Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support the mkosi build type #1640

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions osc/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ def get_built_files(pacdir, buildtype):
'-type', 'f'],
stdout=subprocess.PIPE).stdout.read().strip()
s_built = ''
elif buildtype == 'mkosi':
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 = ''
Expand Down Expand Up @@ -757,37 +762,40 @@ def main(apiurl, store, opts, argv):

build_descr = os.path.abspath(build_descr)
build_type = os.path.splitext(build_descr)[1][1:]
if os.path.basename(build_descr) == 'PKGBUILD':
if build_type in ['spec', 'dsc', 'kiwi', 'productcompose', 'livebuild']:
# File extension works
pass
elif os.path.basename(build_descr) == 'PKGBUILD':
build_type = 'arch'
if os.path.basename(build_descr) == 'build.collax':
elif os.path.basename(build_descr) == 'build.collax':
build_type = 'collax'
if os.path.basename(build_descr) == 'appimage.yml':
elif os.path.basename(build_descr) == 'appimage.yml':
build_type = 'appimage'
if os.path.basename(build_descr) == 'Chart.yaml':
elif os.path.basename(build_descr) == 'Chart.yaml':
build_type = 'helm'
if os.path.basename(build_descr) == 'snapcraft.yaml':
elif os.path.basename(build_descr) == 'snapcraft.yaml':
build_type = 'snapcraft'
if os.path.basename(build_descr) == 'simpleimage':
elif os.path.basename(build_descr) == 'simpleimage':
build_type = 'simpleimage'
if os.path.basename(build_descr) == 'Containerfile' or os.path.basename(build_descr).startswith('Containerfile.'):
elif os.path.basename(build_descr) == 'Containerfile' or os.path.basename(build_descr).startswith('Containerfile.'):
build_type = 'docker'
if os.path.basename(build_descr) == 'Dockerfile' or os.path.basename(build_descr).startswith('Dockerfile.'):
elif os.path.basename(build_descr) == 'Dockerfile' or os.path.basename(build_descr).startswith('Dockerfile.'):
build_type = 'docker'
if os.path.basename(build_descr) == 'fissile.yml':
elif os.path.basename(build_descr) == 'fissile.yml':
build_type = 'fissile'
if os.path.basename(build_descr) == '_preinstallimage':
elif 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'):
elif 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', 'helm',
'podman', 'fissile', 'flatpak', 'preinstallimage', 'productcompose']:
elif os.path.basename(build_descr).startswith('mkosi.'):
build_type = 'mkosi'
else:
raise oscerr.WrongArgs(
'Unknown build type: \'%s\'. '
'Build description should end in .spec, .dsc, .kiwi, .productcompose or .livebuild. '
'Or being named PKGBUILD, build.collax, simpleimage, appimage.yml, '
'Chart.yaml, snapcraft.yaml, flatpak.json, flatpak.yml, flatpak.yaml, '
'preinstallimage or Dockerfile' % build_type)
'preinstallimage, Dockerfile.*, Containerfile.* or mkosi.*' % 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
4 changes: 3 additions & 1 deletion osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6860,7 +6860,7 @@ def parse_repoarchdescr(self, args, noinit=False, alternative_project=None, igno
glob.glob('Dockerfile.*') + glob.glob('Containerfile') + glob.glob('Containerfile.*') + \
glob.glob('fissile.yml') + glob.glob('appimage.yml') + glob.glob('Chart.yaml') + \
glob.glob('*flatpak.yaml') + glob.glob('*flatpak.yml') + glob.glob('*flatpak.json') + \
glob.glob('*.productcompose')
glob.glob('*.productcompose') + glob.glob('mkosi.*')

# FIXME:
# * request repos from server and select by build type.
Expand Down Expand Up @@ -6904,6 +6904,8 @@ def parse_repoarchdescr(self, args, noinit=False, alternative_project=None, igno
pac = multibuild_package
if recipe == 'PKGBUILD':
cands = [d for d in descr if d.startswith(recipe)]
elif recipe == 'mkosi':
cands = [d for d in descr if d.startswith('mkosi.')]
else:
cands = [d for d in descr if d.endswith('.' + recipe)]
if len(cands) > 1:
Expand Down
Loading