Ver código fonte

move ShowPkg() from apt-get to the PkgIterator and rename it to FullName()
responseable for displaying a package name and the architecture in a
uniform way. Pretty option can be used to not append the architecture if
it is the native architecture or all - and use it all over the place in
the commandline tools.

David Kalnischkies 16 anos atrás
pai
commit
75ce206243
4 arquivos alterados com 75 adições e 77 exclusões
  1. 1 0
      apt-pkg/cacheiterators.h
  2. 12 0
      apt-pkg/pkgcache.cc
  3. 28 31
      cmdline/apt-cache.cc
  4. 34 46
      cmdline/apt-get.cc

+ 1 - 0
apt-pkg/cacheiterators.h

@@ -151,6 +151,7 @@ class pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
 
 
 	//Nice printable representation
 	//Nice printable representation
 	friend std::ostream& operator <<(std::ostream& out, PkgIterator i);
 	friend std::ostream& operator <<(std::ostream& out, PkgIterator i);
+	std::string FullName(bool const &Pretty = false) const;
 
 
 	// Constructors
 	// Constructors
 	inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator<Package, PkgIterator>(Owner, Trg), HashIndex(0) {
 	inline PkgIterator(pkgCache &Owner,Package *Trg) : Iterator<Package, PkgIterator>(Owner, Trg), HashIndex(0) {

+ 12 - 0
apt-pkg/pkgcache.cc

@@ -445,6 +445,18 @@ operator<<(ostream& out, pkgCache::PkgIterator Pkg)
    return out;
    return out;
 }
 }
 									/*}}}*/
 									/*}}}*/
+// PkgIterator::FullName - Returns Name and (maybe) Architecture	/*{{{*/
+// ---------------------------------------------------------------------
+/* Returns a name:arch string */
+std::string pkgCache::PkgIterator::FullName(bool const &Pretty) const
+{
+   string fullname = Name();
+   if (Pretty == false ||
+       (strcmp(Arch(), "all") != 0 && _config->Find("APT::Architecture") != Arch()))
+      return fullname.append(":").append(Arch());
+   return fullname;
+}
+									/*}}}*/
 // DepIterator::IsCritical - Returns true if the dep is important	/*{{{*/
 // DepIterator::IsCritical - Returns true if the dep is important	/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* Currently critical deps are defined as depends, predepends and
 /* Currently critical deps are defined as depends, predepends and

+ 28 - 31
cmdline/apt-cache.cc

@@ -139,7 +139,7 @@ bool UnMet(CommandLine &CmdL)
 	    // Oops, it failed..
 	    // Oops, it failed..
 	    if (Header == false)
 	    if (Header == false)
 	       ioprintf(cout,_("Package %s version %s has an unmet dep:\n"),
 	       ioprintf(cout,_("Package %s version %s has an unmet dep:\n"),
-			P.Name(),V.VerStr());
+			P.FullName(true).c_str(),V.VerStr());
 	    Header = true;
 	    Header = true;
 	    
 	    
 	    // Print out the dep type
 	    // Print out the dep type
@@ -149,7 +149,7 @@ bool UnMet(CommandLine &CmdL)
 	    Start = RealStart;
 	    Start = RealStart;
 	    do
 	    do
 	    {
 	    {
-	       cout << Start.TargetPkg().Name();
+	       cout << Start.TargetPkg().FullName(true);
 	       if (Start.TargetVer() != 0)
 	       if (Start.TargetVer() != 0)
 		  cout << " (" << Start.CompType() << " " << Start.TargetVer() <<
 		  cout << " (" << Start.CompType() << " " << Start.TargetVer() <<
 		  ")";
 		  ")";
@@ -182,7 +182,7 @@ bool DumpPackage(CommandLine &CmdL)
 	 continue;
 	 continue;
       }
       }
 
 
-      cout << "Package: " << Pkg.Name() << endl;
+      cout << "Package: " << Pkg.FullName(true) << endl;
       cout << "Versions: " << endl;
       cout << "Versions: " << endl;
       for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
       for (pkgCache::VerIterator Cur = Pkg.VersionList(); Cur.end() != true; Cur++)
       {
       {
@@ -204,7 +204,7 @@ bool DumpPackage(CommandLine &CmdL)
       cout << "Reverse Depends: " << endl;
       cout << "Reverse Depends: " << endl;
       for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() != true; D++)
       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)
 	 if (D->Version != 0)
 	    cout << ' ' << DeNull(D.TargetVer()) << endl;
 	    cout << ' ' << DeNull(D.TargetVer()) << endl;
 	 else
 	 else
@@ -216,7 +216,7 @@ bool DumpPackage(CommandLine &CmdL)
       {
       {
 	 cout << Cur.VerStr() << " - ";
 	 cout << Cur.VerStr() << " - ";
 	 for (pkgCache::DepIterator Dep = Cur.DependsList(); Dep.end() != true; Dep++)
 	 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;
 	 cout << endl;
       }      
       }      
 
 
@@ -225,12 +225,12 @@ bool DumpPackage(CommandLine &CmdL)
       {
       {
 	 cout << Cur.VerStr() << " - ";
 	 cout << Cur.VerStr() << " - ";
 	 for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
 	 for (pkgCache::PrvIterator Prv = Cur.ProvidesList(); Prv.end() != true; Prv++)
-	    cout << Prv.ParentPkg().Name() << " ";
+	    cout << Prv.ParentPkg().FullName(true) << " ";
 	 cout << endl;
 	 cout << endl;
       }
       }
       cout << "Reverse Provides: " << endl;
       cout << "Reverse Provides: " << endl;
       for (pkgCache::PrvIterator Prv = Pkg.ProvidesList(); Prv.end() != true; Prv++)
       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;
    return true;
@@ -353,13 +353,13 @@ bool Dump(CommandLine &Cmd)
    
    
    for (pkgCache::PkgIterator P = Cache.PkgBegin(); P.end() == false; P++)
    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++)
       for (pkgCache::VerIterator V = P.VersionList(); V.end() == false; V++)
       {
       {
 	 cout << " Version: " << V.VerStr() << endl;
 	 cout << " Version: " << V.VerStr() << endl;
 	 cout << "     File: " << V.FileList().File().FileName() << endl;
 	 cout << "     File: " << V.FileList().File().FileName() << endl;
 	 for (pkgCache::DepIterator D = V.DependsList(); D.end() == false; D++)
 	 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;
 	                     DeNull(D.TargetVer()) << endl;
 	 for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
 	 for (pkgCache::DescIterator D = V.DescriptionList(); D.end() == false; D++)
 	 {
 	 {
@@ -570,11 +570,11 @@ bool Depends(CommandLine &CmdL)
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 if (Ver.end() == true)
 	 if (Ver.end() == true)
 	 {
 	 {
-	    cout << '<' << Pkg.Name() << '>' << endl;
+	    cout << '<' << Pkg.FullName(true) << '>' << endl;
 	    continue;
 	    continue;
 	 }
 	 }
 	 
 	 
-	 cout << Pkg.Name() << endl;
+	 cout << Pkg.FullName(true) << endl;
 	 
 	 
 	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
 	 for (pkgCache::DepIterator D = Ver.DependsList(); D.end() == false; D++)
 	 {
 	 {
@@ -596,9 +596,9 @@ bool Depends(CommandLine &CmdL)
 	    
 	    
 		// Show the package
 		// Show the package
 		if (Trg->VersionList == 0)
 		if (Trg->VersionList == 0)
-		  cout << D.DepType() << ": <" << Trg.Name() << ">" << endl;
+		  cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl;
 		else
 		else
-		  cout << D.DepType() << ": " << Trg.Name() << endl;
+		  cout << D.DepType() << ": " << Trg.FullName(true) << endl;
 	    
 	    
 		if (Recurse == true)
 		if (Recurse == true)
 		  Colours[D.TargetPkg()->ID]++;
 		  Colours[D.TargetPkg()->ID]++;
@@ -614,7 +614,7 @@ bool Depends(CommandLine &CmdL)
 	       if (V != Cache.VerP + V.ParentPkg()->VersionList ||
 	       if (V != Cache.VerP + V.ParentPkg()->VersionList ||
 		   V->ParentPkg == D->Package)
 		   V->ParentPkg == D->Package)
 		  continue;
 		  continue;
-	       cout << "    " << V.ParentPkg().Name() << endl;
+	       cout << "    " << V.ParentPkg().FullName(true) << endl;
 	       
 	       
 	       if (Recurse == true)
 	       if (Recurse == true)
 		  Colours[D.ParentPkg()->ID]++;
 		  Colours[D.ParentPkg()->ID]++;
@@ -663,11 +663,11 @@ bool RDepends(CommandLine &CmdL)
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 pkgCache::VerIterator Ver = Pkg.VersionList();
 	 if (Ver.end() == true)
 	 if (Ver.end() == true)
 	 {
 	 {
-	    cout << '<' << Pkg.Name() << '>' << endl;
+	    cout << '<' << Pkg.FullName(true) << '>' << endl;
 	    continue;
 	    continue;
 	 }
 	 }
 	 
 	 
-	 cout << Pkg.Name() << endl;
+	 cout << Pkg.FullName(true) << endl;
 	 
 	 
 	 cout << "Reverse Depends:" << endl;
 	 cout << "Reverse Depends:" << endl;
 	 for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
 	 for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
@@ -684,9 +684,9 @@ bool RDepends(CommandLine &CmdL)
 		  cout << "  ";
 		  cout << "  ";
 
 
 		if (Trg->VersionList == 0)
 		if (Trg->VersionList == 0)
-		  cout << D.DepType() << ": <" << Trg.Name() << ">" << endl;
+		  cout << D.DepType() << ": <" << Trg.FullName(true) << ">" << endl;
 		else
 		else
-		  cout << Trg.Name() << endl;
+		  cout << Trg.FullName(true) << endl;
 
 
 		if (Recurse == true)
 		if (Recurse == true)
 		  Colours[D.ParentPkg()->ID]++;
 		  Colours[D.ParentPkg()->ID]++;
@@ -702,7 +702,7 @@ bool RDepends(CommandLine &CmdL)
 	       if (V != Cache.VerP + V.ParentPkg()->VersionList ||
 	       if (V != Cache.VerP + V.ParentPkg()->VersionList ||
 		   V->ParentPkg == D->Package)
 		   V->ParentPkg == D->Package)
 		  continue;
 		  continue;
-	       cout << "    " << V.ParentPkg().Name() << endl;
+	       cout << "    " << V.ParentPkg().FullName(true) << endl;
 	       
 	       
 	       if (Recurse == true)
 	       if (Recurse == true)
 		  Colours[D.ParentPkg()->ID]++;
 		  Colours[D.ParentPkg()->ID]++;
@@ -863,7 +863,7 @@ bool XVcg(CommandLine &CmdL)
 	    // Only graph critical deps	    
 	    // Only graph critical deps	    
 	    if (D.IsCritical() == true)
 	    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
 	       // Colour the node for recursion
 	       if (Show[D.TargetPkg()->ID] <= DoneNR)
 	       if (Show[D.TargetPkg()->ID] <= DoneNR)
@@ -922,10 +922,10 @@ bool XVcg(CommandLine &CmdL)
 	 continue;
 	 continue;
 
 
       if (Show[Pkg->ID] == DoneNR)
       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]]);
 		Shapes[ShapeMap[Pkg->ID]]);
       else
       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]]);
 		Shapes[ShapeMap[Pkg->ID]]);
       
       
    }
    }
@@ -1084,7 +1084,7 @@ bool Dotty(CommandLine &CmdL)
 	    // Only graph critical deps	    
 	    // Only graph critical deps	    
 	    if (D.IsCritical() == true)
 	    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
 	       // Colour the node for recursion
 	       if (Show[D.TargetPkg()->ID] <= DoneNR)
 	       if (Show[D.TargetPkg()->ID] <= DoneNR)
@@ -1138,10 +1138,10 @@ bool Dotty(CommandLine &CmdL)
       
       
       // Orange box for early recursion stoppage
       // Orange box for early recursion stoppage
       if (Show[Pkg->ID] == DoneNR)
       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]]);
 		Shapes[ShapeMap[Pkg->ID]]);
       else
       else
-	 printf("\"%s\" [shape=%s];\n",Pkg.Name(),
+	 printf("\"%s\" [shape=%s];\n",Pkg.FullName(true).c_str(),
 		Shapes[ShapeMap[Pkg->ID]]);
 		Shapes[ShapeMap[Pkg->ID]]);
    }
    }
    
    
@@ -1561,7 +1561,7 @@ bool Policy(CommandLine &CmdL)
 	    continue;
 	    continue;
 
 
 	 // Print the package name and the version we are forcing to
 	 // Print the package name and the version we are forcing to
-	 cout << "     " << I.Name() << " -> ";
+	 cout << "     " << I.FullName(true) << " -> ";
 	 
 	 
 	 pkgCache::VerIterator V = Plcy.GetMatch(I);
 	 pkgCache::VerIterator V = Plcy.GetMatch(I);
 	 if (V.end() == true)
 	 if (V.end() == true)
@@ -1590,10 +1590,7 @@ bool Policy(CommandLine &CmdL)
       if (strcmp(Pkg.Arch(),"all") == 0)
       if (strcmp(Pkg.Arch(),"all") == 0)
 	 continue;
 	 continue;
 
 
-      if (myArch == Pkg.Arch())
-	 cout << Pkg.Name() << ":" << endl;
-      else
-	 cout << Pkg.Name() << ": [" << Pkg.Arch() << "]" << endl;
+      cout << Pkg.FullName(true) << ":" << endl;
 
 
       // Installed version
       // Installed version
       cout << _("  Installed: ");
       cout << _("  Installed: ");
@@ -1691,7 +1688,7 @@ bool Madison(CommandLine &CmdL)
                     {
                     {
                          if ((*IF)->FindInCache(*(VF.File().Cache())) == VF.File())
                          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;
                                         << (*IF)->Describe(true) << endl;
                          }
                          }
                     }
                     }

+ 34 - 46
cmdline/apt-get.cc

@@ -227,17 +227,6 @@ bool ShowList(ostream &out,string Title,string List,string VersionsList)
    return false;
    return false;
 }
 }
 									/*}}}*/
 									/*}}}*/
-// ShowPkg - display a package name					/*{{{*/
-// ---------------------------------------------------------------------
-/* Displays the package name and maybe also the architecture
-   if it is not the main architecture */
-string ShowPkg(pkgCache::PkgIterator const Pkg) {
-	string p = Pkg.Name();
-	if (strcmp(Pkg.Arch(),"all") != 0 && _config->Find("APT::Architecture") != Pkg.Arch())
-		p.append(":").append(Pkg.Arch());
-	return p;
-}
-									/*}}}*/
 // ShowBroken - Debugging aide						/*{{{*/
 // ShowBroken - Debugging aide						/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* This prints out the names of all the packages that are broken along
 /* This prints out the names of all the packages that are broken along
@@ -269,8 +258,8 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
       }
       }
       
       
       // Print out each package and the failed dependencies
       // Print out each package and the failed dependencies
-      out << " " << ShowPkg(I) << " :";
-      unsigned const Indent = ShowPkg(I).size() + 3;
+      out << " " << I.FullName(true) << " :";
+      unsigned const Indent = I.FullName(true).size() + 3;
       bool First = true;
       bool First = true;
       pkgCache::VerIterator Ver;
       pkgCache::VerIterator Ver;
       
       
@@ -323,7 +312,7 @@ void ShowBroken(ostream &out,CacheFile &Cache,bool Now)
 	       out << ' ' << End.DepType() << ": ";
 	       out << ' ' << End.DepType() << ": ";
 	    FirstOr = false;
 	    FirstOr = false;
 	    
 	    
-	    out << ShowPkg(Start.TargetPkg());
+	    out << Start.TargetPkg().FullName(true);
 	 
 	 
 	    // Show a quick summary of the version requirements
 	    // Show a quick summary of the version requirements
 	    if (Start.TargetVer() != 0)
 	    if (Start.TargetVer() != 0)
@@ -387,7 +376,7 @@ void ShowNew(ostream &out,CacheFile &Cache)
       if (Cache[I].NewInstall() == true) {
       if (Cache[I].NewInstall() == true) {
 	 if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	 if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	    continue;
 	    continue;
-         List += ShowPkg(I) + " ";
+         List += I.FullName(true) + " ";
          VersionsList += string(Cache[I].CandVersion) + "\n";
          VersionsList += string(Cache[I].CandVersion) + "\n";
       }
       }
    }
    }
@@ -412,9 +401,9 @@ void ShowDel(ostream &out,CacheFile &Cache)
 	 if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	 if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	    continue;
 	    continue;
 	 if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
 	 if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
-	    List += ShowPkg(I) + "* ";
+	    List += I.FullName(true) + "* ";
 	 else
 	 else
-	    List += ShowPkg(I) + " ";
+	    List += I.FullName(true) + " ";
      
      
      VersionsList += string(Cache[I].CandVersion)+ "\n";
      VersionsList += string(Cache[I].CandVersion)+ "\n";
       }
       }
@@ -439,7 +428,7 @@ void ShowKept(ostream &out,CacheFile &Cache)
 	  I->CurrentVer == 0 || Cache[I].Delete() == true)
 	  I->CurrentVer == 0 || Cache[I].Delete() == true)
 	 continue;
 	 continue;
       
       
-      List += ShowPkg(I) + " ";
+      List += I.FullName(true) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    }
    ShowList(out,_("The following packages have been kept back:"),List,VersionsList);
    ShowList(out,_("The following packages have been kept back:"),List,VersionsList);
@@ -462,7 +451,7 @@ void ShowUpgraded(ostream &out,CacheFile &Cache)
       if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
       if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	 continue;
 	 continue;
 
 
-      List += ShowPkg(I) + " ";
+      List += I.FullName(true) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    }
    ShowList(out,_("The following packages will be upgraded:"),List,VersionsList);
    ShowList(out,_("The following packages will be upgraded:"),List,VersionsList);
@@ -485,7 +474,7 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache)
       if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
       if (Cache[I].CandidateVerIter(Cache).Pseudo() == true)
 	 continue;
 	 continue;
 
 
-      List += ShowPkg(I) + " ";
+      List += I.FullName(true) + " ";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
       VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
    }
    }
    return ShowList(out,_("The following packages will be DOWNGRADED:"),List,VersionsList);
    return ShowList(out,_("The following packages will be DOWNGRADED:"),List,VersionsList);
@@ -503,7 +492,7 @@ bool ShowHold(ostream &out,CacheFile &Cache)
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       pkgCache::PkgIterator I(Cache,Cache.List[J]);
       if (Cache[I].InstallVer != (pkgCache::Version *)I.CurrentVer() &&
       if (Cache[I].InstallVer != (pkgCache::Version *)I.CurrentVer() &&
           I->SelectedState == pkgCache::State::Hold) {
           I->SelectedState == pkgCache::State::Hold) {
-         List += ShowPkg(I) + " ";
+         List += I.FullName(true) + " ";
 		 VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
 		 VersionsList += string(Cache[I].CurVersion) + " => " + Cache[I].CandVersion + "\n";
       }
       }
    }
    }
@@ -537,7 +526,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
 	 if (Added[I->ID] == false)
 	 if (Added[I->ID] == false)
 	 {
 	 {
 	    Added[I->ID] = true;
 	    Added[I->ID] = true;
-	    List += ShowPkg(I) + " ";
+	    List += I.FullName(true) + " ";
         //VersionsList += string(Cache[I].CurVersion) + "\n"; ???
         //VersionsList += string(Cache[I].CurVersion) + "\n"; ???
 	 }
 	 }
       }
       }
@@ -561,7 +550,7 @@ bool ShowEssential(ostream &out,CacheFile &Cache)
 	    Added[P->ID] = true;
 	    Added[P->ID] = true;
 	    
 	    
 	    char S[300];
 	    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;
 	    List += S;
         //VersionsList += "\n"; ???
         //VersionsList += "\n"; ???
 	 }	 
 	 }	 
@@ -1106,7 +1095,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
       if (found_one == true)
       if (found_one == true)
       {
       {
 	 ioprintf(c1out,_("Note, selecting %s instead of %s\n"),
 	 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;
 	 Pkg = Prov;
       }
       }
    }
    }
@@ -1117,7 +1106,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
    {
    {
       if (AllowFail == true)
       if (AllowFail == true)
 	 ioprintf(c1out,_("Skipping %s, it is already installed and upgrade is not set.\n"),
 	 ioprintf(c1out,_("Skipping %s, it is already installed and upgrade is not set.\n"),
-		  Pkg.Name());
+		  Pkg.FullName(true).c_str());
       return true;
       return true;
    }
    }
    
    
@@ -1134,7 +1123,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
       if (AllowFail == false)
       if (AllowFail == false)
 	 return 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;
       return true;
    }
    }
    
    
@@ -1146,7 +1135,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
       if (Pkg->ProvidesList != 0)
       if (Pkg->ProvidesList != 0)
       {
       {
 	 ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
 	 ioprintf(c1out,_("Package %s is a virtual package provided by:\n"),
-		  Pkg.Name());
+		  Pkg.FullName(true).c_str());
 	 
 	 
 	 pkgCache::PrvIterator I = Pkg.ProvidesList();
 	 pkgCache::PrvIterator I = Pkg.ProvidesList();
 	 for (; I.end() == false; I++)
 	 for (; I.end() == false; I++)
@@ -1156,10 +1145,10 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
 	    if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer())
 	    if (Cache[Pkg].CandidateVerIter(Cache) == I.OwnerVer())
 	    {
 	    {
 	       if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false)
 	       if (Cache[Pkg].Install() == true && Cache[Pkg].NewInstall() == false)
-		  c1out << "  " << Pkg.Name() << " " << I.OwnerVer().VerStr() <<
+		  c1out << "  " << Pkg.FullName(true) << " " << I.OwnerVer().VerStr() <<
 		  _(" [Installed]") << endl;
 		  _(" [Installed]") << endl;
 	       else
 	       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;
 	 c1out << _("You should explicitly select one to install.") << endl;
@@ -1169,7 +1158,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
 	 ioprintf(c1out,
 	 ioprintf(c1out,
 	 _("Package %s is not available, but is referred to by another package.\n"
 	 _("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"
 	   "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 List;
 	 string VersionsList;
 	 string VersionsList;
@@ -1183,13 +1172,13 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
 	    if (Seen[Dep.ParentPkg()->ID] == true)
 	    if (Seen[Dep.ParentPkg()->ID] == true)
 	       continue;
 	       continue;
 	    Seen[Dep.ParentPkg()->ID] = true;
 	    Seen[Dep.ParentPkg()->ID] = true;
-	    List += string(Dep.ParentPkg().Name()) + " ";
+	    List += Dep.ParentPkg().FullName(true) + " ";
         //VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ???
         //VersionsList += string(Dep.ParentPkg().CurVersion) + "\n"; ???
 	 }	    
 	 }	    
 	 ShowList(c1out,_("However the following packages replace it:"),List,VersionsList);
 	 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;
       return false;
    }
    }
 
 
@@ -1210,7 +1199,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
       {
       {
 	 if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false)
 	 if (Pkg->CurrentVer == 0 || Pkg.CurrentVer().Downloadable() == false)
 	    ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
 	    ioprintf(c1out,_("Reinstallation of %s is not possible, it cannot be downloaded.\n"),
-		     Pkg.Name());
+		     Pkg.FullName(true).c_str());
 	 else
 	 else
 	    Cache.SetReInstall(Pkg,true);
 	    Cache.SetReInstall(Pkg,true);
       }      
       }      
@@ -1218,7 +1207,7 @@ bool TryToInstall(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
       {
       {
 	 if (AllowFail == true)
 	 if (AllowFail == true)
 	    ioprintf(c1out,_("%s is already the newest version.\n"),
 	    ioprintf(c1out,_("%s is already the newest version.\n"),
-		     Pkg.Name());
+		     Pkg.FullName(true).c_str());
       }      
       }      
    }   
    }   
    else
    else
@@ -1247,15 +1236,15 @@ bool TryToChangeVer(pkgCache::PkgIterator Pkg,pkgDepCache &Cache,
    {
    {
       if (IsRel == true)
       if (IsRel == true)
 	 return _error->Error(_("Release '%s' for '%s' was not found"),
 	 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"),
       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)
    if (strcmp(VerTag,Ver.VerStr()) != 0)
    {
    {
       ioprintf(c1out,_("Selected version %s (%s) for %s\n"),
       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);
    Cache.SetCandidateVersion(Ver);
@@ -1511,7 +1500,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
       {
       {
 	 if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
 	 if(Pkg.CurrentVer() != 0 || Cache[Pkg].Install())
 	    if(Debug)
 	    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)
 	 if (doAutoRemove)
 	 {
 	 {
@@ -1530,7 +1519,7 @@ bool DoAutomaticRemove(CacheFile &Cache)
 	       // we don't need to fill the strings if we don't need them
 	       // we don't need to fill the strings if we don't need them
 	       if (smallList == false)
 	       if (smallList == false)
 	       {
 	       {
-		 autoremovelist += string(Pkg.Name()) + " ";
+		 autoremovelist += Pkg.FullName(true) + " ";
 		 autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
 		 autoremoveversions += string(Cache[Pkg].CandVersion) + "\n";
 	       }
 	       }
 	    }
 	    }
@@ -1804,7 +1793,7 @@ bool DoInstall(CommandLine &CmdL)
 	       _config->FindB("APT::Get::Download-Only",false) == false)
 	       _config->FindB("APT::Get::Download-Only",false) == false)
 	    {
 	    {
 	       ioprintf(c1out,_("%s set to manually installed.\n"),
 	       ioprintf(c1out,_("%s set to manually installed.\n"),
-			Pkg.Name());
+			Pkg.FullName(true).c_str());
 	       Cache->MarkAuto(Pkg,false);
 	       Cache->MarkAuto(Pkg,false);
 	       AutoMarkChanged++;
 	       AutoMarkChanged++;
 	    }
 	    }
@@ -1873,7 +1862,7 @@ bool DoInstall(CommandLine &CmdL)
 		break;
 		break;
 	 
 	 
 	 if (*J == 0) {
 	 if (*J == 0) {
-	    List += string(I.Name()) + " ";
+	    List += I.FullName(true) + " ";
 	    VersionsList += string(Cache[I].CandVersion) + "\n";
 	    VersionsList += string(Cache[I].CandVersion) + "\n";
 	 }
 	 }
       }
       }
@@ -1909,7 +1898,7 @@ bool DoInstall(CommandLine &CmdL)
 	    for(;;)
 	    for(;;)
 	    {
 	    {
 	       /* Skip if package is  installed already, or is about to be */
 	       /* 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
 	       if ((*Start.TargetPkg()).SelectedState == pkgCache::State::Install
 		   || Cache[Start.TargetPkg()].Install())
 		   || Cache[Start.TargetPkg()].Install())
@@ -2559,7 +2548,7 @@ bool DoBuildDep(CommandLine &CmdL)
             for (; Prv.end() != true; Prv++)
             for (; Prv.end() != true; Prv++)
 	    {
 	    {
                if (_config->FindB("Debug::BuildDeps",false) == true)
                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)
 	       if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false)
 	          break;
 	          break;
@@ -2600,7 +2589,7 @@ bool DoBuildDep(CommandLine &CmdL)
                if (Prv.end() == false)
                if (Prv.end() == false)
                {
                {
                   if (_config->FindB("Debug::BuildDeps",false) == true)
                   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;
                   skipAlternatives = hasAlternatives;
                   continue;
                   continue;
                }
                }
@@ -2625,7 +2614,7 @@ bool DoBuildDep(CommandLine &CmdL)
                   return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
                   return _error->Error(_("Failed to satisfy %s dependency for %s: Installed package %s is too new"),
                                        Last->BuildDepType((*D).Type),
                                        Last->BuildDepType((*D).Type),
                                        Src.c_str(),
                                        Src.c_str(),
-                                       Pkg.Name());
+                                       Pkg.FullName(true).c_str());
                }
                }
             }
             }
 
 
@@ -2674,7 +2663,6 @@ bool DoBuildDep(CommandLine &CmdL)
    return true;
    return true;
 }
 }
 									/*}}}*/
 									/*}}}*/
-
 // DoMoo - Never Ask, Never Tell					/*{{{*/
 // DoMoo - Never Ask, Never Tell					/*{{{*/
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 /* */
 /* */