Bug 198033

Summary: [patch]: tweak perl.req to cut down false Requires
Product: [Fedora] Fedora Reporter: J. Randall Owens <jrowens.fedora>
Component: rpmAssignee: Paul Nasrat <nobody+pnasrat>
Status: CLOSED UPSTREAM QA Contact: Mike McLean <mikem>
Severity: low Docs Contact:
Priority: medium    
Version: 5CC: kestes, rdieter
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: 2006-07-08 14:08:14 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: 198027    
Attachments:
Description Flags
patch for /usr/lib/rpm/perl.req
none
patch for /usr/lib/rpm/perl.req with debugging output none

Description J. Randall Owens 2006-07-08 11:47:56 UTC
Created attachment 132100 [details]
patch for /usr/lib/rpm/perl.req

Comment 1 J. Randall Owens 2006-07-08 11:47:56 UTC
Description of problem:
False requirements for many perl packages; the latest example that happened to
come to my attention while I was learning a bit of spec file work anyway was
perl-Image-ExifTools.
/usr/lib/rpm/perl.req finds some lines that are actually quoted by q{} but have
"use..." at the beginning of a line. It interprets these as perl dependencies
(could happen for "require..." too, but that's not such a common word).

Version-Release number of selected component (if applicable):
rpm-4.4.2-15.2
perl-5.8.8-5
perl-Image-ExifTools-6.26-1.fc5

How reproducible:
Try to install perl-Image-ExifTools, either from downloaded package or a
frontend that should find dependencies for you, e.g. yum or smart, or even from
SRPM.

Steps to Reproduce:
1. download perl-Image-ExifTools-6.26-1.fc5.noarch.rpm &
perl-Image-ExifTools-6.26-1.fc5.src.rpm
2. rpm -Uhv perl-Image-ExifTools-6.26-1.fc5.noarch.rpm
3. rpm -i perl-Image-ExifTools-6.26-1.fc5.src.rpm ; rpmbuild -ba
SPECS/perl-Image-ExifTool.spec ; rpm -Uhv
RPMS/noarch/perl-Image-ExifTools-6.26-1.fc5.noarch.rpm
  
Actual results:
error: Failed dependencies:
        perl(the) is needed by perl-Image-ExifTool-6.26-1.fc5.noarch
Exit 1

Expected results:
Preparing...                ########################################### [100%]
   1:perl-Image-ExifTool    ########################################### [100%]

Additional info:

$ rpm -qp --requires perl-Image-ExifTool-6.26-1.fc5.noarch.rpm
/usr/bin/perl
perl >= 0:5.002
perl >= 0:5.004
perl(:MODULE_COMPAT_5.8.8)
perl(Exporter)
perl(File::RandomAccess)
perl(Image::ExifTool)
perl(Image::ExifTool::APP12)
perl(Image::ExifTool::ASF)
perl(Image::ExifTool::Canon)
perl(Image::ExifTool::Exif)
perl(Image::ExifTool::GPS)
perl(Image::ExifTool::ID3)
perl(Image::ExifTool::MakerNotes)
perl(Image::ExifTool::Nikon)
perl(Image::ExifTool::Real)
perl(Image::ExifTool::Shortcuts)
perl(Image::ExifTool::XMP)
perl(strict)
perl(the)           <====- this is the one
perl(vars)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(VersionedDependencies) <= 3.0.3-1

I poked around in /usr/lib/rpm/perl.req, after a verbose rpmbuild showed me
that's what was finding those dependencies. I think I have an improvement that
will cut down on such things without missing too much. I have a patch for a
regular version, attached here, and then I'll do a second attachment with a
perl.req-test, which outputs the chunks that were skipped over by my bit, plus
the two characters it found and is looking for, for debugging (I'm sure my
regexp has room for improvement).
It's not perfect, but neither is what we have now. I think it's a little bit
better. I ran rpmbuild after setting %__perl_requires in my .rpmmacros, it
installed just fine, and a diff of the outputs of `rpm -qp --requires` on each
package shows that the only difference there is perl(the).
I'm adding the author whose email is in comments in perl.req as a Cc: to this,
since I'm not sure just who has the overall authority on the contents. I'm also
listing the perl-Image-ExifTool bug I'd already reported as an "external" bug
reference; I'm not sure just how that works, so please be forgiving if I
should've just skipped it.

Comment 2 J. Randall Owens 2006-07-08 11:57:07 UTC
Created attachment 132101 [details]
patch for /usr/lib/rpm/perl.req with debugging output

Extra patch with some debugging output.

Comment 3 J. Randall Owens 2006-07-08 12:20:40 UTC
Oh, and as an extra note, here are other related bugs I found while looking to
see whether my patch might best be attached to one of them:
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=109934 (with a patch right
where mine goes)
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=130531
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=157195
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=161921

There seems to be some debate on whether to go with perl.req or perldeps.pl
--requires, but here this is for what it's worth. No worries if it ends up on
the cutting room floor.

Comment 4 Jeff Johnson 2006-07-08 13:53:26 UTC
Yah, Requires: perl(the) comes back againa and again and again, everyone is dying to tell me about 
perl.req problems even if the real problem is the inability to upgrade rpm with a "fix" ;-)

The problem really needs to be approached per-distro release, not in rpm, since there are filters in 
pkgs as well as multiple versions of perl.req floating around.

Too bad that FC has insufficient QA clue to undertake running this rpm-4.4.3 command on an 
"everything" clean install:

    /usr/lib/rpm/rpmdeps --perl -vv

That command finds Provides: from all installed perl scripts, and matches against Requires: from 
packages, and prints out any unmatched dependencies.

The command is not perfect, mind you, there's an even better script on
    <rpm-perl.duke.edu>
but it also demonstrates how easy the QA pn perl(...) would be to do if anyone really cared.

Thanks for the patch.

Comment 5 Jeff Johnson 2006-07-08 14:08:14 UTC
Added to rpm cvs, will be in rpm-4.4.7-0.13 and later when built/released.

Comment 6 J. Randall Owens 2006-07-08 23:04:12 UTC
Oh, I forgot to mention, the patch also cleans up a few typos in comments, and
removes the irrelevant and probably cycle-wasting case-insensitive option on a
pair of regexps where it doesn't matter. Figured I might as well hit those while
I was at it.