Improve sys/check_meson_subproject script
Check that local files for wrap-file and wrap-git are up-to-date with the versions in subproject/package-files
This commit is contained in:
parent
fcd1f9810e
commit
bac12fddc4
1 changed files with 28 additions and 6 deletions
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
import sys
|
||||
import os
|
||||
import filecmp
|
||||
|
||||
subproject = sys.argv[1]
|
||||
meson_root = os.environ['MESON_SOURCE_ROOT']
|
||||
|
|
@ -19,23 +20,44 @@ try:
|
|||
is_wrap_git = False
|
||||
revision = None
|
||||
directory = subproject
|
||||
patch_directory = subproject
|
||||
for l in f:
|
||||
if 'wrap-git' in l:
|
||||
is_wrap_git = True
|
||||
elif 'wrap-file' in l:
|
||||
is_wrap_file = True
|
||||
elif l.startswith('revision'):
|
||||
revision = l.split('=')[1].strip()
|
||||
elif l.startswith('directory'):
|
||||
directory = l.split('=')[1].strip()
|
||||
elif l.startswith('patch_directory'):
|
||||
patch_directory = l.split('=')[1].strip()
|
||||
|
||||
if not is_wrap_git or not revision:
|
||||
if is_wrap_git:
|
||||
if not revision:
|
||||
sys.exit(0)
|
||||
|
||||
subproject_dir = os.path.join(meson_root, 'subprojects', directory)
|
||||
subproject_git_dir = os.path.join(subproject_dir, '.git')
|
||||
if os.path.isdir(subproject_dir) and os.path.isdir(subproject_git_dir):
|
||||
head = open(os.path.join(subproject_git_dir, 'HEAD'), 'r').read().strip()
|
||||
if head != revision:
|
||||
sys.exit(1)
|
||||
|
||||
if not patch_directory:
|
||||
sys.exit(0)
|
||||
|
||||
subproject_dir = os.path.join(meson_root, 'subprojects', directory)
|
||||
subproject_git_dir = os.path.join(subproject_dir, '.git')
|
||||
if os.path.isdir(subproject_dir) and os.path.isdir(subproject_git_dir):
|
||||
head = open(os.path.join(subproject_git_dir, 'HEAD'), 'r').read().strip()
|
||||
if head != revision:
|
||||
sys.exit(1)
|
||||
patch_subproject_dir = os.path.join(meson_root, 'subprojects', 'packagefiles', patch_directory)
|
||||
if os.path.isdir(patch_subproject_dir) and os.path.isdir(subproject_dir):
|
||||
for f in os.listdir(patch_subproject_dir):
|
||||
subproject_f = os.path.join(subproject_dir, f)
|
||||
subproject_p_f = os.path.join(patch_subproject_dir, f)
|
||||
if not os.path.isfile(subproject_f):
|
||||
sys.exit(1)
|
||||
|
||||
if not filecmp.cmp(subproject_p_f, subproject_f):
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
except FileNotFoundError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue