diff --git a/apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch b/apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch new file mode 100644 index 0000000..1153e95 --- /dev/null +++ b/apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch @@ -0,0 +1,106 @@ +--- apt-0.5.15lorg2/tools/genpkglist.cc- 2007-08-11 15:10:54 +0400 ++++ apt-0.5.15lorg2/tools/genpkglist.cc 2007-08-11 19:36:03 +0400 +@@ -18,6 +18,8 @@ + #include + #include + ++#include ++ + #include + #include + #include +@@ -77,20 +79,30 @@ typedef struct { + string url; + } UpdateInfo; + ++static std::tr1::unordered_set reqfiles; + +-static inline int usefullFile(char *a) ++static int usefulFile(const char *dir, const char *basename) + { +- int l = strlen(a); +- +- if (strstr(a, "bin") || strstr(a, "/etc") || strncmp(a, "/lib", 4) == 0) +- return 1; +- +- if (l < 3) +- return 0; ++ if (strstr(dir, "bin/")) ++ return 1; ++ if (strstr(dir, "/etc/")) ++ return 1; + +- if (strcmp(a + l - 3, ".so") == 0 +- || strstr(a, ".so.")) +- return 1; ++ const char *pos = strstr(basename, ".so"); ++ if (pos > basename) { ++ int c = pos[3]; ++ if (c == '.' || c == '\0') ++ return 1; ++ } ++ ++ if (reqfiles.size() > 0) { ++ char fullname[strlen(dir) + strlen(basename) + 1]; ++ strcpy(fullname, dir); ++ strcat(fullname, basename); ++ if (reqfiles.find(fullname) != reqfiles.end()) ++ return 2; ++ } ++ + return 0; + } + +@@ -133,9 +145,8 @@ static void copyStrippedFileList(Header + { + int ok = 0; + +- ok = usefullFile(basenames[i]); +- if (!ok) +- ok = usefullFile(dirnames[dirindexes[i]]); ++ ok = usefulFile(dirnames[dirindexes[i]], basenames[i]); ++ // if (ok > 1) cerr << "useful file: " << dirnames[dirindexes[i]] << basenames[i] <d_name, O_RDONLY, 0666); ++ if (!fd) ++ continue; ++ int rc; ++ Header h; ++#if RPM_VERSION >= 0x040100 ++ rc = rpmReadPackageFile(ts, fd, dirEntries[entry_cur]->d_name, &h); ++ if (rc == RPMRC_OK || rc == RPMRC_NOTTRUSTED || rc == RPMRC_NOKEY) { ++#else ++ rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL); ++ if (rc == 0) { ++#endif ++ int reqtype; ++ const char **requires; ++ int nreq; ++ rc = headerGetEntry(h, RPMTAG_REQUIRENAME, &reqtype, (void**)&requires, &nreq); ++ if (rc == 1 && reqtype == RPM_STRING_ARRAY_TYPE) { ++ int i; ++ for (i = 0; i < nreq; i++) { ++ const char *req = requires[i]; ++ if (*req == '/') { ++ // cerr << dirEntries[entry_cur]->d_name << " requires " << req << endl; ++ reqfiles.insert(req); ++ } ++ } ++ } ++ headerFree(h); ++ } ++ Fclose(fd); ++ } ++ } + for (entry_cur = 0; entry_cur < entry_no; entry_cur++) { + struct stat sb; + diff --git a/apt.spec b/apt.spec index 9fa4598..7c960d8 100644 --- a/apt.spec +++ b/apt.spec @@ -62,12 +62,9 @@ Patch48: apt-0.5.15lorg2-alt-apt-get-TryToInstall-PrvPkgCandVer.patch Patch49: apt-0.5.15lorg2-alt-apt-get-simple-output.patch Patch50: apt-0.5.15lorg2-alt-versionmatch-TryToChangeVer.patch Patch51: apt-0.5.15lorg2-alt-exit-status.patch - -# Fix for bug #5400 Patch52: apt-0.5.15lorg2-alt-i18n-apt-shell-typo.patch - -# Fix for bug #7618 Patch53: apt-0.5.15lorg2-alt-src-apt-shell-wrong_message_fix.patch +Patch54: apt-0.5.15lorg2-alt-genpkglist-reqfiles.patch # Normally not applied, but useful. Patch101: apt-0.5.4cnc9-alt-getsrc-debug.patch @@ -278,6 +275,7 @@ This package contains method 'rsync' for APT. %patch51 -p1 %patch52 -p1 %patch53 -p1 +%patch54 -p1 find -type f -name \*.orig -delete