- removed unused methods from Patch and PatchImplIf. Provided
authorMichael Andres <ma@suse.de>
Thu, 16 Nov 2006 22:38:07 +0000 (22:38 +0000)
committerMichael Andres <ma@suse.de>
Thu, 16 Nov 2006 22:38:07 +0000 (22:38 +0000)
  reasonable default implementation for Patch::interactive
  (in PatchImplIf).

14 files changed:
testsuite/src/helix/HelixPatchImpl.cc
testsuite/src/helix/HelixPatchImpl.h
zypp/Patch.cc
zypp/Patch.h
zypp/detail/PatchImpl.cc
zypp/detail/PatchImpl.h
zypp/detail/PatchImplIf.cc
zypp/detail/PatchImplIf.h
zypp/source/yum/YUMPatchImpl.cc
zypp/source/yum/YUMPatchImpl.h
zypp/target/store/xml/XMLPatchImpl.cc
zypp/target/store/xml/XMLPatchImpl.h
zypp2/source/sqlite-source/SqlitePatchImpl.cc
zypp2/source/sqlite-source/SqlitePatchImpl.h

index 3bde3d6..777fee0 100644 (file)
@@ -43,45 +43,29 @@ ByteCount HelixPatchImpl::size() const
 { return _size_installed; }
 
       /** Patch ID */
-std::string HelixPatchImpl::id() const 
+std::string HelixPatchImpl::id() const
 { return ""; }
 
       /** Patch time stamp */
-Date HelixPatchImpl::timestamp() const 
+Date HelixPatchImpl::timestamp() const
 { return 0; }
 
       /** Patch category (recommended, security,...) */
-std::string HelixPatchImpl::category() const 
+std::string HelixPatchImpl::category() const
 { return ""; }
 
       /** Does the system need to reboot to finish the update process? */
-bool HelixPatchImpl::reboot_needed() const 
+bool HelixPatchImpl::reboot_needed() const
 { return false; }
 
       /** Does the patch affect the package manager itself? */
-bool HelixPatchImpl::affects_pkg_manager() const 
-{ return false; }
-
-      /** Is the patch installation interactive? (does it need user input?) */
-bool HelixPatchImpl::interactive() const 
+bool HelixPatchImpl::affects_pkg_manager() const
 { return false; }
 
       /** The list of all atoms building the patch */
 PatchImplIf::AtomList HelixPatchImpl::all_atoms() const
 { return AtomList(); }
 
-      /** The list of those atoms which have not been installed */
-PatchImplIf::AtomList HelixPatchImpl::not_installed_atoms() const
-{ return AtomList(); }
-
-
-// TODO check necessarity of functions below
-void HelixPatchImpl::mark_atoms_to_freshen(bool freshen) 
-{ return; }
-
-bool HelixPatchImpl::any_atom_selected() const
-{ return false; }
-
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index 065c01c..e678676 100644 (file)
@@ -47,20 +47,10 @@ public:
       virtual bool affects_pkg_manager() const ;
       /** */
       virtual ByteCount size() const;
-
-      /** Is the patch installation interactive? (does it need user input?) */
-      virtual bool interactive() const;
       /** The list of all atoms building the patch */
       virtual AtomList all_atoms() const;
-      /** The list of those atoms which have not been installed */
-      virtual AtomList not_installed_atoms() const;
-
-// TODO check necessarity of functions below
-      virtual void mark_atoms_to_freshen(bool freshen) ;
-      virtual bool any_atom_selected() const;
-
-       /** */
-       virtual Source_Ref source() const;
+      /** */
+      virtual Source_Ref source() const;
 
 protected:
        Source_Ref _source;
index abd14a3..f3fd3f6 100644 (file)
@@ -18,7 +18,7 @@ namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   IMPL_PTR_TYPE( Patch );
+
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Patch::Patch
@@ -63,14 +63,14 @@ namespace zypp
   bool Patch::interactive() const
   { return pimpl().interactive(); }
 
-  void Patch::mark_atoms_to_freshen(bool freshen)
-  { pimpl().mark_atoms_to_freshen(freshen); }
 
+  // DEPRECATED:
+  void Patch::mark_atoms_to_freshen(bool freshen)
+  { ; }
   bool Patch::any_atom_selected()
-  { return pimpl().any_atom_selected(); }
-
+  { return false; }
   void Patch::select()
