1 commit 2f6b86835cbbad530f838bcf5d3e183f92eb3396
2 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
3 Date: Thu Sep 27 17:44:19 2012 +0200
5 Change the way how / is stored in dirindex
7 Previously, / was stored in dirindex with leading slash (i.e. as //)
8 what caused various side effects as:
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
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)
21 int i, size = n_array_size(arr);
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);
28 + n_buf_printf(nbuf, "%s%s%s", *dirname != '/' ? "/" : "",
29 + dirname, i < size - 1 ? sep : "");
35 @@ -179,7 +183,8 @@ static int store_from_previous(uint32_t package_no, struct pkg *pkg, struct tndb
38 const char *dir = *tl;
39 - dir = dir + 1; /* skip '/' */
41 + dir = dir + 1; /* skip '/' only when strlen(dir) > 1 */
42 add_to_path_index(path_index, dir, package_no);
45 @@ -238,15 +243,13 @@ void store_package(uint32_t package_no, struct pkg *pkg, struct tndb *db,
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));
57 - n_buf_printf(nbuf, "/"); /* prefix all by '/' */
58 - nbuf = dirarray_join(nbuf, owned, ":/");
59 + nbuf = dirarray_join(nbuf, owned, ":");
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);
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 ? ":" : "");
76 DBGF(" dir %s %s\n", path, (char*)n_buf_ptr(nbuf));
78 @@ -774,11 +781,11 @@ tn_array *get_package_directories_as_array(const struct pkgdir *pkgdir,
80 dirs = n_array_new(n, free, (tn_fn_cmp)strcmp);
84 n_array_push(dirs, n_strdup(*tl));
89 n_str_tokl_free(tl_save);
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;
97 + if (*path == '/' && path[1] != '\0')
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,
103 DBGF("%s %s\n", pkg_id(pkg), path);
106 + if (*path == '/' && path[1] != '\0')
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
114 Provide function body for inlined pkg_id
116 diff --git a/pkg.c b/pkg.c
117 index 6e83694..227fe14 100644
120 @@ -1463,11 +1463,6 @@ struct pkg *pkg_link(struct pkg *pkg)
124 -const char *pkg_id(const struct pkg *p)
129 int pkg_id_snprintf(char *str, size_t size, const struct pkg *pkg)
131 return n_snprintf(str, size, "%s", pkg_id(pkg));
132 diff --git a/pkg.h b/pkg.h
133 index f0d71ac..ec6cc6d 100644
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);
140 -EXPORT extern__inline const char *pkg_id(const struct pkg *p);
141 +static inline const char *pkg_id(const struct pkg *p)
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);
149 commit ce00c5a5311fb6d77fcf96b04bca5cf2904d90ae
150 Author: Marcin Banasiak <marcin.banasiak@gmail.com>
151 Date: Sun Oct 7 12:46:36 2012 +0200
153 Kill redundant EXPORT in pm.h
155 diff --git a/pm/pm.h b/pm/pm.h
156 index 9913168..a20c305 100644
159 @@ -204,7 +204,7 @@ EXPORT int pm_get_dbdepdirs(struct pm_ctx *ctx,
161 EXPORT struct pkg *pm_load_package(struct pm_ctx *ctx,
162 tn_alloc *na, const char *path, unsigned ldflags);
163 -EXPORT 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
172 - fix LP#1077603 - poldek make indexes crash for subpackage without Group
173 https://bugs.launchpad.net/poldek/+bug/1077603
175 Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
177 diff --git a/pkgroup.c b/pkgroup.c
178 index cd8bf4d..9fdeaf9 100644
181 @@ -470,17 +470,21 @@ int pkgroup_idx_update_rpmhdr(struct pkgroup_idx *idx, void *rpmhdr)
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]);
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);
195 + const char *lang = n_array_nth(langs, i);
197 + const char *grp = groups;
198 + if (ngroups > 1) grp = groups[i];
200 + DBGF(" gr[%d of %d] %s\n", i, ngroups, grp);
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);
213 commit 810280a1e3be737bf074b536c414eadbb0f38596
214 Author: Bartlomiej Zimon <uzi18@o2.pl>
215 Date: Thu Jan 3 22:48:28 2013 +0100
217 - fix LP#966972: adding repo to group from repo config
218 https://bugs.launchpad.net/poldek/+bug/966972
220 Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
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.
230 + <option name="group" type="string" value="">
232 + Group name of the repositories group.
236 <option name="type" type="string" required="yes" value="pndir">
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
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);
246 for (j=0; j < n_array_size(htcnf_sources); j++) {
247 - const char *name, *type;
248 + const char *name, *type, *grp;
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,
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;
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);
267 - if (htcnf_matches[j] == 0 && fnmatch(s->name, name, 0) == 0) {
271 - names = poldek_conf_get_multi(ht, "sources");
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) {
284 + names = poldek_conf_get_multi(ht, "sources");
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);
294 + n_hash_replace(expanded_h, s->name, NULL);
295 + htcnf_matches[j] = 1;
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;
306 n_array_push(sources, source_link(s));
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)
314 if (src->flags & PKGSOURCE_NOAUTO)
315 poldek_conf_add_to_section(sect, "auto", "no");
317 + if (src->flags & PKGSOURCE_GROUP && src->group)
318 + poldek_conf_add_to_section(sect, "group", src->group);
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,
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);
348 + } else if (opt->flag & PKGSOURCE_GROUP) {
349 + src->group = n_strdup(str);
352 } else if (opt->flag & PKGSOURCE_COMPRESS) {
353 src->compress = n_strdup(str);
355 @@ -131,7 +137,6 @@ unsigned get_subopt(struct source *src, struct src_option *opt,
362 logn(LOGWARN, _("%s%sinvalid value ('%s') for option '%s'"),
363 @@ -162,7 +167,7 @@ struct source *source_malloc(void)
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;
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);
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);
380 @@ -224,6 +230,7 @@ void source_free(struct source *src)
382 n_cfree(&src->compress);
384 + n_cfree(&src->group);
385 n_cfree(&src->lc_lang);
386 n_cfree(&src->original_type);
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);
392 + if ((vs = poldek_conf_get(htcnf, "group", NULL)))
393 + n += n_snprintf(&spec[n], sizeof(spec) - n, ",group=%s", vs);
395 vs = poldek_conf_get(htcnf, "path", 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);
402 + } else if ((opt->flag & PKGSOURCE_GROUP)) {
404 + n += poldek_term_snprintf_c(PRCOLOR_GREEN, &str[n], size - n,
406 + n += n_snprintf(&str[n], size - n, "=%s,", src->group);
409 } else if ((opt->flag & PKGSOURCE_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);
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;
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
444 Control rpm's _check_dirname_deps via "auto directory dependencies" config option
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 */
454 + argv[nargs++] = "--define";
455 + if (ts->getop(ts, POLDEK_OP_AUTODIRDEP))
456 + argv[nargs++] = "_check_dirname_deps 1";
458 + argv[nargs++] = "_check_dirname_deps 0";
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
467 homepage: fix repository address
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
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>
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
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>
490 commit 4ae50361fe21302e22e50b0f8df4284cd0ec930b
491 Author: Bartlomiej Zimon <uzi18@o2.pl>
492 Date: Fri Mar 8 19:21:21 2013 +0100
494 - proper type for size of read()
496 http://lists.pld-linux.org/mailman/pipermail/pld-devel-pl/2013-March/156262.html
498 Signed-off-by: Bartlomiej Zimon <uzi18@o2.pl>
500 diff --git a/tndb/write.c b/tndb/write.c
501 index 7b992b1..e1edfb6 100644
504 @@ -178,7 +178,7 @@ static uint32_t htt_store_size(struct tndb *db)
506 static int htt_write(struct tndb *db)
510 uint32_t data_offs, htt_size, ht_offs;
512 n_assert((db->hdr.flags & TNDB_NOHASH) == 0);
513 @@ -263,7 +263,7 @@ static int htt_compute_digest(struct tndb *db)
515 static int tndbw_close(struct tndb *db)
517 - unsigned int nread, ntotal;
518 + ssize_t nread, ntotal;
520 int fdin = -1, fdout = -1, type, rc;