rpm.RPMTAG_SOURCERPM vs rpm.RPMTAG_SOURCEPACKAGE

Ville Skyttä <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
Hi,

http://yum.baseurl.org/gitweb?p=yum.git;a=commitdiff;h=066241a5b0b46671ea871908a27cb792ec491b49

I believe this change is broken and should be reverted - rpm.RPMTAG_SOURCERPM 
is the name-version-release.src.rpm string of the source rpm that a binary 
package was created from (so "1" will never match); and if the package is a 
source rpm, its RPMTAG_SOURCERPM is something evaluating to False (seemingly 
an empty list for me on F-9).  So things should have been ok before the above 
change.

Another way of testing whether a package is a source one is checking for 
rpm.RPMTAG_SOURCEPACKAGE (not RPMTAG_SOURCERPM) which should be 1 for source 
packages.  But based on 
http://osdir.com/ml/linux.redhat.rpm.devel/2006-04/msg00014.html I believe 
RPMTAG_SOURCEPACKAGE is a legacy thing already removed from rpm5.org, FWIW, 
and RPMTAG_SOURCERPM should work for both rpm.org and rpm5.org.

Anyway, I think RPMTAG_SOURCEPACKAGE still works for all rpm.org versions 
currently, but you want to use it, the code should be:

    if hdr[rpm.RPMTAG_SOURCEPACKAGE] == 1:
        arch = 'src'
    else:
        arch = hdr['arch']

...and _not_:

    if hdr[rpm.RPMTAG_SOURCEPACKAGE] == 1:
        arch = hdr['arch']
    else:
        arch = 'src'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.