Exemple #1
0
def get_header(file, fildes=None, source=None):
    # rhn_mpm.get_package_header will choose the right thing to do - open the
    # file or use the provided open file descriptor)
    h = rhn_mpm.get_package_header(filename=file, fd=fildes)

    # Verify that this is indeed a binary/source. xor magic
    # xor doesn't work with None values, so compare the negated values - the
    # results are identical
    if (not source) ^ (not h.is_source):
        raise UploadError("Unexpected RPM package type")
    return h
            "Level:", package.diff.level)
        pdict = package.toDict()
        orig_path = package['path']
        orig_path = os.path.join(CFG.MOUNT_POINT, orig_path)
        log_debug(4, "Original package", orig_path)

        # Determine the type of packaging that was used to create the package.
        packaging = 'rpm'
        if hasattr(header, 'packaging'):
            packaging = header.packaging

        # MPMs do not store their headers on disk, so we must avoid performing
        # operations which rely on information only contained in the headers
        # (such as header signatures).
        if os.path.exists(orig_path) and packaging != 'mpm':
            oh = rhn_mpm.get_package_header(orig_path)
            _diff_header_sigs(header, oh, pdict['diff']['diff'])

        return pdict, package.diff.level


    # Remove any pending scheduled file deletion for this package
    h = rhnSQL.prepare("""
        delete from rhnPackageFileDeleteQueue where path = :path
    """)
    h.execute(path=relative_path)

    if package.diff and not force and package.diff.level:
        #No need to copy it - just the path is modified
        #pkilambi bug#180347
        #case 1:check if the path exists in the db and also on the file system.