[libvirt-jenkins-ci PATCH 0/4] Fixes and improvements to cross-build environments

The first two commits are necessary to build container images that can successfully be used in libosinfo's GitLab CI setup, which is currently not performing MinGW builds because of the issues they address. Andrea Bolognani (4): lcitool: Install dpkg-dev when doing cross-builds on Debian Don't set $PKG_CONFIG_LIBDIR anywhere lcitool: Drop duplicated code lcitool: Don't specify --target in $CONFIGURE_OPTS guests/lcitool | 15 +++------------ guests/playbooks/build/jobs/defaults.yml | 2 -- jenkins/jobs/defaults.yaml | 2 -- 3 files changed, 3 insertions(+), 16 deletions(-) -- 2.24.1

When invoked as $triplet-pkg-config, pkg-config is smart enough to search the paths corresponding to the target architecture; on Debian, however, this currently only works when dpkg-dev is installed, which by default it is not. Work around the issue on our side by installing dpkg-dev explicitly in our cross-building container images. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=952526 Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 1 + 1 file changed, 1 insertion(+) diff --git a/guests/lcitool b/guests/lcitool index 771402e..86416c4 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -811,6 +811,7 @@ class Application: dpkg --add-architecture {cross_arch} && \\ {package_manager} update && \\ {package_manager} dist-upgrade -y && \\ + {package_manager} install --no-install-recommends -y dpkg-dev && \\ {package_manager} install --no-install-recommends -y {cross_pkgs} && \\ {package_manager} autoremove -y && \\ {package_manager} autoclean -y -- 2.24.1

When invoked as $triplet-pkg-config, pkg-config is smart enough to search the paths corresponding to the target architecture, so we don't need to point it to them directly. This works for both MinGW builds and non-x86_64 Linux builds, and avoids the problems that come from setting $PKG_CONFIG_LIBDIR in containers, mainly that you can't use the same container image to perform both native builds and cross builds - something that libosinfo is alreayd doing today in their CI. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 2 -- guests/playbooks/build/jobs/defaults.yml | 2 -- jenkins/jobs/defaults.yaml | 2 -- 3 files changed, 6 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 86416c4..053e46a 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -899,7 +899,6 @@ class Application: ENV ABI "{cross_abi}" ENV CONFIGURE_OPTS "--host={cross_abi} \\ --target={cross_abi}" - ENV PKG_CONFIG_LIBDIR "/usr/lib/{cross_lib}/pkgconfig" """).format(**varmap)) if cross_arch and package_format == "rpm": @@ -907,7 +906,6 @@ class Application: ENV ABI "{cross_abi}" ENV CONFIGURE_OPTS "--host={cross_abi} \\ --target={cross_abi}" - ENV PKG_CONFIG_LIBDIR "/usr/{cross_abi}/sys-root/mingw/lib/pkgconfig:/usr/{cross_abi}/sys-root/mingw/share/pkgconfig" """).format(**varmap)) def _action_dockerfile(self, args): diff --git a/guests/playbooks/build/jobs/defaults.yml b/guests/playbooks/build/jobs/defaults.yml index 65dee78..3d5eaa0 100644 --- a/guests/playbooks/build/jobs/defaults.yml +++ b/guests/playbooks/build/jobs/defaults.yml @@ -37,13 +37,11 @@ strip_buildrequires: | mingw32_local_env: | export VIRT_PREFIX="$VIRT_PREFIX/i686-w64-mingw32/sys-root/mingw" export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig" - export PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" mingw32_autogen_args: --host=i686-w64-mingw32 mingw32_meson_args: --cross-file=/usr/share/mingw/toolchain-mingw32.meson mingw64_local_env: | export VIRT_PREFIX="$VIRT_PREFIX/x86_64-w64-mingw32/sys-root/mingw" export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig" - export PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" mingw64_autogen_args: --host=x86_64-w64-mingw32 mingw64_meson_args: --cross-file=/usr/share/mingw/toolchain-mingw64.meson git_urls: diff --git a/jenkins/jobs/defaults.yaml b/jenkins/jobs/defaults.yaml index ec429ed..8e9486d 100644 --- a/jenkins/jobs/defaults.yaml +++ b/jenkins/jobs/defaults.yaml @@ -33,13 +33,11 @@ mingw32_local_env: | export VIRT_PREFIX="$VIRT_PREFIX/i686-w64-mingw32/sys-root/mingw" export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig" - export PKG_CONFIG_LIBDIR="/usr/i686-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/i686-w64-mingw32/sys-root/mingw/share/pkgconfig" mingw32_autogen_args: --host=i686-w64-mingw32 mingw32_meson_args: --cross-file=/usr/share/mingw/toolchain-mingw32.meson mingw64_local_env: | export VIRT_PREFIX="$VIRT_PREFIX/x86_64-w64-mingw32/sys-root/mingw" export PKG_CONFIG_PATH="$VIRT_PREFIX/lib/pkgconfig" - export PKG_CONFIG_LIBDIR="/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig:/usr/x86_64-w64-mingw32/sys-root/mingw/share/pkgconfig" mingw64_autogen_args: --host=x86_64-w64-mingw32 mingw64_meson_args: --cross-file=/usr/share/mingw/toolchain-mingw64.meson git_urls: -- 2.24.1

Now that we no longer set $PKG_CONFIG_LIBDIR, there is no need to have separate code paths for Debian and Fedora. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 053e46a..80e725c 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -894,14 +894,7 @@ class Application: ENV LANG "en_US.UTF-8" """).format(**varmap)) - if cross_arch and package_format == "deb": - sys.stdout.write(textwrap.dedent(""" - ENV ABI "{cross_abi}" - ENV CONFIGURE_OPTS "--host={cross_abi} \\ - --target={cross_abi}" - """).format(**varmap)) - - if cross_arch and package_format == "rpm": + if cross_arch: sys.stdout.write(textwrap.dedent(""" ENV ABI "{cross_abi}" ENV CONFIGURE_OPTS "--host={cross_abi} \\ -- 2.24.1

If --target is not specified, the value of --host will be used, so having both is unnecessary; --target is mostly intended for building toolchains, which we're not doing. In fact, we're already not using --target in either the Jenkins and Ansible build scripts, thus proving that we don't need it. Signed-off-by: Andrea Bolognani <abologna@redhat.com> --- guests/lcitool | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 80e725c..209380a 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -897,8 +897,7 @@ class Application: if cross_arch: sys.stdout.write(textwrap.dedent(""" ENV ABI "{cross_abi}" - ENV CONFIGURE_OPTS "--host={cross_abi} \\ - --target={cross_abi}" + ENV CONFIGURE_OPTS "--host={cross_abi}" """).format(**varmap)) def _action_dockerfile(self, args): -- 2.24.1

On Tue, Feb 25, 2020 at 1:17 PM Andrea Bolognani <abologna@redhat.com> wrote:
The first two commits are necessary to build container images that can successfully be used in libosinfo's GitLab CI setup, which is currently not performing MinGW builds because of the issues they address.
Andrea Bolognani (4): lcitool: Install dpkg-dev when doing cross-builds on Debian Don't set $PKG_CONFIG_LIBDIR anywhere lcitool: Drop duplicated code lcitool: Don't specify --target in $CONFIGURE_OPTS
guests/lcitool | 15 +++------------ guests/playbooks/build/jobs/defaults.yml | 2 -- jenkins/jobs/defaults.yaml | 2 -- 3 files changed, 3 insertions(+), 16 deletions(-)
-- 2.24.1
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
participants (2)
-
Andrea Bolognani
-
Fabiano Fidêncio