Message ID | 20221010173214.3547133-6-kieran.bingham@ideasonboard.com |
---|---|
State | Accepted |
Headers | show |
Series |
|
Related | show |
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@jmondi.org> > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > --- > v3 > - Improve error message > - Remove redundant git add > > Signed-off-by: Kieran Bingham <kieran.bingham@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@ideasonboard.com> > + > +# Create a tag > +git tag "v$new_version" -asm "libcamera v$new_version"
Quoting Laurent Pinchart (2022-10-12 15:57:17) > 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@jmondi.org> > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > --- > > v3 > > - Improve error message > > - Remove redundant git add > > > > Signed-off-by: Kieran Bingham <kieran.bingham@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. I thought about that, and was going to consider adding that later. But I can add it immediately. I sort of thought the 'release' message should go in the tag, or even both the tag and the commit... as some web based systems will show the contents of the tag as the 'release' information. -- Kieran > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > + > > +# Create a tag > > +git tag "v$new_version" -asm "libcamera v$new_version" > > -- > Regards, > > Laurent Pinchart
Hi Kieran, On Wed, Oct 12, 2022 at 04:47:56PM +0100, Kieran Bingham wrote: > Quoting Laurent Pinchart (2022-10-12 15:57:17) > > 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@jmondi.org> > > > Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > > > --- > > > v3 > > > - Improve error message > > > - Remove redundant git add > > > > > > Signed-off-by: Kieran Bingham <kieran.bingham@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. > > I thought about that, and was going to consider adding that later. But I > can add it immediately. The reason I'd like it now is that modifying the message is difficult after the tag is created, we can't just commit --amend, so it would discentivise use from adding commit messages. > I sort of thought the 'release' message should go in the tag, or even > both the tag and the commit... as some web based systems will show the > contents of the tag as the 'release' information. That's a good point too. Maybe the script could take the message from the commit and use it for the tag, with '-F -' (maybe with the SoB stripped off) ? That could be added later too. > > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > > > > + > > > +# Create a tag > > > +git tag "v$new_version" -asm "libcamera v$new_version"
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 + +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" + +# Create a tag +git tag "v$new_version" -asm "libcamera v$new_version"