]> git.pld-linux.org Git - packages/rpm.git/blame - rpm-check_files.patch
- handle include(dirname(__FILE__) . "foo/bar.php")
[packages/rpm.git] / rpm-check_files.patch
CommitLineData
5b0f0ac9
MM
1diff -urN rpm-4.0.4.org/build/files.c rpm-4.0.4/build/files.c
2--- rpm-4.0.4.org/build/files.c Sun Jul 28 00:22:46 2002
3+++ rpm-4.0.4/build/files.c Sun Jul 28 00:23:54 2002
4@@ -90,6 +90,10 @@
5 /*@unchecked@*/
6 static int multiLib = 0; /* MULTILIB */
e89f8c57 7
5b0f0ac9
MM
8+/* list of files */
9+static StringBuf check_fileList = NULL;
10+static int check_fileListLen = 0;
11+
12 /**
13 * Package file tree walk data.
14 */
15@@ -1593,6 +1597,13 @@
16 (unsigned)fileMode, fileUname, fileGname, fileURL);
17 #endif
e89f8c57 18
5b0f0ac9
MM
19+ /* S_XXX macro must be consistent with type in find call at check-files script */
20+ if (S_ISREG(fileMode)) {
21+ appendStringBuf(check_fileList, diskURL);
22+ appendStringBuf(check_fileList, "\n");
23+ check_fileListLen += strlen(diskURL) + 1;
24+ }
25+
26 /* Add to the file list */
27 if (fl->fileListRecsUsed == fl->fileListRecsAlloced) {
28 fl->fileListRecsAlloced += 128;
29@@ -2655,11 +2671,54 @@
30 versions = hfd(versions, dvt);
e89f8c57 31 }
32
5b0f0ac9 33+static int checkFiles(StringBuf fileList, int fileListLen)
e89f8c57 34+{
35+ StringBuf readBuf = NULL;
08e31d78 36+ char* myargv[3] = {NULL, NULL, NULL};
e89f8c57 37+ int rc = 0;
38+ char *buf;
39+
40+ myargv[0] = rpmExpand("%{__check_files}", NULL);
41+ if (!(myargv[0] && *myargv[0] != '%')) {
42+ rc = -1;
43+ goto exit;
44+ }
45+ myargv[1] = rpmExpand("%{buildroot}", NULL);
46+ if (!(myargv[1] && *myargv[1] != '%')) {
47+ rc = -1;
48+ goto exit;
49+ }
e89f8c57 50+
51+ rpmMessage(RPMMESS_NORMAL, _("Searching for omited files: (using %s)...\n"),
52+ myargv[0]);
53+
08e31d78 54+ readBuf = getOutputFrom(NULL, myargv, getStringBuf(fileList), fileListLen, 0);
e89f8c57 55+
56+ if (readBuf) {
57+ buf = getStringBuf(readBuf);
8d28f612 58+ if ((*buf != '\0') && (*buf != '\n'))
e89f8c57 59+ rpmMessage(RPMMESS_WARNING, \
60+ _("found installed files not placed in any package:\n---\n%s---\n"),
08e31d78 61+ buf);
e89f8c57 62+ }
63+
64+exit:
65+
66+ freeStringBuf(readBuf);
5b0f0ac9
MM
67+ _free(myargv[0]);
68+ _free(myargv[1]);
e89f8c57 69+
70+ return rc;
71+}
72+
73 int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
74 {
75 Package pkg;
76 int res = 0;
e89f8c57 77
5b0f0ac9
MM
78+ check_fileList = newStringBuf();
79+ check_fileListLen = 0;
80+
e89f8c57 81 for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
82 const char *n, *v, *r;
5b0f0ac9
MM
83 int rc;
84@@ -2687,5 +2746,15 @@
85 /*@=noeffect@*/
e89f8c57 86 }
87
08e31d78 88+ /* Now we have in fileList list of files from all packages.
e89f8c57 89+ * We pass it to a script which do the work of finding missing
90+ * and duplicated files.
91+ */
92+
3dea2558 93+ if (res == 0)
5b0f0ac9 94+ checkFiles(check_fileList, check_fileListLen);
e89f8c57 95+
5b0f0ac9 96+ freeStringBuf(check_fileList);
e89f8c57 97+
98 return res;
99 }
5b0f0ac9
MM
100diff -Nur rpm-4.0.4.orig/platform.in rpm-4.0.4/platform.in
101--- rpm-4.0.4.orig/platform.in Sun Jun 30 00:07:54 2002
102+++ rpm-4.0.4/platform.in Sun Jun 30 00:13:45 2002
103@@ -89,6 +89,10 @@
104 # Expanded at end of %install scriptlet.
e89f8c57 105 #
106
107+# Gets file list on input and buildroot as first parameter
108+# and returns list of files not found in any package
109+%__check_files @prefix@/lib/rpm/check-files
110+
111 %__arch_install_post @ARCH_INSTALL_POST@
112
113 %__os_install_post \
This page took 0.044113 seconds and 4 git commands to generate.