[libcamera-devel] [PATCH v4 3/3] utils: Provide a release script
Kieran Bingham
kieran.bingham at ideasonboard.com
Thu Oct 13 11:59:57 CEST 2022
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)
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 -
--
2.34.1
More information about the libcamera-devel
mailing list