]> git.pld-linux.org Git - packages/poldek.git/blobdiff - poldek-git.patch
- rel 6: add upstream patches
[packages/poldek.git] / poldek-git.patch
index 771de387b8aa5b12623765a5c6349e031f19b655..a6741839c42b0dcbbb135e6a0ad2d4ca09d5e4e1 100644 (file)
-commit 3c90766404683407368cab9526d13b0aa8036469
+commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396
+Author: Marcin Banasiak <marcin.banasiak@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)))
+commit f575c9bbe3cdd8f2d6ef27eb73dcc270c1a8a3f2
+Author: Marcin Banasiak <marcin.banasiak@gmail.com>
+Date:   Sun Oct 7 12:41:42 2012 +0200
+
+    Provide function body for inlined pkg_id
+
+diff --git a/pkg.c b/pkg.c
+index 6e83694..227fe14 100644
+--- a/pkg.c
++++ b/pkg.c
+@@ -1463,11 +1463,6 @@ struct pkg *pkg_link(struct pkg *pkg)
+     return pkg;
+ }
+-const char *pkg_id(const struct pkg *p) 
+-{
+-    return p->_nvr;
+-}
+-
+ int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg)
+ {
+     return n_snprintf(str, size, "%s", pkg_id(pkg));
+diff --git a/pkg.h b/pkg.h
+index f0d71ac..ec6cc6d 100644
+--- a/pkg.h
++++ b/pkg.h
+@@ -231,7 +231,11 @@ EXPORT const char *pkg_pkgdirpath(const struct pkg *pkg);
+ EXPORT unsigned pkg_file_url_type(const struct pkg *pkg);
+-EXPORT extern__inline const char *pkg_id(const struct pkg *p);
++static inline const char *pkg_id(const struct pkg *p)
++{
++    return p->_nvr;
++}
++
+ EXPORT int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg);
+ EXPORT int pkg_idevr_snprintf(char *str, size_t size, const struct pkg *pkg);
+commit ce00c5a5311fb6d77fcf96b04bca5cf2904d90ae
+Author: Marcin Banasiak <marcin.banasiak@gmail.com>
+Date:   Sun Oct 7 12:46:36 2012 +0200
+
+    Kill redundant EXPORT in pm.h
+
+diff --git a/pm/pm.h b/pm/pm.h
+index 9913168..a20c305 100644
+--- a/pm/pm.h
++++ b/pm/pm.h
+@@ -204,7 +204,7 @@ EXPORT int pm_get_dbdepdirs(struct pm_ctx *ctx,
+ EXPORT struct pkg *pm_load_package(struct pm_ctx *ctx,
+                             tn_alloc *na, const char *path, unsigned ldflags);
+-EXPORT struct pkgdir;
++struct pkgdir;
+ EXPORT struct pkgdir *pkgdb_to_pkgdir(struct pm_ctx *ctx, const char *rootdir,
+                                const char *path, unsigned pkgdir_ldflags,
+                                const char *key, ...);
+commit a6f68bc7fe9305d4988e69c1d3166b1a4585b8f7
+Author: Bartlomiej Zimon <uzi18@o2.pl>
+Date:   Thu Jan 3 22:44:11 2013 +0100
+
+    - fix LP#1077603 - poldek make indexes crash for subpackage without Group
+      https://bugs.launchpad.net/poldek/+bug/1077603
+    
+    Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
+
+diff --git a/pkgroup.c b/pkgroup.c
+index cd8bf4d..9fdeaf9 100644
+--- a/pkgroup.c
++++ b/pkgroup.c
+@@ -470,17 +470,21 @@ int pkgroup_idx_update_rpmhdr(struct pkgroup_idx *idx, void *rpmhdr)
+     DBGF("ngroups %d, %d\n", ngroups, n_array_size(langs));
+     for (i=0; i < ngroups; i++) {
+-        const char *lang = n_array_nth(langs, i);
+-        DBGF("   gr[%d of %d] %s\n", i, ngroups, groups[i]);
+-        
+-        if (n_str_eq(lang, "C")) {
+-            if ((gr = n_hash_get(idx->ht, groups[i])) == NULL) {
+-                gr = pkgroup_new(n_array_size(idx->arr) + 1, groups[i]);
+-                n_array_push(idx->arr, gr);
+-                n_hash_insert(idx->ht, gr->name, gr);
+-            }
+-            break;
++      const char *lang = n_array_nth(langs, i);
++      
++      const char *grp = groups;
++      if (ngroups > 1) grp = groups[i];
++      
++      DBGF("   gr[%d of %d] %s\n", i, ngroups, grp);
++      
++      if (n_str_eq(lang, "C")) {
++        if ((gr = n_hash_get(idx->ht, grp)) == NULL) {
++          gr = pkgroup_new(n_array_size(idx->arr) + 1, grp);
++          n_array_push(idx->arr, gr);
++          n_hash_insert(idx->ht, gr->name, gr);
+         }
++        break;
++      }
+     }
+     if (gr != NULL) {
+commit 810280a1e3be737bf074b536c414eadbb0f38596
 Author: Bartlomiej Zimon <uzi18@o2.pl>
-Date:   Wed Mar 21 01:48:26 2012 +0100
+Date:   Thu Jan 3 22:48:28 2013 +0100
 
-    - pndir update: realy keep quiet
+    - fix LP#966972: adding repo to group from repo config
+      https://bugs.launchpad.net/poldek/+bug/966972
     
     Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
 
-diff --git a/pkgdir/pndir/update.c b/pkgdir/pndir/update.c
-index 830356a..c26fe9f 100644
---- a/pkgdir/pndir/update.c
-+++ b/pkgdir/pndir/update.c
-@@ -289,8 +289,7 @@ int pndir_m_update(struct pkgdir *pkgdir, enum pkgdir_uprc *uprc)
-     pidxpath += 6;
-     // to keep quiet vf_stat
--    if (poldek_VERBOSE < 2)
--        vfile_configure(VFILE_CONF_VERBOSE, &poldek_VERBOSE);
-+    vfile_configure(VFILE_CONF_VERBOSE, 0);
+diff --git a/doc/poldek.conf.xml b/doc/poldek.conf.xml
+index aae8091..7ecf678 100644
+--- a/doc/poldek.conf.xml
++++ b/doc/poldek.conf.xml
+@@ -525,6 +525,12 @@ Every repository is configured in its own [ source ] section.
+     </description>
+   </option>
++  <option name="group" type="string" value="">
++    <description>
++    Group name of the repositories group.
++    </description>
++  </option>
++
+   <option name="type" type="string" required="yes" value="pndir">
+     <description>
+     Type of repository index. Permitted values are 'pndir', 'pdir', 'apt', 'yum'
+diff --git a/lib_init.c b/lib_init.c
+index ff9a270..92d9163 100644
+--- a/lib_init.c
++++ b/lib_init.c
+@@ -269,7 +269,7 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
+         struct source *s = n_array_nth(srcs_named, i);
+         for (j=0; j < n_array_size(htcnf_sources); j++) {
+-            const char *name, *type;
++            const char *name, *type, *grp;
+             tn_hash *ht;
+             ht = n_array_nth(htcnf_sources, j);
+@@ -278,8 +278,9 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
+                 continue;
+             
+             type = poldek_conf_get(ht, "type", NULL);
++            grp = poldek_conf_get(ht, "group", NULL);
+             /* skip not "group" */
+-            if (type == NULL || n_str_ne(type, source_TYPE_GROUP)) { 
++            if ((type == NULL || n_str_ne(type, source_TYPE_GROUP)) && !grp) {
+                 isgroup_matches[j] = 1;
+                 continue;
+             }
+@@ -287,26 +288,35 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
+             name = poldek_conf_get(ht, "name", NULL);
+             n_assert(name);
+-            if (htcnf_matches[j] == 0 && fnmatch(s->name, name, 0) == 0) {
+-                tn_array *names;
+-                int ii;
+-                
+-                names = poldek_conf_get_multi(ht, "sources");
+-                n_assert(names);
+-                
+-                for (ii=0; ii < n_array_size(names); ii++) {
+-                    struct source *src = source_new(n_array_nth(names, ii), NULL, NULL, NULL);
+-                    DBGF("%s -> %s\n", s->name, n_array_nth(names, ii));
+-                    src->no = s->no + 1 + ii; /* XXX: hope we fit (see sources_add()) */
+-                    n_array_push(sources, src);
++            if (!grp) { // old groups
++                if (htcnf_matches[j] == 0 && fnmatch(s->name, name, 0) == 0) {
++                    tn_array *names;
++                    int ii;
++
++                    names = poldek_conf_get_multi(ht, "sources");
++                    n_assert(names);
++
++                    for (ii=0; ii < n_array_size(names); ii++) {
++                        struct source *src = source_new(n_array_nth(names, ii), NULL, NULL, NULL);
++                        DBGF("%s -> %s\n", s->name, n_array_nth(names, ii));
++                        printf("%s -> %s\n", s->name, n_array_nth(names, ii));
++                        src->no = s->no + 1 + ii; /* XXX: hope we fit (see sources_add()) */
++                        n_array_push(sources, src);
++                    }
++                    n_hash_replace(expanded_h, s->name, NULL);
++                    htcnf_matches[j] = 1;
+                 }
++            } else if (fnmatch(s->name, grp, 0) == 0) { // new groups
++                struct source *src = source_new(name, NULL, NULL, NULL);
++                src->no = s->no + 1;
++                n_array_push(sources, src);
+                 n_hash_replace(expanded_h, s->name, NULL);
+-                htcnf_matches[j] = 1;
+             }
+         }
+         
+         n_array_push(sources, source_link(s));
+     }
++
+ #if ENABLE_TRACE
+     for (i=0; i < n_array_size(sources); i++) {
+         struct source *s = n_array_nth(sources, i);
+@@ -349,6 +359,9 @@ static int source_to_htconf(struct source *src, int no, tn_hash *htcnf)
      
-     snprintf(path, sizeof(path), "%s.ndir.%s",
-            pkgdir->idxpath, pidxpath);
+     if (src->flags & PKGSOURCE_NOAUTO)
+         poldek_conf_add_to_section(sect, "auto", "no");
++
++    if (src->flags & PKGSOURCE_GROUP && src->group)
++        poldek_conf_add_to_section(sect, "group", src->group);
+     
+     if (src->flags & PKGSOURCE_NOAUTOUP)
+         poldek_conf_add_to_section(sect, "autoup", "no");
+@@ -438,7 +451,7 @@ static int get_conf_sources(struct poldek_ctx *ctx, tn_array *sources,
+                 source_free(src);
+         }
+     }
+-    
++
+     for (i=0; i < n_array_size(srcs_named); i++) {
+         struct source *src = n_array_nth(srcs_named, i);
+         if (matches == NULL ||
+diff --git a/pkgdir/source.c b/pkgdir/source.c
+index 894519a..a0b2f57 100644
+--- a/pkgdir/source.c
++++ b/pkgdir/source.c
+@@ -73,6 +73,8 @@ static struct src_option source_options[] = {
+                      PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
+     { "lang",     0, PKGSOURCE_DSCR |
+                      PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
++    { "group",    0, PKGSOURCE_GROUP |
++                     PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
+     { "pri",      0, PKGSOURCE_PRI | PKGSRC_OPTION_SUBOPT, NULL},
+     { "compress", 0, PKGSOURCE_COMPRESS |
+                      PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
+@@ -121,6 +123,10 @@ unsigned get_subopt(struct source *src, struct src_option *opt,
+         src->dscr = n_strdup(str);
+         v = 1;
++    } else if (opt->flag & PKGSOURCE_GROUP) {
++        src->group = n_strdup(str);
++        v = 1;
++
+     } else if (opt->flag & PKGSOURCE_COMPRESS) {
+         src->compress = n_strdup(str);
+         v = 1;
+@@ -131,7 +137,6 @@ unsigned get_subopt(struct source *src, struct src_option *opt,
+             v = 1;
+         }
+     }
+-    
+     if (v == 0)
+         logn(LOGWARN, _("%s%sinvalid value ('%s') for option '%s'"),
+@@ -162,7 +167,7 @@ struct source *source_malloc(void)
+     src->no = 0;
+     //src->flags |= PKGSOURCE_PRI;
+     src->name = src->path = src->pkg_prefix = NULL;
+-    src->dscr = src->type = NULL;
++    src->group = src->dscr = src->type = NULL;
+     src->lc_lang = NULL;
+     src->_refcnt = 0;
+     src->exclude_path = n_array_new(4, free, (tn_fn_cmp)strcmp);
+@@ -197,6 +202,7 @@ struct source *source_clone(const struct source *src)
+     cp_str_ifnotnull(&nsrc->compress, src->compress);
+     cp_str_ifnotnull(&nsrc->dscr, src->dscr);
++    cp_str_ifnotnull(&nsrc->group, src->group);
+     cp_str_ifnotnull(&nsrc->lc_lang, src->lc_lang);
+     cp_str_ifnotnull(&nsrc->original_type, src->original_type);
+@@ -224,6 +230,7 @@ void source_free(struct source *src)
+     n_cfree(&src->compress);
+     n_cfree(&src->dscr);
++    n_cfree(&src->group);
+     n_cfree(&src->lc_lang);
+     n_cfree(&src->original_type);
+@@ -585,6 +592,9 @@ struct source *source_new_htcnf(const tn_hash *htcnf)
+     if ((vs = poldek_conf_get(htcnf, "lang", NULL)))
+         n += n_snprintf(&spec[n], sizeof(spec) - n, ",lang=%s", vs);
++    if ((vs = poldek_conf_get(htcnf, "group", NULL)))
++        n += n_snprintf(&spec[n], sizeof(spec) - n, ",group=%s", vs);
++
+     vs = poldek_conf_get(htcnf, "path", NULL);
+     if (vs == NULL)
+         vs = poldek_conf_get(htcnf, "url", NULL);
+@@ -781,6 +791,13 @@ int source_snprintf_flags(char *str, int size, const struct source *src)
+                 n += n_snprintf(&str[n], size - n, "=%s,", src->type);
+             }
++        } else if ((opt->flag & PKGSOURCE_GROUP)) {
++            if (src->type) {
++                n += poldek_term_snprintf_c(PRCOLOR_GREEN, &str[n], size - n,
++                                            "%s", opt->name);
++                n += n_snprintf(&str[n], size - n, "=%s,", src->group);
++            }
++
+         } else if ((opt->flag & PKGSOURCE_DSCR)) {
+             if (src->dscr) {
+                 n += poldek_term_snprintf_c(PRCOLOR_GREEN, &str[n], size - n,
+@@ -788,7 +805,6 @@ int source_snprintf_flags(char *str, int size, const struct source *src)
+                 n += n_snprintf(&str[n], size - n, "=%s,", src->dscr);
+             }
+-
+         } else {
+             int j = 0;
+             
+diff --git a/pkgdir/source.h b/pkgdir/source.h
+index 32e4781..86e823a 100644
+--- a/pkgdir/source.h
++++ b/pkgdir/source.h
+@@ -31,6 +31,7 @@ EXPORT const char source_TYPE_GROUP[]; /* "group" */
+ #define PKGSOURCE_TYPE       (1 << 5)
+ #define PKGSOURCE_PRI        (1 << 6)
+ #define PKGSOURCE_DSCR       (1 << 7)
++#define PKGSOURCE_GROUP      (1 << 9)
+ #define PKGSOURCE_NAMED      (1 << 10)
+ #define PKGSOURCE_COMPRESS   (1 << 11)
+ #define PKGSOURCE_NODESC     (1 << 12)
+@@ -56,6 +57,7 @@ struct source {
+     char      *original_type;   /* type of source repo for this source  */
+     unsigned  subopt_flags;
+     int       _refcnt;
++    char      *group;
+ };
+ EXPORT struct source *source_malloc(void);
+commit 3396184bdbf036adabf0440ea6a67726dbbb347b
+Author: Marcin Banasiak <marcin.banasiak@gmail.com>
+Date:   Sat Nov 17 15:10:33 2012 +0100
+
+    Control rpm's _check_dirname_deps via "auto directory dependencies" config option
+
+diff --git a/pm/rpm/rpminstall.c b/pm/rpm/rpminstall.c
+index 9a40768..c128216 100644
+--- a/pm/rpm/rpminstall.c
++++ b/pm/rpm/rpminstall.c
+@@ -371,6 +371,12 @@ int pm_rpm_packages_install(struct pkgdb *db, const tn_array *pkgs,
+     argv[nargs++] = "--noorder";    /* packages always ordered by me */
+ #endif
++    argv[nargs++] = "--define";
++    if (ts->getop(ts, POLDEK_OP_AUTODIRDEP))
++        argv[nargs++] = "_check_dirname_deps 1";
++    else
++        argv[nargs++] = "_check_dirname_deps 0";
++
+     if (ts->rpmacros) 
+         for (i=0; i<n_array_size(ts->rpmacros); i++) {
+             argv[nargs++] = "--define";
+commit 7c0eccdfcb64e0acc35d59cde376925eb23235e9
+Author: Marcin Banasiak <marcin.banasiak@gmail.com>
+Date:   Sun Oct 7 14:23:53 2012 +0200
+
+    homepage: fix repository address
+
+diff --git a/doc/homepage/devel-body.html b/doc/homepage/devel-body.html
+index c1b94fa..c0d98c8 100644
+--- a/doc/homepage/devel-body.html
++++ b/doc/homepage/devel-body.html
+@@ -1,12 +1,11 @@
+-<h2> Anonymous CVS </h2>
+-<p>Getting the module (no password is needed):</p>
++<h2>Anonymous GIT</h2>
++<p>Getting the repository:</p>
+ <pre class="screen">
+-$ cvs -d :pserver:cvs@anoncvs.pld-linux.org:/cvsroot login
+-$ cvs -d :pserver:cvs@anoncvs.pld-linux.org:/cvsroot co poldek
++$ git clone git://gitorious.org/poldek/poldek.git
+ </pre>
+ <p>            
+ Particular files may be accessed via 
+-<a href="http://cvs.pld-linux.org/poldek/">CVSWeb</a>
++<a href="http://gitorious.org/poldek/">Gitorious interface</a>
+ <p>
This page took 0.09755 seconds and 4 git commands to generate.