From nobody Mon Feb 9 10:27:48 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1619190483; cv=none; d=zohomail.com; s=zohoarc; b=lMJum6vmC0y9nPEuV0QCBKCkP7eMhmhIisvzbSeBvuqK0T4kPmdwkRfzyicaxSIXsAEi9y4BtAkM0CcKGCwIWEf5GylzZS9TmZG9LGv7+7qoJZmfDpTTRTH8aLKbZJ/AUZgDnMo33NV2+GIogAlGPjlOzVs8r/TN4KomZFvvCUg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619190483; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Wh7W14+lL2aItF9e9ltMszoMjjBBYgJipGXLF15uc4I=; b=cO0aZ9UcTL8lTjwWYaov7+AOujXCxerwp3POCwyt0nMx3mckV7gnu1MZ9WRM7/7bPINsbsFOwRPBmvCG59R4M8CQ5eP1Y/eV6T97hKhLG1fz5/MZ1AiPNoSNR/NmM5YPC/7LEKgJaFRh3DjABf9X6DyRLh1iviANWNS0tWtQV/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1619190483912345.7432706116025; Fri, 23 Apr 2021 08:08:03 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-RoAz2trhOkuFE8td6YB8LA-1; Fri, 23 Apr 2021 11:08:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5C602802575; Fri, 23 Apr 2021 15:07:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3EB9B60854; Fri, 23 Apr 2021 15:07:55 +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 0AA771806D1D; Fri, 23 Apr 2021 15:07:55 +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 13NF3IMh031684 for ; Fri, 23 Apr 2021 11:03:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id B763F10027A5; Fri, 23 Apr 2021 15:03:18 +0000 (UTC) Received: from harajuku.usersys.redhat.com (unknown [10.40.195.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 152FB10016DB for ; Fri, 23 Apr 2021 15:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619190482; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Wh7W14+lL2aItF9e9ltMszoMjjBBYgJipGXLF15uc4I=; b=QDhbNQybsOAov8RVoDHFOdc1bPH787+wbJ1zofwoxUaXpJ/mhGtdE0vv/jRq+YJhVZctbw Zu1cmAYtw8AXuY/ECnLg9tqgPTtQPXRWTHvt9rKR962X1CHoa6R6CuYfWDfQ08+DhBJUsa I7SdLm24cD+dNj/S0WrHBYELh1reqgE= X-MC-Unique: RoAz2trhOkuFE8td6YB8LA-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 02/11] ci: util: Replace get_image_distro() with get_image_info() Date: Fri, 23 Apr 2021 17:02:59 +0200 Message-Id: <20210423150308.346189-3-abologna@redhat.com> In-Reply-To: <20210423150308.346189-1-abologna@redhat.com> References: <20210423150308.346189-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This is a more flexible function that parses the name of the container image into its components: distro name and, where applicable, target architecture for cross-building. Signed-off-by: Andrea Bolognani --- ci/util.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/ci/util.py b/ci/util.py index 304d0d4af8..e4e0955098 100644 --- a/ci/util.py +++ b/ci/util.py @@ -39,24 +39,32 @@ def get_registry_images(uri: str) -> List[Dict]: return json.loads(r.read().decode()) =20 =20 -def get_image_distro(image_name: str) -> str: +def get_image_info(image_name: str) -> Dict[str, str]: """ - Extract the name of the distro in the GitLab image registry name, e.g. - ci-debian-9-cross-mipsel --> debian-9 + Extract information about the image from its name, e.g. + + "ci-debian-9-cross-mipsel" + =3D> { "distro": "debian-9", "cross": "mipsel" } + + "ci-centos-8" + =3D> { "distro": "centos-8", "cross": None } =20 :param image_name: name of the GitLab registry image - :return: distro name as a string + :return: image information """ - name_prefix =3D "ci-" - name_suffix =3D "-cross-" + distro_prefix =3D "ci-" + cross_prefix =3D "-cross-" =20 - distro =3D image_name[len(name_prefix):] + distro =3D image_name[len(distro_prefix):] =20 - index =3D distro.find(name_suffix) - if index > 0: - distro =3D distro[:index] + cross_index =3D distro.find(cross_prefix) + if cross_index > 0: + cross =3D distro[cross_index + len(cross_prefix):] + distro =3D distro[:cross_index] + else: + cross =3D None =20 - return distro + return {"distro": distro, "cross": cross} =20 =20 def get_registry_stale_images(registry_uri: str, @@ -74,7 +82,8 @@ def get_registry_stale_images(registry_uri: str, =20 stale_images =3D {} for img in images: - if get_image_distro(img["name"]) not in supported_distros: + info =3D get_image_info(img["name"]) + if info["distro"] not in supported_distros: stale_images[img["name"]] =3D img["id"] =20 return stale_images --=20 2.26.3