1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-09 22:36:14 +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:
Adrian Schröter 2009-10-20 08:43:52 +00:00
parent b8a915b8a2
commit 9266647b0c
3 changed files with 39 additions and 30 deletions

2
NEWS
View File

@ -14,6 +14,8 @@
* shows public part of project key
* allows (re)creation 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
- added missing code for 'osc sr -l [ID]'

View File

@ -369,19 +369,27 @@ def main(opts, argv):
cpio.add(os.path.basename(build_descr), build_descr_data)
build_descr_data = cpio.get()
print 'Getting buildinfo from server'
tempdir = '/tmp'
if sys.platform[:3] == 'win':
tempdir = os.getenv('TEMP')
bi_file = NamedTemporaryFile(suffix='.xml', prefix='buildinfo.', dir = tempdir)
bi_file_name = '.buildinfo.xml'
bi_file = None
try:
bi_text = ''.join(get_buildinfo(apiurl,
prj,
pac,
repo,
arch,
specfile=build_descr_data,
addlist=extra_pkgs))
if opts.noinit:
if not os.path.isfile(bi_file_name):
print >>sys.stderr, '--noinit is not possible, no local build info file'
sys.exit(1)
print 'Use local .buildinfo.xml file as build description'
bi_file = open(bi_file_name, 'r')
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:
if e.code == 404:
# check what caused the 404
@ -401,8 +409,6 @@ def main(opts, argv):
sys.exit(1)
else:
raise
bi_file.write(bi_text)
bi_file.flush()
bi = Buildinfo(bi_file.name, apiurl, build_type, prefer_pkgs.keys())
if bi.debuginfo and not opts.disable_debuginfo:

View File

@ -2601,27 +2601,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
arg_arch = arg_arch or osc.build.hostarch
repositories = get_repositories_of_project( \
store_read_apiurl('.'), \
opts.alternative_project or store_read_project('.'))
if not arg_repository:
if not opts.noinit:
repositories = get_repositories_of_project( \
store_read_apiurl('.'), \
opts.alternative_project or store_read_project('.'))
if not arg_repository:
if len(repositories) == 0:
arg_repository = conf.config['build_repository']
if len(repositories) == 0:
arg_repository = conf.config['build_repository']
else:
else:
# Use a default value from config, but just even if it's available
# unless try standard, or openSUSE_Factory
for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'):
if repository in repositories:
arg_repository = repository
break
# Use a default value from config, but just even if it's available
# unless try standard, or openSUSE_Factory
for repository in (conf.config['build_repository'], 'standard', 'openSUSE_Factory'):
if repository in repositories:
arg_repository = repository
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:
raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ", ".join(repositories)))
if not arg_repository in repositories:
raise oscerr.WrongArgs('%s is not a valid repository, use one of: %s' % (arg_repository, ", ".join(repositories)))
# check for source services
if os.listdir('.').count("_service"):