1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-03-03 06:32:12 +01:00
- rename --prefer-pacs option to --prefer-pkgs
  - implement --keep-pkgs option
This commit is contained in:
Dr. Peter Poeml 2007-05-03 15:54:40 +00:00
parent 22b72ac695
commit 4a2c675e6e
5 changed files with 39 additions and 11 deletions

View File

@ -3,3 +3,5 @@ There is a number of people who have helped:
Marcus Rueckert - help and countless suggestions
Christoph Thiel - patch enabling build log following.
Adrian Schroeter - one-liner showing how to handle an error ;-)
Michael Marek
Michael Wolf

2
NEWS
View File

@ -1,5 +1,5 @@
since 0.95:
- build: implement --prefer-pacs option
- build: implement --prefer-pkgs and --keep-pkgs option
- applied patch from Michael Marek, fixing all places where error
messages were printed to stdout instead of stderr. [#239404]
- osc is now easier to work with when using alternative API servers. The

14
TODO
View File

@ -19,6 +19,7 @@
Message-ID: <20070214120205.GA9629@suse.de>
- implement wipe command
- implement editing of project configuration (alrady works in api & backend)
- build: --extra-pkgs ... buildinfo -> &add=...&add=...
checkin:
@ -270,3 +271,16 @@ AttributeError: 'NoneType' object has no attribute 'md5'
18:48 <darix> rmap['status'] += ': ' + statusnode.find('details').text
18:48 <darix> AttributeError: 'NoneType' object has no attribute 'text'
21:49 < darix> DuDE: osc editmeta
21:49 < darix> the template is stupid
21:49 < darix> it now has "your_name" as project maintainer
21:50 < darix> that requires you to edit the line everytime when creating a new package
21:50 < DuDE> hm, can't find that
21:50 < DuDE> is that the exact string?
21:52 < DuDE> ah, I find your_username
21:52 < darix> DuDE: http://rafb.net/p/TgxmfB83.txt
21:54 < DuDE> I think that was filled in the past
21:54 < DuDE> since the user account data is now stored in the config per api server, the (in the config) global user/passwd is no longer used otherwise, so it shows the default
-> hits also in edit_user()

View File

@ -180,13 +180,13 @@ def get_built_files(pacdir, pactype):
return s_built, b_built
def get_prefer_pacs(dirs, wanted_arch):
def get_prefer_pkgs(dirs, wanted_arch):
# XXX learn how to do the same for Debian packages
import glob
paths = []
for dir in dirs:
paths += glob.glob(os.path.join(dir, '*.rpm'))
prefer_pacs = []
prefer_pkgs = []
for path in paths:
if path.endswith('src.rpm'):
@ -199,9 +199,9 @@ def get_prefer_pacs(dirs, wanted_arch):
# requested arch for this package from buildinfo
# also, it will ignore i686 packages, how to handle those?
if arch == wanted_arch or arch == 'noarch':
prefer_pacs.append((name, path))
prefer_pkgs.append((name, path))
return dict(prefer_pacs)
return dict(prefer_pkgs)
def main(opts, argv):
@ -245,13 +245,13 @@ def main(opts, argv):
bi = Buildinfo(bi_file.name)
rpmlist_prefers = []
if opts.prefer_pacs:
if opts.prefer_pkgs:
print 'Evaluating preferred packages'
# the resulting dict will also contain packages which are not on the install list
# but they won't be installed
prefer_pacs = get_prefer_pacs(opts.prefer_pacs, bi.buildarch)
prefer_pkgs = get_prefer_pkgs(opts.prefer_pkgs, bi.buildarch)
for name, path in prefer_pacs.iteritems():
for name, path in prefer_pkgs.iteritems():
if bi.has_dep(name):
# We remove a preferred package from the buildinfo, so that the
# fetcher doesn't take care about them.
@ -343,4 +343,9 @@ def main(opts, argv):
print
print b_built
if opts.keep_pkgs:
for i in b_built.splitlines():
import shutil
shutil.copy2(i, os.path.join(opts.keep_pkgs, os.path.basename(i)))

View File

@ -1034,8 +1034,10 @@ class Osc(cmdln.Cmdln):
help='Delete old build root before initializing it')
@cmdln.option('--noinit', '--no-init', action='store_true',
help='Skip initialization of build root and start with build immediately.')
@cmdln.option('-p', '--prefer-pacs', metavar='DIR', action='append',
@cmdln.option('-p', '--prefer-pkgs', metavar='DIR', action='append',
help='Prefer packages from this directory when installing the build-root')
@cmdln.option('-k', '--keep-pkgs', metavar='DIR',
help='Save built packages into this directory')
def do_build(self, subcmd, opts, *args):
"""${cmd_name}: Build a package on your local machine
@ -1106,12 +1108,17 @@ class Osc(cmdln.Cmdln):
print line.strip()
return 1
if opts.prefer_pacs:
for d in opts.prefer_pacs:
if opts.prefer_pkgs:
for d in opts.prefer_pkgs:
if not os.path.isdir(d):
print >> sys.stderr, 'Preferred package location \'%s\' is not a directory' % d
return 1
if opts.keep_pkgs:
if not os.path.isdir(opts.keep_pkgs):
print >> sys.stderr, 'Preferred save location \'%s\' is not a directory' % opts.keep_pkgs
return 1
return osc.build.main(opts, args)