コード例 #1
0
def test(filename):
        if not os.path.isfile(filename):
                return False

        try:
                SolarisPackage(filename)
                return True
        except:
                return False
コード例 #2
0
def test(filename):
    if not os.path.isfile(filename):
        return False

    try:
        SolarisPackage(filename)
        return True
    except MultiPackageDatastreamException:
        raise InvalidBundleException(
            _("Multi-package datastreams are not supported.\n"
              "Please use pkgtrans(1) to convert this bundle to "
              "multiple\nfilesystem format packages."))
    except:
        return False
コード例 #3
0
    def __init__(self, filename, data=True, **kwargs):
        filename = os.path.normpath(filename)
        self.pkg = SolarisPackage(filename)
        self.pkgname = self.pkg.pkginfo["PKG"]
        self.filename = filename
        self.data = data

        # map the path name to the SVR4 class it belongs to and
        # maintain a set of pre/post install/remove and class action
        # scripts this package uses.
        self.class_actions_dir = {}
        self.class_action_names = set()
        self.scripts = set()

        self.hollow = self.pkg.pkginfo.get("SUNW_PKG_HOLLOW",
                                           "").lower() == "true"
        # A list of pkg.action.AttributeActions with pkginfo
        # attributes for items that don't map to pkg(7) equivalents
        self.pkginfo_actions = self.get_pkginfo_actions(self.pkg.pkginfo)
コード例 #4
0
        def __init__(self, filename, targetpaths=()):
                self.pkg = SolarisPackage(filename)
                self.pkgname = self.pkg.pkginfo["PKG"]
                self.filename = filename

                # SolarisPackage.manifest is a list.  Cache it into a dictionary
                # based on pathname.  The cpio archive contains the files as
                # they would be in the directory structure -- that is, under
                # install, reloc, or root, depending on whether they're i-type
                # files, relocatable files, or unrelocatable files.  Make sure
                # we find the right object, even though the filenames in the
                # package map don't have these directory names.
                self.pkgmap = {}

                for p in self.pkg.manifest:
                        if p.type in "fevdsl":
                                if p.pathname.startswith("/"):
                                        dir = "root"
                                else:
                                        dir = "reloc/"
                                self.pkgmap[dir + p.pathname] = p
                        elif p.type == "i":
                                self.pkgmap["install/" + p.pathname] = p
コード例 #5
0
    def __init__(self, filename, **kwargs):
        filename = os.path.normpath(filename)
        self.pkg = SolarisPackage(filename)
        self.pkgname = self.pkg.pkginfo["PKG"]
        self.filename = filename

        # map the path name to the SVR4 class it belongs to and
        # maintain a set of pre/post install/remove and class action
        # scripts this package uses.
        self.class_actions_dir = {}
        self.class_action_names = set()
        self.scripts = set()

        self.hollow = self.pkg.pkginfo.get("SUNW_PKG_HOLLOW",
                                           "").lower() == "true"
        self.pkginfo_actions = self.get_pkginfo_actions(self.pkg.pkginfo)

        # SolarisPackage.manifest is a list.  Cache it into a dictionary
        # based on pathname.  The cpio archive contains the files as
        # they would be in the directory structure -- that is, under
        # install, reloc, or root, depending on whether they're i-type
        # files, relocatable files, or unrelocatable files.  Make sure
        # we find the right object, even though the filenames in the
        # package map don't have these directory names.
        self.pkgmap = {}

        for p in self.pkg.manifest:
            if p.type in "fevdsl":
                if p.pathname[0] == "/":
                    d = "root"
                else:
                    d = "reloc/"
                self.pkgmap[d + p.pathname] = p
                self.class_actions_dir[p.pathname] = p.klass
                self.class_action_names.add(p.klass)
            elif p.type == "i":
                self.pkgmap["install/" + p.pathname] = p
コード例 #6
0
 def __init__(self, filename, data=True, targetpaths=()):
         self.pkg = SolarisPackage(filename)
         self.pkgname = self.pkg.pkginfo["PKG"]
         self.filename = filename
         self.data = data