summaryrefslogtreecommitdiff
path: root/update-moduleset.sh
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2011-03-04 08:01:11 -0800
committerDan Nicholson <dbn.lists@gmail.com>2011-03-12 12:54:26 -0800
commit3920d4e93f8eea4597ad2be3610e638cb1be7580 (patch)
tree87c8b3c0a43b54246a92610d4e53ca94b3eca67b /update-moduleset.sh
parent4d84e999d590685d0d3dec11fc4f7e7780628d14 (diff)
jhbuild: Add script for updating moduleset tarball definitions
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. The module name mangling list was reached by grepping for all the package names in the moduleset. Signed-off-by: Dan Nicholson <dbn.lists@gmail.com> Reviewed-by: Dirk Wallenstein <halsmit@t-online.de>
Diffstat (limited to 'update-moduleset.sh')
-rwxr-xr-xupdate-moduleset.sh84
1 files changed, 84 insertions, 0 deletions
diff --git a/update-moduleset.sh b/update-moduleset.sh
new file mode 100755
index 0000000..691402e
--- /dev/null
+++ b/update-moduleset.sh
@@ -0,0 +1,84 @@
+#!/bin/sh
+
+module=
+version=
+
+usage()
+{
+ cat <<EOF
+Usage: `basename $0` MODULESET SHA1SUM TARBALL
+
+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
+ xorg-server)
+ module_id=xserver
+ ;;
+ util-macros)
+ module_id=macros
+ ;;
+ libXres)
+ module_id=libXRes
+ ;;
+ xtrans)
+ module_id=libxtrans
+ ;;
+ xbitmaps)
+ module_id=bitmaps
+ ;;
+ MesaLib)
+ module_id=libGL
+ ;;
+ xcursor-themes)
+ module_id=cursors
+ ;;
+ libpthread-stubs)
+ module_id=pthread-stubs
+ ;;
+ xproto)
+ module_id=x11proto
+ ;;
+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"