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

add and implement ccache option for getbinaries

If this option is used, the api is asked to list ccache archive if
present, osc will then download the archive.
This commit is contained in:
Sumit Jamgade 2020-05-05 09:58:16 +02:00
parent 9aa3777a60
commit 5557a06e5b
2 changed files with 8 additions and 3 deletions

View File

@ -7224,6 +7224,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
help='also fetch source packages')
@cmdln.option('--debug', action="store_true",
help='also fetch debug packages')
@cmdln.option('--ccache', action="store_true",
help='allow fetching ccache archive')
def do_getbinaries(self, subcmd, opts, *args):
"""${cmd_name}: Download binaries to a local directory
@ -7304,7 +7306,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
for arch in arches:
for pac in package:
binaries = get_binarylist(apiurl, project, repository, arch,
package=pac, verbose=True)
package=pac, verbose=True, withccache=opts.ccache)
if not binaries:
print('no binaries found: Either the package %s ' \
'does not exist or no binaries have been built.' % pac, file=sys.stderr)

View File

@ -5654,9 +5654,12 @@ def get_repos_of_project(apiurl, prj):
for node2 in node.findall('arch'):
yield Repo(node.get('name'), node2.text)
def get_binarylist(apiurl, prj, repo, arch, package=None, verbose=False):
def get_binarylist(apiurl, prj, repo, arch, package=None, verbose=False, withccache=False):
what = package or '_repository'
u = makeurl(apiurl, ['build', prj, repo, arch, what])
query = {}
if withccache:
query['withccache'] = 1
u = makeurl(apiurl, ['build', prj, repo, arch, what], query=query)
f = http_GET(u)
tree = ET.parse(f)
if not verbose: