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

Andrea Bolognani abologna at redhat.com
Wed Jun 24 11:11:23 UTC 2020

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


    : 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

More information about the libvir-list mailing list