linux-pr: Derive the tag prefix from the template name Use the template name as the tag prefix and accept only the template name and version as positional arguments. Update the usage examples for the shorter command line and renamed templates. Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
diff --git a/README.md b/README.md index b216d09..df10b0e 100644 --- a/README.md +++ b/README.md
@@ -5,17 +5,21 @@ `DATADIR` at installation time to use a different directory; the installed command records that directory. `DESTDIR` is only a staging prefix. -Select a template by name, without the `.mbox.in` suffix: +Select a template by name, without the `.mbox.in` suffix. The name also serves +as the tag prefix: ```sh -linux-pr -n -C ~/work/linux tpmdd v7.4-rc1 linux-tpmdd +linux-pr -n -C ~/work/linux tpm v7.4-rc1 ``` -The available names are `keyrings` and `linux-tpmdd`. Lookup defaults to the +`linux-pr --postfix rebased tpm v7.4-rc1` selects `tpm.mbox.in` and creates +the Git tag `tpm-v7.4-rc1-rebased`. + +The available names are `keys` and `tpm`. Lookup defaults to the installed template directory, with no current-directory or checkout fallback. Use `--data-dir <dir>` to select another template directory explicitly. For example, when testing from this checkout: ```sh -bin/linux-pr -n --data-dir ./data -C ~/work/linux tpmdd v7.4-rc1 linux-tpmdd +bin/linux-pr -n --data-dir ./data -C ~/work/linux tpm v7.4-rc1 ```
diff --git a/bin/linux-pr b/bin/linux-pr index 3459261..e5c286b 100755 --- a/bin/linux-pr +++ b/bin/linux-pr
@@ -8,7 +8,7 @@ TEMPLATE_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/linux-pr" usage() { - echo "Usage: $0 [-n|--dry-run] [-C <linux kernel tree>] [--postfix <postfix>] [--data-dir <data dir>] <tag prefix> <version> <template name>" + echo "Usage: $0 [-n|--dry-run] [-C <linux kernel tree>] [--postfix <postfix>] [--data-dir <data dir>] <template name> <version>" } git_kernel() { @@ -89,7 +89,7 @@ esac done -if [[ -z "$kernel_tree" || $# -ne 3 ]]; then +if [[ -z "$kernel_tree" || $# -ne 2 ]]; then usage >&2 exit 1 fi @@ -99,9 +99,8 @@ exit 1 fi -tag_prefix="$1" +template_name="$1" version="$2" -template_name="$3" if [[ -z "$template_name" || "$template_name" == */* ]]; then echo "Invalid template name: \"$template_name\"" >&2 exit 1 @@ -111,7 +110,7 @@ echo "Template \"$template_name\" not found or unreadable: $template" >&2 exit 1 fi -tag="${tag_prefix}-${version}" +tag="${template_name}-${version}" git_tag="${tag}${postfix:+-$postfix}" tag_ref="refs/tags/$git_tag"