From nobody Sat Feb 7 09:37:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1551369214079814.7939038249567; Thu, 28 Feb 2019 07:53:34 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 07735C9438; Thu, 28 Feb 2019 15:53:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C89701001DF7; Thu, 28 Feb 2019 15:53:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 81EBC4ED28; Thu, 28 Feb 2019 15:53:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x1SFrU51006339 for ; Thu, 28 Feb 2019 10:53:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id E78261001DFA; Thu, 28 Feb 2019 15:53:30 +0000 (UTC) Received: from dhcp-17-75.lcy.redhat.com (unknown [10.42.17.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60E951001DF2; Thu, 28 Feb 2019 15:53:30 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Thu, 28 Feb 2019 15:53:16 +0000 Message-Id: <20190228155319.18373-2-berrange@redhat.com> In-Reply-To: <20190228155319.18373-1-berrange@redhat.com> References: <20190228155319.18373-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [jenkins-ci PATCH v6 1/4] mappings: extend mapping to allow per-arch entries X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 28 Feb 2019 15:53:32 +0000 (UTC) For example to prevent Xen being installed on any s390x xen: deb: libxen-dev Fedora: xen-devel s390x-default: Or the inverse to only install Xen on x86_64 on Debian, but allow it on all archs on Fedora xen: Fedora: xen-devel x86_64-deb: libxen-dev Note that the architecture specific matches are considered after all the non-architcture matches. The dockerfile generator is updated to apply arch filtering based on the host arch. The ansible playbook is not actually implementing support for non-x86_64 architectures in this commit. It is just hardcoding x86_64, which is enough to ensure the changes in the mappings.yml file are a no-op initially. Signed-off-by: Daniel P. Berrang=C3=A9 --- guests/lcitool | 16 +++++++++- guests/playbooks/update/tasks/packages.yml | 32 +++++++++++++++++++ guests/vars/mappings.yml | 37 ++++++++++++++++++++-- 3 files changed, 81 insertions(+), 4 deletions(-) diff --git a/guests/lcitool b/guests/lcitool index 88bc945..d762721 100755 --- a/guests/lcitool +++ b/guests/lcitool @@ -20,6 +20,7 @@ import argparse import fnmatch import json import os +import platform import random import string import subprocess @@ -79,6 +80,16 @@ class Util: =20 return sorted(set(matches)) =20 + @staticmethod + def get_native_arch(): + # Same canonicalization as libvirt virArchFromHost + arch =3D platform.machine() + if arch in ["i386", "i486", "i586"]: + arch =3D "i686" + if arch =3D=3D "amd64": + arch =3D "x86_64" + return arch + =20 class Config: =20 @@ -302,6 +313,8 @@ class Application: self._inventory =3D Inventory() self._projects =3D Projects() =20 + self._native_arch =3D Util.get_native_arch() + self._parser =3D argparse.ArgumentParser( conflict_handler=3D"resolve", description=3D"libvirt CI guest management tool", @@ -540,7 +553,8 @@ class Application: ) =20 pkgs =3D {} - keys =3D ["default", package_format, os_name, os_full] + base_keys =3D ["default", package_format, os_name, os_full] + keys =3D base_keys + [self._native_arch + "-" + k for k in base_ke= ys] # We need to add the base project manually here: the standard # machinery hides it because it's an implementation detail for project in projects + ["base"]: diff --git a/guests/playbooks/update/tasks/packages.yml b/guests/playbooks/= update/tasks/packages.yml index 7fdfc45..01d4616 100644 --- a/guests/playbooks/update/tasks/packages.yml +++ b/guests/playbooks/update/tasks/packages.yml @@ -52,6 +52,38 @@ when: - mappings[item][os_name + os_version] is defined =20 +- name: '{{ project }}: Look up mappings (default with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item]["x86_64" + "-" + "defaul= t"] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item]["x86_64" + "-" + "default"] is defined + +- name: '{{ project }}: Look up mappings (package format with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item]["x86_64" + "-" + package= _format] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item]["x86_64" + "-" + package_format] is defined + +- name: '{{ project }}: Look up mappings (OS name with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item]["x86_64" + "-" + os_name= ] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item]["x86_64" + "-" + os_name] is defined + +- name: '{{ project }}: Look up mappings (OS version with arch)' + set_fact: + temp: '{{ temp|combine({ item: mappings[item]["x86_64" + "-" + os_name= + os_version] }) }}' + with_items: + '{{ packages }}' + when: + - mappings[item]["x86_64" + "-" + os_name + os_version] is defined + - set_fact: flattened: [] =20 diff --git a/guests/vars/mappings.yml b/guests/vars/mappings.yml index 8ff2f34..f856cda 100644 --- a/guests/vars/mappings.yml +++ b/guests/vars/mappings.yml @@ -7,9 +7,25 @@ # priority: # # - default -# - package format (deb, pkg, rpm) -# - OS name (CentOS, Debian, Fedora, FreeBSD, Ubuntu) -# - OS version (CentOS7, Debian9, FedoraRawhide, Ubuntu18 and so on) +# - package format +# - OS name +# - OS version +# - arch with default +# - arch with package format +# - arch with OS name +# - arch with OS version +# +# Valid package formats are +# - deb, pkg, rpm +# +# Valid OS names are: +# - CentOS, Debian, Fedora, FreeBSD, Ubuntu +# +# Valid OS versions are: +# - CentOS7, Debian9, FedoraRawhide, Ubuntu18 and so on +# +# The arch specific rules use a prefix "$ARCH-" where $ARCH +# is a libvirt arch name. # # So something like # @@ -27,6 +43,21 @@ # # will result in the 'ccache' package being installed everywhere except # for CentOS, where nothing will be installed. +# +# For example to prevent Xen being installed on any s390x +# +# xen: +# deb: libxen-dev +# Fedora: xen-devel +# s390x-default: +# +# Or the inverse to only install Xen on x86_64 only on debian +# based distros or Fedora +# +# xen: +# x86_64-deb: libxen-dev +# x86_64-Fedora: xen-devel +# =20 mappings: =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list