• [gentoo-dev] [PATCH 1/7] eclass/nuget.eclass: introduce new eclass

    From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:40:02 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/nuget.eclass | 192 ++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 192 insertions(+)
    create mode 100644 eclass/nuget.eclass

    diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
    new file mode 100644
    index 0000000000..cbc9bae4a1
    --- /dev/null
    +++ b/eclass/nuget.eclass
    @@ -0,0 +1,192 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: nuget.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @BLURB: common functions and variables for handling .NET NuGets
    +# @DESCRIPTION:
    +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files. +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
  • From Sam James@21:1/5 to [email protected] on Sun Jul 16 14:50:01 2023
    Maciej Barć <[email protected]> writes:

    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---

    First, thank you to you & navi for working on this. It's long overdue.

    Left some small comments below.

    eclass/nuget.eclass | 192 ++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 192 insertions(+)
    create mode 100644 eclass/nuget.eclass

    diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
    new file mode 100644
    index 0000000000..cbc9bae4a1
    --- /dev/null
    +++ b/eclass/nuget.eclass
    @@ -0,0 +1,192 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: nuget.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @BLURB: common functions and variables for handling .NET NuGets
    +# @DESCRIPTION:
    +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
    +if [[ -z ${_NUGET_ECLASS} ]] ; then
    +_NUGET_ECLASS=1
    +
    +# @ECLASS_VARIABLE: SYSTEM_NUGETS
    +# @DESCRIPTION:
    +# Location of the system NuGet packages directory. +SYSTEM_NUGETS=/opt/dotnet-nugets
    +

    Not to bikeshed too hard, but wonder if this should be another
    directory.

    +# @ECLASS_VARIABLE: NUGET_APIS
    +# @DESCRIPTION:
    +# NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads.
    +# Set or append to this variable post-inherit, but before calling
    +# the "nuget_uris" function, preferably just before "SRC_URI".

    Is there a reason we don't just mandate this per-inherit? Feels like
    it'd be cleaner there.

    +#
    +# Example:
    +# @CODE
    +# SRC_URI="https://example.com/example.tar.xz"
    +# NUGET_APIS+=( "https://api.nuget.org/v3-flatcontainer" )
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +NUGET_APIS=( "https://api.nuget.org/v3-flatcontainer" )
    +
    +# @ECLASS_VARIABLE: NUGET_PACKAGES
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# Path from where NuGets will be restored from.
    +# Defaults to ${T}/nugets for use with "nuget_uris" but may be set to a custom
    +# location to, for example, restore NuGets extracted form a prepared archive.
    +# Do not set this variable in conjunction with non-empty "NUGETS".
    +if [[ "${NUGETS}" ]] || [[ ! "${NUGET_PACKAGES}" ]] ; then
    + NUGET_PACKAGES="${T}"/nugets
    +fi
    +export NUGET_PACKAGES
    +
    +# @ECLASS_VARIABLE: NUGETS
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# String containing all NuGet packages that need to be downloaded.
    +# Used by "nuget_uris".
    +#
    +# Example:
    +# @CODE
    +# NUGETS="
    +# ImGui.NET-1.87.2
    +# Config.Net-4.19.0
    +# "
    +#
    +# inherit dotnet-pkg
    +#
    +# ...
    +#
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE

    Can we use the approach we're doing w/ cargo.eclass, so this isn't
    the default option? (i.e. set a global variable instead).

    [...]
    +# @FUNCTION: nuget_link
    +# @USAGE: <nuget-path>
    +# @DESCRIPTION:
    +# Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES"
    +# directory.
    +#
    +# Example:
    +# @CODE
    +# nuget_link "${DISTDIR}"/pkg.0.nupkg
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link() {
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no nuget path given"
    +
    + mkdir -p "${NUGET_PACKAGES}" || die
    +
    + local nuget_name="$(basename "${1}")"

    You should be able to do this with pure bash.

    [...]

    best,
    sam

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

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

    iOQEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZLPnIV8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZDmCAEA7dtxWJtuAo25L6via0MYn6Eo98mKAiu4wkY7 mT1W2iwA+OiFz7o/GmhA/aAFlSaE011RJLfgPVd6wkIHu9Vk+Ao=+vxB
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:50:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg.eclass | 249 +++++++++++++++++++++++++++++++++++++++
    1 file changed, 249 insertions(+)
    create mode 100644 eclass/dotnet-pkg.eclass

    diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass
    new file mode 100644
    index 0000000000..2b711467f5
    --- /dev/null
    +++ b/eclass/dotnet-pkg.eclass
    @@ -0,0 +1,249 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @PROVIDES: dotnet-pkg-utils nuget
    +# @BLURB: common functions and variables for .NET packages
    +# @DESCRIPTION:
    +# This eclass is designed to help with building and installing packages that +# use the .NET SDK.
    +#
    +# .NET SDK is a open-source framework from Microsoft, it is a cross-platform +# successor to .NET Framework.
    +#
    +# .NET packages re
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:50:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    app-eselect/eselect-dotnet/Manifest | 1 +
    .../eselect-dotnet-0.1.0.ebuild | 25 +++++++++++++++++++
    app-eselect/eselect-dotnet/metadata.xml | 9 +++++++
    3 files changed, 35 insertions(+)
    create mode 100644 app-eselect/eselect-dotnet/Manifest
    create mode 100644 app-eselect/eselect-dotnet/eselect-dotnet-0.1.0.ebuild
    create mode 100644 app-eselect/eselect-dotnet/metadata.xml

    diff --git a/app-eselect/eselect-dotnet/Manifest b/app-eselect/eselect-dotnet/Manifest
    new file mode 100644
    index 0000000000..9cf36cadf1
    --- /dev/null
    +++ b/app-eselect/eselect-dotnet/Manifest
    @@ -0,0 +1 @@
    +DIST eselect-dotnet-0.1.0.tar.bz2 7788 BLAKE2B 141e5a2fc765454682de60a6a337d6634766b4dd76f218606e2f4eb18960fdcf8940b954deda2fb6b0903f72b161513936c1d767210883316c32200704188945 SHA512
    879281ffff019d1e4a8a5ee3d3e6b6de3446ba573d253a5b3b0c59aa9faffcd6eb4382066e1752e18cb4e48c3e14340a278b2189c2674b1baa258ceb3980d13a
    diff --git a/app-eselect/eselect-dotnet/eselect-dotnet-0.1.0.ebuild b
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:50:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    dev-dotnet/dotnet-runtime-nugets/Manifest | 117 ++++++++++++++++++
    .../dotnet-runtime-nugets-3.1.32.ebuild | 45 +++++++
    .../dotnet-runtime-nugets-6.0.12.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-6.0.14.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-6.0.16.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-7.0.3.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-7.0.5.ebuild | 48 +++++++
    dev-dotnet/dotnet-runtime-nugets/metadata.xml | 9 ++
    8 files changed, 411 insertions(+)
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/Manifest
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-3.1.32.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.12.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.14.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.16.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotn
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:50:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    dev-dotnet/dotnet-sdk-bin/Manifest | 8 +--
    .../dotnet-sdk-bin-6.0.402-r3.ebuild | 65 ------------------
    .../dotnet-sdk-bin-6.0.404.ebuild | 67 -------------------
    .../dotnet-sdk-bin-7.0.200.ebuild | 67 -------------------
    4 files changed, 1 insertion(+), 206 deletions(-)
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-6.0.402-r3.ebuild
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-6.0.404.ebuild
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-7.0.200.ebuild

    diff --git a/dev-dotnet/dotnet-sdk-bin/Manifest b/dev-dotnet/dotnet-sdk-bin/Manifest
    index 34d9d16893..8469c78ba4 100644
    --- a/dev-dotnet/dotnet-sdk-bin/Manifest
    +++ b/dev-dotnet/dotnet-sdk-bin/Manifest
    @@ -1,15 +1,9 @@
    -DIST dotnet-sdk-6.0.402-linux-arm.tar.gz 181622588 BLAKE2B 1010a7cd9f598e0487af127f9e1dac86681479cd6d95e39eb5f1fbf555fd3923be7e2a56bf0bc878259c17e7eb66b711da9587fcfc8ac3ab5f5b17abff1c6da7
    -DIST dotnet-sdk-6.0.402-linux-arm64.tar.
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 16 14:50:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 598 +++++++++++++++++++++++++++++++++
    1 file changed, 598 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass new file mode 100644
    index 0000000000..aeabebc92d
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,598 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case "${EAPI}" in
    + 7 | 8 )
    + :
    +
  • From Sam James@21:1/5 to [email protected] on Sun Jul 16 15:00:01 2023
    Maciej Barć <[email protected]> writes:

    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg.eclass | 249 +++++++++++++++++++++++++++++++++++++++
    1 file changed, 249 insertions(+)
    create mode 100644 eclass/dotnet-pkg.eclass

    diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass
    new file mode 100644
    index 0000000000..2b711467f5
    --- /dev/null
    +++ b/eclass/dotnet-pkg.eclass
    @@ -0,0 +1,249 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @PROVIDES: dotnet-pkg-utils nuget
    +# @BLURB: common functions and variables for .NET packages
    +# @DESCRIPTION:
    +# This eclass is designed to help with building and installing packages that +# use the .NET SDK.
    +#
    +# .NET SDK is a open-source framework from Microsoft, it is a cross-platform +# successor to .NET Framework.
    +#
    +# .NET packages require proper inspection before packaging:
    +# - the compatible .NET SDK version has to be declared,
    +# this can be done by inspecting the package's "*proj" files,
    +# unlike JAVA, .NET packages tend to lock onto one selected .NET SDK
    +# version, so building with other .NET versions will be mostly unsupported,
    +# - nugets, which are similar to JAVA's JARs (package .NET dependencies),
    +# have to be listed using either the "NUGETS" variable or bundled inside +# a "prebuilt" archive, in second case also the "NUGET_PACKAGES" variable +# has to be explicitly set.
    +# - the main project file (.*proj) that builds the project has to be specified
    +# by the "DOTNET_PROJECT" variable.
    +
    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
    +if [[ -z ${_DOTNET_PKG_ECLASS} ]] ; then
    +_DOTNET_PKG_ECLASS=1
    +
    +inherit dotnet-pkg-utils
    +
    +# @ECLASS_VARIABLE: DOTNET_PROJECTS
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Path to the main .NET project files (".csproj", ".fsproj", ".vbproj")
    +# used by default by "dotnet-pkg_src_compile" phase function.
    +#
    +# In .NET version 6.0 and lower it was possible to build a project solution +# (".sln") immediately with output to a specified directory ("--output DIR"),
    +# but versions >= 7.0 deprecated this behavior. This means that
    +# "dotnet-pkg-utils_build" will fail when pointed to a solution or a directory
    +# containing a solution file.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg-utils" eclass, but it is advised that it is set after
    +# the variable "${S}" is set, it should also integrate with it
    +# (see the example below).
    +#
    +# Example:
    +# @CODE
    +# SRC_URI="..."
    +# S="${S}"/src
    +#
    +# LICENSE="MIT"
    +# SLOT="0"
    +# KEYWORDS="~amd64"
    +#
    +# DOTNET_PROJECTS=( "${S}/DotnetProject" )
    +#
    +# src_prepare() {
    +# ...
    +# @CODE
    +
    +# @ECLASS_VARIABLE: DOTNET_RESTORE_EXTRA_ARGS
    +# @DESCRIPTION:
    +# Extra arguments to pass to the package restore, in the "src_configure" phase.
    +#
    +# This is passed only when restoring the specified "DOTNET_PROJECT".
    +# Other project restorers do not use this variable.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg.eclass", but it is advised that it is set after the variable +# "DOTNET_PROJECT" (from "dotnet-pkg-utils" eclass) is set.
    +#
    +# Default value is an empty array.
    +#
    +# For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_configure".
    +DOTNET_RESTORE_EXTRA_ARGS=()
    +
    +# @ECLASS_VARIABLE: DOTNET_BUILD_EXTRA_ARGS
    +# @DESCRIPTION:
    +# Extra arguments to pass to the package build, in the "src_compile" phase. +#
    +# This is passed only when building the specified "DOTNET_PROJECT".
    +# Other project builds do not use this variable.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg.eclass", but it is advised that it is set after the variable +# "DOTNET_PROJECT" (from "dotnet-pkg-utils" eclass) is set.
    +#
    +# Default value is an empty array.
    +#
    +# Example:
    +# @CODE
    +# DOTNET_BUILD_EXTRA_ARGS=( -p:WarningLevel=0 )
    +# @CODE
    +#
    +# For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_compile".
    +DOTNET_BUILD_EXTRA_ARGS=()
    +
    +# @FUNCTION: dotnet-pkg_pkg_setup
    +# @DESCRIPTION:
    +# Default "pkg_setup" for the "dotnet-pkg" eclass.
    +# Pre-build configuration and checks.
    +#
    +# Calls "dotnet-pkg-utils_pkg_setup".
    +dotnet-pkg_pkg_setup() {
    + dotnet-pkg-utils_setup
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_unpack
    +# @DESCRIPTION:
    +# Default "src_unpack" for the "dotnet-pkg" eclass.
    +# Unpack the package sources.
    +#
    +# Includes a special exception for nugets (".nupkg" files) - they are instead
    +# copied into the "NUGET_PACKAGES" directory.
    +dotnet-pkg_src_unpack() {
    + nuget_link-system-nugets
    +
    + local archive
    + for archive in ${A} ; do
    + case ${archive} in
    + *.nupkg )
    + nuget_link "${DISTDIR}"/${archive}
    + ;;
    + * )
    + unpack ${archive}
    + ;;
    + esac
    + done
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_prepare
    +# @DESCRIPTION:
    +# Default "src_prepare" for the "dotnet-pkg" eclass.
    +# Prepare the package sources.
    +#
    +# Run "dotnet-pkg-utils_remove-global-json".
    +dotnet-pkg_src_prepare() {
    + dotnet-pkg-utils_remove-global-json
    +
    + default
    +}
    +
    +# @FUNCTION: dotnet-pkg_foreach-project
    +# @USAGE: <args> ...
    +# @DESCRIPTION:
    +# Run a specified command for each project listed inside the "DOTNET_PROJECTS"
    +# variable.
    +#
    +# Used by "dotnet-pkg_src_configure" and "dotnet-pkg_src_compile". +dotnet-pkg_foreach-project() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dotnet_project
    + for dotnet_project in "${DOTNET_PROJECTS[@]}" ; do
    + einfo "Running \"${@}\" for project: \"$(basename "${dotnet_project}")\""
    + "${@}" "${dotnet_project}"

    No die?

    + done
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_configure
    +# @DESCRIPTION:
    +# Default "src_configure" for the "dotnet-pkg" eclass.
    +# Configure the package.
    +#
    +# First show information about current .NET SDK that is being used,
    +# then restore the project file specified by "DOTNET_PROJECT",
    +# afterwards restore any found solutions.
    +dotnet-pkg_src_configure() {
    + dotnet-pkg-utils_info
    +
    + dotnet-pkg_foreach-project \
    + dotnet-pkg-utils_restore "${DOTNET_RESTORE_EXTRA_ARGS[@]}"
    +
    + dotnet-pkg-utils_foreach-solution dotnet-pkg-utils_restore "$(pwd)"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_compile
    +# @DESCRIPTION:
    +# Default "src_compile" for the "dotnet-pkg" eclass.
    +# Build the package.
    +#
    +# Build the package using "dotnet build" in the directory specified by either
    +# "DOTNET_PROJECT" or "S" (temporary build directory) variables.
    +#
    +# For more info see: "DOTNET_PROJECT" variable
    +# and "dotnet-pkg-utils_get-project" function.
    +dotnet-pkg_src_compile() {
    + dotnet-pkg_foreach-project \
    + dotnet-pkg-utils_build "${DOTNET_BUILD_EXTRA_ARGS[@]}"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_test
    +# @DESCRIPTION:
    +# Default "src_test" for the "dotnet-pkg" eclass.
    +# Test the package.
    +#
    +# Test the package by testing any found solutions.
    +#
    +# It is very likely that this function will either not execute any tests or +# will execute wrong or incomplete test suite. Maintainers should inspect if +# any and/or correct tests are ran.
    +dotnet-pkg_src_test() {
    + dotnet-pkg-utils_foreach-solution dotnet-pkg-utils_test "$(pwd)"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_install
    +# @DESCRIPTION:
    +# Default "src_install" for the "dotnet-pkg" eclass.
    +# Install the package.
    +#
    +# This is the default package install function for the "dotnet-pkg" eclass. +#
    +# It is very likely that this function is either insufficient or has to be +# redefined in a ebuild.
    +dotnet-pkg_src_install() {
    + # Install the compiled .NET package artifacts,
    + # for more info see "dotnet-pkg-utils_install" and "DOTNET_OUTPUT".
    + dotnet-pkg-utils_install
    +
    + # Create launcher from the .NET package directory to "/usr/bin".
    + # For example: /usr/bin/Nake -> /usr/share/nake-3.0.0/Nake
    + dotnet-pkg-utils_dolauncher /usr/share/${P}/${PN^}
    +
    + # Create a compatibility symlink and also for ease of use from CLI.
    + dosym -r /usr/bin/${PN^} /usr/bin/${PN}
    +
    + einstalldocs
    +}
    +
    +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install
    +
    +fi


    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

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

    iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZLPpXl8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZAmZwEA/stIfb0oJhlz8CbUuDzVLG9uxvGcaFsKvhd4 21PZAn8BAI0CCVQSGsfZ96IHzM/e3pyzajC7OTVgoK663X6LaI8N
    =lEHx
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to [email protected] on Sun Jul 16 15:00:01 2023
    Maciej Barć <[email protected]> writes:

    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 598 +++++++++++++++++++++++++++++++++
    1 file changed, 598 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass new file mode 100644
    index 0000000000..aeabebc92d
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,598 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8

    Let's not add EAPI 7 to a new eclass.

    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages. +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case "${EAPI}" in
    + 7 | 8 )

    Per above, drop this, but if keeping it: 7|8). Own style is fine for an
    eclass ofc, but writing it like this is unconventional.

    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
    +if [[ -z ${_DOTNET_PKG_UTILS_ECLASS} ]] ; then
    +_DOTNET_PKG_UTILS_ECLASS=1
    +
    +inherit edo multiprocessing nuget
    +
    +# @ECLASS_VARIABLE: DOTNET_COMPAT
    +# @REQUIRED
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# Allows to choose a slot for dotnet.
    +#
    +# Most .NET packages will lock onto one supported .NET major version.
    +# DOTNET_COMPAT should specify which version was chosen by package upstream. +# In case multiple .NET versions are specified in the project, then the highest
    +# should be picked by the maintainer.
    +if [[ ${CATEGORY}/${PN} != dev-dotnet/dotnet-runtime-nugets ]] ; then
    + if [[ ! ${DOTNET_COMPAT} ]] ; then
    + die "${ECLASS}: DOTNET_COMPAT not set"
    + fi
    +
    + RDEPEND+=" virtual/dotnet-sdk:${DOTNET_COMPAT} "
    + BDEPEND+=" ${RDEPEND} "
    +
    + if [[ ${CATEGORY}/${PN} != dev-dotnet/csharp-gentoodotnetinfo ]] ; then + BDEPEND+=" dev-dotnet/csharp-gentoodotnetinfo "
    + fi
    +
    + IUSE+=" debug "
    +fi
    +
    +# Needed otherwise the binaries may break.
    +RESTRICT+=" strip "
    +
    +# Everything is built by "dotnet".
    +QA_PREBUILT=".*"
    +
    +# Special .NET SDK environment variables.
    +# Setting them either prevents annoying information from being generated
    +# or stops services that may interfere with a clean package build.
    +export DOTNET_CLI_TELEMETRY_OPTOUT=1
    +export DOTNET_NOLOGO=1
    +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
    +export MSBUILDDISABLENODEREUSE=1
    +export POWERSHELL_TELEMETRY_OPTOUT=1
    +export POWERSHELL_UPDATECHECK=0
    +# Overwrite selected MSBuild properties ("-p:XYZ").
    +export UseSharedCompilation=false
    +
    +# @ECLASS_VARIABLE: DOTNET_RUNTIME
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Sets the runtime used to build a package.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_EXECUTABLE
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Sets path of a "dotnet" executable.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_CONFIGURATION
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Configuration value passed to "dotnet" in the compile phase.
    +# Is either Debug or Release, depending on the "debug" USE flag.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_OUTPUT
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Path of the output directory, where the package artifacts are placed during
    +# the building of packages with "dotnet-pkg-utils_build" function.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @VARIABLE: DOTNET_LAUNCHERDEST
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Sets the path that .NET launchers are installed into by
    +# the "dotnet-pkg-utils_dolauncher" function.
    +#
    +# The function "dotnet-pkg-utils_launcherinto" is able to manipulate this
    +# variable.
    +#
    +# Defaults to "/usr/bin".
    +DOTNET_LAUNCHERDEST=/usr/bin
    +
    +# @VARIABLE: DOTNET_LAUNCHERVARS
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Sets additional variables for .NET launchers created by
    +# the "dotnet-pkg-utils_dolauncher" function.
    +#
    +# The function "dotnet-pkg-utils_append_launchervar" is able to manipulate this
    +# variable.
    +#
    +# Defaults to a empty array.
    +DOTNET_LAUNCHERVARS=()
    +
    +# @FUNCTION: dotnet-pkg-utils_get-configuration
    +# @DESCRIPTION:
    +# Return .NET configuration type of the current package.
    +#
    +# It is advised to refer to the "DOTNET_CONFIGURATION" variable instead of +# calling this function if necessary.
    +#
    +# Used by "dotnet-pkg-utils_setup".
    +dotnet-pkg-utils_get-configuration() {
    + if in_iuse debug && use debug ; then
    + echo Debug
    + else
    + echo Release
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_get-output
    +# @USAGE: <name>
    +# @DESCRIPTION:
    +# Return a specially constructed name of a directory for output of
    +# "dotnet build" artifacts ("--output" flag, see "dotnet-pkg-utils_build"). +#
    +# It is very rare that a maintainer would use this function in an ebuild.
    +#
    +# This function is used inside "dotnet-pkg-utils_setup". +dotnet-pkg-utils_get-output() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! ${DOTNET_CONFIGURATION} ]] &&
    + die "${FUNCNAME}: DOTNET_CONFIGURATION is not set."
    +
    + echo "${WORKDIR}"/${1}_net${DOTNET_COMPAT}_${DOTNET_CONFIGURATION}
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_get-runtime
    +# @DESCRIPTION:
    +# Return the .NET runtime used for the current package.
    +#
    +# Used by "dotnet-pkg-utils_setup".
    +dotnet-pkg-utils_get-runtime() {
    + local libc="$(usex elibc_musl "-musl" "")"
    +
    + if use amd64 ; then
    + echo linux${libc}-x64
    + elif use x86 ; then
    + echo linux${libc}-x86
    + elif use arm ; then
    + echo linux${libc}-arm
    + elif use arm64 ; then
    + echo linux${libc}-arm64
    + else
    + die "${FUNCNAME}: Unsupported architecture: ${ARCH}"
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_setup
    +# @DESCRIPTION:
    +# Sets up "DOTNET_EXECUTABLE" variable for later use in "edotnet".
    +# Also sets up "DOTNET_CONFIGURATION" and "DOTNET_OUTPUT"
    +# for "dotnet-pkg_src_configure" and "dotnet-pkg_src_compile".
    +#
    +# This functions should be called by "pkg_setup".
    +#
    +# Used by "dotnet-pkg_pkg_setup" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_setup() {
    + local _dotnet
    + for _dotnet in dotnet{,-bin}-${DOTNET_COMPAT} ; do
    + if type ${_dotnet} >/dev/null 2>&1 ; then
    + DOTNET_EXECUTABLE=${_dotnet}
    + DOTNET_EXECUTABLE_PATH="$(command -v
    ${_dotnet})"

    We can just change the original call to `type -P` (not `type`)
    and reuse the result here.

    + break
    + fi
    + done
    +
    + # Link "DOTNET_EXECUTABLE" to "dotnet" only for the package build.
    + local dotnet_spoof_path="${T}"/dotnet_spoof/${DOTNET_COMPAT}
    + mkdir -p "${dotnet_spoof_path}" || die
    + ln -s "${DOTNET_EXECUTABLE_PATH}" "${dotnet_spoof_path}"/dotnet || die + export PATH="${dotnet_spoof_path}:${PATH}"
    +
    + einfo "Using dotnet SDK \"${DOTNET_EXECUTABLE}\" from \"${DOTNET_EXECUTABLE_PATH}\"."
    +
    + # The picked "DOTNET_EXECUTABLE" should set "DOTNET_ROOT" internally
    + # and not rely upon this environment variable.
    + unset DOTNET_ROOT
    +
    + # Unset .NET and NuGet directories.
    + unset DOTNET_DATA
    + unset NUGET_DATA
    +
    + DOTNET_RUNTIME=$(dotnet-pkg-utils_get-runtime)
    + DOTNET_CONFIGURATION=$(dotnet-pkg-utils_get-configuration)
    + DOTNET_OUTPUT="$(dotnet-pkg-utils_get-output ${P})"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_remove-global-json
    +# @USAGE: [directory]
    +# @DESCRIPTION:
    +# Remove the "global.json" if it exists.
    +# The file in question might lock target package to a specified .NET
    +# version, which might be unnecessary (as it is in most cases).
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Used by "dotnet-pkg_src_prepare" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_remove-global-json() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local file="${1:-.}"/global.json
    +
    + if [[ -f "${file}" ]] ; then
    + ebegin "Removing the global.json file"
    + rm "${file}"
    + eend ${?} || die "${FUNCNAME}: failed to remove ${file}"
    + fi
    +}
    +
    +# @FUNCTION: edotnet
    +# @USAGE: <command> [args...]
    +# @DESCRIPTION:
    +# Call dotnet, passing the supplied arguments.
    +edotnet() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + if [[ ! "${DOTNET_EXECUTABLE}" ]] ; then
    + die "${FUNCNAME}: DOTNET_EXECUTABLE not set. Was dotnet-pkg-utils_setup called?"
    + fi
    +
    + edo "${DOTNET_EXECUTABLE}" "${@}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_info
    +# @DESCRIPTION:
    +# Show information about current .NET SDK that is being used.
    +#
    +# Depends upon the "gentoo-dotnet-info" program installed by
    +# the "dev-dotnet/csharp-gentoodotnetinfo" package.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_info() {
    + if [[ ${CATEGORY}/${PN} == dev-dotnet/csharp-gentoodotnetinfo ]] ; then + debug-print-function "${FUNCNAME}: ${P} is a special package, skipping dotnet-pkg-utils_info"
    + elif ! command -v gentoo-dotnet-info >/dev/null ; then
    + ewarn "${FUNCNAME}: gentoo-dotnet-info not available"
    + else
    + gentoo-dotnet-info || die "${FUNCNAME}: failed to execute gentoo-dotnet-info"
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_foreach-solution
    +# @USAGE: <function> [directory]
    +# @DESCRIPTION:
    +# Execute a function for each solution file (.sln) in a specified directory. +# This function may yield no real results because solutions are discovered +# automatically.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_foreach-solution() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dotnet_solution
    + for dotnet_solution in $(find "${2:-.}" -maxdepth 1 -type f -name "*.sln") ; do
    + einfo "Running \"${1}\" for solution: \"$(basename "${dotnet_solution}")\""
    + "${1}" "${dotnet_solution}"
    + done

    Ideally, please change this to:

    ```
    while read ... ; do

    done < <( ... )
    ```

    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_restore
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Restore the package using "dotnet restore" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_restore() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a restore_args=(
    + --runtime ${DOTNET_RUNTIME}
    + --source "${NUGET_PACKAGES}"
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + edotnet restore "${restore_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_restore_tools
    +# @USAGE: [config-file] [args] ...
    +# @DESCRIPTION:
    +# Restore dotnet tools for a project in the current directory.
    +#
    +# Optional "config-file" argument is used to specify a file for the
    +# "--configfile" option which records what tools should be restored.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +dotnet-pkg-utils_restore_tools() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local -a tool_restore_args=(
    + --add-source "${NUGET_PACKAGES}"
    + )
    +
    + if [[ "${1}" ]] ; then
    + tool_restore_args+=( --configfile "${1}" )
    + shift
    + fi
    +
    + tool_restore_args+=( "${@}" )
    +
    + edotnet tool restore "${tool_restore_args[@]}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_build
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Build the package using "dotnet build" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_compile" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_build() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a build_args=(
    + --configuration "${DOTNET_CONFIGURATION}"
    + --no-restore
    + --no-self-contained
    + --output "${DOTNET_OUTPUT}"
    + --runtime ${DOTNET_RUNTIME}
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + if ! use debug ; then
    + build_args+=(
    + -p:StripSymbols=true
    + -p:NativeDebugSymbols=false
    + )
    + fi
    +
    + edotnet build "${build_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_test
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Test the package using "dotnet test" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_test" from the "dotnet-pkg" eclass. +dotnet-pkg-utils_test() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a test_args=(
    + --configuration "${DOTNET_CONFIGURATION}"
    + --no-restore
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + edotnet test "${test_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_install
    +# @USAGE: [directory]
    +# @DESCRIPTION:
    +# Install the contents of "DOTNET_OUTPUT" into a directory, defaults to
    +# "/usr/share/${PN}".
    +#
    +# Installation directory is relative to "ED".
    +dotnet-pkg-utils_install() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local installation_directory="${1:-/usr/share/${P}}"
    +

    The docstring says it defaults to ${PN}, not ${P}?

    + dodir "${installation_directory}"
    + cp -r "${DOTNET_OUTPUT}"/* "${ED}"/"${installation_directory}"/ || die

    I would just quote the whole second argument instead of selectively
    doing it, but up to you.

    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_launcherinto
    +# @USAGE: <directory>
    +# @DESCRIPTION:
    +# Changes the path .NET launchers are installed into via subsequent
    +# "dotnet-pkg-utils_dolauncher" calls.
    +#
    +# For more info see the "DOTNET_LAUNCHERDEST" variable. +dotnet-pkg-utils_launcherinto() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no directory specified"
    +
    + DOTNET_LAUNCHERDEST="${1}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_append_launchervar
    +# @USAGE: <variable-setting>
    +# @DESCRIPTION:
    +# Appends a given variable setting to the "DOTNET_LAUNCHERVARS".
    +#
    +# WARNING: This functions modifies a global variable permanently!
    +# This means that all launchers created in subsequent
    +# "dotnet-pkg-utils_dolauncher" calls of a given package will have
    +# the given variable set.
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_append_launchervar "DOTNET_EnableAlternateStackCheck=1" +# @CODE
    +#
    +# For more info see the "DOTNET_LAUNCHERVARS" variable. +dotnet-pkg-utils_append_launchervar() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no variable setting specified"
    +
    + DOTNET_LAUNCHERVARS+=( "${1}" )
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_dolauncher
    +# @USAGE: <executable-path> [filename]
    +# @DESCRIPTION:
    +# Make a wrapper script to launch an executable built from a .NET package. +#
    +# If no file name is given, the `basename` of the executable is used.
    +#
    +# Parameters:
    +# ${1} - path of the executable to launch,
    +# ${2} - filename of launcher to create (optional).
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_install
    +# dotnet-pkg-utils_dolauncher /usr/share/${P}/${PN^}
    +# @CODE
    +#
    +# The path is prepended by "EPREFIX".
    +dotnet-pkg-utils_dolauncher() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local executable_path executable_name
    +
    + if [[ "${1}" ]] ; then
    + local executable_path="${1}"
    + shift
    + else
    + die "${FUNCNAME}: No executable path given."
    + fi
    +
    + if [[ ${#} = 0 ]] ; then
    + executable_name="$(basename "${executable_path}")"
    + else
    + executable_name="${1}"
    + shift
    + fi
    +
    + local executable_target="${T}/${executable_name}"
    +
    + cat > "${executable_target}" <<-EOF

    Missing die.

    + #!/bin/sh
    +
    + # Lanucher script for ${executable_path} (${executable_name}),
    + # created from package "${CATEGORY}/${P}",
    + # compatible with dotnet version ${DOTNET_COMPAT}.
    +
    + for __dotnet_root in \\
    + ${EPREFIX}/usr/$(get_libdir)/dotnet-sdk-${DOTNET_COMPAT} \\
    + ${EPREFIX}/opt/dotnet-sdk-bin-${DOTNET_COMPAT} ; do
    + [ -d \${__dotnet_root} ] && break
    + done
    +
    + DOTNET_ROOT="\${__dotnet_root}"
    + export DOTNET_ROOT
    +
    + $(for var in "${DOTNET_LAUNCHERVARS[@]}" ; do
    + echo "${var}"
    + echo "export ${var%%=*}"
    + done)
    +
    + exec "${EPREFIX}${executable_path}" "\${@}"
    + EOF
    +
    + dodir "${DOTNET_LAUNCHERDEST}"
    + exeinto "${DOTNET_LAUNCHERDEST}"
    + doexe "${executable_target}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_dolauncher_portable
    +# @USAGE: <dll-path> <filename>
    +# @DESCRIPTION:
    +# Make a wrapper script to launch a .NET DLL file built from a .NET package. +#
    +# Parameters:
    +# ${1} - path of the DLL to launch,
    +# ${2} - filename of launcher to create.
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_dolauncher_portable \
    +# /usr/share/${P}/GentooDotnetInfo.dll gentoo-dotnet-info
    +# @CODE
    +#
    +# The path is prepended by "EPREFIX". +dotnet-pkg-utils_dolauncher_portable() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dll_path="${1}"
    + local executable_name="${2}"
    + local executable_target="${T}/${executable_name}"
    +
    + cat > "${executable_target}" <<-EOF

    Missing die.

    + #!/bin/sh
    +
    + # Lanucher script for ${dll_path} (${executable_name}),
    + # created from package "${CATEGORY}/${P}",
    + # compatible with any dotnet version, built on ${DOTNET_COMPAT}.
    +
    + $(for var in "${DOTNET_LAUNCHERVARS[@]}" ; do
    + echo "${var}"
    + echo "export ${var%%=*}"
    + done)
    +
    + exec dotnet exec "${EPREFIX}${dll_path}" "\${@}"
    + EOF
    +
    + dodir "${DOTNET_LAUNCHERDEST}"
    + exeinto "${DOTNET_LAUNCHERDEST}"
    + doexe "${executable_target}"
    +}
    +
    +fi


    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

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

    iOUEARYKAI0WIQQlpruI3Zt2TGtVQcJzhAn1IN+RkAUCZLPobV8UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0MjVB NkJCODhERDlCNzY0QzZCNTU0MUMyNzM4NDA5RjUyMERGOTE5MA8cc2FtQGdlbnRv by5vcmcACgkQc4QJ9SDfkZAJKwD/WZf5Yo72G+FoHgwAtz0XHEYKvCJHqy1IlV1a Xo8GqfwA/jsqB/laUeYpE1/rqr21IwJ7+V2xj/5qJ2dArrLbcS0D
    =5Kun
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Maciej_Bar=c4=87?=@21:1/5 to All on Sun Jul 16 15:40:02 2023
    +# @FUNCTION: dotnet-pkg-utils_install
    +# @USAGE: [directory]
    +# @DESCRIPTION:
    +# Install the contents of "DOTNET_OUTPUT" into a directory, defaults to
    +# "/usr/share/${PN}".
    +#
    +# Installation directory is relative to "ED".
    +dotnet-pkg-utils_install() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local installation_directory="${1:-/usr/share/${P}}"
    +

    The docstring says it defaults to ${PN}, not ${P}?


    Typo, should be P.

    I agree with the rest.

    W dniu 16.07.2023 o 14:48, Sam James pisze:

    Maciej Barć <[email protected]> writes:

    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 598 +++++++++++++++++++++++++++++++++
    1 file changed, 598 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass >> new file mode 100644
    index 0000000000..aeabebc92d
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,598 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8

    Let's not add EAPI 7 to a new eclass.

    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages. >> +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case "${EAPI}" in
    + 7 | 8 )

    Per above, drop this, but if keeping it: 7|8). Own style is fine for an eclass ofc, but writing it like this is unconventional.

    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
    +if [[ -z ${_DOTNET_PKG_UTILS_ECLASS} ]] ; then
    +_DOTNET_PKG_UTILS_ECLASS=1
    +
    +inherit edo multiprocessing nuget
    +
    +# @ECLASS_VARIABLE: DOTNET_COMPAT
    +# @REQUIRED
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# Allows to choose a slot for dotnet.
    +#
    +# Most .NET packages will lock onto one supported .NET major version.
    +# DOTNET_COMPAT should specify which version was chosen by package upstream.
    +# In case multiple .NET versions are specified in the project, then the highest
    +# should be picked by the maintainer.
    +if [[ ${CATEGORY}/${PN} != dev-dotnet/dotnet-runtime-nugets ]] ; then
    + if [[ ! ${DOTNET_COMPAT} ]] ; then
    + die "${ECLASS}: DOTNET_COMPAT not set"
    + fi
    +
    + RDEPEND+=" virtual/dotnet-sdk:${DOTNET_COMPAT} "
    + BDEPEND+=" ${RDEPEND} "
    +
    + if [[ ${CATEGORY}/${PN} != dev-dotnet/csharp-gentoodotnetinfo ]] ; then >> + BDEPEND+=" dev-dotnet/csharp-gentoodotnetinfo "
    + fi
    +
    + IUSE+=" debug "
    +fi
    +
    +# Needed otherwise the binaries may break.
    +RESTRICT+=" strip "
    +
    +# Everything is built by "dotnet".
    +QA_PREBUILT=".*"
    +
    +# Special .NET SDK environment variables.
    +# Setting them either prevents annoying information from being generated
    +# or stops services that may interfere with a clean package build.
    +export DOTNET_CLI_TELEMETRY_OPTOUT=1
    +export DOTNET_NOLOGO=1
    +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
    +export MSBUILDDISABLENODEREUSE=1
    +export POWERSHELL_TELEMETRY_OPTOUT=1
    +export POWERSHELL_UPDATECHECK=0
    +# Overwrite selected MSBuild properties ("-p:XYZ").
    +export UseSharedCompilation=false
    +
    +# @ECLASS_VARIABLE: DOTNET_RUNTIME
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Sets the runtime used to build a package.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_EXECUTABLE
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Sets path of a "dotnet" executable.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_CONFIGURATION
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Configuration value passed to "dotnet" in the compile phase.
    +# Is either Debug or Release, depending on the "debug" USE flag.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @ECLASS_VARIABLE: DOTNET_OUTPUT
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Path of the output directory, where the package artifacts are placed during
    +# the building of packages with "dotnet-pkg-utils_build" function.
    +#
    +# This variable is set automatically by the "dotnet-pkg-utils_setup" function.
    +
    +# @VARIABLE: DOTNET_LAUNCHERDEST
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Sets the path that .NET launchers are installed into by
    +# the "dotnet-pkg-utils_dolauncher" function.
    +#
    +# The function "dotnet-pkg-utils_launcherinto" is able to manipulate this >> +# variable.
    +#
    +# Defaults to "/usr/bin".
    +DOTNET_LAUNCHERDEST=/usr/bin
    +
    +# @VARIABLE: DOTNET_LAUNCHERVARS
    +# @INTERNAL
    +# @DESCRIPTION:
    +# Sets additional variables for .NET launchers created by
    +# the "dotnet-pkg-utils_dolauncher" function.
    +#
    +# The function "dotnet-pkg-utils_append_launchervar" is able to manipulate this
    +# variable.
    +#
    +# Defaults to a empty array.
    +DOTNET_LAUNCHERVARS=()
    +
    +# @FUNCTION: dotnet-pkg-utils_get-configuration
    +# @DESCRIPTION:
    +# Return .NET configuration type of the current package.
    +#
    +# It is advised to refer to the "DOTNET_CONFIGURATION" variable instead of >> +# calling this function if necessary.
    +#
    +# Used by "dotnet-pkg-utils_setup".
    +dotnet-pkg-utils_get-configuration() {
    + if in_iuse debug && use debug ; then
    + echo Debug
    + else
    + echo Release
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_get-output
    +# @USAGE: <name>
    +# @DESCRIPTION:
    +# Return a specially constructed name of a directory for output of
    +# "dotnet build" artifacts ("--output" flag, see "dotnet-pkg-utils_build"). >> +#
    +# It is very rare that a maintainer would use this function in an ebuild. >> +#
    +# This function is used inside "dotnet-pkg-utils_setup".
    +dotnet-pkg-utils_get-output() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! ${DOTNET_CONFIGURATION} ]] &&
    + die "${FUNCNAME}: DOTNET_CONFIGURATION is not set."
    +
    + echo "${WORKDIR}"/${1}_net${DOTNET_COMPAT}_${DOTNET_CONFIGURATION}
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_get-runtime
    +# @DESCRIPTION:
    +# Return the .NET runtime used for the current package.
    +#
    +# Used by "dotnet-pkg-utils_setup".
    +dotnet-pkg-utils_get-runtime() {
    + local libc="$(usex elibc_musl "-musl" "")"
    +
    + if use amd64 ; then
    + echo linux${libc}-x64
    + elif use x86 ; then
    + echo linux${libc}-x86
    + elif use arm ; then
    + echo linux${libc}-arm
    + elif use arm64 ; then
    + echo linux${libc}-arm64
    + else
    + die "${FUNCNAME}: Unsupported architecture: ${ARCH}"
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_setup
    +# @DESCRIPTION:
    +# Sets up "DOTNET_EXECUTABLE" variable for later use in "edotnet".
    +# Also sets up "DOTNET_CONFIGURATION" and "DOTNET_OUTPUT"
    +# for "dotnet-pkg_src_configure" and "dotnet-pkg_src_compile".
    +#
    +# This functions should be called by "pkg_setup".
    +#
    +# Used by "dotnet-pkg_pkg_setup" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_setup() {
    + local _dotnet
    + for _dotnet in dotnet{,-bin}-${DOTNET_COMPAT} ; do
    + if type ${_dotnet} >/dev/null 2>&1 ; then
    + DOTNET_EXECUTABLE=${_dotnet}
    + DOTNET_EXECUTABLE_PATH="$(command -v
    ${_dotnet})"

    We can just change the original call to `type -P` (not `type`)
    and reuse the result here.

    + break
    + fi
    + done
    +
    + # Link "DOTNET_EXECUTABLE" to "dotnet" only for the package build.
    + local dotnet_spoof_path="${T}"/dotnet_spoof/${DOTNET_COMPAT}
    + mkdir -p "${dotnet_spoof_path}" || die
    + ln -s "${DOTNET_EXECUTABLE_PATH}" "${dotnet_spoof_path}"/dotnet || die >> + export PATH="${dotnet_spoof_path}:${PATH}"
    +
    + einfo "Using dotnet SDK \"${DOTNET_EXECUTABLE}\" from \"${DOTNET_EXECUTABLE_PATH}\"."
    +
    + # The picked "DOTNET_EXECUTABLE" should set "DOTNET_ROOT" internally
    + # and not rely upon this environment variable.
    + unset DOTNET_ROOT
    +
    + # Unset .NET and NuGet directories.
    + unset DOTNET_DATA
    + unset NUGET_DATA
    +
    + DOTNET_RUNTIME=$(dotnet-pkg-utils_get-runtime)
    + DOTNET_CONFIGURATION=$(dotnet-pkg-utils_get-configuration)
    + DOTNET_OUTPUT="$(dotnet-pkg-utils_get-output ${P})"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_remove-global-json
    +# @USAGE: [directory]
    +# @DESCRIPTION:
    +# Remove the "global.json" if it exists.
    +# The file in question might lock target package to a specified .NET
    +# version, which might be unnecessary (as it is in most cases).
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Used by "dotnet-pkg_src_prepare" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_remove-global-json() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local file="${1:-.}"/global.json
    +
    + if [[ -f "${file}" ]] ; then
    + ebegin "Removing the global.json file"
    + rm "${file}"
    + eend ${?} || die "${FUNCNAME}: failed to remove ${file}"
    + fi
    +}
    +
    +# @FUNCTION: edotnet
    +# @USAGE: <command> [args...]
    +# @DESCRIPTION:
    +# Call dotnet, passing the supplied arguments.
    +edotnet() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + if [[ ! "${DOTNET_EXECUTABLE}" ]] ; then
    + die "${FUNCNAME}: DOTNET_EXECUTABLE not set. Was dotnet-pkg-utils_setup called?"
    + fi
    +
    + edo "${DOTNET_EXECUTABLE}" "${@}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_info
    +# @DESCRIPTION:
    +# Show information about current .NET SDK that is being used.
    +#
    +# Depends upon the "gentoo-dotnet-info" program installed by
    +# the "dev-dotnet/csharp-gentoodotnetinfo" package.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_info() {
    + if [[ ${CATEGORY}/${PN} == dev-dotnet/csharp-gentoodotnetinfo ]] ; then >> + debug-print-function "${FUNCNAME}: ${P} is a special package, skipping dotnet-pkg-utils_info"
    + elif ! command -v gentoo-dotnet-info >/dev/null ; then
    + ewarn "${FUNCNAME}: gentoo-dotnet-info not available"
    + else
    + gentoo-dotnet-info || die "${FUNCNAME}: failed to execute gentoo-dotnet-info"
    + fi
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_foreach-solution
    +# @USAGE: <function> [directory]
    +# @DESCRIPTION:
    +# Execute a function for each solution file (.sln) in a specified directory.
    +# This function may yield no real results because solutions are discovered >> +# automatically.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_foreach-solution() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dotnet_solution
    + for dotnet_solution in $(find "${2:-.}" -maxdepth 1 -type f -name "*.sln") ; do
    + einfo "Running \"${1}\" for solution: \"$(basename "${dotnet_solution}")\""
    + "${1}" "${dotnet_solution}"
    + done

    Ideally, please change this to:

    ```
    while read ... ; do

    done < <( ... )
    ```

    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_restore
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Restore the package using "dotnet restore" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_configure" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_restore() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a restore_args=(
    + --runtime ${DOTNET_RUNTIME}
    + --source "${NUGET_PACKAGES}"
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + edotnet restore "${restore_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_restore_tools
    +# @USAGE: [config-file] [args] ...
    +# @DESCRIPTION:
    +# Restore dotnet tools for a project in the current directory.
    +#
    +# Optional "config-file" argument is used to specify a file for the
    +# "--configfile" option which records what tools should be restored.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +dotnet-pkg-utils_restore_tools() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local -a tool_restore_args=(
    + --add-source "${NUGET_PACKAGES}"
    + )
    +
    + if [[ "${1}" ]] ; then
    + tool_restore_args+=( --configfile "${1}" )
    + shift
    + fi
    +
    + tool_restore_args+=( "${@}" )
    +
    + edotnet tool restore "${tool_restore_args[@]}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_build
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Build the package using "dotnet build" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_compile" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_build() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a build_args=(
    + --configuration "${DOTNET_CONFIGURATION}"
    + --no-restore
    + --no-self-contained
    + --output "${DOTNET_OUTPUT}"
    + --runtime ${DOTNET_RUNTIME}
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + if ! use debug ; then
    + build_args+=(
    + -p:StripSymbols=true
    + -p:NativeDebugSymbols=false
    + )
    + fi
    +
    + edotnet build "${build_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_test
    +# @USAGE: [directory] [args] ...
    +# @DESCRIPTION:
    +# Test the package using "dotnet test" in a specified directory.
    +#
    +# Optional "directory" argument defaults to the current directory path.
    +#
    +# Additionally any number of "args" maybe be given, they are appended to
    +# the "dotnet" command invocation.
    +#
    +# Used by "dotnet-pkg_src_test" from the "dotnet-pkg" eclass.
    +dotnet-pkg-utils_test() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local directory
    + if [[ "${1}" ]] ; then
    + directory="${1}"
    + shift
    + else
    + directory="$(pwd)"
    + fi
    +
    + local -a test_args=(
    + --configuration "${DOTNET_CONFIGURATION}"
    + --no-restore
    + -maxCpuCount:$(makeopts_jobs)
    + "${@}"
    + )
    +
    + edotnet test "${test_args[@]}" "${directory}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_install
    +# @USAGE: [directory]
    +# @DESCRIPTION:
    +# Install the contents of "DOTNET_OUTPUT" into a directory, defaults to
    +# "/usr/share/${PN}".
    +#
    +# Installation directory is relative to "ED".
    +dotnet-pkg-utils_install() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local installation_directory="${1:-/usr/share/${P}}"
    +

    The docstring says it defaults to ${PN}, not ${P}?

    + dodir "${installation_directory}"
    + cp -r "${DOTNET_OUTPUT}"/* "${ED}"/"${installation_directory}"/ || die

    I would just quote the whole second argument instead of selectively
    doing it, but up to you.

    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_launcherinto
    +# @USAGE: <directory>
    +# @DESCRIPTION:
    +# Changes the path .NET launchers are installed into via subsequent
    +# "dotnet-pkg-utils_dolauncher" calls.
    +#
    +# For more info see the "DOTNET_LAUNCHERDEST" variable.
    +dotnet-pkg-utils_launcherinto() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no directory specified"
    +
    + DOTNET_LAUNCHERDEST="${1}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_append_launchervar
    +# @USAGE: <variable-setting>
    +# @DESCRIPTION:
    +# Appends a given variable setting to the "DOTNET_LAUNCHERVARS".
    +#
    +# WARNING: This functions modifies a global variable permanently!
    +# This means that all launchers created in subsequent
    +# "dotnet-pkg-utils_dolauncher" calls of a given package will have
    +# the given variable set.
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_append_launchervar "DOTNET_EnableAlternateStackCheck=1" >> +# @CODE
    +#
    +# For more info see the "DOTNET_LAUNCHERVARS" variable.
    +dotnet-pkg-utils_append_launchervar() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no variable setting specified"
    +
    + DOTNET_LAUNCHERVARS+=( "${1}" )
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_dolauncher
    +# @USAGE: <executable-path> [filename]
    +# @DESCRIPTION:
    +# Make a wrapper script to launch an executable built from a .NET package. >> +#
    +# If no file name is given, the `basename` of the executable is used.
    +#
    +# Parameters:
    +# ${1} - path of the executable to launch,
    +# ${2} - filename of launcher to create (optional).
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_install
    +# dotnet-pkg-utils_dolauncher /usr/share/${P}/${PN^}
    +# @CODE
    +#
    +# The path is prepended by "EPREFIX".
    +dotnet-pkg-utils_dolauncher() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local executable_path executable_name
    +
    + if [[ "${1}" ]] ; then
    + local executable_path="${1}"
    + shift
    + else
    + die "${FUNCNAME}: No executable path given."
    + fi
    +
    + if [[ ${#} = 0 ]] ; then
    + executable_name="$(basename "${executable_path}")"
    + else
    + executable_name="${1}"
    + shift
    + fi
    +
    + local executable_target="${T}/${executable_name}"
    +
    + cat > "${executable_target}" <<-EOF

    Missing die.

    + #!/bin/sh
    +
    + # Lanucher script for ${executable_path} (${executable_name}),
    + # created from package "${CATEGORY}/${P}",
    + # compatible with dotnet version ${DOTNET_COMPAT}.
    +
    + for __dotnet_root in \\
    + ${EPREFIX}/usr/$(get_libdir)/dotnet-sdk-${DOTNET_COMPAT} \\
    + ${EPREFIX}/opt/dotnet-sdk-bin-${DOTNET_COMPAT} ; do
    + [ -d \${__dotnet_root} ] && break
    + done
    +
    + DOTNET_ROOT="\${__dotnet_root}"
    + export DOTNET_ROOT
    +
    + $(for var in "${DOTNET_LAUNCHERVARS[@]}" ; do
    + echo "${var}"
    + echo "export ${var%%=*}"
    + done)
    +
    + exec "${EPREFIX}${executable_path}" "\${@}"
    + EOF
    +
    + dodir "${DOTNET_LAUNCHERDEST}"
    + exeinto "${DOTNET_LAUNCHERDEST}"
    + doexe "${executable_target}"
    +}
    +
    +# @FUNCTION: dotnet-pkg-utils_dolauncher_portable
    +# @USAGE: <dll-path> <filename>
    +# @DESCRIPTION:
    +# Make a wrapper script to launch a .NET DLL file built from a .NET package.
    +#
    +# Parameters:
    +# ${1} - path of the DLL to launch,
    +# ${2} - filename of launcher to create.
    +#
    +# Example:
    +# @CODE
    +# dotnet-pkg-utils_dolauncher_portable \
    +# /usr/share/${P}/GentooDotnetInfo.dll gentoo-dotnet-info
    +# @CODE
    +#
    +# The path is prepended by "EPREFIX".
    +dotnet-pkg-utils_dolauncher_portable() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dll_path="${1}"
    + local executable_name="${2}"
    + local executable_target="${T}/${executable_name}"
    +
    + cat > "${executable_target}" <<-EOF

    Missing die.

    + #!/bin/sh
    +
    + # Lanucher script for ${dll_path} (${executable_name}),
    + # created from package "${CATEGORY}/${P}",
    + # compatible with any dotnet version, built on ${DOTNET_COMPAT}.
    +
    + $(for var in "${DOTNET_LAUNCHERVARS[@]}" ; do
    + echo "${var}"
    + echo "export ${var%%=*}"
    + done)
    +
    + exec dotnet exec "${EPREFIX}${dll_path}" "\${@}"
    + EOF
    +
    + dodir "${DOTNET_LAUNCHERDEST}"
    + exeinto "${DOTNET_LAUNCHERDEST}"
    + doexe "${executable_target}"
    +}
    +
    +fi


    --
    Have a great day!

    ~ Maciej XGQT Barć

    [email protected]
    Gentoo Linux developer
    (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt
    9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Maciej_Bar=c4=87?=@21:1/5 to All on Sun Jul 16 15:50:01 2023
    Offtopic: That calls for a YAS snippet ;D

    W dniu 16.07.2023 o 15:40, Ulrich Mueller pisze:
    On Sun, 16 Jul 2023, Maciej Barć wrote:

    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac

    The QA team has invested quite some work to unify that case block
    between different eclasses. So, please stay with the standard style:

    case ${EAPI} in
    7|8) ;;
    *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    esac

    --
    Have a great day!

    ~ Maciej XGQT Barć

    [email protected]
    Gentoo Linux developer
    (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt
    9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Maciej_Bar=c4=87?=@21:1/5 to All on Sun Jul 16 15:40:02 2023
    + local dotnet_project
    + for dotnet_project in "${DOTNET_PROJECTS[@]}" ; do
    + einfo "Running \"${@}\" for project: \"$(basename "${dotnet_project}")\""
    + "${@}" "${dotnet_project}"

    No die?


    Should be called by given function.

    Not sure how double dies would function.
    I think the 1st one triggers and second one might trigger if 1st one
    does not.

    So maybe it is good to add just in case.

    W dniu 16.07.2023 o 14:56, Sam James pisze:

    Maciej Barć <[email protected]> writes:

    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg.eclass | 249 +++++++++++++++++++++++++++++++++++++++
    1 file changed, 249 insertions(+)
    create mode 100644 eclass/dotnet-pkg.eclass

    diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass
    new file mode 100644
    index 0000000000..2b711467f5
    --- /dev/null
    +++ b/eclass/dotnet-pkg.eclass
    @@ -0,0 +1,249 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 7 8
    +# @PROVIDES: dotnet-pkg-utils nuget
    +# @BLURB: common functions and variables for .NET packages
    +# @DESCRIPTION:
    +# This eclass is designed to help with building and installing packages that
    +# use the .NET SDK.
    +#
    +# .NET SDK is a open-source framework from Microsoft, it is a cross-platform
    +# successor to .NET Framework.
    +#
    +# .NET packages require proper inspection before packaging:
    +# - the compatible .NET SDK version has to be declared,
    +# this can be done by inspecting the package's "*proj" files,
    +# unlike JAVA, .NET packages tend to lock onto one selected .NET SDK
    +# version, so building with other .NET versions will be mostly unsupported,
    +# - nugets, which are similar to JAVA's JARs (package .NET dependencies), >> +# have to be listed using either the "NUGETS" variable or bundled inside >> +# a "prebuilt" archive, in second case also the "NUGET_PACKAGES" variable >> +# has to be explicitly set.
    +# - the main project file (.*proj) that builds the project has to be specified
    +# by the "DOTNET_PROJECT" variable.
    +
    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac
    +
    +if [[ -z ${_DOTNET_PKG_ECLASS} ]] ; then
    +_DOTNET_PKG_ECLASS=1
    +
    +inherit dotnet-pkg-utils
    +
    +# @ECLASS_VARIABLE: DOTNET_PROJECTS
    +# @DEFAULT_UNSET
    +# @DESCRIPTION:
    +# Path to the main .NET project files (".csproj", ".fsproj", ".vbproj")
    +# used by default by "dotnet-pkg_src_compile" phase function.
    +#
    +# In .NET version 6.0 and lower it was possible to build a project solution >> +# (".sln") immediately with output to a specified directory ("--output DIR"),
    +# but versions >= 7.0 deprecated this behavior. This means that
    +# "dotnet-pkg-utils_build" will fail when pointed to a solution or a directory
    +# containing a solution file.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg-utils" eclass, but it is advised that it is set after
    +# the variable "${S}" is set, it should also integrate with it
    +# (see the example below).
    +#
    +# Example:
    +# @CODE
    +# SRC_URI="..."
    +# S="${S}"/src
    +#
    +# LICENSE="MIT"
    +# SLOT="0"
    +# KEYWORDS="~amd64"
    +#
    +# DOTNET_PROJECTS=( "${S}/DotnetProject" )
    +#
    +# src_prepare() {
    +# ...
    +# @CODE
    +
    +# @ECLASS_VARIABLE: DOTNET_RESTORE_EXTRA_ARGS
    +# @DESCRIPTION:
    +# Extra arguments to pass to the package restore, in the "src_configure" phase.
    +#
    +# This is passed only when restoring the specified "DOTNET_PROJECT".
    +# Other project restorers do not use this variable.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg.eclass", but it is advised that it is set after the variable >> +# "DOTNET_PROJECT" (from "dotnet-pkg-utils" eclass) is set.
    +#
    +# Default value is an empty array.
    +#
    +# For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_configure".
    +DOTNET_RESTORE_EXTRA_ARGS=()
    +
    +# @ECLASS_VARIABLE: DOTNET_BUILD_EXTRA_ARGS
    +# @DESCRIPTION:
    +# Extra arguments to pass to the package build, in the "src_compile" phase. >> +#
    +# This is passed only when building the specified "DOTNET_PROJECT".
    +# Other project builds do not use this variable.
    +#
    +# It is up to the maintainer if this variable is set before inheriting
    +# "dotnet-pkg.eclass", but it is advised that it is set after the variable >> +# "DOTNET_PROJECT" (from "dotnet-pkg-utils" eclass) is set.
    +#
    +# Default value is an empty array.
    +#
    +# Example:
    +# @CODE
    +# DOTNET_BUILD_EXTRA_ARGS=( -p:WarningLevel=0 )
    +# @CODE
    +#
    +# For more info see the "DOTNET_PROJECT" variable and "dotnet-pkg_src_compile".
    +DOTNET_BUILD_EXTRA_ARGS=()
    +
    +# @FUNCTION: dotnet-pkg_pkg_setup
    +# @DESCRIPTION:
    +# Default "pkg_setup" for the "dotnet-pkg" eclass.
    +# Pre-build configuration and checks.
    +#
    +# Calls "dotnet-pkg-utils_pkg_setup".
    +dotnet-pkg_pkg_setup() {
    + dotnet-pkg-utils_setup
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_unpack
    +# @DESCRIPTION:
    +# Default "src_unpack" for the "dotnet-pkg" eclass.
    +# Unpack the package sources.
    +#
    +# Includes a special exception for nugets (".nupkg" files) - they are instead
    +# copied into the "NUGET_PACKAGES" directory.
    +dotnet-pkg_src_unpack() {
    + nuget_link-system-nugets
    +
    + local archive
    + for archive in ${A} ; do
    + case ${archive} in
    + *.nupkg )
    + nuget_link "${DISTDIR}"/${archive}
    + ;;
    + * )
    + unpack ${archive}
    + ;;
    + esac
    + done
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_prepare
    +# @DESCRIPTION:
    +# Default "src_prepare" for the "dotnet-pkg" eclass.
    +# Prepare the package sources.
    +#
    +# Run "dotnet-pkg-utils_remove-global-json".
    +dotnet-pkg_src_prepare() {
    + dotnet-pkg-utils_remove-global-json
    +
    + default
    +}
    +
    +# @FUNCTION: dotnet-pkg_foreach-project
    +# @USAGE: <args> ...
    +# @DESCRIPTION:
    +# Run a specified command for each project listed inside the "DOTNET_PROJECTS"
    +# variable.
    +#
    +# Used by "dotnet-pkg_src_configure" and "dotnet-pkg_src_compile".
    +dotnet-pkg_foreach-project() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local dotnet_project
    + for dotnet_project in "${DOTNET_PROJECTS[@]}" ; do
    + einfo "Running \"${@}\" for project: \"$(basename "${dotnet_project}")\""
    + "${@}" "${dotnet_project}"

    No die?

    + done
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_configure
    +# @DESCRIPTION:
    +# Default "src_configure" for the "dotnet-pkg" eclass.
    +# Configure the package.
    +#
    +# First show information about current .NET SDK that is being used,
    +# then restore the project file specified by "DOTNET_PROJECT",
    +# afterwards restore any found solutions.
    +dotnet-pkg_src_configure() {
    + dotnet-pkg-utils_info
    +
    + dotnet-pkg_foreach-project \
    + dotnet-pkg-utils_restore "${DOTNET_RESTORE_EXTRA_ARGS[@]}"
    +
    + dotnet-pkg-utils_foreach-solution dotnet-pkg-utils_restore "$(pwd)"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_compile
    +# @DESCRIPTION:
    +# Default "src_compile" for the "dotnet-pkg" eclass.
    +# Build the package.
    +#
    +# Build the package using "dotnet build" in the directory specified by either
    +# "DOTNET_PROJECT" or "S" (temporary build directory) variables.
    +#
    +# For more info see: "DOTNET_PROJECT" variable
    +# and "dotnet-pkg-utils_get-project" function.
    +dotnet-pkg_src_compile() {
    + dotnet-pkg_foreach-project \
    + dotnet-pkg-utils_build "${DOTNET_BUILD_EXTRA_ARGS[@]}"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_test
    +# @DESCRIPTION:
    +# Default "src_test" for the "dotnet-pkg" eclass.
    +# Test the package.
    +#
    +# Test the package by testing any found solutions.
    +#
    +# It is very likely that this function will either not execute any tests or >> +# will execute wrong or incomplete test suite. Maintainers should inspect if
    +# any and/or correct tests are ran.
    +dotnet-pkg_src_test() {
    + dotnet-pkg-utils_foreach-solution dotnet-pkg-utils_test "$(pwd)"
    +}
    +
    +# @FUNCTION: dotnet-pkg_src_install
    +# @DESCRIPTION:
    +# Default "src_install" for the "dotnet-pkg" eclass.
    +# Install the package.
    +#
    +# This is the default package install function for the "dotnet-pkg" eclass. >> +#
    +# It is very likely that this function is either insufficient or has to be >> +# redefined in a ebuild.
    +dotnet-pkg_src_install() {
    + # Install the compiled .NET package artifacts,
    + # for more info see "dotnet-pkg-utils_install" and "DOTNET_OUTPUT".
    + dotnet-pkg-utils_install
    +
    + # Create launcher from the .NET package directory to "/usr/bin".
    + # For example: /usr/bin/Nake -> /usr/share/nake-3.0.0/Nake
    + dotnet-pkg-utils_dolauncher /usr/share/${P}/${PN^}
    +
    + # Create a compatibility symlink and also for ease of use from CLI.
    + dosym -r /usr/bin/${PN^} /usr/bin/${PN}
    +
    + einstalldocs
    +}
    +
    +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install
    +
    +fi


    --
    Have a great day!

    ~ Maciej XGQT Barć

    [email protected]
    Gentoo Linux developer
    (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt
    9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ulrich Mueller@21:1/5 to All on Sun Jul 16 15:50:01 2023
    On Sun, 16 Jul 2023, Maciej Barć wrote:

    +case "${EAPI}" in
    + 7 | 8 )
    + :
    + ;;
    + * )
    + die "${ECLASS}: EAPI ${EAPI} unsupported."
    + ;;
    +esac

    The QA team has invested quite some work to unify that case block
    between different eclasses. So, please stay with the standard style:

    case ${EAPI} in
    7|8) ;;
    *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    esac

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

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

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmSz82MPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4u2C8IAJnANTVevY2KjFejT21O6vdnGb/JTC/5wbck Z4z4nCgR3ElyGJqE5RhE3IqN9EGD3p8aN82XUAYW4EhMzE0ogtxJ97Rr/wgcOFfW FVfnHkGldNRmpMgu9i3WfMNfZfa7J3xvg8TiQOEqsvYYAsjNLyYSMHF2YtGVyl3X zwd4K6ii94l6oDjMo9ctJGRT4K/iDi9SR15yaXQpRqY/voUxxEusA1hvZXHxmSgh Avu1n0paYth0aWrrklUEXh4Edxtp60zaKB6F8re87wfaRlUBSAuQTtJ6lieskCbr 15SlHvv5I2TiEiOSZXHB3vM3H24jx6oATpeHFMEj+a24bb8Hqko=XBF0
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    app-eselect/eselect-dotnet/Manifest | 1 +
    .../eselect-dotnet-0.1.0.ebuild | 25 +++++++++++++++++++
    app-eselect/eselect-dotnet/metadata.xml | 9 +++++++
    3 files changed, 35 insertions(+)
    create mode 100644 app-eselect/eselect-dotnet/Manifest
    create mode 100644 app-eselect/eselect-dotnet/eselect-dotnet-0.1.0.ebuild
    create mode 100644 app-eselect/eselect-dotnet/metadata.xml

    diff --git a/app-eselect/eselect-dotnet/Manifest b/app-eselect/eselect-dotnet/Manifest
    new file mode 100644
    index 000000000..9cf36cadf
    --- /dev/null
    +++ b/app-eselect/eselect-dotnet/Manifest
    @@ -0,0 +1 @@
    +DIST eselect-dotnet-0.1.0.tar.bz2 7788 BLAKE2B 141e5a2fc765454682de60a6a337d6634766b4dd76f218606e2f4eb18960fdcf8940b954deda2fb6b0903f72b161513936c1d767210883316c32200704188945 SHA512
    879281ffff019d1e4a8a5ee3d3e6b6de3446ba573d253a5b3b0c59aa9faffcd6eb4382066e1752e18cb4e48c3e14340a278b2189c2674b1baa258ceb3980d13a
    diff --git a/app-eselect/eselect-dotnet/eselect-dotnet-0.1.0.ebuild b/a
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/nuget.eclass | 188 ++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 188 insertions(+)
    create mode 100644 eclass/nuget.eclass

    diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
    new file mode 100644
    index 000000000..320573c53
    --- /dev/null
    +++ b/eclass/nuget.eclass
    @@ -0,0 +1,188 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: nuget.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @BLURB: common functions and variables for handling .NET NuGets
    +# @DESCRIPTION:
    +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files. +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    +esac
    +
    +if [[ -z ${_NUGET_ECLASS
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    dev-dotnet/dotnet-sdk-bin/Manifest | 8 +--
    .../dotnet-sdk-bin-6.0.402-r3.ebuild | 65 ------------------
    .../dotnet-sdk-bin-6.0.404.ebuild | 67 -------------------
    .../dotnet-sdk-bin-7.0.200.ebuild | 67 -------------------
    4 files changed, 1 insertion(+), 206 deletions(-)
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-6.0.402-r3.ebuild
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-6.0.404.ebuild
    delete mode 100644 dev-dotnet/dotnet-sdk-bin/dotnet-sdk-bin-7.0.200.ebuild

    diff --git a/dev-dotnet/dotnet-sdk-bin/Manifest b/dev-dotnet/dotnet-sdk-bin/Manifest
    index 34d9d1689..8469c78ba 100644
    --- a/dev-dotnet/dotnet-sdk-bin/Manifest
    +++ b/dev-dotnet/dotnet-sdk-bin/Manifest
    @@ -1,15 +1,9 @@
    -DIST dotnet-sdk-6.0.402-linux-arm.tar.gz 181622588 BLAKE2B 1010a7cd9f598e0487af127f9e1dac86681479cd6d95e39eb5f1fbf555fd3923be7e2a56bf0bc878259c17e7eb66b711da9587fcfc8ac3ab5f5b17abff1c6da7
    -DIST dotnet-sdk-6.0.402-linux-arm64.tar.gz
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg.eclass | 246 +++++++++++++++++++++++++++++++++++++++
    1 file changed, 246 insertions(+)
    create mode 100644 eclass/dotnet-pkg.eclass

    diff --git a/eclass/dotnet-pkg.eclass b/eclass/dotnet-pkg.eclass
    new file mode 100644
    index 000000000..6d1f15985
    --- /dev/null
    +++ b/eclass/dotnet-pkg.eclass
    @@ -0,0 +1,246 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: dotnet-pkg-utils nuget
    +# @BLURB: common functions and variables for .NET packages
    +# @DESCRIPTION:
    +# This eclass is designed to help with building and installing packages that +# use the .NET SDK.
    +#
    +# .NET SDK is a open-source framework from Microsoft, it is a cross-platform +# successor to .NET Framework.
    +#
    +# .NET packages requir
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 602 +++++++++++++++++++++++++++++++++
    1 file changed, 602 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass new file mode 100644
    index 000000000..bdde11fe5
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,602 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.
    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLAS
  • From =?UTF-8?q?Maciej=20Bar=C4=87?=@21:1/5 to All on Sun Jul 30 16:30:01 2023
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    dev-dotnet/dotnet-runtime-nugets/Manifest | 117 ++++++++++++++++++
    .../dotnet-runtime-nugets-3.1.32.ebuild | 45 +++++++
    .../dotnet-runtime-nugets-6.0.12.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-6.0.14.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-6.0.16.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-7.0.3.ebuild | 48 +++++++
    .../dotnet-runtime-nugets-7.0.5.ebuild | 48 +++++++
    dev-dotnet/dotnet-runtime-nugets/metadata.xml | 9 ++
    8 files changed, 411 insertions(+)
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/Manifest
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-3.1.32.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.12.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.14.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotnet-runtime-nugets-6.0.16.ebuild
    create mode 100644 dev-dotnet/dotnet-runtime-nugets/dotn
  • From =?UTF-8?Q?Maciej_Bar=C4=87?=@21:1/5 to All on Sun Jul 30 22:10:01 2023
    W dniu 30.07.2023 o 21:34, Michał Górny pisze:
    On Sun, 2023-07-30 at 16:26 +0200, Maciej Barć wrote:
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 602 +++++++++++++++++++++++++++++++++
    1 file changed, 602 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass >> new file mode 100644
    index 000000000..bdde11fe5
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,602 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages. >> +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.

    Given how intrusive this is, I don't think "-utils" is a correct suffix.
    It's for eclasses providing utility functions without affecting packages implicitly.


    What about "-common", like "elisp-common.eclass" has?

    Any suggestion?

    BTW: I will not merge dotnet-pkg and dotnet-pkg-utils because then we
    will get the most perfect spaghetti-code-soup-thing known to men.

    --
    Have a great day!

    ~ Maciej XGQT Barć

    [email protected]
    Gentoo Linux developer
    (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt
    9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C

    --- 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 All on Sun Jul 30 21:40:01 2023
    On Sun, 2023-07-30 at 16:26 +0200, Maciej Barć wrote:
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/nuget.eclass | 188 ++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 188 insertions(+)
    create mode 100644 eclass/nuget.eclass

    diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
    new file mode 100644
    index 000000000..320573c53
    --- /dev/null
    +++ b/eclass/nuget.eclass
    @@ -0,0 +1,188 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: nuget.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @BLURB: common functions and variables for handling .NET NuGets
    +# @DESCRIPTION:
    +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.

    This doesn't say anything about why or how you'd use the eclass.

    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    +esac
    +
    +if [[ -z ${_NUGET_ECLASS} ]] ; then
    +_NUGET_ECLASS=1
    +
    +# @ECLASS_VARIABLE: SYSTEM_NUGETS
    +# @DESCRIPTION:
    +# Location of the system NuGet packages directory. +SYSTEM_NUGETS=/opt/dotnet-nugets

    What is the usage for this variable? Is it a fixed value or something
    to be overriden in ebuilds? Is it private or public?

    Also namespace it to NUGET_*.

    +
    +# @ECLASS_VARIABLE: NUGET_APIS
    +# @DESCRIPTION:
    +# NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads.
    +# Set or append to this variable post-inherit, but before calling
    +# the "nuget_uris" function, preferably just before "SRC_URI".
    +#
    +# Example:
    +# @CODE
    +# SRC_URI="https://example.com/example.tar.xz"
    +# NUGET_APIS+=( "https://api.nuget.org/v3-flatcontainer" )
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +NUGET_APIS=( "https://api.nuget.org/v3-flatcontainer" )

    I'd be useful to explain what the default is.

    +
    +# @ECLASS_VARIABLE: NUGET_PACKAGES
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# Path from where NuGets will be restored from.

    This doesn't say anything to someone who doesn't know deep technical
    details.

    +# Defaults to ${T}/nugets for use with "nuget_uris" but may be set to a custom
    +# location to, for example, restore NuGets extracted form a prepared archive.
    +# Do not set this variable in conjunction with non-empty "NUGETS".
    +if [[ "${NUGETS}" ]] || [[ ! "${NUGET_PACKAGES}" ]] ; then

    Combine the [[ ]]s.

    Also, in general I'd suggest using '-z'/'-n' explicitly when it's
    a empty/non-empty string with a meaningful value rather than a boolean.

    + NUGET_PACKAGES="${T}"/nugets
    +fi
    +export NUGET_PACKAGES
    +
    +# @ECLASS_VARIABLE: NUGETS
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# String containing all NuGet packages that need to be downloaded.
    +# Used by "nuget_uris".
    +#
    +# Example:
    +# @CODE
    +# NUGETS="
    +# ImGui.NET-1.87.2
    +# Config.Net-4.19.0
    +# "
    +#
    +# inherit dotnet-pkg
    +#
    +# ...
    +#
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +
    +# @FUNCTION: nuget_uris
    +# @USAGE: <nuget...>
    +# @DESCRIPTION:
    +# Generates the URIs to put in SRC_URI to help fetch dependencies.
    +# If no arguments provided, uses the "NUGETS" variable.

    Sounds like you're copying the old, horribly slow cargo.eclass API.
    Don't do that, unless you have to. Prefer variable-setting approach
    used by modern cargo.eclass.

    +nuget_uris() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local -r regex='^([a-zA-Z0-9_.-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'

    Sounds like you're copying the second super-horribly slow approach of cargo.eclass. Don't do that.

    + local nugets
    +
    + if (( ${#} != 0 )) ; then
    + nugets="${@}"
    + elif [[ ${NUGETS} ]] ; then
    + nugets="${NUGETS}"
    + else
    + eerror "NUGETS variable is not defined and nothing passed as argument"
    + die "${FUNCNAME}: Can't generate SRC_URI from empty input"
    + fi
    +
    + local nuget name version nuget_api url
    + for nuget in ${nugets} ; do
    + [[ ${nuget} =~ ${regex} ]] ||
    + die "${FUNCNAME}: Could not parse given nuget: ${nuget}"
    +
    + name="${BASH_REMATCH[1]}"
    + version="${BASH_REMATCH[2]}"
    +
    + for nuget_api in "${NUGET_APIS[@]}" ; do
    + case "${nuget_api}" in
    + */v2 | */v2/ )
    + url="${nuget_api}/package/${name}/${version}
    + -> ${name}.${version}.nupkg"
    + ;;
    + * )
    + url="${nuget_api}/${name}/${version}/${name}.${version}.nupkg"
    + ;;
    + esac
    + echo "${url}"
    + done
    + done
    +}
    +
    +# @FUNCTION: nuget_link
    +# @USAGE: <nuget-path>
    +# @DESCRIPTION:
    +# Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES"
    +# directory.
    +#
    +# Example:
    +# @CODE
    +# nuget_link "${DISTDIR}"/pkg.0.nupkg
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link() {
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no nuget path given"
    +
    + mkdir -p "${NUGET_PACKAGES}" || die
    +
    + local nuget_name="${1##*/}"
    +
    + if [[ -f "${NUGET_PACKAGES}"/${nuget_name} ]] ; then
    + ewarn "${FUNCNAME}: ${nuget_name} already exists"

    What does that mean? What is the user supposed to do about it? Is it
    normal? If it's normal, then why are you warning about it? If it isn't normal, then why isn't this fatal?

    + else
    + ln -s "${1}" "${NUGET_PACKAGES}"/${nuget_name} || die
    + fi
    +}
    +
    +# @FUNCTION: nuget_link-system-nugets
    +# @DESCRIPTION:
    +# Link all system NuGet packages to the "NUGET_PACKAGES" directory.
    +#
    +# Example:
    +# @CODE
    +# src_unpack() {
    +# nuget_link-system-nugets
    +# default
    +# }
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link-system-nugets() {
    + local runtime_nuget
    + for runtime_nuget in "${EPREFIX}${SYSTEM_NUGETS}"/*.nupkg ; do
    + if [[ -f "${runtime_nuget}" ]] ; then
    + nuget_link "${runtime_nuget}"
    + fi
    + done
    +}
    +
    +# @FUNCTION: nuget_donuget
    +# @USAGE: <nuget-path> ...
    +# @DESCRIPTION:
    +# Install NuGet package(s) at "nuget-path" to the system nugets directory. +#
    +# Example:
    +# @CODE
    +# src_install() {
    +# nuget_donuget my-pkg.nupkg
    +# }
    +# @CODE
    +nuget_donuget() {
    + insinto "${SYSTEM_NUGETS}"
    + doins "${@}"
    +}
    +
    +fi

    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Maciej_Bar=C4=87?=@21:1/5 to All on Sun Jul 30 22:10:01 2023
    W dniu 30.07.2023 o 21:30, Michał Górny pisze:
    On Sun, 2023-07-30 at 16:26 +0200, Maciej Barć wrote:
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/nuget.eclass | 188 ++++++++++++++++++++++++++++++++++++++++++++
    1 file changed, 188 insertions(+)
    create mode 100644 eclass/nuget.eclass

    diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
    new file mode 100644
    index 000000000..320573c53
    --- /dev/null
    +++ b/eclass/nuget.eclass
    @@ -0,0 +1,188 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: nuget.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @BLURB: common functions and variables for handling .NET NuGets
    +# @DESCRIPTION:
    +# This eclass is designed to provide support for .NET NuGet's ".nupkg" files.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.

    This doesn't say anything about why or how you'd use the eclass.

    +
    +case ${EAPI} in
    + 8) ;;
    + *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
    +esac
    +
    +if [[ -z ${_NUGET_ECLASS} ]] ; then
    +_NUGET_ECLASS=1
    +
    +# @ECLASS_VARIABLE: SYSTEM_NUGETS
    +# @DESCRIPTION:
    +# Location of the system NuGet packages directory.
    +SYSTEM_NUGETS=/opt/dotnet-nugets

    What is the usage for this variable? Is it a fixed value or something
    to be overriden in ebuilds? Is it private or public?

    Also namespace it to NUGET_*.


    It's too verbose imho, but sure.

    +
    +# @ECLASS_VARIABLE: NUGET_APIS
    +# @DESCRIPTION:
    +# NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads. >> +# Set or append to this variable post-inherit, but before calling
    +# the "nuget_uris" function, preferably just before "SRC_URI".
    +#
    +# Example:
    +# @CODE
    +# SRC_URI="https://example.com/example.tar.xz"
    +# NUGET_APIS+=( "https://api.nuget.org/v3-flatcontainer" )
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +NUGET_APIS=( "https://api.nuget.org/v3-flatcontainer" )

    I'd be useful to explain what the default is.

    +
    +# @ECLASS_VARIABLE: NUGET_PACKAGES
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# Path from where NuGets will be restored from.

    This doesn't say anything to someone who doesn't know deep technical
    details.


    Without duplicating MS docs how else yould You describe this variable?

    deep technical details.

    "Restore" is standard .NET terminology.

    Maybe something like: "this variable influences the dotnet executable behavior"?

    Not sure what you want here.

    +# Defaults to ${T}/nugets for use with "nuget_uris" but may be set to a custom
    +# location to, for example, restore NuGets extracted form a prepared archive.
    +# Do not set this variable in conjunction with non-empty "NUGETS".
    +if [[ "${NUGETS}" ]] || [[ ! "${NUGET_PACKAGES}" ]] ; then

    Combine the [[ ]]s.

    Also, in general I'd suggest using '-z'/'-n' explicitly when it's
    a empty/non-empty string with a meaningful value rather than a boolean.

    + NUGET_PACKAGES="${T}"/nugets
    +fi
    +export NUGET_PACKAGES
    +
    +# @ECLASS_VARIABLE: NUGETS
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# String containing all NuGet packages that need to be downloaded.
    +# Used by "nuget_uris".
    +#
    +# Example:
    +# @CODE
    +# NUGETS="
    +# ImGui.NET-1.87.2
    +# Config.Net-4.19.0
    +# "
    +#
    +# inherit dotnet-pkg
    +#
    +# ...
    +#
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +
    +# @FUNCTION: nuget_uris
    +# @USAGE: <nuget...>
    +# @DESCRIPTION:
    +# Generates the URIs to put in SRC_URI to help fetch dependencies.
    +# If no arguments provided, uses the "NUGETS" variable.

    Sounds like you're copying the old, horribly slow cargo.eclass API.
    Don't do that, unless you have to. Prefer variable-setting approach
    used by modern cargo.eclass.


    Please elaborate.

    Maybe such mechanisms could be extracted into standalone eclass? I do
    not know cargo, rust nor how it is used in Gentoo.

    +nuget_uris() {
    + debug-print-function ${FUNCNAME} "${@}"
    +
    + local -r regex='^([a-zA-Z0-9_.-]+)-([0-9]+\.[0-9]+\.[0-9]+.*)$'

    Sounds like you're copying the second super-horribly slow approach of cargo.eclass. Don't do that.

    + local nugets
    +
    + if (( ${#} != 0 )) ; then
    + nugets="${@}"
    + elif [[ ${NUGETS} ]] ; then
    + nugets="${NUGETS}"
    + else
    + eerror "NUGETS variable is not defined and nothing passed as argument"
    + die "${FUNCNAME}: Can't generate SRC_URI from empty input"
    + fi
    +
    + local nuget name version nuget_api url
    + for nuget in ${nugets} ; do
    + [[ ${nuget} =~ ${regex} ]] ||
    + die "${FUNCNAME}: Could not parse given nuget: ${nuget}"
    +
    + name="${BASH_REMATCH[1]}"
    + version="${BASH_REMATCH[2]}"
    +
    + for nuget_api in "${NUGET_APIS[@]}" ; do
    + case "${nuget_api}" in
    + */v2 | */v2/ )
    + url="${nuget_api}/package/${name}/${version}
    + -> ${name}.${version}.nupkg"
    + ;;
    + * )
    + url="${nuget_api}/${name}/${version}/${name}.${version}.nupkg"
    + ;;
    + esac
    + echo "${url}"
    + done
    + done
    +}
    +
    +# @FUNCTION: nuget_link
    +# @USAGE: <nuget-path>
    +# @DESCRIPTION:
    +# Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES"
    +# directory.
    +#
    +# Example:
    +# @CODE
    +# nuget_link "${DISTDIR}"/pkg.0.nupkg
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link() {
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no nuget path given"
    +
    + mkdir -p "${NUGET_PACKAGES}" || die
    +
    + local nuget_name="${1##*/}"
    +
    + if [[ -f "${NUGET_PACKAGES}"/${nuget_name} ]] ; then
    + ewarn "${FUNCNAME}: ${nuget_name} already exists"

    What does that mean? What is the user supposed to do about it? Is it normal? If it's normal, then why are you warning about it? If it isn't normal, then why isn't this fatal?

    This can happen if NuGets copied from SYSTEM_NUGETS are overwritten by
    ones specified in ebuild.

    This might be desired by ebuild author.

    We need to have this logged, I think ewarn is appropriate.


    + else
    + ln -s "${1}" "${NUGET_PACKAGES}"/${nuget_name} || die
    + fi
    +}
    +
    +# @FUNCTION: nuget_link-system-nugets
    +# @DESCRIPTION:
    +# Link all system NuGet packages to the "NUGET_PACKAGES" directory.
    +#
    +# Example:
    +# @CODE
    +# src_unpack() {
    +# nuget_link-system-nugets
    +# default
    +# }
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link-system-nugets() {
    + local runtime_nuget
    + for runtime_nuget in "${EPREFIX}${SYSTEM_NUGETS}"/*.nupkg ; do
    + if [[ -f "${runtime_nuget}" ]] ; then
    + nuget_link "${runtime_nuget}"
    + fi
    + done
    +}
    +
    +# @FUNCTION: nuget_donuget
    +# @USAGE: <nuget-path> ...
    +# @DESCRIPTION:
    +# Install NuGet package(s) at "nuget-path" to the system nugets directory. >> +#
    +# Example:
    +# @CODE
    +# src_install() {
    +# nuget_donuget my-pkg.nupkg
    +# }
    +# @CODE
    +nuget_donuget() {
    + insinto "${SYSTEM_NUGETS}"
    + doins "${@}"
    +}
    +
    +fi


    --
    Have a great day!

    ~ Maciej XGQT Barć

    [email protected]
    Gentoo Linux developer
    (dotnet, emacs, math, ml, nim, scheme, sci) https://wiki.gentoo.org/wiki/User:Xgqt
    9B0A 4C5D 02A3 B43C 9D6F D6B1 14D7 4A1F 43A6 AC3C

    --- 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 All on Sun Jul 30 21:40:01 2023
    On Sun, 2023-07-30 at 16:26 +0200, Maciej Barć wrote:
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 602 +++++++++++++++++++++++++++++++++
    1 file changed, 602 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass new file mode 100644
    index 000000000..bdde11fe5
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,602 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages. +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.

    Given how intrusive this is, I don't think "-utils" is a correct suffix.
    It's for eclasses providing utility functions without affecting packages implicitly.

    --
    Best regards,
    Michał Górny

    --- 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 All on Mon Jul 31 07:10:01 2023
    On Sun, 2023-07-30 at 22:01 +0200, Maciej Barć wrote:
    +# @ECLASS_VARIABLE: NUGETS
    +# @DEFAULT_UNSET
    +# @PRE_INHERIT
    +# @DESCRIPTION:
    +# String containing all NuGet packages that need to be downloaded.
    +# Used by "nuget_uris".
    +#
    +# Example:
    +# @CODE
    +# NUGETS="
    +# ImGui.NET-1.87.2
    +# Config.Net-4.19.0
    +# "
    +#
    +# inherit dotnet-pkg
    +#
    +# ...
    +#
    +# SRC_URI+=" $(nuget_uris) "
    +# @CODE
    +
    +# @FUNCTION: nuget_uris
    +# @USAGE: <nuget...>
    +# @DESCRIPTION:
    +# Generates the URIs to put in SRC_URI to help fetch dependencies.
    +# If no arguments provided, uses the "NUGETS" variable.

    Sounds like you're copying the old, horribly slow cargo.eclass API.
    Don't do that, unless you have to. Prefer variable-setting approach
    used by modern cargo.eclass.


    Please elaborate.

    Maybe such mechanisms could be extracted into standalone eclass? I do
    not know cargo, rust nor how it is used in Gentoo.


    Calling subshells in global scope is a very bad idea, and it is
    completely unnecessary in the most common case when NUGETS are defined
    prior to inherit and URIs are inserted into top-level SRC_URI.

    Just look at cargo.eclass.

    +# @FUNCTION: nuget_link
    +# @USAGE: <nuget-path>
    +# @DESCRIPTION:
    +# Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES" +# directory.
    +#
    +# Example:
    +# @CODE
    +# nuget_link "${DISTDIR}"/pkg.0.nupkg
    +# @CODE
    +#
    +# This function is used inside "dotnet-pkg_src_unpack"
    +# from the "dotnet-pkg" eclass.
    +nuget_link() {
    + [[ ! "${1}" ]] && die "${FUNCNAME}: no nuget path given"
    +
    + mkdir -p "${NUGET_PACKAGES}" || die
    +
    + local nuget_name="${1##*/}"
    +
    + if [[ -f "${NUGET_PACKAGES}"/${nuget_name} ]] ; then
    + ewarn "${FUNCNAME}: ${nuget_name} already exists"

    What does that mean? What is the user supposed to do about it? Is it normal? If it's normal, then why are you warning about it? If it isn't normal, then why isn't this fatal?

    This can happen if NuGets copied from SYSTEM_NUGETS are overwritten by
    ones specified in ebuild.

    This might be desired by ebuild author.

    We need to have this logged, I think ewarn is appropriate.

    ewarn is a warning for the end user. The end user doesn't benefit from
    being warned for "ebuild is doing something that might be wrong, or
    might be perfectly fine, ignore this".

    --
    Best regards,
    Michał Górny

    --- 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 Florian Schmaus on Mon Jul 31 07:10:01 2023
    On Sun, 2023-07-30 at 22:19 +0200, Florian Schmaus wrote:
    Which problem are we solving by moving away from this towards a slightly more verbose construct?

    The problem was that cargo.eclass ebuilds were taking significant time
    during cache regeneration and slowing down tools noticeably. No fancy
    loops required, contrary to your great theory.

    --
    Best regards,
    Michał Górny

    --- 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 All on Mon Jul 31 07:10:01 2023
    On Sun, 2023-07-30 at 22:04 +0200, Maciej Barć wrote:
    W dniu 30.07.2023 o 21:34, Michał Górny pisze:
    On Sun, 2023-07-30 at 16:26 +0200, Maciej Barć wrote:
    Bug: https://bugs.gentoo.org/900597
    Bug: https://github.com/gentoo/gentoo/pull/29309
    Signed-off-by: Maciej Barć <[email protected]>
    ---
    eclass/dotnet-pkg-utils.eclass | 602 +++++++++++++++++++++++++++++++++
    1 file changed, 602 insertions(+)
    create mode 100644 eclass/dotnet-pkg-utils.eclass

    diff --git a/eclass/dotnet-pkg-utils.eclass b/eclass/dotnet-pkg-utils.eclass
    new file mode 100644
    index 000000000..bdde11fe5
    --- /dev/null
    +++ b/eclass/dotnet-pkg-utils.eclass
    @@ -0,0 +1,602 @@
    +# Copyright 1999-2023 Gentoo Authors
    +# Distributed under the terms of the GNU General Public License v2
    +
    +# @ECLASS: dotnet-pkg-utils.eclass
    +# @MAINTAINER:
    +# Gentoo Dotnet project <[email protected]>
    +# @AUTHOR:
    +# Anna Figueiredo Gomes <[email protected]>
    +# Maciej Barć <[email protected]>
    +# @SUPPORTED_EAPIS: 8
    +# @PROVIDES: nuget
    +# @BLURB: common functions and variables for builds using .NET SDK
    +# @DESCRIPTION:
    +# This eclass is designed to provide common definitions for .NET packages.
    +#
    +# This eclass does not export any phase functions, for that see
    +# the "dotnet-pkg" eclass.

    Given how intrusive this is, I don't think "-utils" is a correct suffix. It's for eclasses providing utility functions without affecting packages implicitly.


    What about "-common", like "elisp-common.eclass" has?


    Works for me. It probably still doesn't really explain when you want "- common", and when you want the main eclass. I may have better
    suggestions if I figured that out.


    --
    Best regards,
    Michał Górny

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to Florian Schmaus on Mon Jul 31 11:40:01 2023
    Florian Schmaus <[email protected]> writes:

    [[PGP Signed Part:Undecided]]
    On 31/07/2023 07.02, Michał Górny wrote:
    On Sun, 2023-07-30 at 22:19 +0200, Florian Schmaus wrote:
    Which problem are we solving by moving away from this towards a slightly >>> more verbose construct?
    The problem was that cargo.eclass ebuilds were taking significant
    time
    during cache regeneration and slowing down tools noticeably. No fancy
    loops required, contrary to your great theory.

    Removing the $()/fork from go-modules.eclass reduced the source time
    of a package from 2400 milliseconds to 236 milliseconds.

    Changing, for example net-p2p/arti-1.1.6, to use _cargo_set_crate_uris reduces the source time from 44 milliseconds to 24 milliseconds.

    That is a win in relative reduction, but absolute its just 20
    milliseconds. Cache regeneration is an embarrassingly parallel
    problem. Therefore such a reduction should not matter much, assuming
    you have some parallelism on the hardware level.

    Consistency matters and I already raised the point last week as well.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Thomas Bracht Laumann Jespersen@21:1/5 to All on Mon Jul 31 11:40:01 2023
    +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install

    EXPORT_FUNCTIONS should go outside the inherit guard (see https://devmanual.gentoo.org/eclass-writing/index.html#export-functions)
    - unless I'm missing something and there's a specific reason to put it
    inside.

    +
    +fi

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to Florian Schmaus on Mon Jul 31 13:50:01 2023
    Florian Schmaus <[email protected]> writes:

    [[PGP Signed Part:Undecided]]
    On 31/07/2023 11.32, Sam James wrote:
    Florian Schmaus <[email protected]> writes:

    [[PGP Signed Part:Undecided]]
    On 31/07/2023 07.02, Michał Górny wrote:
    On Sun, 2023-07-30 at 22:19 +0200, Florian Schmaus wrote:
    Which problem are we solving by moving away from this towards a slightly >>>>> more verbose construct?
    The problem was that cargo.eclass ebuilds were taking significant
    time
    during cache regeneration and slowing down tools noticeably. No fancy >>>> loops required, contrary to your great theory.

    Removing the $()/fork from go-modules.eclass reduced the source time
    of a package from 2400 milliseconds to 236 milliseconds.

    Changing, for example net-p2p/arti-1.1.6, to use _cargo_set_crate_uris
    reduces the source time from 44 milliseconds to 24 milliseconds.

    That is a win in relative reduction, but absolute its just 20
    milliseconds. Cache regeneration is an embarrassingly parallel
    problem. Therefore such a reduction should not matter much, assuming
    you have some parallelism on the hardware level.
    Consistency matters

    Sure, I would be in favor of consistently using $(foo_uris).

    Too late for that. Please don't reopen the cargo.eclass issue
    unnecessarily.


    Especially since the performance gains of the variable-setting
    approach are even lower than I first assumed. The cargo.eclass runs
    the function that computes CARGO_CRATE_URIS now twice, which adds significantly more overhead than the fork of $(foo_uris). See my patch
    to the ML.

    and I already raised the point last week as well.

    Here on the mailing list, or somewhere else?


    Here on the mailing list.

    --- 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 Florian Schmaus on Mon Jul 31 16:00:01 2023
    On Mon, 2023-07-31 at 12:49 +0200, Florian Schmaus wrote:
    On 31/07/2023 11.32, Sam James wrote:

    Florian Schmaus <[email protected]> writes:

    [[PGP Signed Part:Undecided]]
    On 31/07/2023 07.02, Michał Górny wrote:
    On Sun, 2023-07-30 at 22:19 +0200, Florian Schmaus wrote:
    Which problem are we solving by moving away from this towards a slightly
    more verbose construct?
    The problem was that cargo.eclass ebuilds were taking significant
    time
    during cache regeneration and slowing down tools noticeably. No fancy loops required, contrary to your great theory.

    Removing the $()/fork from go-modules.eclass reduced the source time
    of a package from 2400 milliseconds to 236 milliseconds.

    Changing, for example net-p2p/arti-1.1.6, to use _cargo_set_crate_uris reduces the source time from 44 milliseconds to 24 milliseconds.

    That is a win in relative reduction, but absolute its just 20 milliseconds. Cache regeneration is an embarrassingly parallel
    problem. Therefore such a reduction should not matter much, assuming
    you have some parallelism on the hardware level.

    Consistency matters

    Sure, I would be in favor of consistently using $(foo_uris).

    Especially since the performance gains of the variable-setting approach
    are even lower than I first assumed. The cargo.eclass runs the function
    that computes CARGO_CRATE_URIS now twice, which adds significantly more overhead than the fork of $(foo_uris). See my patch to the ML.


    So, to summarize, your point is that after you've ignored the original
    thread and we've actually started switching stuff to ${xxx}, we should
    reopen the discussion and start moving everything back to $(xxx), even
    though you've proven yourself that it's less optimal ("but only
    a little!") and because... you prefer it? Yes, that certainly makes
    sense. It's surely a great way to run a distro is to undo optimizations
    6 weeks later because you liked the old variant better.

    --
    Best regards,
    Michał Górny

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