mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: jon@ringle.org
To: ptxdist@pengutronix.de
Cc: Jon Ringle <jringle@gridpoint.com>
Subject: [ptxdist] [PATCH] make_release.sh: make it more accessible for creating custom releases
Date: Thu, 13 Feb 2014 09:08:27 -0500	[thread overview]
Message-ID: <1392300507-30372-1-git-send-email-jon@ringle.org> (raw)

From: Jon Ringle <jringle@gridpoint.com>

Without args, the script will continue to work as it used to for
pengutronix approved releases

But now a custom release can be created if your in a situation where you
need to distribute to a group of developers a needed fix to ptxdist and
you can't wait until the next pengutronix release of ptxdist.

I've personally setup my local ptxdist.git repo to use gitflow-AVH:

[gitflow "branch"]
        master = production
        develop = develop
[gitflow "prefix"]
        feature = feature/
        release = release/
        hotfix = hotfix/
        support = support/
        versiontag = gp-

I will then call this script from the production branch like this:
$ git checkout production
$ ./scripts/make_release.sh -s "GP" -t "-a" gridpoint production release

and if I need a subsequent release within the same month:
$ git flow release start ptxdist-2014.02.x_GP
$ ./scripts/make_release.sh -s "GP" -t "-a" gridpoint production release

Signed-off-by: Jon Ringle <jringle@gridpoint.com>
---
 scripts/make_release.sh | 60 ++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 49 insertions(+), 11 deletions(-)

diff --git a/scripts/make_release.sh b/scripts/make_release.sh
index f0d4357..3515740 100755
--- a/scripts/make_release.sh
+++ b/scripts/make_release.sh
@@ -2,7 +2,45 @@
 
 set -e
 
-origin=origin
+usage() {
+cat <<-EOF
+
+Usage: `basename "$0"` OPTIONS [origin] [master] [stable]
+
+    -h              this help
+    -t <tagopts>    Options to pass to git tag. Default: -s
+    -s <suffix>     Suffix to append to release tag name. Default is no suffix
+
+    [origin]        The git remote to push to. Default: origin
+    [master]        The master branch for new releases. Default: master
+    [stable]        The stable/ branch branch dir for stable releases. Default: stable
+EOF
+}
+
+suffix=
+tagopts=-s
+
+while getopts "ht:s:" OPT
+do
+    case "$OPT" in
+	h)
+	    usage
+	    exit 1
+	    ;;
+	t)
+	    tagopts="$OPTARG"
+	    ;;
+	s)
+	    suffix="_$OPTARG"
+	    ;;
+    esac
+done
+shift $(expr $OPTIND - 1)
+
+origin=${1:-origin}
+master=${2:-master}
+stable=${3:-stable}
+
 v="ptxdist-"
 
 branch="$(git symbolic-ref HEAD)"
@@ -29,23 +67,23 @@ fi
 
 # guess if we're going to make a new or stable release
 case "${branch}" in
-    master)
-	release="${v}$(date +%Y.%m).0"
-	prev_release="${v}*.0"
+    ${master})
+	release="${v}$(date +%Y.%m).0${suffix}"
+	prev_release="${v}*.0${suffix}"
 	;;
-    stable/*)
-	release="${branch##stable/}"
-	release="${release%.x}"
+    ${stable}/*)
+	release="${branch##${stable}/}"
+	release="${release%.x${suffix}}"
 	inc="$(git tag -l "${release}.*" | wc -l)"
 	if [ ${inc} -eq 0 ]; then
 	    echo "about to make stable a release for '${release}', but no '.0' found" >&2
 	    exit 1
 	fi
-	prev_release="${release}.$((inc - 1))"
-	release="${release}.${inc}"
+	prev_release="${release}.$((inc - 1))${suffix}"
+	release="${release}.${inc}${suffix}"
 	;;
     *)
-	echo "please checkout either master or stable branch" >&2
+	echo "please checkout either ${master} or ${stable} branch" >&2
 	exit 1
 	;;
 esac
@@ -70,7 +108,7 @@ log="${tmp}/log"
 printf "${release}\n\n" > "${log}"
 git shortlog "${prev_release}"..HEAD >> "${log}"
 echo "creating tag '${release}'"
-git tag -s -F "${log}" "${release}"
+git tag ${tagopts} -F "${log}" "${release}"
 
 # create tarball
 here="$(pwd)"
-- 
1.8.5.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2014-02-13 14:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-13 14:08 jon [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-05 19:55 [ptxdist] [PATCH] ptxd_make_get.sh: remove git fetch --progress jon
2014-02-05 19:55 ` [ptxdist] [PATCH] make_release.sh: make it more accessible for creating custom releases jon
2014-02-12  8:54   ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1392300507-30372-1-git-send-email-jon@ringle.org \
    --to=jon@ringle.org \
    --cc=jringle@gridpoint.com \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox