#include <zypp/base/Exception.h>
#include <zypp/base/LogTools.h>
#include <zypp/base/ProvideNumericId.h>
+#include <zypp/AutoDispose.h>
#include "zypp/ZYppFactory.h"
#include "zypp/ResPoolProxy.h"
-#include <zypp/CapMatchHelper.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/Digest.h"
#include "zypp/PackageKeyword.h"
-#include "zypp/NameKindProxy.h"
-#include "zypp/pool/GetResolvablesToInsDel.h"
+#include "zypp/ManagedFile.h"
+
#include "zypp/parser/TagParser.h"
#include "zypp/parser/susetags/PackagesFileReader.h"
#include "zypp/RepoManager.h"
#include "zypp/RepoInfo.h"
+#include "zypp/repo/DeltaCandidates.h"
+#include "zypp/repo/PackageProvider.h"
+#include "zypp/repo/SrcPackageProvider.h"
+
+#include "zypp/ui/PatchContents.h"
+#include "zypp/ResPoolProxy.h"
+
using namespace std;
using namespace zypp;
using namespace zypp::functor;
-
+using namespace zypp::ui;
using zypp::parser::TagParser;
///////////////////////////////////////////////////////////////////
static const Pathname sysRoot( "/Local/ROOT" );
///////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////
+namespace zypp
+{ /////////////////////////////////////////////////////////////////
+
+bool queryInstalledEditionHelper( const std::string & name_r,
+ const Edition & ed_r,
+ const Arch & arch_r )
+{
+ if ( ed_r == Edition::noedition )
+ return true;
+ if ( name_r == "kernel-default" && ed_r == Edition("2.6.22.5-10") )
+ return true;
+ if ( name_r == "update-test-affects-package-manager" && ed_r == Edition("1.1-6") )
+ return true;
+
+ return false;
+}
+
+
+ManagedFile repoProvidePackage( const PoolItem & pi )
+{
+ ResPool _pool( getZYpp()->pool() );
+ repo::RepoMediaAccess _access;
+
+ // Redirect PackageProvider queries for installed editions
+ // (in case of patch/delta rpm processing) to rpmDb.
+ repo::PackageProviderPolicy packageProviderPolicy;
+ packageProviderPolicy.queryInstalledCB( queryInstalledEditionHelper );
+
+ Package::constPtr p = asKind<Package>(pi.resolvable());
+
+ // Build a repository list for repos
+ // contributing to the pool
+ repo::DeltaCandidates deltas( repo::makeDeltaCandidates( _pool.knownRepositoriesBegin(),
+ _pool.knownRepositoriesEnd() ) );
+ repo::PackageProvider pkgProvider( _access, p, deltas, packageProviderPolicy );
+ return pkgProvider.providePackage();
+}
+
+ /////////////////////////////////////////////////////////////////
+} // namespace zypp
+///////////////////////////////////////////////////////////////////
+
+void dbgDu( Selectable::Ptr sel )
+{
+ if ( sel->installedPoolItem() )
+ {
+ DBG << "i: " << sel->installedPoolItem() << endl
+ << sel->installedPoolItem()->diskusage() << endl;
+ }
+ if ( sel->candidatePoolItem() )
+ {
+ DBG << "c: " << sel->candidatePoolItem() << endl
+ << sel->candidatePoolItem()->diskusage() << endl;
+ }
+ INT << sel << endl
+ << getZYpp()->diskUsage() << endl;
+}
+
+///////////////////////////////////////////////////////////////////
struct Xprint
{
bool operator()( const PoolItem & obj_r )
{
- handle( asKind<Package>( obj_r ) );
- //handle( asKind<Pattern>( obj_r ) );
- //handle( asKind<Product>( obj_r ) );
+ if ( obj_r.status().isLocked() )
+ SEC << obj_r << endl;
+
+// handle( asKind<Package>( obj_r ) );
+// handle( asKind<Patch>( obj_r ) );
+// handle( asKind<Pattern>( obj_r ) );
+// handle( asKind<Product>( obj_r ) );
return true;
}
if ( !p )
return;
+ WAR << p->size() << endl;
MIL << p->diskusage() << endl;
}
+ void handle( const Patch_constPtr & p )
+ {
+ if ( !p )
+ return;
+ }
+
void handle( const Pattern_constPtr & p )
{
if ( !p )
return;
- MIL << p << endl;
+ if ( p->vendor().empty() )
+ ERR << p << endl;
+ else if ( p->vendor() == "SUSE (assumed)" )
+ SEC << p << endl;
}
void handle( const Product_constPtr & p )
if ( !p )
return;
- ERR << p << endl;
- ERR << p->type() << endl;
+ USR << p << endl;
+ USR << p->vendor() << endl;
+ USR << p->type() << endl;
}
template<class _C>
{}
};
-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( bool establish = false )
return true;
}
+bool install()
+{
+ SEC << getZYpp()->commit( ZYppCommitPolicy() ) << endl;
+ return true;
+}
+
///////////////////////////////////////////////////////////////////
struct ConvertDbReceive : public callback::ReceiveReport<target::ScriptResolvableReport>
struct MediaChangeReceive : public callback::ReceiveReport<media::MediaChangeReport>
{
- virtual Action requestMedia( Repository source
+ virtual Action requestMedia( Url & source
, unsigned mediumNr
, Error error
, const std::string & description )
{ /////////////////////////////////////////////////////////////////
+ void Vtst( const std::string & lhs, const std::string & rhs )
+ {
+ (VendorAttr::instance().equivalent( lhs, rhs )?MIL:ERR) << lhs << " <==> "<< rhs << endl;
+
+ }
/////////////////////////////////////////////////////////////////
} // namespace zypp
using namespace zypp;
+void tt( std::string dd )
+{
+ unsigned level = 3;
+ std::string::size_type pos = dd.find( "/" );
+ while ( --level && pos != std::string::npos )
+ {
+ pos = dd.find( "/", pos+1 );
+ }
+ if ( pos != std::string::npos )
+ dd.erase( pos+1 );
+ DBG << dd << "\t" << level << " " << pos << endl;
+}
+
/******************************************************************
**
** FUNCTION NAME : main
{
//zypp::base::LogControl::instance().logfile( "log.restrict" );
INT << "===[START]==========================================" << endl;
+ setenv( "ZYPP_CONF", "/Local/ROOT/zypp.conf", 1 );
DigestReceive foo;
KeyRingSignalsReceive baa;
RepoManager repoManager( makeRepoManager( "/Local/ROOT" ) );
- RepoInfoList repos = repoManager.knownRepositories();
- SEC << repos << endl;
- if ( repos.empty() )
- {
- RepoInfo nrepo;
- nrepo
- .setAlias( "factorytest" )
- .setName( "Test Repo for factory." )
- .setEnabled( true )
- .setAutorefresh( false )
- .addBaseUrl( Url("http://dist.suse.de/install/stable-x86/") );
-
- repoManager.addRepository( nrepo );
- SEC << "refreshMetadat" << endl;
- repoManager.refreshMetadata( nrepo );
- SEC << "buildCache" << endl;
- repoManager.buildCache( nrepo );
- SEC << "------" << endl;
- repos = repoManager.knownRepositories();
- }
-
- ResPool pool( getZYpp()->pool() );
- vdumpPoolStats( USR << "Initial pool:" << endl,
- pool.begin(),
- pool.end() ) << endl;
+ RepoInfoList repos = repoManager.knownRepositories();
+ SEC << "/Local/ROOT " << repos << endl;
for ( RepoInfoList::iterator it = repos.begin(); it != repos.end(); ++it )
{
repoManager.cleanCache( nrepo );
}
SEC << "refreshMetadata" << endl;
- repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+ //repoManager.refreshMetadata( nrepo, RepoManager::RefreshForced );
+ repoManager.refreshMetadata( nrepo );
SEC << "buildCache" << endl;
repoManager.buildCache( nrepo );
}
getZYpp()->addResolvables( store );
}
+ ResPool pool( getZYpp()->pool() );
USR << "pool: " << pool << endl;
SEC << pool.knownRepositoriesSize() << endl;
{
{
zypp::base::LogControl::TmpLineWriter shutUp;
- getZYpp()->initTarget( sysRoot );
+ //getZYpp()->initTarget( sysRoot );
+ getZYpp()->initTarget( "/" );
}
MIL << "Added target: " << pool << endl;
}
- std::for_each( pool.begin(), pool.end(), Xprint() );
+ //std::for_each( pool.begin(), pool.end(), Xprint() );
+
+ PoolItem pi = getPi<Patch>( "fetchmsttfonts.sh" );
+ USR << pi << endl;
+
+ //pi.status().setTransact( true, ResStatus::USER );
+ //install();
- ///////////////////////////////////////////////////////////////////
+ ///////////////////////////////////////////////////////////////////
INT << "===[END]============================================" << endl << endl;
zypp::base::LogControl::instance().logNothing();
return 0;