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

Jacopo Mondi jacopo at jmondi.org
Fri Sep 30 17:35:28 CEST 2022


Hi Kieran

On Thu, Sep 29, 2022 at 03:36:26PM +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.
>
> Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
>
> ---
> This can later be extended to support or enforce adding an overview
> changelog to the commit, and annotated tag.
>
>  utils/release.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
>  create mode 100755 utils/release.sh
>
> diff --git a/utils/release.sh b/utils/release.sh
> new file mode 100755
> index 000000000000..c1c35dacab8e
> --- /dev/null
> +++ b/utils/release.sh
> @@ -0,0 +1,48 @@
> +#!/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 -o ! -e .git ]; then
> +	echo "This release script must be run from the root of libcamera git clone."
> +	exit 1
> +fi
> +
> +if ! git diff-index --quiet HEAD; then

Took me a while to validate this as --quite implies --exit-code which
is documented as:

Make the program exit with codes similar to diff(1). That is, it exits
with 1 if there were differences and 0 means no differences.

But in bash an exit code 0 mean success, so it's right to negate it


> +	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:"
> +		echo " - major"
> +		echo " - minor"
> +		echo " - 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 add meson.build
> +git commit meson.build -m "libcamera v$new_version"
> +
> +# Create a tag
> +git tag v$new_version -am "libcamera v$new_version"

The rest looks good
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>

Thanks
  j

> --
> 2.34.1
>


More information about the libcamera-devel mailing list