Mailinglist Archive: zypp-commit (266 mails)

< Previous Next >
[zypp-commit] r11734 - in /trunk/libzypp/devel/devel.ma: Iorder.cc Test.cc Tools.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Thu, 20 Nov 2008 10:06:49 -0000
  • Message-id: <20081120100649.B6CFEDF6AF@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Thu Nov 20 11:06:49 2008
New Revision: 11734

URL: http://svn.opensuse.org/viewcvs/zypp?rev=11734&view=rev
Log:
backup

Modified:
trunk/libzypp/devel/devel.ma/Iorder.cc
trunk/libzypp/devel/devel.ma/Test.cc
trunk/libzypp/devel/devel.ma/Tools.h

Modified: trunk/libzypp/devel/devel.ma/Iorder.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Iorder.cc?rev=11734&r1=11733&r2=11734&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Iorder.cc (original)
+++ trunk/libzypp/devel/devel.ma/Iorder.cc Thu Nov 20 11:06:49 2008
@@ -1,14 +1,31 @@
#include "Tools.h"
+#include <zypp/ResObjects.h>
+
#include "zypp/pool/GetResolvablesToInsDel.h"

-static TestSetup test( Arch_x86_64 ); // use x86_64 as system arch
+bool upgrade()
+{
+ bool rres = false;
+ {
+ //zypp::base::LogControl::TmpLineWriter shutUp;
+ UpgradeStatistics u;
+ rres = getZYpp()->resolver()->doUpgrade( u );
+ }
+ if ( ! rres )
+ {
+ ERR << "upgrade " << rres << endl;
+ return false;
+ }
+ MIL << "upgrade " << rres << endl;
+ return true;
+}

bool solve()
{
bool rres = false;
{
//zypp::base::LogControl::TmpLineWriter shutUp;
- rres = test.resolver().resolvePool();
+ rres = getZYpp()->resolver()->resolvePool();
}
if ( ! rres )
{
@@ -19,23 +36,29 @@
return true;
}

+/******************************************************************
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+*/
int main( int argc, char * argv[] )
-try {
- --argc;
- ++argv;
- zypp::base::LogControl::instance().logToStdErr();
+{
INT << "===[START]==========================================" << endl;

- test.loadTarget(); // initialize and load target
- test.loadRepo(
Url("iso:/?iso=/mounts/dist/install/openSUSE-11.1-Beta2-DONTUSE/kiwi.out.dvd-i586.iso")
);
+ Pathname mroot( "/tmp/Bb" );
+ TestSetup test( mroot, Arch_ppc64 );
+ test.loadTarget();
+ test.loadTestcaseRepos(
"/suse/ma/BUGS/439802/bug439802/YaST2/solverTestcase" );
+
+ //getPi<>( "", "", Edition(""), Arch("") );
+ getPi<Product>( "SUSE_SLES", Edition("11"), Arch("ppc64")
).status().setTransact( true, ResStatus::USER );
+ getPi<Package>( "sles-release", Edition("11-54.3"), Arch("ppc64")
).status().setTransact( true, ResStatus::USER );

- ResPool pool( test.pool() );
- Resolver & resolver( test.resolver() );
-
- resolver.addRequire( Capability("glibc") );
- resolver.addRequire( Capability("zlib") );
- resolver.addRequire( Capability("lsb-buildenv") );
- solve();
+ ResPool pool( test.pool() );
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ upgrade();
vdumpPoolStats( USR << "Transacting:"<< endl,
make_filter_begin<resfilter::ByTransact>(pool),
make_filter_end<resfilter::ByTransact>(pool) ) << endl;
@@ -79,15 +102,7 @@
collect._toDelete.begin(), collect._toDelete.end() ) << endl;
}

- ///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl <<
endl;
- zypp::base::LogControl::instance().logNothing();
return 0;
}
-catch ( const Exception & exp )
-{
- INT << exp << endl << exp.historyAsString();
-}
-catch (...)
-{}


Modified: trunk/libzypp/devel/devel.ma/Test.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Test.cc?rev=11734&r1=11733&r2=11734&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Test.cc (original)
+++ trunk/libzypp/devel/devel.ma/Test.cc Thu Nov 20 11:06:49 2008
@@ -1,10 +1,40 @@
#include "Tools.h"
#include <zypp/ResObjects.h>

-#include "zypp/IdString.h"
-#include "zypp/Glob.h"
+#include "zypp/pool/GetResolvablesToInsDel.h"

