Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download only the package header, not complete RPMs. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Feb 28, 2022

  1. Download only the package header, not complete RPMs.

    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>
    Jan Kaluza committed Feb 28, 2022
    Configuration menu
    Copy the full SHA
    14ea840 View commit details
    Browse the repository at this point in the history