[PATCH modular 14/15] jhbuild: Add script for updating moduleset tarball definitions

Dan Nicholson dbn.lists at gmail.com
Sun Mar 6 09:29:59 PST 2011


update-moduleset.sh takes the sha1sum and tarball and updates the module
definition in a given moduleset. This should make keeping the stable
moduleset easier.

Signed-off-by: Dan Nicholson <dbn.lists at gmail.com>
---
 update-moduleset.sh |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)
 create mode 100755 update-moduleset.sh

diff --git a/update-moduleset.sh b/update-moduleset.sh
new file mode 100755
index 0000000..7de43fe
--- /dev/null
+++ b/update-moduleset.sh
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+module=
+version=
+
+usage()
+{
+    cat <<EOF
+Usage: `basename $0` MODULESET TARBALL SHA1SUM
+
+Updates the module associated to TARBALL in MODULESET.
+EOF
+}
+
+# check input arguments
+moduleset=$1
+sha1sum=$2
+tarball=$3
+if [ -z "$moduleset" ] || [ -z "$sha1sum" ] || [ -z "$tarball" ]; then
+    echo "error: Not enough arguments" >&2
+    usage >&2
+    exit 1
+fi
+
+# check that the moduleset exists and is writable
+if [ ! -w "$moduleset" ]; then
+    echo "error: moduleset \"$moduleset\" does not exist or is not writable" >&2
+    exit 1
+fi
+
+# we only want the tarball name
+tarball=`basename $tarball`
+
+# pull the module and version from the tarball
+module=${tarball%-*}
+version=${tarball##*-}
+version=${version%.tar*}
+
+# sometimes the jhbuild id doesn't match the tarball name
+module_id=$module
+case "$module" in
+    util-macros)
+	module_id=macros
+	;;
+    libXres)
+        module_id=libXRes
+        ;;
+    libxtrans)
+        module_id=xtrans
+        ;;
+    xbitmaps)
+        module_id=bitmaps
+        ;;
+    xcursor-themes)
+        module_id=cursors
+        ;;
+esac
+
+# edit the moduleset
+sed -i \
+    "/id=\"$module_id\"/{
+        # read the next line until we get />, which should be the end
+        # of the branch tag
+        :next
+        N
+        /\/>$/!b next
+
+        # update the info
+        s/$module-[^\"]*\"/$tarball\"/
+        s/version=\"[^\"]*\"/version=\"$version\"/
+        s/hash=\"[^\"]*\"/hash=\"sha1:$sha1sum\"/
+    }" "$moduleset"
-- 
1.7.3.4



More information about the xorg-devel mailing list