1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-28 00:58:52 +02:00

Merge branch 'fix_413_get_deleted_sources' of https://github.com/lethliel/osc

Introduce --deleted option to "osc co" for checking out the files of
a deleted package (no package wc is established).
This commit is contained in:
Marcus Huewe
2018-10-18 12:59:55 +02:00
2 changed files with 39 additions and 8 deletions

View File

@@ -7757,4 +7757,24 @@ def get_rpmlint_log(apiurl, proj, pkg, repo, arch):
f = http_GET(u)
return f.read()
def checkout_deleted_package(apiurl, proj, pkg, dst):
pl = meta_get_filelist(apiurl, proj, pkg, deleted=True)
query = {}
query['deleted'] = 1
if os.path.isdir(dst):
print('Restoring in existing directory %s' % dst)
else:
print('Creating %s' % dst)
os.makedirs(dst)
for filename in pl:
print('Restoring %s to %s' % (filename, dst))
full_file_path = os.path.join(dst, filename)
u = makeurl(apiurl, ['source', proj, pkg, filename], query=query)
with open(full_file_path, 'wb') as f:
for data in streamfile(u):
f.write(data)
print('done.')
# vim: sw=4 et