Skip to content

Commit

Permalink
Change snapcraft to read base url from buildinfo (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeminglyScience authored Oct 10, 2024
1 parent 59b43c1 commit 1c03bd1
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions lts/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ parts:
snapcraftctl set-grade "stable"
override-build: |
file="./version.txt"
buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4)
baseurl=$(echo $buildinfo | jq -r .BaseUrl)
if [ -f "$file" ]
then
echo "using version file"
version=$(cat $file)
else
echo "getting latest version from GitHub"
version=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4| jq -r .ReleaseTag | sed 's/v//')
version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//')
echo "Writing version to file"
echo $version > $file
fi
container=$(echo v$version| sed 's/\./-/g')
echo "getting powershell $version - $container"
# These urls are subject to change.
echo "getting powershell $version - $baseurl/v$version"
case "$SNAPCRAFT_ARCH_TRIPLET" in
aarch64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;;
arm-linux-gnueabihf)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;;
x86_64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;;
*)
# fail because we don't have a build for the requested platform
echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting."
Expand Down
14 changes: 7 additions & 7 deletions preview/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,26 +50,26 @@ parts:
snapcraftctl set-grade "stable"
override-build: |
file="./version.txt"
buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-preview)
baseurl=$(echo $buildinfo | jq -r .BaseUrl)
if [ -f "$file" ]
then
echo "using version file"
version=$(cat $file)
else
echo "getting latest version from GitHub"
version=$(curl -s -L https://aka.ms/pwsh-buildinfo-preview | jq -r .ReleaseTag | sed 's/v//')
version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//')
echo "Writing version to file"
echo $version > $file
fi
container=$(echo v$version| sed 's/\./-/g')
echo "getting powershell $version - $container"
# These urls are subject to change.
echo "getting powershell $version - $baseurl/v$version"
case "$SNAPCRAFT_ARCH_TRIPLET" in
aarch64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;;
arm-linux-gnueabihf)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;;
x86_64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;;
*)
# fail because we don't have a build for the requested platform
echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting."
Expand Down
14 changes: 7 additions & 7 deletions stable/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ parts:
snapcraftctl set-grade "stable"
override-build: |
file="./version.txt"
buildinfo=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4)
baseurl=$(echo $buildinfo | jq -r .BaseUrl)
if [ -f "$file" ]
then
echo "using version file"
version=$(cat $file)
else
echo "getting latest version from GitHub"
version=$(curl -s -L https://aka.ms/pwsh-buildinfo-7-4| jq -r .ReleaseTag | sed 's/v//')
version=$(echo $buildinfo | jq -r .ReleaseTag | sed 's/v//')
echo "Writing version to file"
echo $version > $file
fi
container=$(echo v$version| sed 's/\./-/g')
echo "getting powershell $version - $container"
# These urls are subject to change.
echo "getting powershell $version - $baseurl/v$version"
case "$SNAPCRAFT_ARCH_TRIPLET" in
aarch64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm64.tar.gz ;;
arm-linux-gnueabihf)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-arm32.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-arm32.tar.gz ;;
x86_64-linux-gnu)
curl -L -o powershell.tar.gz https://pscoretestdata.blob.core.windows.net/$container/powershell-$version-linux-x64.tar.gz ;;
curl -L -o powershell.tar.gz $baseurl/v$version/powershell-$version-linux-x64.tar.gz ;;
*)
# fail because we don't have a build for the requested platform
echo "The $SNAPCRAFT_ARCH_TRIPLET platform does not have an available build. Exiting."
Expand Down

0 comments on commit 1c03bd1

Please sign in to comment.