There's no harm in attempting to strip more BuildRequires
than are present in a spec file, so define a shell snippet
we can reuse for the the purpose without duplicating the
same lines all over the place.

Signed-off-by: Andrea Bolognani <abolo...@redhat.com>
---
 jobs/autotools.yaml        | 4 +---
 jobs/defaults.yaml         | 7 +++++++
 jobs/perl-modulebuild.yaml | 4 +---
 jobs/python-distutils.yaml | 2 +-
 projects/osinfo-db.yaml    | 2 +-
 5 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/jobs/autotools.yaml b/jobs/autotools.yaml
index ebf5bd8..f8a7e87 100644
--- a/jobs/autotools.yaml
+++ b/jobs/autotools.yaml
@@ -167,9 +167,7 @@
           {global_env}
           {local_env}
           cd build
-          sed -i -e 's/BuildRequires: *osinfo-db.*//' *.spec*
-          sed -i -e 's/BuildRequires: *libvirt.*devel.*//' *.spec*
-          sed -i -e 's/BuildRequires: *pkgconfig(libvirt.*).*//' *.spec*
+          {strip_buildrequires}
           rm -f *.tar.{archive_format}
           $MAKE dist
           rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta 
*.tar.{archive_format}
diff --git a/jobs/defaults.yaml b/jobs/defaults.yaml
index eb04f32..e4d1f2c 100644
--- a/jobs/defaults.yaml
+++ b/jobs/defaults.yaml
@@ -23,6 +23,13 @@
     archive_format: gz
     global_env: |
     local_env: |
+    strip_buildrequires: |
+      sed -i -e 's/BuildRequires: *libvirt.*devel.*//' *.spec*
+      sed -i -e 's/BuildRequires: *osinfo-db-tools.*//' *.spec*
+      sed -i -e 's/BuildRequires: *osinfo-db.*//' *.spec*
+      sed -i -e 's/BuildRequires: *perl(Sys::Virt).*//' *.spec*
+      sed -i -e 's/BuildRequires: *perl-Sys-Virt.*//' *.spec*
+      sed -i -e 's/BuildRequires: *pkgconfig(libvirt.*).*//' *.spec*
     mingw32_local_env: |
       export VIRT_PREFIX="$VIRT_PREFIX/i686-w64-mingw32/sys-root/mingw"
       export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig"
diff --git a/jobs/perl-modulebuild.yaml b/jobs/perl-modulebuild.yaml
index 93f7054..8b30d7e 100644
--- a/jobs/perl-modulebuild.yaml
+++ b/jobs/perl-modulebuild.yaml
@@ -121,9 +121,7 @@
       - shell: |
           {global_env}
           {local_env}
-          sed -i -e 's/BuildRequires: *perl-Sys-Virt.*//' *.spec*
-          sed -i -e 's/BuildRequires: *perl(Sys::Virt).*//' *.spec*
-          sed -i -e 's/BuildRequires: *libvirt.*devel.*//' *.spec*
+          {strip_buildrequires}
           rm -f *.tar.{archive_format}
           perl Build dist
           rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta 
*.tar.{archive_format}
diff --git a/jobs/python-distutils.yaml b/jobs/python-distutils.yaml
index 2cdf25b..eae5b6f 100644
--- a/jobs/python-distutils.yaml
+++ b/jobs/python-distutils.yaml
@@ -121,7 +121,7 @@
       - shell: |
           {global_env}
           {local_env}
-          sed -i -e 's/BuildRequires: *libvirt.*devel.*//' *.spec*
+          {strip_buildrequires}
           rm -f dist/*.tar.{{ archive_format }}
           $PYTHON ./setup.py sdist
           rpmbuild --clean --define "_topdir `pwd`/rpmbuild" -ta dist/*.tar.{{ 
archive_format }}
diff --git a/projects/osinfo-db.yaml b/projects/osinfo-db.yaml
index b8b609e..7ee84a3 100644
--- a/projects/osinfo-db.yaml
+++ b/projects/osinfo-db.yaml
@@ -19,5 +19,5 @@
           parent_jobs: 'osinfo-db-master-check'
           machines: '{rpm_machines}'
           command: |
-            sed -i -e 's/BuildRequires: *osinfo-db-tools.*//' *.spec*
+            {strip_buildrequires}
             rpmbuild --clean --define "_topdir `pwd`/rpmbuild" --define 
"_sourcedir `pwd`" -ba osinfo-db.spec
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to