]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-extracttemplates.cc
add test for Suite with path
[apt.git] / cmdline / apt-extracttemplates.cc
index de22386b9fbefc696678c084d2a779846feae874..8e1937113ff92ac50c4a6a6d3d8784ef96026b94 100644 (file)
@@ -13,6 +13,8 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
+#include<config.h>
+
 #include <apt-pkg/init.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/init.h>
 #include <apt-pkg/cmndline.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/error.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/fileutl.h>
-       
+#include <apt-pkg/pkgsystem.h>
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <unistd.h>
+#include <locale.h>
+
 #include <fstream>
 
 #include <fstream>
 
-#include <locale.h>
-#include <config.h>
-#include <apti18n.h>
 #include "apt-extracttemplates.h"
 #include "apt-extracttemplates.h"
+
+#include <apti18n.h>
                                                                        /*}}}*/
 
 using namespace std;
 
                                                                        /*}}}*/
 
 using namespace std;
 
-#define TMPDIR         "/tmp"
-
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object                     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 DebFile::DebFile(const char *debfile)
 pkgCache *DebFile::Cache = 0;
 
 // DebFile::DebFile - Construct the DebFile object                     /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 DebFile::DebFile(const char *debfile)
-       : File(debfile, FileFd::ReadOnly), Control(0), DepOp(0), 
-          PreDepOp(0), Config(0), Template(0), Which(None)
+       : File(debfile, FileFd::ReadOnly), Size(0), Control(NULL), ControlLen(0),
+         DepOp(0), PreDepOp(0), Config(0), Template(0), Which(None)
 {
 }
                                                                        /*}}}*/
 {
 }
                                                                        /*}}}*/
@@ -222,7 +224,7 @@ bool DebFile::ParseInfo()
 /* */
 int ShowHelp(void)
 {
 /* */
 int ShowHelp(void)
 {
-       ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,VERSION,
+       ioprintf(cout,_("%s %s for %s compiled on %s %s\n"),PACKAGE,PACKAGE_VERSION,
            COMMON_ARCH,__DATE__,__TIME__);
 
        if (_config->FindB("version") == true) 
            COMMON_ARCH,__DATE__,__TIME__);
 
        if (_config->FindB("version") == true) 
@@ -249,14 +251,11 @@ string WriteFile(const char *package, const char *prefix, const char *data)
 {
        char fn[512];
        static int i;
 {
        char fn[512];
        static int i;
-       const char *tempdir = NULL;
-
-        tempdir = getenv("TMPDIR");
-        if (tempdir == NULL)
-             tempdir = TMPDIR;
 
 
+        std::string tempdir = GetTempDir();
        snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
        snprintf(fn, sizeof(fn), "%s/%s.%s.%u%d",
-                 _config->Find("APT::ExtractTemplates::TempDir", tempdir).c_str(),
+                 _config->Find("APT::ExtractTemplates::TempDir", 
+                               tempdir.c_str()).c_str(),
                  package, prefix, getpid(), i++);
        FileFd f;
        if (data == NULL)
                  package, prefix, getpid(), i++);
        FileFd f;
        if (data == NULL)
@@ -296,8 +295,7 @@ bool Go(CommandLine &CmdL)
        MMap *Map = 0;
        pkgSourceList List;
        List.ReadMainList();
        MMap *Map = 0;
        pkgSourceList List;
        List.ReadMainList();
-       OpProgress Prog;
-       pkgMakeStatusCache(List,Prog,&Map,true);
+       pkgCacheGenerator::MakeStatusCache(List,NULL,&Map,true);
        if (Map == 0)
           return false;
        DebFile::Cache = new pkgCache(Map);
        if (Map == 0)
           return false;
        DebFile::Cache = new pkgCache(Map);
@@ -348,8 +346,7 @@ bool Go(CommandLine &CmdL)
        return !_error->PendingError();
 }
                                                                        /*}}}*/
        return !_error->PendingError();
 }
                                                                        /*}}}*/
-
-int main(int argc, const char **argv)
+int main(int argc, const char **argv)                                  /*{{{*/
 {
        CommandLine::Args Args[] = {
                {'h',"help","help",0},
 {
        CommandLine::Args Args[] = {
                {'h',"help","help",0},
@@ -391,3 +388,4 @@ int main(int argc, const char **argv)
        
        return 0;
 }
        
        return 0;
 }
+                                                                       /*}}}*/