1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 09:16:16 +02:00

Merge pull request #1006 from dmach/getbinaries-multibuild

Fix getbinaries command to fetch also multibuild packages
This commit is contained in:
Daniel Mach 2022-02-28 16:35:26 +01:00 committed by GitHub
commit ced706080b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View File

@ -7437,8 +7437,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='do not show downloading progress')
@cmdln.option('-d', '--destdir', default='./binaries', metavar='DIR',
help='destination directory')
@cmdln.option('-M', '--multibuild-package', action='append',
help='get binaries from specified multibuild package')
@cmdln.option('-M', '--multibuild-package', metavar="FLAVOR", action='append',
help='Get binaries from the specified flavor of a multibuild package.'
' It is meant for use from a package checkout when it is not possible to specify package:flavor.')
@cmdln.option('--sources', action="store_true",
help='also fetch source packages')
@cmdln.option('--debug', action="store_true",
@ -7468,6 +7469,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
package = None
binary = None
if opts.multibuild_package and ((len(args) > 2) or (len(args) <= 2 and is_project_dir(os.getcwd()))):
self.optparser.error("The -M/--multibuild-package option can be only used from a package checkout.")
if len(args) < 1 and is_package_dir('.'):
self.print_repos()
@ -7506,7 +7510,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if package is None:
package = meta_get_packagelist(apiurl, project)
package = meta_get_packagelist(apiurl, project, deleted=0)
else:
if opts.multibuild_package:
packages = []
@ -7534,6 +7538,12 @@ 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

View File

@ -3449,6 +3449,11 @@ def meta_get_packagelist(apiurl, prj, deleted=None, expand=False):
query = {}
if deleted:
query['deleted'] = 1
elif deleted in (False, 0):
# HACK: Omitted 'deleted' and 'deleted=0' produce different results.
# By explicit 'deleted=0', we also get multibuild packages listed.
# See: https://github.com/openSUSE/open-build-service/issues/9715
query['deleted'] = 0
if expand:
query['expand'] = 1