SOURCES: poldek-obsoletes.patch (NEW) - hot stuff from mis

glen glen at pld-linux.org
Mon Nov 21 22:27:14 CET 2005


Author: glen                         Date: Mon Nov 21 21:27:05 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- hot stuff from mis

---- Files affected:
SOURCES:
   poldek-obsoletes.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/poldek-obsoletes.patch
diff -u /dev/null SOURCES/poldek-obsoletes.patch:1.1
--- /dev/null	Mon Nov 21 22:27:05 2005
+++ SOURCES/poldek-obsoletes.patch	Mon Nov 21 22:27:00 2005
@@ -0,0 +1,109 @@
+Index: pkgset-install.c
+===================================================================
+RCS file: /cvsroot/installer/poldek/pkgset-install.c,v
+retrieving revision 1.149
+diff -u -r1.149 pkgset-install.c
+--- pkgset-install.c	3 Nov 2005 00:21:00 -0000	1.149
++++ pkgset-install.c	21 Nov 2005 20:42:04 -0000
+@@ -126,6 +126,13 @@
+ static int marked_for_removal(struct pkg *pkg, struct upgrade_s *upg);
+ 
+ 
++#define mark_package(a, b) do_mark_package(a, b, PKGMARK_MARK);
++
++static int do_mark_package(struct pkg *pkg, struct upgrade_s *upg,
++                           unsigned mark);
++
++
++
+ /* anyone of pkgs is marked? */
+ static inline int one_is_marked(struct pkgmark_set *pms, struct pkg *pkgs[],
+                                 int npkgs)
+@@ -226,6 +233,30 @@
+     return install;
+ }
+ 
++static
++struct pkg *installset_obsoletes(const struct pkg *pkg, struct pkgset *ps,
++                                 struct upgrade_s *upg) 
++{
++    tn_array *pkgs;
++    int i;
++    
++    pkgs = pkgset_search(ps, PS_SEARCH_OBSL, pkg->name);
++    DBGF("%s => found %d packages\n", pkg->name, pkgs ? n_array_size(pkgs) : 0);
++    if (pkgs == NULL)
++        return NULL;
++
++    for (i=0; i<n_array_size(pkgs); i++) {
++        struct pkg *pkg = n_array_nth(pkgs, i);
++        
++        if (pkg_is_marked_i(upg->ts->pms, pkg))
++            mark_package(pkg, upg);
++
++        if (pkg_is_marked(upg->ts->pms, pkg))
++            return pkg;
++    }
++    return NULL;
++}
++
+ 
+ /* looks into Obsoletes only */
+ static
+@@ -235,14 +266,21 @@
+     struct pkg *bypkg = NULL;
+     tn_array *pkgs;
+     int i, best_i;
+-
+-    if ((pkgs = pkgset_search(ps, PS_SEARCH_CAP, pkg->name)) == NULL)
++        
++    pkgs = pkgset_search(ps, PS_SEARCH_CAP, pkg->name);
++    if (pkgs == NULL) {
++        DBGF("%s => found 0 packages\n");
+         return NULL;
++    }
++    
+     
+     best_i = select_best_pkg(pkg, pkgs, ps, upg);
++    DBGF("%s => found %d packages, best=%d\n", pkg->name, n_array_size(pkgs),
++            best_i);
++		    
+     for (i=best_i; i < n_array_size(pkgs); i++) {
+         struct pkg *p = n_array_nth(pkgs, i);
+-            
++
+         if (strcmp(pkg->name, p->name) == 0)
+             continue;
+             
+@@ -264,6 +302,8 @@
+     return bypkg;
+ }
+ 
++
++
+ static
+ int other_version_marked(struct pkgmark_set *pms, struct pkg *pkg,
+                          tn_array *pkgs, struct capreq *req)
+@@ -605,8 +645,6 @@
+ 
+ 
+ 
+-#define mark_package(a, b) do_mark_package(a, b, PKGMARK_MARK);
+-
+ static int do_mark_package(struct pkg *pkg, struct upgrade_s *upg,
+                            unsigned mark)
+ {
+@@ -1146,8 +1184,11 @@
+     p = select_pkg(pkg->name, ps->pkgs, upg);
+     if ((p == NULL || pkg_cmp_evr(p, pkg) == 0) &&
+         upg->ts->getop(upg->ts, POLDEK_OP_OBSOLETES)) {
+-        p = select_supersede_pkg(pkg, ps, upg);
+-        *by_obsoletes = 1;
++        if ((p = installset_obsoletes(pkg, ps, upg)) == NULL)
++            p = select_supersede_pkg(pkg, ps, upg);
++        
++        if (p)
++            *by_obsoletes = 1;
+     }
+     return p;
+ }
================================================================



More information about the pld-cvs-commit mailing list