Exemplo n.º 1
0
    def do_package(self, distro_name, archive_root):
        """Grab shared library info from .deb."""
        fullpath = os.path.join(archive_root, self.filename)
        if not os.path.exists(fullpath):
            raise PoolFileNotFound('%s not found' % fullpath)

        call("dpkg -e %s" % fullpath)
        shlibfile = os.path.join("DEBIAN", "shlibs")
        if os.path.exists(shlibfile):
            self.shlibs = open(shlibfile).read().strip()
            log.debug("Grabbing shared library info from %s" % shlibfile)
Exemplo n.º 2
0
    def do_package(self, distro_name, archive_root):
        """Grab shared library info from .deb."""
        fullpath = os.path.join(archive_root, self.filename)
        if not os.path.exists(fullpath):
            raise PoolFileNotFound('%s not found' % fullpath)

        call("dpkg -e %s" % fullpath)
        shlibfile = os.path.join("DEBIAN", "shlibs")
        if os.path.exists(shlibfile):
            self.shlibs = open(shlibfile).read().strip()
            log.debug("Grabbing shared library info from %s" % shlibfile)
Exemplo n.º 3
0
 def openTagFile(self, prefix):
     for suffix in (".xz", ".bz2", ".gz", ""):
         if os.path.exists(prefix + suffix):
             # Extract index.
             fd, tagfile = tempfile.mkstemp()
             if suffix == ".xz":
                 call("xz -dc %s > %s" % (prefix + suffix, tagfile))
             elif suffix == ".bz2":
                 call("bzip2 -dc %s > %s" % (prefix + suffix, tagfile))
             elif suffix == ".gz":
                 call("gzip -dc %s > %s" % (prefix + suffix, tagfile))
             elif suffix == "":
                 shutil.copy(prefix + suffix, tagfile)
             else:
                 raise AssertionError("Unknown suffix '%s'" % suffix)
             return os.fdopen(fd), tagfile
     else:
         raise MangledArchiveError("Archive missing any variant of %s" %
                                   prefix)
Exemplo n.º 4
0
    def __init__(self, root, distroseries, component, arch=None,
                 source_only=False):

        # Holds the distribution informations
        self.distroseries = distroseries
        self.component = component
        self.arch = arch
        self.source_only = source_only

        dist_dir = os.path.join(root, "dists", distroseries, component)
        if not os.path.exists(dist_dir):
            raise MangledArchiveError("No archive directory for %s/%s" %
                                      (distroseries, component))

        # Search and get the files with full path
        sources_zipped = os.path.join(root, "dists", distroseries,
                                      component, "source", "Sources.gz")
        if not os.path.exists(sources_zipped):
            raise MangledArchiveError("Archive missing Sources.gz at %s"
                                      % sources_zipped)

        # Extract Sources index.
        srcfd, sources_tagfile = tempfile.mkstemp()
        call("gzip -dc %s > %s" % (sources_zipped, sources_tagfile))
        srcfile = os.fdopen(srcfd)

        # Holds the opened files and its names.
        self.sources_tagfile = sources_tagfile
        self.srcfile = srcfile

        # Detect source-only mode and skip binary index parsing.
        if source_only:
            return

        # Extract Binaries indexes.
        dist_bin_dir = os.path.join(dist_dir, "binary-%s" % arch)
        if not os.path.exists(dist_bin_dir):
            raise NoBinaryArchive

        binaries_zipped = os.path.join(dist_bin_dir, "Packages.gz")
        if not os.path.exists(binaries_zipped):
            raise MangledArchiveError("Archive mising Packages.gz at %s"
                                      % binaries_zipped)
        di_zipped = os.path.join(root, "dists", distroseries, component,
                                 "debian-installer", "binary-%s" % arch,
                                 "Packages.gz")
        # Extract Binary indexes.
        binfd, binaries_tagfile = tempfile.mkstemp()
        call("gzip -dc %s > %s" % (binaries_zipped, binaries_tagfile))
        binfile = os.fdopen(binfd)

        difd, di_tagfile = tempfile.mkstemp()
        if os.path.exists(di_zipped):
            call("gzip -dc %s > %s" % (di_zipped, di_tagfile))
        difile = os.fdopen(difd)

        # Holds the opened files and its names.
        self.binaries_tagfile = binaries_tagfile
        self.binfile = binfile
        self.di_tagfile = di_tagfile
        self.difile = difile
Exemplo n.º 5
0
    def __init__(self,
                 root,
                 distroseries,
                 component,
                 arch=None,
                 source_only=False):

        # Holds the distribution informations
        self.distroseries = distroseries
        self.component = component
        self.arch = arch
        self.source_only = source_only

        dist_dir = os.path.join(root, "dists", distroseries, component)
        if not os.path.exists(dist_dir):
            raise MangledArchiveError("No archive directory for %s/%s" %
                                      (distroseries, component))

        # Search and get the files with full path
        sources_zipped = os.path.join(root, "dists", distroseries, component,
                                      "source", "Sources.gz")
        if not os.path.exists(sources_zipped):
            raise MangledArchiveError("Archive missing Sources.gz at %s" %
                                      sources_zipped)

        # Extract Sources index.
        srcfd, sources_tagfile = tempfile.mkstemp()
        call("gzip -dc %s > %s" % (sources_zipped, sources_tagfile))
        srcfile = os.fdopen(srcfd)

        # Holds the opened files and its names.
        self.sources_tagfile = sources_tagfile
        self.srcfile = srcfile

        # Detect source-only mode and skip binary index parsing.
        if source_only:
            return

        # Extract Binaries indexes.
        dist_bin_dir = os.path.join(dist_dir, "binary-%s" % arch)
        if not os.path.exists(dist_bin_dir):
            raise NoBinaryArchive

        binaries_zipped = os.path.join(dist_bin_dir, "Packages.gz")
        if not os.path.exists(binaries_zipped):
            raise MangledArchiveError("Archive mising Packages.gz at %s" %
                                      binaries_zipped)
        di_zipped = os.path.join(root, "dists", distroseries, component,
                                 "debian-installer", "binary-%s" % arch,
                                 "Packages.gz")
        # Extract Binary indexes.
        binfd, binaries_tagfile = tempfile.mkstemp()
        call("gzip -dc %s > %s" % (binaries_zipped, binaries_tagfile))
        binfile = os.fdopen(binfd)

        difd, di_tagfile = tempfile.mkstemp()
        if os.path.exists(di_zipped):
            call("gzip -dc %s > %s" % (di_zipped, di_tagfile))
        difile = os.fdopen(difd)

        # Holds the opened files and its names.
        self.binaries_tagfile = binaries_tagfile
        self.binfile = binfile
        self.di_tagfile = di_tagfile
        self.difile = difile