]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-git.patch
- rel 6: add upstream patches
[packages/poldek.git] / poldek-git.patch
1 commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396
2 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
3 Date:   Thu Sep 27 17:44:19 2012 +0200
4
5     Change the way how / is stored in dirindex
6     
7     Previously, / was stored in dirindex with leading slash (i.e. as //)
8     what caused various side effects as:
9     
10     filesystem-4.0-12.x86_64 obsoleted by filesystem-4.0-13.x86_64
11     filesystem-4.0-13.x86_64 marks FHS-2.3-35.x86_64 (cap //)
12     error: FHS-2.3-35.x86_64: equal version installed, give up
13
14 diff --git a/pkgdir/pkgdir_dirindex.c b/pkgdir/pkgdir_dirindex.c
15 index a6f422f..abfd05c 100644
16 --- a/pkgdir/pkgdir_dirindex.c
17 +++ b/pkgdir/pkgdir_dirindex.c
18 @@ -103,10 +103,14 @@ static int package_key(char *key, int size, const struct pkg *pkg, int prefix)
19  static tn_buf *dirarray_join(tn_buf *nbuf, tn_array *arr, char *sep)
20  {
21      int i, size = n_array_size(arr);
22 +
23      for (i=0; i < size; i++) {
24 -        n_buf_printf(nbuf, "%s%s", (char*)n_array_nth(arr, i),
25 -                     i < size - 1 ? sep : "");
26 +        const char *dirname = n_array_nth(arr, i);
27 +    
28 +        n_buf_printf(nbuf, "%s%s%s", *dirname != '/' ? "/" : "",
29 +                    dirname, i < size - 1 ? sep : "");
30      }
31 +
32      return nbuf;
33  }
34  
35 @@ -179,7 +183,8 @@ static int store_from_previous(uint32_t package_no, struct pkg *pkg, struct tndb
36  
37      while (*tl) {
38          const char *dir = *tl;
39 -        dir = dir + 1; /* skip '/' */
40 +        if (dir[1] != '\0')
41 +           dir = dir + 1; /* skip '/' only when strlen(dir) > 1 */
42          add_to_path_index(path_index, dir, package_no);
43          tl++;
44      }
45 @@ -238,15 +243,13 @@ void store_package(uint32_t package_no, struct pkg *pkg, struct tndb *db,
46  
47          if (required) {
48              n_buf_clean(nbuf);
49 -            n_buf_printf(nbuf, "/"); /* prefix all by '/' */
50 -            nbuf = dirarray_join(nbuf, required, ":/");
51 +            nbuf = dirarray_join(nbuf, required, ":");
52              tndb_put(db, key, klen, n_buf_ptr(nbuf), n_buf_size(nbuf));
53          }
54  
55          if (owned) {
56              n_buf_clean(nbuf);
57 -            n_buf_printf(nbuf, "/"); /* prefix all by '/' */
58 -            nbuf = dirarray_join(nbuf, owned, ":/");
59 +            nbuf = dirarray_join(nbuf, owned, ":");
60  
61              /* ugly, but what for another package_key() call */
62              key[1] = PREFIX_PKGKEY_OWNDIR; 
63 @@ -323,9 +326,13 @@ static int dirindex_create(const struct pkgdir *pkgdir, const char *path,
64      for (i=0; i < n_array_size(directories); i++) {
65          const char *path = n_array_nth(directories, i);
66          tn_array *ids = n_hash_get(path_index, path);
67 +        int j;
68  
69          n_buf_clean(nbuf);
70 -        nbuf = dirarray_join(nbuf, ids, ":");
71 +        for (j = 0; j < n_array_size(ids); j++) {
72 +           n_buf_printf(nbuf, "%s%s", (char *)n_array_nth(ids, j),
73 +                                      j < n_array_size(ids) - 1 ? ":" : "");
74 +        }
75          
76          DBGF("  dir %s %s\n", path, (char*)n_buf_ptr(nbuf));
77          
78 @@ -774,11 +781,11 @@ tn_array *get_package_directories_as_array(const struct pkgdir *pkgdir,
79          
80      dirs = n_array_new(n, free, (tn_fn_cmp)strcmp);
81      while (*tl) {
82 -        if (**tl) 
83 +        if (**tl)
84              n_array_push(dirs, n_strdup(*tl));
85          tl++;
86      }
87 -
88 +    
89      n_str_tokl_free(tl_save);
90      n_free(val);
91  
92 @@ -809,7 +816,7 @@ static tn_array *do_dirindex_get(const struct pkgdir_dirindex *dirindex,
93      unsigned char val[8192];
94      int           n, found, pkgs_passsed = 1;
95  
96 -    if (*path == '/')
97 +    if (*path == '/' && path[1] != '\0')
98          path++;
99      
100      if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
101 @@ -877,7 +884,7 @@ int pkgdir_dirindex_pkg_has_path(const struct pkgdir *pkgdir,
102      
103      DBGF("%s %s\n", pkg_id(pkg), path);
104      
105 -    if (*path == '/')
106 +    if (*path == '/' && path[1] != '\0')
107          path++;
108  
109      if (!tndb_get_str(dirindex->db, path, val, sizeof(val)))
110 commit f575c9bbe3cdd8f2d6ef27eb73dcc270c1a8a3f2
111 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
112 Date:   Sun Oct 7 12:41:42 2012 +0200
113
114     Provide function body for inlined pkg_id
115
116 diff --git a/pkg.c b/pkg.c
117 index 6e83694..227fe14 100644
118 --- a/pkg.c
119 +++ b/pkg.c
120 @@ -1463,11 +1463,6 @@ struct pkg *pkg_link(struct pkg *pkg)
121      return pkg;
122  }
123  
124 -const char *pkg_id(const struct pkg *p) 
125 -{
126 -    return p->_nvr;
127 -}
128 -
129  int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg)
130  {
131      return n_snprintf(str, size, "%s", pkg_id(pkg));
132 diff --git a/pkg.h b/pkg.h
133 index f0d71ac..ec6cc6d 100644
134 --- a/pkg.h
135 +++ b/pkg.h
136 @@ -231,7 +231,11 @@ EXPORT const char *pkg_pkgdirpath(const struct pkg *pkg);
137  EXPORT unsigned pkg_file_url_type(const struct pkg *pkg);
138  
139  
140 -EXPORT extern__inline const char *pkg_id(const struct pkg *p);
141 +static inline const char *pkg_id(const struct pkg *p)
142 +{
143 +    return p->_nvr;
144 +}
145 +
146  EXPORT int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg);
147  EXPORT int pkg_idevr_snprintf(char *str, size_t size, const struct pkg *pkg);
148  
149 commit ce00c5a5311fb6d77fcf96b04bca5cf2904d90ae
150 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
151 Date:   Sun Oct 7 12:46:36 2012 +0200
152
153     Kill redundant EXPORT in pm.h
154
155 diff --git a/pm/pm.h b/pm/pm.h
156 index 9913168..a20c305 100644
157 --- a/pm/pm.h
158 +++ b/pm/pm.h
159 @@ -204,7 +204,7 @@ EXPORT int pm_get_dbdepdirs(struct pm_ctx *ctx,
160  
161  EXPORT struct pkg *pm_load_package(struct pm_ctx *ctx,
162                              tn_alloc *na, const char *path, unsigned ldflags);
163 -EXPORT struct pkgdir;
164 +struct pkgdir;
165  EXPORT struct pkgdir *pkgdb_to_pkgdir(struct pm_ctx *ctx, const char *rootdir,
166                                 const char *path, unsigned pkgdir_ldflags,
167                                 const char *key, ...);
168 commit a6f68bc7fe9305d4988e69c1d3166b1a4585b8f7
169 Author: Bartlomiej Zimon <uzi18@o2.pl>
170 Date:   Thu Jan 3 22:44:11 2013 +0100
171
172     - fix LP#1077603 - poldek make indexes crash for subpackage without Group
173       https://bugs.launchpad.net/poldek/+bug/1077603
174     
175     Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
176
177 diff --git a/pkgroup.c b/pkgroup.c
178 index cd8bf4d..9fdeaf9 100644
179 --- a/pkgroup.c
180 +++ b/pkgroup.c
181 @@ -470,17 +470,21 @@ int pkgroup_idx_update_rpmhdr(struct pkgroup_idx *idx, void *rpmhdr)
182  
183      DBGF("ngroups %d, %d\n", ngroups, n_array_size(langs));
184      for (i=0; i < ngroups; i++) {
185 -        const char *lang = n_array_nth(langs, i);
186 -        DBGF("   gr[%d of %d] %s\n", i, ngroups, groups[i]);
187 -        
188 -        if (n_str_eq(lang, "C")) {
189 -            if ((gr = n_hash_get(idx->ht, groups[i])) == NULL) {
190 -                gr = pkgroup_new(n_array_size(idx->arr) + 1, groups[i]);
191 -                n_array_push(idx->arr, gr);
192 -                n_hash_insert(idx->ht, gr->name, gr);
193 -            }
194 -            break;
195 +      const char *lang = n_array_nth(langs, i);
196 +      
197 +      const char *grp = groups;
198 +      if (ngroups > 1) grp = groups[i];
199 +      
200 +      DBGF("   gr[%d of %d] %s\n", i, ngroups, grp);
201 +      
202 +      if (n_str_eq(lang, "C")) {
203 +        if ((gr = n_hash_get(idx->ht, grp)) == NULL) {
204 +          gr = pkgroup_new(n_array_size(idx->arr) + 1, grp);
205 +          n_array_push(idx->arr, gr);
206 +          n_hash_insert(idx->ht, gr->name, gr);
207          }
208 +        break;
209 +      }
210      }
211  
212      if (gr != NULL) {
213 commit 810280a1e3be737bf074b536c414eadbb0f38596
214 Author: Bartlomiej Zimon <uzi18@o2.pl>
215 Date:   Thu Jan 3 22:48:28 2013 +0100
216
217     - fix LP#966972: adding repo to group from repo config
218       https://bugs.launchpad.net/poldek/+bug/966972
219     
220     Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
221
222 diff --git a/doc/poldek.conf.xml b/doc/poldek.conf.xml
223 index aae8091..7ecf678 100644
224 --- a/doc/poldek.conf.xml
225 +++ b/doc/poldek.conf.xml
226 @@ -525,6 +525,12 @@ Every repository is configured in its own [ source ] section.
227      </description>
228    </option>
229  
230 +  <option name="group" type="string" value="">
231 +    <description>
232 +    Group name of the repositories group.
233 +    </description>
234 +  </option>
235 +
236    <option name="type" type="string" required="yes" value="pndir">
237      <description>
238      Type of repository index. Permitted values are 'pndir', 'pdir', 'apt', 'yum'
239 diff --git a/lib_init.c b/lib_init.c
240 index ff9a270..92d9163 100644
241 --- a/lib_init.c
242 +++ b/lib_init.c
243 @@ -269,7 +269,7 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
244          struct source *s = n_array_nth(srcs_named, i);
245  
246          for (j=0; j < n_array_size(htcnf_sources); j++) {
247 -            const char *name, *type;
248 +            const char *name, *type, *grp;
249              tn_hash *ht;
250  
251              ht = n_array_nth(htcnf_sources, j);
252 @@ -278,8 +278,9 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
253                  continue;
254              
255              type = poldek_conf_get(ht, "type", NULL);
256 +            grp = poldek_conf_get(ht, "group", NULL);
257              /* skip not "group" */
258 -            if (type == NULL || n_str_ne(type, source_TYPE_GROUP)) { 
259 +            if ((type == NULL || n_str_ne(type, source_TYPE_GROUP)) && !grp) {
260                  isgroup_matches[j] = 1;
261                  continue;
262              }
263 @@ -287,26 +288,35 @@ tn_array *expand_sources_group(tn_array *srcs_named, tn_array *htcnf_sources,
264              name = poldek_conf_get(ht, "name", NULL);
265              n_assert(name);
266  
267 -            if (htcnf_matches[j] == 0 && fnmatch(s->name, name, 0) == 0) {
268 -                tn_array *names;
269 -                int ii;
270 -                
271 -                names = poldek_conf_get_multi(ht, "sources");
272 -                n_assert(names);
273 -                
274 -                for (ii=0; ii < n_array_size(names); ii++) {
275 -                    struct source *src = source_new(n_array_nth(names, ii), NULL, NULL, NULL);
276 -                    DBGF("%s -> %s\n", s->name, n_array_nth(names, ii));
277 -                    src->no = s->no + 1 + ii; /* XXX: hope we fit (see sources_add()) */
278 -                    n_array_push(sources, src);
279 +            if (!grp) { // old groups
280 +                if (htcnf_matches[j] == 0 && fnmatch(s->name, name, 0) == 0) {
281 +                    tn_array *names;
282 +                    int ii;
283 +
284 +                    names = poldek_conf_get_multi(ht, "sources");
285 +                    n_assert(names);
286 +
287 +                    for (ii=0; ii < n_array_size(names); ii++) {
288 +                        struct source *src = source_new(n_array_nth(names, ii), NULL, NULL, NULL);
289 +                        DBGF("%s -> %s\n", s->name, n_array_nth(names, ii));
290 +                        printf("%s -> %s\n", s->name, n_array_nth(names, ii));
291 +                        src->no = s->no + 1 + ii; /* XXX: hope we fit (see sources_add()) */
292 +                        n_array_push(sources, src);
293 +                    }
294 +                    n_hash_replace(expanded_h, s->name, NULL);
295 +                    htcnf_matches[j] = 1;
296                  }
297 +            } else if (fnmatch(s->name, grp, 0) == 0) { // new groups
298 +                struct source *src = source_new(name, NULL, NULL, NULL);
299 +                src->no = s->no + 1;
300 +                n_array_push(sources, src);
301                  n_hash_replace(expanded_h, s->name, NULL);
302 -                htcnf_matches[j] = 1;
303              }
304          }
305          
306          n_array_push(sources, source_link(s));
307      }
308 +
309  #if ENABLE_TRACE
310      for (i=0; i < n_array_size(sources); i++) {
311          struct source *s = n_array_nth(sources, i);
312 @@ -349,6 +359,9 @@ static int source_to_htconf(struct source *src, int no, tn_hash *htcnf)
313      
314      if (src->flags & PKGSOURCE_NOAUTO)
315          poldek_conf_add_to_section(sect, "auto", "no");
316 +
317 +    if (src->flags & PKGSOURCE_GROUP && src->group)
318 +        poldek_conf_add_to_section(sect, "group", src->group);
319      
320      if (src->flags & PKGSOURCE_NOAUTOUP)
321          poldek_conf_add_to_section(sect, "autoup", "no");
322 @@ -438,7 +451,7 @@ static int get_conf_sources(struct poldek_ctx *ctx, tn_array *sources,
323                  source_free(src);
324          }
325      }
326 -    
327 +
328      for (i=0; i < n_array_size(srcs_named); i++) {
329          struct source *src = n_array_nth(srcs_named, i);
330          if (matches == NULL ||
331 diff --git a/pkgdir/source.c b/pkgdir/source.c
332 index 894519a..a0b2f57 100644
333 --- a/pkgdir/source.c
334 +++ b/pkgdir/source.c
335 @@ -73,6 +73,8 @@ static struct src_option source_options[] = {
336                       PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
337      { "lang",     0, PKGSOURCE_DSCR |
338                       PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
339 +    { "group",    0, PKGSOURCE_GROUP |
340 +                     PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
341      { "pri",      0, PKGSOURCE_PRI | PKGSRC_OPTION_SUBOPT, NULL},
342      { "compress", 0, PKGSOURCE_COMPRESS |
343                       PKGSRC_OPTION_STRING | PKGSRC_OPTION_SUBOPT, NULL },
344 @@ -121,6 +123,10 @@ unsigned get_subopt(struct source *src, struct src_option *opt,
345          src->dscr = n_strdup(str);
346          v = 1;
347  
348 +    } else if (opt->flag & PKGSOURCE_GROUP) {
349 +        src->group = n_strdup(str);
350 +        v = 1;
351 +
352      } else if (opt->flag & PKGSOURCE_COMPRESS) {
353          src->compress = n_strdup(str);
354          v = 1;
355 @@ -131,7 +137,6 @@ unsigned get_subopt(struct source *src, struct src_option *opt,
356              v = 1;
357          }
358      }
359 -    
360  
361      if (v == 0)
362          logn(LOGWARN, _("%s%sinvalid value ('%s') for option '%s'"),
363 @@ -162,7 +167,7 @@ struct source *source_malloc(void)
364      src->no = 0;
365      //src->flags |= PKGSOURCE_PRI;
366      src->name = src->path = src->pkg_prefix = NULL;
367 -    src->dscr = src->type = NULL;
368 +    src->group = src->dscr = src->type = NULL;
369      src->lc_lang = NULL;
370      src->_refcnt = 0;
371      src->exclude_path = n_array_new(4, free, (tn_fn_cmp)strcmp);
372 @@ -197,6 +202,7 @@ struct source *source_clone(const struct source *src)
373      cp_str_ifnotnull(&nsrc->compress, src->compress);
374  
375      cp_str_ifnotnull(&nsrc->dscr, src->dscr);
376 +    cp_str_ifnotnull(&nsrc->group, src->group);
377      cp_str_ifnotnull(&nsrc->lc_lang, src->lc_lang);
378      cp_str_ifnotnull(&nsrc->original_type, src->original_type);
379  
380 @@ -224,6 +230,7 @@ void source_free(struct source *src)
381  
382      n_cfree(&src->compress);
383      n_cfree(&src->dscr);
384 +    n_cfree(&src->group);
385      n_cfree(&src->lc_lang);
386      n_cfree(&src->original_type);
387  
388 @@ -585,6 +592,9 @@ struct source *source_new_htcnf(const tn_hash *htcnf)
389      if ((vs = poldek_conf_get(htcnf, "lang", NULL)))
390          n += n_snprintf(&spec[n], sizeof(spec) - n, ",lang=%s", vs);
391  
392 +    if ((vs = poldek_conf_get(htcnf, "group", NULL)))
393 +        n += n_snprintf(&spec[n], sizeof(spec) - n, ",group=%s", vs);
394 +
395      vs = poldek_conf_get(htcnf, "path", NULL);
396      if (vs == NULL)
397          vs = poldek_conf_get(htcnf, "url", NULL);
398 @@ -781,6 +791,13 @@ int source_snprintf_flags(char *str, int size, const struct source *src)
399                  n += n_snprintf(&str[n], size - n, "=%s,", src->type);
400              }
401  
402 +        } else if ((opt->flag & PKGSOURCE_GROUP)) {
403 +            if (src->type) {
404 +                n += poldek_term_snprintf_c(PRCOLOR_GREEN, &str[n], size - n,
405 +                                            "%s", opt->name);
406 +                n += n_snprintf(&str[n], size - n, "=%s,", src->group);
407 +            }
408 +
409          } else if ((opt->flag & PKGSOURCE_DSCR)) {
410              if (src->dscr) {
411                  n += poldek_term_snprintf_c(PRCOLOR_GREEN, &str[n], size - n,
412 @@ -788,7 +805,6 @@ int source_snprintf_flags(char *str, int size, const struct source *src)
413                  n += n_snprintf(&str[n], size - n, "=%s,", src->dscr);
414              }
415  
416 -
417          } else {
418              int j = 0;
419              
420 diff --git a/pkgdir/source.h b/pkgdir/source.h
421 index 32e4781..86e823a 100644
422 --- a/pkgdir/source.h
423 +++ b/pkgdir/source.h
424 @@ -31,6 +31,7 @@ EXPORT const char source_TYPE_GROUP[]; /* "group" */
425  #define PKGSOURCE_TYPE       (1 << 5)
426  #define PKGSOURCE_PRI        (1 << 6)
427  #define PKGSOURCE_DSCR       (1 << 7)
428 +#define PKGSOURCE_GROUP      (1 << 9)
429  #define PKGSOURCE_NAMED      (1 << 10)
430  #define PKGSOURCE_COMPRESS   (1 << 11)
431  #define PKGSOURCE_NODESC     (1 << 12)
432 @@ -56,6 +57,7 @@ struct source {
433      char      *original_type;   /* type of source repo for this source  */
434      unsigned  subopt_flags;
435      int       _refcnt;
436 +    char      *group;
437  };
438  
439  EXPORT struct source *source_malloc(void);
440 commit 3396184bdbf036adabf0440ea6a67726dbbb347b
441 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
442 Date:   Sat Nov 17 15:10:33 2012 +0100
443
444     Control rpm's _check_dirname_deps via "auto directory dependencies" config option
445
446 diff --git a/pm/rpm/rpminstall.c b/pm/rpm/rpminstall.c
447 index 9a40768..c128216 100644
448 --- a/pm/rpm/rpminstall.c
449 +++ b/pm/rpm/rpminstall.c
450 @@ -371,6 +371,12 @@ int pm_rpm_packages_install(struct pkgdb *db, const tn_array *pkgs,
451      argv[nargs++] = "--noorder";    /* packages always ordered by me */
452  #endif
453  
454 +    argv[nargs++] = "--define";
455 +    if (ts->getop(ts, POLDEK_OP_AUTODIRDEP))
456 +        argv[nargs++] = "_check_dirname_deps 1";
457 +    else
458 +        argv[nargs++] = "_check_dirname_deps 0";
459 +
460      if (ts->rpmacros) 
461          for (i=0; i<n_array_size(ts->rpmacros); i++) {
462              argv[nargs++] = "--define";
463 commit 7c0eccdfcb64e0acc35d59cde376925eb23235e9
464 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
465 Date:   Sun Oct 7 14:23:53 2012 +0200
466
467     homepage: fix repository address
468
469 diff --git a/doc/homepage/devel-body.html b/doc/homepage/devel-body.html
470 index c1b94fa..c0d98c8 100644
471 --- a/doc/homepage/devel-body.html
472 +++ b/doc/homepage/devel-body.html
473 @@ -1,12 +1,11 @@
474 -<h2> Anonymous CVS </h2>
475 -<p>Getting the module (no password is needed):</p>
476 +<h2>Anonymous GIT</h2>
477 +<p>Getting the repository:</p>
478  <pre class="screen">
479 -$ cvs -d :pserver:cvs@anoncvs.pld-linux.org:/cvsroot login
480 -$ cvs -d :pserver:cvs@anoncvs.pld-linux.org:/cvsroot co poldek
481 +$ git clone git://gitorious.org/poldek/poldek.git
482  </pre>
483  
484  <p>            
485  Particular files may be accessed via 
486 -<a href="http://cvs.pld-linux.org/poldek/">CVSWeb</a>
487 +<a href="http://gitorious.org/poldek/">Gitorious interface</a>
488  <p>
489  
This page took 0.093699 seconds and 3 git commands to generate.