#include "zypp/PackageKeyword.h"
#include "zypp/TmpPath.h"
#include "zypp/ManagedFile.h"
-#include "zypp/NameKindProxy.h"
-#include "zypp/pool/GetResolvablesToInsDel.h"
+#include "zypp/MediaSetAccess.h"
+
#include "zypp/RepoManager.h"
#include "zypp/Repository.h"
#include "zypp/RepoInfo.h"
-
+#include "zypp/TriBool.h"
#include "zypp/repo/PackageProvider.h"
#include "zypp/ResPoolProxy.h"
#include "zypp/sat/Pool.h"
#include "zypp/sat/LocaleSupport.h"
#include "zypp/sat/LookupAttr.h"
+#include "zypp/sat/AttrMatcher.h"
#include "zypp/sat/SolvableSet.h"
#include "zypp/sat/SolvIterMixin.h"
#include "zypp/sat/detail/PoolImpl.h"
#include "zypp/sat/WhatObsoletes.h"
#include "zypp/PoolQuery.h"
#include "zypp/ServiceInfo.h"
+#include "zypp/media/MediaPriority.h"
+
+#include "zypp/target/rpm/RpmDb.h"
+#include "zypp/target/rpm/RpmHeader.h"
+#include "zypp/target/rpm/librpmDb.h"
#include <boost/mpl/int.hpp>
{}
};
-inline bool g( const NameKindProxy & nkp, Arch arch = Arch() )
-{
- 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()
#undef OUTS
}
-/******************************************************************
-**
-** FUNCTION NAME : main
-** FUNCTION TYPE : int
-*/
-int main( int argc, char * argv[] )
-try {
- --argc;
- ++argv;
- zypp::base::LogControl::instance().logToStdErr();
- INT << "===[START]==========================================" << endl;
- ZConfig::instance();
-
+#include "zypp/Locks.h"
+#include "zypp/target/HardLocksFile.h"
+inline PoolQuery makeTrivialQuery( IdString ident_r )
+{
+ sat::Solvable::SplitIdent ident( ident_r );
+
+ PoolQuery q;
+ q.addAttribute( sat::SolvAttr::name, ident.name().asString() );
+ q.addKind( ident.kind() );
+ q.setMatchExact();
+ q.setCaseSensitive(true);
+ return q;
+}
+inline PoolQuery makeTrivialQuery( const char * ch )
+{ return makeTrivialQuery( IdString(ch) ); }
+void lktest()
+{
+ static unsigned i = 0;
+ ResPool pool( ResPool::instance() );
+ target::HardLocksFile::Data newdata;
+ pool.getHardLockQueries( newdata );
+ SEC << '[' << i++ << ']' << newdata << endl;
+}
-#if 0
- RepoManager repoManager( makeRepoManager( sysRoot ) );
+Capability guessPackageSpec( const std::string & str_r )
+{
+ return Capability::guessPackageSpec( str_r );
+}
- ServiceInfoList services = repoManager.knownServices();
- WAR << services << endl;
- //RepoInfoList repos = repoManager.knownRepositories();
- //DBG << repos << endl;
- ServiceInfo s( repoManager.getService( "STest" ) );
- if ( s == ServiceInfo::noService )
+void cut( const Capability & cap )
+{
+ CapDetail detail( cap.detail() );
+ if ( detail.isSimple() )
{
- Measure x( "Add service STest" );
- repoManager.addService( "STest", Url("dir:///Local/Service") );
- s = repoManager.getService( "STest" );
- USR << "Add service " << s << endl;
+ MIL << detail.kind() << ": " << detail.name();
+ if ( detail.hasArch() )
+ MIL << " (" << detail.arch() << ")";
+ if ( detail.isVersioned() )
+ MIL << " " << detail.op() << " " << detail.ed();
+ MIL << endl;
}
-
+ else
{
- Measure x( "Refresh service STest" );
- repoManager.refreshService( s );
+ MIL << "---???---" << endl;
}
+}
+namespace zypp { namespace target {
+ void XRunUpdateMessages( const Pathname & root_r,
+ const Pathname & messagesPath_r,
+ const std::vector<sat::Solvable> & checkPackages_r,
+ ZYppCommitResult & result_r );
- RepoInfo nrepo;
- nrepo.setAlias( alias );
- nrepo.setName( alias );
- nrepo.setEnabled( true );
- nrepo.setAutorefresh( false );
- nrepo.addBaseUrl( Url(url) );
+}}
+using zypp::target::XRunUpdateMessages;
- if ( ! repoManager.isCached( nrepo ) )
- {
- repoManager.buildCache( nrepo );
+/******************************************************************
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+*/
+int main( int argc, char * argv[] )
+try {
+ --argc,++argv;
+ if (0) {
+ // download the repo index file
+ media::MediaManager mediamanager;
+ media::MediaAccessId mid = mediamanager.open( Url("http://download.opensuse.org") );
+ mediamanager.attach( mid );
}
-
- repoManager.loadFromCache( nrepo );
-
-
- ///////////////////////////////////////////////////////////////////
- INT << "===[END]============================================" << endl << endl;
- zypp::base::LogControl::instance().logNothing();
- return 0;
-#endif
+ zypp::base::LogControl::instance().logToStdErr();
+ INT << "===[START]==========================================" << endl;
+ ZConfig::instance();
ResPool pool( ResPool::instance() );
sat::Pool satpool( sat::Pool::instance() );
- if ( 1 )
+ if ( 0 )
{
Measure x( "INIT TARGET" );
{
{
- zypp::base::LogControl::TmpLineWriter shutUp;
+ //zypp::base::LogControl::TmpLineWriter shutUp;
getZYpp()->initializeTarget( sysRoot );
}
getZYpp()->target()->load();
- USR << getZYpp()->target()->targetDistribution() << endl;
- USR << getZYpp()->target()->targetDistributionRelease() << endl;
+ USR << "baseproduct: " << getZYpp()->target()->baseProduct() << endl;
+ USR << "targetDistribution: " << getZYpp()->target()->targetDistribution() << endl;
+ USR << "targetDistributionRelease: " << getZYpp()->target()->targetDistributionRelease() << endl;
dumpRange( USR << "Product ", pool.byKindBegin<Product>(), pool.byKindEnd<Product>() ) << endl;
}
}
- if ( 1 )
+ if ( 0 )
{
RepoManager repoManager( makeRepoManager( sysRoot ) );
ServiceInfoList services = repoManager.knownServices();
repoManager.loadFromCache( nrepo );
}
- USR << "pool: " << pool << endl;
+ //USR << "pool: " << pool << endl;
}
}
}
if ( 0 )
{
Measure x( "Upgrade" );
- UpgradeStatistics u;
- getZYpp()->resolver()->doUpgrade( u );
+ getZYpp()->resolver()->doUpgrade();
}
///////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////
- if ( 0 )
- {
- PoolItem pi ( getPi<Patch>("xorg-x11-Xvnc") );
- MIL << pi << endl;
- if ( pi )
- {
- Patch::constPtr p( pi->asKind<Patch>() );
- INT << p->contents() << endl;
- }
- }
-#if 0
+
+
+#if 1
getZYpp()->resolver()->addRequire( Capability("amarok") );
+ pool.byKindBegin<Package>()->status().setTransact( true, ResStatus::USER );
solve();
vdumpPoolStats( USR << "Transacting:"<< endl,
make_filter_begin<resfilter::ByTransact>(pool),
catch ( const Exception & exp )
{
INT << exp << endl << exp.historyAsString();
+ throw;
}
catch (...)
-{}
+{
+ throw;
+}