All pastes #1985601 Raw Edit

aguerreiro

public text v1 · immutable
#1985601 ·published 2010-11-08 18:58 UTC
rendered paste body
=== modified file 'cmdline/apt-get.cc'--- cmdline/apt-get.cc	2010-07-18 16:24:17 +0000+++ cmdline/apt-get.cc	2010-11-08 18:57:46 +0000@@ -2856,9 +2856,11 @@    for (const char **I = CmdL.FileList + 1; *I != 0; I++,pos++)    {        const char *p;+       char *VerTag = NULL;        int eq = 0, gt = 0, lt = 0;        const char *sep = strpbrk(*I,"=><");        string FirstConst;+       pkgCache::VerIterator MatchedVer = NULL;          if (strcmp(*I,"aux:")==0) {@@ -2881,17 +2883,46 @@ //	   *sep = '\0';        } +       /* Check for versioned requests */ +       char *S = *I;+       char *Slash = strchr(S, '=');+       if (Slash != 0)+       {+	       *Slash = 0;+	       VerTag = Slash + 1;+       }+        pkgCache::PkgIterator Pkg = Cache.FindPkg(*I);-      if (Pkg.end() == true)-      {-	 _error->Warning(_("Unable to locate package %s"),*I);-	 continue;-      }-      Colours[Pkg->ID] = 2;--      //Top of the list is the version with higher priority-      // ToDo: Check against operator passed by user-      pkgCache::VerIterator Ver = Pkg.VersionList();+       if (Pkg.end() == true)+       {+	       _error->Warning(_("Unable to locate package %s"),*I);+	       continue;+       }+       /*Find the specific version if requested */+       if (VerTag != NULL)+       {+	       pkgVersionMatch Match(VerTag, pkgVersionMatch::Version);++	       MatchedVer = Match.Find(Pkg);++	       if (Ver.end() == true)+	       {+		        _error->Warning(_("Version '%s' for '%s' was not found"),+				       VerTag,Pkg.Name());+			continue;+	       }+	      /* Warn if we chose a not exactly-equal match */+	       if (strcmp(VerTag,Ver.VerStr()) != 0)+	       {+		       ioprintf(c1out,_("Selected version %s (%s) for %s\n"),+				       Ver.VerStr(),Ver.RelStr().c_str(),Pkg.Name());+	       }++       }+       Colours[Pkg->ID] = 2;++      /* Choose APTs candidate version if unversioned request or choose specific matched version */ +      pkgCache::VerIterator Ver = MatchedVer== NULL ? Pkg.VersionList(): MatchedVer;        if (Ver == NULL){ 	// If the user wants to install a virtual package we have to expand the reverse provides