Merge "Add local directory or file for source build"

This commit is contained in:
Jenkins 2016-03-10 02:20:24 +00:00 committed by Gerrit Code Review
commit 5d8851c7c4
2 changed files with 11 additions and 1 deletions

View File

@ -208,6 +208,16 @@ class WorkerThread(threading.Thread):
with tarfile.open(dest_archive, 'w') as tar: with tarfile.open(dest_archive, 'w') as tar:
tar.add(clone_dir, arcname=os.path.basename(clone_dir)) tar.add(clone_dir, arcname=os.path.basename(clone_dir))
elif source.get('type') == 'local':
LOG.debug("%s:Getting local archive from %s", image['name'],
source['source'])
if os.path.isdir(source['source']):
with tarfile.open(dest_archive, 'w') as tar:
tar.add(source['source'],
arcname=os.path.basename(source['source']))
else:
shutil.copyfile(source['source'], dest_archive)
else: else:
LOG.error("%s:Wrong source type '%s'", image['name'], LOG.error("%s:Wrong source type '%s'", image['name'],
source.get('type')) source.get('type'))

View File

@ -241,7 +241,7 @@ SOURCES = {
def get_source_opts(type_=None, location=None, reference=None): def get_source_opts(type_=None, location=None, reference=None):
return [cfg.StrOpt('type', choices=['git', 'url'], return [cfg.StrOpt('type', choices=['local', 'git', 'url'],
default=type_, default=type_,
help='Source location type'), help='Source location type'),
cfg.StrOpt('location', default=location, cfg.StrOpt('location', default=location,