]> git.pld-linux.org Git - packages/apt.git/blob - apt-md5-cache-dir-option.patch
- merged DEVEL
[packages/apt.git] / apt-md5-cache-dir-option.patch
1 diff -ur apt-0.3.19cnc52/tools/genpkglist.cc apt-0.3.19cnc52-/tools/genpkglist.cc
2 --- apt-0.3.19cnc52/tools/genpkglist.cc Thu Jul 12 23:47:33 2001
3 +++ apt-0.3.19cnc52-/tools/genpkglist.cc        Wed Apr 24 15:50:01 2002
4 @@ -139,6 +139,7 @@
5     ~CachedMD5();
6  };
7  
8 +string cache_dir;
9  
10  CachedMD5::CachedMD5(string DirName)
11  {
12 @@ -153,7 +154,7 @@
13          if (buf[i]=='/')
14            buf[i]='_';
15  
16 -    string cachedir = _config->FindDir("Dir::Cache") + "/genpkglist";
17 +    string cachedir = cache_dir + "/genpkglist";
18      filename = strdup(string(cachedir+string(buf)).c_str());
19  
20      f = fopen(filename, "r");
21 @@ -501,6 +502,7 @@
22     cerr << "options:" << endl;
23     cerr << " --index <file>  file to write srpm index data to" << endl;
24     cerr << " --info <file>   file to read update info from" << endl;
25 +   cerr << " --cache-dir <dir>   use named directory for md5 cache" << endl;
26     cerr << " --bloat         do not strip the package file list. Needed for some\ndistributions that use non-automatically generated file dependencies" << endl;
27  }
28  
29 @@ -607,6 +609,11 @@
30     int i;
31     bool fullFileList = false;
32     
33 +   if (getenv("TMPDIR"))
34 +       cache_dir = getenv("TMPDIR");
35 +   else
36 +       cache_dir = "/tmp";
37 +       
38     putenv("LC_ALL=");
39     for (i = 1; i < argc; i++) {
40        if (strcmp(argv[i], "--index") == 0) {
41 @@ -617,6 +624,14 @@
42             cout << "genpkglist: filename missing for option --index"<<endl;
43             exit(1);
44          }
45 +      } else if (strcmp(argv[i], "--cache-dir") == 0) {
46 +        i++;
47 +        if (i < argc) {
48 +           cache_dir = argv[i];
49 +        } else {
50 +           cout << "genpkglist: filename missing for option --cache-dir"<<endl;
51 +           exit(1);
52 +        }
53        } else if (strcmp(argv[i], "--info") == 0) {
54          i++;
55          if (i < argc) {
56 diff -ur apt-0.3.19cnc52/tools/gensrclist.cc apt-0.3.19cnc52-/tools/gensrclist.cc
57 --- apt-0.3.19cnc52/tools/gensrclist.cc Thu Jul 12 23:47:33 2001
58 +++ apt-0.3.19cnc52-/tools/gensrclist.cc        Wed Apr 24 15:52:57 2002
59 @@ -90,6 +90,7 @@
60     ~CachedMD5();
61  };
62  
63 +string cache_dir = "/var/cache/apt/gensrclist/";
64  
65  CachedMD5::CachedMD5(string DirName)
66  {
67 @@ -103,7 +104,7 @@
68      for (i = 0; buf[i]; i++)
69          if (buf[i]=='/')
70            buf[i]='_';
71 -    filename = strdup(string("/var/cache/apt/gensrclist/"+string(buf)).c_str());
72 +    filename = strdup(string(cache_dir + "/" + string(buf)).c_str());
73  
74      f = fopen(filename, "r");
75      if (!f) {
76 @@ -243,8 +244,15 @@
77     bool mapi;
78     
79     putenv("LC_ALL=");
80 +
81 +   if (argv[1] && argv[2] && strcmp(argv[1], "--cache-dir") == 0) {
82 +       cache_dir = argv[2];
83 +       argv += 2;
84 +       argc -= 2;
85 +   }
86 +   
87     if (argc < 4 || argc > 5) {
88 -      cerr << "usage: gensrclist <dir> <suffix> <srpm index>" << endl;
89 +      cerr << "usage: gensrclist [--cache-dir <dir>] <dir> <suffix> <srpm index>" << endl;
90        exit(1);
91     }
92     
This page took 0.064054 seconds and 3 git commands to generate.