]> git.pld-linux.org Git - packages/apt.git/blame - apt-md5-cache-dir-option.patch
- readline 5.0
[packages/apt.git] / apt-md5-cache-dir-option.patch
CommitLineData
f4c11b99
JB
1diff -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 @@
bc440889 5
f4c11b99 6 extern const char *__progname;
bc440889 7
f4c11b99
JB
8+extern string cache_dir;
9+
bc440889
MM
10 CachedMD5::CachedMD5(string DirName)
11 {
f4c11b99
JB
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";
bc440889 19
f4c11b99
JB
20 FILE *f = fopen(CacheFileName.c_str(), "r");
21diff -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 @@
bc440889
MM
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;
f4c11b99
JB
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 */
bc440889 35
f4c11b99
JB
36+string cache_dir;
37
38 int main(int argc, char ** argv)
39 {
40@@ -449,7 +451,12 @@
bc440889
MM
41 int i;
42 bool fullFileList = false;
f4c11b99
JB
43 bool progressBar = false;
44-
45+
bc440889 46+ if (getenv("TMPDIR"))
f4c11b99 47+ cache_dir = getenv("TMPDIR");
bc440889 48+ else
f4c11b99
JB
49+ cache_dir = "/tmp";
50+
bc440889
MM
51 putenv("LC_ALL=");
52 for (i = 1; i < argc; i++) {
53 if (strcmp(argv[i], "--index") == 0) {
f4c11b99 54@@ -460,6 +467,14 @@
bc440889
MM
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) {
f4c11b99 61+ cache_dir = argv[i];
bc440889 62+ } else {
f4c11b99 63+ cout << "genpkglist: filename missing for option --cache-dir"<<endl;
bc440889
MM
64+ exit(1);
65+ }
66 } else if (strcmp(argv[i], "--info") == 0) {
67 i++;
68 if (i < argc) {
f4c11b99
JB
69diff -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 @@
bc440889 73
f4c11b99
JB
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 }
bc440889 84
80519a9f 85+string cache_dir = "/var/cache/apt";
f4c11b99
JB
86+
87 int main(int argc, char ** argv)
bc440889 88 {
f4c11b99
JB
89 char buf[300];
90@@ -143,6 +145,13 @@
91 char *arg_dir, *arg_suffix, *arg_srpmindex;
bc440889 92
bc440889
MM
93 putenv("LC_ALL=");
94+
95+ if (argv[1] && argv[2] && strcmp(argv[1], "--cache-dir") == 0) {
f4c11b99
JB
96+ cache_dir = argv[2];
97+ argv += 2;
98+ argc -= 2;
bc440889 99+ }
f4c11b99
JB
100+
101 for (i = 1; i < argc; i++) {
102 if (strcmp(argv[i], "--mapi") == 0) {
103 mapi = true;
This page took 0.044199 seconds and 4 git commands to generate.