mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-08 20:15:47 +01:00
Merge branch 'livebuild' of https://github.com/jblunck/osc
This commit is contained in:
commit
e90a60a8c8
25
osc/build.py
25
osc/build.py
@ -116,6 +116,8 @@ class Buildinfo:
|
|||||||
self.pacsuffix = 'deb'
|
self.pacsuffix = 'deb'
|
||||||
if self.buildtype == 'arch':
|
if self.buildtype == 'arch':
|
||||||
self.pacsuffix = 'arch'
|
self.pacsuffix = 'arch'
|
||||||
|
if self.buildtype == 'livebuild':
|
||||||
|
self.pacsuffix = 'deb'
|
||||||
|
|
||||||
self.buildarch = root.find('arch').text
|
self.buildarch = root.find('arch').text
|
||||||
if root.find('hostarch') != None:
|
if root.find('hostarch') != None:
|
||||||
@ -254,32 +256,37 @@ class Pac:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_built_files(pacdir, pactype):
|
def get_built_files(pacdir, buildtype):
|
||||||
if pactype == 'rpm':
|
if buildtype == 'spec':
|
||||||
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'RPMS'),
|
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'RPMS'),
|
||||||
'-name', '*.rpm'],
|
'-name', '*.rpm'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
s_built = subprocess.Popen(['find', os.path.join(pacdir, 'SRPMS'),
|
s_built = subprocess.Popen(['find', os.path.join(pacdir, 'SRPMS'),
|
||||||
'-name', '*.rpm'],
|
'-name', '*.rpm'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
elif pactype == 'kiwi':
|
elif buildtype == 'kiwi':
|
||||||
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'KIWI'),
|
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'KIWI'),
|
||||||
'-type', 'f'],
|
'-type', 'f'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
elif pactype == 'deb':
|
elif buildtype == 'dsc':
|
||||||
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'DEBS'),
|
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'DEBS'),
|
||||||
'-name', '*.deb'],
|
'-name', '*.deb'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
s_built = subprocess.Popen(['find', os.path.join(pacdir, 'SOURCES.DEB'),
|
s_built = subprocess.Popen(['find', os.path.join(pacdir, 'SOURCES.DEB'),
|
||||||
'-type', 'f'],
|
'-type', 'f'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
elif pactype == 'arch':
|
elif buildtype == 'arch':
|
||||||
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'ARCHPKGS'),
|
b_built = subprocess.Popen(['find', os.path.join(pacdir, 'ARCHPKGS'),
|
||||||
'-name', '*.pkg.tar*'],
|
'-name', '*.pkg.tar*'],
|
||||||
stdout=subprocess.PIPE).stdout.read().strip()
|
stdout=subprocess.PIPE).stdout.read().strip()
|
||||||
s_built = ''
|
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:
|
else:
|
||||||
print('WARNING: Unknown package type \'%s\'.' % pactype, file=sys.stderr)
|
print('WARNING: Unknown package type \'%s\'.' % buildtype, file=sys.stderr)
|
||||||
b_built = ''
|
b_built = ''
|
||||||
s_built = ''
|
s_built = ''
|
||||||
return s_built, b_built
|
return s_built, b_built
|
||||||
@ -406,9 +413,9 @@ def main(apiurl, opts, argv):
|
|||||||
build_type = os.path.splitext(build_descr)[1][1:]
|
build_type = os.path.splitext(build_descr)[1][1:]
|
||||||
if os.path.basename(build_descr) == 'PKGBUILD':
|
if os.path.basename(build_descr) == 'PKGBUILD':
|
||||||
build_type = 'arch'
|
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(
|
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)
|
% build_type)
|
||||||
if not os.path.isfile(build_descr):
|
if not os.path.isfile(build_descr):
|
||||||
raise oscerr.WrongArgs('Error: build description file named \'%s\' does not exist.' % build_descr)
|
raise oscerr.WrongArgs('Error: build description file named \'%s\' does not exist.' % build_descr)
|
||||||
@ -1006,7 +1013,7 @@ def main(apiurl, opts, argv):
|
|||||||
pacdir = os.path.join(build_root, pacdir)
|
pacdir = os.path.join(build_root, pacdir)
|
||||||
|
|
||||||
if os.path.exists(pacdir):
|
if os.path.exists(pacdir):
|
||||||
(s_built, b_built) = get_built_files(pacdir, bi.pacsuffix)
|
(s_built, b_built) = get_built_files(pacdir, bi.buildtype)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
if s_built: print(s_built)
|
if s_built: print(s_built)
|
||||||
|
@ -5377,7 +5377,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
for subarch in osc.build.can_also_build.get(mainarch):
|
for subarch in osc.build.can_also_build.get(mainarch):
|
||||||
all_archs.append(subarch)
|
all_archs.append(subarch)
|
||||||
for arg in args:
|
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
|
arg_descr = arg
|
||||||
else:
|
else:
|
||||||
if (arg == osc.build.hostarch or arg in all_archs) and arg_arch is None:
|
if (arg == osc.build.hostarch or arg in all_archs) and arg_arch is None:
|
||||||
@ -5434,7 +5434,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
# can be implemented using
|
# can be implemented using
|
||||||
# reduce(lambda x, y: x + y, (glob.glob(x) for x in ('*.spec', '*.dsc', '*.kiwi')))
|
# reduce(lambda x, y: x + y, (glob.glob(x) for x in ('*.spec', '*.dsc', '*.kiwi')))
|
||||||
# but be a bit more readable :)
|
# 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:
|
# FIXME:
|
||||||
# * request repos from server and select by build type.
|
# * request repos from server and select by build type.
|
||||||
@ -5449,7 +5449,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
pac = os.path.basename(os.getcwd())
|
pac = os.path.basename(os.getcwd())
|
||||||
if is_package_dir(os.getcwd()):
|
if is_package_dir(os.getcwd()):
|
||||||
pac = store_read_package(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)]
|
cands = [i for i in descr for ext in extensions if i == '%s-%s.%s' % (pac, arg_repository, ext)]
|
||||||
if len(cands) == 1:
|
if len(cands) == 1:
|
||||||
arg_descr = cands[0]
|
arg_descr = cands[0]
|
||||||
@ -5460,7 +5460,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if not arg_descr:
|
if not arg_descr:
|
||||||
msg = 'Multiple build description files found: %s' % ', '.join(descr)
|
msg = 'Multiple build description files found: %s' % ', '.join(descr)
|
||||||
elif not ignore_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:
|
try:
|
||||||
p = Package('.')
|
p = Package('.')
|
||||||
if p.islink() and not p.isexpanded():
|
if p.islink() and not p.isexpanded():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user