示例#1
0
    def detect(self):
        result = Issue.detect(self)
        if result is not None:
            return result

        dbname = os.path.join(Config.system.root, "/var/lib/rpm/Packages")
        self._happened = False

        if not os.path.isfile(os.path.realpath(dbname)):
            self._db_missing = True
            self._happened = True
            self._checked = True
            return True
        
        #verify the Package database
        rpm_verify = spawnvch(executable = "/usr/lib/rpm/rpmdb_verify", args = ["/usr/lib/rpm/rpmdb_verify", dbname], chroot = Config.system.root)
        err = rpm_verify.wait()
        if err!=0:
            return False

        if len(rpm_verify.stdout.read())>0:
            self._happened = True
        if len(rpm_verify.stderr.read())>0:
            self._happened = True

        self._checked = True
        return True
示例#2
0
    def detect(self):
        result = Issue.detect(self)
        if result is not None:
            return result

        path = os.path.join(Config.system.root,"/var/lib/rpm/")
        self.locks = []

        def walkfunc(arg, dirname, fnames):
            for f in fnames:
                if f[:4]=="__db" and os.path.isfile(os.path.join(dirname, f)):
                    arg.append(os.path.join(dirname, f))

        os.path.walk(path, walkfunc, self.locks)

        if len(self.locks)==0:
            self._happened = False
        else:
            self._happened = True

        self._checked = True
        return True
示例#3
0
    def detect(self):
        result = Issue.detect(self)
        if result is not None:
            return result

        architectures = {}

        for p in self.packages_list:
            architectures[p] = set()
            mi = self._plugin.rpm.dbMatch("name", p)
            for hdr in mi:
                self._plugin._reporting.debug(
                    level=TASK,
                    origin=self,
                    message="Found package %s with architecture %s" %
                    (p, hdr["arch"]))
                architectures[p].add(hdr["arch"])

        #is there a common architecture for all the packages?
        all = reduce(lambda acc, x: acc.union(x), architectures.values(),
                     set())
        common = reduce(lambda acc, x: acc.intersection(x),
                        architectures.values(), all)
        self._plugin._reporting.debug(
            level=TASK,
            origin=self,
            message="Common architecture for all packages is %s" %
            ("+".join(common), ))

        if len(common) == 0:
            self._happened = True
        else:
            self._happened = False

        self._checked = True
        return True