pkglistgen: use new cache format of repo_checker

This commit is contained in:
Ludwig Nussel 2017-11-13 17:39:52 +01:00
parent 1ea00d8d8f
commit 384746715d

View File

@ -647,29 +647,29 @@ class CommandLineInterface(ToolBase.CommandLineInterface):
for prp in self.tool.repos: for prp in self.tool.repos:
project, repo = prp.split('/') project, repo = prp.split('/')
for arch in self.tool.architectures: for arch in self.tool.architectures:
d = os.path.join( # TODO: refactor to common function with repo_checker.py
CACHEDIR, 'repo-{}-{}-{}'.format(project, repo, arch)) d = os.path.join(CACHEDIR, project, repo, arch)
if not os.path.exists(d):
os.makedirs(d)
logger.debug('updating %s', d) logger.debug('updating %s', d)
# XXX
if 'opensuse' in self.tool.apiurl:
apiurl = 'https://api.opensuse.org/public'
else:
apiurl = 'https://api.suse.de/public'
args = [bs_mirrorfull] args = [bs_mirrorfull]
args.append('--nodebug') args.append('--nodebug')
args.append('{}/build/{}/{}/{}'.format(apiurl, project, repo, arch)) args.append('{}/public/build/{}/{}/{}'.format(self.tool.apiurl, project, repo, arch))
args.append(d) args.append(d)
p = subprocess.Popen(args, stdout=subprocess.PIPE) p = subprocess.Popen(args, stdout=subprocess.PIPE)
repo_update = False repo_update = False
for line in p.stdout: for line in p.stdout:
print(line.rstrip()) logger.info(line.rstrip())
global_update = True global_update = True
repo_update = True repo_update = True
if not repo_update:
solv_file = os.path.join(CACHEDIR, 'repo-{}-{}-{}.solv'.format(project, repo, arch))
if os.path.exists(solv_file) and not repo_update:
continue continue
files = [os.path.join(d, f) files = [os.path.join(d, f)
for f in os.listdir(d) if f.endswith('.rpm')] for f in os.listdir(d) if f.endswith('.rpm')]
fh = open(d + '.solv', 'w') fh = open(solv_file, 'w')
p = subprocess.Popen( p = subprocess.Popen(
['rpms2solv', '-m', '-', '-0'], stdin=subprocess.PIPE, stdout=fh) ['rpms2solv', '-m', '-', '-0'], stdin=subprocess.PIPE, stdout=fh)
p.communicate('\0'.join(files)) p.communicate('\0'.join(files))