[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#195510: Patch



retitle 195510 [libapt-pkg] apt-get -s remove displays candidate version (ABI change)
thanks

Unfortunately, this patch changes the library ABI because Describe is a
protected member function, though it is only used internally.  This patch
changes it to be private, and adds the capability to display only the
installed version (which is what will be removed).

-- 
 - mdz
Index: algorithms.cc
===================================================================
RCS file: /cvs/deity/apt/apt-pkg/algorithms.cc,v
retrieving revision 1.44
diff -u -u -r1.44 algorithms.cc
--- algorithms.cc	28 Nov 2002 18:49:16 -0000	1.44
+++ algorithms.cc	2 Aug 2003 18:24:41 -0000
@@ -50,26 +50,29 @@
 									/*}}}*/
 // Simulate::Describe - Describe a package				/*{{{*/
 // ---------------------------------------------------------------------
-/* Parameter Now == true gives both current and available varsion,
-   Parameter Now == false gives only the available package version */
-void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Now)
+/* Parameter Current == true displays the current package version,
+   Parameter Candidate == true displays the candidate package version */
+void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candidate)
 {
    VerIterator Ver(Sim);
  
    out << Pkg.Name();
 
-   if (Now == true)
+   if (Current == true)
    {
       Ver = Pkg.CurrentVer();
       if (Ver.end() == false)
          out << " [" << Ver.VerStr() << ']';
    }
 
-   Ver = Sim[Pkg].CandidateVerIter(Sim);
-   if (Ver.end() == true)
-      return;
+   if (Candidate == true)
+   {
+      Ver = Sim[Pkg].CandidateVerIter(Sim);
+      if (Ver.end() == true)
+         return;
    
-   out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')';
+      out << " (" << Ver.VerStr() << ' ' << Ver.RelStr() << ')';
+   }
 }
 									/*}}}*/
 // Simulate::Install - Simulate unpacking of a package			/*{{{*/
@@ -82,7 +85,7 @@
    Flags[Pkg->ID] = 1;
    
    cout << "Inst ";
-   Describe(Pkg,cout,true);
+   Describe(Pkg,cout,true,true);
    Sim.MarkInstall(Pkg,false);
    
    // Look for broken conflicts+predepends.
@@ -156,7 +159,7 @@
    else
    {
       cout << "Conf "; 
-      Describe(Pkg,cout,false);
+      Describe(Pkg,cout,false,true);
    }
 
    if (Sim.BrokenCount() != 0)
@@ -181,7 +184,7 @@
       cout << "Purg ";
    else
       cout << "Remv ";
-   Describe(Pkg,cout,false);
+   Describe(Pkg,cout,true,false);
 
    if (Sim.BrokenCount() != 0)
       ShortBreaks();
Index: algorithms.h
===================================================================
RCS file: /cvs/deity/apt/apt-pkg/algorithms.h,v
retrieving revision 1.10
diff -u -u -r1.10 algorithms.h
--- algorithms.h	22 May 2001 04:17:41 -0000	1.10
+++ algorithms.h	2 Aug 2003 18:24:41 -0000
@@ -67,8 +67,10 @@
    virtual bool Install(PkgIterator Pkg,string File);
    virtual bool Configure(PkgIterator Pkg);
    virtual bool Remove(PkgIterator Pkg,bool Purge);
+
+private:
    void ShortBreaks();
-   void Describe(PkgIterator iPkg,ostream &out,bool Now);
+   void Describe(PkgIterator iPkg,ostream &out,bool Current,bool Candidate);
    
    public:
 

Reply to: