mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-27 23:16:14 +01:00
Merge pull request #1015 from dmach/fix/1014-getbinaries-download-into-subdirs
Fix getbinaries command by downloading files in subdirs named by the packages
This commit is contained in:
commit
d5e04f806f
@ -7518,8 +7518,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
|
||||
if package is None:
|
||||
package_specified = False
|
||||
package = meta_get_packagelist(apiurl, project, deleted=0)
|
||||
else:
|
||||
package_specified = True
|
||||
if opts.multibuild_package:
|
||||
packages = []
|
||||
for subpackage in opts.multibuild_package:
|
||||
@ -7546,12 +7548,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
for i in binaries:
|
||||
if binary != None and binary != i.name:
|
||||
continue
|
||||
# skip metadata (unless explicitly specified as the `FILE` (== `binary`) argument)
|
||||
if not binary and i.name.startswith("_"):
|
||||
continue
|
||||
# skip logs (unless explicitly specified as the `FILE` (== `binary`) argument)
|
||||
if not binary and i.name.endswith(".log"):
|
||||
continue
|
||||
# skip source rpms
|
||||
if not opts.sources and (i.name.endswith('src.rpm') or i.name.endswith('sdeb')):
|
||||
continue
|
||||
@ -7560,7 +7556,18 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
continue
|
||||
if i.name.find('-debugsource-') >= 0:
|
||||
continue
|
||||
|
||||
if package_specified:
|
||||
# if package is specified, download everything into the target dir
|
||||
fname = '%s/%s' % (target_dir, i.name)
|
||||
elif i.name.startswith("_") or i.name.endswith(".log"):
|
||||
# download logs and metadata into subdirs
|
||||
# to avoid overwriting them with files with indentical names
|
||||
fname = '%s/%s/%s' % (target_dir, pac, i.name)
|
||||
else:
|
||||
# always download packages into the target dir
|
||||
fname = '%s/%s' % (target_dir, i.name)
|
||||
|
||||
if os.path.exists(fname):
|
||||
st = os.stat(fname)
|
||||
if st.st_mtime == i.mtime and st.st_size == i.size:
|
||||
|
@ -4747,6 +4747,15 @@ def get_binary_file(apiurl, prj, repo, arch,
|
||||
|
||||
target_filename = target_filename or filename
|
||||
|
||||
# create target directory if it doesn't exist
|
||||
target_dir = os.path.dirname(target_filename)
|
||||
if target_dir:
|
||||
try:
|
||||
os.makedirs(target_dir, 0o755)
|
||||
except OSError as e:
|
||||
if e.errno != errno.EEXIST:
|
||||
raise
|
||||
|
||||
where = package or '_repository'
|
||||
u = makeurl(apiurl, ['build', prj, repo, arch, where, filename])
|
||||
download(u, target_filename, progress_obj, target_mtime)
|
||||
|
Loading…
Reference in New Issue
Block a user