diff options
Diffstat (limited to 'maintainers/scripts/update.nix')
-rwxr-xr-x | maintainers/scripts/update.nix | 53 |
1 files changed, 19 insertions, 34 deletions
diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix index 8d1e47c6bc9..120cd5552f4 100755 --- a/maintainers/scripts/update.nix +++ b/maintainers/scripts/update.nix @@ -1,6 +1,8 @@ { package ? null , maintainer ? null , path ? null +, max-workers ? null +, keep-going ? null }: # TODO: add assert statements @@ -105,27 +107,24 @@ let % nix-shell maintainers/scripts/update.nix --argstr path gnome3 to run update script for all package under an attribute path. - ''; - runUpdateScript = package: '' - echo -ne " - ${package.name}: UPDATING ..."\\r - ${package.updateScript} &> ${(builtins.parseDrvName package.name).name}.log - CODE=$? - if [ "$CODE" != "0" ]; then - echo " - ${package.name}: ERROR " - echo "" - echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------" - echo "" - cat ${(builtins.parseDrvName package.name).name}.log - echo "" - echo "--- SHOWING ERROR LOG FOR ${package.name} ----------------------" - exit $CODE - else - rm ${(builtins.parseDrvName package.name).name}.log - fi - echo " - ${package.name}: DONE. " + You can also add + + --argstr max-workers 8 + + to increase the number of jobs in parallel, or + + --argstr keep-going true + + to continue running when a single update fails. ''; + packageData = package: { + name = package.name; + pname = (builtins.parseDrvName package.name).name; + updateScript = pkgs.lib.toList package.updateScript; + }; + in pkgs.stdenv.mkDerivation { name = "nixpkgs-update-script"; buildCommand = '' @@ -139,21 +138,7 @@ in pkgs.stdenv.mkDerivation { exit 1 ''; shellHook = '' - echo "" - echo "Going to be running update for following packages:" - echo "${builtins.concatStringsSep "\n" (map (x: " - ${x.name}") packages)}" - echo "" - read -n1 -r -p "Press space to continue..." confirm - if [ "$confirm" = "" ]; then - echo "" - echo "Running update for:" - ${builtins.concatStringsSep "\n" (map runUpdateScript packages)} - echo "" - echo "Packages updated!" - exit 0 - else - echo "Aborting!" - exit 1 - fi + unset shellHook # do not contaminate nested shells + exec ${pkgs.python3.interpreter} ${./update.py} ${pkgs.writeText "packages.json" (builtins.toJSON (map packageData packages))}${pkgs.lib.optionalString (max-workers != null) " --max-workers=${max-workers}"}${pkgs.lib.optionalString (keep-going == "true") " --keep-going"} ''; } |