Bug 539490

Summary: yum-builddep ignores already installed provider of a virtual package when processing buildRequires
Product: [Fedora] Fedora Reporter: Praveen Arimbrathodiyil <parimbra>
Component: yum-utilsAssignee: Seth Vidal <skvidal>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: low    
Version: 12CC: bkearney, james.antill, llim, maxamillion, pmatilai, sundaram, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 1.1.25-1.fc12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-01-12 21:02:09 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:
Bug Depends On:    
Bug Blocks: 538980    

Description Praveen Arimbrathodiyil 2009-11-20 11:20:17 UTC
Description of problem:

yum fails to resolve system-bookmarks. Even though fedora-bookmarks is installs and which provides system-bookmarks it tries to install astronomy-bookmarks and fails with a message astronomy-bookmarks conflicts with fedora-bookmarks.

Version-Release number of selected component (if applicable):


How reproducible:

always

Steps to Reproduce:
1.yum-builddep firefox
2.yum install system-bookmarks
3.
  
Actual results:
dependency resolution fails

sudo yum install system-bookmarks
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package astronomy-bookmarks.noarch 0:1-6.fc12 set to be updated
--> Processing Conflict: astronomy-bookmarks-1-6.fc12.noarch conflicts fedora-bookmarks
--> Finished Dependency Resolution
astronomy-bookmarks-1-6.fc12.noarch from fedora has depsolving problems
  --> astronomy-bookmarks conflicts with fedora-bookmarks
Error: astronomy-bookmarks conflicts with fedora-bookmarks
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest


Expected results:
Go ahead with installed fedora-bookmarks, which provides system-bookmarks

Additional info:

Comment 1 Rahul Sundaram 2009-11-20 11:30:47 UTC
With more debug,

Not loading "blacklist" plugin, as it is disabled
Loading "presto" plugin
Loading "refresh-packagekit" plugin
Not loading "whiteout" plugin, as it is disabled
Running "config" handler for "presto" plugin
Config time: 0.639
Yum Version: 3.2.25
COMMAND: yum -d9 install system-bookmarks 
Installroot: /
Ext Commands:

   system-bookmarks
Setting up Package Sacks
pkgsack time: 0.197
Reading Local RPMDB
rpmdb time: 0.234
Setting up Install Process
Checking for virtual provide or file-provide for system-bookmarks
Searching pkgSack for dep: system-bookmarks
Potential match for system-bookmarks from fedora-bookmarks-11-2.noarch
Matched fedora-bookmarks-11-2.noarch to require for system-bookmarks
Potential match for system-bookmarks from astronomy-bookmarks-1-6.fc12.noarch
Matched astronomy-bookmarks-1-6.fc12.noarch to require for system-bookmarks
Running compare_providers() for [<YumAvailablePackageSqlite : fedora-bookmarks-11-2.noarch (0x99e2d0c)>, <YumAvailablePackageSqlite : astronomy-bookmarks-1-6.fc12.noarch (0x99e2b6c)>]
Best Order: [(<YumAvailablePackageSqlite : astronomy-bookmarks-1-6.fc12.noarch (0x99e2b6c)>, -19)]
Building updates object
up:Obs Init time: 0.534
up:simple updates time: 1.035
up:obs time: 0.017
up:condense time: 0.000
updates time: 5.944
Resolving Dependencies
--> Running transaction check
---> Package astronomy-bookmarks.noarch 0:1-6.fc12 set to be updated
Checking deps for astronomy-bookmarks.noarch 0-1-6.fc12 - u
--> Processing Conflict: astronomy-bookmarks-1-6.fc12.noarch conflicts fedora-bookmarks
astronomy-bookmarks conflicts with fedora-bookmarks
--> Finished Dependency Resolution
Dependency Process ending
astronomy-bookmarks-1-6.fc12.noarch from fedora has depsolving problems
  --> astronomy-bookmarks conflicts with fedora-bookmarks
Depsolve time: 12.015
Error: astronomy-bookmarks conflicts with fedora-bookmarks
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest

Comment 2 Rahul Sundaram 2009-11-20 11:32:35 UTC
$ sudo yum-builddep firefox
Loaded plugins: presto, refresh-packagekit
Enabling fedora-source repository
Enabling updates-source repository
astronomy-bookmarks-1-6.fc12.noarch
desktop-file-utils-0.15-8.fc12.i686
xulrunner-devel-unstable-1.9.1.5-1.fc12.i686
xulrunner-devel-unstable-1.9.1.5-1.fc12.i686
astronomy-bookmarks-1-6.fc12.noarch
desktop-file-utils-0.15-8.fc12.i686
--> Running transaction check
---> Package astronomy-bookmarks.noarch 0:1-6.fc12 set to be updated
---> Package xulrunner-devel-unstable.i686 0:1.9.1.5-1.fc12 set to be updated
--> Processing Conflict: astronomy-bookmarks-1-6.fc12.noarch conflicts fedora-bookmarks
--> Finished Dependency Resolution
astronomy-bookmarks-1-6.fc12.noarch from fedora has depsolving problems
  --> astronomy-bookmarks conflicts with fedora-bookmarks

