backup
authorJiri Srain <jsrain@suse.cz>
Tue, 25 Oct 2005 15:47:21 +0000 (15:47 +0000)
committerJiri Srain <jsrain@suse.cz>
Tue, 25 Oct 2005 15:47:21 +0000 (15:47 +0000)
23 files changed:
test/devel.jsrain/Makefile.am
test/devel.jsrain/Msg.cc
test/devel.jsrain/Patch.cc
test/devel.jsrain/PatchSelect.cc [new file with mode: 0644]
test/devel.jsrain/Script.cc
zypp/Makefile.am
zypp/Message.cc
zypp/Message.h
zypp/Patch.cc
zypp/Patch.h
zypp/Product.cc [new file with mode: 0644]
zypp/Product.h [new file with mode: 0644]
zypp/Script.cc
zypp/Script.h
zypp/detail/Makefile.am
zypp/detail/MessageImpl.cc
zypp/detail/MessageImpl.h
zypp/detail/PatchImpl.cc
zypp/detail/PatchImpl.h
zypp/detail/ProductImpl.cc [new file with mode: 0644]
zypp/detail/ProductImpl.h [new file with mode: 0644]
zypp/detail/ScriptImpl.cc
zypp/detail/ScriptImpl.h

index 3980618..765195f 100644 (file)
@@ -1,7 +1,7 @@
 ## Process this file with automake to produce Makefile.in
 ## ##################################################
 
-noinst_PROGRAMS =      Main Main.debug Msg Msg.debug Patch Patch.debug Script Script.debug
+noinst_PROGRAMS =      Main Main.debug Msg Msg.debug Patch Patch.debug Script Script.debug PatchSelect PatchSelect.debug
 
 ## ##################################################
 
@@ -35,6 +35,11 @@ Script_SOURCES =     Script.cc
 Script_debug_SOURCES =         $(Script_SOURCES)
 Script_debug_LDFLAGS = -static
 
+PatchSelect_SOURCES =  PatchSelect.cc
+
+PatchSelect_debug_SOURCES =    $(PatchSelect_SOURCES)
+PatchSelect_debug_LDFLAGS =    -static
+
 ## ##################################################
 
 .PHONY:        always
index 4cf0bd3..b72f298 100644 (file)
@@ -1,21 +1,5 @@
 #include <iostream>
-#include <fstream>
-#include <iterator>
-#include <algorithm>
-#include <set>
-#include <map>
-#include <list>
-#include <vector>
-#include <ext/hash_set>
-#include <ext/hash_map>
-#include <ext/rope>
-
 #include <zypp/base/Logger.h>
-#include <zypp/base/String.h>
-
-///////////////////////////////////////////////////////////////////
-
-#include <zypp/Message.h>
 #include <zypp/detail/MessageImpl.h>
 
 
index ebc91cb..5cc825d 100644 (file)
@@ -1,23 +1,10 @@
 #include <iostream>
-#include <fstream>
-#include <iterator>
-#include <algorithm>
-#include <set>
-#include <map>
-#include <list>
-#include <vector>
-#include <ext/hash_set>
-#include <ext/hash_map>
-#include <ext/rope>
-
 #include <zypp/base/Logger.h>
-#include <zypp/base/String.h>
 
 ///////////////////////////////////////////////////////////////////
 
 #include <zypp/Message.h>
 #include <zypp/detail/MessageImpl.h>
-#include <zypp/Patch.h>
 #include <zypp/detail/PatchImpl.h>
 #include <zypp/Package.h>
 #include <zypp/detail/PackageImpl.h>
diff --git a/test/devel.jsrain/PatchSelect.cc b/test/devel.jsrain/PatchSelect.cc
new file mode 100644 (file)
index 0000000..c8cef5f
--- /dev/null
@@ -0,0 +1,166 @@
+#include <iostream>
+#include <zypp/base/Logger.h>
+
+///////////////////////////////////////////////////////////////////
+
+#include <zypp/Message.h>
+#include <zypp/detail/MessageImpl.h>
+#include <zypp/detail/PatchImpl.h>
+#include <zypp/Package.h>
+#include <zypp/detail/PackageImpl.h>
+
+#include <map>
+#include <set>
+
+
+using namespace std;
+using namespace zypp;
+
+DEFINE_PTR_TYPE(MyPatchImpl)
+
+class MyPatchImpl : public detail::PatchImpl
+{
+  public:
+    MyPatchImpl( std::string name,
+                std::list<ResolvablePtr> atoms,
+                std::string category)
+    : PatchImpl (name,
+                Edition (),
+                Arch ("noarch"))
+    {
+      _reboot_needed = false;
+      _atoms = atoms;
+      _category = category;
+    }
+};
+
+/******************************************************************
+**
+**
+**     FUNCTION NAME : main
+**     FUNCTION TYPE : int
+**
+**     DESCRIPTION :
+*/
+int main( int argc, char * argv[] )
+{
+  INT << "===[START]==========================================" << endl;
+
+  atom_list atoms;
+
+  std::string _name( "foo" );
+  Edition _edition( "1.0", "42" );
+  Arch    _arch( "i386" );
+  detail::PackageImplPtr pi( new detail::PackageImpl(_name,_edition,_arch) );
+  PackagePtr p (new Package (pi));
+  atoms.push_back (p);
+
+  std::string _name2( "bar" );
+  Edition _edition2( "1.0", "43" );
+  Arch    _arch2( "noarch" );
+  detail::PackageImplPtr pi2(new detail::PackageImpl(_name2,_edition2,_arch2));
+  PackagePtr p2 (new Package (pi2));
+  atoms.push_back (p2);
+
+  MyPatchImplPtr q (new MyPatchImpl ("patch1", atoms, "recommended"));
+  PatchPtr patch1 (new Patch (q));
+
+  atom_list atoms2;
+  std::string _name3( "msg" );
+  Arch    _arch3( "noarch" );
+  detail::MessageImplPtr mi(new detail::MessageImpl(_name3,Edition (),_arch3));
+  MessagePtr m (new Message (mi));
+  atoms2.push_back (m);
+
+  MyPatchImplPtr q2 (new MyPatchImpl ("patch2", atoms2, "recommended"));
+  PatchPtr patch2 (new Patch (q2)); 
+
+  list<PatchPtr> patches;
+  patches.push_back (patch1);
+  patches.push_back (patch2);
+
+  // input values
+  bool interactive_run = true;
+  set<string> levels_to_preselect;
+  levels_to_preselect.insert ("security");
+  levels_to_preselect.insert ("recommended");
+
+  // output values
+  list<PatchPtr> patches_to_display;
+  list<PatchPtr> patches_for_manual;
+
+// really start here
+
+  // count patches to offer
+  if (interactive_run)
+  {
+    for (list<PatchPtr>::iterator it = patches.begin();
+         it != patches.end();
+         it++)
+    {
+      (*it)->select ();
+    }
+    DBG << "Running solver here..." << endl; // TODO
+    for (list<PatchPtr>::iterator it = patches.begin();
+         it != patches.end();
+         it++)
+    {
+      if ((*it)->any_atom_selected())
+      {
+       patches_to_display.push_back( *it );
+      }
+      (*it)->select();
+    }
+  }
+
+  // count patches to preselect
+  for (list<PatchPtr>::iterator it = patches.begin();
+       it != patches.end();
+       it++)
+  {
+    PatchPtr ptr = *it;
+    string category = ptr->category ();
+    // interactive patches can be applied only in interactive mode
+    if (interactive_run
+        || (! (ptr->reboot_needed() || ptr->interactive())))
+    {
+      if (levels_to_preselect.count( category ) > 0)
+      {
+       // select only packages severe enough
+       DBG << "Selecting patch: " << *ptr << endl;
+       ptr->select();
+      }
+      else
+      {
+       // and the rest keep neutral (they can be selected by dependencies)
+       DBG << "Category unsufficient: " << *ptr << endl;
+       ptr->select(); // FIXME unselect, but not taboo
+      }
+    }
+    else
+    {
+      // in non-interactive mode, they mustn't be applied in any case
+      DBG << "Patch interactive: " << *ptr << endl;
+      ptr->select(); // FIXME taboo - mustn't be  selected by resolver
+      // instead, admin should be notified
+      patches_for_manual.push_back( ptr );
+      
+    }
+  }
+  DBG << "Running solver here..." << endl; // TODO
+  // hoping resolver solves obsoletes as well
+
+  for (list<PatchPtr>::iterator it = patches.begin();
+       it != patches.end();
+       it++)
+  {
+    PatchPtr ptr = *it;
+    if (! ptr->any_atom_selected())
+    {
+      ptr->select(); // TODO use deselected here instead
+    }
+  }
+
+  INT << "===[END]============================================" << endl;
+  return 0;
+}
index 1cd5a3a..7c2984b 100644 (file)
@@ -1,21 +1,5 @@
 #include <iostream>
