Cleaned my devel-dir
authorStefan Haas <shaas@suse.de>
Mon, 30 Jul 2007 09:20:34 +0000 (09:20 +0000)
committerStefan Haas <shaas@suse.de>
Mon, 30 Jul 2007 09:20:34 +0000 (09:20 +0000)
19 files changed:
devel/devel.shaas/Makefile [deleted file]
devel/devel.shaas/db.cc [deleted file]
devel/devel.shaas/db.h [deleted file]
devel/devel.shaas/dbmain.cc [deleted file]
devel/devel.shaas/dbtest.cc [deleted file]
devel/devel.shaas/old/Makefile [new file with mode: 0644]
devel/devel.shaas/old/Makefile_old2 [new file with mode: 0644]
devel/devel.shaas/old/dbmain.cc [new file with mode: 0644]
devel/devel.shaas/old/dbtest.cc [new file with mode: 0644]
devel/devel.shaas/old/main.cc [new file with mode: 0644]
devel/devel.shaas/resolvable.cc [deleted file]
devel/devel.shaas/resolvable.h [deleted file]
devel/devel.shaas/src/Makefile [new file with mode: 0644]
devel/devel.shaas/src/db.cc [new file with mode: 0644]
devel/devel.shaas/src/db.h [new file with mode: 0644]
devel/devel.shaas/src/pdbtozypp.cc [new file with mode: 0644]
devel/devel.shaas/src/pdbtozypp.h [new file with mode: 0644]
devel/devel.shaas/src/resolvable.cc [new file with mode: 0644]
devel/devel.shaas/src/resolvable.h [new file with mode: 0644]

diff --git a/devel/devel.shaas/Makefile b/devel/devel.shaas/Makefile
deleted file mode 100644 (file)
index c62c824..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-####### 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        = -lmysqlclient
-LIBS          = $(SUBLIBS)  -L/usr/lib
-
-####### Output directory
-
-OBJECTS_DIR   = ./
-
-####### Files
-
-SOURCES       = db.cc resolvable.h dbmain.cc 
-OBJECTS       = db.o dbmain.o resolvable.o
-OBJCOMP                  = /usr/lib/libzypp.so 
-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)
-
diff --git a/devel/devel.shaas/db.cc b/devel/devel.shaas/db.cc
deleted file mode 100644 (file)
index 3368120..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#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;
-}
diff --git a/devel/devel.shaas/db.h b/devel/devel.shaas/db.h
deleted file mode 100644 (file)
index bcff5b6..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <mysql/mysql.h>
-#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
diff --git a/devel/devel.shaas/dbmain.cc b/devel/devel.shaas/dbmain.cc
deleted file mode 100644 (file)
index fba4e45..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-#include <iostream>
-#include <vector>
-#include <map>
-#include "db.h"
-#include "resolvable.h"
-
-#include <zypp/ZYpp.h>
-#include <zypp/ZYppFactory.h>
-#include <zypp/ResStore.h>
-#include <zypp/Package.h>
-#include <zypp/Source.h>
-#include <zypp/CapFactory.h>
-
-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;
-}
diff --git a/devel/devel.shaas/dbtest.cc b/devel/devel.shaas/dbtest.cc
deleted file mode 100644 (file)
index 0c44920..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#include <mysql/mysql.h>
-#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; 
-
-}
diff --git a/devel/devel.shaas/old/Makefile b/devel/devel.shaas/old/Makefile
new file mode 100644 (file)
index 0000000..5dc8fe5
--- /dev/null
@@ -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)
+
diff --git a/devel/devel.shaas/old/Makefile_old2 b/devel/devel.shaas/old/Makefile_old2
new file mode 100644 (file)
index 0000000..d7b1636
--- /dev/null
@@ -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/
diff --git a/devel/devel.shaas/old/dbmain.cc b/devel/devel.shaas/old/dbmain.cc
new file mode 100644 (file)
index 0000000..fba4e45
--- /dev/null
@@ -0,0 +1,253 @@
+#include <iostream>
+#include <vector>
+#include <map>
+#include "db.h"
+#include "resolvable.h"
+
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/ResStore.h>
+#include <zypp/Package.h>
+#include <zypp/Source.h>
+#include <zypp/CapFactory.h>
+
+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;
+}
diff --git a/devel/devel.shaas/old/dbtest.cc b/devel/devel.shaas/old/dbtest.cc
new file mode 100644 (file)
index 0000000..0c44920
--- /dev/null
@@ -0,0 +1,36 @@
+#include <mysql/mysql.h>
+#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; 
+
+}
diff --git a/devel/devel.shaas/old/main.cc b/devel/devel.shaas/old/main.cc
new file mode 100644 (file)
index 0000000..a971998
--- /dev/null
@@ -0,0 +1,22 @@
+#include <pdbtozypp/pdbtozypp.h>
+
+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;
+}
diff --git a/devel/devel.shaas/resolvable.cc b/devel/devel.shaas/resolvable.cc
deleted file mode 100644 (file)
index b2089c5..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#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);
-
-}
-*/
diff --git a/devel/devel.shaas/resolvable.h b/devel/devel.shaas/resolvable.h
deleted file mode 100644 (file)
index 8ea851c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <string>
-#include <vector>
-#include <map>
-#include <zypp/detail/PackageImplIf.h>
-
-#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
diff --git a/devel/devel.shaas/src/Makefile b/devel/devel.shaas/src/Makefile
new file mode 100644 (file)
index 0000000..77ad2a6
--- /dev/null
@@ -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/
diff --git a/devel/devel.shaas/src/db.cc b/devel/devel.shaas/src/db.cc
new file mode 100644 (file)
index 0000000..3368120
--- /dev/null
@@ -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;
+}
diff --git a/devel/devel.shaas/src/db.h b/devel/devel.shaas/src/db.h
new file mode 100644 (file)
index 0000000..bcff5b6
--- /dev/null
@@ -0,0 +1,33 @@
+#include <mysql/mysql.h>
+#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
diff --git a/devel/devel.shaas/src/pdbtozypp.cc b/devel/devel.shaas/src/pdbtozypp.cc
new file mode 100644 (file)
index 0000000..76b5cf9
--- /dev/null
@@ -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;
+}
diff --git a/devel/devel.shaas/src/pdbtozypp.h b/devel/devel.shaas/src/pdbtozypp.h
new file mode 100644 (file)
index 0000000..0896a3c
--- /dev/null
@@ -0,0 +1,18 @@
+#include <vector>
+#include "db.h"
+#include "resolvable.h"
+
+#include <zypp/ZYpp.h>
+#include <zypp/ZYppFactory.h>
+#include <zypp/ResStore.h>
+#include <zypp/Package.h>
+#include <zypp/Source.h>
+#include <zypp/CapFactory.h>
+
+class PdbToZypp{
+       private:
+               zypp::ResStore store;
+       public:
+               PdbToZypp();
+               zypp::ResStore getStore();
+};
diff --git a/devel/devel.shaas/src/resolvable.cc b/devel/devel.shaas/src/resolvable.cc
new file mode 100644 (file)
index 0000000..b2089c5
--- /dev/null
@@ -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);
+
+}
+*/
diff --git a/devel/devel.shaas/src/resolvable.h b/devel/devel.shaas/src/resolvable.h
new file mode 100644 (file)
index 0000000..8ea851c
--- /dev/null
@@ -0,0 +1,34 @@
+#include <string>
+#include <vector>
+#include <map>
+#include <zypp/detail/PackageImplIf.h>
+
+#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