packages: poldek/poldek-multilib-upgrade.patch, poldek/poldek.spec, poldek/...

cactus cactus at pld-linux.org
Thu Oct 29 10:09:04 CET 2009


Author: cactus                       Date: Thu Oct 29 09:09:04 2009 GMT
Module: packages                      Tag: HEAD
---- Log message:
- rel 33
- patch28 - score also pkgs marked to install
- patch29 - dont be so greedy, sometimes upgraded pkg has got needed cap.

---- Files affected:
packages/poldek:
   poldek-multilib-upgrade.patch (1.1 -> 1.2) , poldek.spec (1.387 -> 1.388) , poldek-score-reqs-marked-to-install.patch (NONE -> 1.1)  (NEW), poldek-dont-be-greedy.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/poldek/poldek-multilib-upgrade.patch
diff -u packages/poldek/poldek-multilib-upgrade.patch:1.1 packages/poldek/poldek-multilib-upgrade.patch:1.2
--- packages/poldek/poldek-multilib-upgrade.patch:1.1	Mon Oct 26 17:30:47 2009
+++ packages/poldek/poldek-multilib-upgrade.patch	Thu Oct 29 10:08:58 2009
@@ -103,7 +103,7 @@
      return strcmp(pkg->name, capreq_name(cr)) == 0 &&
          strcmp(pkg->ver, capreq_ver(cr)) == 0 &&
 diff --git a/pkgcmp.h b/pkgcmp.h
-index 6b1b75a..573e32b 100644
+index 6b1b75a..980f675 100644
 --- a/pkgcmp.h
 +++ b/pkgcmp.h
 @@ -17,6 +17,9 @@ int pkg_is_colored_like(const struct pkg *candidate, const struct pkg *pkg);
@@ -116,6 +116,15 @@
  /* strncmp(p1->name, p2->name, strlen(p2->name)) */
  extern__inline int pkg_ncmp_name(const struct pkg *p1, const struct pkg *p2);
  
+@@ -27,7 +30,7 @@ int pkg_cmp_name(const struct pkg *p1, const struct pkg *p2);
+ extern__inline int pkg_cmp_id(const struct pkg *p1, const struct pkg *p2);
+ 
+ 
+-/* versions only */
++/* versions only (+epoch) */
+ int pkg_cmp_ver(const struct pkg *p1, const struct pkg *p2);
+ /* EVR only */
+ int pkg_cmp_evr(const struct pkg *p1, const struct pkg *p2);
 diff --git a/upgrade-dist.c b/upgrade-dist.c
 index 458b764..00f34fc 100644
 --- a/upgrade-dist.c

================================================================
Index: packages/poldek/poldek.spec
diff -u packages/poldek/poldek.spec:1.387 packages/poldek/poldek.spec:1.388
--- packages/poldek/poldek.spec:1.387	Mon Oct 26 17:28:54 2009
+++ packages/poldek/poldek.spec	Thu Oct 29 10:08:58 2009
@@ -16,7 +16,7 @@
 %define	ver_rpm	4.5-5
 #
 %define		snap	20080820.23
-%define		rel		32
+%define		rel		33
 Summary:	RPM packages management helper tool
 Summary(pl.UTF-8):	Pomocnicze narzędzie do zarządzania pakietami RPM
 Name:		poldek
@@ -65,6 +65,8 @@
 Patch25:	%{name}-ls-source-rpm.patch
 Patch26:	%{name}-add-arch-match.patch
 Patch27:	%{name}-multilib-upgrade.patch
+Patch28:	%{name}-score-reqs-marked-to-install.patch
+Patch29:	%{name}-dont-be-greedy.patch
 URL:		http://poldek.pld-linux.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -221,6 +223,10 @@
 %patch26 -p1
 # LP#408034
 %patch27 -p1
+# score reqs already marked to install
+%patch28 -p1
+# dont be greedy if upgraded pkg has needed capabilities
+%patch29 -p1
 
 # cleanup backups after patching
 find . '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
