Bug 552818

Summary: [RFE MD change] yum should know Requires(pre,post) flag for depsolving, and yum check
Product: [Fedora] Fedora Reporter: Mamoru TASAKA <mtasaka>
Component: yumAssignee: Seth Vidal <skvidal>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: ffesti, james.antill, maxamillion, pmatilai, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-30 08:09:51 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:
Attachments:
Description Flags
test spec file: dep1
none
test spec file: dep2 none

Description Mamoru TASAKA 2010-01-06 08:41:27 UTC
Description of problem:
rpm-4.8.0-0.beta1.5.i686
yum-3.2.25-8.fc13.noarch
jadetex-3.13-8.fc12.noarch

On my system:
[root@localhost ~]# env LANG=C yum check
jadetex-3.13-8.fc12.noarch missing requires policycoreutils
Error: check all

However:
[root@localhost ~]# env LANG=C rpm -q --whatrequires policycoreutils
no package requires policycoreutils

Actually:
[tasaka1@localhost ~]$ rpm -qv --requires jadetex
interp: /bin/sh  
post: /bin/sh  
postun: /bin/sh  
manual: jade  
post: policycoreutils  
rpmlib: rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib: rpmlib(FileDigests) <= 4.6.0-1
rpmlib: rpmlib(PayloadFilesHavePrefix) <= 4.0-1
manual: sgml-common >= 0.5
manual: tex(latex)  
manual: texlive  
post: texlive  
rpmlib: rpmlib(PayloadIsXz) <= 5.2-1

So policycoreutils is required as Requires(post) and as far
as I am correct rpm allows to remove dependency for Requires(post)
once the package (in this case jadetex) is correctly installed
(like my current system).

I think as rpm reports that "no package requires policycoreutils"
yum should not report dependency for Requires(post) or so with
"yum check"

Comment 1 James Antill 2010-01-06 13:40:35 UTC
Well yum check operates on the same data the rest of yum has, so if "yum remove" wouldn't work then "yum check" will complain about it.

I guess you could change this to an RFC that yum should know about the post flag, but that'd require huge changes (and I'm not sure we can tell if it's just Require(post) or if you've got Require(postun), the later mneaning we can't remove it).

Comment 2 Mamoru TASAKA 2010-01-06 14:18:00 UTC
Well, with a short test it seems that dependency for Requires(pre) 
and Requires(post) can be removed after installing a rpm completes, 
however the dependency for Requires(preun) or Requires(postun) 
cannot be removed.

Now changing to RFE.

Comment 3 Mamoru TASAKA 2010-01-06 14:18:51 UTC
Created attachment 381999 [details]
test spec file: dep1

Comment 4 Mamoru TASAKA 2010-01-06 14:21:45 UTC
Created attachment 382000 [details]
test spec file: dep2

With the attached dep1.spec and dep2.spec,
# rpm -ivh dep1 dep2
# rpm -e dep2
# yum remove dep1

shows the following messages:
[root@localhost noarch]# env LANG=C yum -y remove dep1
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package dep1.noarch 0:0-1.fc set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

==================================================
 Package    Arch    Version   Repository  Size
==================================================
Removing:
 dep1       noarch  0-1.fc    installed    0.0 

Transaction Summary
==================================================
Remove        1 Package(s)
Reinstall     0 Package(s)
Downgrade     0 Package(s)

Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
dep1-0-1.fc.noarch missing requires dep2
jadetex-3.13-8.fc12.noarch missing requires policycoreutils
  Erasing        : dep1-0-1.fc.noarch       1/1 

Removed:
  dep1.noarch 0:0-1.fc                                                                         

Complete!

Comment 5 James Antill 2010-01-06 16:29:37 UTC
 Ok, writing a quick test program:

http://james.fedorapeople.org/yum/commands/rpm-dump-prco.py

...we seem to have all the data we need, now we "just" have to change all the yum internals to keep it around and add it to the repo metadata.

Comment 6 Panu Matilainen 2013-05-30 08:09:51 UTC
This forgotten bug has actually been long since fixed via what is essentially a dupe of this (bug 785690). The bogus error is now gone:

[root@localhost rpm]# rpm -Uvh /home/pmatilai/rpmbuild/RPMS/noarch/dep2-0-1.fc18.noarch.rpm /home/pmatilai/rpmbuild/RPMS/noarch/dep1-0-1.fc18.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:dep2-0-1.fc18                    ################################# [ 50%]
   2:dep1-0-1.fc18                    ################################# [100%]
[root@localhost rpm]# rpm -e dep2
[root@localhost rpm]# yum check
Loaded plugins: langpacks, presto, refresh-packagekit, tsflags
check all
[root@localhost rpm]# yum remove dep1
Loaded plugins: langpacks, presto, refresh-packagekit, tsflags
Resolving Dependencies
--> Running transaction check
---> Package dep1.noarch 0:0-1.fc18 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch             Version              Repository           Size
================================================================================
Removing:
 dep1           noarch           0-1.fc18             installed           0.0  

Transaction Summary
================================================================================
Remove  1 Package

Installed size: 0  
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Check
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Erasing    : dep1-0-1.fc18.noarch                                         1/1 
  Verifying  : dep1-0-1.fc18.noarch                                         1/1 

Removed:
  dep1.noarch 0:0-1.fc18                                                        

Complete!
[root@localhost rpm]#

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