[Rpm-maint] [PATCH] Auto convert hdr['epoch'] from None to 0

Panu Matilainen pmatilai at redhat.com
Fri Nov 20 13:51:03 UTC 2009


On Fri, 20 Nov 2009, James Antill wrote:

> On Fri, 2009-11-20 at 10:07 +0200, Panu Matilainen wrote:
>> NAK. Sure for rpm internals no epoch is the same as epoch 0, but it's not
>> the same for all uses: you might not want to show the million useless zero
>> epochs to users,
>
> I'm not sure I understand, you need special code to not show the zero
> no matter what. If you forget to check, and fixup, epoch you get output
> like:
>
> yum-None:3.2.25-1.noarch
>
> ...so atm. you are required to check epoch twice if you don't want to
> output "0:" ... after the patch you'd only need to check it once.

Except with the patch you no longer know whether the package actually has 
a zero epoch or no epoch. That's bitten me enough times with repodata in 
various ways...

> Also, AFAIK, any sane API user must be able to handle both None and '0'
> and treat them identically ... which pretty much guarantees that all API
> users will convert None to '0' immediately.
> Everytime we've forgotten to immediately fix epoch, in yum, it's been a
> bug.

In the meanwhile, I added RPMTAG_EPOCHNUM extension which gives you the 
zero if the package doesn't have an epoch without changing longstanding 
behavior and risking breaking who knows what. So if yum wants to show zero 
epochs everywhere, just replace all uses of 'epoch' with 'epochnum' and 
rip the special casing.

FWIW there are some other new related "convenience" extensions in rpm.org 
HEAD too (for some time now): RPMTAG_NEVR, RPMTAG_NEVRA, RPMTAG_EVR and a 
few others that handle the missing epoch (by not showing it) 
automatically.

>
>>  and the above would make it impossible to determine which
>> packages actually *have* set an epoch (if only for distro statistics
>> collection or whatever).
>
> That's true, but does it really matter? What use are those stats?
> I guess approaching it from the other point of view, what do you think
> about changing rpmbuild to always store '0' in epoch?

That wouldn't make the special cases go anywhere as long as rpm can read 
current (v3 and v4) packages.

 	- Panu -


More information about the Rpm-maint mailing list