Added local best-effort builds (i.e. one failure does not ruin all packages you would like to see built)

This commit is contained in:
Michael Raskin 2008-06-14 08:30:35 +00:00
parent 826b271d9a
commit 18e27629d3
2 changed files with 17 additions and 3 deletions

View file

@ -16,7 +16,7 @@ needed_path="$(echo $needed_path | sed -e 's/%2B/+/g; s/%3D/=/g')"
echo needed_path: "$needed_path" >&2 echo needed_path: "$needed_path" >&2
NIX_STORE="${NIX_STORE:-/nix/store}" NIX_STORE="${NIX_STORE_DIR:-/nix/store}"
echo NIX_STORE: "${NIX_STORE}" >&2 echo NIX_STORE: "${NIX_STORE}" >&2

View file

@ -16,6 +16,10 @@ if test -z "$1" || test "a--help" = "a$1" ; then
echo " Or all together: " >&2 echo " Or all together: " >&2
echo -e nix-reduce-build /expr.nix /e2.nix -- \\\\\\\n\ echo -e nix-reduce-build /expr.nix /e2.nix -- \\\\\\\n\
" ssh://a@b.example.com http://n.example.com/get-nar?q= file://nar/" >&2 " ssh://a@b.example.com http://n.example.com/get-nar?q= file://nar/" >&2
echo " Also supports best-effort local builds of failing expression set:" >&2
echo "nix-reduce-build /e.nix -- nix-daemon:// nix-self://" >&2
echo " nix-daemon:// builds using daemon"
echo " nix-self:// builds directly using nix-store from current installation" >&2
exit; exit;
fi; fi;
@ -28,7 +32,7 @@ echo Will work on $(cat initial | wc -l) targets. >&2
while read ; do while read ; do
case "$REPLY" in case "$REPLY" in
${NIX_STORE_PATH:-/nix/store}/*) ${NIX_STORE_DIR:-/nix/store}/*)
echo "$REPLY" >> paths; >&2 echo "$REPLY" >> paths; >&2
;; ;;
*) *)
@ -79,11 +83,21 @@ for i in "$@"; do
echo "Getting $REPLY over http/https" >&2 echo "Getting $REPLY over http/https" >&2
curl ${BAD_CERTIFICATE:+-k} -L "$i${REPLY##*/}" | gunzip | nix-store --import; curl ${BAD_CERTIFICATE:+-k} -L "$i${REPLY##*/}" | gunzip | nix-store --import;
done; done;
elif [ "$i" != "filePath" ] ; then elif [ "$i" != "$filePath" ] ; then
cat needed-paths | while read; do cat needed-paths | while read; do
echo "Installing $REPLY from file" >&2 echo "Installing $REPLY from file" >&2
gunzip < "$filePath/${REPLY##*/}".nar.gz | nix-store --import; gunzip < "$filePath/${REPLY##*/}".nar.gz | nix-store --import;
done; done;
elif [ "$i" = "nix-daemon://" ] ; then
cat needed-paths | while read ; do
echo "Building $REPLY using nix-daemon" >&2
NIX_REMOTE=daemon @bindir@/nix-store -r "${NIX_STORE_DIR:-/nix/store}/${REPLY##*/}"
done;
elif [ "$i" = "nix-self://" ] ; then
cat needed-paths | while read ; do
echo "Building $REPLY using direct Nix build" >&2
NIX_REMOTE= @bindir@/nix-store -r "${NIX_STORE_DIR:-/nix/store}/${REPLY##*/}"
done;
fi; fi;
mv needed-paths wanted-paths; mv needed-paths wanted-paths;
cat wanted-paths | xargs nix-store --check-validity --print-invalid > needed-paths; cat wanted-paths | xargs nix-store --check-validity --print-invalid > needed-paths;