def buildActivePkgSack(self):
     sack = PackageSack()
     ainstRoot = AinstRoot(self._installRoot)
     if not ainstRoot.isValidAinstRoot():
         Log.cout(Log.DEBUG, '%s is invalid ainst root' % self._installRoot)
         return None
     reader = AinstRootReader(ainstRoot)
     activePkgMetas = reader.getActivePkgMetas()
     if activePkgMetas is None:
         Log.cout(Log.DEBUG, 'Get active meta of %s failed' % self._installRoot)
         return None
     for pkgName, rpmPath, aicfPath in activePkgMetas:
         aicfInfo = None
         if file_util.isFile(aicfPath):
             aicfInfo = AicfParser().parse(aicfPath)
         header = rpmutils.readRpmHeader(rpmPath)
         if header:
             repo = FakeRepository(self._installRoot, True)
             pkg = AinstRpmPackage(header, repo, aicfInfo)
             sack.addPackageObject(pkg)
     return sack
Beispiel #2
0
 def buildActivePkgSack(self):
     sack = PackageSack()
     ainstRoot = AinstRoot(self._installRoot)
     if not ainstRoot.isValidAinstRoot():
         Log.cout(Log.DEBUG, '%s is invalid ainst root' % self._installRoot)
         return None
     reader = AinstRootReader(ainstRoot)
     activePkgMetas = reader.getActivePkgMetas()
     if activePkgMetas is None:
         Log.cout(Log.DEBUG,
                  'Get active meta of %s failed' % self._installRoot)
         return None
     for pkgName, rpmPath, aicfPath in activePkgMetas:
         aicfInfo = None
         if file_util.isFile(aicfPath):
             aicfInfo = AicfParser().parse(aicfPath)
         header = rpmutils.readRpmHeader(rpmPath)
         if header:
             repo = FakeRepository(self._installRoot, True)
             pkg = AinstRpmPackage(header, repo, aicfInfo)
             sack.addPackageObject(pkg)
     return sack