1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-14 17:46:17 +01:00

Add compatibility with Debian's obs-build

In Debian and Ubuntu build is renamed to obs-build for disambiguation
purposes.
Add a simple check to use the correct paths if running on Debian and
use /usr/bin/obs-build and /usr/lib/obs-build if so.
This commit is contained in:
Luca Boccassi 2017-07-07 17:47:43 +01:00
parent 9ed700e930
commit af5a38f4c8
2 changed files with 13 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import sys
import time import time
import imp import imp
import inspect import inspect
import os
try: try:
from urllib.parse import urlsplit from urllib.parse import urlsplit
from urllib.error import HTTPError from urllib.error import HTTPError
@ -5867,7 +5868,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
with tempfile.NamedTemporaryFile() as f: with tempfile.NamedTemporaryFile() as f:
f.write(bc) f.write(bc)
f.flush() f.flush()
recipe = return_external('/usr/lib/build/queryconfig', '--dist', f.name, 'type') # some distros like Debian rename and move build to obs-build
if not os.path.isfile('/usr/lib/build/queryconfig') and os.path.isfile('/usr/lib/obs-build/queryconfig'):
queryconfig = '/usr/lib/obs-build/queryconfig'
else:
queryconfig = '/usr/lib/build/queryconfig'
recipe = return_external(queryconfig, '--dist', f.name, 'type')
recipe = recipe.strip() recipe = recipe.strip()
if recipe == 'arch': if recipe == 'arch':
recipe = 'PKGBUILD' recipe = 'PKGBUILD'

View File

@ -183,6 +183,12 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
'vc-cmd': '/usr/lib/build/vc' 'vc-cmd': '/usr/lib/build/vc'
} }
# some distros like Debian rename and move build to obs-build
if not os.path.isfile('/usr/bin/build') and os.path.isfile('/usr/bin/obs-build'):
DEFAULTS['build-cmd'] = '/usr/bin/obs-build'
if not os.path.isfile('/usr/lib/build/vc') and os.path.isfile('/usr/lib/obs-build/vc'):
DEFAULTS['vc-cmd'] = '/usr/lib/obs-build/vc'
# being global to this module, this dict can be accessed from outside # being global to this module, this dict can be accessed from outside
# it will hold the parsed configuration # it will hold the parsed configuration
config = DEFAULTS.copy() config = DEFAULTS.copy()