build/linux: Add 'snapcraft pack' code on local snaps

(cherry picked from commit 56e8275690)
This commit is contained in:
Bruno Lopes 2025-08-07 08:23:38 -03:00 committed by Jehan
parent 8601b86229
commit 9a76ae6f22

View file

@ -43,7 +43,10 @@ printf "(INFO): Name: $NAME (track: $TRACK) | Version: $GIMP_VERSION\n"
## Autodetects what archs will be packaged
supported_archs=$(find . -maxdepth 1 -iname "*.snap")
if echo "$supported_archs" | grep -q 'arm64' && ! echo "$supported_archs" | grep -q 'amd64'; then
if [ "$supported_archs" = '' ]; then
printf "(INFO): Arch: $(dpkg --print-architecture)\n"
export supported_archs="./temp_${NAME}_${GIMP_VERSION}_$(dpkg --print-architecture).snap"
elif echo "$supported_archs" | grep -q 'arm64' && ! echo "$supported_archs" | grep -q 'amd64'; then
printf '(INFO): Arch: arm64\n'
elif ! echo "$supported_archs" | grep -q 'arm64' && echo "$supported_archs" | grep -q 'amd64'; then
printf '(INFO): Arch: amd64\n'
@ -57,6 +60,10 @@ printf "\e[0Ksection_end:`date +%s`:snap_info\r\e[0K\n"
for SNAP in $supported_archs; do
SNAP=$(echo "$SNAP" | sed 's|^\./temp_||')
printf "\e[0Ksection_start:`date +%s`:${SNAP}_making[collapsed=true]\r\e[0KFinishing ${SNAP}\n"
if [ -z "$GITLAB_CI" ]; then
#as explained in 2_build-gimp-snapcraft.sh, we can only make snaps this way locally due to remote-build limitations
sudo snapcraft pack --destructive-mode --output temp_${SNAP}
fi
mv temp_${SNAP} ${SNAP}
printf "(INFO): Suceeded. To test this build, install it from the artifact with: sudo snap install --dangerous ${SNAP}\n"
printf "\e[0Ksection_end:`date +%s`:${SNAP}_making\r\e[0K\n"