[libcamera-devel,v4,3/3] utils: Provide a release script
diff mbox series

Message ID 20221013095957.1642901-4-kieran.bingham@ideasonboard.com
State Accepted
Headers show
Series
  • Add release infrastructure
Related show

Commit Message

Kieran Bingham Oct. 13, 2022, 9:59 a.m. UTC
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@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@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@ideasonboard.com>
---
 utils/release.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100755 utils/release.sh

Comments

Laurent Pinchart Oct. 13, 2022, 10:40 a.m. UTC | #1
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@jmondi.org>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Signed-off-by: Kieran Bingham <kieran.bingham@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@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.
Kieran Bingham Oct. 13, 2022, 11:19 a.m. UTC | #2
Quoting Laurent Pinchart (2022-10-13 11:40:28)
> 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@jmondi.org>
> > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Signed-off-by: Kieran Bingham <kieran.bingham@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 :-)

I'm going to leave this as is.

> 
> > v3
> >  - Improve error message
> >  - Remove redundant git add
> > 
> > Signed-off-by: Kieran Bingham <kieran.bingham@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.

Ah, ok - I thought -a was the request to annotate it with a message. If
that's already implicit ... that's fine. It works with it anyway, but I
can drop it as long as it all still works.


> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch
diff mbox series

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 -