yandex-music: workaround of release circle
The [repacker project](https://github.com/cucumber-sp/yandex-music-linux) have release circle with moving tags, which breaks package distribution in nixpkgs. This replaces fixing revisions with hashes and implements automatically counting of "rc" parts of version for case of moving tags. Change-Id: I08d800220b0def0b6296ce1b18a9f2217188648e
This commit is contained in:
committed by
Yury Shvedov
parent
dc2b24b801
commit
648f1f9648
@@ -34,7 +34,8 @@ stdenvNoCC.mkDerivation rec {
|
||||
src = fetchFromGitHub {
|
||||
owner = "cucumber-sp";
|
||||
repo = "yandex-music-linux";
|
||||
rev = "v${version}";
|
||||
# tags are retagged for some bug fixes
|
||||
rev = "066a6c7f503304d2181db04c5ed379a80f9137b8";
|
||||
hash = "sha256-z+gmUG0/7ykF42+OlFGZC268Tj8+vpfgZRYrW4otpfM=";
|
||||
};
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ REPO="yandex-music-linux"
|
||||
URL="https://api.github.com/repos/$OWNER/$REPO"
|
||||
RAW="https://raw.githubusercontent.com/$OWNER/$REPO"
|
||||
|
||||
attrname="yandex-music"
|
||||
latest_release="$(curl --silent "$URL/releases/latest")"
|
||||
latest_tag="$(curl --silent "$URL/tags?per_page=1")"
|
||||
commit_hash="$(jq -r '.[0].commit.sha' <<<"$latest_tag")"
|
||||
@@ -19,8 +20,32 @@ date=$(jq -r '.created_at' <<<"$latest_release")
|
||||
# truncate time
|
||||
date=${date%T*}
|
||||
|
||||
importTree="(let tree = import ./.; in if builtins.isFunction tree then tree {} else tree)"
|
||||
|
||||
# Old version with rc part (e.g. 5.61.1rc3)
|
||||
oldVersion=$(nix-instantiate --eval -E "with $importTree; $attrname.version" | tr -d '"')
|
||||
# Rc part of old version (without "rc) (e.g. 3)
|
||||
oldVersionRc="${oldVersion##*rc}"
|
||||
|
||||
# If old version does not have "rc" part - assume rc is 0
|
||||
if [ "$oldVersionRc" == "$oldVersion" ]; then
|
||||
oldVersionRc="0"
|
||||
fi
|
||||
# Old version w/o rc part (e.g 5.61.1)
|
||||
oldVersion="${oldVersion%%rc*}"
|
||||
# Remove "rc" part from new version. There should be no "rc" part at all but
|
||||
# better to play it safe.
|
||||
version="${version%%rc*}"
|
||||
|
||||
rc=""
|
||||
|
||||
# If new version is the same as old version - increase rc and format rc part
|
||||
if [ "$version" == "$oldVersion" ]; then
|
||||
rc="rc$((oldVersionRc + 1))";
|
||||
fi
|
||||
|
||||
# update version; otherwise fail
|
||||
update-source-version yandex-music "$version" --ignore-same-hash
|
||||
update-source-version "$attrname" "$version$rc" --ignore-same-hash --rev="$commit_hash"
|
||||
|
||||
# set yandex-music dir
|
||||
dir="pkgs/by-name/ya/yandex-music"
|
||||
|
||||
Reference in New Issue
Block a user