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