def updatePkg(self, root, pkg=[], version = None, tagScript = None,
                  noScripts = False, keepExisting = False, replaceFiles = None,
                  resolve = False, depCheck = True, justDatabase = False,
                  flavor = None, recurse = True, sync = False,
                  info = False, fromFiles = [], checkPathConflicts = True,
                  test = False, migrate = False, keepRequired = None,
                  raiseError = False, callback = None, restartInfo = None,
                  applyCriticalOnly = False, syncChildren = False,
                  keepJournal = False, noRestart=False,
                  exactFlavors = False, replaceManagedFiles = False,
                  replaceModifiedFiles = False, replaceUnmanagedFiles = False,
                  replaceModifiedConfigFiles = False, skipCapsuleOps = False,
                  criticalUpdateInfo = None, modelFile = None):

        if not isinstance(root, str) or not root[0] == '/':
            # hack to allow passing of rootdir as first argument
            # as we used to
            if isinstance(root, list):
                pkg = root
            else:
                pkg = [root]
            root = self.rootDir

        newcfg = self.cfg
        newcfg.root = root

        if callback is None:
            callback = callbacks.UpdateCallback()

        if replaceFiles is not None:
            replaceManagedFiles = replaceFiles
            replaceUnmanagedFiles = replaceFiles
            replaceModifiedFiles = replaceFiles
            replaceModifiedConfigFiles = replaceFiles

        repos = self.openRepository()
        if isinstance(pkg, (str, list)):
            if isinstance(pkg, str):
                if version is not None:
                    if type(version) is not str:
                        version = version.asString()
                    item = "%s=%s" % (pkg, version)
                else:
                    item = pkg

                if flavor is not None:
                    item += flavor % '[%s]'

                pkgl = [ item ]

            else:
                assert(version is None)
                assert(flavor is None)

                pkgl = list(itertools.chain(*(util.braceExpand(x) for x in pkg)))
            # For consistency's sake, if in migrate mode, fake the command
            # line to say migrate
            if migrate:
                newSysArgv = [ 'conary', 'migrate' ]
            else:
                newSysArgv = [ 'conary', 'update' ]
            oldSysArgv = sys.argv

            # Add the packages to handle
            newSysArgv.extend(pkgl)

            newcfg.autoResolve = resolve
            try:
                if keepJournal:
                    k = { 'keepJournal' : True }
                else:
                    k = {}

                try:
                    sys.argv = newSysArgv
                    updatecmd.doUpdate(newcfg, pkgl,
                                       tagScript=tagScript,
                                       keepExisting=keepExisting,
                                       replaceManagedFiles=\
                                                    replaceManagedFiles,
                                       replaceUnmanagedFiles=\
                                                    replaceUnmanagedFiles,
                                       replaceModifiedFiles=\
                                                    replaceModifiedFiles,
                                       replaceModifiedConfigFiles=\
                                                    replaceModifiedConfigFiles,
                                       depCheck=depCheck,
                                       justDatabase=justDatabase,
                                       recurse=recurse, split=True,
                                       sync=sync, info=info,
                                       fromFiles=fromFiles,
                                       checkPathConflicts=checkPathConflicts,
                                       test=test, migrate=migrate,
                                       keepRequired=keepRequired,
                                       callback=callback,
                                       restartInfo=restartInfo,
                                       applyCriticalOnly=applyCriticalOnly,
                                       syncChildren=syncChildren,
                                       forceMigrate=migrate,
                                       noRestart=noRestart,
                                       exactFlavors=exactFlavors,
                                       criticalUpdateInfo=criticalUpdateInfo,
                                       skipCapsuleOps=skipCapsuleOps,
                                       noScripts=noScripts,
                                       systemModelFile=modelFile,
                                       **k)
                finally:
                    sys.argv = oldSysArgv
            except conaryclient.DependencyFailure, msg:
                if raiseError:
                    raise
                print msg
            except errors.InternalConaryError, err:
                raise
            except errors.ConaryError, msg:
                if raiseError:
                    raise
                log.error(msg)
        else:
            # we have a changeset object; mimic what updatecmd does
            assert(not info)
            assert(not fromFiles)
            assert(not test)
            assert(checkPathConflicts)
            cl = conaryclient.ConaryClient(self.cfg)
            cl.setUpdateCallback(callback)
            job = [ (x[0], (None, None), (x[1], x[2]),
                        not keepExisting) for x in
                            pkg.getPrimaryTroveList() ]
            try:
                try:
                    updJob, suggMap = cl.updateChangeSet(job,
                                        keepExisting = keepExisting,
                                        keepRequired = keepRequired,
                                        recurse = recurse, split = True,
                                        sync = sync,
                                        fromChangesets = [ pkg ])
                    if depCheck:
                        assert(not suggMap)
                    if replaceFiles is None:
                        replaceFiles = False
                    # old applyUpdate API doesn't support separate args
                    assert(not replaceManagedFiles)
                    assert(not replaceUnmanagedFiles)
                    assert(not replaceModifiedFiles)
                    assert(not replaceModifiedConfigFiles)
                    cl.applyUpdate(updJob, replaceFiles = replaceFiles,
                                   tagScript = tagScript, justDatabase = justDatabase,
                                   keepJournal = keepJournal)
                finally:
                    updJob.close()
                    cl.close()
            except conaryclient.DependencyFailure, msg:
                if raiseError:
                    raise
                print msg
            except errors.InternalConaryError, err:
                raise
            except errors.ConaryError, err:
                if raiseError:
                    raise
                log.error(err)
dataset/ETHPy150Open sassoftware/conary/conary_test/rephelp.py/RepositoryHelper.updatePkg/swapped operands of `%`