]> git.pld-linux.org Git - packages/rpm.git/blob - rpm-find_required_pkgs_on_build.patch
- AMD64 build fixed
[packages/rpm.git] / rpm-find_required_pkgs_on_build.patch
1 diff -durN rpm-4.3.orig/build/rpmfc.c rpm-4.3/build/rpmfc.c
2 --- rpm-4.3.orig/build/rpmfc.c  2004-01-04 13:53:29.000000000 +0100
3 +++ rpm-4.3/build/rpmfc.c       2004-01-04 15:13:18.227262716 +0100
4 @@ -9,6 +9,8 @@
5  #define        _RPMDS_INTERNAL
6  #include <rpmds.h>
7  #include <rpmfi.h>
8 +#include <rpmts.h>
9 +#include <rpmdb.h>
10  
11  #if HAVE_GELF_H
12  #include <gelf.h>
13 @@ -1058,6 +1060,116 @@
14      { NULL, 0 }
15  };
16  
17 +int rpmfcFindRequiredPackages(rpmfc fc) 
18 +{
19 +    rpmts ts=NULL;
20 +    const char * s;
21 +    char * se;
22 +    rpmds ds;
23 +    const char * N;
24 +    const char * EVR;
25 +    int_32 Flags;
26 +    unsigned char deptype;
27 +    int nddict;
28 +    int previx;
29 +    unsigned int val;
30 +    int dix;
31 +    int ix;
32 +    int i;
33 +    int j;
34 +    int xx;
35 +    int r;
36 +    const char * hname;
37 +    rpmdbMatchIterator it;
38 +    Header hdr;
39 +    ARGV_t noautoreqdep=NULL;
40 +    int noautoreqdep_c;
41 +
42 +    s=rpmExpand("%{_noautoreqdep}",NULL);
43 +    if (s) {
44 +       poptParseArgvString(s,&noautoreqdep_c,(const char ***)&noautoreqdep);
45 +           s = _free(s);
46 +    }
47 +    if (noautoreqdep==NULL) noautoreqdep_c=0;
48 +    
49 +    ts = rpmtsCreate(); /* XXX ts created in main() should be used */
50 +    
51 +    rpmMessage(RPMMESS_NORMAL, "Searching for required packages....\n");
52 +
53 +    nddict = argvCount(fc->ddict);
54 +    previx = -1;
55 +    for (i = 0; i < nddict; i++) {
56 +        s = fc->ddict[i];
57 +
58 +        /* Parse out (file#,deptype,N,EVR,Flags) */
59 +        ix = strtol(s, &se, 10);
60 +        assert(se != NULL);
61 +        deptype = *se++;
62 +        se++;
63 +        N = se;
64 +        while (*se && *se != ' ')
65 +            se++;
66 +        *se++ = '\0';
67 +        EVR = se;
68 +        while (*se && *se != ' ')
69 +            se++;
70 +        *se++ = '\0';
71 +        Flags = strtol(se, NULL, 16);
72 +
73 +        if (deptype!='R') continue;
74 +
75 +        rpmMessage(RPMMESS_DEBUG, "#%i requires: %s,%s,%i\n",ix,N,EVR,Flags);
76 +        if (EVR && EVR[0]) {
77 +            rpmMessage(RPMMESS_DEBUG, "skipping #%i require\n");
78 +            continue;
79 +        }
80 +        for(j=0;j<noautoreqdep_c;j++) 
81 +            if (fnmatch(noautoreqdep[j],N,0)==0) {
82 +                rpmMessage(RPMMESS_NORMAL, 
83 +                        "skipping %s requirement processing (matches noautoreqdep pattern: %s)\n",
84 +                        N,noautoreqdep[j]);
85 +                break;
86 +            }
87 +        if (j<noautoreqdep_c) continue;
88 +        if (N[0]=='/') {
89 +            rpmMessage(RPMMESS_DEBUG, "skipping #%i require (is file requirement)\n");
90 +            continue;
91 +        }
92 +        it=rpmtsInitIterator(ts, RPMTAG_PROVIDENAME, N, 0);
93 +        if (!it) {
94 +            rpmMessage(RPMMESS_DEBUG, "%s -> not found\n",N);
95 +            continue;
96 +        }
97 +        rpmMessage(RPMMESS_DEBUG, "Iterator: %p\n",it);
98 +        if (rpmdbGetIteratorCount(it)>1) {
99 +            rpmMessage(RPMMESS_DEBUG, "%s -> multiple (skipping)\n",N);
100 +            rpmdbFreeIterator(it);
101 +            continue;
102 +        }
103 +        hdr=rpmdbNextIterator(it);
104 +        assert(hdr!=NULL);
105 +        r=rpmHeaderGetEntry(hdr,RPMTAG_NAME,NULL,(void **)&hname, NULL);
106 +        assert(r<2);
107 +        if (!strcmp(hname,N)) {
108 +            rpmMessage(RPMMESS_DEBUG, "%s -> %s (skipping)\n",N,hname);
109 +            rpmdbFreeIterator(it);
110 +            continue;
111 +        }
112 +            
113 +        rpmMessage(RPMMESS_DEBUG, "%s -> %s\n",N,hname);
114 +        
115 +               ds = rpmdsSingle(RPMTAG_REQUIRENAME, hname, "", RPMSENSE_FIND_REQUIRES);
116 +               xx = rpmdsMerge(&fc->requires, ds);
117 +               ds = rpmdsFree(ds);
118 +
119 +        rpmdbFreeIterator(it);
120 +    }
121 +
122 +    noautoreqdep=_free(noautoreqdep);
123 +    ts = rpmtsFree(ts);
124 +    return 0;
125 +}
126 +
127  int rpmfcApply(rpmfc fc)
128  {
129      rpmfcApplyTbl fcat;
130 @@ -1086,6 +1198,8 @@
131         }
132      }
133  
134 +    rpmfcFindRequiredPackages(fc);
135 +
136  /*@-boundswrite@*/
137      /* Generate per-file indices into package dependencies. */
138      nddict = argvCount(fc->ddict);
This page took 0.03599 seconds and 3 git commands to generate.