summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2020-07-08 17:16:46 +0100
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>2020-07-08 19:14:24 +0000
commit5247e2319cc3209c8f992f69ab304992547d33e6 (patch)
treedf541870f699ed954b3b0908869c6274c62ece71 /scripts
parentbf38898af82628b7509e92d82c2b239684f5f222 (diff)
downloadgstreamer-plugins-bad-5247e2319cc3209c8f992f69ab304992547d33e6.tar.gz
meson: set release date from .doap file for releases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1420>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/extract-release-date-from-doap-file.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/extract-release-date-from-doap-file.py b/scripts/extract-release-date-from-doap-file.py
new file mode 100755
index 000000000..f09b60e9d
--- /dev/null
+++ b/scripts/extract-release-date-from-doap-file.py
@@ -0,0 +1,45 @@
+#!/usr/bin/env python3
+#
+# extract-release-date-from-doap-file.py VERSION DOAP-FILE
+#
+# Extract release date for the given release version from a DOAP file
+#
+# Copyright (C) 2020 Tim-Philipp Müller <tim centricular com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+import sys
+import xml.etree.ElementTree as ET
+
+if len(sys.argv) != 3:
+ sys.exit('Usage: {} VERSION DOAP-FILE'.format(sys.argv[0]))
+
+release_version = sys.argv[1]
+doap_fn = sys.argv[2]
+
+tree = ET.parse(doap_fn)
+root = tree.getroot()
+
+namespaces = {'doap': 'http://usefulinc.com/ns/doap#'}
+
+for v in root.findall('doap:release/doap:Version', namespaces=namespaces):
+ if v.findtext('doap:revision', namespaces=namespaces) == release_version:
+ release_date = v.findtext('doap:created', namespaces=namespaces)
+ if release_date:
+ print(release_date)
+ sys.exit(0)
+
+sys.exit('Could not find a release with version {} in {}'.format(release_version, doap_fn))