diff options
author | Malte Brandy <malte.brandy@maralorn.de> | 2021-05-07 15:03:54 +0200 |
---|---|---|
committer | Malte Brandy <malte.brandy@maralorn.de> | 2021-05-07 15:03:54 +0200 |
commit | 2a11f1f5cc1c4680b49240203db18ecbb19b9cc5 (patch) | |
tree | df44c5fcd797c97297ab663b63167e9b4bc06a72 /maintainers | |
parent | f73c2278d07e674233040422b71d965a0587756f (diff) | |
parent | ae1c8ede09b53007ba9b3c32f926c9c03547ae8b (diff) |
Merge branch 'master' into haskell-updates
Diffstat (limited to 'maintainers')
-rwxr-xr-x | maintainers/scripts/update.nix | 14 | ||||
-rw-r--r-- | maintainers/scripts/update.py | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/maintainers/scripts/update.nix b/maintainers/scripts/update.nix index 1305e0947c726..5317bdb9f42cb 100755 --- a/maintainers/scripts/update.nix +++ b/maintainers/scripts/update.nix @@ -1,5 +1,6 @@ { package ? null , maintainer ? null +, predicate ? null , path ? null , max-workers ? null , include-overlays ? false @@ -69,6 +70,11 @@ let */ packagesWith = packagesWithPath []; + /* Recursively find all packages in `pkgs` with updateScript matching given predicate. + */ + packagesWithUpdateScriptMatchingPredicate = cond: + packagesWith (path: pkg: builtins.hasAttr "updateScript" pkg && cond path pkg); + /* Recursively find all packages in `pkgs` with updateScript by given maintainer. */ packagesWithUpdateScriptAndMaintainer = maintainer': @@ -79,7 +85,7 @@ let else builtins.getAttr maintainer' lib.maintainers; in - packagesWith (path: pkg: builtins.hasAttr "updateScript" pkg && + packagesWithUpdateScriptMatchingPredicate (path: pkg: (if builtins.hasAttr "maintainers" pkg.meta then (if builtins.isList pkg.meta.maintainers then builtins.elem maintainer pkg.meta.maintainers @@ -120,6 +126,8 @@ let packages = if package != null then [ (packageByName package pkgs) ] + else if predicate != null then + packagesWithUpdateScriptMatchingPredicate predicate pkgs else if maintainer != null then packagesWithUpdateScriptAndMaintainer maintainer pkgs else if path != null then @@ -139,6 +147,10 @@ let to run update script for specific package, or + % nix-shell maintainers/scripts/update.nix --arg predicate '(path: pkg: builtins.isList pkg.updateScript && builtins.length pkg.updateScript >= 1 && (let script = builtins.head pkg.updateScript; in builtins.isAttrs script && script.name == "gnome-update-script"))' + + to run update script for all packages matching given predicate, or + % nix-shell maintainers/scripts/update.nix --argstr path gnome3 to run update script for all package under an attribute path. diff --git a/maintainers/scripts/update.py b/maintainers/scripts/update.py index 8cc2bcbd67c96..eb26a472e9265 100644 --- a/maintainers/scripts/update.py +++ b/maintainers/scripts/update.py @@ -39,6 +39,9 @@ async def run_update_script(nixpkgs_root: str, merge_lock: asyncio.Lock, temp_di if temp_dir is not None: worktree, _branch = temp_dir + # Ensure the worktree is clean before update. + await check_subprocess('git', 'reset', '--hard', '--quiet', 'HEAD', cwd=worktree) + # Update scripts can use $(dirname $0) to get their location but we want to run # their clones in the git worktree, not in the main nixpkgs repo. update_script_command = map(lambda arg: re.sub(r'^{0}'.format(re.escape(nixpkgs_root)), worktree, arg), update_script_command) |