1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 00:06:15 +01:00

Merge branch 'repotype-pacsuffix-hint' of https://github.com/Conan-Kudo/osc

Use the buildconfig's binarytype to determine the correct pacsuffix
(TODO: cleanup Buildinfo pacsuffix code a bit).
This commit is contained in:
Marcus Huewe 2017-09-26 14:06:29 +02:00
commit 3389db2c8f

View File

@ -21,7 +21,7 @@ except ImportError:
from tempfile import NamedTemporaryFile, mkdtemp from tempfile import NamedTemporaryFile, mkdtemp
from osc.fetch import * from osc.fetch import *
from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir, dgst from osc.core import get_buildinfo, store_read_apiurl, store_read_project, store_read_package, meta_exists, quote_plus, get_buildconfig, is_package_dir, dgst
from osc.core import get_binarylist, get_binary_file, run_external, raw_input from osc.core import get_binarylist, get_binary_file, run_external, return_external, raw_input
from osc.util import rpmquery, debquery, archquery from osc.util import rpmquery, debquery, archquery
import osc.conf import osc.conf
from . import oscerr from . import oscerr
@ -90,7 +90,7 @@ if hostarch == 'parisc':
class Buildinfo: class Buildinfo:
"""represent the contents of a buildinfo file""" """represent the contents of a buildinfo file"""
def __init__(self, filename, apiurl, buildtype = 'spec', localpkgs = []): def __init__(self, filename, apiurl, buildtype = 'spec', localpkgs = [], binarytype = 'rpm'):
try: try:
tree = ET.parse(filename) tree = ET.parse(filename)
except: except:
@ -117,12 +117,13 @@ class Buildinfo:
raise URLError('invalid protocol for the apiurl: \'%s\'' % apiurl) raise URLError('invalid protocol for the apiurl: \'%s\'' % apiurl)
self.buildtype = buildtype self.buildtype = buildtype
self.binarytype = binarytype
self.apiurl = apiurl self.apiurl = apiurl
# are we building .rpm or .deb? # are we building .rpm or .deb?
# XXX: shouldn't we deliver the type via the buildinfo? # XXX: shouldn't we deliver the type via the buildinfo?
self.pacsuffix = 'rpm' self.pacsuffix = 'rpm'
if self.buildtype == 'dsc' or self.buildtype == 'collax': if self.buildtype == 'dsc' or self.buildtype == 'collax' or self.binarytype == 'deb':
self.pacsuffix = 'deb' self.pacsuffix = 'deb'
if self.buildtype == 'arch': if self.buildtype == 'arch':
self.pacsuffix = 'arch' self.pacsuffix = 'arch'
@ -811,7 +812,15 @@ def main(apiurl, opts, argv):
else: else:
raise raise
bi = Buildinfo(bi_filename, apiurl, build_type, list(prefer_pkgs.keys())) # Set default binary type if cannot be detected
binary_type = 'rpm'
if os.path.exists('/usr/lib/build/queryconfig'):
binary_type = return_external('/usr/lib/build/queryconfig', '--dist', bc_filename, 'binarytype').decode('utf-8').strip()
# If binary type is set to a useless value, reset to 'rpm'
if binary_type == 'UNDEFINED':
binary_type = 'rpm'
bi = Buildinfo(bi_filename, apiurl, build_type, list(prefer_pkgs.keys()), binary_type)
if bi.debuginfo and not (opts.disable_debuginfo or '--debug' in buildargs): if bi.debuginfo and not (opts.disable_debuginfo or '--debug' in buildargs):
buildargs.append('--debug') buildargs.append('--debug')