From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 70245158004 for ; Wed, 24 Jan 2024 18:59:55 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DE07DE2A71; Wed, 24 Jan 2024 18:59:48 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9C8E0E2A6D for ; Wed, 24 Jan 2024 18:59:48 +0000 (UTC) Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx1.riseup.net (Postfix) with ESMTPS id 4TKtYb4ZvQzDqMh for ; Wed, 24 Jan 2024 18:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1706122787; bh=yW0ZEwJoJaG40OkGXSxEPUnL4C/qYujHzmsaU9xjmZs=; h=Date:From:To:Subject:In-Reply-To:References:From; b=DlB3zCA3ARmLhpUc4sK7ol+QQD7bMqcTIW73PLNJadvnwlBVAVIgg2OSwsq0fVHCt lh1C1m65RS1Yi6/KkkJzKjUfSZH75ipjEJdnmlJ1TlRXg2R984pyXn3OBKP7Ai2oES 0jUPUdwPKds9QAFQEjHwBHM0cdToCMKvdJaYFgig= X-Riseup-User-ID: 7EC916EF9FE806BF68BA6BEE63FC17DB28FA7A86B394526458ABCE9CED61C04A Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4TKtYb2JshzFqgm for ; Wed, 24 Jan 2024 18:59:47 +0000 (UTC) Date: Wed, 24 Jan 2024 10:59:45 -0800 From: orbea To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH] cargo.eclass: add CARGO_TOML_DIR Message-ID: <20240124105945.0bfe1396@Akita> In-Reply-To: <20240123114313.6b51a617@Akita> References: <20240122161434.991554-1-sam@gentoo.org> <20240122193222.7d9a5b0e@Akita> <20240123061347.20781a5d@Akita> <416b1bde323d9616dfb9d97e535b5365587b0a02.camel@gentoo.org> <20240123114313.6b51a617@Akita> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 78a191cf-7381-4051-8b4f-69ddb80a3eb3 X-Archives-Hash: c04cdd3cdc04d63b9ee3e7ead45346a7 On Tue, 23 Jan 2024 11:43:13 -0800 orbea wrote: > On Tue, 23 Jan 2024 17:48:25 +0100 > Micha=C5=82 G=C3=B3rny wrote: >=20 > > On Tue, 2024-01-23 at 06:13 -0800, orbea wrote: =20 > > > On Tue, 23 Jan 2024 04:48:02 +0100 > > > Micha=C5=82 G=C3=B3rny wrote: > > > =20 > > > > On Mon, 2024-01-22 at 19:32 -0800, orbea wrote: =20 > > > > > This is required when cargo_live_src_unpack needs to be find a > > > > > Cargo.toml file in a directory other than ${S} > > > > >=20 > > > > > Signed-off-by: orbea > > > > > --- > > > > > eclass/cargo.eclass | 11 ++++++++++- > > > > > 1 file changed, 10 insertions(+), 1 deletion(-) > > > > >=20 > > > > > diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass > > > > > index 3bdbb5e3ec64..692623382c56 100644 > > > > > --- a/eclass/cargo.eclass > > > > > +++ b/eclass/cargo.eclass > > > > > @@ -116,6 +116,15 @@ ECARGO_VENDOR=3D"${ECARGO_HOME}/gentoo" > > > > > # other src_functions of this eclass. > > > > > # Note that cargo_gen_config is automatically called by > > > > > cargo_src_unpack.=20 > > > > > +# @ECLASS_VARIABLE: CARGO_TOML_DIR > > > > > +# @DEFAULT_UNSET > > > > > +# @DESCRIPTION: > > > > > +# Optional variable containing the directory path to the > > > > > Cargo.toml file. +# Should be defined before calling > > > > > cargo_live_src_unpack. +# > > > > > +# This is required for live ebuilds when Cargo.toml in a > > > > > directory other +# than ${S}. > > > > > + > > > > > # @ECLASS_VARIABLE: myfeatures > > > > > # @DEFAULT_UNSET > > > > > # @DESCRIPTION: > > > > > @@ -403,7 +412,7 @@ cargo_live_src_unpack() { > > > > > umask "${EVCS_UMASK}" || die "Bad options to > > > > > umask: ${EVCS_UMASK}" fi > > > > > =20 > > > > > - pushd "${S}" > /dev/null || die > > > > > + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die > > > > > =20 > > > >=20 > > > > Please respect the current variable style. =20 > > >=20 > > > Sorry for being dense, but could you elaborate what you mean? > > > =20 > >=20 > > You changed '${S}' to '$S' which goes against the established style. > > =20 >=20 > Thanks for spelling that out, I corrected the patch. >=20 > ------------- >=20 > This is required when cargo_live_src_unpack needs to be find a > Cargo.toml file in a directory other than ${S}. This may happen in > cases where the package has a rust component within a subdirectory > where the program otherwise use another language. >=20 > Signed-off-by: orbea > --- > eclass/cargo.eclass | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) >=20 > diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass > index 3bdbb5e3ec64..f88b3b82d8ed 100644 > --- a/eclass/cargo.eclass > +++ b/eclass/cargo.eclass > @@ -116,6 +116,15 @@ ECARGO_VENDOR=3D"${ECARGO_HOME}/gentoo" > # other src_functions of this eclass. > # Note that cargo_gen_config is automatically called by > cargo_src_unpack.=20 > +# @ECLASS_VARIABLE: CARGO_TOML_DIR > +# @DEFAULT_UNSET > +# @DESCRIPTION: > +# Optional variable containing the directory path to the Cargo.toml > file. +# Should be defined before calling cargo_live_src_unpack. > +# > +# This is required for live ebuilds when Cargo.toml in a directory > other +# than ${S}. > + > # @ECLASS_VARIABLE: myfeatures > # @DEFAULT_UNSET > # @DESCRIPTION: > @@ -403,7 +412,7 @@ cargo_live_src_unpack() { > umask "${EVCS_UMASK}" || die "Bad options to umask: > ${EVCS_UMASK}" fi > =20 > - pushd "${S}" > /dev/null || die > + pushd "${CARGO_TOML_DIR:-${S}}" > /dev/null || die > =20 > # Respect user settings before cargo_gen_config is called. > if [[ ! ${CARGO_TERM_COLOR} ]]; then On second thought maybe this patch is not necessary? A trivial workaround is to just set ${S} for cargo_live_src_unpack, for example... S=3D"${S}"/path/to/rust/dir \ cargo_live_src_unpack Would this be something that is future proof or is it better to have a dedicated variable to handle it?