Logo Search packages:      
Sourcecode: yum version File versions  Download package

def cli::YumBaseCli::updatePkgs (   self,
  userlist = None,
  quiet = 0 

take user commands and populate transaction wrapper with 
   packages to be updated

Definition at line 936 of file cli.py.

00936                                                 :
        """take user commands and populate transaction wrapper with 
           packages to be updated"""
        # if there is no userlist, then do global update below
        # this is probably 90% of the calls
        # if there is a userlist then it's for updating pkgs, not obsoleting
        oldcount = len(self.tsInfo)
        if not userlist:
            userlist = self.extcmds
        avail = self.pkgSack.simplePkgList()
        installed = self.rpmdb.getPkgList()
        updates = self.up.getUpdatesTuples()
        if self.conf.getConfigOption('obsoletes'):
            obsoletes = self.up.getObsoletesTuples(newest=1)
            obsoletes = []

        if len(userlist) == 0: # simple case - do them all
            for (obsoleting, installed) in obsoletes:
                obsoleting_pkg = self.getPackageObject(obsoleting)
                installed_pkg =  YumInstalledPackage(self.rpmdb.returnHeaderByTuple(installed)[0])
                self.tsInfo.addObsoleting(obsoleting_pkg, installed_pkg)
                self.tsInfo.addObsoleted(installed_pkg, obsoleting_pkg)
            for (new, old) in updates:
                txmbrs = self.tsInfo.getMembers(pkgtup=old)

                if txmbrs and txmbrs[0].output_state == 'obsoleted':
                    self.log(5, 'Not Updating Package that is already obsoleted: %s.%s %s:%s-%s' % old)
                    updating_pkg = self.getPackageObject(new)
                    updated_pkg = YumInstalledPackage(self.rpmdb.returnHeaderByTuple(old)[0])
                    self.tsInfo.addUpdate(updating_pkg, updated_pkg)

            # go through the userlist - look for items that are local rpms. If we find them
            # pass them off to localInstall() and then move on
            localupdates = []
            for item in userlist:
                if os.path.exists(item) and item[-4:] == '.rpm': # this is hurky, deal w/it
            if len(localupdates) > 0:
                val, msglist = self.localInstall(filelist=localupdates, updateonly=1)
                for item in localupdates:
            # we've got a userlist, match it against updates tuples and populate
            # the tsInfo with the matches
            updatesPo = []
            for (new, old) in updates:
                (n,a,e,v,r) = new
                updatesPo.extend(self.pkgSack.searchNevra(name=n, arch=a, epoch=e, 
                                 ver=v, rel=r))
            exactmatch, matched, unmatched = yum.packages.parsePackages(
                                                updatesPo, userlist, casematch=1)
            for userarg in unmatched:
                if not quiet:
                    self.errorlog(1, 'Could not find update match for %s' % userarg)

            updateMatches = yum.misc.unique(matched + exactmatch)
            for po in updateMatches:
                for (new, old) in updates:
                    if po.pkgtup == new:
                        updated_pkg = YumInstalledPackage(self.rpmdb.returnHeaderByTuple(old)[0])
                        self.tsInfo.addUpdate(po, updated_pkg)

        if len(self.tsInfo) > oldcount:
            change = len(self.tsInfo) - oldcount
            msg = '%d packages marked for Update/Obsoletion' % change
            return 2, [msg]
            return 0, ['No Packages marked for Update/Obsoletion']

    def erasePkgs(self, userlist=None):

Generated by  Doxygen 1.6.0   Back to index