summaryrefslogtreecommitdiff
path: root/extract-release-date-from-doap-file
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2010-06-21 16:26:21 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2010-07-23 17:11:49 +0100
commit2004d03037bbb2bb72de7a49ba501a7b5f6e2f92 (patch)
treedd22834c5b786764298a0ab28adb73f09a2b94c9 /extract-release-date-from-doap-file
parent1c3225c7cffafbcfdf711ed33c69e6e1f974745d (diff)
downloadgstreamer-common-2004d03037bbb2bb72de7a49ba501a7b5f6e2f92.tar.gz
Add AG_GST_SET_PACKAGE_RELEASE_DATETIME and _DATETIME_WITH_NANO macros for configure
Sets GST_PACKAGE_RELEASE_DATETIME, either to the current date and time, or to the specified datetime, or to the date of the current release based on the .doap file. In a GStreamer module context, one could use it like this: AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO], ["${srcdir}/$PACKAGE.doap"], [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO]) https://bugzilla.gnome.org/show_bug.cgi?id=623040
Diffstat (limited to 'extract-release-date-from-doap-file')
-rwxr-xr-xextract-release-date-from-doap-file32
1 files changed, 32 insertions, 0 deletions
diff --git a/extract-release-date-from-doap-file b/extract-release-date-from-doap-file
new file mode 100755
index 0000000..f2bc418
--- /dev/null
+++ b/extract-release-date-from-doap-file
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Shell script to extract the date given a release version and a .doap file
+
+if test "x$1" = "x" -o "x$2" = "x" -o ! -s "$2"; then
+ echo "Usage: $0 RELEASE-VERSION-NUMBER DOAP-FILE" >&2;
+ exit 1
+fi
+
+if ! grep '<Project' "$2" >/dev/null ; then
+ echo "$2 does not look lika a .doap file" >&2;
+ exit 1
+fi
+
+if ! grep "$1" "$2" >/dev/null ; then
+ echo "$2 contains no reference to a version $1" >&2;
+ exit 1
+fi
+
+awk 'BEGIN {x=0}
+{
+if ($0~"<release>") {x=1; chunk=""}
+if (x==1) {
+ if ($0~"<revision>") { chunk = chunk $0 }
+ if ($0~"<created>") { chunk = chunk $0 }
+}
+if ($0~"</release>") {x=0; print chunk}
+}' < "$2" | \
+\
+grep '<revision>'"$1"'</revision>' | \
+\
+sed -e 's/^.*<created>//' -e 's/<\/created>.*$//'
+