aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/nuget.eclass')
-rw-r--r--eclass/nuget.eclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/eclass/nuget.eclass b/eclass/nuget.eclass
index 02e13b8..3fbb21c 100644
--- a/eclass/nuget.eclass
+++ b/eclass/nuget.eclass
@@ -11,6 +11,39 @@
inherit nupkg
+IUSE+=" +nuget"
+
+DEPEND+=" nuget? ( dev-dotnet/nuget )"
+RDEPEND+=" nuget? ( dev-dotnet/nuget )"
+
+# @FUNCTION: enuget_download_rogue_binary
+# @DESCRIPTION: downloads a binary package from 3rd untrusted party repository
+# accepts Id of package as parameter
+enuget_download_rogue_binary() {
+ CONFIG_PATH=${T}/.nuget
+ CONFIG_NAME=NuGet.Config
+ einfo "Downloading rogue binary '$1'"
+ addwrite "$(get_nuget_untrusted_archives_location)" || die
+ mkdir -p "$(get_nuget_untrusted_archives_location)" || die
+ einfo wget --continue https://www.nuget.org/api/v2/package/$1/$2 --output-document="$(get_nuget_untrusted_archives_location)/$1.$2.nupkg"
+ wget --continue https://www.nuget.org/api/v2/package/$1/$2 --output-document="$(get_nuget_untrusted_archives_location)/$1.$2.nupkg" || die
+ # -p ignores directory if it is already exists
+ mkdir -p "${CONFIG_PATH}/" || die
+ cat <<-EOF >"${CONFIG_PATH}/${CONFIG_NAME}" || die
+ <?xml version="1.0" encoding="utf-8" ?>
+ <configuration>
+ <config>
+ <add key="repositoryPath" value="$(get_nuget_untrusted_archives_location)" />
+ </config>
+ <disabledPackageSources />
+ </configuration>
+ EOF
+ einfo "Installing rogue binary '$1' into '${S}/packages'"
+ einfo "$(pwd)"
+ einfo nuget install "$1" -Version "$2" -SolutionDirectory "${S}" -ConfigFile "${CONFIG_PATH}/${CONFIG_NAME}" -OutputDirectory "${S}/packages" -Verbosity detailed
+ nuget install "$1" -Version "$2" -SolutionDirectory "${T}" -ConfigFile "${CONFIG_PATH}/${CONFIG_NAME}" -OutputDirectory "${S}/packages" -Verbosity detailed || die
+}
+
# @FUNCTION: nuget_src_unpack
# @DESCRIPTION: Runs nuget
# Here is usage example where nuget is alternative way: https://github.com/gentoo/dotnet/blob/master/dev-dotnet/fake