Gentoo Archives: gentoo-commits

From: Anna Figueiredo Gomes <anna-cli@××××××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:dev commit in: eclass/
Date: Fri, 25 Nov 2022 02:38:34
Message-Id: 1669343647.637fee59f92658dcacab882c31237635a79ff53f.anna-cli@gentoo
1 commit: 637fee59f92658dcacab882c31237635a79ff53f
2 Author: Anna (navi) Figueiredo Gomes <anna <AT> navirc <DOT> com>
3 AuthorDate: Fri Nov 25 02:34:07 2022 +0000
4 Commit: Anna Figueiredo Gomes <anna-cli <AT> tutanota <DOT> com>
5 CommitDate: Fri Nov 25 02:34:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=637fee59
7
8 dotnet-utils.eclass: SLOT and runtime ARCH support
9
10 Signed-off-by: Anna (navi) Figueiredo Gomes <anna <AT> navirc.com>
11
12 eclass/dotnet-utils.eclass | 56 +++++++++++++++++++++++++++++++++++++---------
13 1 file changed, 45 insertions(+), 11 deletions(-)
14
15 diff --git a/eclass/dotnet-utils.eclass b/eclass/dotnet-utils.eclass
16 index 26a968035..61ccf8f11 100644
17 --- a/eclass/dotnet-utils.eclass
18 +++ b/eclass/dotnet-utils.eclass
19 @@ -3,9 +3,9 @@
20
21 # @ECLASS: dotnet-utils.eclass
22 # @MAINTAINER:
23 -# anna-cli@××××××××.com
24 +# anna@××××××.com
25 # @AUTHOR:
26 -# Anna Figueiredo Gomes <anna-cli@××××××××.com>
27 +# Anna Figueiredo Gomes <anna@××××××.com>
28 # @SUPPORTED_EAPIS: 7 8
29 # @BLURB: common functions and variables for dotnet builds
30
31 @@ -19,8 +19,23 @@ esac
32
33 inherit multiprocessing
34
35 -BDEPEND=">=virtual/dotnet-sdk-6.0"
36 -EXPORT_FUNCTIONS src_unpack src_prepare src_compile
37 +# @ECLASS_VARIABLE: DOTNET_SLOT
38 +# @DESCRIPTION:
39 +# Allows for choosing a slot for dotnet
40 +# @DEFAULT_UNSET
41 +
42 +if [[ -z "${DOTNET_SLOT}" ]]; then
43 + die "DOTNET_SLOT not set."
44 +fi
45 +
46 +# Temporary, use the virtual once you can have multiple virtuals installed at once
47 +BDEPEND+=" || ( dev-dotnet/dotnet-sdk:${DOTNET_SLOT} dev-dotnet/dotnet-sdk-bin:${DOTNET_SLOT} )"
48 +EXPORT_FUNCTIONS src_unpack src_prepare src_compile pkg_setup
49 +
50 +# @ECLASS_VARIABLE: DOTNET_EXECUTABLE
51 +# @DESCRIPTION:
52 +# Holds the right executable name
53 +# @DEFAULT_UNSET
54
55 # @ECLASS_VARIABLE: DOTNET_CLI_TELEMETRY_OPTOUT
56 # @DESCRIPTION:
57 @@ -36,7 +51,7 @@ export MSBUILDDISABLENODEREUSE=1
58 export DOTNET_NOLOGO=1
59
60 # Needed otherwise the binaries break
61 -RESTRICT="strip"
62 +RESTRICT+=" strip"
63
64 # @ECLASS_VARIABLE: NUGETS
65 # @DEFAULT_UNSET
66 @@ -83,6 +98,30 @@ nuget_uris() {
67 done
68 }
69
70 +dotnet-utils_pkg_setup() {
71 + case "${ARCH}" in
72 + *amd64)
73 + DOTNET_RUNTIME="linux-x64"
74 + ;;
75 + *arm)
76 + DOTNET_RUNTIME="linux-arm"
77 + ;;
78 + *arm64)
79 + DOTNET_RUNTIME="linux-arm64"
80 + ;;
81 + *)
82 + die "Unsupported arch: ${ARCH}"
83 + ;;
84 + esac
85 +
86 + for _dotnet in dotnet-{${DOTNET_SLOT},bin-${DOTNET_SLOT}}; do
87 + if type $_dotnet 1> /dev/null 2>&1; then
88 + DOTNET_EXECUTABLE=$_dotnet
89 + break
90 + fi
91 + done
92 +}
93 +
94 # @FUNCTION: edotnet
95 # @USAGE: [[command] <args> ...]
96 # @DESCRIPTION:
97 @@ -93,7 +132,7 @@ edotnet() {
98
99 local ret
100
101 - set -- dotnet "${@}" -maxcpucount:$(makeopts_jobs)
102 + set -- "$DOTNET_EXECUTABLE" "${@}" --runtime "${DOTNET_RUNTIME}" -maxcpucount:$(makeopts_jobs)
103 echo "${@}" >&2
104 "${@}"
105 ret=${?}
106 @@ -130,7 +169,6 @@ dotnet-utils_src_unpack() {
107 dotnet-utils_src_prepare() {
108 debug-print-function ${FUNCNAME} "$@"
109 edotnet restore \
110 - --runtime linux-x64 \
111 --source "${DISTDIR}" || die
112 default
113 }
114 @@ -141,13 +179,9 @@ dotnet-utils_src_prepare() {
115 dotnet-utils_src_compile() {
116 debug-print-function ${FUNCNAME} "$@"
117
118 - addpredict /opt/dotnet-sdk-bin-6.0/metadata
119 -
120 edotnet publish \
121 - --nologo \
122 --no-restore \
123 --configuration Release \
124 - --runtime linux-x64 \
125 "-p:Version=${PV}" \
126 -p:DebugType=embedded \
127 --self-contained || die