]> git.pld-linux.org Git - packages/apt.git/blob - apt-md5-cache-dir-option.patch
- readline 5.0
[packages/apt.git] / apt-md5-cache-dir-option.patch
1 diff -Nur apt-0.5.4cnc7.orig/tools/cached_md5.cc apt-0.5.4cnc7/tools/cached_md5.cc
2 --- apt-0.5.4cnc7.orig/tools/cached_md5.cc      Sat Jul 27 01:16:34 2002
3 +++ apt-0.5.4cnc7/tools/cached_md5.cc   Tue Dec 10 16:59:14 2002
4 @@ -25,13 +25,15 @@
5  
6  extern const char *__progname;
7  
8 +extern string cache_dir;
9 +
10  CachedMD5::CachedMD5(string DirName)
11  {
12     string fname = DirName;
13     for (string::iterator i = fname.begin(); i != fname.end(); ++i)
14        if ('/' == *i)
15          *i = '_';
16 -   CacheFileName = _config->FindDir("Dir::Cache", "/var/cache/apt") + '/' +
17 +   CacheFileName = cache_dir + '/' +
18                    __progname + '/' + fname + ".md5cache";
19  
20     FILE *f = fopen(CacheFileName.c_str(), "r");
21 diff -Nur apt-0.5.4cnc7.orig/tools/genpkglist.cc apt-0.5.4cnc7/tools/genpkglist.cc
22 --- apt-0.5.4cnc7.orig/tools/genpkglist.cc      Sat Jul 27 01:22:48 2002
23 +++ apt-0.5.4cnc7/tools/genpkglist.cc   Tue Dec 10 17:04:04 2002
24 @@ -340,6 +340,7 @@
25     cerr << "options:" << endl;
26     cerr << " --index <file>  file to write srpm index data to" << endl;
27     cerr << " --info <file>   file to read update info from" << endl;
28 +   cerr << " --cache-dir <dir>   use named directory for md5 cache" << endl;
29     cerr << " --bloat         do not strip the package file list. Needed for some" << endl;
30     cerr << "                 distributions that use non-automatically generated" << endl;
31     cerr << "                 file dependencies" << endl;
32 @@ -431,6 +432,7 @@
33  // end of new stuff from glibc
34  #endif /* !HAVE_SCANDIR */
35  
36 +string cache_dir;
37  
38  int main(int argc, char ** argv) 
39  {
40 @@ -449,7 +451,12 @@
41     int i;
42     bool fullFileList = false;
43     bool progressBar = false;
44 -   
45
46 +   if (getenv("TMPDIR"))
47 +      cache_dir = getenv("TMPDIR");
48 +   else
49 +      cache_dir = "/tmp";
50 +
51     putenv("LC_ALL=");
52     for (i = 1; i < argc; i++) {
53        if (strcmp(argv[i], "--index") == 0) {
54 @@ -460,6 +467,14 @@
55             cout << "genpkglist: filename missing for option --index"<<endl;
56             exit(1);
57          }
58 +      } else if (strcmp(argv[i], "--cache-dir") == 0) {
59 +        i++;
60 +        if (i < argc) {
61 +            cache_dir = argv[i];
62 +        } else {
63 +            cout << "genpkglist: filename missing for option --cache-dir"<<endl;
64 +           exit(1);
65 +        }
66        } else if (strcmp(argv[i], "--info") == 0) {
67          i++;
68          if (i < argc) {
69 diff -Nur apt-0.5.4cnc7.orig/tools/gensrclist.cc apt-0.5.4cnc7/tools/gensrclist.cc
70 --- apt-0.5.4cnc7.orig/tools/gensrclist.cc      Sat Jul 27 01:22:48 2002
71 +++ apt-0.5.4cnc7/tools/gensrclist.cc   Tue Dec 10 17:07:40 2002
72 @@ -116,7 +116,7 @@
73  
74  void usage()
75  {
76 -   cerr << "usage: gensrclist [<options>] <dir> <suffix> <srpm index>" << endl;
77 +   cerr << "usage: gensrclist [--cache-dir <dir>] [<options>] <dir> <suffix> <srpm index>" << endl;
78     cerr << "options:" << endl;
79  //   cerr << " --mapi         ???????????????????" << endl;
80     cerr << " --progress     show a progress bar" << endl;
81 @@ -124,6 +124,8 @@
82     cerr << "                are in the same directory level"<<endl;
83  }
84  
85 +string cache_dir = "/var/cache/apt";
86 +
87  int main(int argc, char ** argv) 
88  {
89     char buf[300];
90 @@ -143,6 +145,13 @@
91     char *arg_dir, *arg_suffix, *arg_srpmindex;
92  
93     putenv("LC_ALL=");
94 +
95 +   if (argv[1] && argv[2] && strcmp(argv[1], "--cache-dir") == 0) {
96 +       cache_dir = argv[2];
97 +       argv += 2;
98 +       argc -= 2;
99 +   }
100 +
101     for (i = 1; i < argc; i++) {
102        if (strcmp(argv[i], "--mapi") == 0) {
103          mapi = true;
This page took 0.078841 seconds and 3 git commands to generate.