1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-26 09:56:13 +01:00

add --debuginfo switch to osc build

This commit is contained in:
Jürgen Weigert 2008-03-11 15:18:02 +00:00
parent c0fabfc449
commit 0334ea4218
3 changed files with 22 additions and 0 deletions

3
NEWS
View File

@ -1,3 +1,6 @@
jw:
- add --debuginfo to osc build.
since 0.99:
- build:

View File

@ -8,6 +8,7 @@
import os
import re
import sys
from tempfile import NamedTemporaryFile
from osc.fetch import *
@ -243,6 +244,22 @@ def main(opts, argv):
print >>sys.stderr, 'Error: specfile \'%s\' does not exist.' % spec
return 1
if opts.debuginfo:
# make sure %debug_package is in the spec-file.
spec_text = open(spec).read()
if not re.search(r'(?m)^%debug_package', spec_text):
spec_text = re.sub(r'(?m)^(%prep)',
r'# added by osc build -d\n%debug_package\n\n\1',
spec_text, 1)
tmp_spec = NamedTemporaryFile(prefix = spec + '_', dir = '.', suffix = '.spec')
tmp_spec.write(spec_text)
tmp_spec.flush()
spec = tmp_spec.name
os.chmod(spec, 0644)
# make it possible to override configuration of the rc file
for var in ['OSC_PACKAGECACHEDIR', 'OSC_SU_WRAPPER', 'BUILD_ROOT', 'OSC_BUILD_ROOT']:
# make it possible to override configuration of the rc file
for var in ['OSC_PACKAGECACHEDIR', 'OSC_SU_WRAPPER', 'BUILD_ROOT', 'OSC_BUILD_ROOT']:

View File

@ -1482,6 +1482,8 @@ class Osc(cmdln.Cmdln):
help='build a package which does not exist on the server')
@cmdln.option('', '--alternative-project', metavar='PROJECT',
help='specify the build target project')
@cmdln.option('-d', '--debuginfo', action='store_true',
help='also build debuginfo sub-packages')
def do_build(self, subcmd, opts, *args):
"""${cmd_name}: Build a package on your local machine