Bug 718857

Summary: yum-builddep should take into account problems with buildind the transaction and exit to OS with non-zero status
Product: [Fedora] Fedora Reporter: Alexey Loukianov <mooroon2>
Component: yum-utilsAssignee: Seth Vidal <skvidal>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 15CC: james.antill, maxamillion, pmatilai, tim.lauridsen, ville.skytta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-19 20:09:28 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alexey Loukianov 2011-07-04 23:27:45 UTC
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 23:30:28 UTC
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 23:38:37 UTC
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 20:09:28 UTC

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