[libcamera-devel] [PATCH v4 3/3] utils: Provide a release script

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Oct 13 12:40:28 CEST 2022


Hi Kieran,

Thank you for the patch.

On Thu, Oct 13, 2022 at 10:59:57AM +0100, Kieran Bingham wrote:
> Support making releases of libcamera by introducing a helper script
> which will facilitate the increment of any release version, along with
> generating an associated tag.
> 
> Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> ---
> v4
>  - Set -e on script to stop on any errors
>  - Use -e when creating the release commit to support the releaser
>    adding notes
>  - Take the commit message into the signed tag as the release message
>    (No signoffs are stripped)

There's a git-interpret-trailers command, I wish there was a
git-remove-trailers, or a %B:trailers=false format string, or something
similar. It shouldn't be too difficult to implement with awk, but that's
really bikeshedding, I won't insist :-)

> v3
>  - Improve error message
>  - Remove redundant git add
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  utils/release.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>  create mode 100755 utils/release.sh
> 
> diff --git a/utils/release.sh b/utils/release.sh
> new file mode 100755
> index 000000000000..6b4e081ba179
> --- /dev/null
> +++ b/utils/release.sh
> @@ -0,0 +1,46 @@
> +#!/bin/sh
> +
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Prepare a project release
> +
> +set -e
> +
> +# Abort if we are not within the project root or the tree is not clean.
> +if [ ! -e utils/gen-version.sh ] || [ ! -e .git ]; then
> +	echo "This release script must be run from the root of libcamera git tree."
> +	exit 1
> +fi
> +
> +if ! git diff-index --quiet HEAD; then
> +	echo "Tree must be clean to release."
> +	exit 1
> +fi
> +
> +# Identify current version components
> +version=$(./utils/gen-version.sh)
> +
> +# Decide if we are here to bump major, minor, or patch release.
> +case $1 in
> +	major|minor|patch)
> +		bump=$1;
> +		;;
> +	*)
> +		echo "You must specify the version bump level: (major, minor, patch)"
> +		exit 1
> +		;;
> +esac
> +
> +new_version=$(./utils/semver bump "$bump" "$version")
> +
> +echo "Bumping $bump"
> +echo "  Existing version is: $version"
> +echo "  New version is : $new_version"
> +
> +# Patch in the version to our meson.build
> +sed -i -E "s/ version : '.*',/ version : '$new_version',/" meson.build
> +
> +# Commit the update
> +git commit meson.build -esm "libcamera v$new_version"
> +
> +# Create a tag from that commit
> +git show -s --format=%B | git tag "v$new_version" -as -F -

Do you need -a for git-tag ? According to the man page,

       -a, --annotate
           Make an unsigned, annotated tag object

       -s, --sign
	   Make a GPG-signed tag, using the default e-mail address’s
	   key. The default behavior of tag GPG-signing is controlled by
	   tag.gpgSign configuration variable if it exists, or disabled
	   otherwise. See git-config(1).

I think -s is enough.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list