]>
Commit | Line | Data |
---|---|---|
01cfb97d | 1 | diff -urN poldek-0.20.1-cvs20070108.22.org/configure.in poldek-0.20.1-cvs20070108.22/configure.in |
035184e7 AM |
2 | --- poldek-0.20.1-cvs20070108.22.org/configure.in 2007-06-16 20:02:10.545517000 +0200 |
3 | +++ poldek-0.20.1-cvs20070108.22/configure.in 2007-06-16 20:02:53.024324896 +0200 | |
776e9132 | 4 | @@ -302,6 +302,7 @@ |
e5783f75 AM |
5 | dnl rpm 4.4.7 |
6 | dnl - killed rpmMachineScore and rpmGetVar | |
7 | AC_CHECK_FUNCS(rpmMachineScore) | |
8 | +AC_CHECK_FUNCS(rpmPlatformScore) | |
9 | AC_CHECK_FUNCS(rpmGetVar) | |
10 | AC_CHECK_FUNCS(rpmioAccess) | |
11 | dnl - new _rpmvercmp() | |
01cfb97d | 12 | diff -urN poldek-0.20.1-cvs20070108.22.org/pm/rpm/misc.c poldek-0.20.1-cvs20070108.22/pm/rpm/misc.c |
035184e7 AM |
13 | --- poldek-0.20.1-cvs20070108.22.org/pm/rpm/misc.c 2007-06-16 20:02:10.545517000 +0200 |
14 | +++ poldek-0.20.1-cvs20070108.22/pm/rpm/misc.c 2007-06-16 20:02:53.024324896 +0200 | |
776e9132 | 15 | @@ -48,7 +48,7 @@ |
8b771e86 AM |
16 | struct capreq *cr; |
17 | uint32_t flags, crflags; | |
18 | ||
19 | - name = rpmdsN(ds); | |
20 | + name = rpmdsDNEVR(ds)+2; | |
21 | evr = rpmdsEVR(ds); | |
22 | flags = rpmdsFlags(ds); | |
23 | ||
776e9132 | 24 | @@ -182,8 +182,39 @@ |
e5783f75 | 25 | return caps; |
57535125 | 26 | } |
e5783f75 | 27 | |
b3972e18 | 28 | +#ifdef HAVE_RPMPLATFORMSCORE |
e5783f75 | 29 | +static int machine_score(int tag, const char *val) { |
776e9132 AM |
30 | + int rc; |
31 | + char *cpu, *vendor, *os; | |
32 | ||
33 | -#ifdef HAVE_RPMMACHINESCORE | |
34 | + cpu = rpmExpand("%{_host_cpu}", NULL); | |
35 | + vendor = rpmExpand("%{_host_vendor}", NULL); | |
36 | + os = rpmExpand("%{_host_os}", NULL); | |
37 | + | |
38 | + if (cpu && vendor && os) { | |
39 | + int size = strlen(cpu) + strlen(vendor) + strlen(os) + 2; | |
40 | + char *p = n_malloc(size); | |
41 | + switch (tag) { | |
42 | + case PMMSTAG_ARCH: | |
43 | + snprintf(p, size, "%s-%s-%s", val, vendor, os); | |
44 | + break; | |
45 | + case PMMSTAG_OS: | |
46 | + snprintf(p, size, "%s-%s-%s", cpu, vendor, val); | |
47 | + break; | |
48 | + default: | |
49 | + snprintf(p, size, "%s", val); | |
50 | + break; | |
51 | + } | |
52 | + rc = rpmPlatformScore(p, platpat, nplatpat); | |
53 | + n_free(p); | |
54 | + } else | |
55 | + rc = rpmPlatformScore(val, platpat, nplatpat); | |
56 | + n_free(cpu); | |
57 | + n_free(vendor); | |
58 | + n_free(os); | |
59 | + return rc; | |
e5783f75 AM |
60 | +} |
61 | +#elif defined(HAVE_RPMMACHINESCORE) | |
62 | static int machine_score(int tag, const char *val) | |
63 | { | |
64 | int rpmtag = 0, rc; | |
776e9132 | 65 | @@ -250,8 +281,10 @@ |
e5783f75 AM |
66 | |
67 | if (arch == NULL) | |
68 | return 0; | |
69 | - | |
70 | -#ifdef HAVE_RPMMACHINESCORE | |
71 | + | |
b3972e18 | 72 | +#ifdef HAVE_RPMPLATFORMSCORE |
991b4a10 | 73 | + rc = rpmPlatformScore(arch, platpat, nplatpat); |
e5783f75 AM |
74 | +#elif defined(HAVE_RPMMACHINESCORE) |
75 | rc = rpmMachineScore(RPM_MACHTABLE_INSTARCH, arch); | |
76 | #else | |
77 | rc = 9; | |
01cfb97d | 78 | diff -urN poldek-0.20.1-cvs20070108.22.org/pm/rpm/pm_rpm.h poldek-0.20.1-cvs20070108.22/pm/rpm/pm_rpm.h |
8b771e86 | 79 | --- poldek-0.20.1-cvs20070108.22.org/pm/rpm/pm_rpm.h 2007-01-08 15:59:16.000000000 +0100 |
035184e7 | 80 | +++ poldek-0.20.1-cvs20070108.22/pm/rpm/pm_rpm.h 2007-06-16 20:02:53.027658397 +0200 |
8b771e86 AM |
81 | @@ -2,6 +2,7 @@ |
82 | #define POLDEK_PM_RPM_MODULE_H | |
83 | ||
84 | #include <rpm/rpmlib.h> | |
85 | +#include <rpm/rpmevr.h> | |
86 | #ifdef HAVE_RPM_4_0_4 | |
87 | # include <rpm/rpmcli.h> | |
88 | #endif | |
01cfb97d | 89 | diff -urN poldek-0.20.1-cvs20070108.22.org/pm/rpm/rpm.c poldek-0.20.1-cvs20070108.22/pm/rpm/rpm.c |
8b771e86 | 90 | --- poldek-0.20.1-cvs20070108.22.org/pm/rpm/rpm.c 2006-12-18 09:53:02.000000000 +0100 |
035184e7 | 91 | +++ poldek-0.20.1-cvs20070108.22/pm/rpm/rpm.c 2007-06-16 20:02:53.027658397 +0200 |
01cfb97d AM |
92 | @@ -402,10 +402,6 @@ |
93 | #endif /* HAVE_RPMLOG */ | |
8b771e86 AM |
94 | |
95 | ||
01cfb97d | 96 | -#ifndef HAVE__RPMVERCMP /* _rpmvercmp - new in rpm 4.4.7 */ |
8b771e86 | 97 | -extern int rpmvercmp(const char *one, const char *two); |
01cfb97d AM |
98 | -#endif |
99 | - | |
8b771e86 | 100 | int pm_rpm_vercmp(const char *one, const char *two) |
01cfb97d AM |
101 | { |
102 | return rpmvercmp(one, two); | |
103 | diff -urN poldek-0.20.1-cvs20070108.22.org/pm/rpm/rpmvercmp.c poldek-0.20.1-cvs20070108.22/pm/rpm/rpmvercmp.c | |
104 | --- poldek-0.20.1-cvs20070108.22.org/pm/rpm/rpmvercmp.c 2006-12-18 09:52:40.000000000 +0100 | |
035184e7 AM |
105 | +++ poldek-0.20.1-cvs20070108.22/pm/rpm/rpmvercmp.c 2007-06-16 20:03:14.682083082 +0200 |
106 | @@ -6,14 +6,10 @@ | |
107 | #include <stdlib.h> | |
108 | #include <string.h> | |
109 | #include <rpm/rpmlib.h> | |
110 | +#include <rpm/rpmevr.h> | |
01cfb97d AM |
111 | |
112 | #include "i18n.h" | |
113 | ||
114 | -#ifndef HAVE__RPMVERCMP /* _rpmvercmp - new in rpm 4.4.7 */ | |
115 | -extern int rpmvercmp(const char *one, const char *two); | |
116 | -#endif | |
117 | - | |
118 | - | |
119 | int main(int argc, char *argv[]) | |
120 | { | |
121 | int cmprc, is_test = 0; | |
a8a9dbd8 AM |
122 | diff -u -r1.11 -r1.12 |
123 | --- poldek/pm/rpm/misc.c 2007/06/16 16:24:08 1.11 | |
124 | +++ poldek/pm/rpm/misc.c 2007/06/16 20:16:40 1.12 | |
125 | @@ -43,14 +43,20 @@ | |
126 | { | |
127 | ds = rpmdsInit(ds); | |
128 | while (rpmdsNext(ds) >= 0) { | |
129 | - const char *name, *evr; | |
130 | - char tmp[256], *tmpptr; | |
131 | + const char *evr, *p; | |
132 | + char *name, tmp[256], *tmpptr; | |
133 | struct capreq *cr; | |
134 | uint32_t flags, crflags; | |
135 | ||
136 | - name = rpmdsDNEVR(ds)+2; | |
137 | + p = rpmdsDNEVR(ds)+2; | |
138 | + n_strdupap(p, &name); | |
139 | + if ((p = strchr(name, ' '))) /* cut afer name */ | |
140 | + *(char*)p = '\0'; | |
141 | + | |
142 | evr = rpmdsEVR(ds); | |
143 | flags = rpmdsFlags(ds); | |
144 | + | |
145 | + DBGF("%s, %s\n", name, evr); | |
146 | ||
147 | if ((flags & RPMSENSE_EQUAL)) { | |
148 | n_strncpy(tmp, evr, 128); |