From 3aee1ac3a199a40020e204e42ed9a48e2f4e1404 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 4 Oct 2010 14:33:16 -0400 Subject: [PATCH] Create some Openbox release scripts release/bugs: Prints a list of bugs that are mentioned in git commits for a git revision, since previous release. - Very useful for updating the CHANGELOG file! release/go: Tests a git revision for correct compilation, and prepares files for release. - Makes the tarball - Makes a GPG signature for the tarball - Tags the release - Spits out URLs to edit and gives the changelog for copy/paste. release/email: Sends an email to the Openbox mailing list with the changelog and details about the release. Call this with the same parameters used for running release/go once it is finished, and the files are uploaded, etc. - Also emails mikachu re freshmeat.net --- release/bugs | 38 ++++++++++++ release/common | 56 ++++++++++++++++++ release/email | 63 ++++++++++++++++++++ release/go | 158 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 315 insertions(+) create mode 100755 release/bugs create mode 100644 release/common create mode 100755 release/email create mode 100755 release/go diff --git a/release/bugs b/release/bugs new file mode 100755 index 00000000..f36a7aa9 --- /dev/null +++ b/release/bugs @@ -0,0 +1,38 @@ +#!/bin/sh + +help() { + echo "Usage: $0 [lastrelease]" + echo + echo " The revision which should be used for release." + echo " [lastrelease] The revision of the most recent release made." + echo " By default it uses the most recent release-tag." + exit 1 +} + +error() { + echo "error: $1" + exit 1 +} + +test -e "./openbox/openbox.c" || \ + error "must be run from the project's top level directory" + +REV="$1" +test -z "$REV" && help +RELEASE_SHA=$(git rev-parse "$REV") +test $? = 0 || error "revision $REV not found" + +LAST="$2" +if test -z "$LAST"; then + LAST=$(git describe --match 'release-*' $REV) + test $? = 0 || \ + error "unable to find last release" +fi + +#### CHANGELOG ##### +git log --no-merges $LAST..$REV --oneline|egrep '[bB][uU][Gg] #?[0-9]+' +git log --no-merges $LAST..$REV --oneline | \ + perl -n -e'/[bB][uU][Gg] #?([0-9]+)/ && print "#$1, "' +perl -e'print "\b\b \n"' + +exit 0 diff --git a/release/common b/release/common new file mode 100644 index 00000000..56093c0a --- /dev/null +++ b/release/common @@ -0,0 +1,56 @@ +#!/bin/sh + +NOW=$(date +%s) +SRCDIR="$PWD" +WORKDIR="/tmp/openbox.$NOW" +TESTDIR="$WORKDIR/.test" + +clean() { + cd "$SRCDIR" + if test -d "$WORKDIR"; then + chmod -R +w "$WORKDIR" + rm -r -f "$WORKDIR" + fi +} + +error() { + echo "error: $1" + test -n "$2" && echo "$2" + clean + exit 1 +} + +RELEASE_SHA=$(git rev-parse "$REV") +test $? = 0 || error "revision $REV not found" + +#NON_MASTER=$(git rev-list $RELEASE_SHA ^master) +#test $? = 0 || error "git rev-list failed" +#test -z $NON_MASTER || error "REVISION contains commits not on master" + +git new-workdir "$SRCDIR" "$WORKDIR" +test $? = 0 || error "git-new-workdir failed" + +echo "working in $WORKDIR" + +cd "$WORKDIR" +test $? = 0 || error "cd to $WORKDIR failed" + +git checkout -q $RELEASE_SHA +test $? = 0 || error "git-checkout failed" + +# get last release +if test -z "$LAST"; then + LAST=$(git describe --match 'release-*' --abbrev=0 $REV) + test $? = 0 || \ + error "unable to find last release" + echo "Using previous release as $LAST" +fi + +H="$(head -1 CHANGELOG|cut -d: -f 1)" +test $H = $VERSION || + error "CHANGELOG does not contain version $VERSION" + +CL="$(cat CHANGELOG|sed -n /^$VERSION:\$/,/^\$/p|tail -n +2|head -n -1)" +CLNOWRAP=$(echo "$CL" \ + |sed -e "s/^ \*/*/"|sed -n '1h;1!H;${;g;s/\n / /g;p;}') +SHORTLOG="$(git shortlog --no-merges $LAST..$REV)" diff --git a/release/email b/release/email new file mode 100755 index 00000000..7fa9e575 --- /dev/null +++ b/release/email @@ -0,0 +1,63 @@ +#!/bin/sh + +help() { + echo "Usage: $0 [lastrelease]" + echo + echo " The revision which should be used for release." + echo " The version of the release." + echo " [lastrelease] The revision of the most recent release made." + echo " By default it uses the most recent release-tag." + exit 1 +} + +REV="$1" +test -z "$REV" && help +VERSION="$2" +test -z "$VERSION" && help +LAST="$3" + +. release/common + +SUBJECT="[RELEASE] Openbox $VERSION" +MAILINGLIST=openbox@icculus.org +MIKACHU=mikachu@icculus.org + +cat < $WORKDIR/.email +Hello, + +Openbox $VERSION is now available! + +Some noteworthy changes are: +$CLNOWRAP + +======== Download ======== + +Download links are here: http://openbox.org/wiki/Openbox:Download + +======== Commits ======== + +The following is a full list of commits appearing in this release. +You can see the full commits here: http://git.openbox.org/?p=dana/openbox.git;a=shortlog;h=refs/tags/release-$VERSION + + +$SHORTLOG +EOF + +if test -z $EDITOR; then + nano -w $WORKDIR/.email || error "failed to edit email, set \$EDITOR" +else + $EDITOR $WORKDIR/.email || error "failed to edit email with \$EDTIOR" +fi + +test -e $WORKDIR/.email || error "email file disappeared" +cat $WORKDIR/.email | mail -s "$SUBJECT" "$MAILINGLIST" || \ + error "mail to $MAILINGLIST failed" + +echo "Hi Mikachu, + +Please update the freshmeat.net Openbox stuff for $VERSION. Thanks!" | \ +mail -s "Freshmeat.net for Openbox $VERSION" "$MIKACHU" || \ + error "mail to $MIKACHU failed" + +clean +exit 0 diff --git a/release/go b/release/go new file mode 100755 index 00000000..3158ac21 --- /dev/null +++ b/release/go @@ -0,0 +1,158 @@ +#!/bin/sh + +help() { + echo "Usage: $0 [lastrelease]" + echo + echo " The revision which should be used for release." + echo " The version of the release." + echo " [lastrelease] The revision of the most recent release made." + echo " By default it uses the most recent release-tag." + exit 1 +} + +REV="$1" +test -z "$REV" && help +VERSION="$2" +test -z "$VERSION" && help +LAST="$3" + +. release/common + +#### CONFIRM SHORTLOG ##### + +echo Shortlog from previous release: +echo "$SHORTLOG" +echo +echo Shortlog from $LAST contains $(echo "$SHORTLOG"|wc -l) lines +echo -n "ok? (y/n) " +read a +test "$a" = "y" || error "aborted" + +#### TEST english po VERSIONS #### + +BAD_PO="$(grep Project-Id-Version po/en*.po|grep -v "openbox $VERSION\\\\n")" +test -z "$BAD_PO" || error "wrong version in po files" "$BAD_PO" + +#### TEST COMPILATION #### + +# check that it builds +./bootstrap >/dev/null || "bootstrap failed" +#CFLAGS="-Werror -isystem /usr/lib/glib-2.0" \ +./configure -C --enable-debug >/dev/null || \ + error "configure (with debug) failed" +make || error "make (with debug and Werror) failed" +git clean -f -x -d -q + +# check that it builds with each optional featureset +./bootstrap >/dev/null || "bootstrap failed" + +echo Check compile with all options enabled +./configure -C >/dev/null || \ + error "configure failed" +make >/dev/null 2>/dev/null || \ + error "make failed" +grep "XKB 1" config.log >/dev/null || error "missing xkb extension" +grep "XRANDR 1" config.log >/dev/null || error "missing xrandr extension" +grep "XINERAMA 1" config.log >/dev/null || error "missing xinerama extension" +grep "SYNC 1" config.log >/dev/null || error "missing sync extension" +make clean >/dev/null || error "make clean failed" + +echo Check compile with startup notification disabled +./configure -C --disable-startup-notification >/dev/null || \ + error "configure failed" +make >/dev/null 2>/dev/null || \ + error "make (with --disable-startup-notification) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with xcursor disabled +./configure -C --disable-xcursor >/dev/null || \ + error "configure failed" +make >/dev/null 2>/dev/null || \ + error "make (with --disable-xcursor) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with imlib2 disabled +./configure -C --disable-imlib2 >/dev/null || \ + error "configure failed" +make >/dev/null 2>/dev/null || \ + error "make (with --disable-imlib2) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with session management disabled +./configure -C --disable-session-management >/dev/null || \ + error "configure failed" +make >/dev/null 2>/dev/null || \ + error "make (with --disable-session-management) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with xkb disabled +./configure -C --disable-xkb >/dev/null || error "configure failed" +make >/dev/null 2>/dev/null || error "make (with --disable-xkb) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with xrandr disabled +./configure -C --disable-xrandr >/dev/null || error "configure failed" +make >/dev/null 2>/dev/null || error "make (with --disable-xrandr) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with xinerama disabled +./configure -C --disable-xinerama >/dev/null || error "configure failed" +make >/dev/null 2>/dev/null || error "make (with --disable-xinerama) failed" +make clean >/dev/null || error "make clean failed" + +echo Check compile with xsync disabled +./configure -C --disable-xsync >/dev/null || error "configure failed" +make >/dev/null 2>/dev/null || error "make (with --disable-xsync) failed" +make clean >/dev/null || error "make clean failed" + +# check that it installs sanely +echo Check installation correctness +./configure -C >/dev/null || \ + error "configure failed" +make distcheck >/dev/null || \ + error "make distcheck failed" + +# VERIFY TARBALL + +TAR="openbox-$VERSION.tar.gz" +ASC="openbox-$VERSION.tar.gz.asc" + +echo Found Openbox release tarball: +ls -d openbox-*.tar.gz +test -e "$TAR" || \ + error "Specified version does not match configure.am" + +# SIGN THE TARBALL + +echo Signing the release tarball: +gpg --sign --detach-sign --armor "$TAR" +test $? = 0 || \ + error "Failed to sign release tarball" + +echo Tagging the release: +git tag -s -m "tagging the $VERSION release" "release-$VERSION" $REV || \ + error "Failed to tag the release" + +mv "$TAR" "$ASC" "$SRCDIR" + +echo "=$VERSION=" +echo "$CLNOWRAP" +echo +echo +echo Edit download page: +echo " http://openbox.org/oldwiki/index.php?title=Openbox:Download&action=edit§ion=1" +echo +echo Edit changelog: +echo " http://openbox.org/oldwiki/index.php?title=Openbox:Changelog&action=edit§ion=1" +echo +echo Push the tag: +echo " git push origin tag release-$VERSION" +echo +echo Email: +echo " ./release/email $*" +echo +cd "$SRCDIR" +ls -l "$TAR" "$ASC" + +clean +exit 0