-using filesystem::Glob;
+bool upgrade()
+{
+ bool rres = false;
+ {
+ zypp::base::LogControl::TmpLineWriter shutUp;
+ UpgradeStatistics u;
+ rres = getZYpp()->resolver()->doUpgrade( u );
+ }
+ if ( ! rres )
+ {
+ ERR << "upgrade " << rres << endl;
+ return false;
+ }
+ MIL << "upgrade " << rres << endl;
+ return true;
+}
+
+bool solve()
+{
+ bool rres = false;
+ {
+ //zypp::base::LogControl::TmpLineWriter shutUp;
+ rres = getZYpp()->resolver()->resolvePool();
+ }
+ if ( ! rres )
+ {
+ ERR << "resolve " << rres << endl;
+ return false;
+ }
+ MIL << "resolve " << rres << endl;
+ return true;
+}

/******************************************************************
**
@@ -16,24 +46,60 @@
INT << "===[START]==========================================" << endl;

Pathname mroot( "/tmp/Bb" );
- TestSetup test( mroot, Arch_x86_64 );
+ TestSetup test( mroot, Arch_ppc64 );
+ test.loadTarget();
+ test.loadTestcaseRepos(
"/suse/ma/BUGS/439802/bug439802/YaST2/solverTestcase" );
+
+ //getPi<>( "", "", Edition(""), Arch("") );
+ getPi<Product>( "SUSE_SLES", Edition("11"), Arch("ppc64")
).status().setTransact( true, ResStatus::USER );
+ getPi<Package>( "sles-release", Edition("11-54.3"), Arch("ppc64")
).status().setTransact( true, ResStatus::USER );

- //test.loadRepos();
- test.loadTestcaseRepos( "/suse/ma/BUGS/153548/YaST2/solverTestcase" );
-
- sat::Pool satpool( test.satpool() );
- for_( it, satpool.reposBegin(), satpool.reposEnd() )
+ ResPool pool( test.pool() );
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+ upgrade();
+ vdumpPoolStats( USR << "Transacting:"<< endl,
+ make_filter_begin<resfilter::ByTransact>(pool),
+ make_filter_end<resfilter::ByTransact>(pool) ) << endl;
+
+ pool::GetResolvablesToInsDel collect( pool,
pool::GetResolvablesToInsDel::ORDER_BY_MEDIANR );
+ MIL << "GetResolvablesToInsDel:" << endl << collect << endl;
+ if ( 1 )
{
- MIL << *it << endl;
+ // 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->mediaNr() && res->mediaNr() != 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;
}
-
- INT << "===[END]============================================" << endl <<
endl;
- return 0;
-
- ResPool pool( test.pool() );
- for_( it, pool.byKindBegin<Product>(), pool.byKindEnd<Product>() )
+ else
{
- MIL << *it << endl;
+ 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;

Modified: trunk/libzypp/devel/devel.ma/Tools.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.ma/Tools.h?rev=11734&r1=11733&r2=11734&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.ma/Tools.h (original)
+++ trunk/libzypp/devel/devel.ma/Tools.h Thu Nov 20 11:06:49 2008
@@ -162,16 +162,19 @@
return 0;
}

+
+
template<class _Res>
-PoolItem getPi( const std::string & name_r, const Edition & ed_r, const Arch &
arch_r )
+PoolItem getPi( const std::string & alias_r, const std::string & name_r, const
Edition & ed_r, const Arch & arch_r )
{
PoolItem ret;
ResPool pool( getZYpp()->pool() );
- for_(it, pool.byNameBegin(name_r), pool.byNameEnd(name_r) )
+ for_(it, pool.byIdentBegin<_Res>(name_r), pool.byIdentEnd<_Res>(name_r) )
{
- if ( !ret && isKind<_Res>( (*it).resolvable() )
- && ( ed_r == Edition() || ed_r.match((*it)->edition()) == 0 )
- && ( arch_r == Arch() || arch_r == (*it)->arch() ) )
+ if ( !ret
+ && ( ed_r.empty() || ed_r.match((*it)->edition()) == 0 )
+ && ( arch_r.empty() || arch_r == (*it)->arch() )
+ && ( alias_r.empty() || alias_r == (*it)->repository().alias() ) )
{
ret = (*it);
MIL << " ->" << *it << endl;
@@ -184,14 +187,19 @@
return ret;
}
template<class _Res>
+PoolItem getPi( const std::string & name_r, const Edition & ed_r, const Arch &
arch_r )
+{
+ return getPi<_Res>( "", name_r, ed_r, arch_r );
+}
+template<class _Res>
PoolItem getPi( const std::string & name_r )
{
- return getPi<_Res>( name_r, Edition(), Arch() );
+ return getPi<_Res>( name_r, Edition(), Arch_empty );
}
template<class _Res>
PoolItem getPi( const std::string & name_r, const Edition & ed_r )
{
- return getPi<_Res>( name_r, ed_r, Arch() );
+ return getPi<_Res>( name_r, ed_r, Arch_empty );
}
template<class _Res>
PoolItem getPi( const std::string & name_r, const Arch & arch_r )

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

< Previous Next >
This Thread
  • No further messages