blob: 2b7e6e7ca2e156b768cd3a1aa7b1d89d9b4d9fc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
# @ECLASS: nuget.eclass
# @MAINTAINER: cynede@gentoo.org
# @BLURB: Common functionality for nuget apps
# @DESCRIPTION: my idea of nuget was following:
# introduce nuget IUSE flag for packages that are on nuget to download them from nuget. (if sources fails with some reason or dependies is complicated or if user just want binaries).
# or maybe even introduce few packages that just downloads and instulls from nuget, reason is obviously - easy maintaince
inherit nupkg
# @ECLASS_VARIABLE: NUGET_DEPEND
# @DESCRIPTION Set false to net depend on nuget
: ${NUGET_NO_DEPEND:=}
if [[ -n ${NUGET_NO_DEPEND} ]]; then
IUSE+=" +nuget"
DEPEND+=" nuget? ( dev-dotnet/nuget )"
RDEPEND+=" nuget? ( dev-dotnet/nuget )"
fi
# @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
}
if [[ $PV == *_alpha* ]] ; then
NPV=${PVR/_alpha/-alpha}
else
if [[ $PV == *_beta* ]] ; then
NPV=${PVR/_beta/-beta}
else
if [[ $PV == *_pre* ]] ; then
NPV=${PVR/_pre/-pre}
else
if [[ $PV == *_p* ]] ; then
NPV=${PVR/_p/-p}
else
NPV=${PVR}
fi
fi
fi
fi
# @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
# Src_compile does nothing and src_install just installs sources from nuget_src_unpack
nuget_src_unpack() {
default
einfo "src_unpack() from nuget.eclass is called"
NPN=${PN/_/.}
nuget install "${NPN}" -Version "${NPV}" -OutputDirectory "${P}"
}
# @FUNCTION: nuget_src_configure
# @DESCRIPTION: Runs nothing.
nuget_src_configure() { :; }
# @FUNCTION: nuget_src_compile
# @DESCRIPTION: Runs nothing.
nuget_src_compile() { :; }
EXPORT_FUNCTIONS src_unpack src_configure src_compile
|