Mailinglist Archive: zypp-commit (149 mails)

< Previous Next >
[zypp-commit] r5348 - in /trunk/libzypp: devel/ devel/devel.ma/ zypp/source/yum/
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Thu, 12 Apr 2007 00:32:34 -0000
  • Message-id: <20070412003234.A88492369D@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Thu Apr 12 02:32:34 2007
New Revision: 5348

URL: http://svn.opensuse.org/viewcvs/zypp?rev=5348&view=rev
Log: (empty)

Added:
    trunk/libzypp/devel/devel.ma/iorderbug.pool
Modified:
    trunk/libzypp/devel/devel.ma/AOUT.cc
    trunk/libzypp/devel/devel.ma/FakePool.h
    trunk/libzypp/devel/devel.ma/Iorder.cc
    trunk/libzypp/devel/devel.ma/Main.cc
    trunk/libzypp/devel/genclass.in
    trunk/libzypp/zypp/source/yum/YUMSourceImpl.cc

Modified: trunk/libzypp/devel/devel.ma/AOUT.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/AOUT.cc?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/AOUT.cc (original)
+++ trunk/libzypp/devel/devel.ma/AOUT.cc Thu Apr 12 02:32:34 2007
@@ -40,6 +40,7 @@
 
 
   DBG << "===[END]============================================" << endl;
+  zypp::base::LogControl::instance().logNothing();
   return 0;
 }
 

Modified: trunk/libzypp/devel/devel.ma/FakePool.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/FakePool.h?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/FakePool.h (original)
+++ trunk/libzypp/devel/devel.ma/FakePool.h Thu Apr 12 02:32:34 2007
@@ -10,9 +10,13 @@
 #include "zypp/base/Algorithm.h"
 #include "zypp/base/Function.h"
 #include "zypp/base/Functional.h"
+#include "zypp/base/IOStream.h"
 #include "zypp/base/String.h"
 
+#include "zypp/ZYppFactory.h"
 #include "zypp/ResPool.h"
+#include "zypp/ResPoolProxy.h"
+#include "zypp/NameKindProxy.h"
 #include "zypp/CapFactory.h"
 
 #include "zypp/Atom.h"
@@ -25,6 +29,7 @@
 #include "zypp/Script.h"
 #include "zypp/Message.h"
 #include "zypp/Language.h"
+#include "zypp/VendorAttr.h"
 
 ///////////////////////////////////////////////////////////////////
 namespace zypp
