def _init(self, options): if not options: return True if hasattr(options, 'repos'): self.repos = options.repos if hasattr(options, 'localRepos'): for repo in options.localRepos: self.localRepos.append(file_util.getAbsPath(repo)) if hasattr(options, 'settings'): self.settings = options.settings if hasattr(options, 'setFiles'): for setFile in options.setFiles: self.setFiles.append(file_util.getAbsPath(setFile)) if hasattr(options, 'noStart'): self.noStart = options.noStart if hasattr(options, 'noExecute'): self.noExecute = options.noExecute if hasattr(options, 'check'): self.check = options.check if hasattr(options, 'downgrade'): self.downgrade = options.downgrade if hasattr(options, 'noUpgrade'): self.noUpgrade = options.noUpgrade if hasattr(options, 'noExclusive'): self.noExclusive = options.noExclusive if hasattr(options, 'dryRun'): self.dryRun = options.dryRun if hasattr(options, 'confirmYes'): self.confirmYes = options.confirmYes if hasattr(options, 'remoteRepos'): self.remoteRepos = options.remoteRepos if hasattr(options, 'prefixFilter'): self.prefixFilter = options.prefixFilter
def _parseMainSection(self, items, ainstConf): for key, value in items: if key == 'reposdir': repodirs = value.split(',') for repodir in repodirs: repodir = repodir.strip() ainstConf.reposdir.append(repodir) elif key == 'installonlypkgs': ainstConf.installonlypkgs = value elif key == 'exactarch': ainstConf.exactarch = int(value) elif key == 'timeout': ainstConf.timeout = float(value) elif key == 'installroot': ainstConf.installroot = file_util.getAbsPath(value) elif key == 'ainstroot': ainstConf.ainstroot = file_util.getAbsPath(value) ainstConf.rootinfo = ainstConf.ainstroot + '/root.info' ainstConf.cachedir = ainstConf.ainstroot + '/cache/' elif key == 'keepcache': ainstConf.keepcache = int(value) elif key == 'maxfilelength': ainstConf.maxfilelength = int(value) elif key == 'retrytime': ainstConf.retrytime = int(value) elif key == 'sockettimeout': ainstConf.sockettimeout = int(value) elif key == 'logfile': ainstConf.logfile = value elif key == 'loglevel': ainstConf.loglevel = value elif key == 'distroverpkg': ainstConf.distroverpkg = value elif key == 'expiretime': ainstConf.expiretime = time_util.stringToSecond(value) elif key == 'autostart': ainstConf.autostart = bool(value) return True
def getInstallRoot(installRoot=None, ainstConf=None): if installRoot is None: if os.environ.has_key(common.AINST_DEFAULT_INSTALLROOT): installRoot = os.environ[common.AINST_DEFAULT_INSTALLROOT] if installRoot: Log.cout(Log.INFO, 'Notice: no --installroot, will use: %s'\ % installRoot) elif ainstConf and ainstConf.installroot: installRoot = ainstConf.installroot Log.cout(Log.INFO, 'Notice: no --installroot, will use default: %s'\ % installRoot) if installRoot: installRoot = file_util.getAbsPath(installRoot) return installRoot
def _init(self, options): if not options: return True if hasattr(options, 'unsetFiles'): for unsetFile in options.unsetFiles: self.unsetFiles.append(file_util.getAbsPath(unsetFile))