#274 doit: don't crash if rpm-build is not available
Closed: Fixed None Opened 8 years ago by kparal.

If you try to use python-doit on libtaskotron and don't have rpm-build package installed, it crashes hard and without explanation. I assume the error is about missing rpmspec tool. Please first check that the command is available, and it if isn't, print out a reasonable error message which will help the user understand what the problem is.

$ doit list
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/doit/doit_cmd.py", line 165, in run
    return command.parse_execute(args)
  File "/usr/lib/python2.7/site-packages/doit/cmd_base.py", line 122, in parse_execute
    return self.execute(params, args)
  File "/usr/lib/python2.7/site-packages/doit/cmd_base.py", line 380, in execute
    self, params, args)
  File "/usr/lib/python2.7/site-packages/doit/cmd_base.py", line 272, in load_tasks
    params['seek_file'])
  File "/usr/lib/python2.7/site-packages/doit/loader.py", line 97, in get_module
    return importlib.import_module(os.path.splitext(file_name)[0])
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/root/libtaskotron/dodo.py", line 61, in <module>
    RPMRELEASE = get_rpmrelease(os.path.abspath(SPECFILE))
  File "/root/libtaskotron/dodo.py", line 48, in get_rpmrelease
    raw_output = subprocess.check_output(rpmspec_command).split()[0].lstrip('"')
  File "/usr/lib64/python2.7/subprocess.py", line 566, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This ticket had assigned some Differential requests:
D609

Metadata Update from @kparal:
- Issue tagged with: easyfix

6 years ago

Login to comment on this ticket.

Metadata