Don't use networking during tests

This commit is contained in:
Mikolaj Izdebski 2020-07-16 16:31:01 +02:00
parent 4604adfdd9
commit cf5965e2dd
7 changed files with 49 additions and 16 deletions

View File

@ -1,7 +1,7 @@
From 760c3e7a568295ded8229b06e651915c78475ccd Mon Sep 17 00:00:00 2001
From 08f57d72cbc458bb39df76f660889eb6c9131579 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 26 Apr 2019 00:50:00 +0200
Subject: [PATCH 1/5] Move python modules under java-utils directory
Subject: [PATCH 1/6] Move python modules under java-utils directory
---
depgenerators/javadoc.req | 3 +++
@ -241,5 +241,5 @@ index 68cb1119..55dfd985 100644
install_maven_artifact)
--
2.25.4
2.26.2

View File

@ -1,7 +1,7 @@
From 48f5467fea8006cf0fe091d28fd879e6aed5a4b1 Mon Sep 17 00:00:00 2001
From f0b7a9c2bc2cc30047e8d41383debc2745371079 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 28 Jun 2019 14:53:26 +0200
Subject: [PATCH 2/5] Enable namespaced dependency generation
Subject: [PATCH 2/6] Enable namespaced dependency generation
---
depgenerators/fileattrs/javadoc.attr | 2 +-
@ -44,5 +44,5 @@ index 7c3ea03d..3ccc8b65 100644
+%__osgi_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))}
%__osgi_path ^(.*\\.jar|((%{_prefix}/lib(64)?|%{_datadir})/.*/META-INF/MANIFEST.MF))$
--
2.25.4
2.26.2

View File

@ -1,7 +1,7 @@
From 0b0f93a4bc050a67e6885a647270a716f3d9cdce Mon Sep 17 00:00:00 2001
From 5fccf686ca538e620231c424989d800df3534f09 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 2 Sep 2019 18:10:01 +0200
Subject: [PATCH 3/5] Fix use of illegal characters in rpmfc generator names
Subject: [PATCH 3/6] Fix use of illegal characters in rpmfc generator names
---
configure-base.sh | 2 +-
@ -63,5 +63,5 @@ index 3ccc8b65..8b0f15f7 100644
+%__osgi@{scl_suffix}_requires_opts --cachedir %{_builddir}/%{?buildsubdir} --rpm-pid %{lua:print(math.floor(posix.getprocessid("pid")))}
+%__osgi@{scl_suffix}_path ^(.*\\.jar|((%{_prefix}/lib(64)?|%{_datadir})/.*/META-INF/MANIFEST.MF))$
--
2.25.4
2.26.2

View File

@ -1,7 +1,7 @@
From f13279da55e61045c8334b40c1fa39c466fdf24c Mon Sep 17 00:00:00 2001
From d95ecd520fef469dd40d8fa54955928b82fd30ce Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Sat, 29 Jun 2019 12:09:25 +0200
Subject: [PATCH 4/5] Skip execution of various Maven plugins
Subject: [PATCH 4/6] Skip execution of various Maven plugins
Resolves: #70
---
@ -77,5 +77,5 @@ index b6288fea..4431f25e 100644
<metadataRepositories>
<repository>/usr/share/maven-metadata</repository>
--
2.25.4
2.26.2

View File

@ -1,7 +1,7 @@
From e5d2b436ed9e01b357a069d1dd6b258fb0b651f3 Mon Sep 17 00:00:00 2001
From 0372ba445718580298dba5e2faaa0946b5313671 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Mon, 18 May 2020 09:11:31 +0200
Subject: [PATCH 5/5] [test] Don't try to kill PID 1 during tests
Subject: [PATCH 5/6] Don't try to kill PID 1 during tests
Normally PID 1 should not be killable, but when running tests in
container this is actually possible.
@ -25,5 +25,5 @@ index 9bdc4675..67370422 100644
try:
shutil.rmtree("/tmp/.javapackages_cache/")
--
2.25.4
2.26.2

View File

@ -0,0 +1,28 @@
From b96e04f0a19c832e2a37e8d6ee3e85e26874b145 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Thu, 16 Jul 2020 16:27:04 +0200
Subject: [PATCH 6/6] [test] Don't use networking during tests
When %_buildhost is not set, RPM will try to call gethostname() and
gethostbyname() to determine it.
---
test/test_rpmbuild.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/test_rpmbuild.py b/test/test_rpmbuild.py
index 8b44fbe9..eebaece2 100644
--- a/test/test_rpmbuild.py
+++ b/test/test_rpmbuild.py
@@ -21,7 +21,8 @@ class Package(object):
"""
def __init__(self, name):
self.__name = name
- self.__macros = [u'%topdir {cwd}/rpmbuild'.format(cwd=os.getcwd())]
+ self.__macros = [u'%topdir {cwd}/rpmbuild'.format(cwd=os.getcwd()),
+ u'%_buildhost testhost']
self.__sources = []
self.__begin = ''
self.__prep = ''
--
2.26.2

View File

@ -24,7 +24,7 @@
Name: javapackages-tools
Version: 5.3.1
Release: 7%{?dist}
Release: 8%{?dist}
Summary: Macros and scripts for Java packaging support
License: BSD
URL: https://github.com/fedora-java/javapackages
@ -40,6 +40,7 @@ Patch2: 0002-Enable-namespaced-dependency-generation.patch
Patch3: 0003-Fix-use-of-illegal-characters-in-rpmfc-generator-nam.patch
Patch4: 0004-Skip-execution-of-various-Maven-plugins.patch
Patch5: 0005-test-Don-t-try-to-kill-PID-1-during-tests.patch
Patch6: 0006-test-Don-t-use-networking-during-tests.patch
BuildRequires: coreutils
BuildRequires: which
@ -140,6 +141,7 @@ OpenJDK 8 toolchain for XMvn
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
sed -i '/^manpage /d' build
sed -i '/${mandir}/d' install
@ -198,6 +200,9 @@ install -p -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/java/javapackages-config
%{_datadir}/xmvn/conf
%changelog
* Thu Jul 16 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 5.3.1-8
- Don't use networking during tests
* Thu Jan 23 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 5.3.1-7
- Add OpenJDK 8 toolchain configuration