[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

apt



apt now builds - diff attached. The package still won't build due to lack
of doc generation (missing debian-sgml), and for some reason that I
haven't been able to work out the shared libraries for libapt-pkg aren't
generated which also trips up the production of the packages. It's rather
early in the morning, so I've just done enough to get the things to build
- since apt-ftparchive kindly dumps core, I've obviously done something
badly wrong there somewhere, and apt-get still doesn't believe that it's
on a Debian system so just prints "E: Unable to determine a suitable
system type". I'll have a look at these problems once I've had some sleep.

-- 
Matthew Garrett | mjg59@srcf.ucam.org
diff -u -r ftparchive/apt-ftparchive.cc ../apt-0.5.4.work/ftparchive/apt-ftparchive.cc
--- ftparchive/apt-ftparchive.cc	Tue Jun 26 02:50:27 2001
+++ ../apt-0.5.4.work/ftparchive/apt-ftparchive.cc	Sun Feb  3 01:16:14 2002
@@ -29,8 +29,9 @@
 
 #include "contents.h"
 #include "multicompress.h"
-#include "writer.h"    
-									/*}}}*/
+#define _POSIX_C_SOURCE
+#include "writer.h"
+#undef _POSIX_C_SOURCE
 
 using namespace std;    
 ostream c0out(0);
diff -u -r ftparchive/cachedb.h ../apt-0.5.4.work/ftparchive/cachedb.h
--- ftparchive/cachedb.h	Tue Feb 20 07:03:18 2001
+++ ../apt-0.5.4.work/ftparchive/cachedb.h	Sun Feb  3 01:45:03 2002
@@ -11,13 +11,18 @@
 									/*}}}*/
 #ifndef CACHEDB_H
 #define CACHEDB_H
-
+/*
+#ifdef __NetBSD__
+#define _POSIX_C_SOURCE
+#endif
+*/
 #ifdef __GNUG__
 #pragma interface "cachedb.h"
 #endif 
 
 #include <db2/db.h>
 #include <string>
+#define _POSIX_C_SOURCE
 #include <apt-pkg/debfile.h>
 #include <inttypes.h>
 #include <sys/stat.h>
@@ -115,5 +120,6 @@
    CacheDB(string DB) : Dbp(0), DebFile(0) {ReadyDB(DB);};
    ~CacheDB() {ReadyDB(string()); delete DebFile;};
 };
-    
+
+#undef _POSIX_C_SOURCE    
 #endif
diff -u -r ftparchive/writer.cc ../apt-0.5.4.work/ftparchive/writer.cc
--- ftparchive/writer.cc	Tue Jun 26 02:50:27 2001
+++ ../apt-0.5.4.work/ftparchive/writer.cc	Sun Feb  3 02:56:37 2002
@@ -25,7 +25,7 @@
 
 #include <sys/types.h>
 #include <unistd.h>
-#include <ftw.h>
+#include <fts.h>
 #include <iostream>
     
 #include "cachedb.h"
@@ -69,19 +69,19 @@
 // ---------------------------------------------------------------------
 /* This is the FTW scanner, it processes each directory element in the 
    directory tree. */
-int FTWScanner::Scanner(const char *File,const struct stat *sb,int Flag)
+int FTWScanner::Scanner(const char *File,int Flag)
 {
-   if (Flag == FTW_DNR)
+   if (Flag == FTS_DNR)
    {
       Owner->NewLine(1);
       c1out << "W: Unable to read directory " << File << endl;
    }   
-   if (Flag == FTW_NS)
+   if (Flag == FTS_NS)
    {
       Owner->NewLine(1);
       c1out << "W: Unable to stat " << File << endl;
    }   
-   if (Flag != FTW_F)
+   if (Flag != FTS_F)
       return 0;
 
    // See if it is a .deb
@@ -139,7 +139,11 @@
 /* */
 bool FTWScanner::RecursiveScan(string Dir)
 {
-   /* If noprefix is set then jam the scan root in, so we don't generate
+   FTS *fts;
+   FTSENT *p;
+   char dirname[255];
+   char *dirlist[1];
+      /* If noprefix is set then jam the scan root in, so we don't generate
       link followed paths out of control */
    if (InternalPrefix.empty() == true)
    {
@@ -150,16 +154,16 @@
    
    // Do recursive directory searching
    Owner = this;
-   int Res = ftw(Dir.c_str(),Scanner,30);
-   
-   // Error treewalking?
-   if (Res != 0)
-   {
-      if (_error->PendingError() == false)
-	 _error->Errno("ftw","Tree walking failed");
-      return false;
+   strncpy(dirname,Dir.c_str(),255);
+   dirlist[0]=dirname;
+   if (!(fts = fts_open(dirlist,FTS_LOGICAL,0))) {
+	c1out << "Unable to open\n";
+	return false;
+   }  
+   while ((p = fts_read(fts)) != NULL) {
+          Scanner(p->fts_path, p->fts_info);
    }
-   
+   fts_close(fts); 
    return true;
 }
 									/*}}}*/
@@ -206,11 +210,11 @@
       }
       
       struct stat St;
-      int Flag = FTW_F;
+      int Flag = FTS_F;
       if (stat(FileName,&St) != 0)
-	 Flag = FTW_NS;
+	 Flag = FTS_NS;
 
-      if (Scanner(FileName,&St,Flag) != 0)
+      if (Scanner(FileName,Flag) != 0)
 	 break;
    }
   
diff -u -r ftparchive/writer.h ../apt-0.5.4.work/ftparchive/writer.h
--- ftparchive/writer.h	Tue Jun 26 02:50:27 2001
+++ ../apt-0.5.4.work/ftparchive/writer.h	Sun Feb  3 02:34:30 2002
@@ -44,7 +44,7 @@
    bool NoLinkAct;
    
    static FTWScanner *Owner;
-   static int Scanner(const char *File,const struct stat *sb,int Flag);
+   static int Scanner(const char *File,int Flag);
 
    bool Delink(string &FileName,const char *OriginalPath,
 	       unsigned long &Bytes,struct stat &St);

Reply to: