All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: lvs-devel@vger.kernel.org, Simon Horman <horms@verge.net.au>
Cc: Wensong Zhang <wensong@linux-vs.org>,
	Julian Anastasov <ja@ssi.bg>,
	Hans Schillstrom <hans.schillstrom@ericsson.com>,
	Ryan O'Hara <rohara@redhat.com>
Subject: [ipvsadm PATCH 3/3] Maintainer script for releasing tarballs
Date: Thu, 05 Sep 2013 13:23:19 +0200	[thread overview]
Message-ID: <20130905112319.5071.69455.stgit@localhost> (raw)
In-Reply-To: <20130905112303.5071.14612.stgit@localhost>

Adding a script (release-tarball.sh) for making a release
tarball, where we avoid including files not related to the git
repository, by using git archive to a temp dir (mktemp).

You need to create a git tag corrosponding with the version in the
file VERSION, before you can make a release.  For testing purposes,
its possible to give a commit id on the command line via "-c" option.

The script also creates a GPG signed file output of the uncompressed
tarball (which is needed by kernel.org upload utility).  A specific
GPGKEY ID can be specified on the command line via "-g" option.

The release tarballs and GPG signing files are placed in the
directory "release/".

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---
 release-tarball.sh |  123 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100755 release-tarball.sh

