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

def cli::YumBaseCli::localInstall (   self,
  filelist = None,
  updateonly = 0 
)

handles installs/updates of rpms provided on the filesystem in a 
   local dir (ie: not from a repo)

Definition at line 1064 of file cli.py.

01064                                                        :
        """handles installs/updates of rpms provided on the filesystem in a 
           local dir (ie: not from a repo)"""
           
        # read in each package into a YumLocalPackage Object
        # append it to self.localPackages
        # check if it can be installed or updated based on nevra versus rpmdb
        # don't import the repos until we absolutely need them for depsolving
        
        oldcount = len(self.tsInfo)
        
        if not filelist:
            filelist = self.extcmds
        
        if len(filelist) == 0:
            return 0, ['No Packages Provided']
        
        self.doRpmDBSetup()
        installpkgs = []
        updatepkgs = []
        donothingpkgs = []
        
        for pkg in filelist:
            try:
                po = YumLocalPackage(ts=self.read_ts, filename=pkg)
            except yum.Errors.MiscError, e:
                self.errorlog(0, 'Cannot open file: %s. Skipping.' % pkg)
                continue
            self.log(2, 'Examining %s: %s' % (po.localpath, po))

            # everything installed that matches the name
            installedByKey = self.rpmdb.returnTupleByKeyword(name=po.name)
            # go through each package 
            if len(installedByKey) == 0: # nothing installed by that name
                if updateonly:
                    self.errorlog(2, 'Package %s not installed, cannot update it. Run yum install to install it instead.' % po.name)
                else:
                    installpkgs.append(po)
                continue

            for instTup in installedByKey:
                installed_pkg = YumInstalledPackage(self.rpmdb.returnHeaderByTuple(instTup)[0])
                (n, a, e, v, r) = po.pkgtup
                (n2, a2, e2, v2, r2) = installed_pkg.pkgtup
                rc = compareEVR((e2, v2, r2), (e, v, r))
                if rc < 0: # we're newer - this is an update, pass to them
                    if n2 in self.conf.exactarchlist:
                        if a == a2:
                            updatepkgs.append((po, installed_pkg))
                            continue
                        else:
                            donothingpkgs.append(po)
                            continue
                    else:
                        updatepkgs.append((po, installed_pkg))
                        continue
                elif rc == 0: # same, ignore
                    donothingpkgs.append(po)
                    continue
                elif rc > 0: 
                    donothingpkgs.append(po)
                    continue


        for po in installpkgs:
            self.log(2, 'Marking %s to be installed' % po.localpath)
            self.localPackages.append(po)
            self.tsInfo.addInstall(po)
        
        for (po, oldpo) in updatepkgs:
            self.log(2, 'Marking %s as an update to %s' % (po.localpath, oldpo))
            self.localPackages.append(po)
            self.tsInfo.addUpdate(po, oldpo)
        
        for po in donothingpkgs:
            self.log(2, '%s: does not update installed package.' % po.localpath)
        
        if len(self.tsInfo) > oldcount:
            
            return 2, ['Package(s) to install']
        return 0, ['Nothing to do']
        
            
        
        
    def returnPkgLists(self):


Generated by  Doxygen 1.6.0   Back to index