def execute(self):
        Log.cout(Log.INFO, 'Remove pkg %s ...' % self._pkg)
        if self._dryrun:
            return True
        if self._executed:
            return False
        self._executed = True

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir('packages') + pkgDirName
        self._settingPath = self._ainstRoot.getRootVarAinstDir('settings') + self._pkg.name

        if not self._removeSettings():
            Log.cout(Log.ERROR, 'Remove setting of pkg %s failed' % self._pkg.name)
            self.undo()
            return False

        if not self._removePkgDir(pkgDirName):
            Log.cout(Log.ERROR, 'Remove packages dir of %s failed' % self._pkg)
            self.undo()
            return False

        Log.cout(Log.DEBUG, 'Remove pkg %s success' % self._pkg)
        return True
    def _getScriptContent(self, action):
        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return None

        self._ainstActivePkg = self._ainstRoot.getRootVarAinstDir('active') + self._pkg.name
        if not self._isActive(self._ainstActivePkg, pkgDirName):
            Log.cout(Log.ERROR, 'Package %s is not active' % self._pkg)
            return None

        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir('packages') + pkgDirName
        aicfFile = self._ainstPkgDir + '/ainst/' + self._pkg.name + '.aicf'
        if not file_util.isFile(aicfFile):
            return None

        aicfInfo = AicfParser().parse(aicfFile)
        if not aicfInfo or not AicfInfoWrapper().removeConfigPrefix(aicfInfo) \
                or not self._checkAicfInfo(aicfInfo):
            Log.cout(Log.ERROR, 'Aicf info of pkg %s is illegal' % self._pkg)
            return None

        if not aicfInfo.scripts.has_key(action):
            Log.cout(Log.ERROR, 'Pkg %s has no %s script' % (self._pkg, action))
            return None
        
        return aicfInfo.scripts[action]
Beispiel #3
0
 def getConflicts(self, obj):
     if not self.indexBuilt:
         self.buildIndex()
     result = {}
     for pkgObject in self.conflictPkgDict.get(obj.name, []):
         conflicts = PackageUtil.matchingConflict(pkgObject, obj)
         if conflicts:
             result[pkgObject] = conflicts
     return result
Beispiel #4
0
 def getConflicts(self, obj):
     if not self.indexBuilt:
         self.buildIndex()
     result = {}
     for pkgObject in self.conflictPkgDict.get(obj.name, []):
         conflicts = PackageUtil.matchingConflict(pkgObject, obj)
         if conflicts:
             result[pkgObject] = conflicts
     return result
Beispiel #5
0
 def getRequires(self, obj):
     '''return dict: {packageObject:[require, require, ...]}'''
     if not self.indexBuilt:
         self.buildIndex()
     result = {}
     for pkgObject in self.requirePkgDict.get(obj.name, []):
         requires = PackageUtil.matchingRequire(pkgObject, obj)
         if requires:
             result[pkgObject] = requires
     return result
Beispiel #6
0
 def getRequires(self, obj):
      '''return dict: {packageObject:[require, require, ...]}'''
      if not self.indexBuilt:
          self.buildIndex()
      result = {}
      for pkgObject in self.requirePkgDict.get(obj.name, []):
          requires = PackageUtil.matchingRequire(pkgObject, obj)
          if requires:
              result[pkgObject] = requires
      return result
Beispiel #7
0
    def getConflicts(self, conflict):
        name, version = conflict.name, conflict.version
        if conflict in self._conflictCache:
            return self._conflictCache[conflict]

        pkgs = self.searchPkgByConflict(name)
        result = {}
        for pkgObj in pkgs:
            conflicts = PackageUtil.matchingProvide(pkgObj, conflict)
            if conflicts:
                result[pkgObj] = conflicts
        self._conflictCache[conflict] = result
        return result
Beispiel #8
0
    def getConflicts(self, conflict):
        name, version = conflict.name, conflict.version
        if conflict in self._conflictCache:
            return self._conflictCache[conflict]

        pkgs = self.searchPkgByConflict(name)
        result = {}
        for pkgObj in pkgs:
            conflicts = PackageUtil.matchingProvide(pkgObj, conflict)
            if conflicts:
                result[pkgObj] = conflicts
        self._conflictCache[conflict] = result
        return result
Beispiel #9
0
    def getProvides(self, provide):
        name, version = provide.name, provide.version
        if provide in self._provideCache:
            return self._provideCache[provide]

        pkgs = self.searchPkgByProvide(name)
        result = {}
        for pkgObj in pkgs:
            if name[0] == '/' and version is None:
                result[pkgObj] = [Provide(name, None, None, None, None)]
            provides = PackageUtil.matchingProvide(pkgObj, provide)
            if provides:
                result[pkgObj] = provides
        self._provideCache[provide] = result
        return result
Beispiel #10
0
 def getProvides(self, obj):
      '''return dict: {packageObject:[provide, provide, ...]}'''
      if not self.indexBuilt:
          self.buildIndex()
      result = {}
      for pkgObject in self.providePkgDict.get(obj.name, []):
          provides = PackageUtil.matchingProvide(pkgObject, obj)
          if provides:
              result[pkgObject] = provides
      #if obj.name[0] == '/':
      #    tmpProvide = Require()
      #    tmpProvide.name = name
      #    for pkgObject in self.searchFilesByName(name):
      #        result.setdefault(pkgObject, []).append(tmpProvide)
      return result
Beispiel #11
0
    def getProvides(self, provide):
        name, version = provide.name, provide.version
        if provide in self._provideCache:
            return self._provideCache[provide]

        pkgs = self.searchPkgByProvide(name)
        result = {}
        for pkgObj in pkgs:
            if name[0] == '/' and version is None:
                result[pkgObj] = [Provide(name, None, None, None, None)]
            provides = PackageUtil.matchingProvide(pkgObj, provide)
            if provides:
                result[pkgObj] = provides
        self._provideCache[provide] = result
        return result
Beispiel #12
0
 def getProvides(self, obj):
     '''return dict: {packageObject:[provide, provide, ...]}'''
     if not self.indexBuilt:
         self.buildIndex()
     result = {}
     for pkgObject in self.providePkgDict.get(obj.name, []):
         provides = PackageUtil.matchingProvide(pkgObject, obj)
         if provides:
             result[pkgObject] = provides
     #if obj.name[0] == '/':
     #    tmpProvide = Require()
     #    tmpProvide.name = name
     #    for pkgObject in self.searchFilesByName(name):
     #        result.setdefault(pkgObject, []).append(tmpProvide)
     return result
Beispiel #13
0
    def getRequires(self, require):
        name, version = require.name, require.version
        if require in self._requireCache:
            return self._requireCache[require]

        pkgs = self.searchPkgByRequire(name)
        result = {}
        for pkgObj in pkgs:
            if name[0] == '/' and version is None:
                result[pkgObj] = [Require(name, None, None, None, None)]
                continue
            requires = PackageUtil.matchingRequire(pkgObj, require)
            if requires:
                result[pkgObj] = requires
        self._requireCache[require] = result
        return result
Beispiel #14
0
    def getRequires(self, require):
        name, version  = require.name, require.version
        if require in self._requireCache:
            return self._requireCache[require]

        pkgs = self.searchPkgByRequire(name)
        result = {}
        for pkgObj in pkgs:
            if name[0] == '/' and version is None:
                result[pkgObj] = [Require(name, None, None, None, None)]
                continue
            requires = PackageUtil.matchingRequire(pkgObj, require)
            if requires:
                result[pkgObj] = requires
        self._requireCache[require] = result
        return result
