Skip to content

Commit

Permalink
Add support for livebuild buildtype
Browse files Browse the repository at this point in the history
This commit allows for 'osc build' to do local builds of type livebuild.
Debian livebuild is the native Debian live image building system.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
  • Loading branch information
jblunck committed Jul 8, 2014
1 parent b2ad3eb commit 475d2a2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
11 changes: 9 additions & 2 deletions osc/build.py
Expand Up @@ -116,6 +116,8 @@ def __init__(self, filename, apiurl, buildtype = 'spec', localpkgs = []):
self.pacsuffix = 'deb'
if self.buildtype == 'arch':
self.pacsuffix = 'arch'
if self.buildtype == 'livebuild':
self.pacsuffix = 'deb'

self.buildarch = root.find('arch').text
if root.find('hostarch') != None:
Expand Down Expand Up @@ -278,6 +280,11 @@ def get_built_files(pacdir, buildtype):
'-name', '*.pkg.tar*'],
stdout=subprocess.PIPE).stdout.read().strip()
s_built = ''
elif buildtype == 'livebuild':
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'OTHER'),
'-name', '*.iso*'],
stdout=subprocess.PIPE).stdout.read().strip()
s_built = ''
else:
print('WARNING: Unknown package type \'%s\'.' % buildtype, file=sys.stderr)
b_built = ''
Expand Down Expand Up @@ -406,9 +413,9 @@ def main(apiurl, opts, argv):
build_type = os.path.splitext(build_descr)[1][1:]
if os.path.basename(build_descr) == 'PKGBUILD':
build_type = 'arch'
if build_type not in ['spec', 'dsc', 'kiwi', 'arch']:
if build_type not in ['spec', 'dsc', 'kiwi', 'arch', 'livebuild']:
raise oscerr.WrongArgs(
'Unknown build type: \'%s\'. Build description should end in .spec, .dsc or .kiwi.' \
'Unknown build type: \'%s\'. Build description should end in .spec, .dsc, .kiwi or .livebuild.' \
% build_type)
if not os.path.isfile(build_descr):
raise oscerr.WrongArgs('Error: build description file named \'%s\' does not exist.' % build_descr)
Expand Down
8 changes: 4 additions & 4 deletions osc/commandline.py
Expand Up @@ -5377,7 +5377,7 @@ def parse_repoarchdescr(self, args, noinit = False, alternative_project = None,
for subarch in osc.build.can_also_build.get(mainarch):
all_archs.append(subarch)
for arg in args:
if arg.endswith('.spec') or arg.endswith('.dsc') or arg.endswith('.kiwi') or arg == 'PKGBUILD':
if arg.endswith('.spec') or arg.endswith('.dsc') or arg.endswith('.kiwi') or arg.endswith('.livebuild') or arg == 'PKGBUILD':
arg_descr = arg
else:
if (arg == osc.build.hostarch or arg in all_archs) and arg_arch is None:
Expand Down Expand Up @@ -5434,7 +5434,7 @@ def parse_repoarchdescr(self, args, noinit = False, alternative_project = None,
# can be implemented using
# reduce(lambda x, y: x + y, (glob.glob(x) for x in ('*.spec', '*.dsc', '*.kiwi')))
# but be a bit more readable :)
descr = glob.glob('*.spec') + glob.glob('*.dsc') + glob.glob('*.kiwi') + glob.glob('PKGBUILD')
descr = glob.glob('*.spec') + glob.glob('*.dsc') + glob.glob('*.kiwi') + glob.glob('*.livebuild') + glob.glob('PKGBUILD')

# FIXME:
# * request repos from server and select by build type.
Expand All @@ -5449,7 +5449,7 @@ def parse_repoarchdescr(self, args, noinit = False, alternative_project = None,
pac = os.path.basename(os.getcwd())
if is_package_dir(os.getcwd()):
pac = store_read_package(os.getcwd())
extensions = ['spec', 'dsc', 'kiwi']
extensions = ['spec', 'dsc', 'kiwi', 'livebuild']
cands = [i for i in descr for ext in extensions if i == '%s-%s.%s' % (pac, arg_repository, ext)]
if len(cands) == 1:
arg_descr = cands[0]
Expand All @@ -5460,7 +5460,7 @@ def parse_repoarchdescr(self, args, noinit = False, alternative_project = None,
if not arg_descr:
msg = 'Multiple build description files found: %s' % ', '.join(descr)
elif not ignore_descr:
msg = 'Missing argument: build description (spec, dsc or kiwi file)'
msg = 'Missing argument: build description (spec, dsc, kiwi or livebuild file)'
try:
p = Package('.')
if p.islink() and not p.isexpanded():
Expand Down

0 comments on commit 475d2a2

Please sign in to comment.