[packages/poldek] Fix issue described in: http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2012-September/155

megabajt megabajt at pld-linux.org
Thu Sep 27 20:43:39 CEST 2012


commit a881abeb2342dc5a6c95efebfd4398446a4cf318
Author: Marcin Banasiak <marcin.banasiak at gmail.com>
Date:   Thu Sep 27 20:40:04 2012 +0200

    Fix issue described in: http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2012-September/155913.html
    Release 3

 poldek-git.patch | 109 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 poldek.spec      |   4 +-
 2 files changed, 112 insertions(+), 1 deletion(-)
---
diff --git a/poldek.spec b/poldek.spec
index b0ac15f..71b8163 100644
--- a/poldek.spec
+++ b/poldek.spec
@@ -14,7 +14,7 @@
 %define		ver_rpm		5.4.10
 
 %define		snap	rc6
-%define		rel	2%{?with_snap:.%{SNAP}}
+%define		rel	3%{?with_snap:.%{SNAP}}
 Summary:	RPM packages management helper tool
 Summary(hu.UTF-8):	RPM csomagkezelést segítő eszköz
 Summary(pl.UTF-8):	Pomocnicze narzędzie do zarządzania pakietami RPM
@@ -44,6 +44,7 @@ Patch2:		%{name}-size-type.patch
 Patch3:		%{name}-Os-fail-workaround.patch
 Patch4:		%{name}-link-rpmio.patch
 Patch5:		%{name}-vrpmlog.patch
+Patch6:		%{name}-git.patch
 URL:		http://poldek.pld-linux.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -208,6 +209,7 @@ Moduły języka Python dla poldka.
 %patch3 -p1
 %patch4 -p1
 %patch5 -p1
+%patch6 -p1
 
 %{__rm} m4/libtool.m4 m4/lt*.m4
 
diff --git a/poldek-git.patch b/poldek-git.patch
new file mode 100644
index 0000000..0b2b325
--- /dev/null
+++ b/poldek-git.patch
@@ -0,0 +1,109 @@
+commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396
+Author: Marcin Banasiak <marcin.banasiak at gmail.com>
+Date:   Thu Sep 27 17:44:19 2012 +0200
+
+    Change the way how / is stored in dirindex
+    
+    Previously, / was stored in dirindex with leading slash (i.e. as //)
+    what caused various side effects as:
+    
+    filesystem-4.0-12.x86_64 obsoleted by filesystem-4.0-13.x86_64
+    filesystem-4.0-13.x86_64 marks FHS-2.3-35.x86_64 (cap //)
+    error: FHS-2.3-35.x86_64: equal version installed, give up
+
+diff --git a/pkgdir/pkgdir_dirindex.c b/pkgdir/pkgdir_dirindex.c
+index a6f422f..abfd05c 100644
+--- a/pkgdir/pkgdir_dirindex.c
++++ b/pkgdir/pkgdir_dirindex.c
+@@ -103,10 +103,14 @@ static int package_key(char *key, int size, const struct pkg *pkg, int prefix)
+ static tn_buf *dirarray_join(tn_buf *nbuf, tn_array *arr, char *sep)
+ {
+     int i, size = n_array_size(arr);
++
+     for (i=0; i < size; i++) {
+-        n_buf_printf(nbuf, "%s%s", (char*)n_array_nth(arr, i),
+-                     i < size - 1 ? sep : "");
++        const char *dirname = n_array_nth(arr, i);
++    
++        n_buf_printf(nbuf, "%s%s%s", *dirname != '/' ? "/" : "",
++    		     dirname, i < size - 1 ? sep : "");
+     }
++
+     return nbuf;
+ }
+ 
+@@ -179,7 +183,8 @@ static int store_from_previous(uint32_t package_no, struct pkg *pkg, struct tndb
+ 
+     while (*tl) {
+         const char *dir = *tl;
+-        dir = dir + 1; /* skip '/' */
++        if (dir[1] != '\0')
++    	    dir = dir + 1; /* skip '/' only when strlen(dir) > 1 */
+         add_to_path_index(path_index, dir, package_no);
+         tl++;
+     }
+@@ -238,15 +243,13 @@ void store_package(uint32_t package_no, struct pkg *pkg, struct tndb *db,
+ 
+         if (required) {
+             n_buf_clean(nbuf);
+-            n_buf_printf(nbuf, "/"); /* prefix all by '/' */
+-            nbuf = dirarray_join(nbuf, required, ":/");
++            nbuf = dirarray_join(nbuf, required, ":");
+             tndb_put(db, key, klen, n_buf_ptr(nbuf), n_buf_size(nbuf));
+         }
+ 
+         if (owned) {
+             n_buf_clean(nbuf);
+-            n_buf_printf(nbuf, "/"); /* prefix all by '/' */
+-            nbuf = dirarray_join(nbuf, owned, ":/");
++            nbuf = dirarray_join(nbuf, owned, ":");
+ 
+             /* ugly, but what for another package_key() call */
+             key[1] = PREFIX_PKGKEY_OWNDIR; 
+@@ -323,9 +326,13 @@ static int dirindex_create(const struct pkgdir *pkgdir, const char *path,
+     for (i=0; i < n_array_size(directories); i++) {
+         const char *path = n_array_nth(directories, i);
+         tn_array *ids = n_hash_get(path_index, path);
++        int j;
+ 
+         n_buf_clean(nbuf);
+-        nbuf = dirarray_join(nbuf, ids, ":");
++        for (j = 0; j < n_array_size(ids); j++) {
++    	    n_buf_printf(nbuf, "%s%s", (char *)n_array_nth(ids, j),
++    				       j < n_array_size(ids) - 1 ? ":" : "");
++        }
+         
+         DBGF("  dir %s %s\n", path, (char*)n_buf_ptr(nbuf));
+         
+@@ -774,11 +781,11 @@ tn_array *get_package_directories_as_array(const struct pkgdir *pkgdir,
+         
+     dirs = n_array_new(n, free, (tn_fn_cmp)strcmp);
+     while (*tl) {
+-        if (**tl) 
++        if (**tl)
+             n_array_push(dirs, n_strdup(*tl));
+         tl++;
+     }
+-
++    
+     n_str_tokl_free(tl_save);
+     n_free(val);
+ 
+@@ -809,7 +816,7 @@ static tn_array *do_dirindex_get(const struct pkgdir_dirindex *dirindex,
+     unsigned char val[8192];
+     int           n, found, pkgs_passsed = 1;
+ 
+-    if (*path == '/')
++    if (*path == '/' && path[1] != '\0')
+         path++;
+     
+     if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
+@@ -877,7 +884,7 @@ int pkgdir_dirindex_pkg_has_path(const struct pkgdir *pkgdir,
+     
+     DBGF("%s %s\n", pkg_id(pkg), path);
+     
+-    if (*path == '/')
++    if (*path == '/' && path[1] != '\0')
+         path++;
+ 
+     if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/poldek.git/commitdiff/a881abeb2342dc5a6c95efebfd4398446a4cf318



More information about the pld-cvs-commit mailing list