• Re: [gentoo-dev] [PATCH] cargo.eclass: add CARGO_TOML_DIR

    From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to orbea on Tue Jan 23 04:50:01 2024
    On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a
    Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.

    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die

    Please respect the current variable style.


    # Respect user settings before cargo_gen_config is called.
    if [[ ! ${CARGO_TERM_COLOR} ]]; then

    --
    Best regards,
    Michał Górny


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmWvNvISHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOGooH+wdisUVBnGCK1uLQpfySjvFSngawXLIn RncEyIDU9+yfGz8dAU4xpRtxnPvSynMikOj76Sd840Rg2u8xUQTLcIP0TmuXtBm1 Uv14MuUKyVkaatWXD4nwt8sVFkotEfGxucNTWGRPk4D5KcG9TvF056JN8uEGZE14 VG2lozuPqgRW6NzM/Jrm2Ym1uU368QuuLdHBGWQo9eL/JU8se2BShuBAkMys28rR UL0ZDGn8eOFZGnk6XS36xbBeYIrp7n7kr7agrxtYcf1rI0VflLswrmj4vcLRq+us xv3aSs6eVB8daDEcCxahUQOfJkCcNjBW692Ea5qt2NhZtrzO3eWNOfA=
    =ZdS+
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From orbea@21:1/5 to All on Tue Jan 23 04:40:01 2024
    This is required when cargo_live_src_unpack needs to be find a
    Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.

    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die

    # Res
  • From orbea@21:1/5 to Eli Schwartz on Tue Jan 23 15:20:01 2024
    On Mon, 22 Jan 2024 23:06:35 -0500
    Eli Schwartz <eschwartz93@gmail.com> wrote:

    On 1/22/24 10:32 PM, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a
    Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---


    Fairly confused why this email was posted to an existing thread
    instead of a new one?

    Anyway, I'm sure the change is very reasonable but it is difficult to
    tell from an outside perspective just by reading the commit message --
    which doesn't detail why your Cargo.toml would be in a directory other
    than the one src_compile() starts off in.



    My mistake in composing the e-mail in why it was posted to an existing
    thread.

    The program in question is:

    https://github.com/Rosalie241/RMG

    Which has an optional rust plugin.

    https://github.com/Rosalie241/RMG/tree/master/Source/3rdParty/mupen64plus-input-gca

    It seems impossible to support a live ebuild unless
    cargo_live_src_unpack knows where to look.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From orbea@21:1/5 to mgorny@gentoo.org on Tue Jan 23 15:20:01 2024
    On Tue, 23 Jan 2024 04:48:02 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a
    Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by
    cargo_src_unpack.
    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die

    Please respect the current variable style.

    Sorry for being dense, but could you elaborate what you mean?



    # Respect user settings before cargo_gen_config is called.
    if [[ ! ${CARGO_TERM_COLOR} ]]; then


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to orbea on Tue Jan 23 17:50:01 2024
    On Tue, 2024-01-23 at 06:13 -0800, orbea wrote:
    On Tue, 23 Jan 2024 04:48:02 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a
    Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.
    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die

    Please respect the current variable style.

    Sorry for being dense, but could you elaborate what you mean?


    You changed '${S}' to '$S' which goes against the established style.

    --
    Best regards,
    Michał Górny


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmWv7dkSHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOM3wH/R/4A6Nu7zNFXL5ISjRkpG7x47NzgFSw doaVZxgKkZkR4/Piihj0A5PiNChYyfJjTSrcCp/eQR5Zw8yO3wPDyqOUcMqmycDb cfj1YhFWtFVw6zPaf5G//hiGWrcVuHOs2m+yEWvX36q2ebpbg4O4lxg5owEuRHWn qmWn7ZtXpdv03wPMGH5mqwZ+fULQklq5cRTod5+djHBWLRD0UnZc0nvtN/kM4BUp r4AKkyFo1RO8hSrDBTPfLIcgE7sN4po4NCxOm8nGySk6Xq0/hJh1rnFlexplMnPq HiNS/CDVNyHgMhRXsbAx87IPS+5t5m7uf7+ZM+99cxxWQGwPlddpcvs=
    =ITI6
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From orbea@21:1/5 to mgorny@gentoo.org on Tue Jan 23 20:50:01 2024
    On Tue, 23 Jan 2024 17:48:25 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Tue, 2024-01-23 at 06:13 -0800, orbea wrote:
    On Tue, 23 Jan 2024 04:48:02 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.
    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die

    Please respect the current variable style.

    Sorry for being dense, but could you elaborate what you mean?


    You changed '${S}' to '$S' which goes against the established style.


    Thanks for spelling that out, I corrected the patch.

    -------------

    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.

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.

    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-${S}}" > /dev/null || die
  • From orbea@21:1/5 to orbea on Wed Jan 24 20:00:02 2024
    On Tue, 23 Jan 2024 11:43:13 -0800
    orbea <orbea@riseup.net> wrote:

    On Tue, 23 Jan 2024 17:48:25 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Tue, 2024-01-23 at 06:13 -0800, orbea wrote:
    On Tue, 23 Jan 2024 04:48:02 +0100
    Michał Górny <mgorny@gentoo.org> wrote:

    On Mon, 2024-01-22 at 19:32 -0800, orbea wrote:
    This is required when cargo_live_src_unpack needs to be find a Cargo.toml file in a directory other than ${S}

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by cargo_src_unpack.
    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-$S}" > /dev/null || die


    Please respect the current variable style.

    Sorry for being dense, but could you elaborate what you mean?


    You changed '${S}' to '$S' which goes against the established style.


    Thanks for spelling that out, I corrected the patch.

    -------------

    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.

    Signed-off-by: orbea <orbea@riseup.net>
    ---
    eclass/cargo.eclass | 11 ++++++++++-
    1 file changed, 10 insertions(+), 1 deletion(-)

    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="${ECARGO_HOME}/gentoo"
    # other src_functions of this eclass.
    # Note that cargo_gen_config is automatically called by
    cargo_src_unpack.
    +# @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

    - pushd "${S}" > /dev/null || die
    + pushd "${CARGO_TOML_DIR:-${S}}" > /dev/null || die

    # 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="${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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)