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:
parent
c0fabfc449
commit
0334ea4218
17
osc/build.py
17
osc/build.py
@ -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']:
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user