Re: rpm.RPMTAG_SOURCERPM vs rpm.RPMTAG_SOURCEPACKAGE

Panu Matilainen <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <[email protected]>
On Fri, 23 Jan 2009, Ville Skyttä wrote:

> 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'

Yup, what was there before was correct (and identical to what rpm itself 
uses) - the existence of RPMTAG_SOURCERPM tag means it's a binary, 
otherwise it's a source.

I'd suggest changing it back to what it was, as RPMTAG_SOURCEPACKAGE 
doesn't really even exist in packages: from what I can tell by digging 
ancient rpm commits from the nineties, it's always been added on the fly.

 	- Panu -


 	- Panu -
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.