diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2020-07-08 17:39:20 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2020-07-08 17:45:27 +0100 |
commit | e270b412277f460d8db48ba65fb3df6281e282c7 (patch) | |
tree | b31a2b25a75ad1d316957459dc93c433f8a542d4 | |
parent | 8647f4d4807c12ea6c076b7a9e5985f7427453fc (diff) | |
download | gst-omx-e270b412277f460d8db48ba65fb3df6281e282c7.tar.gz |
meson: set release date from .doap file for releases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-omx/-/merge_requests/69>
-rw-r--r-- | gst-omx.doap | 4 | ||||
-rw-r--r-- | meson.build | 18 | ||||
-rwxr-xr-x | scripts/extract-release-date-from-doap-file.py | 45 |
3 files changed, 63 insertions, 4 deletions
diff --git a/gst-omx.doap b/gst-omx.doap index 2dd46d9..b33150a 100644 --- a/gst-omx.doap +++ b/gst-omx.doap @@ -6,7 +6,7 @@ xmlns:admin="http://webns.net/mvcb/"> <name>GStreamer OpenMAX IL wrapper plugin</name> - <shortname>gst-omx>/shortname> + <shortname>gst-omx</shortname> <homepage rdf:resource="http://gstreamer.freedesktop.org/modules/gst-omx.html" /> <created>2005-06-17</created> <shortdesc xml:lang="en"> @@ -284,7 +284,7 @@ a basic collection of elements <maintainer> <foaf:Person> - <foaf:name>Sebastian Drö&ge</foaf:name> + <foaf:name>Sebastian Dröge</foaf:name> <foaf:mbox_sha1sum>7c1069ea873ef7751e4eca5f1a42744b0e9a3a0a</foaf:mbox_sha1sum> </foaf:Person> </maintainer> diff --git a/meson.build b/meson.build index f06dce2..b26b16f 100644 --- a/meson.build +++ b/meson.build @@ -388,8 +388,6 @@ else message('GStreamer debug system is enabled') endif -configure_file(output : 'config.h', configuration : cdata) - subdir('config') if not get_option('examples').disabled() @@ -407,5 +405,21 @@ if not get_option('tests').disabled() and gstcheck_dep.found() endif subdir('docs') +# Set release date +if gst_version_nano == 0 + extract_release_date = find_program('scripts/extract-release-date-from-doap-file.py') + run_result = run_command(extract_release_date, gst_version, files('gst-omx.doap')) + if run_result.returncode() == 0 + release_date = run_result.stdout().strip() + cdata.set_quoted('GST_PACKAGE_RELEASE_DATETIME', release_date) + message('Package release date: ' + release_date) + else + # Error out if our release can't be found in the .doap file + error(run_result.stderr()) + endif +endif + +configure_file(output: 'config.h', configuration: cdata) + python3 = find_program('python3') run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")') 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 0000000..f09b60e --- /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)) |