build: Do not require appstream-util for metainfo version check
appstream-util is deprecated in favor of appstreamcli. The new tool does not have a `validate-version` command, so implement the check in directly in the check-version.py script. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3520>
This commit is contained in:
parent
fd8d923a34
commit
7405f7c360
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import argparse, subprocess
|
from xml.etree.ElementTree import ElementTree
|
||||||
|
import argparse
|
||||||
|
|
||||||
def check_version(version, file, type='news'):
|
def check_version(version, file, type='news'):
|
||||||
if type == 'news':
|
if type == 'news':
|
||||||
@ -12,8 +13,11 @@ def check_version(version, file, type='news'):
|
|||||||
if not ok:
|
if not ok:
|
||||||
raise Exception("{} does not start with {}".format(file, version))
|
raise Exception("{} does not start with {}".format(file, version))
|
||||||
elif type == 'metainfo':
|
elif type == 'metainfo':
|
||||||
subprocess.run(['appstream-util', 'validate-version', file, version],
|
query = './releases/release[@version="{}"]'.format(version)
|
||||||
check=True)
|
ok = ElementTree(file=file).find(query) is not None
|
||||||
|
print("{}: {}".format(file, "OK" if ok else "FAILED"))
|
||||||
|
if not ok:
|
||||||
|
raise Exception("{} does not contain release {}".format(file, version))
|
||||||
else:
|
else:
|
||||||
raise Exception('Not implemented')
|
raise Exception('Not implemented')
|
||||||
|
|
||||||
|
@ -69,12 +69,10 @@ if not meson.is_subproject()
|
|||||||
gtk_update_icon_cache: true
|
gtk_update_icon_cache: true
|
||||||
)
|
)
|
||||||
|
|
||||||
if appstream_util.found()
|
meson.add_dist_script('build-aux/meson/check-version.py',
|
||||||
meson.add_dist_script('build-aux/meson/check-version.py',
|
meson.project_version(),
|
||||||
meson.project_version(),
|
'--type=metainfo',
|
||||||
'--type=metainfo',
|
'data/metainfo/org.gnome.Extensions.metainfo.xml.in')
|
||||||
'data/metainfo/org.gnome.Extensions.metainfo.xml.in')
|
|
||||||
endif
|
|
||||||
|
|
||||||
summary_dirs = {
|
summary_dirs = {
|
||||||
'prefix': get_option('prefix'),
|
'prefix': get_option('prefix'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user