@@ -38,9 +43,9 @@
      * const char * data[] = {
      * "@ product"
      * ,"@ installed"
-     * ,"prodold 1 1 x86_64"
+     * ,"- prodold 1 1 x86_64"
      * ,"@ available"
-     * ,"prodnew 1 1 x86_64"
+     * ,"- prodnew 1 1 x86_64"
      * ,"@ obsoletes"
      * ,"prodold"
      * ,"@ fin"
@@ -59,10 +64,15 @@
       , _defdep( Dep::PROVIDES )
       , _defdepref( _defkind )
       , _verbose( verbose_r )
-      {}
+      {
+       VendorAttr::disableAutoProtect();
+      }
 
-      void operator()( const std::string & line_r )
-      { parseLine( line_r ); }
+      bool operator()( const std::string & line_r )
+      {
+       parseLine( str::trim( line_r ) );
+       return true;
+      }
 
       const ResStore & installed() const
       { return _installed; }
@@ -94,7 +104,10 @@
     private:
       void parseLine( const std::string & line_r )
       {
-        std::vector<std::string> words;
+       if ( line_r.empty() || line_r[0] == '#' )
+         return;
+
+       std::vector<std::string> words;
         str::split( line_r, std::back_inserter( words ) );
         if ( words.empty() )
           return;
@@ -203,7 +216,7 @@
     };
     ///////////////////////////////////////////////////////////////////
 
-    /** \refers DataCollect Stream output. */
+    /** \relates DataCollect Stream output. */
     inline std::ostream & operator<<( std::ostream & str, const DataCollect & obj )
     {
       dumpRange( str << "Installed" << endl,
@@ -217,6 +230,25 @@
 
     ///////////////////////////////////////////////////////////////////
 
+    template<class _Iterator>
+       inline void addPool( _Iterator begin_r, _Iterator end_r )
+    {
+      DataCollect dataCollect;
+      dataCollect.collect( begin_r, end_r );
+      getZYpp()->addResolvables( dataCollect.installed(), true );
+      getZYpp()->addResolvables( dataCollect.available() );
+    }
+
+    inline void addPool( const Pathname & file_r )
+    {
+      std::ifstream in( file_r.c_str() );
+      DataCollect dataCollect;
+      function<bool(const std::string &)> fnc( ref(dataCollect) );
+      iostr::forEachLine( in, fnc );
+      getZYpp()->addResolvables( dataCollect.installed(), true );
+      getZYpp()->addResolvables( dataCollect.available() );
+    }
+
     /////////////////////////////////////////////////////////////////
   } // namespace debug
   ///////////////////////////////////////////////////////////////////

Modified: trunk/libzypp/devel/devel.ma/Iorder.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Iorder.cc?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Iorder.cc (original)
+++ trunk/libzypp/devel/devel.ma/Iorder.cc Thu Apr 12 02:32:34 2007
@@ -276,13 +276,12 @@
   pool::GetResolvablesToInsDel collect( pool, pool::GetResolvablesToInsDel::ORDER_BY_MEDIANR );
   MIL << "GetResolvablesToInsDel:" << endl << collect << endl;
 
-  typedef pool::GetResolvablesToInsDel::PoolItemList PoolItemList;
-
   if ( 1 )
     {
       // Collect until the 1st package from an unwanted media occurs.
       // Further collection could violate install order.
       bool hitUnwantedMedia = false;
+      typedef pool::GetResolvablesToInsDel::PoolItemList PoolItemList;
       PoolItemList::iterator fst=collect._toInstall.end();
       for ( PoolItemList::iterator it = collect._toInstall.begin(); it != collect._toInstall.end(); ++it)
         {

Modified: trunk/libzypp/devel/devel.ma/Main.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Main.cc?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Main.cc (original)
+++ trunk/libzypp/devel/devel.ma/Main.cc Thu Apr 12 02:32:34 2007
@@ -7,21 +7,14 @@
 #include <zypp/base/Function.h>
 #include <zypp/base/Iterator.h>
 
-#include "zypp/ZYppFactory.h"
-#include "zypp/ResPoolProxy.h"
 #include <zypp/SourceManager.h>
 #include <zypp/SourceFactory.h>
-
 #include "zypp/ZYppCallbacks.h"
+
 #include "zypp/NVRAD.h"
-#include "zypp/ResPool.h"
 #include "zypp/ResFilters.h"
 #include "zypp/CapFilters.h"
-#include "zypp/Package.h"
-#include "zypp/Pattern.h"
-#include "zypp/Language.h"
 #include "zypp/PackageKeyword.h"
-#include "zypp/NameKindProxy.h"
 #include "zypp/pool/GetResolvablesToInsDel.h"
 
 using namespace std;
@@ -29,19 +22,88 @@
 
 ///////////////////////////////////////////////////////////////////
 
-template<class _Iterator>
-    void addPool( _Iterator begin_r, _Iterator end_r )
+struct SetTransactValue
+{
+  SetTransactValue( ResStatus::TransactValue newVal_r, ResStatus::TransactByValue causer_r )
+  : _newVal( newVal_r )
+  , _causer( causer_r )
+  {}
+
+  ResStatus::TransactValue   _newVal;
+  ResStatus::TransactByValue _causer;
+
+  bool operator()( const PoolItem & pi ) const
+  {
+    bool ret = pi.status().setTransactValue( _newVal, _causer );
+    if ( ! ret )
+      ERR << _newVal <<  _causer << " " << pi << endl;
+    return ret;
+  }
+};
+
+struct StatusReset : public SetTransactValue
+{
+  StatusReset()
+  : SetTransactValue( ResStatus::KEEP_STATE, ResStatus::USER )
+  {}
+};
+
+struct StatusInstall : public SetTransactValue
+{
+  StatusInstall()
+  : SetTransactValue( ResStatus::TRANSACT, ResStatus::USER )
+  {}
+};
+
+inline bool selectForTransact( const NameKindProxy & nkp, Arch arch = Arch() )
 {
-  using zypp::debug::DataCollect;
-  DataCollect dataCollect;
-  dataCollect.collect( begin_r, end_r );
-  getZYpp()->addResolvables( dataCollect.installed(), true );
-  getZYpp()->addResolvables( dataCollect.available() );
-  vdumpPoolStats( USR << "Pool:" << endl,
-                 getZYpp()->pool().begin(),
-                 getZYpp()->pool().end() ) << endl;
+  if ( nkp.availableEmpty() )
+  {
+    ERR << "No Item to select: " << nkp << endl;
+    return false;
+    ZYPP_THROW( Exception("No Item to select") );
+  }
+
+  if ( arch != Arch() )
+  {
+    typeof( nkp.availableBegin() ) it =  nkp.availableBegin();
+    for ( ; it != nkp.availableEnd(); ++it )
+    {
+      if ( (*it)->arch() == arch )
+       return (*it).status().setTransact( true, ResStatus::USER );
+    }
+  }
+
+  return nkp.availableBegin()->status().setTransact( true, ResStatus::USER );
 }
 
+///////////////////////////////////////////////////////////////////
+
+bool solve( bool establish = false )
+{
+  if ( establish )
+  {
+    bool eres = getZYpp()->resolver()->establishPool();
+    if ( ! eres )
+    {
+      ERR << "establish " << eres << endl;
+      return false;
+    }
+    MIL << "establish " << eres << endl;
+  }
+
+  bool rres = getZYpp()->resolver()->resolvePool();
+  if ( ! rres )
+  {
+    ERR << "resolve " << rres << endl;
+    return false;
+  }
+  MIL << "resolve " << rres << endl;
+  return true;
+}
+
+///////////////////////////////////////////////////////////////////
+
 /******************************************************************
 **
 **      FUNCTION NAME : main
@@ -50,33 +112,101 @@
 int main( int argc, char * argv[] )
 {
   INT << "===[START]==========================================" << endl;
-
-  const char * data[] = {
-    "@ package",
-    "@ installed",
-    "@ available",
-    "- glibc 2.3.4 31 i686",
-    "- glibc 2.3.5 28 i586",
-    "- glibc-locale 2.3.5 28 i686",
-    "@ requires",
-    "glibc == 2.3.5",
-    "@ fin"
-  };
-  addPool( data, data + ( sizeof(data) / sizeof(const char *) ) );
-
+  ///////////////////////////////////////////////////////////////////
+  // define pool
+  ///////////////////////////////////////////////////////////////////
+  if ( 0 )
+  {
+    const char * data[] = {
+      "@ product",
+      "@ installed",
+      "- prodold 1 1 x86_64",
+      "@ available",
+      "- prodnew 1 1 x86_64",
+      "@ obsoletes",
+      "prodold",
+      "@ fin",
+    };
+    debug::addPool( data, data + ( sizeof(data) / sizeof(const char *) ) );
+  }
+  else
+  {
+    debug::addPool( "SRC/iorderbug.pool" );
+  }
   ResPool pool( getZYpp()->pool() );
-
-  vdumpPoolStats( USR << "Pool:" << endl,
-                 getZYpp()->pool().begin(),
-                 getZYpp()->pool().end() ) << endl;
-
- // solve();
-
-  vdumpPoolStats( USR << "Pool:" << endl,
-                 getZYpp()->pool().begin(),
-                 getZYpp()->pool().end() ) << endl;
+  vdumpPoolStats( USR << "Initial pool:" << endl,
+                 pool.begin(),
+                 pool.end() ) << endl;
+
+  ///////////////////////////////////////////////////////////////////
+  // define transaction
+  ///////////////////////////////////////////////////////////////////
+  if ( 0 )
+    for_each( pool.byKindBegin<Product>(), pool.byKindEnd<Product>(), StatusInstall() );
+
+#define selt(K,N) selectForTransact( nameKindProxy<K>( pool, #N ) )
+  selt( Package, bash );
+  selt( Package, readline );
+  selt( Package, fontcfg );
+#undef selt
+
+  ///////////////////////////////////////////////////////////////////
+  // solve
+  ///////////////////////////////////////////////////////////////////
+  if ( 0 )
+  {
+    solve();
+  }
+
+  vdumpPoolStats( USR << "Transacting:"<< endl,
+                 make_filter_begin<resfilter::ByTransact>(pool),
+                 make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+
+  ///////////////////////////////////////////////////////////////////
+  // install order
+  ///////////////////////////////////////////////////////////////////
+  pool::GetResolvablesToInsDel collect( pool, pool::GetResolvablesToInsDel::ORDER_BY_MEDIANR );
+  MIL << "GetResolvablesToInsDel:" << endl << collect << endl;
+
+  if ( 1 )
+  {
+    // Collect until the 1st package from an unwanted media occurs.
+    // Further collection could violate install order.
+    bool hitUnwantedMedia = false;
+    typedef pool::GetResolvablesToInsDel::PoolItemList PoolItemList;
+    PoolItemList::iterator fst=collect._toInstall.end();
+    for ( PoolItemList::iterator it = collect._toInstall.begin(); it != collect._toInstall.end(); ++it)
+    {
+      ResObject::constPtr res( it->resolvable() );
+
+      if ( hitUnwantedMedia
+          || ( res->sourceMediaNr() && res->sourceMediaNr() != 1 ) )
+      {
+       if ( !hitUnwantedMedia )
+         fst=it;
+       hitUnwantedMedia = true;
+      }
+      else
+      {
+      }
+    }
+    dumpRange( WAR << "toInstall1: " << endl,
+              collect._toInstall.begin(), fst ) << endl;
+    dumpRange( WAR << "toInstall2: " << endl,
+              fst, collect._toInstall.end() ) << endl;
+    dumpRange( ERR << "toDelete: " << endl,
+              collect._toDelete.begin(), collect._toDelete.end() ) << endl;
+  }
+  else
+  {
+    dumpRange( WAR << "toInstall: " << endl,
+              collect._toInstall.begin(), collect._toInstall.end() ) << endl;
+    dumpRange( ERR << "toDelete: " << endl,
+              collect._toDelete.begin(), collect._toDelete.end() ) << endl;
+  }
 
   INT << "===[END]============================================" << endl << endl;
+  zypp::base::LogControl::instance().logNothing();
   return 0;
 }
 

Added: trunk/libzypp/devel/devel.ma/iorderbug.pool
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/iorderbug.pool?rev=5348&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.ma/iorderbug.pool (added)
+++ trunk/libzypp/devel/devel.ma/iorderbug.pool Thu Apr 12 02:32:34 2007
@@ -0,0 +1,26 @@
+@ package
+@ installed
+
+- readline 1 1 i686
+
+- bash 1 1 i686
+@ requires
+readline = 1
+
+- fontcfg 1 1 i686
+@ prerequires
+bash
+
+@ available
+
+- readline 2 1 i686
+
+- bash 2 1 i686
+@ requires
+readline = 2
+
+- fontcfg 2 1 i686
+#@ prerequires
+#bash
+
+@ fin

Modified: trunk/libzypp/devel/genclass.in
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/genclass.in?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/devel/genclass.in (original)
+++ trunk/libzypp/devel/genclass.in Thu Apr 12 02:32:34 2007
@@ -10,9 +10,9 @@
 
 test -z "$1" && usage "Missing name!"
 
-TOPSRCDIR=$( cd @abs_top_srcdir@ && pwd )
+TOPSRCDIR=${XTOPSRCDIR:-$(cd @abs_top_srcdir@ && pwd)}
 test -z "$TOPSRCDIR" && {
-   echo "Dir does not exist '@abs_top_srcdir@'" >&2
+   echo "Dir does not exist '$TOPSRCDIR'" >&2
    exit 1
 }
 

Modified: trunk/libzypp/zypp/source/yum/YUMSourceImpl.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/source/yum/YUMSourceImpl.cc?rev=5348&r1=5347&r2=5348&view=diff
==============================================================================
--- trunk/libzypp/zypp/source/yum/YUMSourceImpl.cc (original)
+++ trunk/libzypp/zypp/source/yum/YUMSourceImpl.cc Thu Apr 12 02:32:34 2007
@@ -326,7 +326,7 @@
 
   MIL << "Metadata saved in " << cache_dir_r << ". Setting as cache." << std::endl;
   _cache_dir = cache_dir_r;

+
   readRepomd();
 }
 
@@ -377,7 +377,7 @@
   _repo_pattern.clear();
   _repo_product.clear();
   _repo_patches.clear();
-  
+
   parser::ParserProgress::Ptr progress;
   callback::SendReport<SourceReport> report;
   YUMSourceEventHandler npp(report);
@@ -422,22 +422,22 @@
 YUMSourceImpl::resolvableKinds() const
 {
   std::set<zypp::Resolvable::Kind> kinds;
-  
+
   if (_repo_product.size() > 0 )
-    kinds.insert( ResTraits<zypp::Product>::kind ); 
-  
+    kinds.insert( ResTraits<zypp::Product>::kind );
+
   if (_repo_pattern.size() > 0 )
     kinds.insert( ResTraits<zypp::Pattern>::kind );
-  
+
   if (_repo_group.size() > 0 )
     kinds.insert( ResTraits<zypp::Selection>::kind );
-  
+
   if (_repo_primary.size() > 0 )
   kinds.insert( ResTraits<zypp::Package>::kind );
-  
+
   if (_repo_patches.size() > 0 )
     kinds.insert( ResTraits<zypp::Patch>::kind );
-  
+
   return kinds;
 }
 
@@ -462,7 +462,7 @@
 
        // TranslatorExplanation %s = product file
       report->start( selfSourceRef(), str::form(_("Reading product from %s"), filename.asString().c_str()) );
-      
+
       YUMProductParser product(st, "", progress);
       for (; !product.atEnd(); ++product)
       {
@@ -1148,10 +1148,10 @@
     Arch arch;
     if (!parsed.arch.empty())
       arch = Arch(parsed.arch);
-    
+
     string name(parsed.name);
     std::replace(name.begin(), name.end(), ' ', '_');
-    
+
     NVRAD dataCollect( name,
                        Edition( parsed.ver, parsed.rel, parsed.epoch ),
                        arch,

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages