Bug 718857 - yum-builddep should take into account problems with buildind the transaction and exit to OS with non-zero status
yum-builddep should take into account problems with buildind the transaction ...
Status: CLOSED DUPLICATE of bug 716267
Product: Fedora
Classification: Fedora
Component: yum-utils (Show other bugs)
15
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-04 19:27 EDT by Alexey Loukianov
Modified: 2014-01-21 18:18 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-12-19 15:09:28 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Alexey Loukianov 2011-07-04 19:27:45 EDT
Description of problem:
SUBJ. Around the line 100 of /usr/bin/yum-builddep there's a check if self.doUtilBuildTransaction() is available with a sebsequent call in case it is.
Trouble is that the functions is being called discarding the exit result:

        if hasattr(self, 'doUtilBuildTransaction'):
            self.doUtilBuildTransaction()
        else:
            try:
                self.buildTransaction()
            except yum.Errors.YumBaseError, e:
                self.logger.critical("Error building transaction: %s" % e)
                sys.exit(1)

        if len(self.tsInfo) < 1:
            print 'No uninstalled build requires'
            sys.exit()

Thus it is imposible to distinguish the fact that there are no uninstalled build requires on the system from the fact that there were some problems building the transaction. Here is my quick-n-dirty hack to solve the problem:

        if hasattr(self, 'doUtilBuildTransaction'):
            transresult = self.doUtilBuildTransaction()
        else:
            transresult = 0
            try:
                transresult = self.buildTransaction()
            except yum.Errors.YumBaseError, e:
                self.logger.critical("Error building transaction: %s" % e)
                sys.exit(1)

        if transresult != 0:
            msg = "There was a problem building the transaction, exiting.\n"
            self.logger.error(msg)
            sys.exit(1)

        if len(self.tsInfo) < 1:
            print 'No uninstalled build requires'
            sys.exit()


Version-Release number of selected component (if applicable):
yum-utils-1.1.30-2

How reproducible:
Try to use yum-builddep to install buildreqs in a situation when it's imposible to solve the dependency graph. 

Steps to Reproduce:
Imagine the following situation:
there'are two versions of package libbar: 1.0 and 2.0. First one provides libbar.so.1, while second one provides libbar.so.2. In case we've got libbar >= 2.0 as a direct build dependency for a package, while other builddep packages require libbar-1.0 (i.e. libbar.so.1) - we're in trobles.   

Actual results:
yum-builddep fails to solve the transaction and install builddeps. Not noticing the fact that there were problems it merely prints: "No uninstalled builddeps." and exits with 0 exit code.

Expected results:
yum-builddep should print that there were some problems resolving dependencies/building transaction and exit non-zero.
Comment 1 Alexey Loukianov 2011-07-04 19:30:28 EDT
Hmm, looks like the dirty hack I mentioned seems to fail for a some reason. Looks like I need to dig deeper into yum-utils sources to solve it.
Comment 2 Alexey Loukianov 2011-07-04 19:38:37 EDT
Well, being mainly asm/c/c++/php programmer it's really hard to write python or perl code.

This way it works as I expect it to work:


        if hasattr(self, 'doUtilBuildTransaction'):
            transresult = self.doUtilBuildTransaction()
        else:
            transresult = 0
            try:
                transresult = self.buildTransaction()
            except yum.Errors.YumBaseError, e:
                self.logger.critical("Error building transaction: %s" % e)
                sys.exit(1)

        if transresult > 0:
            msg = "There was a problem building the transaction, error code = %d exiting.\n" % transresult
            self.logger.error(msg)
            sys.exit(1)

        if len(self.tsInfo) < 1:
            print 'No uninstalled build requires'
            sys.exit()
Comment 3 Ville Skyttä 2011-12-19 15:09:28 EST

*** This bug has been marked as a duplicate of bug 716267 ***

Note You need to log in before you can comment on or make changes to this bug.