[libvirt PATCH] gitlab: test RPM build in CI jobs

Daniel P. Berrangé posted 1 patch 3 years, 10 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20200619155701.733497-1-berrange@redhat.com
.gitlab-ci.yml | 5 +++++
1 file changed, 5 insertions(+)
[libvirt PATCH] gitlab: test RPM build in CI jobs
Posted by Daniel P. Berrangé 3 years, 10 months ago
We need to test the native and mingw RPM builds, but since the
mingw RPM does both arches at once, we only need to test it
on one of the two mingw jobs.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 .gitlab-ci.yml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index bfb66a652d..e5babfeba2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -63,6 +63,7 @@ stages:
     - cd build
     - ../autogen.sh || (cat config.log && exit 1)
     - $MAKE distcheck
+    - if test -x /usr/bin/rpmbuild && test "$RPM" != "skip" ; then rpmbuild --nodeps -ta libvirt*.tar.xz ; fi
 
 # Extra native build jobs that are only run post-merge, or
 # when code is pushed to a branch with "ci-full-" name prefix
@@ -111,6 +112,8 @@ stages:
     - cd build
     - ../autogen.sh $CONFIGURE_OPTS || (cat config.log && exit 1)
     - $MAKE
+    - if test -x /usr/bin/rpmbuild && "$RPM" != "skip"; then $MAKE dist ; fi
+    - if test -x /usr/bin/rpmbuild && "$RPM" != "skip"; then rpmbuild --nodeps -ta --define "_sourcedir `pwd`" mingw-libvirt.spec ; fi
 
 # Extra cross build jobs that are only run post-merge, or
 # when code is pushed to a branch with "ci-full-" name prefix
@@ -378,6 +381,7 @@ x64-opensuse-151:
   <<: *native_build_default_job_definition
   variables:
     NAME: opensuse-151
+    RPM: skip
 
 x64-ubuntu-1804:
   <<: *native_build_extra_job_definition
@@ -461,6 +465,7 @@ mingw32-fedora-rawhide:
   variables:
     NAME: fedora-rawhide
     CROSS: mingw32
+    RPM: skip
 
 mingw64-fedora-rawhide:
   <<: *cross_build_default_job_definition
-- 
2.26.2

Re: [libvirt PATCH] gitlab: test RPM build in CI jobs
Posted by Andrea Bolognani 3 years, 10 months ago
On Fri, 2020-06-19 at 16:57 +0100, Daniel P. Berrangé wrote:
> @@ -111,6 +112,8 @@ stages:
>      - cd build
>      - ../autogen.sh $CONFIGURE_OPTS || (cat config.log && exit 1)
>      - $MAKE
> +    - if test -x /usr/bin/rpmbuild && "$RPM" != "skip"; then $MAKE dist ; fi
> +    - if test -x /usr/bin/rpmbuild && "$RPM" != "skip"; then rpmbuild --nodeps -ta --define "_sourcedir `pwd`" mingw-libvirt.spec ; fi

This will not work for a few reasons:

* you forgot "test" in the second part of the if condition, so the
  shell will tell you either

    skip: command not found

  or

    : command not found

  and not actually run rpmbuild;

* you're using '-ta', but since the argument you're passing to
  rpmbuild in this case is not a tarball, you'll get

    error: Failed to read spec file from mingw-libvirt.spec

  I believe you need to use '-ba' instead;

* as you mention in the commit message, the spec file is set up to
  build both mingw32 and mingw64 RPMs, but each of the cross-build
  containers only has dependencies for the corresponding
  architecture, so the build will fail anyway.

This last one is the only one that's not trivially addressed.

The standard RPM macros for MinGW already have built-in support for
only building one of the two variants of the packages[1], but our
mingw.spec files are not prepared for it: if I try to build, for
example, libvirt-glib with

  $ rpmbuild --define "_sourcedir $PWD" \
             --define "mingw_build_win32 0" \
             -ba mingw-libvirt-glib.spec

it eventually fails because, unsurprisingly, it can't find some
mingw32 files. So we need to change all our mingw.spec files to
support this properly before we can enable MinGW RPM build jobs.

Since that's a bunch of extra work, and we never had MinGW RPM
build jobs on CentOS CI, I suggest we skip that for now: let's
focus on getting all projects on GitLab CI with more or less the
same set of build jobs they had on CentOS CI, and once we've done
that we can go back and add extra features such as MinGW RPMs.

Does that sound reasonable?


[1] https://fedoraproject.org/wiki/Packaging:MinGW#Build_for_multiple_targets
-- 
Andrea Bolognani / Red Hat / Virtualization