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

- do not hardcode path to the build scripts and removed legacy check

This commit is contained in:
Marcus Huewe 2014-10-01 14:45:48 +02:00
parent e1cdf86bdf
commit a7c92eb18f
3 changed files with 23 additions and 11 deletions

View File

@ -5595,10 +5595,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
import osc.build import osc.build
if not os.path.exists('/usr/lib/build/debtransform') \ if which(conf.config['build-cmd']) is None:
and not os.path.exists('/usr/lib/lbuild/debtransform'): print('Error: build (\'%s\') command not found' % conf.config['build-cmd'], file=sys.stderr)
sys.stderr.write('Error: you need build.rpm with version 2007.3.12 or newer.\n') print('Install the build package from http://download.opensuse.org/repositories/openSUSE:/Tools/', file=sys.stderr)
sys.stderr.write('See http://download.opensuse.org/repositories/openSUSE:/Tools/\n')
return 1 return 1
if opts.debuginfo and opts.disable_debuginfo: if opts.debuginfo and opts.disable_debuginfo:
@ -7894,18 +7893,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
except IndexError: except IndexError:
pass pass
cmd_list = [conf.config['vc-cmd']]
if meego_style: if meego_style:
if not os.path.exists('/usr/bin/vc'): if not os.path.exists('/usr/bin/vc'):
print('Error: you need meego-packaging-tools for /usr/bin/vc command', file=sys.stderr) print('Error: you need meego-packaging-tools for /usr/bin/vc command', file=sys.stderr)
return 1 return 1
cmd_list = ['/usr/bin/vc'] cmd_list = ['/usr/bin/vc']
else: elif which(cmd_list[0]) is None:
if not os.path.exists('/usr/lib/build/vc'): print('Error: vc (\'%s\') command not found' % cmd_list[0], file=sys.stderr)
print('Error: you need build.rpm with version 2009.04.17 or newer', file=sys.stderr) print('Install the build package from http://download.opensuse.org/repositories/openSUSE:/Tools/', file=sys.stderr)
print('See http://download.opensuse.org/repositories/openSUSE:/Tools/', file=sys.stderr) return 1
return 1
cmd_list = ['/usr/lib/build/vc']
# set user's email if no mailaddr exists # set user's email if no mailaddr exists
if 'mailaddr' not in os.environ: if 'mailaddr' not in os.environ:

View File

@ -172,6 +172,8 @@ DEFAULTS = {'apiurl': 'https://api.opensuse.org',
'maintenance_attribute': 'OBS:MaintenanceProject', 'maintenance_attribute': 'OBS:MaintenanceProject',
'maintained_update_project_attribute': 'OBS:UpdateProject', 'maintained_update_project_attribute': 'OBS:UpdateProject',
'show_download_progress': '0', 'show_download_progress': '0',
# path to the vc script
'vc-cmd': '/usr/lib/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

View File

@ -7032,4 +7032,17 @@ def utime(filename, arg, ignore_einval=True):
return return
raise raise
def which(name):
"""Searches "name" in PATH."""
name = os.path.expanduser(name)
if os.path.isabs(name):
if os.path.exists(name):
return name
return None
for directory in os.environ.get('PATH', '').split(':'):
path = os.path.join(directory, name)
if os.path.exists(path):
return path
return None
# vim: sw=4 et # vim: sw=4 et