]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-rpm_4_4_3.patch
- fix build with --as-needed
[packages/poldek.git] / poldek-rpm_4_4_3.patch
1 Index: pm/rpm/misc.c
2 ===================================================================
3 RCS file: /cvsroot/installer/poldek/pm/rpm/misc.c,v
4 retrieving revision 1.4
5 retrieving revision 1.5
6 diff -u -r1.4 -r1.5
7 --- pm/rpm/misc.c       12 May 2005 15:44:41 -0000      1.4
8 +++ pm/rpm/misc.c       21 Nov 2005 17:01:34 -0000      1.5
9 @@ -11,7 +11,7 @@
10  */
11  
12  /*
13 -  $Id$
14 +  $Id$
15  */
16  
17  #ifdef HAVE_CONFIG_H
18 @@ -23,6 +23,9 @@
19  #include <string.h>
20  
21  #include <rpm/rpmlib.h>
22 +#if HAVE_RPMDSRPMLIB
23 +# include <rpm/rpmds.h>
24 +#endif
25  
26  #include <trurl/nassert.h>
27  #include <trurl/nstr.h>
28 @@ -33,21 +36,49 @@
29  #include "log.h"
30  #include "pm/pm.h"
31  
32 -tn_array *pm_rpm_rpmlib_caps(void) 
33 +#if HAVE_RPMDSRPMLIB            /* rpmdsRpmlib() => rpm >= 4.4.3 */
34 +static int get_rpmlib_caps(tn_array *caps)
35 +{
36 +    rpmds ds = NULL;
37 +    
38 +    if (rpmdsRpmlib(&ds, NULL) != 0)
39 +        return 0;
40 +    
41 +    ds = rpmdsInit(ds);
42 +    while (rpmdsNext(ds) >= 0) {
43 +        const char *name, *evr;
44 +        char tmp[256];
45 +        struct capreq *cr;
46 +        uint32_t flags;
47 +
48 +        name = rpmdsN(ds);
49 +        evr = rpmdsEVR(ds);
50 +        flags = rpmdsFlags(ds);
51 +        
52 +        n_assert(flags & RPMSENSE_EQUAL);
53 +        n_assert((flags & (RPMSENSE_LESS | RPMSENSE_GREATER)) == 0);
54 +
55 +        n_strncpy(tmp, evr, 128);
56 +        cr = capreq_new_evr(name, tmp, REL_EQ, 0);
57 +        if (cr) 
58 +            n_array_push(caps, cr);
59 +    }
60 +    ds = rpmdsFree(ds);
61 +    return n_array_size(caps);
62 +}
63 +#endif  /* HAVE_RPMDSRPMLIB */
64 +
65 +#if HAVE_RPMGETRPMLIBPROVIDES   /* rpmGetRpmlibProvides() => rpm < 4.4.3 */
66 +static int get_rpmlib_caps_rpm_lt_4_4_3(tn_array *caps) 
67  {
68      char **names = NULL, **versions = NULL, *evr;
69      int *flags = NULL, n = 0, i;
70 -    tn_array *caps;
71 -    
72 -#if HAVE_RPMGETRPMLIBPROVIDES
73 +
74      n = rpmGetRpmlibProvides((const char ***)&names, &flags, (const char ***)&versions);
75 -#endif
76 -    
77      if (n <= 0)
78 -        return NULL;
79 +        return 0;
80  
81      caps = capreq_arr_new(0);
82 -    
83      evr = alloca(128);
84      
85      for (i=0; i<n; i++) {
86 @@ -62,19 +93,39 @@
87              n_array_push(caps, cr);
88      }
89  
90 -    if (names)
91 -        free(names);
92 -    
93 -    if (flags)
94 -        free(flags);
95 +    n_cfree(&names);
96 +    n_cfree(&flags);
97 +    n_cfree(&versions);
98 +    return 1;
99 +}
100 +#endif
101  
102 -    if (versions)
103 -        free(versions);
104 +tn_array *pm_rpm_rpmlib_caps(void) 
105 +{
106 +    tn_array *caps;
107 +    int rc = 0;
108 +    
109 +    caps = capreq_arr_new(0);
110      
111 -    n_array_sort(caps);
112 +#if HAVE_RPMDSRPMLIB            /* rpm >= 4.4.3 */
113 +    rc = get_rpmlib_caps(caps);
114 +#else
115 +# if HAVE_RPMGETRPMLIBPROVIDES
116 +    rc = get_rpmlib_caps_rpm_lt_4_4_3(caps);
117 +# endif
118 +#endif
119 +    
120 +    if (rc) {
121 +        n_array_sort(caps);
122 +        
123 +    } else {
124 +        n_array_free(caps);
125 +        caps = NULL;
126 +    }
127      return caps;
128  }
129  
130 +
131  const char *pm_rpm_get_arch(void *pm_rpm) 
132  {
133      pm_rpm = pm_rpm;
134 Index: pm/rpm/pm_rpm.h
135 ===================================================================
136 RCS file: /cvsroot/installer/poldek/pm/rpm/pm_rpm.h,v
137 retrieving revision 1.11
138 retrieving revision 1.12
139 diff -u -r1.11 -r1.12
140 --- pm/rpm/pm_rpm.h     24 Oct 2005 15:25:58 -0000      1.11
141 +++ pm/rpm/pm_rpm.h     21 Nov 2005 17:01:34 -0000      1.12
142 @@ -10,6 +10,14 @@
143  # include <rpm/rpmts.h>
144  #endif
145  
146 +/* RPMTAG_COPYRIGHT disappears in 4.4.3 but don't know from
147 +   when RPMTAG_LICENSE starts */
148 +#ifdef RPMTAG_COPYRIGHT         
149 +# define PM_RPMTAG_LICENSE RPMTAG_COPYRIGHT
150 +#else
151 +# define PM_RPMTAG_LICENSE RPMTAG_LICENSE
152 +#endif
153 +
154  #include <trurl/trurl.h>
155  #include "poldek.h"
156  #include "pm/pm.h"
157 Index: pkgu.c
158 ===================================================================
159 RCS file: /cvsroot/installer/poldek/pkgu.c,v
160 retrieving revision 1.30
161 retrieving revision 1.31
162 diff -u -r1.30 -r1.31
163 --- pkgu.c      18 Oct 2005 16:25:12 -0000      1.30
164 +++ pkgu.c      21 Nov 2005 17:01:34 -0000      1.31
165 @@ -11,7 +11,7 @@
166  */
167  
168  /*
169 -  $Id$
170 +  $Id$
171  */
172  
173  #include <ctype.h>
174 @@ -337,7 +337,7 @@
175      }
176  
177      pkgu->vendor = cp_tag(pkgu->_na, h, RPMTAG_VENDOR);
178 -    pkgu->license = cp_tag(pkgu->_na, h, RPMTAG_COPYRIGHT);
179 +    pkgu->license = cp_tag(pkgu->_na, h, PM_RPMTAG_LICENSE);
180      pkgu->url = cp_tag(pkgu->_na, h, RPMTAG_URL);
181      pkgu->distro = cp_tag(pkgu->_na, h, RPMTAG_DISTRIBUTION);
182      pkgu->buildhost = cp_tag(pkgu->_na, h, RPMTAG_BUILDHOST);
183 @@ -370,7 +370,7 @@
184          headerAddEntry(hdr, RPMTAG_VENDOR, RPM_STRING_TYPE, pkgu->vendor, 1);
185      
186      if (pkgu->license)
187 -        headerAddEntry(hdr, RPMTAG_COPYRIGHT, RPM_STRING_TYPE, pkgu->license, 1);
188 +        headerAddEntry(hdr, PM_RPMTAG_LICENSE, RPM_STRING_TYPE, pkgu->license, 1);
189      
190      if (pkgu->url)
191          headerAddEntry(hdr, RPMTAG_URL, RPM_STRING_TYPE, pkgu->url, 1);
192 Index: configure.in
193 ===================================================================
194 RCS file: /cvsroot/installer/poldek/configure.in,v
195 retrieving revision 1.121
196 retrieving revision 1.122
197 diff -u -r1.121 -r1.122
198 --- configure.in        4 Nov 2005 17:44:21 -0000       1.121
199 +++ configure.in        21 Nov 2005 17:01:34 -0000      1.122
200 @@ -293,9 +293,10 @@
201         LIBS="$LIBS -lbz2 -lrpmio"
202  fi
203  
204 -AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
205 -       [AC_MSG_WARN("[poldek will not work fine with rpmlib\(...\) capabilities"])],
206 -       [$CONF_IN_LDFLAGS])
207 +AC_CHECK_FUNCS(rpmdsRpmlib,,
208 +               [ AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
209 +                [AC_MSG_WARN(["poldek will not work fine with rpmlib\(...\) capabilities"])],
210 +                [$CONF_IN_LDFLAGS])], [$CONF_IN_LDFLAGS])
211  
212  
213  dnl metadata & xml2
This page took 0.049468 seconds and 3 git commands to generate.