chromium: Add an update script.

It fetches the latest version based on the bucketlist XML from
commondatastorage and generates a "source.nix" which contains an attribute set
about where to fetch the latest version.

The XML is parsed in a somewhat hackish way using sed, but as this is just an
updater, its okay and we don't want to break a fly on the wheel by employing a
full XML parser.
This commit is contained in:
aszlig 2012-06-15 10:23:33 +02:00 committed by Eelco Dolstra
parent b5956ec179
commit d342672f5a
2 changed files with 39 additions and 3 deletions

View File

@ -14,6 +14,8 @@
}:
let
sourceInfo = import ./source.nix;
mkGypFlags = with stdenv.lib; let
sanitize = value:
if value == true then "1"
@ -25,11 +27,11 @@ let
in stdenv.mkDerivation rec {
name = "chromium-${version}";
version = "21.0.1171.0";
version = sourceInfo.version;
src = fetchurl {
url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.bz2";
sha256 = "3fd9b2d8895750a4435a585b9c2dc7d34b583c6470ba67eb6ea6c2579f126377";
url = sourceInfo.url;
sha256 = sourceInfo.sha256;
};
buildInputs = [

View File

@ -0,0 +1,34 @@
#!/bin/sh
bucket_url="http://commondatastorage.googleapis.com/chromium-browser-official/";
get_newest_version()
{
curl -s "$bucket_url" | sed -ne ' H;/<[Kk][Ee][Yy]>chromium-[^<]*</h;${
g;s/^.*<Key>chromium-\([^<.]\+\(\.[^<.]\+\)\+\)\.tar\.bz2<.*$/\1/p
}';
}
cd "$(dirname "$0")";
version="$(get_newest_version)";
if [ -e source.nix ]; then
oldver="$(sed -n 's/^ *version *= *"\([^"]\+\)".*$/\1/p' source.nix)";
if [ "x$oldver" = "x$version" ]; then
echo "Already the newest version: $version" >&2;
exit 1;
fi;
fi;
url="${bucket_url%/}/chromium-$version.tar.bz2";
sha256="$(nix-prefetch-url "$url")";
cat > source.nix <<EOF
{
version = "$version";
url = "$url";
sha256 = "$sha256";
}
EOF