|
|
@ -98,24 +98,24 @@ def install(options: 'argparse.Namespace') -> None: |
|
|
|
f.write(url.read()) |
|
|
|
f.write(url.read()) |
|
|
|
print(f'Installed {name} version {version} revision {revision}') |
|
|
|
print(f'Installed {name} version {version} revision {revision}') |
|
|
|
|
|
|
|
|
|
|
|
def parse_patch_url(patch_url: str) -> T.Tuple[str, int]: |
|
|
|
def parse_patch_url(patch_url: str) -> T.Tuple[str, str]: |
|
|
|
u = urlparse(patch_url) |
|
|
|
u = urlparse(patch_url) |
|
|
|
if u.netloc != 'wrapdb.mesonbuild.com': |
|
|
|
if u.netloc != 'wrapdb.mesonbuild.com': |
|
|
|
raise WrapException(f'URL {patch_url} does not seems to be a wrapdb patch') |
|
|
|
raise WrapException(f'URL {patch_url} does not seems to be a wrapdb patch') |
|
|
|
arr = u.path.strip('/').split('/') |
|
|
|
arr = u.path.strip('/').split('/') |
|
|
|
if arr[0] == 'v1': |
|
|
|
if arr[0] == 'v1': |
|
|
|
# e.g. https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/5/get_zip |
|
|
|
# e.g. https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/5/get_zip |
|
|
|
return arr[-3], int(arr[-2]) |
|
|
|
return arr[-3], arr[-2] |
|
|
|
elif arr[0] == 'v2': |
|
|
|
elif arr[0] == 'v2': |
|
|
|
# e.g. https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch |
|
|
|
# e.g. https://wrapdb.mesonbuild.com/v2/zlib_1.2.11-5/get_patch |
|
|
|
tag = arr[-2] |
|
|
|
tag = arr[-2] |
|
|
|
name, version = tag.rsplit('_', 1) |
|
|
|
name, version = tag.rsplit('_', 1) |
|
|
|
version, revision = version.rsplit('-', 1) |
|
|
|
version, revision = version.rsplit('-', 1) |
|
|
|
return version, int(revision) |
|
|
|
return version, revision |
|
|
|
else: |
|
|
|
else: |
|
|
|
raise WrapException(f'Invalid wrapdb URL {patch_url}') |
|
|
|
raise WrapException(f'Invalid wrapdb URL {patch_url}') |
|
|
|
|
|
|
|
|
|
|
|
def get_current_version(wrapfile: str) -> T.Tuple[str, int, str, str, str]: |
|
|
|
def get_current_version(wrapfile: str) -> T.Tuple[str, str, str, str, str]: |
|
|
|
cp = configparser.ConfigParser(interpolation=None) |
|
|
|
cp = configparser.ConfigParser(interpolation=None) |
|
|
|
cp.read(wrapfile) |
|
|
|
cp.read(wrapfile) |
|
|
|
wrap_data = cp['wrap-file'] |
|
|
|
wrap_data = cp['wrap-file'] |
|
|
|