Example #1
0
 def test_simple(self):
     # unpack_source unpacks in a temporary directory and returns the
     # path.
     temp_dir = self.makeTemporaryDirectory()
     extract_dpkg_source(
         datadir(os.path.join('suite', 'bar_1.0-1', 'bar_1.0-1.dsc')),
         temp_dir)
     self.assertEquals(["bar-1.0"], os.listdir(temp_dir))
     self.assertContentEqual(
         ["THIS_IS_BAR", "debian"],
         os.listdir(os.path.join(temp_dir, "bar-1.0")))
Example #2
0
 def test_simple(self):
     # unpack_source unpacks in a temporary directory and returns the
     # path.
     temp_dir = self.makeTemporaryDirectory()
     extract_dpkg_source(
         datadir(os.path.join('suite', 'bar_1.0-1', 'bar_1.0-1.dsc')),
         temp_dir)
     self.assertEqual(["bar-1.0"], os.listdir(temp_dir))
     self.assertContentEqual(
         ["THIS_IS_BAR", "debian"],
         os.listdir(os.path.join(temp_dir, "bar-1.0")))
Example #3
0
def unpack_dsc(package, version, component, distro_name, archive_root):
    dsc_name, dsc_path, component = get_dsc_path(package, version, component,
                                                 archive_root)
    try:
        extract_dpkg_source(dsc_path, ".", vendor=distro_name)
    except DpkgSourceError as e:
        raise ExecutionError("Error %d unpacking source" % e.result)

    version = re.sub("^\d+:", "", version)
    version = re.sub("-[^-]+$", "", version)
    source_dir = "%s-%s" % (package, version)
    return source_dir, dsc_path
Example #4
0
def unpack_dsc(package, version, component, distro_name, archive_root):
    dsc_name, dsc_path, component = get_dsc_path(package, version,
                                                 component, archive_root)
    try:
        extract_dpkg_source(dsc_path, ".", vendor=distro_name)
    except DpkgSourceError as e:
        raise ExecutionError("Error %d unpacking source" % e.result)

    version = re.sub("^\d+:", "", version)
    version = re.sub("-[^-]+$", "", version)
    source_dir = "%s-%s" % (package, version)
    return source_dir, dsc_path
Example #5
0
def unpack_source(dsc_filepath):
    """Unpack a source package into a temporary directory

    :param dsc_filepath: Path to the dsc file
    :return: Path to the temporary directory with the unpacked sources
    """
    # Get a temporary dir together.
    unpacked_dir = tempfile.mkdtemp()
    try:
        extract_dpkg_source(dsc_filepath, unpacked_dir)
    except:
        shutil.rmtree(unpacked_dir)
        raise

    return unpacked_dir
Example #6
0
def unpack_source(dsc_filepath):
    """Unpack a source package into a temporary directory

    :param dsc_filepath: Path to the dsc file
    :return: Path to the temporary directory with the unpacked sources
    """
    # Get a temporary dir together.
    unpacked_dir = tempfile.mkdtemp()
    try:
        extract_dpkg_source(dsc_filepath, unpacked_dir)
    except:
        shutil.rmtree(unpacked_dir)
        raise

    return unpacked_dir