diff --git a/release-tarball.sh b/release-tarball.sh
new file mode 100755
index 0000000..2333fde
--- /dev/null
+++ b/release-tarball.sh
@@ -0,0 +1,123 @@
+#!/bin/bash
+#
+# Script for making a release tarball, where we avoid including files
+# not related to the git repository, by using git archive to a temp
+# dir (mktemp).
+#
+# You need to create a git tag corrosponding with the version in the
+# file VERSION, before you can make a release.  For testing purposes,
+# its possible to give a commit id on the command line via "-c" option.
+#
+# The script also creates a GPG signed file output of the uncompressed
+# tarball (which is needed by kernel.org upload utility).  A specific
+# GPGKEY ID can be specified on the command line via "-g" option.
+#
+# The release tarballs and GPG signing files are placed in the
+# directory "release/".
+#
+set -e
+NAME=ipvsadm
+#PREV_VERSION=1.xx # disabled in script
+
+if [ -e VERSION ]; then
+    export VERSION=$(cat VERSION)
+else
+    echo "ERROR - Cannot find version file"
+    exit 1
+fi
+VERSION_TAG="v${VERSION}"
+# Notice VERSION can be overridden by command line arg -c
+
+##  --- Parse command line arguments ---
+while getopts "c:g:" option; do
+    case $option in
+	c)
+	    COMMIT=$OPTARG
+	    echo "[WARNING] using git commit/id ($COMMIT) instead of release tag"
+	    VERSION=$COMMIT
+	    VERSION_TAG=$COMMIT
+	    git show $COMMIT > /dev/null
+	    ;;
+	g)
+	    SPECIFIC_GPGKEY=$OPTARG
+	    echo "[NOTICE] Using GPG signing key: $SPECIFIC_GPGKEY"
+	    gpg --list-key "$SPECIFIC_GPGKEY" > /dev/null
+	    ;;
+	?|*)
+	    echo ""
+	    echo "[ERROR] Unknown parameter \"$OPTARG\""
+	    exit 2
+    esac
+done
+shift $[ OPTIND - 1 ]
+
+if [ -n "$SPECIFIC_GPGKEY" ]; then
+    GPGKEY="-u $SPECIFIC_GPGKEY"
+fi
+
+echo "Creating tarball for release tag: $VERSION_TAG"
+echo "================================="
+
+read -p "Are you sure, you want to create a release tarball (y/n)? " -n 1 -r
+echo ""
+if [[ ! "$REPLY" =~ ^[Yy]$ ]]; then
+    exit 1
+fi
+
+# Create a unique tempdir, to avoid leftovers from older release builds
+TMPDIR=`mktemp -dt $NAME.XXXXXXXXXX`
+trap 'rm -rf $TMPDIR' EXIT
+#echo "TMPDIR:$TMPDIR"
+PKGDIR="$TMPDIR/${NAME}-${VERSION}"
+#echo PKGDIR:$PKGDIR
+RELDIR=release
+if [ ! -d $RELDIR ]; then
+    mkdir -p $RELDIR
+fi
+
+# Compression packer tool
+packer=gzip
+packext=gz
+
+TARBALL="$RELDIR/$NAME-$VERSION.tar";
+#CHANGES="$RELDIR/changes-$NAME-$PREV_VERSION-$VERSION.txt";
+
+#mkdir -p "$TMPDIR"
+#echo " -- Git shortlog v$PREV_VERSION..$VERSION_TAG"
+#git shortlog "v$PREV_VERSION..$VERSION_TAG" > "$CHANGES"
+
+echo " -- Git archiving version tag $VERSION_TAG"
+git archive --prefix="$NAME-$VERSION/" "$VERSION_TAG" | tar -xC "$TMPDIR/"
+
+#pushd "$PKGDIR" > /dev/null && {
+#    echo " -- Generating configure scripts..."
+#    sh autogen.sh
+#    popd > /dev/null
+#}
+
+# Create .spec file
+export RELEASE=1
+if [ -f ipvsadm.spec.in ]; then
+    echo " -- Creating .spec file"
+    sed -e "s/@@VERSION@@/${VERSION}/g" \
+	-e "s/@@RELEASE@@/${RELEASE}/g" \
+	< ipvsadm.spec.in > ${PKGDIR}/ipvsadm.spec
+fi
+
+echo " -- Creating tarball $TARBALL"
+#tar --use=${packer} -C "$TMPDIR" -cf "$TARBALL" "$NAME-$VERSION";
+tar -C "$TMPDIR" -cf "$TARBALL" "$NAME-$VERSION";
+
+#(Disabled checksums are auto created by kernel.org kup scripts)
+#echo " -- Calculating checksums"
+#md5sum "$TARBALL"  > "${TARBALL}.md5sum";
+#sha1sum "$TARBALL" > "${TARBALL}.sha1sum";
+
+echo " -- You need to sign the tarball (uncompressed)"
+gpg  $GPGKEY --armor --detach-sign "$TARBALL";
+
+echo " -- Compress tarball to ${TARBALL}.${packext}"
+${packer} "$TARBALL"
+
+echo "MANUAL: Upload to kernel.org, via command:"
+echo kup put ${TARBALL}.${packext} ${TARBALL}.asc /pub/linux/utils/kernel/ipvsadm/


  parent reply	other threads:[~2013-09-05 11:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 11:23 [ipvsadm PATCH 0/3] Patchset in preparation for ipvsadm release v1.27 Jesper Dangaard Brouer
2013-09-05 11:23 ` [ipvsadm PATCH 1/3] Make README more generic and reference new kernel.org location Jesper Dangaard Brouer
2013-09-05 11:23 ` [ipvsadm PATCH 2/3] Add MAINTAINERS style file Jesper Dangaard Brouer
2013-09-05 11:23 ` Jesper Dangaard Brouer [this message]
2013-09-05 19:33 ` [ipvsadm PATCH 0/3] Patchset in preparation for ipvsadm release v1.27 Julian Anastasov
2013-09-06  2:20   ` Simon Horman
2013-09-06  7:48     ` Jesper Dangaard Brouer
2013-09-06  8:05       ` Simon Horman
2013-09-06  8:13         ` Jesper Dangaard Brouer
2013-09-06  8:28           ` Simon Horman

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=20130905112319.5071.69455.stgit@localhost \
    --to=brouer@redhat.com \
    --cc=hans.schillstrom@ericsson.com \
    --cc=horms@verge.net.au \
    --cc=ja@ssi.bg \
    --cc=lvs-devel@vger.kernel.org \
    --cc=rohara@redhat.com \
    --cc=wensong@linux-vs.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.