mirror of
https://github.com/sudoxnym/fdroiddata.git
synced 2026-04-14 19:46:54 +00:00
tools/check-git-repo-availability.py: softwareheritage URL when NoSourceSince
This commit is contained in:
parent
bba2a364dd
commit
15aa39d1a6
1 changed files with 15 additions and 1 deletions
|
|
@ -106,8 +106,22 @@ for f in files:
|
|||
if not f.startswith('metadata/'):
|
||||
continue
|
||||
# this rewriting only works with metadata files, not srclibs
|
||||
|
||||
url = data.get('SourceCode')
|
||||
if url and not url.startswith('https://archive.softwareheritage.org/'):
|
||||
url = url[:-4] if url.endswith('.git') else url
|
||||
r = requests.get(f'https://archive.softwareheritage.org/api/1/origin/{url}/get/')
|
||||
get = r.json()
|
||||
if get.get('url') == url:
|
||||
newurl = f'https://archive.softwareheritage.org/browse/origin/{url}/directory/'
|
||||
else:
|
||||
newurl = url
|
||||
|
||||
with open(f, 'w') as fp:
|
||||
fp.write(re.sub(r'(Repo|RepoType):.*\n{1,2}', r'', raw))
|
||||
processed = re.sub(r'(Repo|RepoType):.*\n{1,2}', r'', raw)
|
||||
processed = re.sub(r'\nSourceCode:.*', f'\nSourceCode: {newurl}', processed)
|
||||
processed = re.sub(r'\n(AutoUpdateMode|UpdateCheckMode):.*', r'\n\1: None', processed)
|
||||
fp.write(processed)
|
||||
builds = data.get('Builds')
|
||||
if builds:
|
||||
versionName = str(builds[-1]['versionName'])
|
||||
|
|
|
|||
Loading…
Reference in a new issue