From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) by sourceware.org (Postfix) with ESMTPS id A9BB33858D20 for ; Mon, 5 Jun 2023 20:42:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A9BB33858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x229.google.com with SMTP id 5614622812f47-38eb2984c82so2168061b6e.0 for ; Mon, 05 Jun 2023 13:42:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685997765; x=1688589765; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=9gudR1UGay3bVfpgbSfu/TCWCReYZHqmIVIy0sFD44s=; b=tuzkl1z4NqVfEVL80g8YIHUSjeYZz7eudAN+IHk8WokKqneA8PUJAXmgasBR5b6j/Z 1Qm/T4aBXiJcHMlACZWXQSJIypOTU4nlx/GdfwcB6TEDjM0ARML6NUqpZc2rQk1qCgKP DVC3Bj7z65af2xQPQxAfyRKLG2Vvm/WwR8MBwNIx7uVttJNB1wOtiLCdS81rF+Q3qC3l gCvSRqkphVWKeODgY/rS5io+8/uIVFVqNR+aXjCjyd0r7VBLjPj8MZjrDhSNn0f7YM24 u86acP2l3IYSArTx3d6RkeF5KavSjyvO6BFR7SYAL8hLtDgdjGdWoG5uPg4S+cXpFwdx Jeeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685997765; x=1688589765; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9gudR1UGay3bVfpgbSfu/TCWCReYZHqmIVIy0sFD44s=; b=jAraIZxj5KQeRVtiyT6TJ8Z8zkGpuX+n2rCLKkKVJcVTHkyhGmPdLkaAIOMocaM7O3 SHG4ef7RBg4vLFnObDoY0qcm8jCtE67PHpIH8wYXSPVGeseqL4ZOq4/o+B+DTkwGV0n+ 1R7WW6BcHJ7cKPGKlByf7T5DJj9AyRu9Yn2Jy7CvkuPNpT46Tk8xyWva+w09beXXmq/N vQU3AvGTesMGPKLIdj4L3A9lRjj+bWmC7NGNv/U603B0miE2y6cwr9X+EBCXtRQdN0Nu DSMuw4Mh+6hGjyrzcXehwQE8eXE/Ff4pQiitsOXBVmKOIdluJoV7d/csjvFdGOaSvjtE q1PQ== X-Gm-Message-State: AC+VfDza/jlY8cDK5dElGymuUHRl7Vs+z0iU1SWbpVT6OOoz3wZGH+5U 5hdjdq1dOAQyonHzjXDIKGKtcA== X-Google-Smtp-Source: ACHHUZ5Qe2KUbe961OB8HCWhoQqLEVd6vCYx0QV3P4pC+x2GQuWtjpwWHuQu7VqXeCXKiKYmXLBPOQ== X-Received: by 2002:a05:6808:28d:b0:396:4bbc:9a36 with SMTP id z13-20020a056808028d00b003964bbc9a36mr4616743oic.19.1685997764901; Mon, 05 Jun 2023 13:42:44 -0700 (PDT) Received: from ?IPV6:2804:1b3:a7c1:fe49:680c:a97a:ffe6:9a8f? ([2804:1b3:a7c1:fe49:680c:a97a:ffe6:9a8f]) by smtp.gmail.com with ESMTPSA id v6-20020a056808004600b003896e31867esm3611355oic.49.2023.06.05.13.42.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jun 2023 13:42:44 -0700 (PDT) Message-ID: Date: Mon, 5 Jun 2023 17:42:41 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH] ci: Check for necessary Debian packages when running build-many-glibcs.py Content-Language: en-US To: DJ Delorie , Lukasz Majewski Cc: fweimer@redhat.com, libc-alpha@sourceware.org, schwab@linux-m68k.org, joseph@codesourcery.com References: From: Adhemerval Zanella Netto Organization: Linaro In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 26/05/23 19:12, DJ Delorie wrote: > > [working my way through old patches ;-] > > https://patchwork.sourceware.org/project/glibc/patch/20211108165255.15600-1-lukma@denx.de/ > https://patchwork.sourceware.org/project/glibc/patch/20211108201931.17159-1-lukma@denx.de/ > > Lukasz Majewski writes: >> I thought that the above code is so different from mine, that you would >> like to prepare patch for it? > > How about something like this? I filled out Adhemerval's sample code > with some error checking, added some user messages, and ended up with > the attached. I split it up so that the *list* of required tools is at > the beginning of the file (easily findable) but the *code* to handle it > is near the end. > > I also thought of adding two more columns to the required_tools table, > one with common RPM package names, and one with common DEB package > names. This would purely be for convenience, although I assume most bmg > users know how to find which package an executable is in. Might be > trickier for libraries, if we add "required libraries" to the list > later. > > I also considered moving the minimum-version list to the beginning, to > make it easier to find, but decided that should be separate. The patch organization sounds good to me, thanks for working on this. > > > diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py > index 95726c4a29..0f35c62b7a 100755 > --- a/scripts/build-many-glibcs.py > +++ b/scripts/build-many-glibcs.py > @@ -56,6 +56,20 @@ import sys > import time > import urllib.request > > +def get_list_of_required_tools(): > + global REQUIRED_TOOLS > + REQUIRED_TOOLS = { > + 'awk' : (get_version_awk, (3,1,2)), > + 'bison' : (get_version, (2,7)), > + 'flex' : (get_version, (2,6,0)), > + 'git' : (get_version, (2,32)), > + 'make' : (get_version, (4,0)), > + 'makeinfo' : (get_version, (4,7)), > + 'patch' : (get_version, (2,7,0)), > + 'sed' : (get_version, (3,2)), > + 'tar' : (get_version, (1,3,4)), The script untar gz, bz2, and xz files, should it check for the associated tools as well? > + } > + > try: > subprocess.run > except: > @@ -1865,8 +1879,66 @@ def get_parser(): > return parser > > > +def get_version_common(progname,line,word,delchars): > + try: > + out = subprocess.run([progname, '--version'], > + stdout=subprocess.PIPE, > + stderr=subprocess.DEVNULL, > + check=True, universal_newlines=True).stdout > + v = out.splitlines()[line].split()[word] > + if delchars: > + v = v.replace(delchars,'') > + return [int(x) for x in v.split('.')] > + except: > + return 'missing'; > + > +def get_version(progname): > + return get_version_common (progname, 0, -1, None); > + > +def get_version_awk(progname): > + return get_version_common (progname, 0, 2, ','); > + > +def check_version(ver, req): > + for v, r in zip(ver, req): > + if v > r: > + return True > + if v < r: > + return False > + return True > + > +def version_str(ver): > + return '.'.join([str (x) for x in ver]) > + > +def check_for_required_tools(): > + get_list_of_required_tools() > + count_old_tools = 0 > + count_missing_tools = 0 > + > + for k, v in REQUIRED_TOOLS.items(): > + version = v[0](k) > + if version == 'missing': > + ok = 'missing' > + else: > + ok = 'ok' if check_version (version, v[1]) else 'old' > + if ok == 'old': > + if count_old_tools == 0: > + print("One or more required tools are too old:") > + count_old_tools = count_old_tools + 1 > + print('{:9}: {:3} (obtained=\"{}\" required=\"{}\")'.format(k, ok, > + version_str(version), version_str(v[1]))) > + if ok == 'missing': > + if count_missing_tools == 0: > + print("One or more required tools are missing:") > + count_missing_tools = count_missing_tools + 1 > + print('{:9}: {:3} (required=\"{}\")'.format(k, ok, > + version_str(v[1]))) > + > + if count_old_tools > 0 or count_missing_tools > 0: > + exit (1); > + > def main(argv): > """The main entry point.""" > + check_for_required_tools(); > parser = get_parser() > opts = parser.parse_args(argv) > topdir = os.path.abspath(opts.topdir) >