NUGET.ECLASS

Section: eclass-manpages (5)
Updated: Jun 2024
Index Return to Main Contents

NAME

nuget.eclass - common functions and variables for handling .NET NuGets

DESCRIPTION

This eclass is designed to provide support for .NET NuGet's ".nupkg" files. It is used to handle NuGets installation and usage. "dotnet-pkg" and "dotnet-pkg-utils" inherit this eclass.

This eclass does not export any phase functions, for that see the "dotnet-pkg" eclass.

SUPPORTED EAPIS

8

FUNCTIONS

_nuget_set_nuget_uris <nugets>
Generates the URIs to put in SRC_URI to help fetch dependencies. Constructs a list of NuGets from its arguments. The value is set as "NUGET_URIS".
nuget_link <nuget-path>
Link a specified NuGet package at "nuget-path" to the "NUGET_PACKAGES" directory.

Example:

nuget_link "${DISTDIR}"/pkg.0.nupkg

This function is used inside "dotnet-pkg_src_unpack" from the "dotnet-pkg" eclass.

nuget_link-system-nugets
Link all system NuGet packages to the "NUGET_PACKAGES" directory.

Example:

src_unpack() {
    nuget_link-system-nugets
    default
}

This function is used inside "dotnet-pkg_src_unpack" from the "dotnet-pkg" eclass.

nuget_link-nuget-archives
Link NuGet packages from package source files to the "NUGET_PACKAGES" directory.

This is a complementary function to "nuget_unpack-non-nuget-archives".

This function is used inside "dotnet-pkg_src_unpack" from the "dotnet-pkg" eclass.

nuget_unpack-non-nuget-archives
Unpack all from package source files that are not NuGet packages.

This is a complementary function to "nuget_link-nuget-archives".

This function is used inside "dotnet-pkg_src_unpack" from the "dotnet-pkg" eclass.

nuget_writeconfig <path>
Create a "NuGet.config" config file that can be used to overwrite any other Nuget configuration file in order to prevent Nuget executable from accessing the network or undesired NuPkg package sources.

If given path ends with a slash, a file name "NuGet.config" is assumed, otherwise contents are written to specified file path exactly.

Created configuration file clears all other NuPkg sources and inserts "NUGET_PACKAGES" as the only one source.

This function is used inside "dotnet-pkg_src_prepare" from the "dotnet-pkg" eclass.

This function is used inside "dotnet-pkg_src_prepare" from the "dotnet-pkg" eclass.

nuget_donuget <nuget-path> ...
Install NuGet package(s) at "nuget-path" to the system nugets directory.

Example:

src_install() {
    nuget_donuget my-pkg.nupkg
}

ECLASS VARIABLES

NUGET_SYSTEM_NUGETS = /opt/dotnet-nugets
Location of the system NuGet packages directory.
NUGET_APIS (SET BEFORE INHERIT)
NuGet API URLs to use for precompiled NuGet package ".nupkg" downloads. Set this variable pre-inherit.

Defaults to an array of one item: "https://api.nuget.org/v3-flatcontainer"

Example:

NUGET_APIS+=( "https://api.nuget.org/v3-flatcontainer" )
inherit nuget
SRC_URI="https://example.com/example.tar.xz"
SRC_URI+=" ${NUGET_URIS} "
NUGET_PACKAGES (SET BEFORE INHERIT)
Path from where NuGets will be restored from. This is a special variable that modifies the behavior of "dotnet".

Defaults to ${T}/nugets for use with "NUGETS" but may be set to a custom location to, for example, restore NuGets extracted from a prepared archive. Do not set this variable in conjunction with non-empty "NUGETS".

NUGETS (SET BEFORE INHERIT)
String containing all NuGet packages that need to be downloaded.

Used by "_nuget_uris".

Example:

NUGETS="
        ImGui.NET@1.87.2
        Config.Net@4.19.0
"

inherit dotnet-pkg

...

SRC_URI+=" ${NUGET_URIS} "
NUGET_URIS (GENERATED BY ECLASS)
List of URIs to put in SRC_URI created from NUGETS variable.

AUTHORS

Anna Figueiredo Gomes <navi@vlhl.dev>
Maciej Barć <xgqt@gentoo.org>

MAINTAINERS

Gentoo Dotnet project <dotnet@gentoo.org>

REPORTING BUGS

Please report bugs via https://bugs.gentoo.org/

FILES

nuget.eclass

SEE ALSO

ebuild(5)
https://gitweb.gentoo.org/repo/gentoo.git/log/eclass/nuget.eclass


Index

NAME
DESCRIPTION
SUPPORTED EAPIS
FUNCTIONS
ECLASS VARIABLES
AUTHORS
MAINTAINERS
REPORTING BUGS
FILES
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 03:27:00 GMT, June 23, 2024