forked from mirrors/nixpkgs
Add a script to automatically update io.js expression
This commit is contained in:
parent
d44573e16f
commit
71008a00b9
43
maintainers/scripts/update-iojs
Executable file
43
maintainers/scripts/update-iojs
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
latest() {
|
||||||
|
curl -s "$1" | grep 'href="v' \
|
||||||
|
| tail -1 | sed 's/.*href="v//;s/\/".*//'
|
||||||
|
}
|
||||||
|
|
||||||
|
latest_log() {
|
||||||
|
echo "Getting latest $1 version from $2" >&2
|
||||||
|
version=$(latest "$2")
|
||||||
|
echo " -> $version" >&2
|
||||||
|
echo "$version"
|
||||||
|
}
|
||||||
|
|
||||||
|
url() {
|
||||||
|
nix-instantiate -A "$1" 2> /dev/null | xargs cat \
|
||||||
|
| sed 's/.*"urls","//;s/".*//'
|
||||||
|
}
|
||||||
|
|
||||||
|
hash() {
|
||||||
|
nix-prefetch-url "$1" 2> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
hash_log() {
|
||||||
|
echo "Finding hash for $1" >&2
|
||||||
|
value=$(hash "$1")
|
||||||
|
echo " -> $value" >&2
|
||||||
|
echo "$value"
|
||||||
|
}
|
||||||
|
|
||||||
|
stable=$(latest_log stable 'https://iojs.org/dist/')
|
||||||
|
nightly=$(latest_log nightly 'https://iojs.org/download/nightly/')
|
||||||
|
|
||||||
|
sed -i \
|
||||||
|
"/version = if nightly/s/then.*/then \"$nightly\" else \"$stable\";/" \
|
||||||
|
pkgs/development/web/iojs/default.nix
|
||||||
|
|
||||||
|
stableHash=$(hash_log "$(url iojs.src)")
|
||||||
|
nightlyHash=$(hash_log "$(url iojs-nightly.src)")
|
||||||
|
|
||||||
|
sed -i \
|
||||||
|
"/sha256 = if nightly/{N;s/\"[^\"]*\"/\"$nightlyHash\"/;N;s/\"[^\"]*\";/\"$stableHash\";/}" \
|
||||||
|
pkgs/development/web/iojs/default.nix
|
Loading…
Reference in a new issue