mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 09:56:13 +01:00
- support 100% offline build when using "osc build --noinit ..."
-> buildinfo gets stored in local directory as .buildinfo.xml
This commit is contained in:
parent
b8a915b8a2
commit
9266647b0c
2
NEWS
2
NEWS
@ -14,6 +14,8 @@
|
|||||||
* shows public part of project key
|
* shows public part of project key
|
||||||
* allows (re)creation of a project key
|
* allows (re)creation of a project key
|
||||||
* allows deletion of a project key
|
* allows deletion of a project key
|
||||||
|
- support 100% offline build when using "osc build --noinit ..."
|
||||||
|
-> buildinfo gets stored in local directory as .buildinfo.xml
|
||||||
|
|
||||||
0.122
|
0.122
|
||||||
- added missing code for 'osc sr -l [ID]'
|
- added missing code for 'osc sr -l [ID]'
|
||||||
|
34
osc/build.py
34
osc/build.py
@ -369,19 +369,27 @@ def main(opts, argv):
|
|||||||
cpio.add(os.path.basename(build_descr), build_descr_data)
|
cpio.add(os.path.basename(build_descr), build_descr_data)
|
||||||
build_descr_data = cpio.get()
|
build_descr_data = cpio.get()
|
||||||
|
|
||||||
print 'Getting buildinfo from server'
|
bi_file_name = '.buildinfo.xml'
|
||||||
tempdir = '/tmp'
|
bi_file = None
|
||||||
if sys.platform[:3] == 'win':
|
|
||||||
tempdir = os.getenv('TEMP')
|
|
||||||
bi_file = NamedTemporaryFile(suffix='.xml', prefix='buildinfo.', dir = tempdir)
|
|
||||||
try:
|
try:
|
||||||
bi_text = ''.join(get_buildinfo(apiurl,
|
if opts.noinit:
|
||||||
prj,
|
if not os.path.isfile(bi_file_name):
|
||||||
pac,
|
print >>sys.stderr, '--noinit is not possible, no local build info file'
|
||||||
repo,
|
sys.exit(1)
|
||||||
arch,
|
print 'Use local .buildinfo.xml file as build description'
|
||||||
specfile=build_descr_data,
|
bi_file = open(bi_file_name, 'r')
|
||||||
addlist=extra_pkgs))
|
else:
|
||||||
|
print 'Getting buildinfo from server and store to local directory as .buildinfo.xml'
|
||||||
|
bi_file = open(bi_file_name, 'w+')
|
||||||
|
bi_text = ''.join(get_buildinfo(apiurl,
|
||||||
|
prj,
|
||||||
|
pac,
|
||||||
|
repo,
|
||||||
|
arch,
|
||||||
|
specfile=build_descr_data,
|
||||||
|
addlist=extra_pkgs))
|
||||||
|
bi_file.write(bi_text)
|
||||||
|
bi_file.flush()
|
||||||
except urllib2.HTTPError, e:
|
except urllib2.HTTPError, e:
|
||||||
if e.code == 404:
|
if e.code == 404:
|
||||||
# check what caused the 404
|
# check what caused the 404
|
||||||
@ -401,8 +409,6 @@ def main(opts, argv):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
bi_file.write(bi_text)
|
|
||||||
bi_file.flush()
|
|
||||||
|
|
||||||
bi = Buildinfo(bi_file.name, apiurl, build_type, prefer_pkgs.keys())
|
bi = Buildinfo(bi_file.name, apiurl, build_type, prefer_pkgs.keys())
|
||||||
if bi.debuginfo and not opts.disable_debuginfo:
|
if bi.debuginfo and not opts.disable_debuginfo:
|
||||||
|
@ -2601,27 +2601,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
arg_arch = arg_arch or osc.build.hostarch
|
arg_arch = arg_arch or osc.build.hostarch
|
||||||
|
|
||||||
repositories = get_repositories_of_project( \
|
if not opts.noinit:
|
||||||
store_read_apiurl('.'), \
|
repositories = get_repositories_of_project( \
|
||||||
opts.alternative_project or store_read_project('.'))
|
store_read_apiurl('.'), \
|
||||||
if not arg_repository:
|
opts.alternative_project or store_read_project('.'))
|
||||||
|
if not arg_repository:
|
||||||
|
|
||||||
if len(repositories) == 0:
|
if len(repositories) == 0:
|
||||||
arg_repository = conf.config['build_repository']
|
arg_repository = conf.config['build_repository']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# Use a default value from config, but just even if it's available
|
# Use a default value from config, but just even if it's available
|
||||||
# unless try standard, or openSUSE_Factory
|
# unless try standard, or openSUSE_Factory
|
||||||
for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'):
|
for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'):
|
||||||
if repository in repositories:
|
if repository in repositories:
|
||||||
arg_repository = repository
|
arg_repository = repository
|
||||||
break
|
break
|
||||||
|
|
||||||
arg_repository = arg_repository or repositories[len(repositories)-1]
|
arg_repository = arg_repository or repositories[len(repositories)-1]
|
||||||
|
|
||||||
if not arg_repository in repositories:
|
if not arg_repository in repositories:
|
||||||
raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ", ".join(repositories)))
|
raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ", ".join(repositories)))
|
||||||
|
|
||||||
# check for source services
|
# check for source services
|
||||||
if os.listdir('.').count("_service"):
|
if os.listdir('.').count("_service"):
|
||||||
|
Loading…
Reference in New Issue
Block a user