================================================================================
 Package                      Arch       Version              Repository   Size
================================================================================
Installing:
 astronomy-bookmarks          noarch     1-6.fc12             fedora      5.0 k
 xulrunner-devel-unstable     i686       1.9.1.5-1.fc12       updates     3.4 M

Transaction Summary
================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total size: 3.4 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
ERROR with rpm_check_debug vs depsolve:
fedora-bookmarks conflicts with astronomy-bookmarks-1-6.fc12.noarch

Comment 3 Rahul Sundaram 2009-11-20 11:35:57 UTC
Another similar problem

sudo yum -d9 install system-release
Not loading "blacklist" plugin, as it is disabled
Loading "presto" plugin
Loading "refresh-packagekit" plugin
Not loading "whiteout" plugin, as it is disabled
Running "config" handler for "presto" plugin
Config time: 0.490
Yum Version: 3.2.25
COMMAND: yum -d9 install system-release 
Installroot: /
Ext Commands:

   system-release
Setting up Package Sacks
pkgsack time: 0.181
Reading Local RPMDB
rpmdb time: 0.177
Setting up Install Process
Checking for virtual provide or file-provide for system-release
Searching pkgSack for dep: system-release
Potential match for system-release from fedora-release-12-1.noarch
Matched fedora-release-12-1.noarch to require for system-release
Potential match for system-release from generic-release-11.90-2.noarch
Matched generic-release-11.90-2.noarch to require for system-release
Potential match for system-release from fedora-release-12-2.noarch
Matched fedora-release-12-2.noarch to require for system-release
Potential match for system-release from generic-release-12-1.noarch
Matched generic-release-12-1.noarch to require for system-release
Running compare_providers() for [<YumAvailablePackageSqlite : fedora-release-12-1.noarch (0xa225cec)>, <YumAvailablePackageSqlite : generic-release-11.90-2.noarch (0xa225b4c)>, <YumAvailablePackageSqlite : fedora-release-12-2.noarch (0xa2256cc)>, <YumAvailablePackageSqlite : generic-release-12-1.noarch (0xa2255ec)>]
Best Order: [(<YumAvailablePackageSqlite : generic-release-12-1.noarch (0xa2255ec)>, -15), (<YumAvailablePackageSqlite : generic-release-11.90-2.noarch (0xa225b4c)>, -1039)]
Building updates object
up:Obs Init time: 0.640
up:simple updates time: 1.215
up:obs time: 0.016
up:condense time: 0.000
updates time: 6.395
Resolving Dependencies
--> Running transaction check
---> Package generic-release.noarch 0:12-1 set to be updated
Checking deps for generic-release.noarch 0-12-1 - u
--> Processing Conflict: generic-release-12-1.noarch conflicts fedora-release
Running compare_providers() for [<YumAvailablePackageSqlite : generic-release-11.90-2.noarch (0xa225b4c)>, <YumAvailablePackageSqlite : generic-release-12-1.noarch (0xa2255ec)>]
Best Order: [(<YumAvailablePackageSqlite : generic-release-12-1.noarch (0xa2255ec)>, -15), (<YumAvailablePackageSqlite : generic-release-11.90-2.noarch (0xa225b4c)>, -1039)]
generic-release conflicts with fedora-release
--> Finished Dependency Resolution
Dependency Process ending
generic-release-12-1.noarch from updates has depsolving problems
  --> generic-release conflicts with fedora-release
Depsolve time: 12.697
Error: generic-release conflicts with fedora-release
 You could try using --skip-broken to work around the problem
 You could try running: package-cleanup --problems
                        package-cleanup --dupes
                        rpm -Va --nofiles --nodigest

Comment 4 Praveen Arimbrathodiyil 2009-11-20 11:54:39 UTC
From both examples, it seems, Best Order fails to list already installed packages.

Comment 5 seth vidal 2009-11-20 13:05:18 UTC
rpm -Va --nofiles --nodigest  

Run that command and let me know what it returns.

Comment 6 Praveen Arimbrathodiyil 2009-11-20 13:11:13 UTC
It is clean.

[pravi@savannah mozilla]$ rpm -Va --nofiles --nodigest 
[pravi@savannah mozilla]$

Comment 7 Rahul Sundaram 2009-11-20 13:15:17 UTC
It returns nothing.

