mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
meson: set release date from .doap file for releases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/355>
This commit is contained in:
parent
d8f0e1b01f
commit
60c183331a
2 changed files with 61 additions and 1 deletions
17
meson.build
17
meson.build
|
@ -156,7 +156,6 @@ osxversion = curversion + 1
|
||||||
|
|
||||||
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
|
plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
|
||||||
|
|
||||||
configure_file(configuration: cdata, output: 'config.h')
|
|
||||||
gstreamer_vaapi_args = ['-DHAVE_CONFIG_H']
|
gstreamer_vaapi_args = ['-DHAVE_CONFIG_H']
|
||||||
configinc = include_directories('.')
|
configinc = include_directories('.')
|
||||||
libsinc = include_directories('gst-libs')
|
libsinc = include_directories('gst-libs')
|
||||||
|
@ -166,5 +165,21 @@ subdir('gst')
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
subdir('docs')
|
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('gstreamer-vaapi.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 = import('python').find_installation()
|
python3 = import('python').find_installation()
|
||||||
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
|
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
|
||||||
|
|
45
scripts/extract-release-date-from-doap-file.py
Executable file
45
scripts/extract-release-date-from-doap-file.py
Executable file
|
@ -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))
|
Loading…
Reference in a new issue