diff -urN rpm-4.0.4.org/build/files.c rpm-4.0.4/build/files.c --- rpm-4.0.4.org/build/files.c Sun Jul 28 00:22:46 2002 +++ rpm-4.0.4/build/files.c Sun Jul 28 00:23:54 2002 @@ -90,6 +90,10 @@ /*@unchecked@*/ static int multiLib = 0; /* MULTILIB */ +/* list of files */ +static StringBuf check_fileList = NULL; +static int check_fileListLen = 0; + /** * Package file tree walk data. */ @@ -1593,6 +1597,13 @@ (unsigned)fileMode, fileUname, fileGname, fileURL); #endif + /* S_XXX macro must be consistent with type in find call at check-files script */ + if (S_ISREG(fileMode)) { + appendStringBuf(check_fileList, diskURL); + appendStringBuf(check_fileList, "\n"); + check_fileListLen += strlen(diskURL) + 1; + } + /* Add to the file list */ if (fl->fileListRecsUsed == fl->fileListRecsAlloced) { fl->fileListRecsAlloced += 128; @@ -2655,11 +2671,54 @@ versions = hfd(versions, dvt); } +static int checkFiles(StringBuf fileList, int fileListLen) +{ + StringBuf readBuf = NULL; + char* myargv[3] = {NULL, NULL, NULL}; + int rc = 0; + char *buf; + + myargv[0] = rpmExpand("%{__check_files}", NULL); + if (!(myargv[0] && *myargv[0] != '%')) { + rc = -1; + goto exit; + } + myargv[1] = rpmExpand("%{buildroot}", NULL); + if (!(myargv[1] && *myargv[1] != '%')) { + rc = -1; + goto exit; + } + + rpmMessage(RPMMESS_NORMAL, _("Searching for omited files: (using %s)...\n"), + myargv[0]); + + readBuf = getOutputFrom(NULL, myargv, getStringBuf(fileList), fileListLen, 0); + + if (readBuf) { + buf = getStringBuf(readBuf); + if ((*buf != '\0') && (*buf != '\n')) + rpmMessage(RPMMESS_WARNING, \ + _("found installed files not placed in any package:\n---\n%s---\n"), + buf); + } + +exit: + + freeStringBuf(readBuf); + _free(myargv[0]); + _free(myargv[1]); + + return rc; +} + int processBinaryFiles(Spec spec, int installSpecialDoc, int test) { Package pkg; int res = 0; + check_fileList = newStringBuf(); + check_fileListLen = 0; + for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) { const char *n, *v, *r; int rc; @@ -2687,5 +2746,15 @@ /*@=noeffect@*/ } + /* Now we have in fileList list of files from all packages. + * We pass it to a script which do the work of finding missing + * and duplicated files. + */ + + if (res == 0) + checkFiles(check_fileList, check_fileListLen); + + freeStringBuf(check_fileList); + return res; } diff -Nur rpm-4.0.4.orig/platform.in rpm-4.0.4/platform.in --- rpm-4.0.4.orig/platform.in Sun Jun 30 00:07:54 2002 +++ rpm-4.0.4/platform.in Sun Jun 30 00:13:45 2002 @@ -89,6 +89,10 @@ # Expanded at end of %install scriptlet. # +# Gets file list on input and buildroot as first parameter +# and returns list of files not found in any package +%__check_files @prefix@/lib/rpm/check-files + %__arch_install_post @ARCH_INSTALL_POST@ %__os_install_post \