From bc8cce06a5cc88278f7f78868fbccd771f4b893f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 5 Mar 2015 17:40:48 +0100 Subject: [PATCH] After updating the channel, update/push a corresponding Git branch https://github.com/NixOS/nixpkgs/issues/3609 --- mirror-nixos-branch.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mirror-nixos-branch.sh b/mirror-nixos-branch.sh index 58f653d..08eeeda 100755 --- a/mirror-nixos-branch.sh +++ b/mirror-nixos-branch.sh @@ -12,6 +12,7 @@ releaseUrl="http://hydra.nixos.org/job/nixos/$jobset/tested/latest-finished" releasesDir="/data/releases/nixos/$branch" channelsDir=/data/releases/channels channelName=nixos-"$branch" +export GIT_DIR=/home/hydra-mirror/nixpkgs-channels curl="curl --silent --show-error --fail" wget="wget --no-verbose --content-disposition" @@ -31,6 +32,12 @@ releaseDir=$releasesDir/$release echo "release is ‘$release’ (build $releaseId), eval is ‘$url’, dir is ‘$releaseDir’" >&2 +# Figure out the Git revision from which this release was +# built. FIXME: get this from Hydra directly. +shortRev=$(echo "$release" | sed 's/.*\.//') +rev=$(git rev-parse "$shortRev") +echo "revision is $rev" + if [ -d $releaseDir ]; then echo "release already exists" >&2 else @@ -39,7 +46,8 @@ else trap 'rm -rf -- "$tmpDir"' EXIT - echo $url > $tmpDir/src-url + echo -n "$url" > $tmpDir/src-url + echo -n "$rev" > $tmpDir/git-revision # Copy the manual. $curl -L $url/job/nixos.manual.x86_64-linux/output/out | bzip2 -d | nix-store --restore $tmpDir/foo @@ -96,4 +104,8 @@ flock -x $channelsDir/.htaccess.lock -c "cat $channelsDir/.htaccess-nix* > $chan cd "$channelsDir" rsync -avR . hydra-mirror@nixos.org:"$channelsDir" --delete >&2 +# Update the nixpkgs-channels repo. +git remote update nixpkgs +git push nixpkgs-channels "$rev:refs/heads/$channelName" + echo "$releaseDir"