[libcamera-devel] [PATCH v3 5/5] utils: Provide a release script

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Oct 12 16:57:17 CEST 2022


Hi Kieran,

Thank you for the patch.

On Mon, Oct 10, 2022 at 06:32:14PM +0100, Kieran Bingham via libcamera-devel 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>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> ---
> v3
>   - Improve error message
>   - Remove redundant git add
> 
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> ---
>  utils/release.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>  create mode 100755 utils/release.sh
> 
> diff --git a/utils/release.sh b/utils/release.sh
> new file mode 100755
> index 000000000000..14d62aa6005f
> --- /dev/null
> +++ b/utils/release.sh
> @@ -0,0 +1,44 @@
> +#!/bin/sh
> +
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +# Prepare a project release
> +
> +# 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

Not something you need to fix for merging (although I wouldn't mind
;-)), it would be nice if the script could be run from within a
subdirectory of the source tree. When testing the series, I had to move
back and forth between the source root and the build root to bump the
version number and compile-test. That's partly due to my work flow (I
could just use ninja -C), and we won't tag new releases every minute, so
it's not a big deal.

> +
> +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 -sm "libcamera v$new_version"

I'd add -e to let the user write a commit message.

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> +
> +# Create a tag
> +git tag "v$new_version" -asm "libcamera v$new_version"

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list