Comment 8 seth vidal 2009-11-20 13:22:35 UTC
What's happening with yum-builddep needs to be fixed - but I'm not sure the 'these two pkgs conflict' is necessarily a problem.

Is your objection that it is not saying "fedora-bookmarks provides system-bookmarks and is already installed"?

Comment 9 Rahul Sundaram 2009-11-20 13:29:33 UTC
Yes, that would be a much better output.  Even better

# yum install generic-release

...

fedora-release is already installed and conflicts with generic-release. Would you like replace fedora-release with generic release? Y/N

Similarly, replacing fedora-bookmarks by astronomy bookmarks. Currently I have to use yum shell to workaround this.

Comment 10 Praveen Arimbrathodiyil 2009-11-20 13:31:58 UTC
firefox depends on system-bookmarks, which is already provided by fedora-bookmarks. So there is nothing stopping yum to fail, but it does anyway. This happens because yum finds astronomy-bookmarks has higher priority than fedora-bookmarks (from the debug output, it is clear yum is ignoring fedora-bookmarks), which is not the case. Moreover yum install system-bookmarks also fails, so it is not a bug with firefox.

Comment 11 Praveen Arimbrathodiyil 2009-11-20 13:38:46 UTC
# yum install astronomy-bookmarks
(ie, specific package in provider list of a virtual package)

should offer a similar dialogue as Rahul suggested, but

if it is 

# yum install system-bookmarks

(ie, virtual package directly) 

If any of the installed packages provides it, it should be sufficient. If none of the installed packages provide it and there is more than one available packages provide it, the user should be given an option to choose from a list of providers.

Comment 12 James Antill 2009-11-20 13:46:44 UTC
 I don't think the above install tests are valid because requires != install.
 For instance:

 "yum install MTA" wants to install postfix, but yum shouldn't ask to install it when processing "requires: MTA".

 I think the bug is in yum-builddep which does:

                    pkg = self.returnPackageByDep(dep)
                    print pkg
                    if not self.rpmdb.installed(name=pkg.name):
                        self.tsInfo.addInstall(pkg)

...which is wrong, for this case, unless returnPackageByDep() used to always return an installed pkg if an installed pkg resolved the dep. and we changed it.

Comment 13 Praveen Arimbrathodiyil 2009-11-20 13:53:56 UTC
James,

if the bug is in yum-builddep, then why 

# yum install system-bookmarks 

(using plain yum)

fails, when fedora-bookmarks already provides it?

Comment 14 James Antill 2009-11-20 14:04:53 UTC
"yum install system-bookmarks" doesn't "fail". It tries to do what you asked it to, which is install a package which provides system-bookmarks. We could change that, and maybe that would be better in the general case ... but it would be "interesting" in a few cases (Eg. foo installed which provides bar, but bar is a real pkg ... "yum install bar" would be painful to do "nothing" here, and probably insane).

 Anyway, here is a patch (against yum) which changes returnPackageByDep() to act like yum-builddeb seems to assume it will (but I'm not sure has ever been guaranteed):

diff --git a/yum/__init__.py b/yum/__init__.py
index 35f599c..b47698f 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -2468,7 +2468,9 @@ class YumBase(depsolve.Depsolve):
 
     def returnPackageByDep(self, depstring):
         """Pass in a generic [build]require string and this function will 
-           pass back the best(or first) package it finds providing that dep."""
+           pass back the best(or first) package it finds providing that dep.
+           We guarantee to return an installed pkg, if a pkg is installed
+           which provides the require/[build]require. """
         
         # we get all sorts of randomness here
         errstring = depstring
@@ -2479,7 +2481,10 @@ class YumBase(depsolve.Depsolve):
             pkglist = self.returnPackagesByDep(depstring)
         except Errors.YumBaseError:
             raise Errors.YumBaseError, _('No Package found for %s') % errstring
-        
+
+        ipkglist = [pkg for pkg in pkglist if pkg.repoid == 'installed']
+        if ipkglist:
+            pkglist = ipkglist
         ps = ListPackageSack(pkglist)
         result = self._bestPackageFromList(ps.returnNewestByNameArch())
         if result is None:

Comment 15 James Antill 2009-11-23 15:06:46 UTC
 After some more thought I pushed:

http://yum.baseurl.org/gitweb?p=yum-utils.git;a=commitdiff;h=c8e7823de9cb169f65f20fcdc57e39b9de3ca474

...to fix yum-builddep directly. I'm still not 100% sure this is the right thing to do, but it is localized.

Comment 16 Fedora Update System 2010-01-27 12:13:03 UTC
yum-utils-1.1.25-1.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/yum-utils-1.1.25-1.fc12

Comment 17 Fedora Update System 2010-02-11 14:47:32 UTC
yum-utils-1.1.25-1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.