summary refs log tree commit diff
path: root/maintainers
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2014-12-17 00:44:58 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2014-12-17 00:44:58 +0000
commitf0c21ab3f74127c8614500d6f8aa9cf7ccb36842 (patch)
treec82c73e02fa05091df7d84b133618fef71ea1e75 /maintainers
parent973f4bedbfdd3d4cecba49036a48bda237b12c16 (diff)
downloadnixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar.gz
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar.bz2
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar.lz
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar.xz
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.tar.zst
nixpkgs-f0c21ab3f74127c8614500d6f8aa9cf7ccb36842.zip
Add a script to add git branches for each channel.
Diffstat (limited to 'maintainers')
-rwxr-xr-xmaintainers/scripts/update-channel-branches.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/maintainers/scripts/update-channel-branches.sh b/maintainers/scripts/update-channel-branches.sh
new file mode 100755
index 00000000000..0157fe1db10
--- /dev/null
+++ b/maintainers/scripts/update-channel-branches.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+: ${NIXOS_CHANNELS:=https://nixos.org/channels/}
+
+# Find the name of all channels which are listed in the directory.
+for channelName in : $(curl -s $NIXOS_CHANNELS | sed -n '/folder/ { s,.*href=",,; s,/".*,,; p }'); do
+    test "$channelName" = : && continue;
+
+    # Do not follow redirections, such that we can extract the
+    # short-changeset from the name of the directory where we are
+    # redirected to.
+    sha1=$(curl -s --max-redirs 0 $NIXOS_CHANNELS$channelName | sed -n '/has moved/ { s,.*\.\([a-z0-9A-Z]*\)".*,\1,; p; }')
+    test -z "$sha1" -o -z "$channelName" && continue;
+
+    # Update the local channels/* branches to be in-sync with the
+    # channel references.
+    git update-ref refs/heads/channels/$channelName $sha1
+done