1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-08-24 07:08:53 +02:00

fixes 413 checkout deleted package

* altered command do_checkout
  new option -D | --deleted. Can only be used with PACKAGE and needs
  -o to work

* what happens:
  core function checkout_deleted_package fetches the file list of the deleted
  package and saves it to given destdir. If destdir is not existent it
  creates the destination directory. Otherwise the files will be written
  in the existing directory.
This commit is contained in:
lethliel
2018-07-19 13:34:49 +02:00
parent b730f880cf
commit 0123bb71db
2 changed files with 39 additions and 8 deletions

View File

@@ -7763,4 +7763,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