* Idem for the Nixpkgs channel.

git-svn-id: https://nixos.org/repos/nix/release/trunk/channels@34756 70bd8c7a-acb8-0310-9f0d-9cc1c95dcdbb
This commit is contained in:
Eelco Dolstra 2013-08-13 21:04:08 +00:00
parent 65d629a2e2
commit 100e90272c

View file

@ -1,35 +1,35 @@
#! /bin/sh -e #! /bin/sh -e
viewUrl=http://hydra.nixos.org/view/nixpkgs/unstable/latest-finished releaseUrl=http://hydra.nixos.org/job/nixpkgs/trunk/unstable/latest-finished
releasesDir=/data/releases/nixpkgs releasesDir=/data/releases/nixpkgs
channelsDir=/data/releases/channels channelsDir=/data/releases/channels
channelName=nixpkgs-unstable channelName=nixpkgs-unstable
curl="curl --silent --show-error --fail" curl="curl --silent --show-error --fail"
url=$($curl --head $viewUrl | sed 's/Location: \(.*\)\r/\1/; t; d') json=$($curl -L -H 'Accept: application/json' $releaseUrl)
if [ -z "$url" ]; then exit 1; fi
echo "View page is $url" releaseId=$(echo "$json" | json id)
if [ -z "$releaseId" ]; then echo "Failed to get release id"; exit 1; fi
release=$($curl $url | sed 's|.*<h1>.*View \(.*\)</small.*|\1|; t; d') release=$(echo "$json" | json nixname)
if [ -z "$release" ]; then echo "Failed to get release"; exit 1; fi if [ -z "$release" ]; then echo "Failed to get release"; exit 1; fi
echo "Release is $release" url=$($curl --head http://hydra.nixos.org/build/$releaseId/eval | sed 's/Location: \(.*\)\r/\1/; t; d')
if [ -z "$url" ]; then exit 1; fi
releaseDir=$releasesDir/$release echo "release is $release (build $releaseId), eval is $url"
echo $releaseDir
if [ -d $releaseDir ]; then if [ -d $releaseDir ]; then
echo "Release already exists" echo "release already exists"
else else
tmpDir=$releasesDir/.tmp-$release-$$ tmpDir=$releasesDir/.tmp-$release-$$
mkdir -p $tmpDir mkdir -p $tmpDir
echo $url > $tmpDir/src-url echo $url > $tmpDir/src-url
perl -w ./mirror-channel.pl "$url/eval/channel" "$tmpDir" \ perl -w ./mirror-channel.pl "$url/channel" "$tmpDir" \
nix-cache http://cache.nixos.org \ nix-cache http://cache.nixos.org \
/data/releases/patches/all-patches "$url/tarball/download/4" /data/releases/patches/all-patches "$url/job/tarball/download/4"
mv $tmpDir $releaseDir mv $tmpDir $releaseDir
fi fi