Beispiel #15
0
    def execute(self):
        Log.cout(Log.INFO, 'Install pkg %s ...' % self._pkg)
        if self._dryrun:
            return True

        if self._executed:
            Log.cout(Log.DEBUG, 'Install %s has always executed' % self._pkg)
            return False
        self._executed = True

        ret, self._rootInitTrace = self._ainstRoot.init()
        if not ret:
            Log.cout(Log.ERROR, 'Init ainst root failed')
            return False

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir(
            'packages') + pkgDirName
        if file_util.isDir(self._ainstPkgDir):
            Log.cout(Log.INFO, 'Package %s is always installed' % self._pkg)
            return True

        self._ainstTmpPkgDir = self._ainstRoot.getRootVarAinstDir(
            'tmp') + pkgDirName
        if not self._installInTmpDir(self._pkg, self._ainstTmpPkgDir):
            Log.cout(Log.ERROR,
                     'Install pkg %s to tmp dir failed' % pkgDirName)
            self.undo()
            return False

        if not file_util.move(self._ainstTmpPkgDir, self._ainstPkgDir):
            Log.cout(Log.ERROR,
                     'Move pkg %s to packages dir failed' % self._pkg)
            self.undo()
            return False

        self._success = True
        Log.cout(Log.DEBUG, 'Install pkg %s success' % self._pkg)
        return True
    def execute(self):
        Log.cout(Log.INFO, 'Install pkg %s ...' % self._pkg)
        if self._dryrun:
            return True

        if self._executed:
            Log.cout(Log.DEBUG, 'Install %s has always executed' % self._pkg)
            return False
        self._executed = True

        ret, self._rootInitTrace = self._ainstRoot.init()
        if not ret:
            Log.cout(Log.ERROR, 'Init ainst root failed')
            return False

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir('packages') + pkgDirName
        if file_util.isDir(self._ainstPkgDir):
            Log.cout(Log.INFO, 'Package %s is always installed' % self._pkg)
            return True

        self._ainstTmpPkgDir = self._ainstRoot.getRootVarAinstDir('tmp') + pkgDirName
        if not self._installInTmpDir(self._pkg, self._ainstTmpPkgDir):
            Log.cout(Log.ERROR, 'Install pkg %s to tmp dir failed' % pkgDirName)
            self.undo()
            return False

        if not file_util.move(self._ainstTmpPkgDir, self._ainstPkgDir):
            Log.cout(Log.ERROR, 'Move pkg %s to packages dir failed' % self._pkg)
            self.undo()
            return False

        self._success = True
        Log.cout(Log.DEBUG, 'Install pkg %s success' % self._pkg)
        return True
Beispiel #17
0
    def execute(self):
        if self._dryRun:
            if self._unsetKeySet:
                Log.cout(Log.INFO, 'Unset pkg %s settings...' % self._pkg.name)
                for key in self._unsetKeySet:
                    Log.coutValue(Log.INFO, 'unset', key)
            return True
        if self._executed:
            return False
        self._executed = True

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        #get active dir and package dir
        ainstActivePkg = self._ainstRoot.getRootVarAinstDir('active') + self._pkg.name
        if not self._isActive(ainstActivePkg, pkgDirName):
            Log.cout(Log.ERROR, 'Package %s is not active' % self._pkg)
            return False
        ainstPkgDir = self._ainstRoot.getRootVarAinstDir('packages') + pkgDirName
        getRet, aicfInfo = self._getAicfInfo(ainstPkgDir, self._pkg)
        if not getRet:
            Log.cout(Log.ERROR, 'Get aicfInfo of %s failed' % self._pkg)
            return False            

        if aicfInfo is None:
            Log.cout(Log.INFO, 'No aicf, will not do effective action')
            return True

        #get settings from setting file
        settingPath = self._ainstRoot.getRootVarAinstDir('settings') + self._pkg.name
        srcSettings = SettingStreamer().parse(settingPath)
        if srcSettings is None:
            srcSettings = {}
        newSettings = self._unsetSettings(srcSettings, self._unsetKeySet)

        settingsEnv = self._generateSettingsEnv(newSettings)
        ainstDirPath = ainstPkgDir + '/ainst/'
        ainstPathEnv = {self._ainstDirKey : ainstDirPath}
        self._exportToEnv(ainstPathEnv)
        self._exportToEnv(settingsEnv)
        settingMap = {}
        settingMap.update(newSettings)
        settingMap[self._ainstRoot.getInstallRootEnvKey()] = self._ainstRoot.getRoot()
        settingMap.update(ainstPathEnv)
        ret = self._generateConfigToRoot(ainstPkgDir, aicfInfo,
                                         settingMap, self._confBakDict)
        self._removeFromEnv(settingsEnv)
        self._removeFromEnv(ainstPathEnv)

        if not ret:
            Log.cout(Log.ERROR, 'Generate config of %s to root failed' % self._pkg.name)
            self.undo()
            return False

        if not SettingStreamer().dump(newSettings, settingPath):
            Log.cout(Log.ERROR, 'Dump settings of %s failed' % self._pkg.name)
            self.undo()
            return False
        self._bakSettings = srcSettings
        return True
