]> git.pld-linux.org Git - packages/poldek.git/blame - poldek-obsoletes.patch
- fix config for Th
[packages/poldek.git] / poldek-obsoletes.patch
CommitLineData
944afcbf
ER
1Index: pkgset-install.c
2===================================================================
3RCS file: /cvsroot/installer/poldek/pkgset-install.c,v
4retrieving revision 1.149
5diff -u -r1.149 pkgset-install.c
6--- pkgset-install.c 3 Nov 2005 00:21:00 -0000 1.149
7+++ pkgset-install.c 21 Nov 2005 20:42:04 -0000
8@@ -126,6 +126,13 @@
9 static int marked_for_removal(struct pkg *pkg, struct upgrade_s *upg);
10
11
12+#define mark_package(a, b) do_mark_package(a, b, PKGMARK_MARK);
13+
14+static int do_mark_package(struct pkg *pkg, struct upgrade_s *upg,
15+ unsigned mark);
16+
17+
18+
19 /* anyone of pkgs is marked? */
20 static inline int one_is_marked(struct pkgmark_set *pms, struct pkg *pkgs[],
21 int npkgs)
22@@ -226,6 +233,30 @@
23 return install;
24 }
25
26+static
27+struct pkg *installset_obsoletes(const struct pkg *pkg, struct pkgset *ps,
28+ struct upgrade_s *upg)
29+{
30+ tn_array *pkgs;
31+ int i;
32+
33+ pkgs = pkgset_search(ps, PS_SEARCH_OBSL, pkg->name);
34+ DBGF("%s => found %d packages\n", pkg->name, pkgs ? n_array_size(pkgs) : 0);
35+ if (pkgs == NULL)
36+ return NULL;
37+
38+ for (i=0; i<n_array_size(pkgs); i++) {
39+ struct pkg *pkg = n_array_nth(pkgs, i);
40+
41+ if (pkg_is_marked_i(upg->ts->pms, pkg))
42+ mark_package(pkg, upg);
43+
44+ if (pkg_is_marked(upg->ts->pms, pkg))
45+ return pkg;
46+ }
47+ return NULL;
48+}
49+
50
51 /* looks into Obsoletes only */
52 static
53@@ -235,14 +266,21 @@
54 struct pkg *bypkg = NULL;
55 tn_array *pkgs;
56 int i, best_i;
57-
58- if ((pkgs = pkgset_search(ps, PS_SEARCH_CAP, pkg->name)) == NULL)
59+
60+ pkgs = pkgset_search(ps, PS_SEARCH_CAP, pkg->name);
61+ if (pkgs == NULL) {
62+ DBGF("%s => found 0 packages\n");
63 return NULL;
64+ }
65+
66
67 best_i = select_best_pkg(pkg, pkgs, ps, upg);
68+ DBGF("%s => found %d packages, best=%d\n", pkg->name, n_array_size(pkgs),
69+ best_i);
70+
71 for (i=best_i; i < n_array_size(pkgs); i++) {
72 struct pkg *p = n_array_nth(pkgs, i);
73-
74+
75 if (strcmp(pkg->name, p->name) == 0)
76 continue;
77
78@@ -264,6 +302,8 @@
79 return bypkg;
80 }
81
82+
83+
84 static
85 int other_version_marked(struct pkgmark_set *pms, struct pkg *pkg,
86 tn_array *pkgs, struct capreq *req)
87@@ -605,8 +645,6 @@
88
89
90
91-#define mark_package(a, b) do_mark_package(a, b, PKGMARK_MARK);
92-
93 static int do_mark_package(struct pkg *pkg, struct upgrade_s *upg,
94 unsigned mark)
95 {
96@@ -1146,8 +1184,11 @@
97 p = select_pkg(pkg->name, ps->pkgs, upg);
98 if ((p == NULL || pkg_cmp_evr(p, pkg) == 0) &&
99 upg->ts->getop(upg->ts, POLDEK_OP_OBSOLETES)) {
100- p = select_supersede_pkg(pkg, ps, upg);
101- *by_obsoletes = 1;
102+ if ((p = installset_obsoletes(pkg, ps, upg)) == NULL)
103+ p = select_supersede_pkg(pkg, ps, upg);
104+
105+ if (p)
106+ *by_obsoletes = 1;
107 }
108 return p;
109 }
This page took 0.116301 seconds and 4 git commands to generate.