Пример #1
0
def load_package(package_stream):
    if package_stream.name.endswith(".deb"):
        try:
            header, payload_stream = rhn_deb.load(filename=package_stream.name)
        except:
            raise_with_tb(rhnFault(50, "Unable to load package", explain=0), sys.exc_info()[2])
    else:
        try:
            header, payload_stream = rhn_mpm.load(file=package_stream)
        except:
            raise_with_tb(rhnFault(50, "Unable to load package", explain=0), sys.exc_info()[2])

    payload_stream.seek(0, 0)
    if header.packaging == "mpm" or header.packaging == "deb":
        header.header_start = header.header_end = 0
        (header_start, header_end) = (0, 0)
    else:
        (header_start, header_end) = get_header_byte_range(payload_stream)
        payload_stream.seek(0, 0)

    return header, payload_stream, header_start, header_end
Пример #2
0
def load_package(package_stream):
    if package_stream.name.endswith('.deb'):
        try:
            header, payload_stream = rhn_deb.load(filename=package_stream.name)
        except:
            raise rhnFault(50, "Unable to load package", explain=0), None, sys.exc_info()[2]
    else:
        try:
            header, payload_stream = rhn_mpm.load(file=package_stream)
        except:
            raise rhnFault(50, "Unable to load package", explain=0), None, sys.exc_info()[2]

    payload_stream.seek(0, 0)
    if header.packaging == "mpm" or header.packaging == "deb":
        header.header_start = header.header_end = 0
        (header_start, header_end) = (0, 0)
    else:
        (header_start, header_end) = get_header_byte_range(payload_stream)
        payload_stream.seek(0, 0)

    return header, payload_stream, header_start, header_end