@@ -500,6 +506,11 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.388  2009/10/29 09:08:58  cactus
+- rel 33
+- patch28 - score also pkgs marked to install
+- patch29 - dont be so greedy, sometimes upgraded pkg has got needed cap.
+
 Revision 1.387  2009/10/26 16:28:54  cactus
 - rel 32
 - patch25 - adds option --source-rpm (-s) to ls command (LP#392984)

================================================================
Index: packages/poldek/poldek-score-reqs-marked-to-install.patch
diff -u /dev/null packages/poldek/poldek-score-reqs-marked-to-install.patch:1.1
--- /dev/null	Thu Oct 29 10:09:04 2009
+++ packages/poldek/poldek-score-reqs-marked-to-install.patch	Thu Oct 29 10:08:58 2009
@@ -0,0 +1,151 @@
+diff --git a/install3/iset.c b/install3/iset.c
+index e891a13..8ecbd7f 100644
+--- a/install3/iset.c
++++ b/install3/iset.c
+@@ -238,6 +238,29 @@ int iset_provides(struct iset *iset, const struct capreq *cap)
+     return pkg != NULL;
+ }
+ 
++// returns how many pkg reqs are in iset
++int iset_reqs_score(struct iset *iset, const struct pkg *pkg)
++{
++    struct pkg_req_iter  *it = NULL;
++    const struct capreq  *req = NULL;
++    unsigned itflags = PKG_ITER_REQIN | PKG_ITER_REQDIR; // | PKG_ITER_REQDIR | PKG_ITER_REQSUG
++    int score = 0;
++
++    n_assert(pkg->reqs);
++
++    it = pkg_req_iter_new(pkg, itflags);
++    while ((req = pkg_req_iter_get(it))) {
++        if (iset_provides(iset, req)){
++            score++;
++	    if (capreq_versioned(req))
++		score +=2;
++	}
++    }
++    pkg_req_iter_free(it);
++
++    return score;
++}
++
+ void iset_dump(struct iset *iset)
+ {
+     int i;
+diff --git a/install3/iset.h b/install3/iset.h
+index 3946c0e..7b3b08d 100644
+--- a/install3/iset.h
++++ b/install3/iset.h
+@@ -32,7 +32,11 @@ void iset_add(struct iset *iset, struct pkg *pkg, unsigned mflag);
+ int  iset_remove(struct iset *iset, struct pkg *pkg);
+ 
+ int iset_provides(struct iset *iset, const struct capreq *cap);
++// returns how many pkg reqs are in iset
++int iset_reqs_score(struct iset *iset, const struct pkg *pkg);
++
+ int iset_has_pkg(struct iset *iset, const struct pkg *pkg);
++// return 1st found pkg_is_kind_of from iset or null
+ struct pkg *iset_has_kind_of_pkg(struct iset *iset, const struct pkg *pkg);
+ 
+ #endif    
+diff --git a/install3/requirements.c b/install3/requirements.c
+index ea9df61..37bb5e2 100644
+--- a/install3/requirements.c
++++ b/install3/requirements.c
+@@ -21,9 +21,8 @@ tn_array *filter_out_olders(struct i3ctx *ictx, tn_array *pkgs,
+                             const struct pkg *pkg)
+ {
+     tn_array *tmp = n_array_clone(pkgs);
+-    int i;
+-    
+-    for (i=0; i < n_array_size(pkgs); i++) {
++
++    for (unsigned int i=0; i < n_array_size(pkgs); i++) {
+         struct pkg *p = n_array_nth(pkgs, i);
+         int cmprc;
+         
+@@ -49,7 +48,8 @@ static struct pkg *select_successor(int indent, struct i3ctx *ictx,
+ {
+     const struct pkg *selected_pkg = NULL;
+     tn_array *pkgs, *tmp;
+-    int i, max_score = 0, *scores;
++    int max_score = 0, *scores;
++    unsigned int i;
+     int nconsidered = 0, nuncolored = 0;
+ 
+     tracef(indent, "%s (c=%d)", pkg_id(pkg), pkg->color);
+@@ -73,13 +73,21 @@ static struct pkg *select_successor(int indent, struct i3ctx *ictx,
+         selected_pkg = n_array_nth(pkgs, 0);
+         goto l_end;
+     }
+-    
++
+     /* multilib mode */
+     scores = alloca(sizeof(*scores) * n_array_size(pkgs));
+     for (i=0; i < n_array_size(pkgs); i++) {
+         struct pkg *p = n_array_nth(pkgs, i);
+         scores[i] = 0;
+-        
++
++	// extra 100 points for arch compatible
++	if (pkg_is_kind_of(p, pkg) && pkg_is_arch_compat(p, pkg)) {
++	    scores[i] += 100;
++	}
++
++	// extra points for reqs marked to install
++	scores[i] += iset_reqs_score(ictx->inset, p);
++
+         if (pkg->color == 0 && p->color == 0) { /* both uncolored  */
+             scores[i] += 1;
+             if (pkg_is_kind_of(p, pkg))
+@@ -93,14 +101,14 @@ static struct pkg *select_successor(int indent, struct i3ctx *ictx,
+         } else if (pkg_is_colored_like(p, pkg)) {
+             scores[i] += 2;
+         }
+-        
++
+         trace(indent, "- %d. %s -> color %d, score %d", i, pkg_id(p),
+-              p->color, scores[i]);
+-        
+-        if (max_score < scores[i]) {
+-            max_score = scores[i];
+-            selected_pkg = p;
+-        }
++            p->color, scores[i]);
++
++	if (max_score < scores[i]) {
++	    max_score = scores[i];
++	    selected_pkg = p;
++	}
+         
+         nconsidered++;
+     }
+@@ -150,9 +158,7 @@ l_end:
+ /* detect which package capability has "replaces" meaning, if any */
+ static const char *get_replacemeant_capname(const struct pkg *pkg) 
+ {
+-    int i;
+-    
+-    for (i=0; i < n_array_size(pkg->cnfls); i++) {
++    for (unsigned int i=0; i < n_array_size(pkg->cnfls); i++) {
+         struct capreq *cnfl = n_array_nth(pkg->cnfls, i);
+ 
+         if (capreq_versioned(cnfl) || !capreq_is_obsl(cnfl))
+@@ -194,7 +200,7 @@ struct pkg *find_successor_by(int indent, struct i3ctx *ictx,
+ {
+     struct pkg *bypkg = NULL;
+     tn_array *pkgs, *tmp;
+-    int i, best_i;
++    unsigned int i, best_i;
+ 
+     n_assert(tag == PS_SEARCH_OBSL || tag == PS_SEARCH_CAP);
+     if ((pkgs = pkgset_search(ictx->ps, tag, pkg->name)) == NULL) {
+@@ -741,7 +747,7 @@ int i3_process_pkg_requirements(int indent, struct i3ctx *ictx,
+        asks for suggested package, even though it is required. */
+     if (ts->getop(ts, POLDEK_OP_SUGGESTS) && nerrors == 0) {
+         tn_array *suggests = NULL;
+-	int      i;
++	unsigned int i;
+ 	
+ 	suggests = with_suggests(indent + 2, ictx, pkg);
+ 	

================================================================
Index: packages/poldek/poldek-dont-be-greedy.patch
diff -u /dev/null packages/poldek/poldek-dont-be-greedy.patch:1.1
--- /dev/null	Thu Oct 29 10:09:04 2009
+++ packages/poldek/poldek-dont-be-greedy.patch	Thu Oct 29 10:08:58 2009
@@ -0,0 +1,14 @@
+diff --git a/install3/requirements.c b/install3/requirements.c
+index ea9df61..361c400 100644
+--- a/install3/requirements.c
++++ b/install3/requirements.c
+@@ -386,7 +392,8 @@ static int process_orphan_req(int indent, struct i3ctx *ictx,
+     }
+     
+     /* try upgrade orphan */
+-    if (ts->getop(ts, POLDEK_OP_GREEDY)) {
++    if (ts->getop(ts, POLDEK_OP_GREEDY) && !(tomark && pkg_caps_match_req(tomark, req,
++		POLDEK_MA_PROMOTE_EPOCH || POLDEK_MA_PROMOTE_VERSION))) {
+         if (try_to_upgrade_orphan(indent, ictx, pkg, req, tomark))
+             goto l_end;
+     }
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/poldek/poldek-multilib-upgrade.patch?r1=1.1&r2=1.2&f=u
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/poldek/poldek.spec?r1=1.387&r2=1.388&f=u



More information about the pld-cvs-commit mailing list