mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-03 18:16:17 +01:00
add support for building preinstall images
This is yet another build type supported by the obs-build script intended to build images that speed up the build setup phase.
This commit is contained in:
parent
f70b41ce32
commit
69c83d41aa
24
osc/build.py
24
osc/build.py
@ -122,7 +122,7 @@ class Buildinfo:
|
||||
if self.buildtype == 'livebuild':
|
||||
self.pacsuffix = 'deb'
|
||||
if self.buildtype == 'snapcraft':
|
||||
# atm ubuntu is used as base, but we need to be more clever when
|
||||
# atm ubuntu is used as base, but we need to be more clever when
|
||||
# snapcraft also supports rpm
|
||||
self.pacsuffix = 'deb'
|
||||
|
||||
@ -440,6 +440,11 @@ def get_built_files(pacdir, buildtype):
|
||||
'-type', 'f'],
|
||||
stdout=subprocess.PIPE).stdout.read().strip()
|
||||
s_built = ''
|
||||
elif buildtype == 'preinstallimage':
|
||||
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'OTHER'),
|
||||
'-type', 'f'],
|
||||
stdout=subprocess.PIPE).stdout.read().strip()
|
||||
s_built = ''
|
||||
else:
|
||||
print('WARNING: Unknown package type \'%s\'.' % buildtype, file=sys.stderr)
|
||||
b_built = ''
|
||||
@ -650,12 +655,19 @@ def main(apiurl, opts, argv):
|
||||
build_type = 'docker'
|
||||
if os.path.basename(build_descr) == 'fissile.yml':
|
||||
build_type = 'fissile'
|
||||
if os.path.basename(build_descr) == '_preinstallimage':
|
||||
build_type = 'preinstallimage'
|
||||
if build_descr.endswith('flatpak.yaml') or build_descr.endswith('flatpak.yml') or build_descr.endswith('flatpak.json'):
|
||||
build_type = 'flatpak'
|
||||
if build_type not in ['spec', 'dsc', 'kiwi', 'arch', 'collax', 'livebuild', 'simpleimage', 'snapcraft', 'appimage', 'docker', 'podman', 'fissile', 'flatpak']:
|
||||
if build_type not in ['spec', 'dsc', 'kiwi', 'arch', 'collax', 'livebuild',
|
||||
'simpleimage', 'snapcraft', 'appimage', 'docker',
|
||||
'podman', 'fissile', 'flatpak', 'preinstallimage']:
|
||||
raise oscerr.WrongArgs(
|
||||
'Unknown build type: \'%s\'. Build description should end in .spec, .dsc, .kiwi, or .livebuild. Or being named PKGBUILD, build.collax, simpleimage, appimage.yml, snapcraft.yaml, flatpak.json, flatpak.yml, flatpak.yaml or Dockerfile' \
|
||||
% build_type)
|
||||
'Unknown build type: \'%s\'. '
|
||||
'Build description should end in .spec, .dsc, .kiwi, or .livebuild. '
|
||||
'Or being named PKGBUILD, build.collax, simpleimage, appimage.yml, '
|
||||
'snapcraft.yaml, flatpak.json, flatpak.yml, flatpak.yaml, preinstallimage '
|
||||
'or Dockerfile' % build_type)
|
||||
if not os.path.isfile(build_descr):
|
||||
raise oscerr.WrongArgs('Error: build description file named \'%s\' does not exist.' % build_descr)
|
||||
|
||||
@ -1089,6 +1101,10 @@ def main(apiurl, opts, argv):
|
||||
if build_as_user():
|
||||
# preinstallimage extraction will fail
|
||||
bi.preinstallimage = None
|
||||
if build_type == 'preinstallimage':
|
||||
# preinstallimage would repackage just the previously built preinstallimage
|
||||
bi.preinstallimage = None
|
||||
|
||||
if (not config['no_preinstallimage'] and not opts.nopreinstallimage and
|
||||
bi.preinstallimage and
|
||||
not opts.noinit and
|
||||
|
@ -6320,7 +6320,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
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.endswith('.livebuild') or arg == 'PKGBUILD' or arg == 'build.collax' or arg == 'Dockerfile' or arg == 'fissile.yml' or arg == 'appimage.yml' or arg.endswith('flatpak.yaml') or arg.endswith('flatpak.yml') or arg.endswith('flatpak.json'):
|
||||
if (arg.endswith('.spec') or arg.endswith('.dsc') or arg.endswith('.kiwi') or
|
||||
arg.endswith('.livebuild') or arg == 'PKGBUILD' or arg == 'build.collax' or
|
||||
arg == 'Dockerfile' or arg == 'fissile.yml' or arg == 'appimage.yml' or
|
||||
arg == '_preinstallimage' or arg.endswith('flatpak.yaml') or
|
||||
arg.endswith('flatpak.yml') or arg.endswith('flatpak.json')):
|
||||
arg_descr = arg
|
||||
else:
|
||||
if (arg == osc.build.hostarch or arg in all_archs) and arg_arch is None:
|
||||
|
Loading…
Reference in New Issue
Block a user