From patchwork Mon Nov 8 16:52:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 47223 X-Patchwork-Delegate: dj@redhat.com Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B5E89385842E for ; Mon, 8 Nov 2021 16:53:24 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by sourceware.org (Postfix) with ESMTPS id 18CF73858D3C for ; Mon, 8 Nov 2021 16:53:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 18CF73858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=denx.de Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9655A83257; Mon, 8 Nov 2021 17:53:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1636390390; bh=CZZj43ROiAGkdUt5lyZCeyEwDiQUtjJuvmKq1lVqmQs=; h=From:To:Cc:Subject:Date:From; b=eFyAKsiSiPPvWOZtOJbRdalQI+FLmmiUGxuzGqI7vo70TD9qYasmlOILQoiaWDqtx vjhDWZzz3dCj8AzqlvNRSiU7dZG9eybU7+MAg9V+BL6jf7lgGcQ2/AduyvCLw5B2rs RjsTv8gFZuS5h85diTm0fZo7Yxt/03J8dYqGEEMwIM0sbg0zgYIdMr0QI18Grgfpsv TxATGmBiVcKVkebHSFS0GbCEWQoVOZjUWTvgd9e0iCuHYyUHXvjg8TJqEKUBLwgLNY mjB0ct2gLiHQe7Rr/LXEIPD5cyEL8FF53Igyl1K1r0pF/C/XzxsYjeRGLADpH6JbJZ 9AgLjR4OUEbmg== From: Lukasz Majewski To: Joseph Myers Subject: [PATCH] ci: Check for necessary Debian packages when running build-many-glibcs.py Date: Mon, 8 Nov 2021 17:52:55 +0100 Message-Id: <20211108165255.15600-1-lukma@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Weimer , libc-alpha , Andreas Schwab Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The build-many-glibc.py can be run on a 'vanila' Debian distribution (as for example in docker container), which don't have by default installed some packages (like flex). This causes build break at late stage of the full build; ../src/scripts/build-many-glibcs.py . checkout --replace-sources && ../src/scripts/build-many-glibcs.py . host-libraries && ../src/scripts/build-many-glibcs.py . compilers && ../src/scripts/build-many-glibcs.py . glibcs To avoid such situation, this check has been added to inform user early of required (and missing) Debian packages. The same approach (with using the 'distro' python module) can be applied to Fedora or Suse. Signed-off-by: Lukasz Majewski Reviewed-by: Adhemerval Zanella --- scripts/build-many-glibcs.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index 6046048b75..b7aedf304f 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -54,6 +54,7 @@ import subprocess import sys import time import urllib.request +import distro try: subprocess.run @@ -1852,9 +1853,24 @@ def get_parser(): nargs='*') return parser +def check_os_requirements(): + if distro.id() == "debian" and distro.version() == "10": + # List 'Debian' specific packages requirements (different than + # vanila distro) to run this test without errors. + debian_requirements = ['flex', 'bison', 'dnsutils', 'texinfo'] + import apt + debian_pkgs = apt.Cache() + for pkg in debian_requirements: + if not debian_pkgs[pkg].is_installed: + print(f"error: Debian package: '{pkg}' NOT installed!") + return False + + return True def main(argv): """The main entry point.""" + if not check_os_requirements(): + sys.exit(0) parser = get_parser() opts = parser.parse_args(argv) topdir = os.path.abspath(opts.topdir)