mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-06 17:13:24 -05:00
maintainers/scripts/update.nix: allow true for boolean args along w/ "true"
I intend to add a deprecation warning when a string is provided once I've
updated some downstream users.
(cherry picked from commit 2bb3216d1c)
This commit is contained in:
parent
90102dad7e
commit
91a9476387
11 changed files with 25 additions and 21 deletions
|
|
@ -13,9 +13,9 @@
|
|||
path ? null,
|
||||
max-workers ? null,
|
||||
include-overlays ? false,
|
||||
keep-going ? null,
|
||||
commit ? null,
|
||||
skip-prompt ? null,
|
||||
keep-going ? false,
|
||||
commit ? false,
|
||||
skip-prompt ? false,
|
||||
order ? null,
|
||||
}:
|
||||
|
||||
|
|
@ -206,18 +206,18 @@ let
|
|||
|
||||
to increase the number of jobs in parallel, or
|
||||
|
||||
--argstr keep-going true
|
||||
--arg keep-going true
|
||||
|
||||
to continue running when a single update fails.
|
||||
|
||||
You can also make the updater automatically commit on your behalf from updateScripts
|
||||
that support it by adding
|
||||
|
||||
--argstr commit true
|
||||
--arg commit true
|
||||
|
||||
to skip prompt:
|
||||
To skip the prompt, you can add
|
||||
|
||||
--argstr skip-prompt true
|
||||
--arg skip-prompt true
|
||||
|
||||
By default, the updater will update the packages in arbitrary order. Alternately, you can force a specific order based on the packages’ dependency relations:
|
||||
|
||||
|
|
@ -250,11 +250,15 @@ let
|
|||
# JSON file with data for update.py.
|
||||
packagesJson = pkgs.writeText "packages.json" (builtins.toJSON (map packageData packages));
|
||||
|
||||
# Allow boolean arguments to be provided with either --arg or --argstr.
|
||||
# The ability to use the string "true" will be deprecated.
|
||||
isTrue = arg: arg == true || arg == "true";
|
||||
|
||||
optionalArgs =
|
||||
lib.optional (max-workers != null) "--max-workers=${max-workers}"
|
||||
++ lib.optional (keep-going == "true") "--keep-going"
|
||||
++ lib.optional (commit == "true") "--commit"
|
||||
++ lib.optional (skip-prompt == "true") "--skip-prompt"
|
||||
++ lib.optional (isTrue keep-going) "--keep-going"
|
||||
++ lib.optional (isTrue commit) "--commit"
|
||||
++ lib.optional (isTrue skip-prompt) "--skip-prompt"
|
||||
++ lib.optional (order != null) "--order=${order}";
|
||||
|
||||
args = [ packagesJson ] ++ optionalArgs;
|
||||
|
|
|
|||
|
|
@ -1019,7 +1019,7 @@ Furthermore each update script will be passed the following environment variable
|
|||
> An update script will be usually run from the root of the Nixpkgs repository, but you should not rely on that.
|
||||
> Also note that `update.nix` executes update scripts in parallel by default, so you should avoid running `git commit` or any other commands that cannot handle that.
|
||||
|
||||
While update scripts should not create commits themselves, `update.nix` supports automatically creating commits when running it with `--argstr commit true`.
|
||||
While update scripts should not create commits themselves, `update.nix` supports automatically creating commits when running it with `--arg commit true`.
|
||||
If you need to customize commit message, you can have the update script implement the `commit` feature.
|
||||
|
||||
### Supported features
|
||||
|
|
@ -1046,7 +1046,7 @@ If you need to customize commit message, you can have the update script implemen
|
|||
```
|
||||
:::
|
||||
|
||||
When `update.nix` is run with `--argstr commit true`, it will create a separate commit for each of the objects.
|
||||
When `update.nix` is run with `--arg commit true`, it will create a separate commit for each of the objects.
|
||||
An empty list can be returned when the script did not update any files; for example, when the package is already at the latest version.
|
||||
|
||||
The commit object contains the following values:
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
#
|
||||
# from the root of the nixpkgs git repository, run:
|
||||
#
|
||||
# nix-shell maintainers/scripts/update.nix --argstr commit true --argstr package buck2
|
||||
# nix-shell maintainers/scripts/update.nix --arg commit true --argstr package buck2
|
||||
|
||||
let
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# NOTE: Use the following command to update the package
|
||||
# ```sh
|
||||
# nix-shell maintainers/scripts/update.nix --argstr commit true --arg predicate '(path: pkg: builtins.elem path [["claude-code"] ["vscode-extensions" "anthropic" "claude-code"]])'
|
||||
# nix-shell maintainers/scripts/update.nix --arg commit true --arg predicate '(path: pkg: builtins.elem path [["claude-code"] ["vscode-extensions" "anthropic" "claude-code"]])'
|
||||
# ```
|
||||
{
|
||||
lib,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ buildGoModule rec {
|
|||
fi
|
||||
'';
|
||||
|
||||
# Usage: nix-shell maintainers/scripts/update.nix --argstr package lightning-terminal --argstr commit true
|
||||
# Usage: nix-shell maintainers/scripts/update.nix --argstr package lightning-terminal --arg commit true
|
||||
passthru.updateScript = _experimental-update-script-combinators.sequence [
|
||||
(gitUpdater {
|
||||
rev-prefix = "v";
|
||||
|
|
|
|||
|
|
@ -121,5 +121,5 @@ nix-shell maintainers/scripts/update.nix --argstr package tree-sitter-grammars.t
|
|||
Or, to update all grammars:
|
||||
|
||||
```shell
|
||||
nix-shell maintainers/scripts/update.nix --argstr path tree-sitter-grammars --argstr keep-going true
|
||||
nix-shell maintainers/scripts/update.nix --argstr path tree-sitter-grammars --arg keep-going true
|
||||
```
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ stdenv'.mkDerivation (finalAttrs: {
|
|||
pname = "uhd";
|
||||
# NOTE: Use the following command to update the package, and the uhdImageSrc attribute:
|
||||
#
|
||||
# nix-shell maintainers/scripts/update.nix --argstr package uhd --argstr commit true
|
||||
# nix-shell maintainers/scripts/update.nix --argstr package uhd --arg commit true
|
||||
#
|
||||
version = "4.9.0.1";
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ if not all(
|
|||
raise Exception(
|
||||
"Please don't run this script manually, only with:\n"
|
||||
"nix-shell maintainers/scripts/update.nix --argstr path nerd-fonts "
|
||||
"--argstr commit true"
|
||||
"--arg commit true"
|
||||
)
|
||||
|
||||
RELEASE_INFO_URL = "https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# How to update
|
||||
|
||||
`nix-shell maintainers/scripts/update.nix --argstr package androidenv.test-suite --argstr commit true`
|
||||
`nix-shell maintainers/scripts/update.nix --argstr package androidenv.test-suite --arg commit true`
|
||||
|
||||
# How to run tests
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
# from the root of the nixpkgs git repository, run:
|
||||
#
|
||||
# nix-shell maintainers/scripts/update.nix \
|
||||
# --argstr commit true \
|
||||
# --arg commit true \
|
||||
# --argstr package infisical
|
||||
|
||||
let
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
# The `versions.json` can be automatically updated and committed with a commit summary.
|
||||
# To do so, change directory to nixpkgs root, and do:
|
||||
# $ nix-shell ./maintainers/scripts/update.nix --argstr package optifinePackages.optifine-latest --argstr commit true
|
||||
# $ nix-shell ./maintainers/scripts/update.nix --argstr package optifinePackages.optifine-latest --arg commit true
|
||||
|
||||
lib.recurseIntoAttrs (
|
||||
lib.mapAttrs (name: value: callPackage ./generic.nix value) (lib.importJSON ./versions.json)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue