SUBDIRS = yum
-noinst_PROGRAMS = Msg Msg.debug Patch Patch.debug Script Script.debug PatchSelect PatchSelect.debug PatchRead PatchRead.debug SourceRead SourceRead.debug SourceProvide SourceProvide.debug RpmTarget RpmTarget.debug RpmInstall RpmInstall.debug
+noinst_PROGRAMS = Msg Msg.debug Patch Patch.debug Script Script.debug PatchSelect PatchSelect.debug PatchRead PatchRead.debug SourceRead SourceRead.debug SourceProvide SourceProvide.debug RpmTarget RpmTarget.debug RpmInstall RpmInstall.debug Target Target.debug
## ##################################################
RpmInstall_debug_SOURCES = $(RpmInstall_SOURCES)
RpmInstall_debug_LDFLAGS = -static
+Target_SOURCES = Target.cc
+
+Target_debug_SOURCES = $(Target_SOURCES)
+Target_debug_LDFLAGS = -static
+
## ##################################################
--- /dev/null
+#include <iostream>
+#include "zypp/base/Logger.h"
+#include "zypp/target/rpm/RpmDb.h"
+#include "zypp/ZYpp.h"
+#include "zypp/ZYppFactory.h"
+#include "zypp/SourceManager.h"
+
+
+using namespace std;
+using namespace zypp;
+using namespace zypp::target::rpm;
+
+/******************************************************************
+**
+**
+** FUNCTION NAME : main
+** FUNCTION TYPE : int
+**
+** DESCRIPTION :
+*/
+int main( int argc, char * argv[] )
+{
+ INT << "===[START]==========================================" << endl;
+
+ // initialize target
+ ZYpp::Ptr zypp = ZYppFactory().letsTest();
+ zypp->initTarget("/");
+ Target_Ptr target = zypp->target();
+
+ // initialize source
+ SourceManager_Ptr mgr = SourceManager::sourceManager();
+ unsigned id = mgr->addSource(Url("http://lide.suse.cz/~~jsrain/devel.jsrain"));
+ Source & src = mgr->findSource(id);
+ ResStore store = src.resolvables();
+ RpmDb & rpm = target->rpmDb();
+ for (ResStore::const_iterator it = store.begin();
+ it != store.end();
+ it++)
+ {
+ if (isKind<Package>(*it))
+ {
+ Package::Ptr p = dynamic_pointer_cast<Package>(*it);
+ try {
+ Pathname path = p->getPlainRpm();
+ rpm.installPackage(path);
+ }
+ catch (...)
+ {}
+ }
+ }
+
+
+ INT << "===[END]============================================" << endl;
+ return 0;
+}
{
INT << "===[START]==========================================" << endl;
SourceManager_Ptr mgr = SourceManager::sourceManager();
- ResPoolManager pool;
- unsigned id = mgr->addSource(pool, Url("ftp://cml.suse.cz/netboot/find/SUSE-10.1-CD-OSS-i386-Beta1-CD1"), Pathname("/"));
+ unsigned id = mgr->addSource(Url("ftp://cml.suse.cz/netboot/find/SUSE-10.1-CD-OSS-i386-Beta1-CD1"), Pathname("/"));
ERR << id << endl;
- ERR << pool << endl;
Source & src = mgr->findSource(id);
Pathname p = src.provideFile("/control.xml", 0);
ERR << p << endl;
- mgr->removeSource(pool, id);
- ERR << pool << endl;
+ const ResStore store = src.resolvables();
+ ERR << store << endl;
+ mgr->removeSource(id);
INT << "===[END]============================================" << endl;
return 0;
}
INT << "===[START]==========================================" << endl;
SourceFactory _f;
Pathname p = "/";
- Url url = Url("ftp://cml.suse.cz/netboot/find/SUSE-10.1-CD-OSS-i386-Beta1-CD1");
-// Url url = Url("http://lide.suse.cz/~~jsrain/devel.jsrain");
+// Url url = Url("ftp://cml.suse.cz/netboot/find/SUSE-10.1-CD-OSS-i386-Beta1-CD1");
+ Url url = Url("http://lide.suse.cz/~~jsrain/devel.jsrain");
// Url url = Url("dir:/local/zypp/libzypp/devel/devel.jsrain");
Source s = _f.createFrom( url, p );
ResStore store = s.resolvables();