mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 20:22:46 +00:00
Merge pull request #69 from xsuchy/pull-req-31
#31 - if build fails due missing dependecies, suggest to run yum-builddep
This commit is contained in:
commit
bdcaf75b6a
4 changed files with 18 additions and 2 deletions
|
@ -23,6 +23,7 @@ from distutils.version import LooseVersion as loose_version
|
|||
from tempfile import mkdtemp
|
||||
|
||||
from tito.common import *
|
||||
from tito.exception import RunCommandException
|
||||
from tito.release import *
|
||||
from tito.exception import TitoException
|
||||
from tito.config_object import ConfigObject
|
||||
|
@ -261,6 +262,11 @@ class Builder(ConfigObject):
|
|||
except (KeyboardInterrupt, SystemExit):
|
||||
print ""
|
||||
exit(1)
|
||||
except RunCommandException, err:
|
||||
msg = str(err)
|
||||
if (re.search('Failed build dependencies', err.output)):
|
||||
msg = "Please run 'yum-builddep %s' as root." % find_spec_file(self.relative_project_dir)
|
||||
error_out('%s' % msg)
|
||||
except Exception, err:
|
||||
error_out('%s' % str(err))
|
||||
print(output)
|
||||
|
|
|
@ -20,6 +20,8 @@ import sys
|
|||
import commands
|
||||
import traceback
|
||||
|
||||
from tito.exception import RunCommandException
|
||||
|
||||
DEFAULT_BUILD_DIR = "/tmp/tito"
|
||||
DEFAULT_BUILDER = "default_builder"
|
||||
DEFAULT_TAGGER = "default_tagger"
|
||||
|
@ -209,7 +211,6 @@ def extract_sha1(output):
|
|||
else:
|
||||
return ""
|
||||
|
||||
|
||||
def run_command(command):
|
||||
debug(command)
|
||||
(status, output) = commands.getstatusoutput(command)
|
||||
|
@ -218,7 +219,7 @@ def run_command(command):
|
|||
sys.stderr.write("Error running command: %s\n" % command)
|
||||
sys.stderr.write("Status code: %s\n" % status)
|
||||
sys.stderr.write("Command output: %s\n" % output)
|
||||
raise Exception("Error running command")
|
||||
raise RunCommandException("Error running command", command, status, output)
|
||||
return output
|
||||
|
||||
|
||||
|
|
|
@ -28,3 +28,11 @@ class TitoException(Exception):
|
|||
|
||||
def __str__(self):
|
||||
return "TitoException: %s" % self.message
|
||||
|
||||
class RunCommandException(Exception):
|
||||
""" Raised by run_command() """
|
||||
def __init__(self, msg, command, status, output):
|
||||
Exception.__init__(self, msg)
|
||||
self.command = command
|
||||
self.status = status
|
||||
self.output = output
|
||||
|
|
|
@ -26,6 +26,7 @@ Requires: fedora-cert
|
|||
Requires: fedora-packager
|
||||
Requires: rpmdevtools
|
||||
Requires: rpm-python
|
||||
Requires: yum-utils
|
||||
|
||||
%description
|
||||
Tito is a tool for managing tarballs, rpms, and builds for projects using
|
||||
|
|
Loading…
Add table
Reference in a new issue