]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-check_files.patch
- workaround over static markers for the .. operator
[packages/rpm.git] / rpm-check_files.patch
1 --- rpm-4.0.2/build/files.c     Sun May 26 13:40:43 2002
2 +++ rpm-4.0.2-filon/build/files.c       Sun May 26 13:39:44 2002
3 @@ -1987,7 +1987,7 @@
4   */
5  static int generateDepends(Spec spec, Package pkg,
6                            struct cpioFileMapping *cpioList, int cpioCount,
7 -                          int multiLib)
8 +                          int multiLib, StringBuf fileList, int *fileListLen)
9  {
10      StringBuf writeBuf;
11      int writeBytes;
12 @@ -2013,7 +2013,9 @@
13         }
14  
15         writeBytes += strlen(cpioList->fsPath) + 1;
16 +       *fileListLen += strlen(cpioList->fsPath) + 1;
17         appendLineStringBuf(writeBuf, cpioList->fsPath);
18 +       appendLineStringBuf(fileList, cpioList->fsPath);
19      }
20  
21      for (dm = depMsgs; dm->msg != NULL; dm++) {
22 @@ -2190,10 +2192,54 @@
23      FREE(versions);
24  }
25  
26 +int checkFiles(StringBuf fileList, int fileListLen)
27 +{
28 +    StringBuf readBuf = NULL;
29 +    char* myargv[3] = {NULL, NULL, NULL};
30 +    int rc = 0;
31 +    char *buf;
32 +    
33 +    myargv[0] = rpmExpand("%{__check_files}", NULL);
34 +    if (!(myargv[0] && *myargv[0] != '%')) {
35 +        rc = -1;
36 +        goto exit;
37 +    }    
38 +    myargv[1] = rpmExpand("%{buildroot}", NULL);
39 +    if (!(myargv[1] && *myargv[1] != '%')) {
40 +        rc = -1;
41 +        goto exit;
42 +    }
43 +    
44 +    rpmMessage(RPMMESS_NORMAL, _("Searching for omited files: (using %s)...\n"),
45 +               myargv[0]);
46 +                   
47 +    readBuf = getOutputFrom(NULL, myargv, getStringBuf(fileList), fileListLen, 0);
48 +    
49 +    if (readBuf) {
50 +        buf = getStringBuf(readBuf);
51 +        if ((*buf != '\0') && (*buf != '\n'))
52 +            rpmMessage(RPMMESS_WARNING, \
53 +                       _("found installed files not placed in any package:\n---\n%s---\n"),
54 +                       buf);
55 +    }
56 +    
57 +exit:
58 +    
59 +    freeStringBuf(readBuf);
60 +    FREE(myargv[0]);
61 +    FREE(myargv[1]);
62 +
63 +    return rc;
64 +}
65 +
66  int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
67  {
68      Package pkg;
69      int res = 0;
70 +    StringBuf fileList;
71 +    int fileListLen = 0;
72 +    
73 +    fileList = newStringBuf();
74      
75      for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
76         const char *n, *v, *r;
77 @@ -2213,13 +2260,23 @@
78       * XXX existence (rather than value) that will need to change as well.
79       */
80         if (headerGetEntry(pkg->header, RPMTAG_MULTILIBS, NULL, NULL, NULL)) {
81 -           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 1);
82 -           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 2);
83 +           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 1, fileList, &fileListLen);
84 +           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 2, fileList, &fileListLen);
85         } else
86 -           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 0);
87 +           generateDepends(spec, pkg, pkg->cpioList, pkg->cpioCount, 0, fileList, &fileListLen);
88         printDeps(pkg->header);
89         
90      }
91  
92 +    /* Now we have in fileList list of files from all packages.
93 +     * We pass it to a script which do the work of finding missing
94 +     * and duplicated files.
95 +     */
96 +    
97 +    if (res == 0) 
98 +        checkFiles(fileList, fileListLen);
99 +    
100 +    freeStringBuf(fileList);
101 +    
102      return res;
103  }
104 --- rpm-4.0.2/platform.in       Sun May 26 13:40:43 2002
105 +++ rpm-4.0.2-filon/platform.in Sun May 26 12:11:26 2002
106 @@ -38,6 +38,10 @@
107  #      Expanded at end of %install
108  #
109  
110 +# Gets file list on input and buildroot as first parameter
111 +# and returns list of files not found in any package
112 +%__check_files         @prefix@/lib/rpm/check-files
113 +
114  %__arch_install_post   @ARCH_INSTALL_POST@
115  
116  %__os_install_post    \
This page took 0.064112 seconds and 3 git commands to generate.