def _installInTmpDir(self, pkg, ainstTmpPkgDir):
        rpmFilePath = self._getRpmFilePath(pkg)
        if not rpmFilePath:
            return False

        if not file_util.makeDir(ainstTmpPkgDir, True):
            Log.cout(Log.ERROR, 'Prepare tmp dir for install failed')
            return False

        if not rpmutils.rpm2dir(rpmFilePath, ainstTmpPkgDir):
            Log.cout(Log.ERROR, 'Rpm %s to dir failed' % rpmFilePath)
            return False

        # disable dir checking
        # if not self._changeToValidRootDir(ainstTmpPkgDir):
        #     Log.cout(Log.ERROR, 'Change to valid root dir failed')
        #     return False

        if not file_util.makeDir(ainstTmpPkgDir + '/ainst'):
            return False
        if not file_util.copyFile(rpmFilePath,
                                  ainstTmpPkgDir + self._bakRpmPath):
            Log.cout(Log.ERROR, 'Copy installed.rpm failed')
            return False
        return True
Exemple #2
0
    def _installInTmpDir(self, pkg, ainstTmpPkgDir):
        rpmFilePath = self._getRpmFilePath(pkg)
        if not rpmFilePath:
            return False

        if not file_util.makeDir(ainstTmpPkgDir, True):
            Log.cout(Log.ERROR, 'Prepare tmp dir for install failed')
            return False

        if not rpmutils.rpm2dir(rpmFilePath, ainstTmpPkgDir):
            Log.cout(Log.ERROR, 'Rpm %s to dir failed' % rpmFilePath)
            return False

        # disable dir checking
        # if not self._changeToValidRootDir(ainstTmpPkgDir):
        #     Log.cout(Log.ERROR, 'Change to valid root dir failed')
        #     return False

        if not file_util.makeDir(ainstTmpPkgDir + '/ainst'):
            return False
        if not file_util.copyFile(rpmFilePath,
                                  ainstTmpPkgDir + self._bakRpmPath):
            Log.cout(Log.ERROR, 'Copy installed.rpm failed')
            return False
        return True
Exemple #3
0
 def _generateConfigByCopy(self, srcPath, destPath):
     if not file_util.copyFile(srcPath, destPath):
         Log.cout(Log.ERROR, 'Generat config file %s failed' % destPath)
         return False
     return True