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:

committed by
Marge Bot

parent
fd8d923a34
commit
7405f7c360
@ -2,7 +2,8 @@
|
||||
|
||||
import os, sys
|
||||
from pathlib import Path
|
||||
import argparse, subprocess
|
||||
from xml.etree.ElementTree import ElementTree
|
||||
import argparse
|
||||
|
||||
def check_version(version, file, type='news'):
|
||||
if type == 'news':
|
||||
@ -12,8 +13,11 @@ def check_version(version, file, type='news'):
|
||||
if not ok:
|
||||
raise Exception("{} does not start with {}".format(file, version))
|
||||
elif type == 'metainfo':
|
||||
subprocess.run(['appstream-util', 'validate-version', file, version],
|
||||
check=True)
|
||||
query = './releases/release[@version="{}"]'.format(version)
|
||||
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:
|
||||
raise Exception('Not implemented')
|
||||
|
||||
|
Reference in New Issue
Block a user