Author: haass
Date: Mon Jul 30 11:20:34 2007
New Revision: 6277
URL: http://svn.opensuse.org/viewcvs/zypp?rev=6277&view=rev
Log:
Cleaned my devel-dir
Added:
trunk/libzypp/devel/devel.shaas/old/
trunk/libzypp/devel/devel.shaas/old/Makefile
trunk/libzypp/devel/devel.shaas/old/Makefile_old2
trunk/libzypp/devel/devel.shaas/old/dbmain.cc
trunk/libzypp/devel/devel.shaas/old/dbtest.cc
trunk/libzypp/devel/devel.shaas/old/main.cc
trunk/libzypp/devel/devel.shaas/src/
trunk/libzypp/devel/devel.shaas/src/Makefile
trunk/libzypp/devel/devel.shaas/src/db.cc
trunk/libzypp/devel/devel.shaas/src/db.h
trunk/libzypp/devel/devel.shaas/src/pdbtozypp.cc
trunk/libzypp/devel/devel.shaas/src/pdbtozypp.h
trunk/libzypp/devel/devel.shaas/src/resolvable.cc
trunk/libzypp/devel/devel.shaas/src/resolvable.h
Removed:
trunk/libzypp/devel/devel.shaas/Makefile
trunk/libzypp/devel/devel.shaas/db.cc
trunk/libzypp/devel/devel.shaas/db.h
trunk/libzypp/devel/devel.shaas/dbmain.cc
trunk/libzypp/devel/devel.shaas/dbtest.cc
trunk/libzypp/devel/devel.shaas/resolvable.cc
trunk/libzypp/devel/devel.shaas/resolvable.h
Added: trunk/libzypp/devel/devel.shaas/old/Makefile
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/Makefile?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/Makefile (added)
+++ trunk/libzypp/devel/devel.shaas/old/Makefile Mon Jul 30 11:20:34 2007
@@ -0,0 +1,51 @@
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES =
+CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/include -I. -I. -I.
+LINK = g++
+LFLAGS = -lpdbtozypp
+LIBS = $(SUBLIBS) -L/usr/local/lib
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = main.cc
+OBJECTS = main.o
+OBJCOMP =
+DESTDIR =
+TARGET = dbread
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
Added: trunk/libzypp/devel/devel.shaas/old/Makefile_old2
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/Makefile_old2?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/Makefile_old2 (added)
+++ trunk/libzypp/devel/devel.shaas/old/Makefile_old2 Mon Jul 30 11:20:34 2007
@@ -0,0 +1,56 @@
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES =
+CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/include -I. -I. -I.
+LINK = g++
+LFLAGS = -shared -fpic -lmysqlclient
+LIBS = $(SUBLIBS) -L/usr/local/lib
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = db.cc resolvable.h pdbtozypp.cc
+OBJECTS = db.o dbmain.o pdbtozypp.o
+OBJCOMP = /usr/local/lib/libzypp.so
+DESTDIR =
+TARGET = libpdbtozypp.so
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+install:
+ install --mode=644 db.h /usr/include/pdbtozypp/
+ install --mode=644 resolvable.h /usr/include/pdbtozypp/
+ install --mode=644 pdbtozypp.h /usr/include/pdbtozypp/
+ install --mode=555 libpdbtozypp.so /usr/lib/
Added: trunk/libzypp/devel/devel.shaas/old/dbmain.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/dbmain.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/dbmain.cc (added)
+++ trunk/libzypp/devel/devel.shaas/old/dbmain.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,253 @@
+#include <iostream>
+#include <vector>
+#include <map>
+#include "db.h"
+#include "resolvable.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+using namespace zypp;
+
+unsigned int getResolvables(ResStore*);
+
+int main(){
+
+ static ZYpp::Ptr God;
+ ResStore *store = new ResStore();
+
+ std::cout << "Returncode: " << getResolvables(store) << std::endl;
+
+ // Get Zypp lock
+ try {
+ God = zypp::getZYpp();
+ }
+ catch (const Exception & excpt_r ) {
+ ZYPP_CAUGHT( excpt_r );
+ std::cerr << "Can't aquire ZYpp lock" << std::endl;
+ return 1;
+ }
+
+ God->addResolvables(*store);
+
+ std::cout << "Number of elements in pool: " << God->pool().size() << std::endl;
+ std::cout << "Verify System: " << God->resolver()->verifySystem() << std::endl;
+
+ /*for (ResPool::const_iterator it = God->pool().begin(); it != God->pool().end(); ++it) {
+ if(it->resolvable()->name() == "tvbrowser"){
+ CapSet caps = it->resolvable()->dep (Dep::REQUIRES);
+ for (CapSet::const_iterator itCap = caps.begin(); itCap != caps.end(); ++itCap)
+ std::cout << "Requires: " << itCap->op().asString() << " " << itCap->asString() << std::endl;
+ }
+ }*/
+
+ return 0;
+}
+
+unsigned int getResolvables(ResStore *store){
+
+ database *dbDeps = new database("lorien.suse.de", "rpmread", "Salahm1", "rpm");
+ database *dbPackages = new database("lorien.suse.de", "rpmread", "Salahm1", "package");
+
+ if(dbPackages->connect() != 1){
+ std::cout << "NO DB CONNECTION!!!\n";
+ return 1;
+ }
+
+ if(dbDeps->connect() != 1){
+ std::cout << "NO DB CONNECTION!!!\n";
+ return 1;
+ }
+
+ dbPackages->sqlexecute("SELECT PackID, PackNameShort, PackStatus FROM Packages WHERE CDReleaseID = 10 AND PackStatus IN (0, 6, 7, 8) AND BasedOnID IS NULL");
+
+ std::vector< std::vector<string> > packIDs = dbPackages->getResult();
+ std::cout << "get packages from db...\n";
+
+ Resolvable::Kind kind = ResTraits<Package>::kind;
+ CapFactory factory;
+
+ for(unsigned int i = 2000; i < packIDs.size(); i++){
+
+ string sqlcom("SELECT PackID FROM Packages WHERE BasedOnID=");
+ sqlcom.append(packIDs[i].at(0));
+ dbPackages->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > basedIDs = dbPackages->getResult();
+
+ std::vector< std::vector<string> > binPack;
+
+ for(unsigned int j = 0; j < basedIDs.size(); j++){
+
+ sqlcom = "SELECT BinPackID, Version FROM BinaryPackages WHERE PackID=";
+ sqlcom.append(basedIDs[j].at(0));
+ dbDeps->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > tempVec = dbDeps->getResult();
+ for(unsigned int x = 0; x < tempVec.size(); x++)
+ binPack.push_back(tempVec.at(x));
+ }
+
+ intrusive_ptr<resolvZypp> pkg;
+ CapSet prov;
+ CapSet preq;
+ CapSet req;
+ CapSet conf;
+ CapSet obs;
+ CapSet rec;
+ CapSet sug;
+ CapSet fre;
+ CapSet enh;
+ CapSet sup;
+
+ string edition = "";
+
+ // If Deps
+ if(binPack.size() != 0){
+
+ std::vector< std::vector<string> > packDeps;
+
+ for(unsigned int k = 0; k < binPack.size(); k++){
+ sqlcom = "SELECT Symbol, Kind, Compare, Version FROM PackReqProv WHERE BinPackID=";
+ sqlcom.append(binPack[k].at(0));
+ dbDeps->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > tempVec = dbDeps->getResult();
+ for(unsigned int l = 0; l < tempVec.size(); l++)
+ packDeps.push_back(tempVec.at(l));
+
+
+ }
+
+ for(unsigned int y = 0; y < packDeps.size(); y++){
+
+ string ed = "";
+ Rel rel = Rel::ANY;
+
+ if(packDeps[y].at(0) == "(none)")
+ continue;
+
+ if(packDeps[y].at(2) != "NULL"){
+ rel = Rel(packDeps[y].at(2));
+ ed = packDeps[y].at(3);
+ }
+
+
+ if(packDeps[y].at(1) == "provides"){
+ prov.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "prerequires"){
+ preq.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "requires"){
+ req.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "conflicts"){
+ conf.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "obsoletes"){
+ obs.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "recommends"){
+ rec.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "suggests"){
+ sug.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "freshens"){
+ fre.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "enhances"){
+ enh.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "supplements"){
+ sup.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }
+ }
+
+ edition = binPack[0].at(1);
+
+ }
+
+ Dependencies deps;
+ if(prov.size() > 0)
+ deps[Dep::PROVIDES] = prov;
+ if(preq.size() > 0)
+ deps[Dep::PREREQUIRES] = preq;
+ if(req.size() > 0)
+ deps[Dep::REQUIRES] = req;
+ if(conf.size() > 0)
+ deps[Dep::CONFLICTS] = conf;
+ if(obs.size() > 0)
+ deps[Dep::OBSOLETES] = obs;
+ if(rec.size() > 0)
+ deps[Dep::RECOMMENDS] = rec;
+ if(sug.size() > 0)
+ deps[Dep::SUGGESTS] = sug;
+ if(fre.size() > 0)
+ deps[Dep::FRESHENS] = fre;
+ if(enh.size() > 0)
+ deps[Dep::ENHANCES] = enh;
+ if(sup.size() > 0)
+ deps[Dep::SUPPLEMENTS] = sup;
+
+ //std::cout << "Package: " << packIDs[i].at(1) << std::endl;
+ NVRAD nvPkg(packIDs[i].at(1), Edition(edition), Arch("i386"), deps);
+
+ CapSet::const_iterator testIter;
+
+ for(testIter = req.begin(); testIter != req.end(); testIter++){
+ //std::cout << testIter->asString() << std::endl;
+ }
+
+ Package::Ptr p( detail::makeResolvableAndImpl(nvPkg, pkg));
+
+ store->insert(p);
+
+ if(i%1000 == 0)
+ std::cout << std::endl << i << " packages parsed!\n";
+ }
+
+ dbDeps->close();
+ dbPackages->close();
+
+ return 0;
+
+}
+
+int old_test(){
+
+ //* old Test-Main
+ database *db = new database("lorien.suse.de", "rpmread", "Salahm1", "rpm");
+ //database *db = new database("lorien.suse.de", "rpmread", "Salahm1", "package");
+ //resolvable *test = new resolvable("art", "386", "1.0", "99", "tr");
+
+ string sqlcom = "";
+
+ if(db->connect() == 1){
+ while(1){
+ std::cout << "SQL-Kommando: ";
+ std::getline(std::cin, sqlcom);
+
+ if(sqlcom.compare("quit") == 0)
+ break;
+
+ db->sqlexecute(sqlcom);
+ }
+ }
+
+ //test->addDep(REQUIRES, "test2");
+ std::vector< std::vector<string> > result = db->getResult();
+ db->close();
+
+ for(unsigned int i = 0; i < result.size(); i++){
+ for(unsigned int y = 0; y < result[i].size(); y++)
+ std::cout << result[i].at(y) << " | ";
+ std::cout << std::endl;
+ }
+
+ //std::cout << "Anzahl an Zeilen: " << result.size() << std::endl;
+ return 0;
+}
Added: trunk/libzypp/devel/devel.shaas/old/dbtest.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/dbtest.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/dbtest.cc (added)
+++ trunk/libzypp/devel/devel.shaas/old/dbtest.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,36 @@
+#include
+#include <iostream>
+
+#define host "lorien.suse.de"
+#define username "rpmread"
+#define password "Salahm1"
+#define database "rpm"
+
+MYSQL *conn;
+
+int main(int argc, char *argv[]){
+
+ conn = mysql_init(NULL);
+ mysql_real_connect(conn,host,username,password,database,0,NULL,0);
+
+ if(conn == NULL)
+ std::cout << "DB connection failed!";
+
+ MYSQL_RES *res_set;
+ MYSQL_ROW row;
+ unsigned int i;
+
+ mysql_query(conn,"SELECT * FROM PackReqProv");
+ res_set = mysql_store_result(conn);
+ unsigned int numrows = mysql_num_rows(res_set);
+
+ std::cout << "Anzahl: " << numrows << std::endl;
+
+ while ((row = mysql_fetch_row(res_set)) != NULL){
+ std::cout << row[5] << std::endl;
+ }
+
+ mysql_close(conn);
+ return 0;
+
+}
Added: trunk/libzypp/devel/devel.shaas/old/main.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/main.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/main.cc (added)
+++ trunk/libzypp/devel/devel.shaas/old/main.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,22 @@
+#include
+
+using namespace zypp;
+using namespace std;
+int main(){
+
+ static ZYpp::Ptr God;
+ ResStore store = pdbToZypp();
+
+ try {
+ God = zypp::getZYpp();
+ }
+ catch (const Exception & excpt_r ) {
+ ZYPP_CAUGHT( excpt_r );
+ cerr << "ZYPP no available" << endl;
+ return 1;
+ }
+
+ God->addResolvables(store);
+ cout << "Elements in pool: " << God->pool().size() << endl;
+ return 0;
+}
Added: trunk/libzypp/devel/devel.shaas/src/Makefile
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/Makefile?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/Makefile (added)
+++ trunk/libzypp/devel/devel.shaas/src/Makefile Mon Jul 30 11:20:34 2007
@@ -0,0 +1,56 @@
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES =
+CFLAGS = -pipe -O2 -Wall -W -fpic -D_REENTRANT $(DEFINES)
+CXXFLAGS = -pipe -O2 -Wall -W -fpic -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/include -I. -I. -I.
+LINK = g++
+LFLAGS = -shared -lmysqlclient
+LIBS = $(SUBLIBS) -L/usr/local/lib
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = db.cc resolvable.h pdbtozypp.cc
+OBJECTS = db.o pdbtozypp.o
+OBJCOMP = /usr/local/lib/libzypp.so
+DESTDIR =
+TARGET = libpdbtozypp.so
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+install:
+ install --mode=644 db.h /usr/include/pdbtozypp/
+ install --mode=644 resolvable.h /usr/include/pdbtozypp/
+ install --mode=644 pdbtozypp.h /usr/include/pdbtozypp/
+ install --mode=555 libpdbtozypp.so /usr/lib/
Added: trunk/libzypp/devel/devel.shaas/src/db.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/db.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/db.cc (added)
+++ trunk/libzypp/devel/devel.shaas/src/db.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,91 @@
+#include "db.h"
+#include <iostream>
+
+using std::string;
+
+//Constructor
+
+database::database(string nHost, string nUsername, string nPassword, string nDatabase, unsigned int nPort, string nSocket, unsigned long nClient_flag){
+ host = nHost;
+ username = nUsername;
+ password = nPassword;
+ db = nDatabase;
+ port = nPort;
+ socket = nSocket;
+ client_flag = nClient_flag;
+
+ conn = mysql_init(NULL);
+}
+
+//Destructor
+
+database::~database(){
+}
+
+//Connect to db
+
+unsigned int database::connect(){
+ if(mysql_real_connect(conn, host.c_str(), username.c_str(), password.c_str(), db.c_str(), port, socket.c_str(), client_flag) == NULL){
+
+ if(mysql_error(conn) != "")
+ std::cout << mysql_error(conn) << std::endl;
+ return mysql_errno(conn);
+ }
+
+ return 1;
+}
+
+//Close db connection
+
+void database::close(){
+ mysql_close(conn);
+}
+
+//Execute given SQL-Statement
+
+unsigned int database::sqlexecute(string sqlcom){
+
+ if(mysql_query(conn, sqlcom.c_str())){
+ if(mysql_error(conn) != "")
+ std::cout << mysql_error(conn) << std::endl;
+ return mysql_errno(conn);
+ }
+
+ if((result = mysql_store_result(conn)) == NULL){
+ if(mysql_error(conn) != "")
+ std::cout << mysql_error(conn) << std::endl;
+ return mysql_errno(conn);
+ }
+
+ unsigned int numrows = mysql_num_rows(result);
+ unsigned int numfields = mysql_num_fields(result);
+
+ //std::cout << "Zeilen: " << numrows << " Spalten: " << numfields << std::endl;
+
+ return 1;
+
+}
+
+//Pushes the fetchbuffer in a vector
+
+std::vector< std::vector<string> > database::getResult(){
+
+ std::vector< std::vector<string> > outResult;
+ int vecCtr = 0;
+ unsigned int numfields = mysql_num_fields(result);
+
+ while ((fetchbuffer = mysql_fetch_row(result)) != NULL){
+ //if(mysql_error(conn) != "")
+ // std::cout << mysql_error(conn) << "\n";
+ std::vector<string> temp;
+ outResult.push_back(temp);
+
+ for(unsigned int i = 0; i < numfields; i++){
+ outResult[vecCtr].push_back(fetchbuffer[i] ? fetchbuffer[i] : "NULL");
+ }
+ vecCtr++;
+
+ }
+
+ return outResult;
+}
Added: trunk/libzypp/devel/devel.shaas/src/db.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/db.h?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/db.h (added)
+++ trunk/libzypp/devel/devel.shaas/src/db.h Mon Jul 30 11:20:34 2007
@@ -0,0 +1,33 @@
+#include
+#include <string>
+#include <vector>
+
+#ifndef DB_H
+#define DB_H
+
+using std::string;
+
+class database{
+ private:
+ string host;
+ string username;
+ string password;
+ string db;
+ unsigned int port;
+ string socket;
+ unsigned long client_flag;
+ MYSQL* conn;
+ MYSQL_ROW fetchbuffer;
+ MYSQL_RES* result;
+
+ public:
+ database(string host, string username, string password, string db, unsigned int port = 0, string socket = "", unsigned long client_flag = 0);
+ ~database();
+ unsigned int connect();
+ void close();
+ unsigned int sqlexecute(string sqlcom);
+ std::vector< std::vector<string> > getResult();
+};
+
+
+#endif
Added: trunk/libzypp/devel/devel.shaas/src/pdbtozypp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/pdbtozypp.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/pdbtozypp.cc (added)
+++ trunk/libzypp/devel/devel.shaas/src/pdbtozypp.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,179 @@
+#include "pdbtozypp.h"
+#include <iostream>
+
+using namespace zypp;
+
+//Constructor
+PdbToZypp::PdbToZypp(){
+
+ database *dbDeps = new database("lorien.suse.de", "rpmread", "Salahm1", "rpm");
+ database *dbPackages = new database("lorien.suse.de", "rpmread", "Salahm1", "package");
+
+ if(dbPackages->connect() != 1){
+ //std::cout << "NO DB CONNECTION!!!\n";
+ //return 1;
+ }
+
+ if(dbDeps->connect() != 1){
+ //std::cout << "NO DB CONNECTION!!!\n";
+ //return 1;
+ }
+
+ dbPackages->sqlexecute("SELECT PackID, PackNameShort, PackStatus FROM Packages WHERE CDReleaseID = 10 AND PackStatus IN (0, 6, 7, 8) AND BasedOnID IS NULL");
+
+ std::vector< std::vector<string> > packIDs = dbPackages->getResult();
+
+ Resolvable::Kind kind = ResTraits<Package>::kind;
+ CapFactory factory;
+
+ for(unsigned int i = 0; i < packIDs.size(); i++){
+
+ string sqlcom("SELECT PackID FROM Packages WHERE BasedOnID=");
+ sqlcom.append(packIDs[i].at(0));
+ dbPackages->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > basedIDs = dbPackages->getResult();
+
+ std::vector< std::vector<string> > binPack;
+
+ for(unsigned int j = 0; j < basedIDs.size(); j++){
+
+ sqlcom = "SELECT BinPackID, Version FROM BinaryPackages WHERE PackID=";
+ sqlcom.append(basedIDs[j].at(0));
+ dbDeps->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > tempVec = dbDeps->getResult();
+ for(unsigned int x = 0; x < tempVec.size(); x++)
+ binPack.push_back(tempVec.at(x));
+ }
+
+ intrusive_ptr<resolvZypp> pkg;
+ CapSet prov;
+ CapSet preq;
+ CapSet req;
+ CapSet conf;
+ CapSet obs;
+ CapSet rec;
+ CapSet sug;
+ CapSet fre;
+ CapSet enh;
+ CapSet sup;
+
+ string edition = "";
+
+ // If Deps
+ if(binPack.size() != 0){
+
+ std::vector< std::vector<string> > packDeps;
+
+ for(unsigned int k = 0; k < binPack.size(); k++){
+ sqlcom = "SELECT Symbol, Kind, Compare, Version FROM PackReqProv WHERE BinPackID=";
+ sqlcom.append(binPack[k].at(0));
+ dbDeps->sqlexecute(sqlcom);
+ std::vector< std::vector<string> > tempVec = dbDeps->getResult();
+ for(unsigned int l = 0; l < tempVec.size(); l++)
+ packDeps.push_back(tempVec.at(l));
+
+
+ }
+
+ for(unsigned int y = 0; y < packDeps.size(); y++){
+
+ string ed = "";
+ string symbol = packDeps[y].at(0);
+ Rel rel = Rel::ANY;
+
+ if(packDeps[y].at(0) == "(none)")
+ continue;
+
+ if(packDeps[y].at(2) != "NULL"){
+ rel = Rel(packDeps[y].at(2));
+ ed = packDeps[y].at(3);
+ }
+
+
+ if(packDeps[y].at(1) == "provides"){
+ if(symbol.find(" = ")){
+ prov.insert(factory.parse(kind, packDeps[y].at(0)));
+ }else{
+ prov.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }
+
+ }else if(packDeps[y].at(1) == "prerequires"){
+ preq.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "requires"){
+ req.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "conflicts"){
+ conf.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "obsoletes"){
+ obs.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "recommends"){
+ rec.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "suggests"){
+ sug.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "freshens"){
+ fre.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "enhances"){
+ enh.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }else if(packDeps[y].at(1) == "supplements"){
+ sup.insert(factory.parse(kind, packDeps[y].at(0)
+ , rel, Edition(ed)));
+ }
+ }
+
+ edition = binPack[0].at(1);
+
+ }
+
+ Dependencies deps;
+ if(prov.size() > 0)
+ deps[Dep::PROVIDES] = prov;
+ if(preq.size() > 0)
+ deps[Dep::PREREQUIRES] = preq;
+ if(req.size() > 0)
+ deps[Dep::REQUIRES] = req;
+ if(conf.size() > 0)
+ deps[Dep::CONFLICTS] = conf;
+ if(obs.size() > 0)
+ deps[Dep::OBSOLETES] = obs;
+ if(rec.size() > 0)
+ deps[Dep::RECOMMENDS] = rec;
+ if(sug.size() > 0)
+ deps[Dep::SUGGESTS] = sug;
+ if(fre.size() > 0)
+ deps[Dep::FRESHENS] = fre;
+ if(enh.size() > 0)
+ deps[Dep::ENHANCES] = enh;
+ if(sup.size() > 0)
+ deps[Dep::SUPPLEMENTS] = sup;
+
+ NVRAD nvPkg(packIDs[i].at(1), Edition(edition), Arch("i386"), deps);
+
+ Package::Ptr p( detail::makeResolvableAndImpl(nvPkg, pkg));
+
+ //set Status to install
+ /*for(unsigned int ii = 0; ii < pToInst.size(); ii++){
+ if(pToInst.at(ii) == packIDs[i].at(1)){
+ PoolItem_Ref poolItem(p);
+ poolItem.status().setToBeInstalled(ResStatus::USER);
+ }
+ }*/
+
+ store.insert(p);
+ }
+
+ dbDeps->close();
+ dbPackages->close();
+
+}
+
+ResStore PdbToZypp::getStore(){
+ return store;
+}
Added: trunk/libzypp/devel/devel.shaas/src/pdbtozypp.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/pdbtozypp.h?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/pdbtozypp.h (added)
+++ trunk/libzypp/devel/devel.shaas/src/pdbtozypp.h Mon Jul 30 11:20:34 2007
@@ -0,0 +1,18 @@
+#include <vector>
+#include "db.h"
+#include "resolvable.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+class PdbToZypp{
+ private:
+ zypp::ResStore store;
+ public:
+ PdbToZypp();
+ zypp::ResStore getStore();
+};
Added: trunk/libzypp/devel/devel.shaas/src/resolvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/resolvable.cc?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/resolvable.cc (added)
+++ trunk/libzypp/devel/devel.shaas/src/resolvable.cc Mon Jul 30 11:20:34 2007
@@ -0,0 +1,25 @@
+#include "resolvable.h"
+
+resolvable::resolvable(string _name, string _kind, string _arch, string _version, string _release){
+ name = _name;
+ kind = _kind;
+ arch = _arch;
+ version = _version;
+ release = _release;
+}
+
+resolvable::~resolvable(){
+}
+
+/*
+void resolvable::addDep(depType _type, string _dep){
+
+ if(deps.find(_type) == deps.end()){
+ std::vector<string> temp;
+ deps[_type] = temp;
+ }
+
+ deps[_type].push_back(_dep);
+
+}
+*/
Added: trunk/libzypp/devel/devel.shaas/src/resolvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/src/resolvable.h?rev=6277&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/src/resolvable.h (added)
+++ trunk/libzypp/devel/devel.shaas/src/resolvable.h Mon Jul 30 11:20:34 2007
@@ -0,0 +1,34 @@
+#include <string>
+#include <vector>
+#include <map>
+#include
+
+#ifndef RESOLVABLE_H
+#define RESOLVABLE_H
+
+using std::string;
+
+enum depType{
+ REQUIRES,
+ PROVIDES,
+ OBSOLETES,
+ CONFLICTS
+};
+
+class resolvable{
+ private:
+ string name;
+ string kind;
+ string arch;
+ string version;
+ string release;
+ std::map < depType, std::vector<string> > deps;
+
+ public:
+ resolvable(string name, string version, string kind = "package", string arch = "i386", string release ="0");
+ ~resolvable();
+ //void addDep(depType type, string dep, string compare, string version);
+};
+
+class resolvZypp : public zypp::detail::PackageImplIf {};
+#endif
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org