From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by sourceware.org (Postfix) with ESMTPS id 6776E3858034 for ; Tue, 9 Nov 2021 15:32:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6776E3858034 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 ktm (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 996C783679; Tue, 9 Nov 2021 16:32:13 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1636471934; bh=nOMVDVJ6Z5w7NQDAwfN8LFG7W6qYuamkEOsNvr7ESVo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Ro6hnFNBoOZsz4pEKka4P9PCSZFCwNabPPvOs0u6zuYuTGz9Jm/u4ne6tYPY1pdfP y//dfKe9vZFiCG+MKYvmbagqOG6YiG8SC/d8wevqonJvZBZ2WXE4m9OghbtBGJFG3q drY0Hff1o631LDXlb+3QatMnj93bdVXNXWHwsqWnpXAQ12L5PqW/wtyAZ9MlS2H9+e jXAklHQch4opFyyvsSxFJsouxbGSzf0R/I5s9bFRJnGFYJoV4FwHi/KNjLocKhym2y +C/fm+qHe3huPfnL5RdobtU41+1Zhqu/cgmEjUyls2s6J7VrQVoEiMK2IrCjcyikBO UkwiMeHynwlWg== Date: Tue, 9 Nov 2021 16:32:06 +0100 From: Lukasz Majewski To: Adhemerval Zanella Cc: Joseph Myers , Florian Weimer , Carlos O'Donell , Andreas Schwab , libc-alpha Subject: Re: [PATCH] ci: Check for necessary Debian packages when running build-many-glibcs.py Message-ID: <20211109163206.326676dc@ktm> In-Reply-To: <019643ba-0363-2911-8b79-583187181622@linaro.org> References: <20211108165255.15600-1-lukma@denx.de> <20211108204439.48a8bf87@ktm> <8ca53888-f0bf-a25f-88b5-d6279235c8c5@linaro.org> <20211109143940.2d6f10d0@ktm> <019643ba-0363-2911-8b79-583187181622@linaro.org> Organization: denx.de X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; boundary="Sig_/ACdOvSXkAidnkP9vmbNAoAJ"; protocol="application/pgp-signature" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: , X-List-Received-Date: Tue, 09 Nov 2021 15:32:17 -0000 --Sig_/ACdOvSXkAidnkP9vmbNAoAJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 9 Nov 2021 10:43:15 -0300 Adhemerval Zanella wrote: > On 09/11/2021 10:39, Lukasz Majewski wrote: > > Hi Adhemerval, > > =20 > >> On 08/11/2021 16:44, Lukasz Majewski wrote: =20 > >>> Hi Adhemerval, > >>> =20 > >>>> On 08/11/2021 13:59, Joseph Myers wrote: =20 > >>>>> On Mon, 8 Nov 2021, Lukasz Majewski wrote: > >>>>> =20 > >>>>>> The same approach (with using the 'distro' python module) can > >>>>>> be applied to Fedora or Suse. =20 > >>>>> > >>>>> That module isn't part of the Python standard library. I don't > >>>>> think we should introduce a dependency on it; rather, any use of > >>>>> it should be appropriately conditional, so the code still runs > >>>>> (without these checks) if the module is unavailable (importing > >>>>> produces an ImportError). > >>>>> > >>>>> In particular, even if the OS Python installation includes that > >>>>> module, the script should work with a separately built copy of > >>>>> Python without any such modules from the OS. =20 > >>>> > >>>> Maybe add a check without tying to any distribution (tool -v and > >>>> some version parsing). =20 > >>> > >>> This would require some extra, work but then we would avoid > >>> 'distro' module as the dependency. =20 > >> > >> I think the work required is that hard, something like: > >> > >> -- > >> import shutil > >> import subprocess > >> > >> def get_version(progname): > >> out =3D subprocess.run([progname, '--version'], > >> stdout=3Dsubprocess.PIPE, check=3DTrue, universal_newlines=3DTrue).std= out > >> return [int(x) for x in > >> out.splitlines()[0].split()[-1].split('.')] > >> > >> def get_version_awk(progname): > >> out =3D subprocess.run([progname, '--version'], > >> stdout=3Dsubprocess.PIPE, check=3DTrue, universal_newlines=3DTrue).std= out > >> version =3D > >> out.splitlines()[0].split()[2].replace(',','').split('.') return > >> [int(x) for x in version] > >> > >> def check_version(ver, req): > >> for v, r in zip(ver, req): > >> if v >=3D r: > >> return True > >> return False > >> > >> def version_str(ver): > >> return '.'.join([str (x) for x in version]) > >> > >> > >> TOOLS=3D{ 'make' : (get_version, (4,0)), > >> 'makeinfo' : (get_version, (4,7)), > >> 'awk' : (get_version_awk, (3,1,2)), > >> 'bison' : (get_version, (2,7)), > >> 'sed' : (get_version, (3,2)), > >> 'flex' : (get_version, (2,6,0)), > >> 'git' : (get_version, (2,32)), > >> 'patch' : (get_version, (2,7,0)), > >> 'tar' : (get_version, (1,3,4))} > >> > >> for k, v in TOOLS.items(): > >> version =3D v[0](k) > >> ok =3D 'ok' if check_version (version, v[1]) else 'old' > >> print('{:9}: {:3} (obtained=3D\"{}\" required=3D\"{}\")'.format(k, > >> ok, version_str(version), version_str(v[1]))) > >> -- =20 > >=20 > > Yes, I think that this approach is the most exhaustive one, so we > > would also check the version of required tools. > >=20 > > LGTM :-) =20 >=20 > Also, please double check the required version (for instance 'git' and > 'patch'). You will also need to add 'perl' and it similar to 'awk', > it emits the version in a GNU manner. I thought that the above code is so different from mine, that you would like to prepare patch for it? Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/ACdOvSXkAidnkP9vmbNAoAJ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAmGKlHYACgkQAR8vZIA0 zr14HAf9FUER0LT0yq7YGfaxo+uDDLzjpwQLC+xGoLJ/rfQiEvqkWZdKg+TlSKeg k7xzJEwqG+DB9Wn+ev5lc+SyTScB0U3RwjnW+jj5Sghwzoi3x4rbs7WE5g7w36GD yJtiSB09lYO/RtKhxwyQpbagFaKFqxqRTKNTWTPJ5UZ2fh0BTaJr8CNDZoJe0qgw Kr6oB/xGw3QEMeMf50LLQ6iYV4siszQul2GECAeDKbvFbYg8fgY50kQTEAmSygX4 gzOh3iZ3TDa+SxtF/WdQb16NEpeu0MC/YczCU1CJgJ8yjjLBmU0I9KOE+Ljh0CjQ tRxvWBvgTtHuzT3Go+6BLyD5gUaM9Q== =ijDw -----END PGP SIGNATURE----- --Sig_/ACdOvSXkAidnkP9vmbNAoAJ--