-  { pimpl().mark_atoms_to_freshen(true); }
+  { ; }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index 7730815..655f2b1 100644 (file)
@@ -20,7 +20,7 @@ namespace zypp
 { /////////////////////////////////////////////////////////////////
 
   DEFINE_PTR_TYPE(Patch);
-  
+
   ///////////////////////////////////////////////////////////////////
   //
   //   CLASS NAME : Patch
@@ -56,10 +56,11 @@ namespace zypp
     AtomList atoms() const;
     /** Is the patch installation interactive? (does it need user input?) */
     bool interactive() const;
-    // TODO add comments and reevaluate the need for functions below
-    void mark_atoms_to_freshen(bool freshen);
-    bool any_atom_selected();
-    void select(); // TODO parameter to specify select/unselect or another function
+
+
+    void mark_atoms_to_freshen(bool freshen) ZYPP_DEPRECATED;
+    bool any_atom_selected() ZYPP_DEPRECATED;
+    void select() ZYPP_DEPRECATED;
 
   protected:
     /** Ctor */
index 6691498..a453294 100644 (file)
@@ -72,90 +72,10 @@ namespace zypp
       return _affects_pkg_manager;
     }
 
-    bool PatchImpl::interactive() const {
-      if (_reboot_needed)
-      {
-       DBG << "Patch needs reboot" << endl;
-       return true;
-      }
-      AtomList not_installed = not_installed_atoms();
-      for (AtomList::const_iterator it = not_installed.begin();
-       it != not_installed.end();
-       it++)
-      {
-       if ((*it)->kind() == "Message")
-       {
-//       DBG << "Patch contains a message" << endl;
-         return true;
-       }
-       if ((*it)->kind() == "Package")
-       {
-                                // Resolvable*
-                                 // Resolvable
-                                  // ResolvablePtr
-
-
-          // <ma> never do somthing like this!!!
-//       Package* p = (Package*)&**it;
-          //
-          // (*it) is a ResolvablePtr
-
-
-
-
-         // FIXME use the condition
-//       if (p->licenseToConfirm() != "")
-         if (false)
-         {
-//         DBG << "Package has a license to be shown to user" << endl;
-           return true;
-         }
-       }
-      }
-      return false;
-    }
-
     PatchImpl::AtomList PatchImpl::all_atoms() const {
       return _atoms;
     }
 
-    PatchImpl::AtomList PatchImpl::not_installed_atoms() const {
-      AtomList ret;
-      for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       if (true) // FIXME check if atom/resolvable is not installed
-       {
-         ret.push_back(*it);
-       }
-      }
-      return ret;
-    }
-
-// TODO check necessarity of functions below
-
-    bool PatchImpl::any_atom_selected() const {
-      for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       if (false) // FIXME check if atom/resolvable is selected
-       {
-         return true;
-       }
-      }
-      return false;
-    }
-
-    void PatchImpl::mark_atoms_to_freshen( bool freshen ) {
-      for (AtomList::iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       // TODO mark the resolvable to be or not to be freshed
-      }
-    }
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index 1f4f2f5..c18593d 100644 (file)
@@ -39,30 +39,22 @@ namespace zypp
 
     public:
       /** Patch ID */
-      std::string id() const;
+      virtual std::string id() const;
       /** Patch time stamp */
-      Date timestamp() const;
+      virtual Date timestamp() const;
       /** Patch summary */
-      TranslatedText summary() const;
+      virtual TranslatedText summary() const;
       /** Patch description */
-      TranslatedText description() const;
+      virtual TranslatedText description() const;
       /** Patch category (recommended, security,...) */
-      std::string category() const;
+      virtual std::string category() const;
       /** Does the system need to reboot to finish the update process? */
-      bool reboot_needed() const;
+      virtual bool reboot_needed() const;
       /** Does the patch affect the package manager itself? */
-      bool affects_pkg_manager() const;
-
-      /** Is the patch installation interactive? (does it need user input?) */
-      bool interactive() const;
+      virtual bool affects_pkg_manager() const;
       /** The list of all atoms building the patch */
-      AtomList all_atoms() const;
-      /** The list of those atoms which have not been installed */
-      AtomList not_installed_atoms() const;
+      virtual AtomList all_atoms() const;
 
