<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
On Fri, 2011-09-16 at 11:11 -0700, Alan Coopersmith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Signed-off-by: Alan Coopersmith <<A HREF="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</A>>
---
release.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 57 insertions(+), 14 deletions(-)
An update to the version I've been using for about a year - after a discussion
at XDC with Keith about adding section autodetection by having a file in every
repo with the directory name, I realized we basically already have one in the
git origin URL.
Still needs a confirmation prompt, which I haven't had time to add, though
it really should be just a few lines of scripting. Anyone want to contribute
that? It could even be a separate patch applied before this one.
diff --git a/release.sh b/release.sh
index c522e1e..073114d 100755
--- a/release.sh
+++ b/release.sh
@@ -17,7 +17,8 @@ moduleset=
usage()
{
cat <<HELP
-Usage: `basename $0` [options] <section> <tag_previous> <tag_current>
+Usage: `basename $0` [options] [<section> [<tag_previous> [<tag_current>]]]
+ or: `basename $0` [options] <section> initial [<tag_current>]
Options:
--force force overwritting an existing release
@@ -123,19 +124,68 @@ while [ $# != 0 ]; do
exit 1
;;
*)
- if [ $# != 3 ]; then
- echo "error: invalid argument count"
+ section="$1"
+ shift
+ if [ $# != 0 ]; then
+ tag_previous="$1"
+ shift
+ if [ $# != 0 ]; then
+ tag_current="$1"
+ shift
+ fi
+ fi
+ if [ $# != 0 ]; then
+ echo "error: unknown parameter"
usage
exit 1
fi
- section="$1"
- tag_previous="$2"
- tag_current="$3"
- shift 3
;;
esac
done
+
+# Attempt to auto-detect values if not specified
+if [ -z "$section" ]; then
+ section="$(git config --get "remote.${remote}.url" | sed -n 's%^.*freedesktop.org/git/xorg/\([^/]*\).*$%\1%p')"
</PRE>
</BLOCKQUOTE>
The parsing of the git url will not work for xcb, which is now part of x.org.
<BLOCKQUOTE>
<PRE>
git://anongit.freedesktop.org/git/xcb/libxcb
</PRE>
</BLOCKQUOTE>
The best, but not the easiest, solution is for x.org to complete the hosting of the xcb reposiroties. The git url is the only indication about which repositories belong to x.org and which don't.
<BLOCKQUOTE TYPE=CITE>
<PRE>
+ echo "Detected section: $section"
+fi
+
+if [ -z "$tag_previous" ]; then
+ tag_previous="$(git describe --abbrev=0 HEAD^)"
+ echo "Detected previous tag: $tag_previous"
+fi
+
+if [ -z "$tag_current" ]; then
+ tag_current="$(git describe --abbrev=0)"
+ echo "Detected current tag: $tag_current"
+fi
+
+
+# Check for required values
+if [ -z "$section" ]; then
+ echo "error: section not found."
+ usage
+ exit 1
+fi
+
+if [ -z "$tag_previous" ] ; then
+ echo "error: previous tag not found."
+ usage
+ exit 1
+fi
+
+if [ -z "$tag_current" ] ; then
+ echo "error: current tag not found."
+ usage
+ exit 1
+fi
+
+if [ "x$tag_previous" = "x$tag_current" ] ; then
+ echo "current tag ($tag_current) must be different than"
+ echo "previous tag ($tag_previous)"
+ exit 1
+fi
+
# Check for uncommitted/queued changes.
if [ "x$ignorechanges" != "x1" ]; then
set +e
@@ -201,13 +251,6 @@ if ! [ -f "$tarball_dir/$tarbz2" ] ||
exit 1
fi
-if [ -z "$tag_previous" ] ||
- [ -z "$section" ]; then
- echo "error: previous tag or section not found."
- usage
- exit 1
-fi
-
if [ -n "$moduleset" ]; then
echo "checking for moduleset"
if ! [ -w "$moduleset" ]; then
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>