mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 14:56:14 +01:00
- do_buildinfo: support --prefer-pkgs
This commit is contained in:
parent
14376dd2b6
commit
e2ab1a520e
@ -3628,6 +3628,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
@cmdln.option('-x', '--extra-pkgs', metavar='PAC', action='append',
|
||||||
help='Add this package when computing the buildinfo')
|
help='Add this package when computing the buildinfo')
|
||||||
|
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
|
||||||
|
help='Prefer packages from this directory when installing the build-root')
|
||||||
def do_buildinfo(self, subcmd, opts, *args):
|
def do_buildinfo(self, subcmd, opts, *args):
|
||||||
"""${cmd_name}: Shows the build info
|
"""${cmd_name}: Shows the build info
|
||||||
|
|
||||||
@ -3679,18 +3681,21 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
del args[0]
|
del args[0]
|
||||||
del args[0]
|
del args[0]
|
||||||
|
|
||||||
# were we given a specfile (third argument)?
|
build_descr_data = None
|
||||||
try:
|
if len(args) == 3:
|
||||||
spec = open(args[2]).read()
|
build_descr_data = open(args[2]).read()
|
||||||
except IndexError:
|
if opts.prefer_pkgs and build_descr_data is None:
|
||||||
spec = None
|
raise oscerr.WrongArgs('error: a build description is needed if \'--prefer-pkgs\' is used')
|
||||||
except IOError, e:
|
elif opts.prefer_pkgs:
|
||||||
print >>sys.stderr, e
|
from build import get_prefer_pkgs
|
||||||
return 1
|
print 'Scanning the following dirs for local packages: %s' % ', '.join(opts.prefer_pkgs)
|
||||||
|
prefer_pkgs, cpio = get_prefer_pkgs(opts.prefer_pkgs, arch, os.path.splitext(args[2])[1])
|
||||||
|
cpio.add(os.path.basename(args[2]), build_descr_data)
|
||||||
|
build_descr_data = cpio.get()
|
||||||
|
|
||||||
print ''.join(get_buildinfo(apiurl,
|
print ''.join(get_buildinfo(apiurl,
|
||||||
project, package, repository, arch,
|
project, package, repository, arch,
|
||||||
specfile=spec,
|
specfile=build_descr_data,
|
||||||
addlist=opts.extra_pkgs))
|
addlist=opts.extra_pkgs))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user