-// TODO check necessarity of functions below
-      bool any_atom_selected() const;
-      void mark_atoms_to_freshen(bool freshen);
     protected:
       /** Patch ID */
       std::string _patch_id;
index 4e452ad..e7e082f 100644 (file)
@@ -42,19 +42,27 @@ namespace zypp
     { return ByteCount(); }
 
     bool PatchImplIf::interactive() const
-    { return false; }
-
-    PatchImplIf::AtomList PatchImplIf::all_atoms() const
-    { return AtomList(); }
+    {
+      if ( reboot_needed() )
+        {
+          return true;
+        }
 
-    PatchImplIf::AtomList PatchImplIf::not_installed_atoms() const
-    { return AtomList(); }
+      AtomList atoms = all_atoms();
+      for ( AtomList::const_iterator it = atoms.begin(); it != atoms.end(); it++)
+        {
+          if (    isKind<Message>( *it )
+               || ! licenseToConfirm().empty() )
+            {
+              return true;
+            }
+        }
 
-    void PatchImplIf::mark_atoms_to_freshen(bool)
-    { return; }
+      return false;
+    }
 
-    bool PatchImplIf::any_atom_selected() const
-    { return false; }
+    PatchImplIf::AtomList PatchImplIf::all_atoms() const
+    { return AtomList(); }
 
     /////////////////////////////////////////////////////////////////
   } // namespace detail
index e77a23f..e963c3c 100644 (file)
@@ -53,17 +53,10 @@ namespace zypp
       virtual bool affects_pkg_manager() const PURE_VIRTUAL;
       /** */
       virtual ByteCount size() const;
-
       /** Is the patch installation interactive? (does it need user input?) */
       virtual bool interactive() const PURE_VIRTUAL;
       /** The list of all atoms building the patch */
       virtual AtomList all_atoms() const PURE_VIRTUAL;
-      /** The list of those atoms which have not been installed */
-      virtual AtomList not_installed_atoms() const PURE_VIRTUAL;
-
-// TODO check necessarity of functions below
-      virtual void mark_atoms_to_freshen(bool freshen) PURE_VIRTUAL;
-      virtual bool any_atom_selected() const PURE_VIRTUAL;
     };
     ///////////////////////////////////////////////////////////////////
 
index 2c91a80..0bba4d9 100644 (file)
@@ -151,96 +151,11 @@ bool YUMPatchImpl::affects_pkg_manager() const
   return _affects_pkg_manager;
 }
 
-bool YUMPatchImpl::interactive() const
-{
-  if (_reboot_needed)
-  {
-    DBG << "Patch needs reboot" << endl;
-    return true;
-  }
-  AtomList not_installed = not_installed_atoms();
-  for (AtomList::iterator it = not_installed.begin();
-       it != not_installed.end();
-       it++)
-  {
-    if ((*it)->kind() == "Message")
-    {
-      //          DBG << "Patch contains a message" << endl;
-      return true;
-    }
-    if ((*it)->kind() == "Package")
-    {
-      // Resolvable*
-      // Resolvable
-      // ResolvablePtr
-
-
-      // <ma> never do somthing like this!!!
-      //          Package* p = (Package*)&**it;
-      //
-      // (*it) is a ResolvablePtr
-
-
-
-
-      // FIXME use the condition
-      //          if (p->licenseToConfirm() != "")
-      if (false)
-      {
-        //            DBG << "Package has a license to be shown to user" << endl;
-        return true;
-      }
-    }
-  }
-  return false;
-}
-
 YUMPatchImpl::AtomList YUMPatchImpl::all_atoms() const
 {
   return _atoms;
 }
 
-YUMPatchImpl::AtomList YUMPatchImpl::not_installed_atoms() const
-{
-  AtomList ret;
-  for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-  {
-    if (true) // FIXME check if atom/resolvable is not installed
-    {
-      ret.push_back(*it);
-    }
-  }
-  return ret;
-}
-
-// TODO check necessarity of functions below
-
-bool YUMPatchImpl::any_atom_selected() const
-{
-  for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-  {
-    if (false) // FIXME check if atom/resolvable is selected
-    {
-      return true;
-    }
-  }
-  return false;
-}
-
-void YUMPatchImpl::mark_atoms_to_freshen( bool freshen )
-{
-  for (AtomList::iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-  {
-    // TODO mark the resolvable to be or not to be freshed
-  }
-}
-
 Source_Ref YUMPatchImpl::source() const
 {
   return _source;
index 5aceacc..be93357 100644 (file)
@@ -42,21 +42,17 @@ public:
     YUMSourceImpl & srcimpl_r
   );
   /** Patch ID */
-  std::string id() const;
+  virtual std::string id() const;
   /** Patch time stamp */
-  Date timestamp() const;
+  virtual Date timestamp() const;
   /** Patch category (recommended, security,...) */
-  std::string category() const;
+  virtual std::string category() const;
   /** Does the system need to reboot to finish the update process? */
-  bool reboot_needed() const;
+  virtual bool reboot_needed() const;
   /** Does the patch affect the package manager itself? */
-  bool affects_pkg_manager() const;
-  /** Is the patch installation interactive? (does it need user input?) */
-  bool interactive() const;
+  virtual bool affects_pkg_manager() const;
   /** The list of all atoms building the patch */
-  AtomList all_atoms() const;
-  /** The list of those atoms which have not been installed */
-  AtomList not_installed_atoms() const;
+  virtual AtomList all_atoms() const;
 
   /** Patch summary */
   virtual TranslatedText summary() const;
@@ -65,9 +61,6 @@ public:
 
   virtual TranslatedText licenseToConfirm() const;
 
-// TODO check necessarity of functions below
-  bool any_atom_selected() const;
-  void mark_atoms_to_freshen(bool freshen);
 protected:
   std::string _patch_id;
   Date _timestamp;
index 6439092..84e6008 100644 (file)
@@ -62,90 +62,10 @@ namespace zypp
       return _affects_pkg_manager;
     }
 
-    bool XMLPatchImpl::interactive() const {
-      if (_reboot_needed)
-      {
-       DBG << "Patch needs reboot" << endl;
-       return true;
-      }
-      AtomList not_installed = not_installed_atoms();
-      for (AtomList::const_iterator it = not_installed.begin();
-       it != not_installed.end();
-       it++)
-      {
-       if ((*it)->kind() == "Message")
-       {
-//       DBG << "Patch contains a message" << endl;
-         return true;
-       }
-       if ((*it)->kind() == "Package")
-       {
-                                // Resolvable*
-                                 // Resolvable
-                                  // ResolvablePtr
-
-
-          // <ma> never do somthing like this!!!
-//       Package* p = (Package*)&**it;
-          //
-          // (*it) is a ResolvablePtr
-
-
-
-
-         // FIXME use the condition
-//       if (p->licenseToConfirm() != "")
-         if (false)
-         {
-//         DBG << "Package has a license to be shown to user" << endl;
-           return true;
-         }
-       }
-      }
-      return false;
-    }
-
     XMLPatchImpl::AtomList XMLPatchImpl::all_atoms() const {
       return _atoms;
     }
 
-    XMLPatchImpl::AtomList XMLPatchImpl::not_installed_atoms() const {
-      AtomList ret;
-      for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       if (true) // FIXME check if atom/resolvable is not installed
-       {
-         ret.push_back(*it);
-       }
-      }
-      return ret;
-    }
-
-// TODO check necessarity of functions below
-
-    bool XMLPatchImpl::any_atom_selected() const {
-      for (AtomList::const_iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       if (false) // FIXME check if atom/resolvable is selected
-       {
-         return true;
-       }
-      }
-      return false;
-    }
-
-    void XMLPatchImpl::mark_atoms_to_freshen( bool freshen ) {
-      for (AtomList::iterator it = _atoms.begin();
-       it != _atoms.end();
-       it++)
-      {
-       // TODO mark the resolvable to be or not to be freshed
-      }
-    }
     /////////////////////////////////////////////////////////////////
   } // namespace detail
   ///////////////////////////////////////////////////////////////////
index f9ba564..b580f0e 100644 (file)
@@ -35,57 +35,49 @@ namespace zypp
       virtual TranslatedText description() const
       { return _description; }
       virtual TranslatedText insnotify() const
-      { return _install_notify; }    
+      { return _install_notify; }
       virtual TranslatedText delnotify() const
-      { return _delete_notify; }    
+      { return _delete_notify; }
       virtual TranslatedText licenseToConfirm() const
-      { return _license_to_confirm; }    
+      { return _license_to_confirm; }
       virtual Vendor vendor() const
