Mailinglist Archive: zypp-commit (325 mails)

< Previous Next >
[zypp-commit] r7136 - in /trunk/libzypp/devel/devel.shaas: PdbToZypp/ PdbToZypp/swig/ old/ src/
  • From: haass@xxxxxxxxxxxxxxxx
  • Date: Fri, 07 Sep 2007 10:14:48 -0000
  • Message-id: <20070907101448.68AA92AFDA@xxxxxxxxxxxxxxxx>
Author: haass
Date: Fri Sep  7 12:14:47 2007
New Revision: 7136

URL: http://svn.opensuse.org/viewcvs/zypp?rev=7136&view=rev
Log:
changed to cmake

Added:
    trunk/libzypp/devel/devel.shaas/PdbToZypp/
    trunk/libzypp/devel/devel.shaas/PdbToZypp/CMakeLists.txt
    trunk/libzypp/devel/devel.shaas/PdbToZypp/db.cc
    trunk/libzypp/devel/devel.shaas/PdbToZypp/db.h
    trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.cc
    trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.h
    trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.cc
    trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.h
    trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/
    trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/CMakeLists.txt
    trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/PdbToZypp.i
Removed:
    trunk/libzypp/devel/devel.shaas/src/
Modified:
    trunk/libzypp/devel/devel.shaas/old/Makefile
    trunk/libzypp/devel/devel.shaas/old/main.cc

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/CMakeLists.txt?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/CMakeLists.txt (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/CMakeLists.txt Fri Sep  7 12:14:47 2007
@@ -0,0 +1,45 @@
+PROJECT(pdbtozypp)
+
+SET( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib" )
+
+SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -O2 -Wall -W -fpic -D_REENTRANT" )
+
+FIND_PROGRAM(SWIG_EXECUTABLE
+  NAMES swig-1.3 swig
+  PATHS ${SWIG_DIR} ${SWIG_DIR}/.. ${SWIG_DIR}/../../bin /usr/bin /usr/local/bin ${CMAKE_INSTALL_PREFIX}/bin
+)
+
+IF ( NOT SWIG_EXECUTABLE )
+   MESSAGE( FATAL_ERROR " swig not found" )
+ELSE ( NOT SWIG_EXECUTABLE )
+   MESSAGE( STATUS "SWIG found at ${SWIG_EXECUTABLE}" )
+ENDIF ( NOT SWIG_EXECUTABLE ) 
+
+FIND_PACKAGE(Zypp REQUIRED)
+IF ( NOT ZYPP_LIBRARY )
+   MESSAGE( FATAL_ERROR " zypp not found" )
+ELSE ( NOT ZYPP_LIBRARY )
+   MESSAGE( STATUS "zypp found" )
+ENDIF ( NOT ZYPP_LIBRARY ) 
+
+SET( pdbtozypp_SRCS
+      db.cc
+      pdbtozypp.cc
+      resolvable.cc
+   )
+
+SET( pdbtozypp_HEADERS
+      db.h
+      pdbtozypp.h
+      resolvable.h
+   )
+
+INSTALL( FILES ${pdbtozypp_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/pdbtozypp" )
+
+ADD_LIBRARY(pdbtozypp SHARED ${pdbtozypp_SRCS})
+TARGET_LINK_LIBRARIES(pdbtozypp ${ZYPP_LIBRARY} )
+TARGET_LINK_LIBRARIES(pdbtozypp -lmysqlclient )
+
+INSTALL(TARGETS pdbtozypp LIBRARY DESTINATION ${LIB_INSTALL_DIR} )
+
+ADD_SUBDIRECTORY(swig)

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/db.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/db.cc?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/db.cc (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/db.cc Fri Sep  7 12:14:47 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/PdbToZypp/db.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/db.h?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/db.h (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/db.h Fri Sep  7 12:14:47 2007
@@ -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

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.cc?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.cc (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.cc Fri Sep  7 12:14:47 2007
@@ -0,0 +1,205 @@
+#include "pdbtozypp.h"
+#include <iostream>
+
+using namespace zypp;
+
+//Constructor
+PdbToZypp::PdbToZypp(){
+   //store = _store;
+}
+
+PdbToZypp::~PdbToZypp(){
+
+}
+
+void PdbToZypp::readOut(){
+
+   //store = new ResStore;
+
+       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");
+       dbPackages->sqlexecute("SELECT PackID, PackNameShort, PackStatus FROM Packages WHERE CDReleaseID IN (10, 64) AND PackStatus IN (0, 6, 7, 8) OR PackStatus IS NULL 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));
+
+            sqlcom = "SELECT name, DirID FROM PackFilelist WHERE DirID IN(1, 22, 24, 96, 178, 756, 1981) AND BinPackID=";
+            sqlcom.append(binPack[k].at(0));
+            dbDeps->sqlexecute(sqlcom);
+            tempVec = dbDeps->getResult();
+
+            for(unsigned int m = 0; m < tempVec.size(); m++){
+               sqlcom = "SELECT dir FROM PackFileDirs WHERE DirID=";
+               sqlcom.append(tempVec[m].at(1));
+               dbDeps->sqlexecute(sqlcom);
+               std::vector< std::vector<string> > tempVec2 = dbDeps->getResult();
+               for(unsigned int n = 0; n < tempVec2.size(); n++){
+                  string fileprov = tempVec2[n].at(0) + "/" + tempVec[m].at(0);
+                  prov.insert(factory.parse(kind, fileprov, Rel::ANY, Edition("")));
+               }
+
+            }
+                       }
+
+                       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/PdbToZypp/pdbtozypp.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.h?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.h (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/pdbtozypp.h Fri Sep  7 12:14:47 2007
@@ -0,0 +1,22 @@
+#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{
+       public:
+      //typedef zypp::ResStore ResStore;
+               //PdbToZypp(zypp::ResStore  & _store);
+               PdbToZypp();
+      ~PdbToZypp();
+      void readOut();
+      zypp::ResStore getStore();
+   private:
+      zypp::ResStore store;
+};

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.cc?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.cc (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.cc Fri Sep  7 12:14:47 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/PdbToZypp/resolvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.h?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.h (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/resolvable.h Fri Sep  7 12:14:47 2007
@@ -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

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/CMakeLists.txt
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/CMakeLists.txt?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/CMakeLists.txt (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/CMakeLists.txt Fri Sep  7 12:14:47 2007
@@ -0,0 +1,43 @@
+FIND_PACKAGE(Perl REQUIRED)
+
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{cppflags}" OUTPUT_VARIABLE PERL_CXX_FLAGS)
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PERL_CXX_FLAGS}")
+
+EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -e "use Config; print \$Config{archlibexp}" OUTPUT_VARIABLE PERL_LIB_PATH)
+SET( PERL_INS_PATH "${PERL_LIB_PATH}" )
+SET( PERL_LIB_PATH "${PERL_LIB_PATH}/CORE" )
+
+MESSAGE(STATUS "Perl executable: ${PERL_EXECUTABLE}")
+MESSAGE(STATUS "Perl cpp-flags: ${PERL_CXX_FLAGS}")
+MESSAGE(STATUS "Perl lib path: ${PERL_LIB_PATH}")
+
+SET( SWIG_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/PdbToZypp_wrap.cxx" )
+SET( SWIG_INPUT "${CMAKE_CURRENT_SOURCE_DIR}/PdbToZypp.i" )
+
+ADD_CUSTOM_COMMAND (
+   OUTPUT  ${CMAKE_CURRENT_BINARY_DIR}/PdbToZypp_wrap.cxx
+   COMMAND ${CMAKE_COMMAND} -E echo_append "Creating wrapper code for perl..."
+   COMMAND ${SWIG_EXECUTABLE} -c++ -perl5 -xmlout ${CMAKE_CURRENT_BINARY_DIR}/parse.xml -o ${CMAKE_CURRENT_BINARY_DIR}/PdbToZypp_wrap.cxx -I${ZYPP_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/PdbToZypp.i
+   COMMAND ${CMAKE_COMMAND} -E echo "Done."
+   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/*.i ${CMAKE_CURRENT_SOURCE_DIR}/*.i
+)
+
+ADD_CUSTOM_TARGET( glue
+   DEPENDS ${SWIG_OUTPUT}
+)
+
+ADD_LIBRARY( rpdbtozypp SHARED "${CMAKE_CURRENT_BINARY_DIR}/PdbToZypp_wrap.cxx" )
+SET_TARGET_PROPERTIES( rpdbtozypp PROPERTIES PREFIX "" )
+ADD_DEPENDENCIES( rpdbtozypp glue )
+
+INCLUDE_DIRECTORIES( ${PERL_LIB_PATH} )
+INCLUDE_DIRECTORIES( ${ZYPP_INCLUDE_DIR} )
+INCLUDE_DIRECTORIES( /usr/include/pdbtozypp )
+TARGET_LINK_LIBRARIES( rpdbtozypp ${ZYPP_LIBRARY} )
+TARGET_LINK_LIBRARIES( rpdbtozypp -lpdbtozypp )
+
+INSTALL(TARGETS rpdbtozypp LIBRARY DESTINATION ${PERL_INS_PATH})
+INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/rpdbtozypp.pm DESTINATION ${PERL_INS_PATH})
+

Added: trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/PdbToZypp.i
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/PdbToZypp.i?rev=7136&view=auto
==============================================================================
--- trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/PdbToZypp.i (added)
+++ trunk/libzypp/devel/devel.shaas/PdbToZypp/swig/PdbToZypp.i Fri Sep  7 12:14:47 2007
@@ -0,0 +1,18 @@
+%module rpdbtozypp
+%{
+#undef NORMAL
+#include "pdbtozypp.h"
+using namespace zypp;
+%}
+
+class PdbToZypp{
+       public:
+      //typedef zypp::ResStore ResStore;
+               //PdbToZypp(zypp::ResStore  & _store);
+               PdbToZypp();
+      ~PdbToZypp();
+      void readOut();
+      ResStore getStore();
+   private:
+      ResStore store;
+};

Modified: trunk/libzypp/devel/devel.shaas/old/Makefile
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/Makefile?rev=7136&r1=7135&r2=7136&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/Makefile (original)
+++ trunk/libzypp/devel/devel.shaas/old/Makefile Fri Sep  7 12:14:47 2007
@@ -8,7 +8,7 @@
 INCPATH       = -I/usr/include -I. -I. -I.
 LINK          = g++
 LFLAGS        = -lpdbtozypp
-LIBS          = $(SUBLIBS)  -L/usr/local/lib
+LIBS          = $(SUBLIBS)  -L/usr/lib
 
 ####### Output directory
 

Modified: trunk/libzypp/devel/devel.shaas/old/main.cc
URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/devel/devel.shaas/old/main.cc?rev=7136&r1=7135&r2=7136&view=diff
==============================================================================
--- trunk/libzypp/devel/devel.shaas/old/main.cc (original)
+++ trunk/libzypp/devel/devel.shaas/old/main.cc Fri Sep  7 12:14:47 2007
@@ -1,13 +1,45 @@
 #include <pdbtozypp/pdbtozypp.h>
+#include <zypp/ResPool.h>
+#include <zypp/RepoManager.h>
+#include <zypp/TmpPath.h>
+#include <zypp/base/Iterator.h>
 
 using namespace zypp;
 using namespace std;
 int main(){
        
        static ZYpp::Ptr God;
-       ResStore store = pdbToZypp();
 
-       try {
+       PdbToZypp pdb;
+   pdb.readOut();
+
+   ResStore store = pdb.getStore();
+
+   /*RepoInfo repo_info;
+   repo_info.setAlias("test");
+   repo_info.setName("Test Repo");
+   repo_info.setEnabled(true);
+   repo_info.setAutorefresh(false);
+   repo_info.addBaseUrl(Url("ftp://dist.suse.de/install/stable-x86/";));
+       
+   RepoManagerOptions opts;
+   filesystem::TmpDir cachePath;
+   filesystem::TmpDir rawPath;
+   filesystem::TmpDir reposPath;
+
+   opts.repoCachePath = cachePath.path();
+   opts.repoRawCachePath = rawPath.path();
+   opts.knownReposPath = reposPath.path();
+
+   RepoManager repo_man(opts);
+
+   repo_man.addRepository(repo_info);
+   repo_man.refreshMetadata(repo_info);
+   repo_man.buildCache(repo_info);
+   Repository repo = repo_man.createFromCache(repo_info);
+   ResStore store = repo.resolvables();*/
+
+   try {
                God = zypp::getZYpp();
        }
        catch (const Exception & excpt_r ) {
@@ -18,5 +50,30 @@
 
        God->addResolvables(store);
        cout << "Elements in pool: " << God->pool().size() << endl;
+
+   for(pool::PoolTraits::const_iterator iter = God->pool().begin(); iter != God->pool().end(); iter++){
+
+      ResObject::constPtr r = iter->resolvable();
+      if(r->name() == "glibc"){
+         cout << "Package found!" << endl;
+         iter->status().setToBeInstalled(ResStatus::USER);
+      }
+   
+   }
+
+   Resolver res(God->pool());
+
+   if(res.resolvePool() == false){
+      cout << "It was not possible to solve the pool" << endl;
+      list<string> problems = res.problemDescription();
+
+      for(list<string>::iterator iter = problems.begin(); iter != problems.end(); iter++){
+         cout << *iter << endl;
+      }
+
+   }else{
+      cout << "The pool was solved corectly" << endl;
+   }
+
        return 0;
 }

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages