added swig-file + several changes
authorStefan Haas <shaas@suse.de>
Thu, 6 Sep 2007 15:00:17 +0000 (15:00 +0000)
committerStefan Haas <shaas@suse.de>
Thu, 6 Sep 2007 15:00:17 +0000 (15:00 +0000)
devel/devel.shaas/src/Makefile.PL [new file with mode: 0644]
devel/devel.shaas/src/Makefile.no [moved from devel/devel.shaas/src/Makefile with 89% similarity]
devel/devel.shaas/src/PdbToZypp.i [new file with mode: 0644]
devel/devel.shaas/src/install.pl [new file with mode: 0644]
devel/devel.shaas/src/pdbtozypp.cc
devel/devel.shaas/src/pdbtozypp.h

diff --git a/devel/devel.shaas/src/Makefile.PL b/devel/devel.shaas/src/Makefile.PL
new file mode 100644 (file)
index 0000000..6e7a7a2
--- /dev/null
@@ -0,0 +1,7 @@
+# File : Makefile.PL
+use ExtUtils::MakeMaker;
+WriteMakefile(
+   'NAME'    => 'rpdbtozypp',                # Name of package
+   'LIBS'    => '-lm -lzypp -lpdbtozypp',                    # Name of custom libraries
+   'OBJECT'  => 'PdbToZypp_wrap.o /usr/lib/perl5/5.8.8/i586-linux-thread-multi/zypp.so'  # Object files
+);
similarity index 89%
rename from devel/devel.shaas/src/Makefile
rename to devel/devel.shaas/src/Makefile.no
index 77ad2a6..7d9ac3c 100644 (file)
@@ -8,7 +8,7 @@ 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
+LIBS          = $(SUBLIBS)  -L/usr/lib
 
 ####### Output directory
 
@@ -18,7 +18,7 @@ OBJECTS_DIR   = ./
 
 SOURCES       = db.cc resolvable.h pdbtozypp.cc 
 OBJECTS       = db.o pdbtozypp.o
-OBJCOMP                  = /usr/local/lib/libzypp.so 
+OBJCOMP                  = /usr/lib/libzypp.so 
 DESTDIR       = 
 TARGET        = libpdbtozypp.so
 
@@ -44,11 +44,14 @@ first: all
 
 ####### Build rules
 
-all: Makefile $(TARGET)
+all: Makefile.no $(TARGET)
 
 $(TARGET):  $(OBJECTS)  
        $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
 
+swig:
+       swig -c++ -perl5 PdbToZypp.i
+
 install: 
        install --mode=644 db.h /usr/include/pdbtozypp/
        install --mode=644 resolvable.h /usr/include/pdbtozypp/
diff --git a/devel/devel.shaas/src/PdbToZypp.i b/devel/devel.shaas/src/PdbToZypp.i
new file mode 100644 (file)
index 0000000..62505ba
--- /dev/null
@@ -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;
+};
diff --git a/devel/devel.shaas/src/install.pl b/devel/devel.shaas/src/install.pl
new file mode 100644 (file)
index 0000000..4d454ad
--- /dev/null
@@ -0,0 +1,12 @@
+print "Build libpdbtozypp.so\n";
+`make -f Makefile.no`;
+print "Install libpdbtozypp.so\n";
+`make -f Makefile.no install`;
+print "Build swig-binding\n";
+`make -f Makefile.no swig`;
+print "Build Makefile for perl-module with MakeMaker\n";
+`perl Makefile.PL`;
+print "Build perl-module\n";
+`make`;
+print "Install perl-module\n";
+`make install`;
index 300cb6f..9e83f3c 100644 (file)
@@ -5,11 +5,19 @@ using namespace zypp;
 
 //Constructor
 PdbToZypp::PdbToZypp(){
+   //store = _store;
+}
+
+PdbToZypp::~PdbToZypp(){
+
+}
+
+void PdbToZypp::readOut(){
 
-   store = new ResStore;
+   //store = new ResStore;
 
-       database *dbDeps = new database("lorien.suse.de", "rpmread", "***", "rpm");
-       database *dbPackages = new database("lorien.suse.de", "rpmread", "***", "package");
+       database *dbDeps = new database("lorien.suse.de", "rpmread", "rrrrrrr", "rpm");
+       database *dbPackages = new database("lorien.suse.de", "rpmread", "rrrrrrr", "package");
 
        if(dbPackages->connect() != 1){
                //std::cout << "NO DB CONNECTION!!!\n";
@@ -21,7 +29,8 @@ PdbToZypp::PdbToZypp(){
                //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 = 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();
 
@@ -74,7 +83,22 @@ PdbToZypp::PdbToZypp(){
                                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++){
@@ -168,7 +192,7 @@ PdbToZypp::PdbToZypp(){
                        }
                }*/
 
-               store->insert(p);
+               store.insert(p);
        }
 
        dbDeps->close();
@@ -176,6 +200,6 @@ PdbToZypp::PdbToZypp(){
 
 }
 
-ResStore& PdbToZypp::getStore(){
-       return *store;
+ResStore PdbToZypp::getStore(){
+       return store;
 }
index 566cd38..f3923d0 100644 (file)
 
 class PdbToZypp{
        public:
-      typedef zypp::ResStore ResStore;
+      //typedef zypp::ResStore ResStore;
+               //PdbToZypp(zypp::ResStore  & _store);
                PdbToZypp();
-               ResStore& getStore();
+      ~PdbToZypp();
+      void readOut();
+      zypp::ResStore getStore();
    private:
-      ResStore *store;
+      zypp::ResStore store;
 };