-      { return _vendor; }    
+      { return _vendor; }
       virtual ByteCount size() const
-      { return _size; }    
+      { return _size; }
       virtual ByteCount archivesize() const
-      { return _archive_size; }    
+      { return _archive_size; }
       virtual unsigned sourceMediaNr() const
-      { return 0; }    
+      { return 0; }
       virtual bool installOnly() const
-      { return _install_only; }    
+      { return _install_only; }
       virtual Date buildtime() const
-      { return _build_time; }    
+      { return _build_time; }
       virtual Date installtime() const
-      { return _install_time; }    
-      
+      { return _install_time; }
+
       /** Patch ID */
-      std::string id() const;
+      virtual std::string id() const;
       /** Patch time stamp */
-      Date timestamp() const;
+      virtual Date timestamp() const;
       /** Patch category (recommended, security,...) */
-      std::string category() const;
+      virtual std::string category() const;
       /** Does the system need to reboot to finish the update process? */
-      bool reboot_needed() const;
+      virtual bool reboot_needed() const;
       /** Does the patch affect the package manager itself? */
-      bool affects_pkg_manager() const;
+      virtual bool affects_pkg_manager() const;
 
-      /** Is the patch installation interactive? (does it need user input?) */
-      bool interactive() const;
       /** The list of all atoms building the patch */
-      AtomList all_atoms() const;
-      /** The list of those atoms which have not been installed */
-      AtomList not_installed_atoms() const;
+      virtual AtomList all_atoms() const;
 
-// TODO check necessarity of functions below
-      bool any_atom_selected() const;
-      void mark_atoms_to_freshen(bool freshen);
-    
 
       /** Patch ID */
       std::string _patch_id;
       /** Patch time stamp */
       Date _timestamp;
-      
+
       TranslatedText _summary;
       TranslatedText _description;
-      
+
       TranslatedText _install_notify;
       TranslatedText _delete_notify;
       TranslatedText _license_to_confirm;
@@ -95,8 +87,8 @@ namespace zypp
       bool _install_only;
       Date _build_time;
       Date _install_time;
-      
-      
+
+
       /** Patch category (recommended, security,...) */
       std::string _category;
       /** Does the system need to reboot to finish the update process? */
index 226fe96..870ea7a 100644 (file)
@@ -62,7 +62,7 @@ void
 SqlitePatchImpl::readHandle( sqlite_int64 id, sqlite3_stmt *handle )
 {
     _zmdid = id;
-    
+
     // 1-5: nvra, see SqliteSourceImpl
     _size_installed = sqlite3_column_int( handle, PATCHES_TABLE_COLUMN_SIZE_INSTALLED );
     // 7: catalog
@@ -110,9 +110,6 @@ bool SqlitePatchImpl::reboot_needed() const
 /** Does the patch affect the package manager itself? */
 bool SqlitePatchImpl::affects_pkg_manager() const
 { return _affects_pkg_manager; }
-/** Is the patch installation interactive? (does it need user input?) */
-bool SqlitePatchImpl::interactive() const
-{ return _interactive; }
 
   /////////////////////////////////////////////////////////////////
 } // namespace zypp
index 465397a..c024685 100644 (file)
@@ -52,22 +52,9 @@ public:
       virtual bool affects_pkg_manager() const;
       /** */
       virtual ByteCount size() const;
-
-      /** Is the patch installation interactive? (does it need user input?) */
-      virtual bool interactive() const;
-
       /** The list of all atoms building the patch */
       virtual AtomList all_atoms() const
       { return AtomList(); }
-      /** The list of those atoms which have not been installed */
-      virtual AtomList not_installed_atoms() const
-      { return AtomList(); }
-
-// TODO check necessarity of functions below
-      virtual void mark_atoms_to_freshen(bool freshen)
-      { return; }
-      virtual bool any_atom_selected() const
-      { return false; }
 
 protected:
        Source_Ref _source;
@@ -77,6 +64,8 @@ protected:
        std::string _category;
        bool _reboot_needed;
        bool _affects_pkg_manager;
+        /** \todo remove it as it is not needed, PatchImplIf::interactive()
+         * should be sufficient, usg. no need to overload it. */
        bool _interactive;
        ByteCount _size_installed;
        ByteCount _size_archive;