Browse Source

rename amprolla-init to amprolla_init.py and make it a valid module

keep-around/e977c9e07f177e8bc2b51265de1bc93475397f61
parazyd 6 years ago
parent
commit
dcaa731f87
Signed by untrusted user: parazyd GPG Key ID: F0CB28FCF78637DE
  1. 37
      amprolla_init.py

37
amprolla-init → amprolla_init.py

@ -35,29 +35,40 @@ def pop_dirs(repo):
suite = config.aliases[repodata['name']][j]
elif repodata['skipmissing'] is True:
continue
skips = ['jessie-security', 'ascii-security'] # XXX: hack
skips = ['jessie-security', 'ascii-security'] # hack
if repo == 'debian' and j in skips:
continue
pair = (join(baseurl, suite),
join(baseurl.replace(repodata['host'],
config.spooldir), suite))
config.spooldir), suite))
urls.append(pair)
return urls
for dist in config.repos:
dlurls = pop_dirs(dist)
for url in dlurls:
for file in config.mainrepofiles:
remote = join(url[0], file)
local = join(url[1], file)
download(remote, local)
def main():
"""
Loops through all repositories, and downloads their *Release* files, along
with all the files listed within those Release files.
"""
for dist in config.repos:
dlurls = pop_dirs(dist)
for url in dlurls:
for file in config.mainrepofiles:
remote = join(url[0], file)
local = join(url[1], file)
download(remote, local)
release_contents = open(join(url[1], 'Release')).read()
release_contents = parse_release(release_contents)
for k in release_contents.keys():
if k.endswith('/binary-armhf/Packages.gz'):
release_contents = open(join(url[1], 'Release')).read()
release_contents = parse_release(release_contents)
# for k in release_contents.keys():
for k in release_contents:
# if k.endswith('/binary-armhf/Packages.gz'):
# if k.endswith('Packages.gz'):
remote = join(url[0], k)
local = join(url[1], k)
download(remote, local)
if __name__ == '__main__':
main()
Loading…
Cancel
Save