From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 19 12:48:04 2021 Received: (at 49597) by debbugs.gnu.org; 19 Jul 2021 16:48:04 +0000 Received: from localhost ([127.0.0.1]:60150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5WR2-0007dX-AH for submit@debbugs.gnu.org; Mon, 19 Jul 2021 12:48:04 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:56020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5WQz-0007d0-PY for 49597@debbugs.gnu.org; Mon, 19 Jul 2021 12:48:03 -0400 Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d]) by xavier.telenet-ops.be with bizsmtp id X4nz2500P0mfAB4014nzfU; Mon, 19 Jul 2021 18:48:00 +0200 Message-ID: Subject: Re: bug#49597: [PATCH core-updates 00/15] Ajust packages to label-less input style From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Mon, 19 Jul 2021 18:47:54 +0200 In-Reply-To: <87tukqmk73.fsf_-_@gnu.org> References: <20210716155009.32118-1-ludo@gnu.org> <87tukqmk73.fsf_-_@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-5kaCTf7goBG7mCJUUpI2" User-Agent: Evolution 3.34.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1626713280; bh=UUEnYGHRY2C8hIm1vISACpmpDATQYixhBSXTQqLqZpU=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=VhXzJwg1AJ0QFBzatCKcxdyGladNAWZ4LMnqJQoR4GIEg6444bpRQhtVJaNVgn7UX Jlf0nBz5Fk5xKnM2o1Io8HY2fKRrJp1Vads+X//v110UXGuqYRmx+El3RkAWyUZXqm QYUAENP8aKbSuDMHMwxClAmIsB8jjolXUxjNR26xlpaOaS4B3zrUEqvo3PYekIeTOE dvTqZrJR39OAZBFsk2wZGck9qhSDTwXsWOeiB7hE7HxHIRR3NYSDZ8QdOFuTCFKGk2 6KUm0G80qx+Mo8ICTRH1u9vjmZ+5hhIzrjDuaSRWEGw8+8fGEiW4xDf0fLGvWu1V8w pSK6a+jCcHCKw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 49597 Cc: 49597@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-5kaCTf7goBG7mCJUUpI2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op ma 19-07-2021 om 16:50 [+0200]: > [...] >=20 > > In the example you gave, both search-input-file and the original 'strin= g-append' > > and 'assoc-ref' look convenient to me, though the latter more so than t= he other, > > and a third variant could be > >=20 > > #$(file-append (this-package-native-input "openmpi") "/lib/libmpi.so"= ) > >=20 > > which avoids 'string-append' and 'assoc-ref'. >=20 > Yes, but you=E2=80=99re still relying on the name, =E2=80=9Copenmpi=E2=80= =9D. >=20 > If I do: >=20 > (package > (inherit thing) > (inputs `(("mpich" ,mpich) > ,@(delete "openmpi" (package-inputs thing))))) >=20 > =E2=80=A6 then you have a problem: =E2=80=98this-package-input=E2=80=99 w= on=E2=80=99t find =E2=80=9Copenmpi=E2=80=9D. > It=E2=80=99s a real, common use case. That=E2=80=99s why we need to be c= areful about > the idioms we promote. >=20 > WDYT? Then you could do: (package (inherit thing) (inputs `(("openmpi" ,mpich) ; use "openmpi" label ,@(delete "openmpi" (package-inputs thing))))) or just use "mpi" in the original and new package as input label, but that doesn't mesh well with eventually removing input labels. Myself, I don't mind input labels much. They look like arguments to a procedure to me, albeit with an unusual syntax for referring to them. > > (I prefer explicitely writing in the package definition in which input = a file > > will be found, as a kind of documentation, though in this case it proba= bly > > doesn't really matter.) >=20 > Yeah, I like that too. OTOH, =E2=80=98search-input-file=E2=80=99 has the= advantage that > it errors out if the file is not found, whereas >=20 > (string-append (assoc-ref inputs "foo") "bar") >=20 > always =E2=80=9Cworks=E2=80=9D and problems occur possibly much later, at= run time. I'd suggest using #+/#$(file-append (this-package-[native]-input "foo") "/b= ar" instead of (string-append (assoc-ref ...) ...). I think I have a method for explicitely choosing which input to use, using package names instead of labels, that still works nicely with "--with-input": (define* (lookup-libmpi-library package) ;; open-coding could be avoided by adding a 'is-mpi-library?' ;; package property and using that instead of hard-coding a list ;; of package names=20 (file-append (or (lookup-package-input package "openmpi") (lookup-package-input package "mpich") ...) "/lib/libmpi.so")) Greetings, Maxime. --=-5kaCTf7goBG7mCJUUpI2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYPWsuhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7mqgAP0WdTpirVH6nqs23zl7Djhwxi1R A5bOT03pPJIl1v8xxAD+Jyzy1WezpJ3nC9Q+ZWBsUh/PNHFMkXDBVZ1Cf7WRQw0= =b2gw -----END PGP SIGNATURE----- --=-5kaCTf7goBG7mCJUUpI2--