-#include <fstream>
-#include <iterator>
-#include <algorithm>
-#include <set>
-#include <map>
-#include <list>
-#include <vector>
-#include <ext/hash_set>
-#include <ext/hash_map>
-#include <ext/rope>
-
 #include <zypp/base/Logger.h>
-#include <zypp/base/String.h>
-
-///////////////////////////////////////////////////////////////////
-
-#include <zypp/Script.h>
 #include <zypp/detail/ScriptImpl.h>
 
 
index 7bf90a4..5da33ba 100644 (file)
@@ -18,7 +18,8 @@ include_HEADERS = \
        Message.h       \
        Script.h        \
        SolverContext.h \
-       Patch.h
+       Patch.h         \
+       Product.h
 
 ## ##################################################
 
@@ -39,7 +40,8 @@ lib@PACKAGE@_la_SOURCES = \
        Message.cc      \
        Script.cc       \
        SolverContext.cc\
-       Patch.cc
+       Patch.cc        \
+       Product.cc
 
 lib@PACKAGE@_la_LDFLAGS =      @LIB_VERSION_INFO@
 
index 34ed077..0ddcdf6 100644 (file)
@@ -11,7 +11,6 @@
 */
 #include <iostream>
 
-#include "zypp/base/Logger.h"
 #include "zypp/Message.h"
 #include "zypp/detail/MessageImpl.h"
 
@@ -27,7 +26,7 @@ namespace zypp
   //   METHOD TYPE : Ctor
   //
   Message::Message( detail::MessageImplPtr impl_r )
-  : Resolvable ( impl_r )
+  : Resolvable( impl_r )
   , _pimpl( impl_r )
   {}
 
@@ -44,9 +43,9 @@ namespace zypp
   //   METHOD NAME : Message::text
   //   Get the text of the message
   //
