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

        for f in self.locks:
            os.unlink(f)

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

        yum = spawnvch(executable="/usr/bin/yum",
                       args=["yum", "install"] + packages_list,
                       chroot=Config.system.root).communicate("y\ny\n")
        if yum.returncode == 0:
            self._fixed = True

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

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

        if not self._db_missing:
            #dump&load the database
            os.rename(dbname, dbname+".orig")
            err = spawnvch(executable = "/bin/sh", args = ["sh", "-c", "/usr/lib/rpm/rpmdb_dump /var/lib/rpm/Packages.orig | /usr/lib/rpm/rpmdb_load /var/lib/rpm/Packages"], chroot = Config.system.root).wait()
            if rpm.returncode!=0:
                os.rename(dbname+".orig", dbname)
                return False

        #rebuild the indexes
        rpm = spawnvch(executable = "/bin/rpm", args = ["rpm", "--rebuilddb"], chroot = Config.system.root).wait()
        if rpm.returncode==0:
            self._fixed = True
        return True