diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-04-01 17:18:31 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-04-01 17:18:31 +0200 |
commit | 46361a17f0cb6f4f7c46705c5af71b6680cf5b1d (patch) | |
tree | e7466e094406d5d195823840cb2d43a371f67bea /cmdline | |
parent | 3b1fffc35f3eb277d92f38c687c270edd1d8550d (diff) | |
parent | 436d7eab92bb8f9cc6498acfbf2055e717be6fd0 (diff) |
merged from lp:~donkult/apt/sid
Diffstat (limited to 'cmdline')
-rw-r--r-- | cmdline/apt-cache.cc | 99 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 136 | ||||
-rwxr-xr-x | cmdline/apt-mark | 4 |
3 files changed, 147 insertions, 92 deletions
diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 3f68579cc..07b95e3ca 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -139,7 +139,7 @@ bool UnMet(CommandLine &CmdL) // Oops, it failed.. if (Header == false) ioprintf(cout,_("Package %s version %s has an unmet dep:\n"), - P.Name(),V.VerStr()); + P.FullName(true).c_str(),V.VerStr()); Header = true; // Print out the dep type @@ -149,7 +149,7 @@ bool UnMet(CommandLine &CmdL) Start = RealStart; do { - cout << Start.TargetPkg().Name(); + cout << Start.TargetPkg().FullName(true); if (Start.TargetVer() != 0) cout << " (" << Start.CompType() << " " << Start.TargetVer() << ")"; @@ -182,7 +182,7 @@ bool DumpPackage(CommandLine &CmdL) continue; } - cout << "Package: " << Pkg.Name() << endl; + cout << "Package: " << Pkg.FullName(true) << endl; cout << "Versions: " << endl; for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++) { @@ -204,7 +204,7 @@ bool DumpPackage(CommandLine &CmdL) cout << "Reverse Depends: " << endl; for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++) { - cout << " " << D.ParentPkg().Name() << ',' << D.TargetPkg().Name(); + cout << " " << D.ParentPkg().FullName(true) << ',' << D.TargetPkg().FullName(true); if (D->Version != 0) cout << ' ' << DeNull(D.TargetVer()) << endl; else @@ -216,7 +216,7 @@ bool DumpPackage(CommandLine &CmdL) { cout << Cur.VerStr() << " - "; for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++) - cout << Dep.TargetPkg().Name() << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") "; + cout << Dep.TargetPkg().FullName(true) << " (" << (int)Dep->CompareOp << " " << DeNull(Dep.TargetVer()) << ") "; cout << endl; } @@ -225,12 +225,12 @@ bool DumpPackage(CommandLine &CmdL) { cout << Cur.VerStr() << " - "; for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++) - cout << Prv.ParentPkg().Name() << " "; + cout << Prv.ParentPkg().FullName(true) << " "; cout << endl; } cout << "Reverse Provides: " << endl; for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++) - cout << Prv.OwnerPkg().Name() << " " << Prv.OwnerVer().VerStr() << endl; + cout << Prv.OwnerPkg().FullName(true) << " " << Prv.OwnerVer().VerStr() << endl; } return true; @@ -353,13 +353,13 @@ bool Dump(CommandLine &Cmd) for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++) { - cout << "Package: " << P.Name() << endl; + cout << "Package: " << P.FullName(true) << endl; for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++) { cout << " Version: " << V.VerStr() << endl; cout << " File: " << V.FileList().File().FileName() << endl; for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++) - cout << " Depends: " << D.TargetPkg().Name() << ' ' << + cout << " Depends: " << D.TargetPkg().FullName(true) << ' ' << DeNull(D.TargetVer()) << endl; for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++) { @@ -570,11 +570,11 @@ bool Depends(CommandLine &CmdL) pkgCache::VerIterator Ver = Pkg.VersionList(); if (Ver.end() == true) { - cout << '<' << Pkg.Name() << '>' << endl; + cout << '<' << Pkg.FullName(true) << '>' << endl; continue; } - cout << Pkg.Name() << endl; + cout << Pkg.FullName(true) << endl; for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++) { @@ -596,9 +596,9 @@ bool Depends(CommandLine &CmdL) // Show the package if (Trg->VersionList == 0) - cout << D.DepType() << ": <" << Trg.Name() << ">" << endl; + cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl; else - cout << D.DepType() << ": " << Trg.Name() << endl; + cout << D.DepType() << ": " << Trg.FullName(true) << endl; if (Recurse == true) Colours[D.TargetPkg()->ID]++; @@ -614,7 +614,7 @@ bool Depends(CommandLine &CmdL) if (V != Cache.VerP + V.ParentPkg()->VersionList || V->ParentPkg == D->Package) continue; - cout << " " << V.ParentPkg().Name() << endl; + cout << " " << V.ParentPkg().FullName(true) << endl; if (Recurse == true) Colours[D.ParentPkg()->ID]++; @@ -663,11 +663,11 @@ bool RDepends(CommandLine &CmdL) pkgCache::VerIterator Ver = Pkg.VersionList(); if (Ver.end() == true) { - cout << '<' << Pkg.Name() << '>' << endl; + cout << '<' << Pkg.FullName(true) << '>' << endl; continue; } - cout << Pkg.Name() << endl; + cout << Pkg.FullName(true) << endl; cout << "Reverse Depends:" << endl; for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++) @@ -684,9 +684,9 @@ bool RDepends(CommandLine &CmdL) cout << " "; if (Trg->VersionList == 0) - cout << D.DepType() << ": <" << Trg.Name() << ">" << endl; + cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl; else - cout << Trg.Name() << endl; + cout << Trg.FullName(true) << endl; if (Recurse == true) Colours[D.ParentPkg()->ID]++; @@ -702,7 +702,7 @@ bool RDepends(CommandLine &CmdL) if (V != Cache.VerP + V.ParentPkg()->VersionList || V->ParentPkg == D->Package) continue; - cout << " " << V.ParentPkg().Name() << endl; + cout << " " << V.ParentPkg().FullName(true) << endl; if (Recurse == true) Colours[D.ParentPkg()->ID]++; @@ -863,7 +863,7 @@ bool XVcg(CommandLine &CmdL) // Only graph critical deps if (D.IsCritical() == true) { - printf ("edge: { sourcename: \"%s\" targetname: \"%s\" class: 2 ",Pkg.Name(), D.TargetPkg().Name() ); + printf ("edge: { sourcename: \"%s\" targetname: \"%s\" class: 2 ",Pkg.FullName(true).c_str(), D.TargetPkg().FullName(true).c_str() ); // Colour the node for recursion if (Show[D.TargetPkg()->ID] <= DoneNR) @@ -922,10 +922,10 @@ bool XVcg(CommandLine &CmdL) continue; if (Show[Pkg->ID] == DoneNR) - printf("node: { title: \"%s\" label: \"%s\" color: orange shape: %s }\n", Pkg.Name(), Pkg.Name(), + printf("node: { title: \"%s\" label: \"%s\" color: orange shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(), Shapes[ShapeMap[Pkg->ID]]); else - printf("node: { title: \"%s\" label: \"%s\" shape: %s }\n", Pkg.Name(), Pkg.Name(), + printf("node: { title: \"%s\" label: \"%s\" shape: %s }\n", Pkg.FullName(true).c_str(), Pkg.FullName(true).c_str(), Shapes[ShapeMap[Pkg->ID]]); } @@ -1084,7 +1084,7 @@ bool Dotty(CommandLine &CmdL) // Only graph critical deps if (D.IsCritical() == true) { - printf("\"%s\" -> \"%s\"",Pkg.Name(),D.TargetPkg().Name()); + printf("\"%s\" -> \"%s\"",Pkg.FullName(true).c_str(),D.TargetPkg().FullName(true).c_str()); // Colour the node for recursion if (Show[D.TargetPkg()->ID] <= DoneNR) @@ -1138,10 +1138,10 @@ bool Dotty(CommandLine &CmdL) // Orange box for early recursion stoppage if (Show[Pkg->ID] == DoneNR) - printf("\"%s\" [color=orange,shape=%s];\n",Pkg.Name(), + printf("\"%s\" [color=orange,shape=%s];\n",Pkg.FullName(true).c_str(), Shapes[ShapeMap[Pkg->ID]]); else - printf("\"%s\" [shape=%s];\n",Pkg.Name(), + printf("\"%s\" [shape=%s];\n",Pkg.FullName(true).c_str(), Shapes[ShapeMap[Pkg->ID]]); } @@ -1417,11 +1417,15 @@ bool ShowPackage(CommandLine &CmdL) for (const char **I = CmdL.FileList + 1; *I != 0; I++) { + // FIXME: Handle the case in which pkgname name:arch is not found pkgCache::PkgIterator Pkg = Cache.FindPkg(*I); if (Pkg.end() == true) { - _error->Warning(_("Unable to locate package %s"),*I); - continue; + Pkg = Cache.FindPkg(*I, "any"); + if (Pkg.end() == true) { + _error->Warning(_("Unable to locate package %s"),*I); + continue; + } } ++found; @@ -1457,16 +1461,17 @@ bool ShowPackage(CommandLine &CmdL) bool ShowPkgNames(CommandLine &CmdL) { pkgCache &Cache = *GCache; - pkgCache::PkgIterator I = Cache.PkgBegin(); - bool All = _config->FindB("APT::Cache::AllNames","false"); - + pkgCache::GrpIterator I = Cache.GrpBegin(); + bool const All = _config->FindB("APT::Cache::AllNames","false"); + if (CmdL.FileList[1] != 0) { for (;I.end() != true; I++) { - if (All == false && I->VersionList == 0) + if (All == false && I->FirstPackage == 0) + continue; + if (I.FindPkg("any")->VersionList == 0) continue; - if (strncmp(I.Name(),CmdL.FileList[1],strlen(CmdL.FileList[1])) == 0) cout << I.Name() << endl; } @@ -1477,7 +1482,9 @@ bool ShowPkgNames(CommandLine &CmdL) // Show all pkgs for (;I.end() != true; I++) { - if (All == false && I->VersionList == 0) + if (All == false && I->FirstPackage == 0) + continue; + if (I.FindPkg("any")->VersionList == 0) continue; cout << I.Name() << endl; } @@ -1565,7 +1572,7 @@ bool Policy(CommandLine &CmdL) continue; // Print the package name and the version we are forcing to - cout << " " << I.Name() << " -> "; + cout << " " << I.FullName(true) << " -> "; pkgCache::VerIterator V = Plcy.GetMatch(I); if (V.end() == true) @@ -1576,19 +1583,26 @@ bool Policy(CommandLine &CmdL) return true; } - + + string const myArch = _config->Find("APT::Architecture"); + // Print out detailed information for each package for (const char **I = CmdL.FileList + 1; *I != 0; I++) { - pkgCache::PkgIterator Pkg = Cache.FindPkg(*I); + pkgCache::GrpIterator Grp = Cache.FindGrp(*I); + pkgCache::PkgIterator Pkg = Grp.FindPkg("any"); if (Pkg.end() == true) { _error->Warning(_("Unable to locate package %s"),*I); continue; } - - cout << Pkg.Name() << ":" << endl; - + + for (; Pkg.end() != true; Pkg = Grp.NextPkg(Pkg)) { + if (strcmp(Pkg.Arch(),"all") == 0) + continue; + + cout << Pkg.FullName(true) << ":" << endl; + // Installed version cout << _(" Installed: "); if (Pkg->CurrentVer == 0) @@ -1633,8 +1647,9 @@ bool Policy(CommandLine &CmdL) return _error->Error(_("Cache is out of sync, can't x-ref a package file")); printf(" %4i %s\n",Plcy.GetPriority(VF.File()), Indx->Describe(true).c_str()); - } - } + } + } + } } return true; @@ -1684,7 +1699,7 @@ bool Madison(CommandLine &CmdL) { if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File()) { - cout << setw(10) << Pkg.Name() << " | " << setw(10) << V.VerStr() << " | " + cout << setw(10) << Pkg.FullName(true) << " | " << setw(10) << V.VerStr() << " | " << (*IF)->Describe(true) << endl; } } diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 3c90354b0..62f712c39 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -258,8 +258,8 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now) } // Print out each package and the failed dependencies - out <<" " << I.Name() << ":"; - unsigned Indent = strlen(I.Name()) + 3; + out << " " << I.FullName(true) << " :"; + unsigned const Indent = I.FullName(true).size() + 3; bool First = true; pkgCache::VerIterator Ver; @@ -312,7 +312,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now) out << ' ' << End.DepType() << ": "; FirstOr = false; - out << Start.TargetPkg().Name(); + out << Start.TargetPkg().FullName(true); // Show a quick summary of the version requirements if (Start.TargetVer() != 0) @@ -374,7 +374,9 @@ void ShowNew(ostream &out,CacheFile &Cache) { pkgCache::PkgIterator I(Cache,Cache.List[J]); if (Cache[I].NewInstall() == true) { - List += string(I.Name()) + " "; + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CandVersion) + "\n"; } } @@ -396,10 +398,12 @@ void ShowDel(ostream &out,CacheFile &Cache) pkgCache::PkgIterator I(Cache,Cache.List[J]); if (Cache[I].Delete() == true) { + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge) - List += string(I.Name()) + "* "; + List += I.FullName(true) + "* "; else - List += string(I.Name()) + " "; + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CandVersion)+ "\n"; } @@ -424,7 +428,7 @@ void ShowKept(ostream &out,CacheFile &Cache) I->CurrentVer == 0 || Cache[I].Delete() == true) continue; - List += string(I.Name()) + " "; + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } ShowList(out,_("The following packages have been kept back:"),List,VersionsList); @@ -444,8 +448,10 @@ void ShowUpgraded(ostream &out,CacheFile &Cache) // Not interesting if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true) continue; - - List += string(I.Name()) + " "; + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; + + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } ShowList(out,_("The following packages will be upgraded:"),List,VersionsList); @@ -465,8 +471,10 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache) // Not interesting if (Cache[I].Downgrade() == false || Cache[I].NewInstall() == true) continue; - - List += string(I.Name()) + " "; + if (Cache[I].CandidateVerIter(Cache).Pseudo() == true) + continue; + + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } return ShowList(out,_("The following packages will be DOWNGRADED:"),List,VersionsList); @@ -484,7 +492,7 @@ bool ShowHold(ostream &out,CacheFile &Cache) pkgCache::PkgIterator I(Cache,Cache.List[J]); if (Cache[I].InstallVer != (pkgCache::Version *)I.CurrentVer() && I->SelectedState == pkgCache::State::Hold) { - List += string(I.Name()) + " "; + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n"; } } @@ -518,7 +526,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache) if (Added[I->ID] == false) { Added[I->ID] = true; - List += string(I.Name()) + " "; + List += I.FullName(true) + " "; //VersionsList += string(Cache[I].CurVersion) + "\n"; ??? } } @@ -542,7 +550,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache) Added[P->ID] = true; char S[300]; - snprintf(S,sizeof(S),_("%s (due to %s) "),P.Name(),I.Name()); + snprintf(S,sizeof(S),_("%s (due to %s) "),P.FullName(true).c_str(),I.FullName(true).c_str()); List += S; //VersionsList += "\n"; ??? } @@ -566,6 +574,9 @@ void Stats(ostream &out,pkgDepCache &Dep) unsigned long ReInstall = 0; for (pkgCache::PkgIterator I = Dep.PkgBegin(); I.end() == false; I++) { + if (pkgCache::VerIterator(Dep, Dep[I].CandidateVer).Pseudo() == true) + continue; + if (Dep[I].NewInstall() == true) Install++; else @@ -1084,7 +1095,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (found_one == true) { ioprintf(c1out,_("Note, selecting %s instead of %s\n"), - Prov.Name(),Pkg.Name()); + Prov.FullName(true).c_str(),Pkg.FullName(true).c_str()); Pkg = Prov; } } @@ -1095,10 +1106,20 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, { if (AllowFail == true) ioprintf(c1out,_("Skipping %s, it is already installed and upgrade is not set.\n"), + Pkg.FullName(true).c_str()); + return true; + } + + // Ignore request for install if package would be new + if (_config->FindB("APT::Get::Only-Upgrade", false) == true && + Pkg->CurrentVer == 0) + { + if (AllowFail == true) + ioprintf(c1out,_("Skipping %s, it is not installed and only upgrades are requested.\n"), Pkg.Name()); return true; } - + // Check if there is something at all to install pkgDepCache::StateCache &State = Cache[Pkg]; if (Remove == true && Pkg->CurrentVer == 0) @@ -1112,7 +1133,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (AllowFail == false) return false; - ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.Name()); + ioprintf(c1out,_("Package %s is not installed, so not removed\n"),Pkg.FullName(true).c_str()); return true; } @@ -1124,7 +1145,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (Pkg->ProvidesList != 0) { ioprintf(c1out,_("Package %s is a virtual package provided by:\n"), - Pkg.Name()); + Pkg.FullName(true).c_str()); pkgCache::PrvIterator I = Pkg.ProvidesList(); for (; I.end() == false; I++) @@ -1134,10 +1155,10 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer()) { if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false) - c1out << " " << Pkg.Name() << " " << I.OwnerVer().VerStr() << + c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr() << _(" [Installed]") << endl; else - c1out << " " << Pkg.Name() << " " << I.OwnerVer().VerStr() << endl; + c1out << " " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr() << endl; } } c1out << _("You should explicitly select one to install.") << endl; @@ -1147,7 +1168,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, ioprintf(c1out, _("Package %s is not available, but is referred to by another package.\n" "This may mean that the package is missing, has been obsoleted, or\n" - "is only available from another source\n"),Pkg.Name()); + "is only available from another source\n"),Pkg.FullName(true).c_str()); string List; string VersionsList; @@ -1161,13 +1182,13 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, if (Seen[Dep.ParentPkg()->ID] == true) continue; Seen[Dep.ParentPkg()->ID] = true; - List += string(Dep.ParentPkg().Name()) + " "; + List += Dep.ParentPkg().FullName(true) + " "; //VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ??? } ShowList(c1out,_("However the following packages replace it:"),List,VersionsList); } - _error->Error(_("Package %s has no installation candidate"),Pkg.Name()); + _error->Error(_("Package %s has no installation candidate"),Pkg.FullName(true).c_str()); return false; } @@ -1188,7 +1209,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, { if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false) ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"), - Pkg.Name()); + Pkg.FullName(true).c_str()); else Cache.SetReInstall(Pkg,true); } @@ -1196,7 +1217,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, { if (AllowFail == true) ioprintf(c1out,_("%s is already the newest version.\n"), - Pkg.Name()); + Pkg.FullName(true).c_str()); } } else @@ -1225,15 +1246,15 @@ bool TryToChangeVer(pkgCache::PkgIterator Pkg,pkgDepCache &Cache, { if (IsRel == true) return _error->Error(_("Release '%s' for '%s' was not found"), - VerTag,Pkg.Name()); + VerTag,Pkg.FullName(true).c_str()); return _error->Error(_("Version '%s' for '%s' was not found"), - VerTag,Pkg.Name()); + VerTag,Pkg.FullName(true).c_str()); } if (strcmp(VerTag,Ver.VerStr()) != 0) { ioprintf(c1out,_("Selected version %s (%s) for %s\n"), - Ver.VerStr(),Ver.RelStr().c_str(),Pkg.Name()); + Ver.VerStr(),Ver.RelStr().c_str(),Pkg.FullName(true).c_str()); } Cache.SetCandidateVersion(Ver); @@ -1270,12 +1291,26 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, { if(VerTag.empty() == false || DefRel.empty() == false) { + bool fuzzy = false; // we have a default release, try to locate the pkg. we do it like // this because GetCandidateVer() will not "downgrade", that means // "apt-get source -t stable apt" won't work on a unstable system - for (pkgCache::VerIterator Ver = Pkg.VersionList(); - Ver.end() == false; Ver++) + for (pkgCache::VerIterator Ver = Pkg.VersionList();; Ver++) { + // try first only exact matches, later fuzzy matches + if (Ver.end() == true) + { + if (fuzzy == true) + break; + fuzzy = true; + Ver = Pkg.VersionList(); + } + // We match against a concrete version (or a part of this version) + if (VerTag.empty() == false && + (fuzzy == true || Cache.VS().CmpVersion(VerTag, Ver.VerStr()) != 0) && // exact match + (fuzzy == false || strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0)) // fuzzy match + continue; + for (pkgCache::VerFileIterator VF = Ver.FileList(); VF.end() == false; VF++) { @@ -1288,10 +1323,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, pkgCache::Flag::NotSource && Pkg.CurrentVer() != Ver) continue; - // We match against a concrete version (or a part of this version) - if (VerTag.empty() == false && strncmp(VerTag.c_str(), Ver.VerStr(), VerTag.size()) != 0) - continue; - // or we match against a release if(VerTag.empty() == false || (VF.File().Archive() != 0 && VF.File().Archive() == DefRel) || @@ -1302,10 +1333,9 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, // no SourcePkg name, so it is the "binary" name if (Src.empty() == true) Src = TmpSrc; - // no Version, so we try the Version of the SourcePkg - - // and after that the version of the binary package - if (VerTag.empty() == true) - VerTag = Parse.SourceVer(); + // the Version we have is possibly fuzzy or includes binUploads, + // so we use the Version of the SourcePkg (empty if same as package) + VerTag = Parse.SourceVer(); if (VerTag.empty() == true) VerTag = Ver.VerStr(); break; @@ -1371,7 +1401,8 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs, const string Ver = Parse->Version(); // Ignore all versions which doesn't fit - if (VerTag.empty() == false && strncmp(VerTag.c_str(), Ver.c_str(), VerTag.size()) != 0) + if (VerTag.empty() == false && + Cache.VS().CmpVersion(VerTag, Ver) != 0) // exact match continue; // Newer version or an exact match? Save the hit @@ -1491,7 +1522,7 @@ bool DoAutomaticRemove(CacheFile &Cache) { if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install()) if(Debug) - std::cout << "We could delete %s" << Pkg.Name() << std::endl; + std::cout << "We could delete %s" << Pkg.FullName(true).c_str() << std::endl; if (doAutoRemove) { @@ -1510,7 +1541,7 @@ bool DoAutomaticRemove(CacheFile &Cache) // we don't need to fill the strings if we don't need them if (smallList == false) { - autoremovelist += string(Pkg.Name()) + " "; + autoremovelist += Pkg.FullName(true) + " "; autoremoveversions += string(Cache[Pkg].CandVersion) + "\n"; } } @@ -1781,10 +1812,11 @@ bool DoInstall(CommandLine &CmdL) Cache[Pkg].Install() == false && (Cache[Pkg].Flags & pkgCache::Flag::Auto) && _config->FindB("APT::Get::ReInstall",false) == false && + _config->FindB("APT::Get::Only-Upgrade",false) == false && _config->FindB("APT::Get::Download-Only",false) == false) { ioprintf(c1out,_("%s set to manually installed.\n"), - Pkg.Name()); + Pkg.FullName(true).c_str()); Cache->MarkAuto(Pkg,false); AutoMarkChanged++; } @@ -1853,7 +1885,7 @@ bool DoInstall(CommandLine &CmdL) break; if (*J == 0) { - List += string(I.Name()) + " "; + List += I.FullName(true) + " "; VersionsList += string(Cache[I].CandVersion) + "\n"; } } @@ -1889,7 +1921,7 @@ bool DoInstall(CommandLine &CmdL) for(;;) { /* Skip if package is installed already, or is about to be */ - string target = string(Start.TargetPkg().Name()) + " "; + string target = Start.TargetPkg().FullName(true) + " "; if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install || Cache[Start.TargetPkg()].Install()) @@ -2290,6 +2322,7 @@ bool DoSource(CommandLine &CmdL) { for (unsigned I = 0; I != J; I++) ioprintf(cout,_("Fetch source %s\n"),Dsc[I].Package.c_str()); + delete[] Dsc; return true; } @@ -2300,6 +2333,7 @@ bool DoSource(CommandLine &CmdL) for (; I != Fetcher.UriEnd(); I++) cout << '\'' << I->URI << "' " << flNotDir(I->Owner->DestFile) << ' ' << I->Owner->FileSize << ' ' << I->Owner->HashSum() << endl; + delete[] Dsc; return true; } @@ -2325,6 +2359,7 @@ bool DoSource(CommandLine &CmdL) if (_config->FindB("APT::Get::Download-only",false) == true) { c1out << _("Download complete and in download only mode") << endl; + delete[] Dsc; return true; } @@ -2386,7 +2421,8 @@ bool DoSource(CommandLine &CmdL) _exit(0); } - + delete[] Dsc; + // Wait for the subprocess int Status = 0; while (waitpid(Process,&Status,0) != Process) @@ -2440,7 +2476,7 @@ bool DoBuildDep(CommandLine &CmdL) // Process the build-dependencies vector<pkgSrcRecords::Parser::BuildDepRec> BuildDeps; - if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only",false)) == false) + if (Last->BuildDepends(BuildDeps, _config->FindB("APT::Get::Arch-Only",true)) == false) return _error->Error(_("Unable to get build-dependency information for %s"),Src.c_str()); // Also ensure that build-essential packages are present @@ -2539,7 +2575,7 @@ bool DoBuildDep(CommandLine &CmdL) for (; Prv.end() != true; Prv++) { if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " Checking provider " << Prv.OwnerPkg().Name() << endl; + cout << " Checking provider " << Prv.OwnerPkg().FullName() << endl; if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false) break; @@ -2580,7 +2616,7 @@ bool DoBuildDep(CommandLine &CmdL) if (Prv.end() == false) { if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " Is provided by installed package " << Prv.OwnerPkg().Name() << endl; + cout << " Is provided by installed package " << Prv.OwnerPkg().FullName() << endl; skipAlternatives = hasAlternatives; continue; } @@ -2605,7 +2641,7 @@ bool DoBuildDep(CommandLine &CmdL) return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"), Last->BuildDepType((*D).Type), Src.c_str(), - Pkg.Name()); + Pkg.FullName(true).c_str()); } } @@ -2654,7 +2690,6 @@ bool DoBuildDep(CommandLine &CmdL) return true; } /*}}}*/ - // DoMoo - Never Ask, Never Tell /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -2823,6 +2858,7 @@ int main(int argc,const char *argv[]) /*{{{*/ {0,"fix-missing","APT::Get::Fix-Missing",0}, {0,"ignore-hold","APT::Ignore-Hold",0}, {0,"upgrade","APT::Get::upgrade",0}, + {0,"only-upgrade","APT::Get::Only-Upgrade",0}, {0,"force-yes","APT::Get::force-yes",0}, {0,"print-uris","APT::Get::Print-URIs",0}, {0,"diff-only","APT::Get::Diff-Only",0}, diff --git a/cmdline/apt-mark b/cmdline/apt-mark index 31383d987..12768b708 100755 --- a/cmdline/apt-mark +++ b/cmdline/apt-mark @@ -76,6 +76,10 @@ if __name__ == "__main__": help="print verbose status messages to stdout") (options, args) = parser.parse_args() + if not args: + parser.print_help() + sys.exit(1) + # get the state-file if not options.filename: STATE_FILE = apt_pkg.config.find_dir("Dir::State") + "extended_states" |