-  std::string Message::text ()
+  std::string Message::text()
   {
-    return _pimpl->text ();
+    return _pimpl->text();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -54,9 +53,9 @@ namespace zypp
   //   METHOD NAME : Message::text
   //   Get the type of the message ("OK", "YesNo")
   //
-  std::string Message::type ()
+  std::string Message::type()
   {
-    return _pimpl->type ();
+    return _pimpl->type();
   }
 
   /////////////////////////////////////////////////////////////////
index 3829cdd..d636929 100644 (file)
@@ -12,8 +12,6 @@
 #ifndef ZYPP_MESSAGE_H
 #define ZYPP_MESSAGE_H
 
-#include <iosfwd>
-
 #include "zypp/Resolvable.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -43,9 +41,9 @@ namespace zypp
     ~Message();
   public:
     /** Get the text of the message */
-    std::string text ();
+    std::string text();
     /** Get the type of the message (YesNo / OK) */
-    std::string type ();
+    std::string type();
   private:
     /** Pointer to implementation */
     detail::MessageImplPtr _pimpl;
index 24b54d6..a0f59ed 100644 (file)
@@ -11,7 +11,6 @@
 */
 #include <iostream>
 
-#include "zypp/base/Logger.h"
 #include "zypp/Patch.h"
 #include "zypp/detail/PatchImpl.h"
 
@@ -27,7 +26,7 @@ namespace zypp
   //   METHOD TYPE : Ctor
   //
   Patch::Patch( detail::PatchImplPtr impl_r )
-  : Resolvable (impl_r)
+  : Resolvable( impl_r )
   , _pimpl( impl_r )
   {
   }
@@ -46,9 +45,9 @@ namespace zypp
   //   METHOD NAME : Patch::id
   //   Get the patch id
   //
-  std::string Patch::id () const
+  std::string Patch::id() const
   {
-    return _pimpl->id ();
+    return _pimpl->id();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -56,9 +55,9 @@ namespace zypp
   //   METHOD NAME : Patch::id
   //   Get the patch id
   //
-  unsigned int Patch::timestamp () const
+  unsigned int Patch::timestamp() const
   {
-    return _pimpl->timestamp ();
+    return _pimpl->timestamp();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -66,9 +65,9 @@ namespace zypp
   //   METHOD NAME : Patch::summary
   //   Get the patch summary
   //
-  std::string Patch::summary () const
+  std::string Patch::summary() const
   {
-    return _pimpl->summary ();
+    return _pimpl->summary();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -76,9 +75,9 @@ namespace zypp
   //   METHOD NAME : Patch::description
   //   Get the patch description
   //
-  std::list<std::string> Patch::description () const
+  std::list<std::string> Patch::description() const
   {
-    return _pimpl->description ();
+    return _pimpl->description();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -86,9 +85,9 @@ namespace zypp
   //   METHOD NAME : Patch::category
   //   Get the category of the patch
   //
-  std::string Patch::category () const
+  std::string Patch::category() const
   {
-    return _pimpl->category ();
+    return _pimpl->category();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -96,8 +95,8 @@ namespace zypp
   //   METHOD NAME : Patch::reboot_needed
   //   Check whether reboot is needed to finish the patch installation
   //
-  bool Patch::reboot_needed () const {
-    return _pimpl->reboot_needed ();
+  bool Patch::reboot_needed() const {
+    return _pimpl->reboot_needed();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -106,8 +105,8 @@ namespace zypp
   //   Check whether the patch installation affects package manager
   //    (and it should be restarted after patch installation)
   //
-  bool Patch::affects_pkg_manager () const {
-    return _pimpl->affects_pkg_manager ();
+  bool Patch::affects_pkg_manager() const {
+    return _pimpl->affects_pkg_manager();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -115,31 +114,31 @@ namespace zypp
   //   METHOD NAME : Patch::atoms
   //    Get the list of all atoms building the patch
   //
-  atom_list Patch::atoms () const {
-    return _pimpl->all_atoms ();
+  atom_list Patch::atoms() const {
+    return _pimpl->all_atoms();
   }
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Patch::interactive
   //   Check whether patch can be applied only interactivly
   //
-  bool Patch::interactive ()
+  bool Patch::interactive()
   {
-    return _pimpl->interactive ();
+    return _pimpl->interactive();
   }
 
-  void Patch::mark_atoms_to_freshen (bool freshen)
+  void Patch::mark_atoms_to_freshen(bool freshen)
   {
-    _pimpl->mark_atoms_to_freshen (freshen);
+    _pimpl->mark_atoms_to_freshen(freshen);
   }
   ///////////////////////////////////////////////////////////////////
   //
   //   METHOD NAME : Patch::any_atom_selected
   //   Check whether there is at least one atom of the solution selected
   //
-  bool Patch::any_atom_selected ()
+  bool Patch::any_atom_selected()
   {
-    return _pimpl->any_atom_selected ();
+    return _pimpl->any_atom_selected();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -149,10 +148,10 @@ namespace zypp
   //    the patch itself as selected for being installed/updated
   //
   // FIXME to be changed to inherit Resolvable's method
-  void Patch::select ()
-//  : Resolvable::select ()
+  void Patch::select()
+//  : Resolvable::select()
   {
-    mark_atoms_to_freshen (true); // FIXME
+    mark_atoms_to_freshen(true); // FIXME
   }
 
   /////////////////////////////////////////////////////////////////
index aac32b5..dc54f0e 100644 (file)
@@ -12,7 +12,6 @@
 #ifndef ZYPP_PATCH_H
 #define ZYPP_PATCH_H
 
-#include <iosfwd>
 #include <list>
 
 #include "zypp/Resolvable.h"
@@ -46,27 +45,27 @@ namespace zypp
     ~Patch();
   public:
     /** Patch ID */
-    std::string id () const;
+    std::string id() const;
     /** Patch time stamp */
-    unsigned int timestamp () const;
+    unsigned int timestamp() const;
     /** Patch summary */
-    std::string summary () const;
+    std::string summary() const;
     /** Patch description */
     std::list<std::string> description() const;
     /** Patch category (recommended, security,...) */
-    std::string category () const;
+    std::string category() const;
     /** Does the system need to reboot to finish the update process? */
-    bool reboot_needed () const;
+    bool reboot_needed() const;
     /** Does the patch affect the package manager itself? */
-    bool affects_pkg_manager () const;
+    bool affects_pkg_manager() const;
     /** The list of all atoms building the patch */
-    atom_list atoms () const;
+    atom_list atoms() const;
     /** Is the patch installation interactive? (does it need user input?) */
-    bool interactive ();
+    bool interactive();
     // 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);
+    bool any_atom_selected();
+    void select(); // TODO parameter to specify select/unselect or another function
   private:
     /** Pointer to implementation */
     detail::PatchImplPtr _pimpl;
diff --git a/zypp/Product.cc b/zypp/Product.cc
new file mode 100644 (file)
index 0000000..c6af92a
--- /dev/null
@@ -0,0 +1,57 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/Product.cc
+ *
+*/
+#include <iostream>
+
+#include "zypp/Product.h"
+#include "zypp/detail/ProductImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Product::Product
+  //   METHOD TYPE : Ctor
+  //
+  Product::Product( detail::ProductImplPtr impl_r )
+  : Resolvable( impl_r )
+  , _pimpl( impl_r )
+  {}
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Product::~Product
+  //   METHOD TYPE : Dtor
+  //
+  Product::~Product()
+  {}
+
+  std::list<std::string> Product::description() const
+  {
+    return _pimpl->description();
+  }
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   METHOD NAME : Product::do_script
+  //   Get the product category
+  //
+  std::string Product::category()
+  {
+    return _pimpl->category();
+  }
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/Product.h b/zypp/Product.h
new file mode 100644 (file)
index 0000000..cac4c28
--- /dev/null
@@ -0,0 +1,57 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/Product.h
+ *
+*/
+#ifndef ZYPP_PRODUCT_H
+#define ZYPP_PRODUCT_H
+
+#include "zypp/Resolvable.h"
+#include <list>
+#include <string>
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(ProductImpl)
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  DEFINE_PTR_TYPE(Product)
+
+  ///////////////////////////////////////////////////////////////////
+  //
+  //   CLASS NAME : Product
+  //
+  /** Class representing an update script */
+  class Product : public Resolvable
+  {
+  public:
+    /** Default ctor */
+    Product( detail::ProductImplPtr impl_r );
+    /** Dtor */
+    ~Product();
+  public:
+    /** Get the product description */
+    std::list<std::string> description() const;
+    /** Get the product categoty (base, add-on) */
+    std::string category();
+  private:
+    /** Pointer to implementation */
+    detail::ProductImplPtr _pimpl;
+  };
+
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_PRODUCT_H
index ffa57f1..aec5bbd 100644 (file)
@@ -11,7 +11,6 @@
 */
 #include <iostream>
 
-#include "zypp/base/Logger.h"
 #include "zypp/Script.h"
 #include "zypp/detail/ScriptImpl.h"
 
@@ -27,7 +26,7 @@ namespace zypp
   //   METHOD TYPE : Ctor
   //
   Script::Script( detail::ScriptImplPtr impl_r )
-  : Resolvable (impl_r)
+  : Resolvable( impl_r )
   , _pimpl( impl_r )
   {}
 
@@ -44,9 +43,9 @@ namespace zypp
   //   METHOD NAME : Script::do_script
   //   Get the script to perform the action
   //
-  std::string Script::do_script ()
+  std::string Script::do_script()
   {
-    return _pimpl->do_script ();
+    return _pimpl->do_script();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -54,9 +53,9 @@ namespace zypp
   //   METHOD NAME : Script::undo_script
   //   Get the script to revert the action
   //
-  std::string Script::undo_script ()
+  std::string Script::undo_script()
   {
-    return _pimpl->undo_script ();
+    return _pimpl->undo_script();
   }
 
   ///////////////////////////////////////////////////////////////////
@@ -64,9 +63,9 @@ namespace zypp
   //   METHOD NAME : Script::undo_available
   //   Check whether the action can be reverted
   //
-  bool Script::undo_available ()
+  bool Script::undo_available()
   {
-    return _pimpl->undo_available ();
+    return _pimpl->undo_available();
   }
 
   /////////////////////////////////////////////////////////////////
index 43ef2c7..a52b367 100644 (file)
@@ -12,8 +12,6 @@
 #ifndef ZYPP_SCRIPT_H
 #define ZYPP_SCRIPT_H
 
-#include <iosfwd>
-
 #include "zypp/Resolvable.h"
 
 ///////////////////////////////////////////////////////////////////
@@ -43,11 +41,11 @@ namespace zypp
     ~Script();
   public:
     /** Get the script to perform the change */
-    std::string do_script ();
+    std::string do_script();
     /** Get the script to undo the change */
-    std::string undo_script ();
+    std::string undo_script();
     /** Check whether script to undo the change is available */
-    bool undo_available ();
+    bool undo_available();
   private:
     /** Pointer to implementation */
     detail::ScriptImplPtr _pimpl;
index 3175dd9..2cc7f47 100644 (file)
@@ -11,7 +11,8 @@ include_HEADERS = \
        SelectionImpl.h         \
        MessageImpl.h           \
        ScriptImpl.h            \
-       PatchImpl.h
+       PatchImpl.h             \
+       ProductImpl.h
 
 
 noinst_LTLIBRARIES =   lib@PACKAGE@_detail.la
@@ -24,6 +25,7 @@ lib@PACKAGE@_detail_la_SOURCES = \
        SelectionImpl.cc        \
        MessageImpl.cc          \
        ScriptImpl.cc           \
-       PatchImpl.cc
+       PatchImpl.cc            \
+       ProductImpl.cc
 
 ## ##################################################
index 60097f8..2483cc6 100644 (file)
@@ -9,11 +9,8 @@
 /** \file zypp/detail/MessageImpl.cc
  *
 */
-#include <iostream>
 
-#include "zypp/base/Logger.h"
 #include "zypp/detail/MessageImpl.h"
-//#include "zypp/Message.h"
 
 using namespace std;
 
@@ -35,10 +32,10 @@ namespace zypp
     MessageImpl::MessageImpl( const std::string & name_r,
                              const Edition & edition_r,
                              const Arch & arch_r )
-    : ResolvableImpl (ResKind ("message"),
+    : ResolvableImpl( ResKind( "message" ),
                      name_r,
                      edition_r,
-                     arch_r)
+                     arch_r )
     {
     }
     /** Dtor */
@@ -46,11 +43,11 @@ namespace zypp
     {
     }
 
-    std::string MessageImpl::type () const {
+    std::string MessageImpl::type() const {
       return _type;
     }
 
-    std::string MessageImpl::text () const {
+    std::string MessageImpl::text() const {
       return _text;
     }
 
index 8b3d39f..a5b57bf 100644 (file)
 #ifndef ZYPP_DETAIL_MESSAGEIMPL_H
 #define ZYPP_DETAIL_MESSAGEIMPL_H
 
-#include <iosfwd>
-
 #include "zypp/detail/ResolvableImpl.h"
-//#include "zypp/Resolvable.h"
-//#include "zypp/Message.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -43,9 +39,9 @@ namespace zypp
 
     public:
       /** Get the text of the message */
-      virtual std::string text () const;
+      virtual std::string text() const;
       /** Get the type of the message (YesNo / OK) */
-      virtual std::string type () const;
+      virtual std::string type() const;
     protected:
       /** The text of the message */
       std::string _text;
index c0881d2..f9473d2 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "zypp/base/Logger.h"
 #include "zypp/detail/PatchImpl.h"
-#include "zypp/Patch.h"
 #include "zypp/Package.h"
 
 using namespace std;
@@ -36,10 +35,10 @@ namespace zypp
     PatchImpl::PatchImpl( const std::string & name_r,
                          const Edition & edition_r,
                          const Arch & arch_r )
-    : ResolvableImpl (ResKind ("patch"),
+    : ResolvableImpl( ResKind( "patch" ),
                      name_r,
-                     Edition (edition_r),
-                     Arch (arch_r))
+                     edition_r,
+                     arch_r )
     {
     }
 
@@ -48,57 +47,57 @@ namespace zypp
     {
     }
 
-    std::string PatchImpl::id () const
+    std::string PatchImpl::id() const
     {
       return _patch_id;
     }
-    unsigned int PatchImpl::timestamp () const
+    unsigned int PatchImpl::timestamp() const
     {
       return _timestamp;
     }
 
-    std::string PatchImpl::summary () const
+    std::string PatchImpl::summary() const
     {
       return _summary;
     }
 
-    std::list<std::string> PatchImpl::description () const
+    std::list<std::string> PatchImpl::description() const
     {
       return _description;
     }
 
-    std::string PatchImpl::category () const
+    std::string PatchImpl::category() const
     {
       return _category;
     }
 
-    bool PatchImpl::reboot_needed () const
+    bool PatchImpl::reboot_needed() const
     {
       return _reboot_needed;
     }
 
-    bool PatchImpl::affects_pkg_manager () const
+    bool PatchImpl::affects_pkg_manager() const
     {
       return _affects_pkg_manager;
     }
 
-    bool PatchImpl::interactive () {
+    bool PatchImpl::interactive() {
       if (_reboot_needed)
       {
        DBG << "Patch needs reboot" << endl;
        return true;
       }
-      atom_list not_installed = not_installed_atoms ();
-      for (atom_list::iterator it = not_installed.begin ();
-       it != not_installed.end ();
+      atom_list not_installed = not_installed_atoms();
+      for (atom_list::iterator it = not_installed.begin();
+       it != not_installed.end();
        it++)
       {
-       if ((std::string)((*it)->kind ()) == "message")
+       if ((std::string)((*it)->kind()) == "message")
        {
 //       DBG << "Patch contains a message" << endl;
          return true;
        }
-       if ((std::string)((*it)->kind ()) == "package")
+       if ((std::string)((*it)->kind()) == "package")
        {
                                 // Resolvable*
                                  // Resolvable
@@ -116,19 +115,19 @@ namespace zypp
       return false;
     }
 
-    atom_list PatchImpl::all_atoms () {
+    atom_list PatchImpl::all_atoms() {
       return _atoms;
     }
 
-    atom_list PatchImpl::not_installed_atoms () {
+    atom_list PatchImpl::not_installed_atoms() {
       atom_list ret;
-      for (atom_list::iterator it = _atoms.begin ();
-       it != _atoms.end ();
+      for (atom_list::iterator it = _atoms.begin();
+       it != _atoms.end();
        it++)
       {
        if (true) // FIXME check if atom/resolvable is not installed
        {
-         ret.push_back (*it);
+         ret.push_back(*it);
        }
       }
       return ret;
@@ -136,9 +135,9 @@ namespace zypp
 
 // TODO check necessarity of functions below
 
-    bool PatchImpl::any_atom_selected () {
-      for (atom_list::iterator it = _atoms.begin ();
-       it != _atoms.end ();
+    bool PatchImpl::any_atom_selected() {
+      for (atom_list::iterator it = _atoms.begin();
+       it != _atoms.end();
        it++)
       {
        if (false) // FIXME check if atom/resolvable is selected
@@ -149,9 +148,9 @@ namespace zypp
       return false;
     }
 
-    void PatchImpl::mark_atoms_to_freshen (bool freshen) {
-      for (atom_list::iterator it = _atoms.begin ();
-       it != _atoms.end ();
+    void PatchImpl::mark_atoms_to_freshen( bool freshen ) {
+      for (atom_list::iterator it = _atoms.begin();
+       it != _atoms.end();
        it++)
       {
        // TODO mark the resolvable to be or not to be freshed
index 5afe5de..d90d610 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "zypp/detail/ResolvableImpl.h"
 #include "zypp/Resolvable.h"
-#include "zypp/Patch.h"
+#include "zypp/Patch.h"  // contains atom_list macro
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -44,30 +44,30 @@ namespace zypp
 
     public:
       /** Patch ID */
-      std::string id () const;
+      std::string id() const;
       /** Patch time stamp */
-      unsigned int timestamp () const;
+      unsigned int timestamp() const;
       /** Patch summary */
-      std::string summary () const;
+      std::string summary() const;
       /** Patch description */
-      std::list<std::string> description () const;
+      std::list<std::string> description() const;
       /** Patch category (recommended, security,...) */
-      std::string category () const;
+      std::string category() const;
       /** Does the system need to reboot to finish the update process? */
-      bool reboot_needed () const;
+      bool reboot_needed() const;
       /** Does the patch affect the package manager itself? */
-      bool affects_pkg_manager () const;
+      bool affects_pkg_manager() const;
 
       /** Is the patch installation interactive? (does it need user input?) */
-      bool interactive ();
+      bool interactive();
       /** The list of all atoms building the patch */
-      atom_list all_atoms ();
+      atom_list all_atoms();
       /** The list of those atoms which have not been installed */
-      atom_list not_installed_atoms ();
+      atom_list not_installed_atoms();
 
 // TODO check necessarity of functions below
-      bool any_atom_selected ();
-      void mark_atoms_to_freshen (bool freshen);
+      bool any_atom_selected();
+      void mark_atoms_to_freshen(bool freshen);
     protected:
       /** Patch ID */
       std::string _patch_id;
diff --git a/zypp/detail/ProductImpl.cc b/zypp/detail/ProductImpl.cc
new file mode 100644 (file)
index 0000000..5ced8ff
--- /dev/null
@@ -0,0 +1,60 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ProductImpl.cc
+ *
+*/
+
+#include "zypp/detail/ProductImpl.h"
+
+using namespace std;
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+    IMPL_PTR_TYPE(ProductImpl)
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ProductImpl
+    //
+    ///////////////////////////////////////////////////////////////////
+
+    /** Default ctor */
+    ProductImpl::ProductImpl( const std::string & name_r,
+                           const Edition & edition_r,
+                           const Arch & arch_r )
+    : ResolvableImpl( ResKind( "script"),
+                     name_r,
+                     edition_r,
+                     arch_r )
+    {
+    }
+    /** Dtor */
+    ProductImpl::~ProductImpl()
+    {
+    }
+
+    std::list<std::string> ProductImpl::description() const
+    {
+      return _description;
+    }
+
+    std::string ProductImpl::category() const {
+      return _category;
+    }
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
diff --git a/zypp/detail/ProductImpl.h b/zypp/detail/ProductImpl.h
new file mode 100644 (file)
index 0000000..a0b9200
--- /dev/null
@@ -0,0 +1,62 @@
+/*---------------------------------------------------------------------\
+|                          ____ _   __ __ ___                          |
+|                         |__  / \ / / . \ . \                         |
+|                           / / \ V /|  _/  _/                         |
+|                          / /__ | | | | | |                           |
+|                         /_____||_| |_| |_|                           |
+|                                                                      |
+\---------------------------------------------------------------------*/
+/** \file zypp/detail/ProductImpl.h
+ *
+*/
+#ifndef ZYPP_DETAIL_PRODUCTIMPL_H
+#define ZYPP_DETAIL_PRODUCTIMPL_H
+
+#include <list>
+#include <string>
+
+#include "zypp/detail/ResolvableImpl.h"
+
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////
+  namespace detail
+  { /////////////////////////////////////////////////////////////////
+    DEFINE_PTR_TYPE(ProductImpl)
+
+    ///////////////////////////////////////////////////////////////////
+    //
+    // CLASS NAME : ProductImpl
+    //
+    /** Class representing an update script */
+    class ProductImpl : public ResolvableImpl
+    {
+    public:
+      /** Default ctor */
+      ProductImpl( const std::string & name_r,
+                 const Edition & edition_r,
+                 const Arch & arch_r );
+      /** Dtor */
+      ~ProductImpl();
+
+    public:
+      /** Get the product description */
+      std::list<std::string> description() const;
+      /** Get the category of the product */
+      std::string category() const;
+    protected:
+      /** Product description */
+      std::list<std::string> _description;
+      /** The category of the product */
+      std::string _category;
+    };
+    ///////////////////////////////////////////////////////////////////
+
+    /////////////////////////////////////////////////////////////////
+  } // namespace detail
+  ///////////////////////////////////////////////////////////////////
+  /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+#endif // ZYPP_DETAIL_PRODUCTIMPL_H
index 6912786..89e0fb4 100644 (file)
@@ -9,11 +9,8 @@
 /** \file zypp/detail/ScriptImpl.cc
  *
 */
-#include <iostream>
 
-#include "zypp/base/Logger.h"
 #include "zypp/detail/ScriptImpl.h"
-#include "zypp/Script.h"
 
 using namespace std;
 
@@ -35,10 +32,10 @@ namespace zypp
     ScriptImpl::ScriptImpl( const std::string & name_r,
                            const Edition & edition_r,
                            const Arch & arch_r )
-    : ResolvableImpl (ResKind ("script"),
+    : ResolvableImpl( ResKind( "script"),
                      name_r,
-                     Edition (edition_r),
-                     Arch (arch_r))
+                     edition_r,
+                     arch_r )
     {
     }
     /** Dtor */
@@ -46,15 +43,15 @@ namespace zypp
     {
     }
 
-    std::string ScriptImpl::do_script () const {
+    std::string ScriptImpl::do_script() const {
       return _do_script;
     }
 
-    std::string ScriptImpl::undo_script () const {
+    std::string ScriptImpl::undo_script() const {
       return _undo_script;
     }
 
-    bool ScriptImpl::undo_available () const {
+    bool ScriptImpl::undo_available() const {
       return _undo_script != "";
     }
 
index 74d8d67..b70db95 100644 (file)
 #ifndef ZYPP_DETAIL_SCRIPTIMPL_H
 #define ZYPP_DETAIL_SCRIPTIMPL_H
 
-#include <iosfwd>
-
 #include "zypp/detail/ResolvableImpl.h"
-#include "zypp/Resolvable.h"
-#include "zypp/Script.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -43,11 +39,11 @@ namespace zypp
 
     public:
       /** Get the script to perform the change */
-      std::string do_script () const;
+      std::string do_script() const;
       /** Get the script to undo the change */
-      std::string undo_script () const;
+      std::string undo_script() const;
       /** Check whether script to undo the change is available */
-      virtual bool undo_available () const;
+      virtual bool undo_available() const;
     protected:
       /** The script to perform the change */
       std::string _do_script;