Beispiel #18
0
    def execute(self):
        Log.cout(Log.INFO, 'Activate pkg %s ...' % self._pkg)
        if self._dryrun:
            return True
        if self._executed:
            return False
        self._executed = True

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        #get active dir and package dir
        self._ainstActivePkg = self._ainstRoot.getRootVarAinstDir(
            'active') + self._pkg.name
        if self._isActive(self._ainstActivePkg, pkgDirName):
            Log.cout(Log.INFO, 'Package %s is always active' % self._pkg)
            return True
        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir(
            'packages') + pkgDirName
        if not file_util.isDir(self._ainstPkgDir):
            Log.cout(Log.ERROR, 'Package %s is not installed' % self._pkg)
            return False

        #get aicf info
        ainstDirPath = self._ainstPkgDir + '/ainst/'
        self._ainstPathEnv = {self._ainstDirKey: ainstDirPath}
        aicfFile = ainstDirPath + self._pkg.name + '.aicf'
        if file_util.isFile(aicfFile):
            self._aicfInfo = AicfParser().parse(aicfFile)
            if not self._aicfInfo or not AicfInfoWrapper().removeConfigPrefix(self._aicfInfo) \
                    or not self._checkAicfInfo(self._aicfInfo):
                Log.cout(Log.ERROR,
                         'Aicf info of pkg %s is illegal' % self._pkg)
                return False

        #calc settings
        settingPath = self._ainstRoot.getRootVarAinstDir(
            'settings') + self._pkg.name
        backSettings = SettingStreamer().parse(settingPath)
        if backSettings is None:
            Log.cout(Log.ERROR, 'Parse settings of pkg %s  failed' % self._pkg)
            return False
        useSettings = {}
        useSettings.update(backSettings)
        self._mergeSettings(useSettings, self._aicfInfo, self._cliSettings,
                            self._unsetKeySet)

        self._settingsEnv = self._generateSettingsEnv(useSettings)

        #get rpm file infos
        bakRpmFile = self._ainstPkgDir + self._ainstRoot.getBackRpmPath()
        rpmFileInfoList = RpmFileWrapper().convert(bakRpmFile)
        if rpmFileInfoList is None:
            Log.cout(Log.ERROR, 'Get rpm file info failed: %s', bakRpmFile)
            return False

        if not self._processScriptByName('pre-activate'):
            return False

        #link common files and makedir if needed
        if not self._linkPkgToRoot(rpmFileInfoList, self._linkList,
                                   self._mkdirList):
            Log.cout(Log.ERROR, 'Link pkg %s dir to root failed' % self._pkg)
            self.undo()
            return False

        #generate a new config file and copy to root dir
        self._exportToEnv(self._ainstPathEnv)
        self._exportToEnv(self._settingsEnv)
        settingMap = {}
        settingMap.update(useSettings)
        settingMap[self._ainstRoot.getInstallRootEnvKey(
        )] = self._ainstRoot.getRoot()
        settingMap.update(self._ainstPathEnv)
        ret = self._generateConfigToRoot(rpmFileInfoList, self._aicfInfo,
                                         settingMap, self._confSet)
        self._removeFromEnv(self._settingsEnv)
        self._removeFromEnv(self._ainstPathEnv)
        if not ret:
            Log.cout(Log.ERROR, 'Generate config of pkg %s failed' % self._pkg)
            self.undo()
            return False

        #seralize to setting files
        if len(useSettings) > 0:
            if not SettingStreamer().dump(useSettings, settingPath):
                Log.cout(Log.ERROR,
                         'Save settings of pkg %s failed' % self._pkg)
                self.undo()
                return False
            self._backSettings = backSettings

        self._modifyDb = self._addFileToDb()
        if not self._modifyDb:
            Log.cout(Log.ERROR, 'Modify db failed')
            self.undo()
            return False

        if not self._generateCrontabFile():
            Log.cout(Log.ERROR, 'Generate crontab failed')
            self.undo()
            return False

        #do symbol link from package dir to active dir
        relativePkgPath = self._getActiveRelativePath(pkgDirName)
        self._linkToActive, self._lastActivePkg = self._symLinkToActive(
            relativePkgPath, self._ainstActivePkg)
        if not self._linkToActive:
            Log.cout(Log.ERROR,
                     'SymLink pkg %s dir to active failed' % self._pkg)
            self.undo()
            return False

        if not self._processScriptByName('post-activate'):
            self.undo()
            return False
        self._processStartScript(useSettings)

        self._success = True
        Log.cout(Log.DEBUG, 'Activate pkg %s success' % self._pkg)
        return True
