[pve-devel] [RFC kernel 1/2] debian/scripts: add patchqueue scripts
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Apr 3 16:15:23 CEST 2018
Am 04/03/2018 um 01:30 PM schrieb Fabian Grünbichler:
> $ import-patchqueue repo dir [branch]
>
> imports a (previously exported) patchqueue from 'dir' into a new branch
> (default 'pq') in 'repo'
>
> $ export-patchqueue repo dir ref
>
> exports a patchqueue from 'ref' to current HEAD of 'repo' into 'dir'
>
> 'repo' can be any checked out non-bare repository, including worktrees or submodules.
>
> Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
> ---
> note: these are separate scripts to help with manual rebasing and/or cherry-picking, and are called from import-upstream-tag from the next patch
>
> debian/scripts/export-patchqueue | 30 ++++++++++++++++++++++++++++++
> debian/scripts/import-patchqueue | 28 ++++++++++++++++++++++++++++
> 2 files changed, 58 insertions(+)
> create mode 100755 debian/scripts/export-patchqueue
> create mode 100755 debian/scripts/import-patchqueue
>
> diff --git a/debian/scripts/export-patchqueue b/debian/scripts/export-patchqueue
> new file mode 100755
> index 0000000..976d128
> --- /dev/null
> +++ b/debian/scripts/export-patchqueue
> @@ -0,0 +1,30 @@
> +#!/bin/bash
> +
> +set -e
> +
> +top=$(pwd)
> +
> +if [ "$#" -ne 3 ]; then
> + echo "three parameters required."
What/which three parameters?
A real "USAGE" output would be much nicer, even if it's quick to read
the source here.
> + exit 1
> +fi
> +
> +# parameters
> +kernel_submodule=$1
> +kernel_patchdir=$2
> +base_ref=$3
> +
> +cd "${kernel_submodule}"
> +echo "clearing old exported patchqueue"
> +rm -f "${top}/${kernel_patchdir}"/*.patch
> +echo "exporting patchqueue using 'git format-patch [...] ${base_ref}.."
> +git format-patch \
> + --quiet \
> + --no-numbered \
> + --no-cover \
While git can expand this, I'd still use the full option name, for
clarity and update-robustness sake.
--no-cover-letter
> + --zero-commit \
> + --output-dir \
> + "${top}/${kernel_patchdir}" \
> + "${base_ref}.."
> +
> +cd "${top}"
> diff --git a/debian/scripts/import-patchqueue b/debian/scripts/import-patchqueue
> new file mode 100755
> index 0000000..b096fd5
> --- /dev/null
> +++ b/debian/scripts/import-patchqueue
> @@ -0,0 +1,28 @@
> +#!/bin/bash
> +
> +set -e
> +
> +top=$(pwd)
> +
> +if [ "$#" -lt 2 ]; then
> + echo "at least two parameters required."
Same ;) maybe with an `|| "$#" -gt 3` check for to many parameters, with:
USAGE: $1 <submodule> <patchdir> [<branch>]
for example.
looks good, besides my small nits :)
And those could be easily followed up, if wanted.
> + exit 1
> +fi
> +
> +
> +# parameters
> +kernel_submodule=$1
> +kernel_patchdir=$2
> +if [[ -z "$3" ]]; then
> + pq_branch='pq'
> +else
> + pq_branch=$3
> +fi
> +
> +cd "${kernel_submodule}"
> +echo "creating patchqeueue branch '${pq_branch}'"
> +git checkout -b "${pq_branch}"
> +echo "importing patches from '${kernel_patchdir}'"
> +git am "${top}/${kernel_patchdir}"/*.patch
> +
> +cd "${top}"
More information about the pve-devel
mailing list