]> git.pld-linux.org Git - packages/satyr.git/blob - satyr-rpm5.patch
binutils rebuild
[packages/satyr.git] / satyr-rpm5.patch
1 --- satyr-0.3/lib/rpm.c.orig    2013-03-25 15:07:04.000000000 +0100
2 +++ satyr-0.3/lib/rpm.c 2013-04-06 15:46:04.134714198 +0200
3 @@ -24,11 +24,11 @@
4  #include "config.h"
5  #include <errno.h>
6  #ifdef HAVE_LIBRPM
7 -#include <rpm/rpmlib.h>
8 +#include <rpm/rpmtag.h>
9  #include <rpm/rpmdb.h>
10 +#include <rpm/rpmio.h>
11 +#include <rpm/rpmrc.h>
12  #include <rpm/rpmts.h>
13 -#include <rpm/rpmtd.h>
14 -#include <rpm/header.h>
15  #endif
16  #include <fcntl.h>
17  #include <assert.h>
18 @@ -249,18 +249,18 @@
19                    rpmTag tag,
20                    char **result)
21  {
22 -    rpmtd tag_data = rpmtdNew();
23 -    int success = headerGet(header,
24 -                            tag,
25 -                            tag_data,
26 -                            HEADERGET_DEFAULT);
27 +    HE_s h;
28 +    memset(&h, 0, sizeof(h));
29 +    h.tag = tag;
30 +    h.ix = -1;
31 +    int success = headerGet(header, &h, 0);
32  
33      if (success != 1)
34          return false;
35  
36 -    const char *str = rpmtdGetString(tag_data);
37 +    const char *str = (h.t == RPM_STRING_TYPE) ? h.p.str :
38 +           (((h.t == RPM_STRING_ARRAY_TYPE) || (h.t == RPM_I18NSTRING_TYPE)) ? h.p.argv[0] : NULL);
39      *result = (str ? sr_strdup(str) : NULL);
40 -    rpmtdFree(tag_data);
41      return str;
42  }
43  
44 @@ -269,20 +269,21 @@
45                    rpmTag tag,
46                    uint32_t *result)
47  {
48 -    rpmtd tag_data = rpmtdNew();
49 -    int success = headerGet(header,
50 -                            tag,
51 -                            tag_data,
52 -                            HEADERGET_DEFAULT);
53 +    HE_s h;
54 +    memset(&h, 0, sizeof(h));
55 +    h.tag = tag;
56 +    h.ix = -1;
57 +    int success = headerGet(header, &h, 0);
58  
59      if (success != 1)
60          return false;
61  
62 -    uint32_t *num = rpmtdGetUint32(tag_data);
63 +    if (h.t != RPM_UINT32_TYPE)
64 +        return false;
65 +    uint32_t *num = h.p.ui32p;
66      if (num)
67          *result = *num;
68  
69 -    rpmtdFree(tag_data);
70      return num;
71  }
72  
73 @@ -361,14 +362,14 @@
74      }
75  
76      rpmts ts = rpmtsCreate();
77 -    rpmdbMatchIterator iter = rpmtsInitIterator(ts,
78 +    rpmmi iter = rpmtsInitIterator(ts,
79                                                  RPMTAG_NAME,
80                                                  name,
81                                                  strlen(name));
82  
83      struct sr_rpm_package *result = NULL;
84      Header header;
85 -    while ((header = rpmdbNextIterator(iter)))
86 +    while ((header = rpmmiNext(iter)))
87      {
88          struct sr_rpm_package *package = header_to_rpm_info(header,
89                                                              error_message);
90 @@ -382,7 +383,7 @@
91          result = sr_rpm_package_append(result, package);
92      }
93  
94 -    rpmdbFreeIterator(iter);
95 +    rpmmiFree(iter);
96      rpmtsFree(ts);
97      return result;
98  #else
99 @@ -403,14 +404,14 @@
100      }
101  
102      rpmts ts = rpmtsCreate();
103 -    rpmdbMatchIterator iter = rpmtsInitIterator(ts,
104 +    rpmmi iter = rpmtsInitIterator(ts,
105                                                  RPMTAG_BASENAMES,
106                                                  path,
107                                                  strlen(path));
108  
109      struct sr_rpm_package *result = NULL;
110      Header header;
111 -    while ((header = rpmdbNextIterator(iter)))
112 +    while ((header = rpmmiNext(iter)))
113      {
114          struct sr_rpm_package *package = header_to_rpm_info(header,
115                                                              error_message);
116 @@ -424,7 +425,7 @@
117          result = sr_rpm_package_append(result, package);
118      }
119  
120 -    rpmdbFreeIterator(iter);
121 +    rpmmiFree(iter);
122      rpmtsFree(ts);
123      return result;
124  #else
This page took 0.092445 seconds and 3 git commands to generate.