mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-02 15:41:48 +00:00
spotify: Auto-commit on update
Also, replace tabs with spaces
This commit is contained in:
parent
6bccbe6372
commit
55fa3c1180
@ -29,10 +29,10 @@ spotify_nix="$nixpkgs/pkgs/applications/audio/spotify/default.nix"
|
||||
|
||||
# create bash array from snap info
|
||||
snap_info=($(
|
||||
curl -H 'X-Ubuntu-Series: 16' \
|
||||
"https://api.snapcraft.io/api/v1/snaps/details/spotify?channel=$channel" \
|
||||
| jq --raw-output \
|
||||
'.revision,.download_sha512,.version,.last_updated'
|
||||
curl -H 'X-Ubuntu-Series: 16' \
|
||||
"https://api.snapcraft.io/api/v1/snaps/details/spotify?channel=$channel" \
|
||||
| jq --raw-output \
|
||||
'.revision,.download_sha512,.version,.last_updated'
|
||||
))
|
||||
|
||||
# "revision" is the actual version identifier on snapcraft, the "version" is
|
||||
@ -50,8 +50,8 @@ echo "Latest $channel release is $upstream_version from $last_updated."
|
||||
#
|
||||
|
||||
current_nix_version=$(
|
||||
grep 'version\s*=' "$spotify_nix" \
|
||||
| sed -Ene 's/.*"(.*)".*/\1/p'
|
||||
grep 'version\s*=' "$spotify_nix" \
|
||||
| sed -Ene 's/.*"(.*)".*/\1/p'
|
||||
)
|
||||
|
||||
echo "Current nix version: $current_nix_version"
|
||||
@ -61,36 +61,28 @@ echo "Current nix version: $current_nix_version"
|
||||
#
|
||||
|
||||
if [[ "$current_nix_version" = "$upstream_version" ]]; then
|
||||
echo "Spotify is already up ot date"
|
||||
exit 0
|
||||
echo "Spotify is already up ot date"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Updating from ${current_nix_version} to ${upstream_version}, released on ${last_updated}"
|
||||
|
||||
# search-and-replace revision, hash and version
|
||||
sed --regexp-extended \
|
||||
-e 's/rev\s*=\s*"[0-9]+"\s*;/rev = "'"${revision}"'";/' \
|
||||
-e 's/sha512\s*=\s*"[^"]*"\s*;/sha512 = "'"${sha512}"'";/' \
|
||||
-e 's/version\s*=\s*".*"\s*;/version = "'"${upstream_version}"'";/' \
|
||||
-i "$spotify_nix"
|
||||
-e 's/rev\s*=\s*"[0-9]+"\s*;/rev = "'"${revision}"'";/' \
|
||||
-e 's/sha512\s*=\s*"[^"]*"\s*;/sha512 = "'"${sha512}"'";/' \
|
||||
-e 's/version\s*=\s*".*"\s*;/version = "'"${upstream_version}"'";/' \
|
||||
-i "$spotify_nix"
|
||||
|
||||
#
|
||||
# try to build the updated version
|
||||
#
|
||||
|
||||
if ! nix-build -A spotify "$nixpkgs"; then
|
||||
echo "The updated spotify failed to build."
|
||||
exit 1
|
||||
echo "The updated spotify failed to build."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# give instructions for upstreaming
|
||||
#
|
||||
|
||||
# Commit changes
|
||||
git add "$spotify_nix"
|
||||
# show changes for review
|
||||
git status
|
||||
echo 'Please review and test the changes (./result/bin/spotify).'
|
||||
echo 'Then stage the changes with `git add` and commit with:'
|
||||
# prepare commit message
|
||||
echo "git commit -m 'spotify: $current_nix_version -> $upstream_version'"
|
||||
git commit -m "spotify: ${current_nix_version} -> ${upstream_version}"
|
||||
|
Loading…
Reference in New Issue
Block a user