nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1set -x
2
3if ! [ -f "$cacheDB" ]; then
4 echo "Creating cache DB $cacheDB"
5 mtn --db "$cacheDB" db init
6fi
7
8echo "getting revision $selector";
9
10done=;
11for source in $dbs; do
12 if mtn pull --db "$cacheDB" "$source" "${branch}"; then
13 revision="$(mtn --db "$cacheDB" au toposort $(mtn --db "$cacheDB" au select "$selector") | tail -1)";
14 if [ -n "$revision" ]; then
15 if mtn --db "$cacheDB" au get_revision "$revision"; then
16 echo "found revision $revision"
17 done=1;
18 else
19 echo "revision $revision does not exist";
20 fi
21 else
22 echo "selector $selector does not match any revision";
23 fi
24 else
25 echo "pulling branch $branch wasn't successful";
26 fi;
27 if test -n "$done"; then
28 break;
29 fi;
30done;
31
32echo "checking out the revision $revision";
33
34if test -n "$done"; then
35 mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}"
36else
37 echo "Needed revision still not found. Exiting";
38 exit 1;
39fi;
40
41echo "clearing _MTN in the output"
42
43rm -rf "$out/_MTN"