[Rpm-maint] Is there a proper way how to get byte range of header?

Panu Matilainen pmatilai at redhat.com
Thu Jun 5 04:47:15 UTC 2014


On 06/04/2014 03:21 PM, Tomas Mlcoch wrote:
>>> Hi,
>>> as you may know, the primary repodata contains information about header
>>> byte range, e.g.:
>>> <rpm:header-range start="1384" end="1050136"/>
>>>
>>> AFAIK, the rpm library doesn't provide any way how to get this information
>>> and tools like createrepo[1] or createrepo_c[2] have to do it by itself.
>>>
>>> It would be nice if the rpm library had such functionality included, so all
>>> tools, which need this information, could use a standard way how to get it
>>> and also it would be handy for case that the header format will change in
>>> future.
>>>
>>> Is there any plan to add such function into the rpm or it is already there
>>> and I've missed something?
>>
>> Does something still use that data? AFAIK the header byte range in
>> repodata is nothing but a hack which yum needed at dawn of times, but
>> long since unneeded.
>>
>> Anyway, you can get it indirectly: after rpmReadPackageFile(), Ftell()
>> on the file descriptor will give you the header end. Substract the size
>> of RPMTAG_HEADERIMMUTABLE data from the header from the end offset to
>> get the start offset.
>>
>> 	- Panu -
>
> Thanks!
>
> I have no idea if someone uses this.
>
> Personally, I think it could be useful for these who only want to download headers and operate on them (e.g. extract some additional data that are not part of repodata but doesn't need the payload). But have no idea if it's a valid use-case..

BTW, I had a fairly strong sense of deja vu when writing the above... 
and now I remembered why: http://rpm.org/ticket/850 :)

	- Panu -


More information about the Rpm-maint mailing list