Beispiel #19
0
    def execute(self):
        if self._dryRun:
            if self._unsetKeySet:
                Log.cout(Log.INFO, 'Unset pkg %s settings...' % self._pkg.name)
                for key in self._unsetKeySet:
                    Log.coutValue(Log.INFO, 'unset', key)
            return True
        if self._executed:
            return False
        self._executed = True

        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        #get active dir and package dir
        ainstActivePkg = self._ainstRoot.getRootVarAinstDir(
            'active') + self._pkg.name
        if not self._isActive(ainstActivePkg, pkgDirName):
            Log.cout(Log.ERROR, 'Package %s is not active' % self._pkg)
            return False
        ainstPkgDir = self._ainstRoot.getRootVarAinstDir(
            'packages') + pkgDirName
        getRet, aicfInfo = self._getAicfInfo(ainstPkgDir, self._pkg)
        if not getRet:
            Log.cout(Log.ERROR, 'Get aicfInfo of %s failed' % self._pkg)
            return False

        if aicfInfo is None:
            Log.cout(Log.INFO, 'No aicf, will not do effective action')
            return True

        #get settings from setting file
        settingPath = self._ainstRoot.getRootVarAinstDir(
            'settings') + self._pkg.name
        srcSettings = SettingStreamer().parse(settingPath)
        if srcSettings is None:
            srcSettings = {}
        newSettings = self._unsetSettings(srcSettings, self._unsetKeySet)

        settingsEnv = self._generateSettingsEnv(newSettings)
        ainstDirPath = ainstPkgDir + '/ainst/'
        ainstPathEnv = {self._ainstDirKey: ainstDirPath}
        self._exportToEnv(ainstPathEnv)
        self._exportToEnv(settingsEnv)
        settingMap = {}
        settingMap.update(newSettings)
        settingMap[self._ainstRoot.getInstallRootEnvKey(
        )] = self._ainstRoot.getRoot()
        settingMap.update(ainstPathEnv)
        ret = self._generateConfigToRoot(ainstPkgDir, aicfInfo, settingMap,
                                         self._confBakDict)
        self._removeFromEnv(settingsEnv)
        self._removeFromEnv(ainstPathEnv)

        if not ret:
            Log.cout(Log.ERROR,
                     'Generate config of %s to root failed' % self._pkg.name)
            self.undo()
            return False

        if not SettingStreamer().dump(newSettings, settingPath):
            Log.cout(Log.ERROR, 'Dump settings of %s failed' % self._pkg.name)
            self.undo()
            return False
        self._bakSettings = srcSettings
        return True
    def execute(self):
        Log.cout(Log.INFO, 'Deactivate pkg %s ...' % self._pkg)
        if self._dryrun:
            return True
        if self._executed:
            return False
        self._executed = True
        
        if not self._ainstRoot.checkRoot():
            Log.cout(Log.ERROR, 'Check ainst root failed')
            return False

        pkgDirName = PackageUtil.getPkgNameVersion(self._pkg)
        if not pkgDirName:
            Log.cout(Log.ERROR, 'Get pkg %s dir name failed' % self._pkg)
            return False

        self._ainstActivePkg = self._ainstRoot.getRootVarAinstDir('active') + self._pkg.name
        self._ainstPkgDir = self._ainstRoot.getRootVarAinstDir('packages') + pkgDirName
        if not self._isActive(self._ainstActivePkg, pkgDirName):
            Log.cout(Log.INFO, 'Package %s is always deactive' % self._pkg)
            return True

        ainstDirPath = self._ainstPkgDir + '/ainst/'
        self._ainstPathEnv = {self._ainstDirKey : ainstDirPath}
        aicfFile = ainstDirPath + self._pkg.name + '.aicf'
        if file_util.isFile(aicfFile):
            self._aicfInfo = AicfParser().parse(aicfFile)
            if not self._aicfInfo or not AicfInfoWrapper().removeConfigPrefix(self._aicfInfo) \
                    or not self._checkAicfInfo(self._aicfInfo):
                Log.cout(Log.ERROR, 'Aicf info of pkg %s is illegal' % self._pkg)
                return False

        #calc settings
        settingPath = self._ainstRoot.getRootVarAinstDir('settings') + self._pkg.name
        settings = SettingStreamer().parse(settingPath)
        if settings is None:
            Log.cout(Log.ERROR, 'Parse settings of pkg %s  failed' % self._pkg)
            return False
        useSettings = self._mergeSettings(settings, self._cliSettings)
        self._settingsEnv = self._generateSettingsEnv(useSettings)

        self._processStopScript()
        if not self._processScriptByName('pre-deactivate'):
            self.undo()
            return False

        #get rpm file infos
        bakRpmFile = self._ainstPkgDir + self._ainstRoot.getBackRpmPath()
        rpmFileInfoList = RpmFileWrapper().convert(bakRpmFile)
        if rpmFileInfoList is None:
            Log.cout(Log.ERROR, 'Get rpm file info failed: %s', bakRpmFile)
            self.undo()
            return False

        ret, self._lastActivePkg = self._unSymlinkFromActive(self._ainstActivePkg)
        if not ret:
            Log.cout(Log.ERROR, 'UnsymLink pkg %s dir from active failed' % self._pkg)
            self.undo()
            return False

        if not self._unlinkPkgFromRoot(rpmFileInfoList, self._unlinkList,
                                       self._rmdirList, self._confDict):
            Log.cout(Log.ERROR, 'Unink pkg %s dir from root failed' % self._pkg)
            self.undo()
            return False

        if not self._removeCrontabFile():
            Log.cout(Log.ERROR, 'Remove crontab file of pkg %s failed' % self._pkg)
            self.undo()
            return False            

        self._modifyDb = self._removeFileFromDb()
        if not self._modifyDb:
            Log.cout(Log.ERROR, 'Modify db failed')
            self.undo()
            return False

        if not self._processScriptByName('post-deactivate'):
            self.undo()
            return False

        self._success = True
        Log.cout(Log.DEBUG, 'Deactivate pkg %s success' % self._pkg)
        return True