]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-get.cc
update po(t)s of all languages and fix a simple docbook-warning in
[apt.git] / cmdline / apt-get.cc
index ebb634b4fca968e6054f243a1142e3a547bca394..c32d67226a406e29e712641ea5b62530664ff22f 100644 (file)
@@ -868,8 +868,11 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask = true,
       if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
       {
          struct statfs Stat;
-         if (statfs(OutputDir.c_str(),&Stat) != 0 ||
-                        unsigned(Stat.f_type) != RAMFS_MAGIC)
+         if (statfs(OutputDir.c_str(),&Stat) != 0
+#if HAVE_STRUCT_STATFS_F_TYPE
+             || unsigned(Stat.f_type) != RAMFS_MAGIC
+#endif
+             )
             return _error->Error(_("You don't have enough free space in %s."),
                 OutputDir.c_str());
       }
@@ -1046,17 +1049,42 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
                  pkgProblemResolver &Fix,bool Remove,bool BrokenFix,
                  unsigned int &ExpectedInst,bool AllowFail = true)
 {
-   /* This is a pure virtual package and there is a single available 
-      provides */
-   if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0 &&
-       Pkg.ProvidesList()->NextProvides == 0)
+   /* This is a pure virtual package and there is a single available
+      candidate providing it. */
+   if (Cache[Pkg].CandidateVer == 0 && Pkg->ProvidesList != 0)
    {
-      pkgCache::PkgIterator Tmp = Pkg.ProvidesList().OwnerPkg();
-      ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
-              Tmp.Name(),Pkg.Name());
-      Pkg = Tmp;
+      pkgCache::PkgIterator Prov;
+      bool found_one = false;
+
+      for (pkgCache::PrvIterator P = Pkg.ProvidesList(); P; P++)
+      {
+        pkgCache::VerIterator const PVer = P.OwnerVer();
+        pkgCache::PkgIterator const PPkg = PVer.ParentPkg();
+
+        /* Ignore versions that are not a candidate. */
+        if (Cache[PPkg].CandidateVer != PVer)
+            continue;
+
+        if (found_one == false)
+        {
+           Prov = PPkg;
+           found_one = true;
+        }
+        else if (PPkg != Prov)
+        {
+           found_one = false; // we found at least two
+           break;
+        }
+      }
+
+      if (found_one == true)
+      {
+        ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
+                 Prov.Name(),Pkg.Name());
+        Pkg = Prov;
+      }
    }
-   
+
    // Handle the no-upgrade case
    if (_config->FindB("APT::Get::upgrade",true) == false &&
        Pkg->CurrentVer != 0)
@@ -1217,17 +1245,25 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 {
    // We want to pull the version off the package specification..
    string VerTag;
+   string DefRel;
    string TmpSrc = Name;
-   string::size_type Slash = TmpSrc.rfind('=');
+   const size_t found = TmpSrc.find_last_of("/=");
 
    // honor default release
-   string DefRel = _config->Find("APT::Default-Release");
+   if (found != string::npos && TmpSrc[found] == '/')
+   {
+      DefRel = TmpSrc.substr(found+1);
+      TmpSrc = TmpSrc.substr(0,found);
+   }
+   else
+      DefRel = _config->Find("APT::Default-Release");
+
    pkgCache::PkgIterator Pkg = Cache.FindPkg(TmpSrc);
 
-   if (Slash != string::npos)
+   if (found != string::npos && TmpSrc[found] == '=')
    {
-      VerTag = string(TmpSrc.begin() + Slash + 1,TmpSrc.end());
-      TmpSrc = string(TmpSrc.begin(),TmpSrc.begin() + Slash);
+      VerTag = TmpSrc.substr(found+1);
+      TmpSrc = TmpSrc.substr(0,found);
    } 
    else  if(!Pkg.end() && DefRel.empty() == false)
    {
@@ -1249,10 +1285,13 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
                pkgCache::Flag::NotSource && Pkg.CurrentVer() != Ver)
            continue;
            
-           //std::cout << VF.File().Archive() << std::endl;
-           if(VF.File().Archive() && (VF.File().Archive() == DefRel)) 
+           if((VF.File().Archive() != 0 && VF.File().Archive() == DefRel) ||
+               (VF.File().Codename() != 0 && VF.File().Codename() == DefRel))
            {
-              VerTag = Ver.VerStr();
+              pkgRecords::Parser &Parse = Recs.Lookup(VF);
+              VerTag = Parse.SourceVer();
+              if (VerTag.empty())
+                 VerTag = Ver.VerStr();
               break;
            }
         }
@@ -1306,7 +1345,7 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
 
       // show name mismatches
       if (IsMatch == true && Parse->Package() != Src)       
-        ioprintf(c1out,  _("No source package '%s' picking '%s' instead\n"), Parse->Package().c_str(), Src.c_str());
+        ioprintf(c1out,  _("No source package '%s' picking '%s' instead\n"), Src.c_str(), Parse->Package().c_str());
       
       if (VerTag.empty() == false)
       {
@@ -2201,8 +2240,11 @@ bool DoSource(CommandLine &CmdL)
    if (unsigned(Buf.f_bfree) < (FetchBytes - FetchPBytes)/Buf.f_bsize)
      {
        struct statfs Stat;
-       if (statfs(OutputDir.c_str(),&Stat) != 0 || 
-           unsigned(Stat.f_type) != RAMFS_MAGIC) 
+       if (statfs(OutputDir.c_str(),&Stat) != 0
+#if HAVE_STRUCT_STATFS_F_TYPE
+           || unsigned(Stat.f_type) != RAMFS_MAGIC
+#endif
+           ) 
           return _error->Error(_("You don't have enough free space in %s"),
               OutputDir.c_str());
       }