#3 Download only the package header, not complete RPMs.
Merged by jkaluza. Opened by jkaluza.
jkaluza/rpmdeplint download-header  into  master

Download 3.patch

Currently, the rpmdpelint downloads the complete RPMs just to load
their headers to check for file conflicts. This is waste of time
and resouces.

This commit changes this to download only RPM headers.

There is no function provided by the Python rpm module which would
return the size of RPM header. The code therefore tries to download
first N bytes of the RPM file and checks if the header is complete or
not using the hdrFromFdno RPM funtion.

As the header size can be very different from package to package, it
tries to download first 100KB and if header is not complete, it
fallbacks to 1MB and 5MB. If that is not enough, the final fallback
downloads whole RPM file.

This strategy still wastes some bandwidth, because we are downloading
first N bytes repeatedly, but because header of typical RPM fits
into first 100KB usually and because the RPM data is much bigger than
what we download repeatedly, it saves lot of time and bandwidth overall.

Checksums cannot be checked by this method, because checksums work
only when complete RPM file is downloaded.

Signed-off-by: Jan Kaluza jkaluza@redhat.com

rebased onto d8acfc679e198aa7b2529569f169172b2db47ade

I've tested this on few builds. My test data for "podman" build shows that without this patch it was running 4:00 while with this patch it was running for 1:33.

Pull-Request has been merged by jkaluza

Metadata