amprolla is an apt repository merger originally intended for use with the Devuan infrastructure. This version is the third iteration of the software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
2.6 KiB

#!/usr/bin/env python3
# see LICENSE file for copyright and license details
This module will download the initial Release files used to populate
the spooldir, along with all the files hashed inside the Release files
from os.path import join
from multiprocessing import Pool
from time import time
from lib.config import aliases, cpunm, mainrepofiles, repos, spooldir, suites
from import download
from lib.parse import parse_release
def pop_dirs(repo):
Crawls through the directories to come up with complete needed
directory structure.
Returns a list of tuples holding the remote and local locations
of the files
repodata = repos[repo]
urls = []
for i in suites:
for j in suites[i]:
baseurl = join(repodata['host'], repodata['dists'])
suite = j
if repodata['aliases'] is True:
if j in aliases[repodata['name']]:
suite = aliases[repodata['name']][j]
elif repodata['skipmissing'] is True:
skips = ['jessie-security', 'ascii-security'] # hack
if repo == 'debian' and j in skips:
pair = (join(baseurl, suite),
spooldir), suite))
return urls
def main():
Loops through all repositories, and downloads their Release files, along
with all the files listed within those Release files.
for dist in repos:
print('Downloading %s directory structure' % dist)
dlurls = pop_dirs(dist)
for url in dlurls:
tpl = []
for file in mainrepofiles:
urls = (join(url[0], file), join(url[1], file))
dlpool = Pool(cpunm), tpl)
release_contents = open(join(url[1], 'Release')).read()
release_contents = parse_release(release_contents)
tpl = []
for k in release_contents:
# if k.endswith('/binary-armhf/Packages.gz'):
urls = (join(url[0], k), join(url[1], k))
dlpool = Pool(cpunm), tpl)
if __name__ == '__main__':
t1 = time()
t2 = time()
print('total time: %s' % (t2 - t1))