1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-27 18:26:15 +01:00

make getbinaries also work in project dirs

Maked getbinaries also work in project dirs. If osc getbinaries
get called in a checked out package directory, the binaries for
all packages of this project get checked out.
This commit is contained in:
Danny Kukawka 2010-07-01 15:32:21 +02:00
parent cd51a420d7
commit 28441bfaeb

View File

@ -4372,8 +4372,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
others even when they are not "published" yet. others even when they are not "published" yet.
usage: usage:
osc getbinaries REPOSITORY # works in checked out package (check out all archs in subdirs) osc getbinaries REPOSITORY # works in checked out project/package (check out all archs in subdirs)
osc getbinaries REPOSITORY ARCHITECTURE # works in checked out package osc getbinaries REPOSITORY ARCHITECTURE # works in checked out project/package
osc getbinaries PROJECT PACKAGE REPOSITORY ARCHITECTURE osc getbinaries PROJECT PACKAGE REPOSITORY ARCHITECTURE
${cmd_option_list} ${cmd_option_list}
""" """
@ -4381,6 +4381,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = slash_split(args) args = slash_split(args)
apiurl = self.get_api_url() apiurl = self.get_api_url()
package = None
project = None
if len(args) < 1 and is_package_dir('.'): if len(args) < 1 and is_package_dir('.'):
self.print_repos() self.print_repos()
@ -4392,11 +4394,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
repository = args[2] repository = args[2]
architecture = args[3] architecture = args[3]
elif len(args) <= 2: elif len(args) <= 2:
if not is_package_dir(os.getcwd()): if is_package_dir(os.getcwd()):
raise oscerr.WrongArgs('Missing arguments: either specify <project> and ' \
'<package> or move to a package working copy')
project = store_read_project(os.curdir) project = store_read_project(os.curdir)
package = store_read_package(os.curdir) package = store_read_package(os.curdir)
elif is_project_dir(os.getcwd()):
project = store_read_project(os.curdir)
else:
raise oscerr.WrongArgs('Missing arguments: either specify <project> and ' \
'<package> or move to a project or package working copy')
repository = args[0] repository = args[0]
if len(args) == 2: if len(args) == 2:
architecture = args[1] architecture = args[1]
@ -4407,12 +4412,19 @@ Please submit there instead, or use --nodevelproject to force direct submission.
arches = [architecture] arches = [architecture]
if architecture is None: if architecture is None:
arches = [i.arch for i in get_repos_of_project(apiurl, project) if repository == i.name] arches = [i.arch for i in get_repos_of_project(apiurl, project) if repository == i.name]
if package is None:
package = meta_get_packagelist(apiurl, project)
else:
package = [package]
for arch in arches: for arch in arches:
for pac in package:
binaries = get_binarylist(apiurl, project, repository, arch, binaries = get_binarylist(apiurl, project, repository, arch,
package=package, verbose=True) package=pac, verbose=True)
if not binaries: if not binaries:
print >>sys.stderr, 'no binaries found: Either the package ' \ print >>sys.stderr, 'no binaries found: Either the package %s ' \
'does not exist or no binaries have been built.' 'does not exist or no binaries have been built.' % pac
continue continue
target_dir = opts.destdir target_dir = opts.destdir
if architecture is None: if architecture is None:
@ -4436,7 +4448,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
project, project,
repository, arch, repository, arch,
i.name, i.name,
package = package, package = pac,
target_filename = fname, target_filename = fname,
target_mtime = i.mtime, target_mtime = i.mtime,
progress_meter = not opts.quiet) progress_meter = not opts.quiet)