Skip to content

Commit b091cc9

Browse files
Merge pull request #28 from canonical/fix/cleanup-snapcraft-yaml
Clean-up `snapcraft.yaml` and set grade to `stable`
2 parents 5ff8984 + 126a8c7 commit b091cc9

1 file changed

Lines changed: 26 additions & 64 deletions

File tree

snap/snapcraft.yaml

Lines changed: 26 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description: |
1212
multiple versions of .NET side-by-side as you want, as well as receive
1313
monthly security and feature updates whenever they become available.
1414
15-
grade: devel # must be 'stable' to release into candidate/stable channels
15+
grade: stable
1616
confinement: classic
1717

1818
package-repositories:
@@ -27,34 +27,22 @@ architectures:
2727
build-for: [arm64]
2828

2929
parts:
30-
pre-reqs:
31-
plugin: nil
32-
build-attributes:
33-
- enable-patchelf
34-
stage-packages:
35-
- libc6
36-
- libgcc-s1
37-
- libgssapi-krb5-2
38-
- libicu70
39-
- liblttng-ust1
40-
- libssl3
41-
- libstdc++6
42-
- libunwind8
43-
- zlib1g
44-
4530
dotnet-installer:
4631
plugin: dump
4732
source: .
48-
after: [ pre-reqs ]
4933
build-packages:
5034
- dotnet-sdk-9.0
35+
- patchelf
5136
stage-packages:
5237
- jq
38+
- libicu70
39+
build-attributes:
40+
- enable-patchelf
5341
override-build: |
5442
/usr/bin/dotnet --info
5543
SNAP_VERSION=$(/usr/bin/dotnet --list-runtimes | grep NETCore.App | awk '{print $2}' | sort -r | head -n 1)
5644
craftctl set version="$SNAP_VERSION"
57-
45+
5846
if [ "${CRAFT_ARCH_BUILD_FOR}" = "amd64" ]; then
5947
RUNTIME_RID="linux-x64"
6048
elif [ "${CRAFT_ARCH_BUILD_FOR}" = "arm64" ]; then
@@ -64,62 +52,31 @@ parts:
6452
exit 1
6553
fi
6654
67-
/usr/bin/dotnet publish src/Dotnet.Installer.Console --output "${SNAPCRAFT_PART_INSTALL}" \
55+
/usr/bin/dotnet publish src/Dotnet.Installer.Console --output "${CRAFT_PART_INSTALL}" \
6856
--configuration Release -r "${RUNTIME_RID}" -p:DebugSymbols=false -p:DebugType=none
69-
chmod 555 "${SNAPCRAFT_PART_INSTALL}/Dotnet.Installer.Console"
70-
override-stage: |
71-
craftctl default
72-
73-
if [ "${CRAFT_ARCH_BUILD_FOR}" = "amd64" ]; then
74-
LIB_PATH=lib/x86_64-linux-gnu
75-
INTERPRETER="/snap/dotnet/current/lib64/ld-linux-x86-64.so.2"
76-
77-
patchelf --force-rpath --set-rpath \$ORIGIN/../${LIB_PATH} \
78-
${CRAFT_STAGE}/usr/bin/jq
79-
patchelf --force-rpath --set-rpath \$ORIGIN/usr/${LIB_PATH} \
80-
${CRAFT_STAGE}/Dotnet.Installer.Console
81-
elif [ "${CRAFT_ARCH_BUILD_FOR}" = "arm64" ]; then
82-
LIB_PATH=lib/aarch64-linux-gnu
83-
INTERPRETER="/snap/dotnet/current/lib/ld-linux-aarch64.so.1"
57+
chmod 555 "${CRAFT_PART_INSTALL}/Dotnet.Installer.Console"
8458
85-
patchelf --force-rpath --set-rpath \$ORIGIN/../${LIB_PATH}:\$ORIGIN/../../${LIB_PATH} \
86-
${CRAFT_STAGE}/usr/bin/jq
87-
patchelf --force-rpath --set-rpath \$ORIGIN/${LIB_PATH}:\$ORIGIN/usr/${LIB_PATH} \
88-
${CRAFT_STAGE}/Dotnet.Installer.Console
89-
else
90-
echo "Unsupported architecture (${CRAFT_ARCH_BUILD_FOR})"
91-
exit 1
92-
fi
93-
94-
patchelf --set-interpreter $INTERPRETER ${CRAFT_STAGE}/usr/bin/jq
95-
patchelf --set-interpreter $INTERPRETER ${CRAFT_STAGE}/Dotnet.Installer.Console
59+
patchelf --force-rpath --set-rpath \
60+
\$ORIGIN/netcoredeps:\$ORIGIN/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
61+
${CRAFT_PART_INSTALL}/Dotnet.Installer.Console
9662
9763
dotnet-host:
9864
plugin: nil
65+
after: [dotnet-installer]
9966
build-packages:
10067
- patchelf
10168
stage-packages:
10269
- dotnet-hostfxr-9.0
103-
override-stage: |
104-
craftctl default
105-
106-
if [ "${CRAFT_ARCH_BUILD_FOR}" = "amd64" ]; then
107-
INTERPRETER="/snap/dotnet/current/lib64/ld-linux-x86-64.so.2"
108-
RPATH="/snap/dotnet/current/usr/lib/x86_64-linux-gnu"
109-
elif [ "${CRAFT_ARCH_BUILD_FOR}" = "arm64" ]; then
110-
INTERPRETER="/snap/dotnet/current/lib/ld-linux-aarch64.so.1"
111-
RPATH="/snap/dotnet/current/usr/lib/aarch64-linux-gnu:/snap/dotnet/current/lib/aarch64-linux-gnu"
112-
else
113-
echo "Unsupported architecture (${CRAFT_ARCH_BUILD_FOR})"
114-
exit 1
115-
fi
116-
70+
override-build: |
11771
DOTNET_VERSION=$(craftctl get version)
118-
patchelf --set-interpreter $INTERPRETER usr/lib/dotnet/dotnet
119-
patchelf --force-rpath --set-rpath $RPATH usr/lib/dotnet/dotnet
120-
patchelf --force-rpath --set-rpath $RPATH usr/lib/dotnet/host/fxr/${DOTNET_VERSION}/libhostfxr.so
121-
122-
ln --symbolic --force /var/snap/dotnet/common/dotnet/dotnet usr/bin/dotnet
72+
INTERPRETER=$(find /usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} -type f -name ld-linux** | head -n 1)
73+
patchelf --set-interpreter /snap/core22/current${INTERPRETER} ${CRAFT_PART_INSTALL}/usr/lib/dotnet/dotnet
74+
patchelf --force-rpath --set-rpath \
75+
/snap/dotnet/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
76+
${CRAFT_PART_INSTALL}/usr/lib/dotnet/dotnet
77+
patchelf --force-rpath --set-rpath \
78+
/snap/dotnet/current/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}:/snap/core22/current/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR} \
79+
${CRAFT_PART_INSTALL}/usr/lib/dotnet/host/fxr/${DOTNET_VERSION}/libhostfxr.so
12380
12481
netstandard-targeting-pack:
12582
plugin: nil
@@ -136,3 +93,8 @@ apps:
13693
command: Scripts/dotnet-installer-launcher.sh
13794
environment:
13895
DOTNET_INSTALL_DIR: $SNAP_COMMON/dotnet
96+
97+
lint:
98+
ignore:
99+
- library:
100+
- usr/lib/**/libicu*

0 commit comments

Comments
 (0)