-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

        Medium-dirty hack, requires slight supervision. Used for my massive
glib-gtk-gnome update.  Lluìs asked me to send it to the list...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJLdtxOAAoJEE6tnN0aWvw3+DUH/iB0hPbpnY/M2uY1YpFPL8lF
O8gZA+VxTUQuqVDTgHaUWz6TOcmYe7+fdT0kDiBvgnJv/j2sUG0CnGsdtiJZ0CSJ
FN57mM/HVqWfoa9N1sKtEVGUA10tsAN1qQPOVveaUA8MVnzk2puyJKawl38ppVS6
zg4jEuqap2SMulxdfem2YJ4GX2ExZ/YJMWPJjCwERExHeekO3M9GdtSwYTnH+swM
/ZuxJqmc7GBaLCZceEyLBcDE+b4cyTdGkNbmlj27CtCZ+qsxUveZt1X9bI7LCNNk
zb9wUsARke7eWAV0uQmEuzRZkxStIRheN/sunOvdGkP/6cGPnM7iARvBPOTZfYg=
=/OJf
-----END PGP SIGNATURE-----
#! /bin/sh

url="$(egrep 'url[[:space:]]*=' $1 |
        sed -re 's/[^=]*=\s*//; s/;[^;]*//; 
s...@mirror://gn...@http://ftp.gnome.org/pub/gnome/@')"

echo "URL: $url"

baseUrl="$url"
baseUrl="$(dirname "$baseUrl")"
baseUrl="$(dirname "$baseUrl")"
baseUrl="$(dirname "$baseUrl")"
baseUrl="$(dirname "$baseUrl")"

echo "Base URL: $baseUrl"

# Stable-only
maxVersion="$(urls-from-page "$baseUrl" | egrep '^[0-9.]*[02468]/*$' | tail -1)"
echo "Max version: $maxVersion"
baseUrl="$baseUrl/$maxVersion"
echo "Base URL: $baseUrl"

maxVersion="$(urls-from-page "$baseUrl" | egrep '^[0-9.]*/*$' | tail -1)"
echo "Max version: $maxVersion"
baseUrl="$baseUrl/$maxVersion"
echo "Base URL: $baseUrl"

baseUrl="$baseUrl/sources"
echo "Base URL: $baseUrl"

baseName="$(basename "$url")"
echo "Base Name: $baseName"

baseName="$(echo "$baseName" | sed -e 's...@-[0-9.]*[.]tar[.].*@@')"
echo "Base Name: $baseName"

freshName="$(urls-from-page "$baseUrl" | egrep "$baseName-[0-9.]*[.]tar[.]bz2")"
echo "Fresh name: $freshName"

hash="$(nix-prefetch-url "$baseUrl/$freshName")"
echo "Hash: $hash"

mirrorUrl="$(echo "$baseUrl/$freshName" | sed -e 
's...@http://ftp.gnome.org/pub/gnome/@mirror://gnome/@; s@//@/@g; 
s...@mirror:/gn...@mirror://gnome@')"

packageName="$(echo "$freshName" | sed -e 's...@[.]tar[.].*@@')"
echo "Package name: $packageName"

sed     -e "s|url\\s*=[^;]*;|url = $mirrorUrl;|;" \
        -e "s|sha256\\s*=[^;]*;|sha256 = \"$hash\";|;" \
        -e "s|name\\s*=[^;]*;|name = \"$packageName\";|;" \
        "$2" "$1"
#! /bin/sh

url="$(egrep 'url[[:space:]]*=' $1 |
        sed -re 's/[^=]*=\s*//; s/;[^;]*//; 
s...@mirror://gn...@http://ftp.gnome.org/pub/gnome/@')"

baseName="$(basename "$url")"
echo "Base Name: $baseName"

baseName="$(echo "$baseName" | sed -e 's...@-[0-9.]*[.]tar[.].*@@')"
echo "Base Name: $baseName"

baseUrl="http://ftp.gnome.org/pub/gnome/sources/$baseName";

maxVersion="$(urls-from-page "$baseUrl" | egrep '^[0-9.]*/*$' | tail -1)"
echo "Max version: $maxVersion"
baseUrl="$baseUrl/$maxVersion"
echo "Base URL: $baseUrl"

freshName="$(urls-from-page "$baseUrl" | egrep '[.]tar[.]bz2$' | tail -1)"
echo "Fresh name: $freshName"

hash="$(nix-prefetch-url "$baseUrl/$freshName")"
echo "Hash: $hash"

mirrorUrl="$(echo "$baseUrl/$freshName" | sed -e 
's...@http://ftp.gnome.org/pub/gnome/@mirror://gnome/@; s@//@/@g; 
s...@mirror:/gn...@mirror://gnome@')"

packageName="$(echo "$freshName" | sed -e 's...@[.]tar[.].*@@')"
echo "Package name: $packageName"

sed     -e "s|url\\s*=[^;]*;|url = $mirrorUrl;|;" \
        -e "s|sha256\\s*=[^;]*;|sha256 = \"$hash\";|;" \
        -e "s|name\\s*=[^;]*;|name = \"$packageName\";|;" \
        "$2" "$1"

Attachment: gnome-package-update.sig
Description: Binary data

Attachment: gnome-package-update-separate.sig
Description: Binary data

_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to