1 diff -urN poldek-0.20.org/arg_packages.c poldek-0.20/arg_packages.c
2 --- poldek-0.20.org/arg_packages.c 2005-10-07 21:00:16.000000000 +0200
3 +++ poldek-0.20/arg_packages.c 2006-07-26 20:25:54.027315250 +0200
17 +extern int poldek_conf_MULTILIB;
19 #define ARG_PACKAGES_SETUPDONE (1 << 0)
21 /* @VIRTUAL [DEFAULT_MASK [EVR]] */
23 // n_hash_size(aps->resolved_caps);
26 -#if 0 /* XXX: disabled, #5702 */
27 -/* tries to convert N-[E:]V-R to N#[E:]V-R */
28 -static char *mask2evrhashedmask(const char *mask)
30 - const char *name, *ver, *rel, *p;
31 - char nmask[1024], e[32] = "", *tmp;
35 - n_strdupap(mask, &tmp);
36 - if (!poldek_util_parse_nevr(tmp, &name, &epoch, &ver, &rel))
39 - p = ver; /* check if it is really version */
46 - if (*p == '\0') /* no digits => part of name propably */
50 - snprintf(e, sizeof(e), "%d:", epoch);
51 - n = n_snprintf(nmask, sizeof(nmask), "%s#%s%s-%s", name, e, ver, rel);
52 - return n_strdupl(nmask, n);
56 tn_array *arg_packages_get_masks(struct arg_packages *aps, int hashed)
61 masks = n_array_clone(aps->package_masks);
62 for (i=0; i < n_array_size(aps->package_masks); i++) {
65 - mask = n_array_nth(aps->package_masks, i);
66 - if (hashed && strchr(mask, '-') && strchr(mask, '*') == NULL) {
67 -#if 0 /* XXX: disabled so smart NEVR parsing, #5702 */
69 - if ((nmask = mask2evrhashedmask(mask)))
73 + const char *mask = n_array_nth(aps->package_masks, i);
74 n_array_push(masks, n_strdup(mask));
78 + hashed = 0; /* disabled for a while */
79 for (i=0; i < n_array_size(aps->packages); i++) {
80 struct pkg *pkg = n_array_nth(aps->packages, i);
81 char mask[1024], e[32] = "";
85 snprintf(e, sizeof(e), "%d:", pkg->epoch);
88 n = n_snprintf(mask, sizeof(mask), "%s%s%s%s-%s", pkg->name,
89 - hashed ? "#" : "-", e, pkg->ver, pkg->rel);
90 + hashed ? "#" : "-", e, pkg->ver, pkg->rel);
92 + if (0 && poldek_conf_MULTILIB && pkg_arch(pkg))
93 + n += n_snprintf(&mask[n], sizeof(mask) - n, ".%s", pkg_arch(pkg));
95 n_array_push(masks, n_strdupl(mask, n));
99 if (matches[j] == 0 && (flags & ARG_PACKAGES_RESOLV_MISSINGOK) == 0) {
100 logn(LOGERR, _("%s: no such package"), mask);
105 if ((flags & ARG_PACKAGES_RESOLV_UNAMBIGUOUS) == 0 && matches_bycmp[j] > 1) {
106 int pri = (flags & ARG_PACKAGES_RESOLV_EXACT) ? LOGERR : LOGWARN;
108 int arg_packages_resolve(struct arg_packages *aps, tn_array *avpkgs,
109 struct pkgset *ps, unsigned flags)
111 - int i, j, nmasks, rc = 0;
112 + int i, j, nmasks, rc = 1;
114 n_hash_clean(aps->resolved_caps);
115 n_array_clean(aps->resolved_pkgs);
116 @@ -697,12 +665,16 @@
120 - rc = resolve_pkgs(aps->resolved_pkgs, aps, avpkgs, flags);
121 - if (rc) /* continue with masks */
122 - rc = resolve_masks(aps->resolved_pkgs, aps, avpkgs, ps, flags);
123 + if (!resolve_pkgs(aps->resolved_pkgs, aps, avpkgs, flags))
126 + if (!resolve_masks(aps->resolved_pkgs, aps, avpkgs, ps, flags))
129 - if (rc && ps && aps->pset_virtuals)
130 - rc = resolve_pset_virtuals(aps, ps, flags);
131 + if (ps && aps->pset_virtuals) {
132 + if (!resolve_pset_virtuals(aps, ps, flags))
137 n_array_clean(aps->resolved_pkgs);
138 diff -urN poldek-0.20.org/arg_packages.h poldek-0.20/arg_packages.h
139 --- poldek-0.20.org/arg_packages.h 2005-05-25 19:53:19.000000000 +0200
140 +++ poldek-0.20/arg_packages.h 2006-07-26 20:25:54.027315250 +0200
144 #ifndef POLDEK_USRSET_H
145 #define POLDEK_USRSET_H
149 void arg_packages_clean(struct arg_packages *aps);
150 int arg_packages_size(struct arg_packages *aps);
152 tn_array *arg_packages_get_masks(struct arg_packages *aps, int hashed);
154 int arg_packages_add_pkgmask(struct arg_packages *aps, const char *mask);
155 diff -urN poldek-0.20.org/ask.c poldek-0.20/ask.c
156 --- poldek-0.20.org/ask.c 2003-04-14 18:28:09.000000000 +0200
157 +++ poldek-0.20/ask.c 2006-07-26 20:25:54.027315250 +0200
173 - msg(-1, _("Which one do you want to install? [%c]"), 'a' + default_i);
174 + msg(-1, _("Which one do you want to install ('Q' to abort)? [%c]"),
176 a = poldek_term_ask(STDIN_FILENO, validchrs, NULL);
186 //printf("Selected %d\n", a);
187 diff -urN poldek-0.20.org/cli/alias.c poldek-0.20/cli/alias.c
188 --- poldek-0.20.org/cli/alias.c 2005-05-24 21:54:22.000000000 +0200
189 +++ poldek-0.20/cli/alias.c 2006-07-26 20:25:54.027315250 +0200
205 #include <trurl/nassert.h>
210 +#include "cmd_chain.h"
215 COMMAND_NOARGS | COMMAND_NOOPTS,
216 "alias", NULL, N_("Print defined command aliases"),
217 NULL, NULL, NULL, alias,
218 - NULL, NULL, NULL, NULL, 0, 0
219 + NULL, NULL, NULL, NULL, NULL, 0, 0
222 static int alias(struct cmdctx *cmdctx)
224 if (cmd->flags & COMMAND_IS_ALIAS) {
225 n_cfree(&cmd->cmdline);
227 + n_cfree(&cmd->aliasto);
228 memset(cmd, 0, sizeof(*cmd));
232 alias->flags = COMMAND_IS_ALIAS | COMMAND__MALLOCED;
233 alias->name = n_strdup(name);
234 alias->cmdline = n_strdup(cmdline);
235 + alias->aliasto = NULL;
236 alias->_free = free_alias;
237 + if (strchr(alias->cmdline, '%'))
238 + alias->flags |= COMMAND_PARAMETERIZED;
243 int add_alias(struct poclidek_ctx *cctx,
244 const char *aliasname, const char *cmdline)
246 - struct poclidek_cmd *cmd;
247 - struct poclidek_cmd tmpcmd;
249 + struct poclidek_cmd *cmd, tmpcmd;
252 tmpcmd.name = (char*)aliasname;
253 - if ((cmd = n_array_bsearch(cctx->commands, &tmpcmd)) == NULL) {
254 - n_array_push(cctx->commands, command_new_alias(aliasname, cmdline));
255 + if ((cmd = n_array_bsearch(cctx->commands, &tmpcmd)) == NULL) {
256 + cmd = command_new_alias(aliasname, cmdline);
257 + n_array_push(cctx->commands, cmd);
260 if ((cmd->flags & COMMAND_IS_ALIAS) == 0) {
261 logn(LOGWARN, _("%s: alias could not shadow a command"), aliasname);
265 if (poldek_verbose() > 1)
266 @@ -102,15 +108,61 @@
269 n_array_sort(cctx->commands);
274 +/* determine to what command alias is aliased */
275 +static char *alias_to(struct poclidek_ctx *cctx, const char *cmdline)
278 + char *p, *cmd = NULL;
280 + if (strchr(cmdline, '|') == NULL) {
281 + cmd = n_strdup(cmdline);
283 + } else if ((ents = poclidek_prepare_cmdline(cctx, cmdline))) {
284 + struct cmd_chain_ent *ent = n_array_nth(ents, 0);
285 + while (ent->next_piped)
286 + ent = ent->next_piped;
288 + cmd = n_strdup(ent->cmd->name);
289 + n_array_free(ents);
295 + if ((p = strchr(cmd, ' ')))
301 +static void find_aliased_commands(struct poclidek_ctx *cctx)
303 + struct poclidek_cmd *cmd;
306 + for (i=0; i < n_array_size(cctx->commands); i++) {
307 + cmd = n_array_nth(cctx->commands, i);
309 + if ((cmd->flags & COMMAND_IS_ALIAS) == 0)
312 + cmd->aliasto = alias_to(cctx, cmd->cmdline);
313 + if (cmd->aliasto == NULL)
314 + logn(LOGWARN, _("%s: could not determine aliased command"),
317 + msgn(3, "%s => aliased %s", cmd->name, cmd->aliasto);
321 int poclidek_load_aliases(struct poclidek_ctx *cctx, const char *path)
323 tn_hash *aliases_htcnf, *ht;
328 if (access(path, R_OK) != 0)
330 @@ -126,16 +178,22 @@
331 const char *name, *cmdline;
333 name = n_array_nth(keys, i);
334 + if (*name == '_') /* config macro */
337 if ((cmdline = poldek_conf_get(ht, name, NULL)))
338 - add_alias(cctx, name, cmdline);
339 + if (add_alias(cctx, name, cmdline))
344 n_hash_free(aliases_htcnf);
347 + find_aliased_commands(cctx);
356 diff -urN poldek-0.20.org/cli/cd.c poldek-0.20/cli/cd.c
357 --- poldek-0.20.org/cli/cd.c 2005-06-12 23:11:08.000000000 +0200
358 +++ poldek-0.20/cli/cd.c 2006-07-26 20:25:54.027315250 +0200
367 #include <sys/param.h> /* for PATH_MAX */
369 COMMAND_SELFARGS | COMMAND_EMPTYARGS | COMMAND_NOOPTS,
370 "cd", N_("[PATH]"), N_("Change current package directory"),
371 NULL, parse_opt, NULL, cd,
372 - NULL, NULL, NULL, NULL, 0, 0
373 + NULL, NULL, NULL, NULL, NULL, 0, 0
376 struct poclidek_cmd command_pwd = {
377 COMMAND_NOARGS | COMMAND_NOOPTS,
378 "pwd", NULL, N_("Print name of current directory"),
379 NULL, NULL, NULL, pwd,
380 - NULL, NULL, NULL, NULL, 0, 0
381 + NULL, NULL, NULL, NULL, NULL, 0, 0
385 diff -urN poldek-0.20.org/cli/cli.c poldek-0.20/cli/cli.c
386 --- poldek-0.20.org/cli/cli.c 2005-10-12 01:20:12.000000000 +0200
387 +++ poldek-0.20/cli/cli.c 2006-07-26 20:25:54.027315250 +0200
390 - Copyright (C) 2000 - 2004 Pawel A. Gajda <mis@pld.org.pl>
391 + Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
393 This program is free software; you can redistribute it and/or modify
394 it under the terms of the GNU General Public License, version 2 as
413 -#include <sys/param.h>
414 -#include <sys/types.h>
415 +#include <sys/errno.h>
416 #include <sys/file.h>
417 +#include <sys/param.h>
418 #include <sys/stat.h>
419 -#include <sys/errno.h>
421 +#include <sys/types.h>
425 @@ -161,14 +161,22 @@
427 if (cmd->flags & COMMAND_IS_ALIAS)
431 n = n_snprintf(nam, sizeof(nam), "%s ", cmd->name);
432 for (i=0; i < n_array_size(cctx->commands); i++) {
433 struct poclidek_cmd *cm = n_array_nth(cctx->commands, i);
436 if ((cm->flags & COMMAND_IS_ALIAS) == 0)
439 + if (cm->aliasto && n_str_eq(cmd->name, cm->aliasto))
442 + else if (strncmp(nam, cm->cmdline, n) == 0)
445 - if (strncmp(nam, cm->cmdline, n) == 0) {
448 aliases = n_array_new(4, NULL, (tn_fn_cmp)command_cmp);
449 n_array_push(aliases, cm);
450 @@ -316,45 +324,50 @@
454 -int cmdctx_printf(struct cmdctx *cmdctx, const char *fmt, ...)
456 +int do_cmdctx_printf(struct cmdctx *cmdctx, int color, const char *fmt,
461 + int is_ctrl, n = 0;
463 - if (cmdctx_isctrlmsg(fmt)) {
464 + if ((is_ctrl = cmdctx_isctrlmsg(fmt))) {
465 if (cmdctx->rtflags & CMDCTX_NOCTRLMSGS)
470 - va_start(args, fmt);
471 - if (cmdctx->pipe_right)
472 + if (cmdctx->pipe_right == NULL || is_ctrl) {
473 + n = color ? poldek_term_vprintf_c(color, fmt, args) :
474 + vfprintf(stdout, fmt, args);
477 n = cmd_pipe_vprintf(cmdctx->pipe_right, fmt, args);
479 - n = vfprintf(stdout, fmt, args);
486 +int cmdctx_printf(struct cmdctx *cmdctx, const char *fmt, ...)
491 + va_start(args, fmt);
492 + n = do_cmdctx_printf(cmdctx, 0, fmt, args);
498 int cmdctx_printf_c(struct cmdctx *cmdctx, int color, const char *fmt, ...)
503 - if (cmdctx_isctrlmsg(fmt)) {
504 - if (cmdctx->rtflags & CMDCTX_NOCTRLMSGS)
512 - if (cmdctx->pipe_right)
513 - n = cmd_pipe_vprintf(cmdctx->pipe_right, fmt, args);
515 - n = poldek_term_vprintf_c(color, fmt, args);
517 + n = do_cmdctx_printf(cmdctx, color, fmt, args);
523 @@ -577,25 +590,22 @@
527 -tn_array *poclidek_prepare_cmdline(struct poclidek_ctx *cctx, const char *line);
530 +/* executes command chain (a pipeline) */
532 int poclidek_exec_cmd_ent(struct poclidek_ctx *cctx, struct poldek_ts *ts,
533 struct cmd_chain_ent *ent, struct cmd_pipe *cmd_pipe)
535 struct cmdctx cmdctx;
538 + int rc = 0, runit = 1;
540 DBGF("ent %s, %d, %p\n", ent->cmd->name, n_array_size(ent->a_argv),
545 memset(&cmdctx, 0, sizeof(cmdctx));
546 cmdctx.cmd = ent->cmd;
549 if ((cmdctx.ts = ts) == NULL)
550 cmdctx.ts = poldek_ts_new(cctx->ctx, 0);
553 cmdctx.pipe_right = ent->pipe_right;
556 - if (ent->prev_piped) {
557 + if (ent->prev_piped) { /* | cmd */
558 struct cmd_pipe *pipe;
559 tn_array *pipe_args = NULL;
563 pipe_args = cmd_pipe_xargs(pipe, CMD_PIPE_CTX_ASCII);
566 + if (pipe_args == NULL) {
567 + runit = 0; /* do not execute command if pipe is empty */
572 while (n_array_size(pipe_args))
573 n_array_push(ent->a_argv, n_array_shift(pipe_args));
574 + n_array_free(pipe_args);
578 @@ -636,11 +652,12 @@
579 a_argv_to_argv(ent->a_argv, argv);
581 rc = do_exec_cmd_ent(&cmdctx, n_array_size(ent->a_argv), argv);
586 poldek_ts_free(cmdctx.ts);
588 - if (ent->next_piped)
589 + if (runit && ent->next_piped)
590 return poclidek_exec_cmd_ent(cctx, ts, ent->next_piped, cmd_pipe);
593 diff -urN poldek-0.20.org/cli/cmd_chain.c poldek-0.20/cli/cmd_chain.c
594 --- poldek-0.20.org/cli/cmd_chain.c 2005-10-21 17:59:28.000000000 +0200
595 +++ poldek-0.20/cli/cmd_chain.c 2006-07-26 20:25:54.031315500 +0200
598 - Copyright (C) 2000 - 2004 Pawel A. Gajda (mis@k2.net.pl)
601 + Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
603 This program is free software; you can redistribute it and/or modify
604 - it under the terms of the GNU General Public License published by
605 - the Free Software Foundation (see file COPYING for details).
606 + it under the terms of the GNU General Public License, version 2 as
607 + published by the Free Software Foundation (see file COPYING for details).
609 + You should have received a copy of the GNU General Public License
610 + along with this program; if not, write to the Free Software
611 + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
628 -#include <sys/types.h>
629 +#include <sys/errno.h>
630 #include <sys/file.h>
631 #include <sys/stat.h>
632 -#include <sys/errno.h>
633 +#include <sys/types.h>
635 #include <trurl/trurl.h>
636 #include <sigint/sigint.h>
639 +#include "poldek_util.h"
640 #define ENABLE_TRACE 0
646 struct cmd_chain_ent *cmd_chain_ent_new(unsigned flags,
647 - struct poclidek_cmd *cmd, tn_array *a_argv)
648 + struct poclidek_cmd *cmd,
651 struct cmd_chain_ent *ent;
652 ent = n_malloc(sizeof(*ent));
657 +static const char *apply_params(const char *cmdline, tn_array *a_argv)
660 + tn_array *new_a_argv = NULL;
661 + char newline[1024];
664 + n_assert(n_array_size(a_argv) > 0);
666 + vars = n_hash_new(n_array_size(a_argv) < 16 ? 16:n_array_size(a_argv) * 2,
669 + for (i=0; i < n_array_size(a_argv); i++) {
671 + n_snprintf(no, sizeof(no), "%d", i);
673 + n_hash_insert(vars, no, n_array_nth(a_argv, i));
676 + cmdline = poldek_util_expand_vars(newline, sizeof(newline),
677 + cmdline, '%', vars,
678 + POLDEK_UTIL_EXPANDVARS_RMUSED);
680 + if (strchr(cmdline, '%')) {/* still unexpanded vars */
685 + /* remove used args from a_argv */
686 + new_a_argv = n_array_clone(a_argv);
687 + n_assert(n_array_ctl_get_freefn(a_argv) == free);
690 + while (n_array_size(a_argv) > 0) {
691 + char no[64], *arg = n_array_shift(a_argv);
693 + n_snprintf(no, sizeof(no), "%d", i++);
694 + if (n_hash_exists(vars, no))
695 + n_array_push(new_a_argv, arg);
699 + n_assert(n_array_size(a_argv) == 0);
700 + while (n_array_size(new_a_argv) > 0)
701 + n_array_push(a_argv, n_array_shift(new_a_argv));
702 + n_array_free(new_a_argv);
711 tn_array *prepare_a_argv(struct poclidek_ctx *cctx, tn_array *cmd_chain,
712 @@ -234,11 +292,26 @@
713 ent = cmd_chain_ent_new(CMD_CHAIN_ENT_CMD, cmd, a_argv);
714 n_array_push(cmd_chain, ent);
717 + } else { /* alias */
720 n_assert(cmd->cmdline);
721 cmdline = cmd->cmdline;
723 + if (cmd->flags & COMMAND_PARAMETERIZED) {
724 + if (n_array_size(a_argv) == 0) {
725 + logn(LOGERR, _("%s: alias needs an arguments"), acmd);
729 + if ((cmdline = apply_params(cmdline, a_argv)) == NULL) {
731 + _("%s: apply arguments failed (not enough arguments?)"),
736 + msgn(2, "%s => %s\n", acmd, cmdline);
738 if (n_array_size(a_argv) > 1) { /* any arguments? -> pass them */
741 len = strlen(cmd->cmdline) + 1;
742 /* from 1 -- skip alias */
743 for (i=1; i < n_array_size(a_argv); i++)
744 - /* + quotes + space */
745 + /* + quotes + space */
746 len += strlen((char*)n_array_nth(a_argv, i)) + 2 + 1;
749 diff -urN poldek-0.20.org/cli/cmd.h poldek-0.20/cli/cmd.h
750 --- poldek-0.20.org/cli/cmd.h 2005-05-15 17:53:07.000000000 +0200
751 +++ poldek-0.20/cli/cmd.h 2006-07-26 20:25:54.031315500 +0200
755 #ifndef POCLIDEK_CMD_H
756 #define POCLIDEK_CMD_H
759 #define COMMAND_HIDDEN (1 << 5) /* help doesn't displays it */
760 #define COMMAND_SELFARGS (1 << 7) /* cmd parses its args itself */
762 -#define COMMAND_MODIFIESDB (1 << 8)
763 -#define COMMAND_IS_ALIAS (1 << 9)
764 +#define COMMAND_MODIFIESDB (1 << 8)
765 +#define COMMAND_IS_ALIAS (1 << 9)
766 +#define COMMAND_PARAMETERIZED (1 << 10)
768 #define COMMAND_PIPEABLE_LEFT (1 << 13)
769 #define COMMAND_PIPEABLE_RIGTH (1 << 14)
773 char *cmdline; /* alias content */
774 + char *aliasto; /* if alias, a cmd name is aliased to */
776 void (*_free)(struct poclidek_cmd *);
778 diff -urN poldek-0.20.org/cli/cmd_pipe.c poldek-0.20/cli/cmd_pipe.c
779 --- poldek-0.20.org/cli/cmd_pipe.c 2005-04-27 20:28:32.000000000 +0200
780 +++ poldek-0.20/cli/cmd_pipe.c 2006-07-26 20:25:54.031315500 +0200
791 xargs_packages(p, args);
794 + if (n_array_size(args) == 0)
795 + n_array_cfree(&args);
800 diff -urN poldek-0.20.org/cli/dbcache.c poldek-0.20/cli/dbcache.c
801 --- poldek-0.20.org/cli/dbcache.c 2005-09-17 17:36:21.000000000 +0200
802 +++ poldek-0.20/cli/dbcache.c 2006-07-26 20:25:54.031315500 +0200
818 #include <trurl/trurl.h>
819 #include <sigint/sigint.h>
820 diff -urN poldek-0.20.org/cli/dent.c poldek-0.20/cli/dent.c
821 --- poldek-0.20.org/cli/dent.c 2005-10-26 16:41:05.000000000 +0200
822 +++ poldek-0.20/cli/dent.c 2006-07-26 20:25:54.031315500 +0200
833 return strcmp(ent->name, name);
837 +int pkg_dent_cmp_ptr(struct pkg_dent *e1, struct pkg_dent *e2)
843 int pkg_dent_cmp_btime(struct pkg_dent *ent1, struct pkg_dent *ent2)
845 @@ -542,17 +548,15 @@
847 if ((ents = poclidek_get_dent_ents(cctx, dir)) == NULL)
850 - pkgs = n_array_new(n_array_size(ents), (tn_fn_free)pkg_free,
851 - (tn_fn_cmp)pkg_nvr_strcmp);
854 + pkgs = pkgs_array_new_ex(n_array_size(ents), pkg_cmp_name_evr_rev);
856 for (i=0; i < n_array_size(ents); i++) {
859 if ((pkg = pkg_dent_getpkg(n_array_nth(ents, i))))
860 n_array_push(pkgs, pkg_link(pkg));
862 - n_array_ctl(pkgs, TN_ARRAY_AUTOSORTED);
869 if (fnmatch(mask, ent->name, 0) == 0) {
870 + DBGF("fnmatch %s %s\n", mask, ent->name);
871 n_array_push(ments, pkg_dent_link(ent));
878 - n_array_uniq(ments);
879 + n_array_uniq_ex(ments, (tn_fn_cmp)pkg_dent_cmp_ptr);
882 //if (flags & ARG_PACKAGES_RESOLV_UNAMBIGUOUS)
883 diff -urN poldek-0.20.org/cli/desc.c poldek-0.20/cli/desc.c
884 --- poldek-0.20.org/cli/desc.c 2005-10-18 20:01:34.000000000 +0200
885 +++ poldek-0.20/cli/desc.c 2006-07-26 20:25:54.031315500 +0200
896 "desc", N_("PACKAGE..."), N_("Display packages info"),
899 - NULL, NULL, NULL, NULL, 0, 0
900 + NULL, NULL, NULL, NULL, NULL, 0, 0
904 diff -urN poldek-0.20.org/cli/external.c poldek-0.20/cli/external.c
905 --- poldek-0.20.org/cli/external.c 2005-05-15 17:53:08.000000000 +0200
906 +++ poldek-0.20/cli/external.c 2006-07-26 20:25:54.031315500 +0200
917 COMMAND_SELFARGS | COMMAND_PIPEABLE | COMMAND_HIDDEN,
918 "!", N_("COMMAND"), N_("Execute external command"),
919 NULL, parse_opt, NULL, external,
920 - NULL, NULL, NULL, NULL, 0, 0
921 + NULL, NULL, NULL, NULL, NULL, 0, 0
925 diff -urN poldek-0.20.org/cli/get.c poldek-0.20/cli/get.c
926 --- poldek-0.20.org/cli/get.c 2005-10-17 23:05:23.000000000 +0200
927 +++ poldek-0.20/cli/get.c 2006-07-26 20:25:54.031315500 +0200
938 #define OPT_GET_DIR (1 << 1) /* cmd_state->flags */
940 static struct argp_option options[] = {
941 - { "dir", 'd', "DIR", 0, N_("Download to directory DIR instead to current one"), 1},
942 + { "dir", 'd', "DIR", 0,
943 + N_("Download to directory DIR instead to current one"), 1},
944 { 0, 0, 0, 0, 0, 0 },
948 struct poclidek_cmd command_get = {
950 "get", N_("PACKAGE..."), N_("Download packages"),
952 - NULL, get, NULL, NULL, NULL, 0, 5, 0
953 + NULL, get, NULL, NULL, NULL, NULL, 0, 5, 0
959 error_t parse_opt(int key, char *arg, struct argp_state *state)
961 diff -urN poldek-0.20.org/cli/help.c poldek-0.20/cli/help.c
962 --- poldek-0.20.org/cli/help.c 2004-12-18 14:26:52.000000000 +0100
963 +++ poldek-0.20/cli/help.c 2006-07-26 20:25:54.031315500 +0200
966 - Copyright (C) 2000 - 2002 Pawel A. Gajda <mis@k2.net.pl>
967 + Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
969 This program is free software; you can redistribute it and/or modify
970 it under the terms of the GNU General Public License, version 2 as
982 #include <trurl/trurl.h>
985 COMMAND_NOOPTS | COMMAND_NOHELP | COMMAND_NOARGS,
986 "help", NULL, N_("Display this help"),
987 NULL, NULL, NULL, cmd_help,
988 - NULL, NULL, NULL, NULL, 0, 0
989 + NULL, NULL, NULL, NULL, NULL, 0, 0
993 diff -urN poldek-0.20.org/cli/install.c poldek-0.20/cli/install.c
994 --- poldek-0.20.org/cli/install.c 2005-10-17 23:13:14.000000000 +0200
995 +++ poldek-0.20/cli/install.c 2006-07-26 20:25:54.031315500 +0200
1006 #define OPT_PM (OPT_GID + 35)
1007 #define OPT_INST_NOFETCH (OPT_GID + 36)
1008 #define OPT_INST_PARSABLETS (OPT_GID + 37)
1009 +#define OPT_INST_MKDIR (OPT_GID + 38)
1011 static struct argp_option options[] = {
1012 {0, 'I', 0, 0, N_("Install, not upgrade packages"), OPT_GID },
1013 @@ -184,8 +185,11 @@
1015 {"parsable-tr-summary", OPT_INST_PARSABLETS, 0, 0,
1016 N_("Print installation summary in parseable form"), OPT_GID },
1018 - { 0, 0, 0, 0, 0, 0 },
1020 +{"mkdir", OPT_INST_MKDIR, 0, OPTION_HIDDEN, /* legacy */
1021 + "make %{_dbpath} directory if not exists", OPT_GID },
1023 +{ 0, 0, 0, 0, 0, 0 },
1028 COMMAND_PIPEABLE_LEFT | COMMAND_PIPE_XARGS | COMMAND_PIPE_PACKAGES,
1029 "install", N_("PACKAGE..."), N_("Install packages"),
1031 - NULL, install, NULL, NULL, NULL, NULL, 0, 0
1032 + NULL, install, NULL, NULL, NULL, NULL, NULL, 0, 0
1035 static struct argp cmd_argp = {
1037 ts->setop(ts, POLDEK_OP_PARSABLETS, 1);
1040 + case OPT_INST_MKDIR:
1041 + break; /* ignored, directory is created by default */
1043 case 'I': /* silently ignore */
1046 diff -urN poldek-0.20.org/cli/ls.c poldek-0.20/cli/ls.c
1047 --- poldek-0.20.org/cli/ls.c 2005-10-18 20:01:35.000000000 +0200
1048 +++ poldek-0.20/cli/ls.c 2006-07-26 20:25:54.035315750 +0200
1060 #include "sigint/sigint.h"
1061 #include "poldek_util.h"
1062 +#include "pkgcmp.h"
1067 COMMAND_PIPE_XARGS | COMMAND_PIPE_PACKAGES,
1068 "ls", N_("[PACKAGE...]"), N_("List packages"),
1069 options, parse_opt, NULL, ls,
1070 - NULL, NULL, NULL, NULL, 0, 0
1071 + NULL, NULL, NULL, NULL, NULL, 0, 0
1075 @@ -159,11 +160,9 @@
1076 char *evr, size_t size)
1078 struct pkg *pkg = NULL;
1082 - snprintf(name, sizeof(name), "%s-", lpkg->name);
1083 - n = n_array_bsearch_idx_ex(pkgs, name, (tn_fn_cmp)pkg_nvr_strncmp);
1084 + n = n_array_bsearch_idx_ex(pkgs, lpkg, (tn_fn_cmp)pkg_ncmp_name);
1092 + n_assert(n_array_ctl_get_cmpfn(cmpto_pkgs) ==
1093 + (tn_fn_cmp)pkg_cmp_name_evr_rev);
1095 ls_ents2 = n_array_clone(ls_ents);
1097 for (i=0; i < n_array_size(ls_ents); i++) {
1099 if (sigint_reached())
1104 + n_array_free(cmpto_pkgs);
1108 @@ -294,6 +299,10 @@
1109 n_array_sort_ex(ls_ents, cmpf);
1111 rc = do_ls(ls_ents, cmdctx, evrs);
1114 + n_array_sort(ls_ents); /* sort them back, ls_ents could be reference
1115 + to global packages array */
1119 diff -urN poldek-0.20.org/cli/main.c poldek-0.20/cli/main.c
1120 --- poldek-0.20.org/cli/main.c 2005-10-27 00:46:07.000000000 +0200
1121 +++ poldek-0.20/cli/main.c 2006-07-26 20:25:54.035315750 +0200
1130 #ifdef HAVE_CONFIG_H
1132 #include <sys/types.h>
1133 #include <sys/stat.h>
1137 #include <trurl/trurl.h>
1140 {"upconf", OPT_UPCONF, 0, 0, N_("Update remote configuration files (if any)"),
1143 -{"version", OPT_BANNER, 0, 0, N_("Display program version information and exit"),
1145 +{"version", OPT_BANNER, 0, OPTION_HIDDEN,
1146 + N_("Display program version information and exit"), OPT_GID },
1148 {"log", OPT_LOG, "FILE", 0, N_("Log program messages to FILE"), OPT_GID },
1149 {"runas", OPT_RUNAS, "USER", 0, N_("Run program as user USER"), OPT_GID },
1150 diff -urN poldek-0.20.org/cli/op_makeidx.c poldek-0.20/cli/op_makeidx.c
1151 --- poldek-0.20.org/cli/op_makeidx.c 2005-10-10 00:35:28.000000000 +0200
1152 +++ poldek-0.20/cli/op_makeidx.c 2006-07-26 20:25:54.035315750 +0200
1161 #ifdef HAVE_CONFIG_H
1163 {"nocompress", OPT_NOCOMPR, NULL, 0,
1164 N_("Create uncompressed index"), OPT_GID },
1166 -{"compress", OPT_COMPR, "type", OPTION_HIDDEN, /* not finished yet */
1167 - N_("Sets compression type (none, bz2, gz)"), OPT_GID },
1169 {"mo", OPT_MOPT, "OPTION[,OPTION]", OPTION_HIDDEN, /* not finished yet */
1170 N_("index type specific options"), OPT_GID },
1171 { 0, 0, 0, 0, 0, 0 },
1173 { 0, 0, 0, 0, 0, 0 },
1181 +static struct mopt valid_mopts[] = {
1182 + { "nodesc", PKGDIR_CREAT_NODESC },
1183 + { "nodiff", PKGDIR_CREAT_NOPATCH },
1184 + { "v018x", PKGDIR_CREAT_v018x }, /* pdir without pkg files timestamps */
1185 + { "nocompress", 0 },
1186 + { "compress", 0 }, /* compress=[gz,bz2,none] - a compression type, NFY */
1195 #define DO_MAKEIDX (1 << 0)
1198 +static int parse_mopts(struct arg_s *arg_s, char *opstr);
1201 error_t parse_opt(int key, char *arg, struct argp_state *state);
1203 @@ -171,23 +185,30 @@
1207 - arg_s->crflags |= PKGDIR_CREAT_NODESC;
1208 + parse_mopts(arg_s, "nodesc");
1209 /* XXX hack, no way to pass option between argps (?)*/
1210 poclidek_op_source_nodesc = 1;
1214 - arg_s->crflags |= PKGDIR_CREAT_NOPATCH;
1215 + parse_mopts(arg_s, "nodiff");
1219 - n_hash_replace(arg_s->opts, "compress", n_strdup(arg));
1222 + n_snprintf(tmp, sizeof(tmp), "compress=%s", arg);
1223 + parse_mopts(arg_s, tmp);
1228 - n_hash_replace(arg_s->opts, "compress", n_strdup("none"));
1229 + parse_mopts(arg_s, "nocompress");
1234 + parse_mopts(arg_s, arg);
1238 return ARGP_ERR_UNKNOWN;
1240 @@ -195,6 +216,73 @@
1245 +static int parse_mopt(struct arg_s *arg_s, const char *opstr)
1250 + n_strdupap(opstr, &tmp);
1252 + if ((p = strchr(tmp, '='))) {
1255 + p = n_str_strip_ws(p);
1256 + tmp = n_str_strip_ws(tmp);
1259 + n_hash_replace(arg_s->opts, tmp, p ? n_strdup(p) : NULL);
1263 + while (valid_mopts[i].name) {
1264 + if (n_str_eq(tmp, valid_mopts[i].name)) {
1265 + arg_s->crflags |= valid_mopts[i].flag;
1273 + logn(LOGERR, _("%s: unknown option"), tmp);
1276 + if (n_str_eq(tmp, "nocompress"))
1277 + n_hash_replace(arg_s->opts, "compress", n_strdup("none"));
1279 + n_hash_replace(arg_s->opts, tmp, p ? n_strdup(p) : NULL);
1286 +static int parse_mopts(struct arg_s *arg_s, char *opstr)
1288 + opstr = n_str_strip_ws(opstr);
1290 + if (opstr == NULL || *opstr == '\0')
1293 + if (strchr(opstr, ',') == NULL) {
1294 + parse_mopt(arg_s, opstr);
1297 + const char **tl_save, **tl;
1299 + tl = tl_save = n_str_tokl(opstr, ",");
1301 + parse_mopt(arg_s, *tl);
1304 + n_str_tokl_free(tl_save);
1311 static tn_array *parse_types(const char *type)
1313 tn_array *types = n_array_new(4, free, (tn_fn_cmp)strcmp);
1314 diff -urN poldek-0.20.org/cli/reload.c poldek-0.20/cli/reload.c
1315 --- poldek-0.20.org/cli/reload.c 2005-10-12 01:20:12.000000000 +0200
1316 +++ poldek-0.20/cli/reload.c 2006-07-26 20:25:54.035315750 +0200
1326 #include <sys/param.h>
1329 #include "sigint/sigint.h"
1330 #include "poldek_util.h"
1332 COMMAND_NOARGS | COMMAND_NOOPTS,
1333 "reload", NULL, N_("Reload installed packages"),
1334 NULL, NULL, NULL, reload,
1335 - NULL, NULL, NULL, NULL, 0, 0
1336 + NULL, NULL, NULL, NULL, NULL, 0, 0
1339 static int reload(struct cmdctx *cmdctx)
1340 diff -urN poldek-0.20.org/cli/search.c poldek-0.20/cli/search.c
1341 --- poldek-0.20.org/cli/search.c 2005-10-18 20:01:35.000000000 +0200
1342 +++ poldek-0.20/cli/search.c 2006-07-26 20:25:54.035315750 +0200
1353 " <delimiter>perl-regexp<delimiter>[imsx]\n"
1354 " For example to find the packages containing foo.bar do:\n"
1355 " search --perlre /foo\\.bar/\n"
1356 - " See perlre(1) for more details.\n"), NULL, 0, 0
1357 + " See perlre(1) for more details.\n"), NULL, NULL, 0, 0
1360 static struct pattern *build_pattern(struct cmdctx *cmdctx, char *arg)
1361 diff -urN poldek-0.20.org/cli/shell.c poldek-0.20/cli/shell.c
1362 --- poldek-0.20.org/cli/shell.c 2005-10-12 01:20:12.000000000 +0200
1363 +++ poldek-0.20/cli/shell.c 2006-07-26 20:25:54.035315750 +0200
1372 #ifdef HAVE_CONFIG_H
1374 #include <sys/errno.h>
1375 #include <sys/param.h>
1379 #include <fnmatch.h>
1383 #include <readline/readline.h>
1385 COMMAND_NOARGS | COMMAND_NOOPTS,
1386 "quit", NULL, N_("Exit poldek"),
1387 NULL, NULL, NULL, cmd_quit,
1388 - NULL, NULL, NULL, NULL, 0, 0
1389 + NULL, NULL, NULL, NULL, NULL, 0, 0
1392 static volatile sig_atomic_t shDone = 0;
1394 struct pkg *ipkg = NULL;
1400 dents = poclidek_get_dent_ents(cctx, POCLIDEK_INSTALLEDDIR);
1404 - snprintf(name, sizeof(name), "%s-", pkg->name);
1405 + name_len = snprintf(name, sizeof(name), "%s-", pkg->name);
1406 n = n_array_bsearch_idx_ex(dents, name, (tn_fn_cmp)pkg_dent_strncmp);
1411 while (n < n_array_size(dents)) {
1412 struct pkg_dent *ent = n_array_nth(dents, n++);
1414 if (pkg_dent_isdir(ent))
1417 + if (strncmp(name, ent->name, name_len) != 0)
1420 ipkg = ent->pkg_dent_pkg;
1421 - if (strcmp(pkg->name, ipkg->name) != 0)
1424 - if (pkg_cmp_evr(pkg, ipkg) > 0)
1425 + if (strcmp(pkg->name, ipkg->name) == 0 && pkg_cmp_evr(pkg, ipkg) > 0)
1429 @@ -357,22 +356,34 @@
1430 snprintf(prompt, sizeof(prompt), "poldek:%s%s> ",
1431 currdir == NULL ? "/" : *currdir->name == '/' ? "" : "/",
1432 currdir == NULL ? "" : currdir->name);
1434 if ((line = readline(prompt)) == NULL)
1437 + /* add to history? */
1439 + while (isspace(*s))
1443 + add_history(line);
1445 s = n_str_strip_ws(line);
1447 int _verbose = poldek_verbose();
1449 - //print_mem_info("BEFORE");
1454 + MEMINF("BEFORE %s\n", s);
1455 poclidek_execline(cctx, NULL, s);
1456 + MEMINF("AFTER %s\n", s);
1462 poldek_set_verbose(_verbose);
1463 - //print_mem_info("AFTER ");
1467 diff -urN poldek-0.20.org/cli/uninstall.c poldek-0.20/cli/uninstall.c
1468 --- poldek-0.20.org/cli/uninstall.c 2005-07-15 20:00:21.000000000 +0200
1469 +++ poldek-0.20/cli/uninstall.c 2006-07-26 20:25:54.047316500 +0200
1480 COMMAND_PIPEABLE_LEFT | COMMAND_PIPE_XARGS | COMMAND_PIPE_PACKAGES,
1481 "uninstall", N_("PACKAGE..."), N_("Uninstall packages"),
1483 - NULL, uninstall, NULL, NULL, NULL, NULL, 0, 0
1484 + NULL, uninstall, NULL, NULL, NULL, NULL, NULL, 0, 0
1487 static struct argp cmd_argp = {
1490 ts->setop(ts, POLDEK_OP_GREEDY, bool);
1495 if (ts->getop(ts, POLDEK_OP_TEST))
1496 diff -urN poldek-0.20.org/conf/centos-source.conf poldek-0.20/conf/centos-source.conf
1497 --- poldek-0.20.org/conf/centos-source.conf 1970-01-01 01:00:00.000000000 +0100
1498 +++ poldek-0.20/conf/centos-source.conf 2006-07-26 20:25:54.051316750 +0200
1504 +_prefix = http://mirror.centos.org/centos/4.2/apt/%{_arch}/
1509 +url = %{_prefix}/base/pkglist.os.bz2
1510 +prefix = %{_prefix}/RPMS.os
1515 +url = %{_prefix}/base/pkglist.updates.bz2
1516 +prefix = %{_prefix}/RPMS.updates
1521 +url = %{_prefix}/base/pkglist.centosplus.bz2
1522 +prefix = %{_prefix}/RPMS.centosplus
1524 +# CentOS yum indexes
1525 +#_prefix = http://mirror.centos.org/centos/4.2
1529 +#url = %{_prefix}/os/%{_arch}/
1534 +#url = %{_prefix}/updates/%{_arch}/
1539 +#url = %{_prefix}/centosplus/%{_arch}/
1541 diff -urN poldek-0.20.org/conf/Makefile.am poldek-0.20/conf/Makefile.am
1542 --- poldek-0.20.org/conf/Makefile.am 2005-10-28 18:15:27.000000000 +0200
1543 +++ poldek-0.20/conf/Makefile.am 2006-07-26 20:25:54.051316750 +0200
1549 GENCONFIGS = fetch.conf source.conf poldek.conf
1551 CONFIGS = $(GENCONFIGS) aliases.conf \
1552 - pld-source.conf rh-source.conf fedora-source.conf
1553 + pld-source.conf rh-source.conf \
1554 + fedora-source.conf centos-source.conf
1556 EXTRA_DIST = $(CONFIGS) \
1557 - sample-source-remoteconf.conf \
1558 + sample-source-remoteconf.conf \
1559 sample-cdrom-source.conf \
1560 poldek-pri-sample.conf
1562 diff -urN poldek-0.20.org/conf/mdk-source.conf poldek-0.20/conf/mdk-source.conf
1563 --- poldek-0.20.org/conf/mdk-source.conf 1970-01-01 01:00:00.000000000 +0100
1564 +++ poldek-0.20/conf/mdk-source.conf 2006-07-26 20:25:54.059317250 +0200
1568 +# Mandrake 8.2; package info is taken from (APT's?) pkglist.cooker.bz2 file
1569 +source1 = mdk,noautoup,type=hdrl \
1570 + ftp://ftp.ps.pl/mirrors/mandrake/8.2/i586/Mandrake/base/pkglist.cooker.bz2
1571 +prefix1 = ftp://ftp.ps.pl/mirrors/mandrake/8.2/i586/Mandrake/RPMS/
1572 diff -urN poldek-0.20.org/conf.c poldek-0.20/conf.c
1573 --- poldek-0.20.org/conf.c 2005-10-07 21:00:16.000000000 +0200
1574 +++ poldek-0.20/conf.c 2006-07-26 20:25:54.059317250 +0200
1577 - Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
1578 + Copyright (C) 2000 - 2006 Pawel A. Gajda <mis@k2.net.pl>
1580 This program is free software; you can redistribute it and/or modify
1581 it under the terms of the GNU General Public License, version 2 as
1591 @@ -38,146 +38,29 @@
1594 #include "poldek_util.h"
1595 +#include "conf_intern.h"
1597 #define POLDEK_LDCONF_APTSOURCES (1 << 15)
1599 -#define TYPE_STR (1 << 0)
1600 -#define TYPE_BOOL (1 << 1)
1601 -#define TYPE_INT (1 << 2)
1602 -#define TYPE_LIST (1 << 3)
1603 -#define TYPE_PATHLIST (1 << 4)
1605 -#define TYPE_MULTI (1 << 5)
1606 -#define TYPE_MULTI_EXCL (1 << 6)
1607 -#define TYPE_ENUM (1 << 7)
1609 -#define TYPE_F_ENV (1 << 10)
1610 -#define TYPE_F_REQUIRED (1 << 11)
1611 -#define TYPE_F_ALIAS (1 << 12)
1612 -#define TYPE_F_OBSL (1 << 14)
1614 static const char *global_tag = "global";
1615 static const char *include_tag = "%include";
1623 -static struct tag unknown_tag = {
1624 - NULL, TYPE_STR | TYPE_F_ENV | TYPE_MULTI_EXCL, { 0 },
1625 +static struct poldek_conf_tag unknown_tag = {
1626 + NULL, CONF_TYPE_STRING | CONF_TYPE_F_ENV | CONF_TYPE_F_MULTI_EXCL,
1630 -static struct tag global_tags[] = {
1631 - { "source", TYPE_STR | TYPE_MULTI | TYPE_F_ENV | TYPE_F_OBSL, {0} },
1632 - { "source?*", TYPE_STR | TYPE_F_ENV | TYPE_F_OBSL, { 0 } },
1633 - { "prefix?*", TYPE_STR | TYPE_F_ENV | TYPE_F_OBSL, { 0 } },
1634 - { "cachedir", TYPE_STR | TYPE_F_ENV, { 0 } },
1636 - { "ftp http_get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1637 - { "ftp get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1638 - { "http get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1639 - { "https get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1640 - { "rsync get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1641 - { "cdrom get", TYPE_STR | TYPE_F_OBSL, { 0 } }, /* obsolete */
1643 - { "ignore req", TYPE_STR | TYPE_MULTI, { 0 } },
1644 - { "ignore pkg", TYPE_STR | TYPE_MULTI, { 0 } },
1646 - { "pm command", TYPE_STR | TYPE_F_ENV, { 0 } },
1647 - { "sudo command", TYPE_STR | TYPE_F_ENV, { 0 } },
1648 - { "rpmdef", TYPE_STR | TYPE_MULTI | TYPE_F_ENV, { 0 } },
1649 - { "rpm install opt", TYPE_STR , { 0 } },
1650 - { "rpm uninstall opt", TYPE_STR , { 0 } },
1652 - { "follow", TYPE_BOOL , { 0 } },
1653 - { "greedy", TYPE_BOOL , { 0 } },
1654 - { "aggressive greedy", TYPE_BOOL , { 0 } },
1655 - { "use sudo", TYPE_BOOL , { 0 } },
1656 - { "run as", TYPE_STR, { 0 } },
1657 - { "runas", TYPE_STR | TYPE_F_ALIAS, { 0 } },
1658 - { "mercy", TYPE_BOOL , { 0 } },
1659 - { "default fetcher", TYPE_STR | TYPE_MULTI , { 0 } },
1660 - { "proxy", TYPE_STR | TYPE_MULTI, { 0 } },
1661 - { "noproxy", TYPE_STR | TYPE_LIST | TYPE_MULTI, { 0 } },
1662 - { "no proxy", TYPE_STR | TYPE_LIST | TYPE_MULTI | TYPE_F_ALIAS, { 0 } },
1663 - { "hold", TYPE_STR | TYPE_LIST | TYPE_MULTI , { 0 } },
1664 - { "ignore", TYPE_STR | TYPE_LIST | TYPE_MULTI , { 0 } },
1665 - { "keep downloads", TYPE_BOOL , { 0 } },
1666 - { "confirm installation", TYPE_BOOL , { 0 } },
1667 - { "confirm installs", TYPE_BOOL | TYPE_F_ALIAS , { 0 } }, /* backward compat */
1668 - { "confirm removal", TYPE_BOOL , { 0 } },
1669 - { "choose equivalents manually", TYPE_BOOL , { 0 } },
1670 - { "particle install", TYPE_BOOL, { 0 } },
1671 - { "unique package names", TYPE_BOOL, { 0 } },
1672 - { "vfile ftp sysuser as anon passwd", TYPE_BOOL , { 0 } },
1673 - { "ftp sysuser as anon passwd", TYPE_BOOL | TYPE_F_ALIAS, { 0 } },
1674 - { "vfile external compress", TYPE_BOOL , { 0 } },
1675 - { "vfile retries", TYPE_INT, { 0 } },
1676 - { "auto zlib in rpm", TYPE_BOOL , { 0 } },
1677 - { "promoteepoch", TYPE_BOOL, { 0 } },
1678 - { "default index type", TYPE_STR, { 0 } },
1679 - { "autoupa", TYPE_BOOL, { 0 } },
1680 - { "load apt sources list", TYPE_BOOL, { 0 } },
1681 - { "exclude path", TYPE_STR | TYPE_PATHLIST | TYPE_MULTI , { 0 } },
1682 - { "allow duplicates", TYPE_BOOL , { 0 } },
1683 - { "multilib", TYPE_BOOL, { 0 } },
1684 - { "__dirname", TYPE_STR, { 0 } },
1685 - { NULL, 0, { 0 } },
1688 -static struct tag fetcher_tags[] = {
1689 - { "name", TYPE_STR, { 0 } },
1690 - { "proto", TYPE_STR | TYPE_F_REQUIRED, { 0 } },
1691 - { "cmd", TYPE_STR | TYPE_F_ENV | TYPE_F_REQUIRED, { 0 } },
1692 - { NULL, 0, { 0 } },
1695 -static struct tag alias_tags[] = {
1696 - { "name", TYPE_STR | TYPE_F_REQUIRED, { 0 } },
1697 - { "cmd", TYPE_STR | TYPE_F_REQUIRED, { 0 } },
1698 - { "ctx", TYPE_ENUM, { "none", "installed", "available", "upgradeable", NULL } },
1699 +/* XXX: aliases are not implemented yet
1700 +static struct poldek_conf_tag alias_tags[] = {
1701 + { "name", CONF_TYPE_STRING | CONF_TYPE_F_REQUIRED, { 0 } },
1702 + { "cmd", CONF_TYPE_STRING | CONF_TYPE_F_REQUIRED, { 0 } },
1703 + { "ctx", CONF_TYPE_ENUM, { "none", "installed", "available", "upgradeable", NULL } },
1706 + { "pri", CONF_TYPE_STRING , { 0 } },
1709 -static struct tag source_tags[] = {
1710 - { "name", TYPE_STR, { 0 } },
1711 - { "url", TYPE_STR | TYPE_F_ENV | TYPE_F_REQUIRED, { 0 } },
1712 - { "path", TYPE_STR | TYPE_F_ENV | TYPE_F_ALIAS, { 0 } }, /* alias for url */
1713 - { "prefix", TYPE_STR | TYPE_F_ENV, { 0 } },
1714 - { "pri", TYPE_STR , { 0 } },
1715 - { "lang", TYPE_STR | TYPE_F_ENV, { 0 } },
1716 - { "dscr", TYPE_STR | TYPE_F_ENV | TYPE_F_ALIAS, { 0 } },
1717 - { "type", TYPE_STR , { 0 } },
1718 - { "original type", TYPE_STR , { 0 } },
1719 - { "noauto", TYPE_BOOL, { 0 } },
1720 - { "noautoup", TYPE_BOOL, { 0 } },
1721 - { "auto", TYPE_BOOL, { 0 } },
1722 - { "autoup", TYPE_BOOL, { 0 } },
1723 - { "douniq", TYPE_BOOL, { 0 } },
1724 - { "unique package names", TYPE_BOOL | TYPE_F_ALIAS, { 0 } },
1725 - { "signed", TYPE_BOOL, { 0 } },
1726 - { "hold", TYPE_STR | TYPE_LIST | TYPE_MULTI , { 0 } },
1727 - { "ignore", TYPE_STR | TYPE_LIST | TYPE_MULTI , { 0 } },
1728 - { "exclude path", TYPE_STR | TYPE_PATHLIST | TYPE_MULTI , { 0 } },
1729 - { "sources" , TYPE_STR | TYPE_LIST | TYPE_MULTI, { 0 }, },
1730 - { NULL, 0, { 0 } },
1739 -struct section sections[] = {
1740 - { "global", global_tags, 0 },
1741 - { "source", source_tags, 1 },
1742 - { "fetcher", fetcher_tags, 1 },
1743 - { "alias", alias_tags, 1 },
1744 - { NULL, NULL, 0 },
1746 +struct poldek_conf_section *sections = poldek_conf_sections; /* just for short */
1748 #define COPT_MULTIPLE (1 << 0)
1750 @@ -254,9 +137,15 @@
1753 p = v = n_str_tokl(vstr, sep);
1756 + if (v == NULL) /* n_str_tokl error */
1759 + if (*v == NULL) { /* empty option value */
1760 + n_str_tokl_free(v);
1764 if (n_hash_exists(ht, name)) {
1765 opt = n_hash_get(ht, name);
1779 -const struct section *find_section(const char *name)
1780 +const struct poldek_conf_section *find_section(const char *name)
1784 @@ -343,11 +233,11 @@
1787 int find_tag(const char *sectname, const char *key,
1788 - const struct section **sectp)
1789 + const struct poldek_conf_section **sectp)
1792 - struct tag *tags = NULL;
1793 - const struct section *sect;
1794 + struct poldek_conf_tag *tags = NULL;
1795 + const struct poldek_conf_section *sect;
1798 if ((sect = find_section(sectname)) == NULL)
1799 @@ -450,17 +340,17 @@
1803 -static int verify_section(const struct section *sect, tn_hash *ht)
1804 +static int verify_section(const struct poldek_conf_section *sect, tn_hash *ht)
1806 int i = 0, nerr = 0;
1808 + struct poldek_conf_tag *tags;
1811 fl = n_hash_get(ht, "__file__line");
1814 while (tags[i].name) {
1815 - if ((tags[i].flags & TYPE_F_REQUIRED) && !n_hash_exists(ht, tags[i].name)) {
1816 + if ((tags[i].flags & CONF_TYPE_F_REQUIRED) && !n_hash_exists(ht, tags[i].name)) {
1817 const char *missing_tag = tags[i].name;
1819 if (n_str_eq(sect->name, "source") &&
1820 @@ -586,13 +476,43 @@
1821 #define ADD_PARAM_OVERWRITE (1 << 1)
1822 #define ADD_PARAM_FOREIGN (1 << 2)
1824 +static int verify_param_presence(tn_hash *ht_sect, const char *section,
1826 + const struct poldek_conf_tag *tag,
1828 + const char *filemark)
1831 + int gotit = 0, overwrite = (flags & ADD_PARAM_OVERWRITE), rc = 1;
1833 + if (n_hash_exists(ht_sect, name)) {
1834 + struct copt *opt = n_hash_get(ht_sect, name);
1835 + gotit = (opt->val != NULL);
1841 + if (overwrite || (tag->flags & CONF_TYPE_F_MULTI_EXCL)) {
1842 + if (!overwrite || poldek_VERBOSE > 1)
1843 + logn(LOGWARN, _("%s %s::%s redefined"), filemark, section, name);
1844 + n_hash_remove(ht_sect, name);
1846 + } else if ((tag->flags & CONF_TYPE_F_MULTI) == 0) {
1847 + logn(LOGWARN, _("%s: multiple '%s' not allowed"), filemark, name);
1854 static int add_param(tn_hash *ht_sect, const char *section,
1855 char *name, char *value, unsigned flags,
1856 const char *path, int nline)
1858 char *val, expanded_val[PATH_MAX], filemark[512];
1859 - const struct section *sect;
1860 - const struct tag *tag;
1861 + const struct poldek_conf_section *sect;
1862 + const struct poldek_conf_tag *tag;
1864 int tagindex, validate, overwrite;
1866 @@ -635,14 +555,15 @@
1868 msgn_i(3, 2, "%s::%s = %s", section, name, value);
1870 - if (tag->flags & TYPE_F_ALIAS) {
1871 + if (tag->flags & CONF_TYPE_F_ALIAS) {
1876 - if ((sect->tags[n].flags & TYPE_F_ALIAS) == 0) {
1877 + if ((sect->tags[n].flags & CONF_TYPE_F_ALIAS) == 0) {
1878 msg(5, "alias %s -> %s\n", name, sect->tags[n].name);
1879 p = name = sect->tags[n].name;
1880 + tag = §->tags[n];
1884 @@ -652,10 +573,13 @@
1889 + if (!verify_param_presence(ht_sect, section, name, tag, flags, filemark))
1892 - if (tag->flags & (TYPE_LIST | TYPE_PATHLIST))
1893 + if (tag->flags & CONF_TYPE_F_LIST)
1894 return getvlist(ht_sect, name, value,
1895 - (tag->flags & TYPE_PATHLIST) ? " \t,:" : " \t,",
1896 + (tag->flags & CONF_TYPE_F_PATH) ? " \t,:" : " \t,",
1899 val = getv(value, path, nline);
1904 - if ((tag->flags & TYPE_ENUM)) {
1905 + if ((tag->flags & CONF_TYPE_ENUM)) {
1906 int n = 0, valid = 0;
1907 while (tag->enums[n]) {
1908 if (strcmp(tag->enums[n++], val) == 0) {
1909 @@ -693,21 +617,22 @@
1910 n_hash_insert(ht_sect, opt->name, opt);
1913 - if (tag->flags & TYPE_F_ENV)
1914 - val = (char*)expand_env_vars(expanded_val, sizeof(expanded_val), val);
1915 + if (tag->flags & CONF_TYPE_F_ENV)
1916 + val = (char*)poldek_util_expand_env_vars(expanded_val,
1917 + sizeof(expanded_val), val);
1919 if (opt->val == NULL) {
1920 opt->val = n_strdup(val);
1921 DBGF("ADD %p %s -> %s\n", ht_sect, name, val);
1923 - } else if (overwrite || (tag->flags & TYPE_MULTI_EXCL)) {
1924 - if (!overwrite || poldek_VERBOSE > 1)
1925 - logn(LOGWARN, _("%s %s::%s redefined"), filemark, section, name);
1926 + } else if (overwrite || (tag->flags & CONF_TYPE_F_MULTI_EXCL)) {
1927 + n_assert(0); /* verify_param_presence() should catch this */
1929 opt->val = n_strdup(val);
1931 - } else if ((tag->flags & TYPE_MULTI) == 0) {
1932 - logn(LOGWARN, _("%s: multiple '%s' not allowed"), filemark, name);
1933 + } else if ((tag->flags & CONF_TYPE_F_MULTI) == 0) {
1934 + n_assert(0); /* verify_param_presence() should catch this */
1935 + //logn(LOGWARN, _("%s: multiple '%s' not allowed"), filemark, name);
1938 } else if (opt->vals != NULL) {
1939 @@ -824,14 +749,16 @@
1940 p = (char*)do_expand_value(expval, sizeof(expval), p, ht, ht_global);
1943 - p = (char*)expand_env_vars(expenv_val, sizeof(expenv_val), p);
1944 + p = (char*)poldek_util_expand_env_vars(expenv_val, sizeof(expenv_val),
1947 n_snprintf(path, size, "%s", p);
1952 -tn_hash *open_section_ht(tn_hash *htconf, const struct section *sect,
1953 +tn_hash *open_section_ht(tn_hash *htconf,
1954 + const struct poldek_conf_section *sect,
1955 const char *sectnam, const char *path, int nline)
1960 void *poldek_conf_add_section(tn_hash *htconf, const char *name)
1962 - const struct section *sect = NULL;
1963 - tn_hash *ht_sect = NULL;
1964 + const struct poldek_conf_section *sect = NULL;
1965 + tn_hash *ht_sect = NULL;
1967 if ((sect = find_section(name)) == NULL) {
1968 logn(LOGERR, _("'%s': invalid section name"), name);
1969 @@ -1086,7 +1013,7 @@
1972 if (*p == '[') { /* section */
1973 - const struct section *sect = NULL;
1974 + const struct poldek_conf_section *sect = NULL;
1978 @@ -1392,7 +1319,7 @@
1981 if (sscanf(vs, "%d", &v) != 1) {
1982 - logn(LOGERR, _("invalid value ('%s') of option '%s'"), vs, name);
1983 + logn(LOGERR, _("invalid value ('%s') of integer option '%s'"), vs, name);
1987 @@ -1409,6 +1336,22 @@
1990 if ((bool = poldek_util_parse_bool(v)) < 0) {
1991 + logn(LOGERR, _("invalid value ('%s') of boolean option '%s'"), v, name);
1998 +int poldek_conf_get_bool3(const tn_hash *htconf, const char *name, int default_v)
2003 + if ((v = poldek_conf_get(htconf, name, NULL)) == NULL)
2006 + if ((bool = poldek_util_parse_bool3(v)) < 0) {
2007 logn(LOGERR, _("invalid value ('%s') of option '%s'"), v, name);
2010 @@ -1438,7 +1381,7 @@
2012 static void load_apt_sources_list(tn_hash *htconf, const char *path)
2014 - const struct section *sect = NULL;
2015 + const struct poldek_conf_section *sect = NULL;
2016 const char **tl, **tl_save, *sectnam;
2019 @@ -1527,89 +1470,3 @@
2025 -static const char *strtype(unsigned flags)
2027 - if (flags & TYPE_PATHLIST)
2028 - return "str-list";
2030 - if (flags & TYPE_STR)
2033 - if (flags & TYPE_BOOL)
2036 - if (flags & TYPE_INT)
2040 - if (flags & TYPE_ENUM)
2048 -static void dump_section(struct section *sect)
2053 - printf("<section name=\"%s\">\n", sect->name);
2056 - tag = sect->tags[i++];
2057 - if (tag.name == NULL)
2060 - if (tag.flags & TYPE_F_OBSL)
2063 - printf(" <option name=\"%s\" type=\"%s%s\"", tag.name,
2064 - strtype(tag.flags),
2065 - (tag.flags & TYPE_LIST) ? "-list" : "");
2066 - printf(" default=\"\"");
2067 - if (tag.flags & TYPE_MULTI_EXCL)
2068 - printf(" redefinable=\"yes\"");
2070 - if (tag.flags & TYPE_MULTI)
2071 - printf(" multiple=\"yes\"");
2073 - if (tag.flags & TYPE_F_ENV)
2074 - printf(" env=\"yes\"");
2076 - if (tag.flags & TYPE_F_ALIAS)
2077 - printf(" alias=\"yes\"");
2079 - if (tag.flags & TYPE_F_REQUIRED)
2080 - printf(" required=\"yes\"");
2084 - if (tag.flags & TYPE_ENUM) {
2086 - printf(" <values>\n");
2087 - while (tag.enums[n])
2088 - printf(" <enum>%s</enum>\n", tag.enums[n++]);
2089 - printf(" </values>\n");
2091 - printf(" <descripion>\n");
2092 - printf(" </descripion>\n");
2094 - printf(" </option>\n\n");
2096 - printf("</section> <!-- end of \"%s\" -->\n", sect->name);
2100 -void dump_sections(const char *name)
2103 - while (sections[i].name) {
2104 - dump_section(§ions[i]);
2109 diff -urN poldek-0.20.org/conf.h poldek-0.20/conf.h
2110 --- poldek-0.20.org/conf.h 2005-05-05 20:54:31.000000000 +0200
2111 +++ poldek-0.20/conf.h 2006-07-26 20:25:54.059317250 +0200
2115 /* ini-like config parsing module */
2116 #ifndef POLDEK_CONF_H
2117 #define POLDEK_CONF_H
2120 tn_hash *poldek_conf_load(const char *path, unsigned flags);
2121 tn_hash *poldek_conf_loadefault(unsigned flags);
2125 + Adds to htconf parameters discovered from lines. If htconf is NULL
2126 + then it is created. Caution: parameters from lines overwrite
2127 + previously discovered ones, i.e. if lines = [ 'foo = a', 'foo = b' ]
2128 + then 'foo' value will be 'b'
2130 tn_hash *poldek_conf_addlines(tn_hash *htconf, const char *sectnam,
2135 const char *poldek_conf_get(const tn_hash *htconf, const char *name, int *is_multi);
2136 int poldek_conf_get_bool(const tn_hash *htconf, const char *name, int default_v);
2137 +int poldek_conf_get_bool3(const tn_hash *htconf, const char *name, int default_v);
2138 int poldek_conf_get_int(const tn_hash *htconf, const char *name, int default_v);
2139 tn_array *poldek_conf_get_multi(const tn_hash *htconf, const char *name);
2141 diff -urN poldek-0.20.org/configure.in poldek-0.20/configure.in
2142 --- poldek-0.20.org/configure.in 2005-10-28 17:32:26.000000000 +0200
2143 +++ poldek-0.20/configure.in 2006-07-26 20:25:54.067317750 +0200
2145 dnl Process this file with autoconf to produce a configure script.
2149 AC_INIT(poldek,0.20)
2150 AC_CONFIG_SRCDIR([capreq.c])
2151 @@ -293,9 +293,16 @@
2152 LIBS="$LIBS -lbz2 -lrpmio"
2155 -AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
2156 - [AC_MSG_WARN("[poldek will not work fine with rpmlib\(...\) capabilities"])],
2157 - [$CONF_IN_LDFLAGS])
2158 +AC_CHECK_FUNCS(rpmdsRpmlib,,
2159 + [ AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
2160 + [AC_MSG_WARN(["poldek will not work fine with rpmlib\(...\) capabilities"])],
2161 + [$CONF_IN_LDFLAGS])], [$CONF_IN_LDFLAGS])
2163 +AC_CHECK_FUNCS(rpmdsUname)
2164 +AC_CHECK_FUNCS(rpmdsSysinfo)
2165 +AC_CHECK_FUNCS(rpmdsGetconf)
2166 +AC_CHECK_FUNCS(rpmdsCpuinfo)
2175 + vfile/tests/Makefile
2179 diff -urN poldek-0.20.org/conf_intern.h poldek-0.20/conf_intern.h
2180 --- poldek-0.20.org/conf_intern.h 1970-01-01 01:00:00.000000000 +0100
2181 +++ poldek-0.20/conf_intern.h 2006-07-26 20:25:54.067317750 +0200
2184 +/* ini-like config parsing module */
2187 +#ifndef POLDEK_CONF_INTERN_H
2188 +#define POLDEK_CONF_INTERN_H
2190 +#define CONF_TYPE_STRING (1 << 0)
2191 +#define CONF_TYPE_BOOLEAN (1 << 1)
2192 +#define CONF_TYPE_BOOLEAN3 (1 << 2) /* yes, no, auto */
2193 +#define CONF_TYPE_INTEGER (1 << 3)
2194 +#define CONF_TYPE_ENUM (1 << 4)
2196 +#define CONF_TYPE_F_LIST (1 << 5) /* values list */
2197 +#define CONF_TYPE_F_PATH (1 << 6) /* path -"- */
2198 +#define CONF_TYPE_F_MULTI (1 << 7) /* may occurr multiple times */
2199 +#define CONF_TYPE_F_MULTI_EXCL (1 << 8) /* may occurr multiple times, last occurrence
2200 + is taken into account */
2202 +#define CONF_TYPE_F_ENV (1 << 10) /* environment variables are expanded */
2203 +#define CONF_TYPE_F_REQUIRED (1 << 11) /* */
2204 +#define CONF_TYPE_F_ALIAS (1 << 12) /* an alias */
2205 +#define CONF_TYPE_F_OBSL (1 << 14) /* obsoleted */
2207 +struct poldek_conf_tag {
2211 + int _op_no; /* internal option number */
2215 +struct poldek_conf_section {
2217 + struct poldek_conf_tag *tags;
2221 +extern struct poldek_conf_section poldek_conf_sections[];
2224 diff -urN poldek-0.20.org/doc/conf-xml2c.xsl poldek-0.20/doc/conf-xml2c.xsl
2225 --- poldek-0.20.org/doc/conf-xml2c.xsl 1970-01-01 01:00:00.000000000 +0100
2226 +++ poldek-0.20/doc/conf-xml2c.xsl 2006-07-26 20:25:54.067317750 +0200
2228 +<xsl:stylesheet version="1.0"
2229 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2231 +<!-- poldek.conf.xml -> conf_sections.c -->
2234 +<xsl:output method="text" indent="no" />
2235 +<xsl:template match="/">
2236 +/* This file is generated from poldek.conf.xml. Do not edit */
2237 +#include <stdlib.h>
2238 +#include "conf_intern.h"
2239 +#include "poldek_ts.h"
2240 + <xsl:for-each select="config/confsection">
2241 +static struct poldek_conf_tag <xsl:value-of select="@name"/>_tags[] = {
2242 + <xsl:for-each select="optiongroup">
2243 + <xsl:for-each select="option">
2244 + { "<xsl:value-of select="@name"/>",
2245 + CONF_TYPE_<xsl:value-of select="translate(@type,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
2246 + <xsl:if test="@multiple='yes'"> | CONF_TYPE_F_MULTI</xsl:if>
2247 + <xsl:if test="@required='yes'"> | CONF_TYPE_F_REQUIRED</xsl:if>
2248 + <xsl:if test="@env='yes'"> | CONF_TYPE_F_ENV</xsl:if>
2249 + <xsl:if test="@list='yes'"> | CONF_TYPE_F_LIST</xsl:if>
2250 + <xsl:if test="@path='yes'"> | CONF_TYPE_F_PATH</xsl:if>
2251 + <xsl:if test="@obsoleted='yes'"> | CONF_TYPE_F_OBSL</xsl:if>,
2253 + <xsl:when test="string-length(@default) > 0">"<xsl:value-of select="@default"/>"</xsl:when>
2254 + <xsl:otherwise>NULL</xsl:otherwise>
2257 + <xsl:when test="string-length(@op) > 0">POLDEK_OP_<xsl:value-of select="@op"/></xsl:when>
2258 + <xsl:otherwise>0</xsl:otherwise>
2259 + </xsl:choose>, { 0 } },
2260 + <xsl:for-each select="alias">
2261 + { "<xsl:value-of select="@name"/>", CONF_TYPE_F_ALIAS<xsl:if test="@obsoleted='yes'"> | CONF_TYPE_F_OBSL</xsl:if>, NULL, 0, { 0 } },
2266 + { NULL, 0, NULL, 0, { 0 } }
2272 +struct poldek_conf_section poldek_conf_sections[] = {
2273 + <xsl:for-each select="config/confsection">
2274 + { "<xsl:value-of select="@name"/>", <xsl:value-of select="@name"/>_tags,
2276 + <xsl:when test="@multiple='yes'">1</xsl:when>
2277 + <xsl:otherwise>0</xsl:otherwise>
2287 diff -urN poldek-0.20.org/doc/conf-xml2.sh poldek-0.20/doc/conf-xml2.sh
2288 --- poldek-0.20.org/doc/conf-xml2.sh 2005-05-23 21:05:05.000000000 +0200
2289 +++ poldek-0.20/doc/conf-xml2.sh 2006-07-26 20:25:54.075318250 +0200
2295 + xsltproc $DN/conf-xml2c.xsl $FILE
2300 # - replace [screen] to '=remove' (removed at end)
2302 elif [ "$TO" = "docb" ]; then
2305 +elif [ "$TO" = "c" ]; then
2308 elif [ "$TO" = "conf" ]; then
2310 [ -n "$NAME" ] || exit 1
2311 diff -urN poldek-0.20.org/doc/conf-xml2testconf.xsl poldek-0.20/doc/conf-xml2testconf.xsl
2312 --- poldek-0.20.org/doc/conf-xml2testconf.xsl 1970-01-01 01:00:00.000000000 +0100
2313 +++ poldek-0.20/doc/conf-xml2testconf.xsl 2006-07-26 20:25:54.075318250 +0200
2315 +<xsl:stylesheet version="1.0"
2316 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2317 +<!-- poldek.conf.xml -> tests/poldek_test_conf.conf -->
2320 +<xsl:output method="text" indent="no" />
2321 +<xsl:template match="/">
2322 + <xsl:for-each select="config/confsection">
2323 +[<xsl:value-of select="@name"/>]
2324 + <xsl:for-each select="optiongroup">
2325 + <xsl:for-each select="option[@type='boolean' or @type='boolean3']">
2327 + <xsl:when test="@default='yes'">
2328 +<xsl:value-of select="@name"/> = no
2330 + <xsl:when test="@default='no'">
2331 +<xsl:value-of select="@name"/> = yes
2333 + <xsl:when test="@default='auto'">
2334 +<xsl:value-of select="@name"/> = auto
2337 +<xsl:value-of select="@name"/> = yes
2342 + <xsl:for-each select="option[@type='string']">
2343 + <xsl:if test="not(contains(@name, '*'))">
2345 + <xsl:when test="string-length(@default) > 0">
2346 + <xsl:value-of select="@name"/> = <xsl:value-of select="@default"/>
2349 + <xsl:value-of select="@name"/> = <xsl:value-of select="translate(@name,' ','_')"/>
2356 + <xsl:for-each select="option[@type='integer']">
2358 + <xsl:when test="string-length(@default) > 0">
2359 + <xsl:value-of select="@name"/> = <xsl:value-of select="@default"/>
2362 + <xsl:value-of select="@name"/> = 100;
2374 diff -urN poldek-0.20.org/doc/homepage/download-body.html poldek-0.20/doc/homepage/download-body.html
2375 --- poldek-0.20.org/doc/homepage/download-body.html 2005-10-28 17:32:27.000000000 +0200
2376 +++ poldek-0.20/doc/homepage/download-body.html 2006-07-26 20:25:54.075318250 +0200
2378 <li> <a href="download/poldek-POLDEK_VERSION.tar.bz2">poldek-POLDEK_VERSION.tar.bz2</a></li>
2379 <li> <a href="download/poldek-POLDEK_VERSION-1.src.rpm">poldek-POLDEK_VERSION-1.src.rpm</a> </li>
2381 -<p>An older versions are available <a href="download/">here</a>.
2382 - Development snapshots are available <a href="download/snapshots/">here</a></p>
2384 +An older versions are available <a href="download/">here</a>.
2385 +Development snapshots are available <a href="download/snapshots/">here</a>
2388 <h1> Binary packages </h1>
2390 -<h2> PLD Linux </h2>
2391 +<h2> <a href="http://pld-linux.org/">PLD Linux</a> </h2>
2394 <a href="download/pld/ra/poldek-POLDEK_VERSION-1.i386.rpm">poldek-POLDEK_VERSION-1.i386.rpm</a>
2398 -<p> Packages for other architectures as for developement PLD branches are available on PLD
2400 +Packages for other architectures as for developement PLD branches are available on PLD
2401 <a href="http://ftp.pld-linux.org">FTP site</a>.
2404 +<h2> <a href="http://fedora.redhat.com/">Fedora Core</a> </h2>
2406 -<h2> Fedora Core </h2>
2409 <a href="download/fedora/c4/poldek-POLDEK_VERSION-1.i386.rpm">poldek-POLDEK_VERSION-1.i386.rpm</a>
2411 <p> An older versions of packages for previous Fedora Core releases can be found <a href="download/fedora/">here</a>.
2415 +<h2> <a href="http://www.redhat.com/">RedHat</a> </h2>
2417 <li> RedHat 9 (rpm 4.2)
2418 <a href="download/rh/9.0/poldek-0.20-1.i386.rpm">poldek-0.20-1.i386.rpm</a>
2422 -<p> An older versions of packages for several RedHat versions can be found <a href="download/rh/">here</a>.
2426 +An older versions of packages for several RedHat versions can be found <a href="download/rh/">here</a>.
2429 +<h2> <a href="http://www.centos.org/">CentOS</a> </h2>
2431 +CentOS aims to be 100% binary compatible with
2432 +<a href="http://www.redhat.com/en_us/USA/rhel">Red Hat Enterprise Linux</a>.
2435 +Packages maintained by Arkadiusz Patyk <<em>areq att pld-linux org</em>>,
2436 +available <a href="http://rescuecd.pld-linux.org/poldek/CentOS/">here</a>.
2440 +<p> Send <a href="mailto: mis @ pld.org.pl">me</a> a links to packages
2443 diff -urN poldek-0.20.org/doc/homepage/Makefile.am poldek-0.20/doc/homepage/Makefile.am
2444 --- poldek-0.20.org/doc/homepage/Makefile.am 2005-10-28 18:38:17.000000000 +0200
2445 +++ poldek-0.20/doc/homepage/Makefile.am 2006-07-26 20:25:54.079318500 +0200
2450 WWW_PAGES = page-template.html \
2451 devel-body.html download-body.html index-body.html related-body.html \
2454 EXTRA_DIST = $(WWW_PAGES) $(WWWBINS)
2457 + ./genhomepage --clean --destdir site
2458 + ./genhomepage --destdir site || exit 1
2461 +site: $(WWW_PAGES) ../manual.xml ../NEWS.xml ../NEWSto
2462 $(MAKE) -C .. manual-web
2463 $(MAKE) -C ../.. NEWS
2464 $(MAKE) -C .. NEWS.html
2466 cp ../NEWS.html ../manual.css style.css logo90.png site
2467 rm -rf site/manual && cp -a ../manual-web site/manual
2469 -credits-body.html: ../NEWS.xml
2470 +credits-body.html: ../NEWS.xml ../NEWSto
2471 $(MAKE) -C .. CREDITS-body.html NEWS.html
2472 cp ../CREDITS-body.html credits-body.html
2474 diff -urN poldek-0.20.org/doc/homepage/style.css poldek-0.20/doc/homepage/style.css
2475 --- poldek-0.20.org/doc/homepage/style.css 1970-01-01 01:00:00.000000000 +0100
2476 +++ poldek-0.20/doc/homepage/style.css 2006-07-26 20:25:54.087319000 +0200
2479 + background: white;
2485 + background: white;
2489 + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
2495 + font-weight: bold;
2502 +a, a:link, a:visited {
2503 + text-decoration: none;
2508 + text-decoration: underline;
2512 + text-decoration: none;
2532 + font-weight: bold;
2539 + //border: 1px solid #ccc;
2543 + margin-left: 10px;
2550 + vertical-align: middle;
2554 + #position: absolute;
2560 + background-color: #EEEEEE;
2561 + border: 1px dashed #ccc;
2582 + margin-left: 165px;
2583 + //border: 1px solid #ccc;
2586 +/* from manual.css */
2587 +.option, .filename { font-weight: bold; font-size: 12px; }
2590 +.prompt { font-family: courier, monospace; }
2593 + background-color: #EEEEEE;
2594 + font-family: courier, monospace;
2597 + padding-left: 5px;
2599 + border: 1pt solid #DDDDDD;
2600 + /* background: #fff8eb; */
2602 + /* begin css 3 or browser specific rules - do not remove!
2603 + see: http://forums.techguy.org/archive/index.php/t-249849.html */
2604 + white-space: pre-wrap;
2605 + word-wrap: break-word;
2606 + white-space: -moz-pre-wrap;
2607 + white-space: -pre-wrap;
2608 + white-space: -o-pre-wrap;
2609 + moz-border-radius: 10px;
2610 + /* end css 3 or browser specific rules */
2614 + font-weight: normal;
2615 + font-family: courier, monospace;
2616 + font-style: normal;
2625 diff -urN poldek-0.20.org/doc/homepage/support-body.html poldek-0.20/doc/homepage/support-body.html
2626 --- poldek-0.20.org/doc/homepage/support-body.html 2005-10-24 13:24:54.000000000 +0200
2627 +++ poldek-0.20/doc/homepage/support-body.html 2006-07-26 20:25:54.087319000 +0200
2631 +<h1> Documentation & co.</h1>
2633 +<li> poldek <a href="http://team.pld.org.pl/~mis/poldek/manual/">manual</a>
2638 <h1>Mailing list</h1>
2640 <p>Program mailing list <code>poldek@pld-linux.org</code>.
2642 <a href="http://lists.pld-linux.org/mailman/listinfo/poldek">web interface</a>,
2643 or by sending a message to <a href="mailto:poldek-subscribe@pld-linux.org">poldek-subscribe@pld-linux.org</a>.
2647 <a href="http://lists.pld-linux.org/mailman/pipermail/poldek/">http://lists.pld-linux.org/mailman/pipermail/poldek/</a>.
2651 List traffic is rather low, most poldek issues are discussed on PLD <a href="http://pld-linux.org/MailingLists">mailing lists</a>.
2655 <h1>Issue Tracker</h1>
2657 Project bugs and other issues database is placed in PLD
2658 -<a href="http://bugs.pld-linux.org/index.php?project=111" title="Bug Tracking System">BTS</a>. Use it to report a bug or request a feature.
2659 +<a href="http://bugs.pld-linux.org/index.php?project=111" title="Bug Tracking System">BTS</a>. Please use it to report a bug or request a feature, although you may <a href="mailto: mis @ pld.org.pl">mail</a> author directly as well.
2662 diff -urN poldek-0.20.org/doc/Makefile.am poldek-0.20/doc/Makefile.am
2663 --- poldek-0.20.org/doc/Makefile.am 2005-10-28 18:50:15.000000000 +0200
2664 +++ poldek-0.20/doc/Makefile.am 2006-07-26 20:25:54.087319000 +0200
2670 # $(GEN) files are automatically generated, don't modify them. See
2672 CREDITS: CREDITS.docb.tmp
2673 xmlto -m NEWS.xsl txt CREDITS.docb.tmp && mv CREDITS.docb.txt $@
2676 +CREDITS-body.html: NEWS.xml NEWSto
2677 ./NEWSto CREDITS.html_body > $@
2679 NEWS.docb.tmp: NEWS.xml NEWSdocb.xsl NEWSto
2680 diff -urN poldek-0.20.org/doc/manual-web.xsl poldek-0.20/doc/manual-web.xsl
2681 --- poldek-0.20.org/doc/manual-web.xsl 1970-01-01 01:00:00.000000000 +0100
2682 +++ poldek-0.20/doc/manual-web.xsl 2006-07-26 20:25:54.095319500 +0200
2684 +<?xml version='1.0'?>
2685 +<!-- add home link, applied as -m argument of xmlto -->
2686 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
2688 +<xsl:template name="user.header.navigation">
2689 + <div align="right">
2690 + [<a href="../">poldek home</a>]
2695 diff -urN poldek-0.20.org/doc/manual.xml poldek-0.20/doc/manual.xml
2696 --- poldek-0.20.org/doc/manual.xml 2005-10-28 17:32:27.000000000 +0200
2697 +++ poldek-0.20/doc/manual.xml 2006-07-26 20:25:54.095319500 +0200
2702 -<date>$Date$</date>
2703 -<releaseinfo>$Id$</releaseinfo>
2704 +<date>$Date$</date>
2705 +<releaseinfo>$Id$</releaseinfo>
2708 <keyword>package management</keyword>
2710 <sect1 id="overview"> <title id="overview.title">Overview</title>
2712 &poldek; is a full-featured frontend to RPM package manager. Its core features
2713 -are similar to every modern package updater like &apt-get;. Features include
2714 +are similar to every modern package updater like &apt-get;. The features include
2715 package installation, upgrading and removal with automatic dependency handling,
2716 querying/ search the package database and more.
2719 <varlistentry><term>Easy to use</term>
2722 - Basic command line options and switches are similar in use to &rpm;
2723 - so &poldek; is easy to learn for users familiar with it. Apart from
2724 - rpm-like command line switches, &poldek; provides higher level command
2725 + &poldek; is easy to learn for users familiar with &rpm; because the
2726 + basic command line options and switches are similar in use.
2728 + Apart from rpm-like command line switches, &poldek; provides higher level command
2729 set ("install", "upgrade", "ls", etc) quite intuitive for those who knows &apt-get;.
2730 - Shell-like interface with auto-completion and history is also provided.
2731 + A very handy shell-like interface with auto-completion and history is also provided.
2735 @@ -108,12 +109,11 @@
2738 &poldek; has been designed with efficiency and scalability in mind.
2739 - Native package repository index format is optimized for storage size
2740 - and loading speed. Package dependencies, conflicts and setting
2741 - in order are handled without using <application>rpmlib</application>,
2742 - so the program is significantly faster and needs less memory than
2743 - rpmlib-based tools. On typical machine &poldek; can handle 20K packages
2744 - without noticable speed degradation.
2745 + The native package repository index format is optimized for storage size
2746 + and loading speed. Dependency processing (dependencies, conflicts, package
2747 + ordering) is significantly faster and needs less memory than rpmlib-based
2748 + tools. &poldek; can handle 20K packages without noticable
2749 + speed degradation on typical machine.
2753 @@ -121,9 +121,11 @@
2754 <varlistentry><term>Incremental repository updates</term>
2757 - &poldek;'s repositories are updateable by downloading a changes
2758 - of remote repository only, what drastically reduces amout of data
2759 - need to be retrieved when remote repository was changed a bit.
2760 + &poldek;'s native repositories are able to update incrementally.
2761 + During the update only the incremental files are transferred
2762 + instead of the complete index. Such files are certainly much smaller,
2763 + what drastically reduces amout of data need to be retrieved
2764 + when remote repository was changed a bit.
2768 @@ -582,12 +584,13 @@
2769 <sect1 id="pkgmanaging"> <title>Managing packages</title>
2771 &poldek; operates in two basic modes - the first one is more generic
2772 -and compliant with &rpm; (&poldek; command) and second <emphasis>interactive</emphasis>
2773 -mode with simplified and more intuitive command set. </para>
2774 +and compliant with &rpm; (&poldek; command) and the second,
2775 +called <emphasis>interactive</emphasis> mode with simplified and
2776 +intuitive command set. </para>
2779 -Interactive mode is available from both command line (&ipoldek; command) and shell
2780 -like interface with auto-completion and history. To enter shell interface
2781 +Interactive mode commands is available from both command line (&ipoldek; command)
2782 +and shell like interface with auto-completion and history. To enter shell interface
2783 execute &ipoldek; without any "command" options like "install", "erase", etc.
2784 See also an <link linkend="screen.shell-start">example</link>.
2788 To install packages in &rpm; sense, i.e. do not upgrade even if older version is already installed:
2790 -&poldek-prompt; [OPTION..] --install (&rpm; mode)
2791 +&poldek-prompt; [OPTION..] --install (command line mode)
2792 &ipoldek-prompt; [OPTION..] install -IN (interactive mode)
2799 -To install package or upgrade it if older version is already installed:
2800 +To install or upgrade package if older version is already installed:
2802 -&poldek-prompt; [OPTION..] --upgrade (&rpm; mode)
2803 +&poldek-prompt; [OPTION..] --upgrade (command line mode)
2804 &ipoldek-prompt; [OPTION..] install (interactive mode)
2806 This is most used installation type. Example:
2809 To upgrade packages, i.e. install only if older version is already installed:
2811 -&poldek-prompt; [OPTION..] --upgrade --fresh (&rpm; mode)
2812 +&poldek-prompt; [OPTION..] --upgrade --fresh (command line mode)
2813 &ipoldek-prompt; [OPTION..] upgrade (interactive mode)
2818 &poldek-prompt; --install-dist=DIR [PACKAGE...]
2820 -All unmet dependencies will be satisfied by marking additionall packages. In this type of installation
2821 -packages are installed one by one what, because of reduction of memory consumption and utilization of CPU, permits to install the system on older machines.
2822 +All unmet dependencies will be satisfied by marking additionall packages.
2823 +Packages are installed one by one what reduces memory consumption and CPU
2824 +utilization of CPU and permits to install the system on older machines.
2827 As example, command which installs system under <filename>/mnt/dest</filename> might looks like:
2830 To remove installed packages:
2832 -&poldek-prompt; [OPTION..] --erase (&rpm; mode)
2833 +&poldek-prompt; [OPTION..] --erase (command line mode)
2834 &ipoldek-prompt; [OPTION..] uninstall [ERASE_OPTION...] (interactive mode)
2844 See also package removal command line options <link linkend="ref.cmdl.package_deinstallation">reference</link>.
2845 @@ -900,19 +905,26 @@
2847 <sect2 id="security.sudo"> <title>Using sudo</title>
2849 -Setting on <option>use sudo</option> configuration opinion causes
2850 +<option>use sudo</option> configuration opinion causes
2851 execution of &rpm; binary through sudo for read-write operations.
2852 -The rest is of the operations may work without super user privileges.
2853 +The rest works without super user privileges.
2856 Of course it is necessary to configure <application>sudo</application>
2857 to allow the user to run <command>rpm</command> binary.
2861 +<option>use sudo</option> is set to "auto" by default, means that
2862 +<command>rpm</command> is executed through <command>sudo</command>
2863 +when poldek is run by an ordinary user.
2867 <sect2 id="security.runas"> <title>Automatic switching to an ordinary user</title>
2869 There is more automated way of using sudo. Configured by <option>runas</option>
2870 -option &poldek; will automatically switch to an ordinary user if detects beeing
2871 +option &poldek; will automatically switch to an ordinary user if detects being
2872 executed by root. To setup this scenario, set <option>runas</option> option:
2877 <varlistentry><term>Package conflicts</term>
2879 - Report prints all package pairs beeing in conflict or beeing obsoleted one another.
2880 + Report prints all package pairs being in conflict or being obsoleted one another.
2881 It lets to verify if all conflicts are needed, what are redundant, and so on. Report is
2882 called <emphasis>conflicts</emphasis>. Output example (Obsoletes
2883 are printed with asterisk '*'):
2886 <varlistentry><term>File conflicts</term>
2888 - Report prints all package pairs beeing in conflict on file level and pairs
2889 + Report prints all package pairs being in conflict on file level and pairs
2890 which share the same file. It lets to verify if all file conflicts are wanted.
2891 Report is called <emphasis>file-conflicts</emphasis>:
2893 diff -urN poldek-0.20.org/doc/manual.xsl poldek-0.20/doc/manual.xsl
2894 --- poldek-0.20.org/doc/manual.xsl 2005-10-28 17:32:27.000000000 +0200
2895 +++ poldek-0.20/doc/manual.xsl 2006-07-26 20:25:54.095319500 +0200
2897 <xsl:param name="html.stylesheet.type">text/css</xsl:param>
2898 <xsl:param name="html.stylesheet" select="'manual.css'"></xsl:param>
2901 +<xsl:param name="css.decoration" select="0"/>
2902 <xsl:param name="draft.mode" select="'no'"></xsl:param>
2905 diff -urN poldek-0.20.org/doc/mkindex.pl poldek-0.20/doc/mkindex.pl
2906 --- poldek-0.20.org/doc/mkindex.pl 1970-01-01 01:00:00.000000000 +0100
2907 +++ poldek-0.20/doc/mkindex.pl 2006-07-26 20:25:54.095319500 +0200
2911 +require XML::Simple;
2913 +use vars qw($file $xs $ref $xml $current_id);
2916 +foreach my $file (@ARGV) {
2917 + #print STDERR "FILE $file\n";
2918 + $xs = new XML::Simple();
2920 + open(F, "<$file") || die;
2923 + if ($lines[0] !~ /\<\?xml\s/) {
2924 + unshift @lines, "<xml>";
2925 + push @lines, "</xml>";
2927 + $ref = $xs->XMLin(join('', @lines), keeproot => 1, keyattr => [], forcecontent => 1);
2928 + #print Dumper($ref);
2929 + traverse(undef, $ref, \%out);
2932 +foreach my $term (keys %out) {
2933 + my %h = map { $_ => 1 } @{$out{$term}};
2934 + my $id = join(' ', keys %h);
2935 + print qq{<indexterm zone="$id"><primary>$term</primary></indexterm>\n};
2939 + my $key = shift || 'undef';
2941 + my $outhref = shift || die;
2943 + #print STDERR "traverse $key, $xml\n" if $key eq 'filename';
2944 + if (ref $xml eq 'HASH') {
2945 + $current_id = '' if exists $xml->{sect1} ||
2946 + exists $xml->{sect2} || exists $xml->{sect3};
2948 + my $previous = $current_id;
2949 + $current_id = $xml->{id} if $xml->{id} && exists $xml->{title};
2950 + $previous ||= '(empty)';
2951 + my $current_id_str = $current_id || '(empty)';
2952 + #print STDERR "ID $previous -> $current_id_str\n"
2953 + # if $previous ne $current_id_str;
2956 + if (ref $xml eq 'ARRAY') {
2957 + foreach my $elem (@{$xml}) {
2958 + next if !ref $elem && $key eq 'filename'; # index <file>s with ids only
2959 + next if !$key eq 'filename' && exists $elem->{id};
2960 + traverse($key, $elem, $outhref);
2963 + } elsif (ref $xml eq 'HASH') {
2964 + foreach (keys %$xml) {
2966 + if ($_ eq 'content') {
2967 + #index all <option>s
2968 + $akey = $key if $key eq 'option';
2969 + # and <file>s with ids
2970 + if ($key eq 'filename' && exists $xml->{id}) {
2972 + #print STDERR " DO $akey $xml->{id} $xml->{content}\n";
2975 + traverse($akey, $xml->{$_}, $outhref);
2979 + return if ref $xml;
2980 + return if $key ne 'option' && $key ne 'filename';
2982 + my $content = $xml;
2983 + $content =~ s/^([^\=]+)/$1/ if $content =~ /=/;
2984 + $content =~ s/^\s+//;
2985 + $content =~ s/\s+$//;
2986 + $content .= " file" if $key eq 'filename';
2987 + $outhref->{$content} ||= [];
2989 + push @{$outhref->{$content}}, $current_id;
2990 + #print STDERR " do $content $current_id\n";
2993 + if ($content =~ /\-\-/) {
2994 + my ($opt) = ($content =~ /\-\-([\w\-]+)/);
2996 + $outhref->{$opt} ||= [];
2997 + push @{$outhref->{$opt}}, $current_id;
3001 diff -urN poldek-0.20.org/doc/NEWSdocb.xsl poldek-0.20/doc/NEWSdocb.xsl
3002 --- poldek-0.20.org/doc/NEWSdocb.xsl 1970-01-01 01:00:00.000000000 +0100
3003 +++ poldek-0.20/doc/NEWSdocb.xsl 2006-07-26 20:25:54.103320000 +0200
3005 +<!-- convert NEWS.xml to docbook document -->
3006 +<xsl:stylesheet version="1.0"
3007 + xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3009 +<xsl:output method="xml"
3010 + doctype-public="-//OASIS//DTD DocBook XML V4.1.2//EN"
3011 + doctype-system="http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"
3012 + encoding="ISO-8859-1"
3014 +<xsl:strip-space elements="*"/>
3016 +<xsl:template match="/">
3017 +<article lang="en">
3019 +<title>poldek NEWS</title>
3020 +<releaseinfo><xsl:value-of select="news/cvsid"/></releaseinfo>
3023 +<xsl:apply-templates select="news"/>
3027 +<xsl:template match="news">
3028 +<xsl:for-each select="release[string-length(@date) > 0]">
3032 + <xsl:variable name="id_version">
3033 + <xsl:value-of select="translate(@version, '.', '_')"/>
3035 + <sect1 id="v{$id_version}"><title><xsl:value-of select="@version"/> (<xsl:value-of select="@focus"/>; <xsl:value-of select="@date"/>)</title>
3036 + <xsl:if test="para">
3037 + <para><xsl:value-of select="para"/></para>
3042 + <xsl:when test='section'>
3043 + <xsl:for-each select="section">
3044 + <sect2><title><xsl:value-of select="title"/></title>
3046 + <xsl:apply-templates select="entry"/>
3053 + <xsl:apply-templates select="entry"/>
3061 +<xsl:template match="entry">
3065 + <xsl:if test="count(para) = 1">
3067 + <xsl:value-of select="para"/>
3068 + <xsl:if test="author">
3069 + (<xsl:apply-templates select="author"/>)
3073 + <xsl:if test="count(para) > 1">
3074 + <xsl:for-each select="para">
3076 + <xsl:when test='@nowrap'>
3078 + <xsl:value-of select="."/>
3083 + <xsl:value-of select="."/>
3093 +<xsl:template match="author">
3094 + <emphasis><xsl:if test="@part">with help of </xsl:if><xsl:value-of select="."/></emphasis> <<emphasis><xsl:value-of select="@email"/></emphasis>><xsl:if test="not(position()=last())">, </xsl:if>
3097 +<xsl:template match="para">
3104 diff -urN poldek-0.20.org/doc/NEWSto poldek-0.20/doc/NEWSto
3105 --- poldek-0.20.org/doc/NEWSto 1970-01-01 01:00:00.000000000 +0100
3106 +++ poldek-0.20/doc/NEWSto 2006-07-26 20:25:54.103320000 +0200
3111 +require XML::Simple;
3113 +use vars qw($xs $xml $PREABLE %op);
3115 +%op = ('NEWS.docb' => \&to_NEWS_docb,
3116 + 'CREDITS.docb' => \&to_CREDITS_docb,
3117 + 'CREDITS.html_body' => \&to_CREDITS_html_body);
3121 +This project has been alive for several years. Many people have provided
3122 +feedback that have improved poldek, especially
3123 +<ulink url="http://pld-linux.org">PLD Linux</ulink> Team people. Thanks!</para>
3124 +<para> Here follows a list of people that have
3125 +contributed (in alphabetical order). <emphasis>Please</emphasis> let
3126 +<a href="mailto: mis @ pld.org.pl">me</a>
3127 +know if somebody is missing.
3131 +die "Usage: $0 {" . join('|', sort keys %op) . "}\n"
3132 + if @ARGV == 0 || !exists $op{$ARGV[0]};
3134 +$xs = new XML::Simple();
3135 +$xml = $xs->XMLin('NEWS.xml', keeproot => 1,
3136 + keyattr => [], forcecontent => 1) || die "XML::Simple error";
3138 +&{$op{$ARGV[0]}}($xml);
3141 + system("xsltproc NEWSdocb.xsl NEWS.xml") == 0 ||
3142 + die "xsltproc failed: $?";
3145 +sub to_CREDITS_html_body {
3147 + my $credits = get_credits($ref);
3148 + my $preable = $PREABLE;
3149 + $preable =~ s/(\W)para>/${1}p>/g;
3150 + $preable =~ s/(\W)emphasis>/${1}em>/g;
3151 + $preable =~ s/(\W)ulink([\s>])/$1a$2/g;
3152 + $preable =~ s/url=/href=/g;
3153 + print qq{<h1>Credits</h1>$preable};
3154 + print q{<ul class="plain">};
3156 + foreach (@$credits) {
3157 + #print STDERR "$_->{name}\n";
3158 + print qq{<li>$_->{name} <<em>$_->{email}</em>></li>\n};
3163 +sub to_CREDITS_docb {
3165 + my $credits = get_credits($ref);
3167 + print q{<?xml version="1.0" encoding="ISO-8859-1"?>
3168 +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3169 +<article lang="en"><articleinfo><title>Credits</title></articleinfo>
3170 +<sect1 id="credits"><title></title>};
3175 +<itemizedlist id="creditslist">
3178 + foreach (@$credits) {
3180 + <listitem id="$_->{id}"><para>
3181 + $_->{name} <<emphasis>$_->{email}</emphasis>>
3182 + </para></listitem>
3197 + foreach my $rel (@{$ref->{news}->{release}}) {
3198 + $rel->{entry} = [ $rel->{entry} ] if ref $rel->{entry} eq 'HASH';
3199 + process_entry($rel->{entry}, \%credits);
3201 + if ($rel->{section}) {
3202 + $rel->{section} = [ $rel->{section} ] if ref $rel->{section} eq 'HASH';
3203 + foreach my $s (@{$rel->{section}}) {
3204 + die if !$s->{entry};
3205 + $s->{entry} = [ $s->{entry} ] if ref $s->{entry} eq 'HASH';
3206 + process_entry($s->{entry}, \%credits);
3211 + foreach my $au (sort { $credits{$a}->{orderby} cmp $credits{$b}->{orderby} } keys %credits) {
3212 + push @credits, $credits{$au};
3217 +sub process_entry {
3219 + my $credits = shift;
3221 + foreach my $e (@{$aref}) {
3222 + next if !$e->{author};
3223 + $e->{author} = [ $e->{author} ] if ref $e->{author} eq 'HASH';
3225 + foreach my $au (@{$e->{author}}) {
3226 + next if $au->{part};
3227 + next if exists $credits->{$au->{id}};
3228 + my $name = $au->{content};
3229 + $name =~ s/^\s+//;
3230 + $name =~ s/\s+$//;
3231 + $name =~ s/\s+/ /;
3233 + my $orderby = $name;
3234 + if ($name =~ /\s/) {
3235 + my ($n, $ln) = ($name =~ /(\S+)\s(\S+)/);
3236 + $orderby = $ln if $ln;
3239 + $credits->{$au->{id}} = {
3242 + orderby => $orderby,
3243 + email => $au->{email},
3248 diff -urN poldek-0.20.org/doc/NEWS.xml poldek-0.20/doc/NEWS.xml
3249 --- poldek-0.20.org/doc/NEWS.xml 1970-01-01 01:00:00.000000000 +0100
3250 +++ poldek-0.20/doc/NEWS.xml 2006-07-26 20:25:54.103320000 +0200
3252 +<?xml version="1.0"?>
3254 +<cvsid>$Id$</cvsid>
3256 +<release version="0.20.1" date="" focus="bugfix release">
3258 + let a user to choose equivalents selected by --caplookup option
3262 + choosing equivalents prompt are interrupt-able now.
3266 + added 0.18.x's --mkdir to be bacward compatible
3270 + fixed path validation ("/foo../" is not a relative path)
3274 + vfcompr: temporary *vfcompr.md5 files moved from source to destination
3275 + (a cache) directory
3279 + orphaned package are upgraded if its successor drags more new packages
3284 + "use sudo" default value is explicit set to "auto" (new 3var boolean-like
3289 + configuration for CentOS has been added.
3290 + <author id="areq" email="areq att areq eu org">Arkadiusz Patyk</author>
3294 +<release version="0.20" date="2005/10/28" focus="major enhancements release">
3296 +This release introduces new series of poldek.
3297 +Significant changes and differences from 0.18.x series
3300 +<section><title>Package repositories</title>
3303 + repositories code has been redesigned and totally rewritten in the
3304 + modular, plugin-like way, so is is quite easy to add support for
3311 + new 'pndir' is the default format now. It is based on tndb (cdb like) DBM
3312 + library. To save bandwidth package descriptions (Description, Summary, etc)
3313 + are stored in 2 separate files: first named packages.ndir.dscr with common
3314 + (BuildHost, Distribution, etc) and "C" descriptions and second with all
3315 + non-C descriptions).
3320 + <para>'hdrl' aka 'apt' format are update-able</para>
3324 + <para>support for Yum and Metadata XML repositories</para>
3329 + repository indexes could be created in many formats at once
3330 + using --mt switch, ex:
3332 + <para nowrap="yes">
3333 + $ poldek -s /foo/bar --mkdix --mt=pdir,pndir
3339 + indexes may be created from any index format, i.e conversion to
3340 + to another format is supported, ex:
3342 + <para nowrap="yes">
3343 + $ poldek --st apt -s /foo/bar --mkidx=/ala/ma --mt=pdir
3349 + (re)creation of native poldek's indexes (pdir, pndir) is much faster now
3350 + package headers are not loaded at all if package's file modification
3351 + time is the same as saved one in existing index.
3356 + <section><title>Installation related</title>
3359 + uninstallation code has been rewritten and improved. Packages are removed
3360 + with its reverse dependencies and in the right order, according to
3361 + {pre,post}un requirements
3367 + poldek can perform 'to repository' installation, i.e packages
3368 + are copied from source to destination repository with full
3369 + dependency checking, ex:
3371 + <para nowrap="yes">
3372 + $ poldek -n ... --dt pdir --destination /foo/bar/RPMS --upgrade-dist -v
3373 + $ poldek -n ... --dn name --upgrade-dist -v
3377 + <section><title>Interactive mode</title>
3380 + interactive mode commands are available directly from command line
3382 + <para nowrap="yes">
3383 + $ poldek --cmd ls foo
3390 + command aliases are defined in external configuration file
3392 + <author id="mmazur" email="mmazur a kernel pl">Mariusz Mazur</author>
3396 + <para>commands may be piped, ex:</para>
3397 + <para nowrap="yes">
3398 + poldek> rsearch /poldek/ | ls -l
3403 + <para>external commands are supported: </para>
3404 + <para nowrap="yes">
3405 + poldek> rsearch /pol/ | !grep ^pol
3410 + <section><title>Configuration</title>
3413 + multi word option names may be written with spaces or underscore separator, i.e:
3414 + both forms "this is = foo" and "this_is = foo" are valid.
3420 + default location of configuration file has been changed to "${_sysconfdir}/poldek/poldek.conf", old /etc location is still supported.
3426 + configuration file format has been changed to ini-like one. Sources and
3427 + external file getters should be configured in its own sections "source" and
3428 + "fetcher", see sample configs. Old configuration format is still supported.
3434 + environment variables in config files are expanded, for example:
3436 + <para nowrap="yes">
3437 + cachedir = $HOME/.cache
3443 + support for simple macros has been added to make configuration easier to write
3444 + and read, for example:
3446 + <para nowrap="yes">
3448 + _prefix = ftp://ftp.pld.org.pl/dists
3453 + path = %{_prefix}/ra/PLD/%{_arch}/PLD/RPMS/
3457 + name = pld-ra-updates
3458 + path = %{_prefix}/ra/updates/general/%{_arch}/
3464 + %include directive has been added, it can include both local and remote files:
3466 + <para nowrap="yes">
3467 + %include source.conf
3468 + %include ftp://ftp.pld.org.pl/dists/ra/source.conf
3471 + Remote files once downloaded are stored in cache directory. To resynchronize them
3472 + with it's remote copy use --upconf option.
3478 + support for APT sources configuration has been added - new
3479 + "load apt sources list" configuration option.
3483 + <section><title>General</title>
3486 + some command line switches has been changed, but all obsoleted switches are still
3487 + supported *except* "-f" (not important IMO).
3490 + <para nowrap="yes">
3492 + ------------------------------------
3493 + -f, --fast => --skip-installed
3494 + --mkidxz => --mkidx (compression is on by default)
3495 + --sidx, --sdir, --shdrl => (use --st=TYPE -s instead)
3496 + --unique-pkg-names => --uniq
3497 + --shcmd => (use --cmd or run ipoldek)
3502 + configuration options may be set from command line by -O switch, for
3505 + <para nowrap="yes">
3506 + $ poldek -Ovfile_external_compress=yes
3512 + PLD-FreeBSD port (ftp://beliar.pld-freebsd.org/dists/1.0/ready/i386/RPMS/)
3514 + <author id="trojan" email="tomek att uninet com pl">Tomasz Trojanowski</author>
3518 + <para>manual have been rewritten and enhanced</para>
3524 +<!-- ============================ 0.18.x ============================ -->
3526 +<release version="0.18.9.1" date="2005/10/17" focus="bugfix release">
3528 + <para>fixed writing diff list file (packages.diff.toc)</para>
3531 + <para>update to rpm 4.4 (dropped legacy PreReq support)</para>
3532 + <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3535 + <para>renamed trurlib's nstream members to avoid conflicts with stdio macros</para>
3536 + <author id="olivier.thauvin" email="olivier.thauvin att aerov jussieu fr">Olivier Thauvin</author>
3539 + <para>fixed package version selection on greedy upgrade</para>
3544 +<release version="0.18.9" date="2005/07/03" focus="bugfix release">
3546 + <para>handle package file 'mtime' tag ('t' tag) to be compatible with devel branch.</para>
3549 + <para>fixes related to glibc 2.3.5</para>
3550 + <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3551 + <author id="arekm" email="arekm att pld-linux org">Arkadiusz Miskiewicz</author>
3553 + <li>fixed cookie seek functions</li>
3554 + <li>setvbuf() with small buffer to avoid reverse gzseeks on small forward fseeks</li>
3555 + <li>do fread() instead of small forward fseeks</li>
3559 + <para>fixed compilation with gcc 4.x (PLD's poldek-gcc4.patch)</para>
3562 + <para>dependency resolving issues</para>
3563 + <author id="mrk" email="mrk att sed pl">Mariusz Krynski</author>
3565 + <li>packages marked for removal are not treated as candidates to upgrade</li>
3566 + <li>user can choose among equivalents during conflict resolving.</li>
3570 + <para>new --pmcmd to set rpm binary in place of default /bin/rpm</para>
3571 + <author id="baggins" email="baggins att sith mimuw edu pl">Jan Rekorajski</author>
3574 +<release version="0.18.8" date="2004/12/30" focus="bugfix release">
3576 + <para>fixed checking file-based dependencies of packages being removed</para>
3579 + <para>fixed another dependency processing bug (hard to explain)</para>
3582 + <para>'ls' output fixes to be parsable by external scripts</para>
3583 + <author id="patrys" email="patrys att pld-dc org">Patryk Zawadzki</author>
3586 + <para>removed usage of superfluous n_free()</para>
3587 + <author id="twittner" email="twittner att o2 pl">Tomasz Wittner</author>
3590 + <para>vfile's progress bar: fixed displaying total transfer and rate</para>
3591 + <author id="lukasz.masko" email="lukasz.masko att ipipan waw pl">Lukasz Masko</author>
3594 + <para>support for RPM 4.4 </para>
3597 + <para>fixed build under Owl (rpm 4.0.2 without libelf)</para>
3600 + <para>workaround for "group not found" bug </para>
3603 + <para>pl and de translation fixes (PLD Team)</para>
3606 +<release version="0.18.7" date="2004/09/24" focus="major bugfix release">
3608 + <para>another stupid SIGSEGV killed (happened occasionally while dependency processing)</para>
3611 + <para>vfile's progress bar improvements</para>
3612 + <author id="patrys" email="p zawadzki att vegaballs com">Patryk Zawadzki</author>
3615 + <para>fix: disabled package Epoch's autopromotion while checking if it matches requirement</para>
3618 + <para>with rpm >= 4.1 packages with same provide are obsoleted, not just name</para>
3621 + <para>fixed processing dependencies of orphaned packages </para>
3624 + <para>SIGSEGV killed while reading packages with dir/file names longer than 127 bytes</para>
3627 + <para>fixed package ordering bug</para>
3630 + <para>with --caplookup packages may be installed by specifying
3631 +its capabilities, i.e: "poldek --caplookup -uv foo" will install
3632 +package provides "foo" (if any). </para>
3635 +<release version="0.18.6" date="2004/06/28" focus="major bugfix release">
3637 + <para>fixed broken dist installation</para>
3640 + <para>fixed serious bug with dependency processing of obsoleted packages</para>
3643 + <para>fixed --rpmdef '_dbpath DIR' (do not read rpm's configs many times) </para>
3646 + <para>fix: --nofollow with --install-dist works as expected (#920)</para>
3649 + <para>vfile: fixed progress bar displaying on std sized terminal (79 cols)</para>
3652 +<release version="0.18.5" date="2004/05/23" focus="bugfix release">
3654 + <para>fixed dowloading packages from apt-like sources </para>
3657 +<release version="0.18.4" date="2004/05/10" focus="bugfix and minor improvements release">
3659 + <para>package filenames in "non-standard" form (N-V.R.ARCH.rpm) are supported</para>
3662 + <para>killed SIGSEGVs on 64bit architecture</para>
3663 + <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3666 + <para>fixed Epoch comparison bug while checking uninstalled capabilities</para>
3669 + <para>vfile: progress bar shows remaining time and transfer rate</para>
3670 + <author id="patrys" email="p zawadzki att vegaballs com">Patryk Zawadzki</author>
3673 + <para>fixed setting cache directory bug</para>
3674 + <author id="a.piesk" email="a.piesk att gmx net">Andreas Piesk</author>
3677 + <para>fixed serious bug of checking unversioned dependencies </para>
3680 + <para>--ignore{arch,os} rpm options are honored</para>
3683 + <para>rpm options could be passed as --rpm=OPTION too,
3684 +i.e. --rpm=ignorearch is equivalent of -- --rpm-ignorearch</para>
3687 + <para>new cmdline options --rpm-{force,nodeps} which are passed
3688 +as --force and --nodeps to /bin/rpm only.</para>
3691 + <para>more aggressive package upgrades - orphaned packages are
3692 +upgraded instead of processing its dependencies. This behavior is
3693 +enabled by "greedy" option. To disable put "aggressive_greedy = no" to
3697 + <para>"greedy" upgrade mode is enabled by default</para>
3700 + <para>conflicts with already installed packages are treated as
3701 +resolved if at least one of multiple-installed package satisfies
3702 +conflict. Of course RPM doesn't support such cases, so additionally
3703 +--rpm-nodepsis needed (use with care). This behavior is enabled by
3704 +default, put "allow_duplicates=no" to config to disable
3708 + <para>displaying package size summary of installed package
3712 + <para>--unique-pkg-names (-Q) behavior is more intuitive now -
3713 +highest version of package are taken instead of one from highest
3714 +prioritizedsource </para>
3717 +<release version="0.18.3" date="2004/01/10" focus="bugfix and improvements release">
3719 + <para>internal HTTP client does not prevent proxy caching</para>
3720 + <author id="arekm" email="arekm att pld-linux org">Arkadiusz Miskiewicz</author>
3723 + <para>fixed bug on getting package capabilities having EVR with
3724 +empty Epoch like "foo = :1.0-1"</para>
3727 + <para>do not die if rpmdb iterator returns NULL (possibly broken rpm database)</para>
3728 + <author id="arekm" email="arekm att pld-linux org">Arkadiusz Miskiewicz</author>
3731 + <para>vfile_external_compress=yes in config allows gzipped
3732 +indexes to be used on systems with broken zlib linked in rpmio
3733 +library(rpm 4.2 from RedHat 9, Fedora) </para>
3736 + <para>kill unaligned traps on Alpha, time_t is not 32bit long (Jakub Bogusz <qboosh att pld-linux org>)</para>
3737 + <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3740 + <para>new "promoteepoch" config and cmdline option switches Epoch
3741 +to comparision compatible with rpm prior to 4.2.1</para>
3742 + <author part="yes" id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3745 + <para>support for RPM 4.2/4.3</para>
3748 + <para>dependency processing fixes</para>
3751 + <para>RPM 4.1 related fixes </para>
3754 +<release version="0.18.1" date="2002/11/27" focus="major bugfix release">
3756 + <para>ability of creation empty indexes</para>
3759 + <para>killed SIGSEV on '$ poldek -s /' (#443)</para>
3762 + <para>fixed presentation of dependency tree during
3763 +unistallations; information about what package marks an others was
3764 +completely broken </para>
3767 + <para>killed SIGSEV during dependencies processing</para>
3770 + <para>fixed vfile's progress bar </para>
3773 + <para>fixed 'hold' and 'ignore' package patterns matching</para>
3776 + <para>fixed bug of interactive mode; after interrupted
3777 +installation selected packages are properly unmarked
3781 +<release version="0.18" date="2002/11/07" focus="bugfix/minor enhancements release">
3783 + <para>support for RPM 4.1</para>
3784 + <author part="yes" id="wiget" email="wiget att pld-linux org">Artur Frysiak</author>
3787 + <para>few dependency processing improvements</para>
3789 + <li>greedy upgrades are performed instead of marking different versions of the same package</li>
3790 + <li>with --greedy packages are selected by Obsoletes tag too</li>
3794 + <para>'hold' and 'ignore' package masks are matched with source name, package epoch,
3795 +version and release, i.e. masks apache-1.3.2* or ra:apache-1* are valid ones now. </para>
3798 + <para>new: with --unique-pkg-names (-Q) packages with the same name
3799 + are removed from available package set</para>
3802 + <para>sources are prioritized in order they are passed in cmdline,
3803 +i.e. with $ poldek -s /foo/bar -n pld, source 'foo/bar' obtains
3804 +highest priority than 'pld', no matter what priority 'pld' has in
3805 +config file. </para>
3808 + <para>fixed available package list management in interactive mode </para>
3811 + <para>AM/AC stuff cleanup and adaptation to their new versions
3812 + (automake 1.7 and autoconf 2.54)</para>
3813 + <author id="wiget" email="wiget att pld-linux org">Artur Frysiak</author>
3816 + <para>Polish translation of manual page</para>
3817 + <author id="gotar" email="gotar att pld-linux org">Tomasz Pala</author>
3820 + <para>fix: progress bar isn't refreshed so frequently (#367)</para>
3823 +<release version="0.17.9" date="2002/09/20" focus="bugfix/minor enhancements release">
3825 + <para>Obsoletes tag is used during upgrades (if --greedy is set)</para>
3829 + <para>fixed dependency EVR matching</para>
3833 + <para>source priorities (new 'pri' source option) -- if the
3834 + same package is availablein more than one source than program takes
3835 + package from source with highest priority.If priorities aren't set
3836 + sources are prioritized in order they are appear in config
3841 + <para>bugfix: -s URL works fine </para>
3845 + <para> added poldek's logo </para>
3846 + <author id="mimooh" email="mimooh att sgsp edu pl">Karol Krenski</author>
3850 +<release version="0.17.8" date="2002/08/18" focus="major bugfix release">
3852 + <para>package installation is verified with rpm database if rpm reports failure</para>
3855 + <para>fixed obsoletes matching</para>
3856 + <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3859 + <para>improved and fixed file based conflicts detection</para>
3862 + <para>fixed size units display</para>
3863 + <author id="gotar" email="gotar att poczta.onet.pl">Tomasz Pala</author>
3866 +<release version="0.17.7" date="2002/06/14" focus="bugfix release">
3868 + <para>improved package conflicts resolving</para>
3871 + <para>split: SIGSEV killed </para>
3874 + <para>fixed package removal </para>
3877 + <para>shell: search: fixed default options processing</para>
3880 + <para>another "desynchronized index" bug is fixed</para>
3883 + <para>fixed Epoch matching </para>
3886 + <para>vhttp: program doesn't die on doubled HTTP headers </para>
3889 +<release version="0.17.6" date="2002/06/03" focus="minor bugfix release">
3891 + <para>new "--ignore" option makes packages invisible to the poldek </para>
3894 + <para>"hdrl" sources can be refreshed with --upa </para>
3897 + <para>fixed package removal: don't follow dependencies if only one of
3898 +multiple-installed packages is intended to uninstall </para>
3901 + <para>shell: search: pattern is treated as shell wildcard (matched by fnmatch(3))
3902 +by default; previous behavior (Perl regular expression matching) is available
3903 +with --perlre or "rsearch" alias. </para>
3906 + <para>fixed package auto-selection among equivalents: dependencies aren't verified strictly
3907 +during package scoring. </para>
3910 + <para>fixed bug of equivalent package selection (<Enter> was select first,
3911 +notdefault package).</para>
3914 + <para>shell: with 'upgrade' and 'greedy-upgrade' commands only upgradeable
3915 +packages are auto-completed. </para>
3918 +<release version="0.17.5" date="2002/05/15" focus="minor bugfix release">
3920 + <para>about 75% less memory is used by incremental update of packages.dir </para>
3923 + <para>improved package auto-selection among equivalents: package which marks
3924 + less packages to install is preferred</para>
3927 + <para>vftp: fixed logging in when server doesn't ask for password</para>
3928 + <author id="venglin" email="venglin att freebsd.lublin.pl">Przemyslaw Frasunek</author>
3931 + <para>bugfix: root directory (--rootdir) is always passed to rpm as absolute path </para>
3934 + <para>shell: desc: file mode is displayed in human readable form</para>
3937 + <para>fixed vfjuggle: packages.dir.md* are copied to hdd too</para>
3940 + <para>few SIGSEVs killed on "search" command when APT's pkglist file is used as package index
3942 + <author part="yes" id="niemeyer" email="niemeyer att conectiva com">Gustavo Niemeyer</author>
3945 +<release version="0.17.4" date="2002/05/06" focus="bugfix/minor enhancements release">
3947 + <para>new (major) modes: --downgrade downgrade given packages;
3948 + --reinstall major mode reinstalls given packages;
3949 + --erase removes packages with its reverse dependent ones</para>
3952 + <para>shell: fixed C-c handling (connecting phase can be interrupted)</para>
3955 + <para>improved splitting</para>
3957 + <li>packages are auto-rearranged on chunk's boundaries </li>
3958 + <li>masks with priority less than 0 are always applied at first</li>
3962 + <para>killed SIGSEV on long URL's basenames</para>
3965 + <para>source prefix is handled properly with --mkidx*</para>
3968 +<release version="0.17.3" date="2002/04/23" focus="major enhancements release">
3970 + <para> supported "hdlist" files (simple raw RPM package headers list) as
3971 +sources. These files are used by APT-RPM as they are widely supported
3972 +by RPM based distributions. However this format isn't optimal, now
3973 +poldek is useable with almost every RPM based distro without poldek's
3974 +native indexes support.
3975 +See poldekrc.sample-{rh,mdk} for examples of RedHat and Mandrake
3980 + <para>new "type=[pidx|dir|hdrl]" source option lets define source type inconfiguration file. Needed to distinguish "hdlist" ('hdrl' type) from"native" index format. Cmdline options: --source for 'pidx', --sdir for'dir' and --shdrl for 'hdrl'.</para>
3983 + <para>support for GPG/PGP signatures verification (new "gpg" and "pgp" source options). Verification works well with rpm >= 4.0.4 or patched PLD's rpm 4.0.2 package (release 62). </para>
3986 + <para>simple HTTP client (with partly HTTP/1.1 support), it is used for HTTP downloads; cURL backend is not compiled by default. </para>
3989 + <para>added IPv6 support to internal FTP client</para>
3992 + <para>new "--clean" and "--clean-whole" options for cache directorycleanup</para>
3995 + <para>URLs with user and password (ftp://user:passwd at host:port/path/ syntax) are supported</para>
3996 + <author id="a.piesk" email="a.piesk att gmx.net">Andreas Piesk</author>
3999 + <para>new "ftp_sysuser_as_anon_passwd" option causes sending login at
4000 + hostname as anonymous FTP password </para>
4003 + <para>new "noautoup" source option tells poldek to do not update source by default. </para>
4006 + <para>shell: added long listig format of file list (poldek> desc -ll)</para>
4009 + <para>misc fixes to compile on SuSE</para>
4012 + <para>fixed rpm 3.x support</para>
4013 + <author part="yes" id="rl" email="rl att hellgate.ch">Roger Luethi</author>
4016 + <para>fixed and improved handling of bool configuration options, added on/off and enable/disable
4017 + to the list of valid choices</para>
4018 + <author id="a.piesk" email="a.piesk att gmx.net">Andreas Piesk</author>
4021 + <para>fixed detection of file based conflicts between available packages. </para>
4024 + <para>packages with capabilities with the same name and different
4025 + versions are handled properly</para>
4028 + <para>misc fixes to compile and work with glibc2.1</para>
4029 + <author part="yes" id="a.piesk" email="a.piesk att gmx.net">Andreas Piesk</author>
4032 + <para>installation of multiple instances of package is allowed (by poldek -i)</para>
4035 + <para>fixes and improvements of dependency resolution</para>
4037 + <li>fixed greedy mode</li>
4038 + <li>fixed handling package conflicts added by poldek</li>
4039 + <li>faster dependency checking</li>
4043 + <para>German translation</para>
4044 + <author id="a.piesk" email="a.piesk att gmx.net">Andreas Piesk</author>
4047 + <para>various bugs are fixed</para>
4049 + <li>double '/' in paths handling</li>
4050 + <li>huge mem leak on --update </li>
4051 + <li>ambiguous p_open() flags (Michal Moskal <malekith att pld-linux org>)</li>
4052 + <li>removed [v]snprintf() (wrong) usage; trurlib's n_[v]snprintf() are used instead</li>
4053 + <li>automake/autoconf fixes (Artur Frysiak <wiget att pld-linux org>)</li>
4057 +<release version="0.17.2" date="2002/03/26" focus="bugfix release">
4059 + <para>"ported" to RedHat 7.2 (with rpm 4.0.4)</para>
4062 + <para>install-dist: --force forces installation of broken package sets</para>
4065 + <para>corrected package installation progress bar</para>
4066 + <author id="malekith" email="malekith att pld-linux org">Michal Moskal</author>
4069 + <para>install-dist: log INST-{OK,ERR} for PLD Installer</para>
4070 + <author id="malekith" email="malekith att pld-linux org">Michal Moskal</author>
4073 + <para>--dump* works properly</para>
4076 + <para>vftp: fixed error handling</para>
4079 +<release version="0.17.1" date="2002/03/26" focus="bugfix release">
4081 + <para>ftp: fixed multiline responses handling</para>
4084 +<release version="0.17" date="2002/02/21" focus="major enhancements release">
4086 + <para>added support for package.dir's "patches" (new option --update-whole updates
4087 + whole index; --update looking for patches first)</para>
4090 + <para>packages are divided into groups before install and each group is installed
4091 + separately; this ensures that broken dependencies in one of group doesn't affect
4095 + <para>improved dependency processing</para>
4097 + <li>package may be marked for install as a consequence of conflict</li>
4098 + <li>dependency loops detected during install time are noticed in human readable form</li>
4099 + <li>improved "greedy" selection - if foo-VER is upgraded, then "greedy" marks will mark
4100 + foo-{devel,static,etc} in version VER too.</li>
4104 + <para>added simple ftp client; it is used for FTP downloads by default</para>
4107 + <para>shell</para>
4109 + <li>db package list is cached what speeds up program start</li>
4110 + <li>ls: long listings are passed to $PAGER program (default is "less")</li>
4111 + <li>ls: new switches -n (list package names only), -G (list group)
4112 + and -O (show package summaries)</li>
4116 + <para>added log file support (--log option)</para>
4119 + <para>sources may be configured as name and URL pair and later selected by that name
4120 + (new --sn|-n option); with --sl|-l program lists all configured sources. </para>
4123 + <para>packages.dir's integrity is verified before each loadingwhat prevents program
4124 + SIGSEVs on load broken indexes</para>
4127 + <para>changed default cache directory to $HOME/.poldek-cache</para>
4130 + <para>package MD5 sums are verified before install</para>
4133 + <para>with --ask program confirms each installation (confirm_install config option)
4134 + and allows the user to choose among equivalent packages
4135 + (choose_equivalents_manually config option)</para>
4138 + <para>few (nice) improvements and (not so nice ;-) bugs fixed</para>
4141 +<release version="0.16" date="2002/01/29" focus="bugfix release">
4143 + <para>fixed removable media support in non-install-dist modes</para>
4146 + <para>shell: uninstall: fix: don't remove pkg from install list if removal fails</para>
4149 +<release version="0.15.9" date="2002/01/11" focus="major enhancements release">
4151 + <para>shell</para>
4153 + <li>desc: added package file size display</li>
4154 + <li>search: added Group search</li>
4155 + <li>install: unhidden --mercy</li>
4156 + <li>uninstall: fix: don't remove pkg from install list if --test is used</li>
4157 + <li>added -h opt. to all commands</li>
4161 + <para>removed GCC's nested functions usage -- seems that it causes SIGSEVs on some machines</para>
4162 + <author id="areq" email="areq att pld-linux org">Arkadiusz Patyk</author>
4165 + <para>fix: don't include trailing whitespaces in config values</para>
4168 +<release version="0.15.8" date="2001/10/29" focus="bugfix release">
4170 + <para>curl: disabled timeouts, cURL's timeout it's a time to transfer file </para>
4173 + <para>curl: amount and total sizes are displayed in progress bar</para>
4176 + <para>fix: enabled --hold </para>
4179 + <para>fix: SIGSEV killed when pkg description requested while pkg index
4180 +doesn't contain package descriptions at all</para>
4183 + <para>shell: fixed installed package list management</para>
4186 + <para>curl: fixed progress bar if total file size is unknown</para>
4187 + <author id="malekith" email="malekith att pld-linux org">Michal Moskal</author>
4190 + <para>"mercy" mode bugfix</para>
4193 +<release version="0.15.7" date="2001/10/10" focus="major enhancements release">
4195 + <para>downloaded packages are removed after successful installation by default
4196 +(keep_downloads=yes in config can change to previous behavior)</para>
4199 + <para>changed semantics of --test: -t causes poldek's checks only,
4200 + -tt turns on tests performed by rpm too.</para>
4203 + <para>"mercy" dependency checking mode may be enabled in config</para>
4206 + <para>added workarounds and traps for (probably) curl's bugs</para>
4209 + <para>"update" option can be used with other commands simultaneously</para>
4212 + <para>shell mode is now the default</para>
4215 + <para>shell: added greedy option to install cmd</para>
4218 +<release version="0.15.6" date="2001/08/12" focus="bugfix/major enhancements release">
4220 + <para>package priorities could be used during installation too
4221 + (/etc/poldek-pkgsplit.conf or /etc/poldek-pri.conf is used by default)</para>
4224 + <para>added global config /etc/poldek.conf usage </para>
4227 + <para>fixed prereq loop detection</para>
4230 + <para>added '@' to list of valid characters in package filename</para>
4231 + <author id="klakier" email="klakier att pld-linux org">Rafal Kleger-Rudomin</author>
4234 + <para>vfjuggle: sed is used instead of awk</para>
4235 + <author id="klakier" email="klakier att pld-linux org">Rafal Kleger-Rudomin</author>
4238 + <para>shell: ls: fixed packages sorting </para>
4241 + <para>minor bugfixes </para>
4244 +<release version="0.15.5" date="2001/07/20" focus="bugfix release">
4246 + <para>another bugfix of dependency processing</para>
4249 + <para>shell: new ls options: -t, -T, -r</para>
4252 + <para>added --shcmd option which allows to execute poldek's shell command
4253 +without entering shell mode </para>
4256 + <para>detect if stdout is connected to a terminal and display progress bars accordingly.</para>
4259 + <para>install-dist: retry to fetch packages if connection is down</para>
4262 +<release version="0.15.4" date="2001/07/17" focus="bugfix release">
4264 + <para>conflicts detection bugfix </para>
4267 +<release version="0.15.3" date="2001/07/16" focus="bugfix release">
4269 + <para>another bugfix of dependency processing</para>
4272 + <para>splitted verify option to verify, verify-conflicts and verify-fileconflicts</para>
4275 + <para>more user friendly output on package set verification</para>
4278 +<release version="0.15.2" date="2001/07/13" focus="bugfix/major enhancements release">
4280 + <para>added "hold" and "greedy" commands </para>
4283 + <para>added FIRST_FREE_SPACE param to split option</para>
4286 + <para>fixed bug of dependency processing</para>
4289 + <para>minor bugfixes </para>
4292 +<release version="0.15.1" date="2001/06/28" focus="major bugfix release">
4294 + <para>spliting: changed packages.chunk* format: full package filenames are printed
4295 + and removed comments. </para>
4298 + <para>bugfixes </para>
4301 +<release version="0.15" date="2001/06/26" focus="bugfix/major enhancements release">
4303 + <para>updated vfcurl progress bar handling (according to curl 7.8)</para>
4306 + <para>better index format version handling (minor.major ver schema), current
4307 + version is 1.0, older versions not supported...</para>
4310 + <para>package's integer fields are stored in binary form, groups are stored as separate, global tag</para>
4313 + <para>remote indexes are verified after download</para>
4316 + <para>added checking of package architecture and OS</para>
4319 + <para>added support for removable media (vfjuggle script is added)</para>
4322 + <para>added package file size to index (for spliting)</para>
4325 + <para>added "nofollow" option to cmdline and "follow" one to config </para>
4328 + <para>renamed "freshen" to "fresh" and changed its semantics, now rpm's
4329 +"--freshen" <=> "--nofollow --fresh"</para>
4332 + <para>changed default index name to "packages.dir"</para>
4335 + <para>added mkpackagedir script</para>
4338 + <para>added spliting (--split* options)</para>
4341 + <para>package-set file syntax: changed "maybe" mark to '~' ('!' still work, but obsoleted)</para>
4344 + <para>shell</para>
4346 + <li>added aliases for commands ("ll", "llu", "freshen", "what-requires", etc)</li>
4347 + <li>better completition context switching</li>
4348 + <li>extended "desc" and "search" commands -- almost allpackage fields could be specified</li>
4349 + <li>colorized output</li>
4353 + <para>many bugfixes</para>
4354 + <author id="klakier" email="klakier att pld-linux org">Rafal Kleger-Rudomin</author>
4355 + <author id="malekith" email="malekith att pld-linux org">Michal Moskal</author>
4358 +<release version="0.14" date="2001/06/12" focus="bugfix/major enhancements release">
4360 + <para>support for multiple sources</para>
4363 + <para>Packages SHA1 digest is computed and checked (Packages.md is created) </para>
4366 + <para>capabilities/requirement are stored in binary form (v0.4 of Packages format)</para>
4369 + <para>default name (Packages[.gz]) is used if only dir is given as source (i.e. it's last character is '/') </para>
4372 + <para>shell: both installed and available packages list is maintained properly during installs/unistalls without reloading rpm database </para>
4375 + <para>shell: added "search" command</para>
4378 + <para>removed unused support for rpmidx (aka tocfile)</para>
4381 + <para>cleanup and bugfixes </para>
4385 diff -urN poldek-0.20.org/doc/NEWS.xsl poldek-0.20/doc/NEWS.xsl
4386 --- poldek-0.20.org/doc/NEWS.xsl 1970-01-01 01:00:00.000000000 +0100
4387 +++ poldek-0.20/doc/NEWS.xsl 2006-07-26 20:25:54.103320000 +0200
4389 +<?xml version='1.0'?>
4390 +<!-- NEWS customizations, applied as -m argument of xmlto -->
4391 +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4393 +<xsl:param name="use.id.as.filename" select="'1'"></xsl:param>
4394 +<xsl:param name="chunk.first.sections" select="'1'"></xsl:param>
4395 +<xsl:param name="section.autolabel" select="'0'"></xsl:param>
4396 +<xsl:param name="generate.index" select="0"></xsl:param>
4398 +<xsl:param name="html.stylesheet.type">text/css</xsl:param>
4399 +<xsl:param name="html.stylesheet" select="'manual.css'"></xsl:param>
4401 +<xsl:param name="draft.mode" select="'no'"></xsl:param>
4403 +<xsl:param name="generate.toc"/>
4405 diff -urN poldek-0.20.org/doc/poldek.1.xml poldek-0.20/doc/poldek.1.xml
4406 --- poldek-0.20.org/doc/poldek.1.xml 2005-07-06 09:31:50.000000000 +0200
4407 +++ poldek-0.20/doc/poldek.1.xml 2006-07-26 20:25:54.111320500 +0200
4412 -This manual page contains only option reference, the full documentation for poldek
4413 -is available as a Texinfo manual. Do <command>info poldek</command> to get it.
4414 +This manual page contains only command line option reference, the full documentation
4415 +for poldek is available as a Texinfo manual. Do <command>info poldek</command> to get it.
4420 &ref-miscellaneous_options;
4423 +<refsect1><title>AUTHOR</title>
4425 +Pawel A. Gajda <mis at pld.org.pl>
4428 +See CREDITS file for a list of contributors.
4432 <refsect1><title>See also</title>
4435 diff -urN poldek-0.20.org/doc/poldek.conf.xml poldek-0.20/doc/poldek.conf.xml
4436 --- poldek-0.20.org/doc/poldek.conf.xml 2005-10-28 18:11:14.000000000 +0200
4437 +++ poldek-0.20/doc/poldek.conf.xml 2006-07-26 20:25:54.111320500 +0200
4439 <?xml version='1.0'?>
4443 +<option name="NAME" type="{string,boolean,boolean3,integer}"
4444 + default="DEFAULT VALUE"
4445 + list="yes" # if an option is a list of values
4446 + path="yes" # if path list (':' separator) in conjunction with list,
4447 + multiple="yes" # if an option may be set multiple times
4448 + env="yes" # if an option value may contain environment variables
4449 + obsoleted="yes" # if an option is obsoleted
4450 + hidden="yes" # not to show it to the user. XXX need to be implemented
4451 + # in *conf-xml2*.xsls, currently just length of the
4452 + # description is tested.
4454 +<description> OPTION DESCRIPTION </description>
4455 +<alias name="ALIAS NAME" obsoleted="{yes,no}" /> an option alias
4459 <config name="poldek.conf">
4461 <section id="synopsis" target="manual">
4462 @@ -133,6 +152,18 @@
4464 <confsection name="global" id="section.global" config="poldek.conf">
4465 <optiongroup id="ogroup.general">
4466 + <!-- legacy options -->
4467 + <option name="source" type="string" multiple="yes" env="yes" obsoleted="yes" />
4468 + <option name="source?*" type="string" env="yes" obsoleted="yes" />
4469 + <option name="prefix?*" type="string" env="yes" obsoleted="yes" />
4470 + <option name="ftp http get" type="string" obsoleted="yes" />
4471 + <option name="ftp get" type="string" obsoleted="yes" />
4472 + <option name="http get" type="string" obsoleted="yes" />
4473 + <option name="https get" type="string" obsoleted="yes" />
4474 + <option name="rsync get" type="string" obsoleted="yes" />
4475 + <option name="cdrom get" type="string" obsoleted="yes" />
4478 <option name="default index type" type="string" default="pndir">
4480 This parameter allows to configure the default repository index type.
4483 <option name="cachedir" type="string" default="$HOME/.poldek-cache" env="yes">
4485 - Cache directory for downloaded files. NOTE: that parent directory of cachedir
4486 + Cache directory for downloaded files. NOTE that parent directory of cachedir
4490 @@ -153,10 +184,10 @@
4491 <alias name="run as" />
4494 - <option name="use sudo" type="boolean" default="no">
4495 + <option name="use sudo" type="boolean3" default="auto" op="USESUDO">
4497 - Permits using root privileges for installation only. Automatically turned
4498 - on when poldek executed as ordinary user.
4499 + Permits using root privileges for installation only. If set to "auto" then
4500 + automatically turned on when poldek executed as ordinary user.
4504 @@ -182,21 +213,13 @@
4508 - <option name="rpm" type="string" default="" env="yes" hide="yes">
4509 - <description></description>
4512 - <option name="sudo" type="string" default="" env="yes" hide="yes">
4513 - <description></description>
4516 - <option name="autoupa" type="boolean" default="yes" hide="yes">
4517 + <option name="autoupa" type="boolean" default="yes">
4519 Automatically download whole index if incremental update fails.
4523 - <option name="exclude path" type="path-list" default="" multiple="yes" hide="yes">
4524 + <option name="exclude path" type="string" list="yes" path="yes" multiple="yes">
4526 Do not save given paths into created indexes. This option may significantly
4527 reduce index size. Example (notice missing starting '/'):
4528 @@ -206,13 +229,14 @@
4532 - <option name="pm command" type="string" default="/bin/rpm" multiple="no" hide="no">
4533 + <option name="pm command" type="string" default="/bin/rpm" multiple="no">
4535 Full path name to a PM (rpm for now) binary.
4537 + <alias name="rpm command" obsoleted="yes" />
4540 - <option name="sudo command" type="string" default="/usr/bin/sudo" multiple="no" hide="no">
4541 + <option name="sudo command" type="string" default="/usr/bin/sudo" multiple="no">
4543 Full path name to sudo binary.
4546 Send ${USER}@${HOSTNAME} as anonymous FTP password (by default
4547 [literal]'poldek@znienacka.net'[/literal] is sent)
4549 - <alias name="ftp sysuser as anon passwd" /> <!-- legacy -->
4550 + <alias name="ftp sysuser as anon passwd" obsoleted="yes" /> <!-- legacy -->
4553 <option name="default fetcher" type="string" default="http,ftp: internal" multiple="yes">
4558 - <option name="noproxy" type="string" default="" multiple="yes">
4559 + <option name="noproxy" type="string" list="yes" default="" multiple="yes">
4561 Comma separated list of hosts or domains which will not be accessed via proxy.
4562 Option overrides no_proxy environment variable.
4564 noproxy = localhost, .pl, ftp.foo.bar.org
4567 + <alias name="no proxy" />
4570 <option name="vfile retries" type="integer" default="128">
4571 @@ -287,20 +312,20 @@
4574 <optiongroup id="ogroup.installation"><title>Installation options</title>
4575 - <option name="particle install" type="boolean" default="yes">
4576 + <option name="particle install" type="boolean" default="yes" op="PARTICLE">
4578 Install packages in small groups instead of doing all-or-nothing
4583 - <option name="keep downloads" type="boolean" default="no">
4584 + <option name="keep downloads" type="boolean" default="no" op="KEEP_DOWNLOADS">
4586 Do not remove downloaded packages after its successful installation.
4590 - <option name="unique package names" type="boolean" default="no">
4591 + <option name="unique package names" type="boolean" default="no" op="UNIQN">
4593 Controls visibility of multiple package instances with different EVR.
4594 If on, only one, highest version will be visible.
4595 @@ -308,42 +333,43 @@
4599 - <option name="promoteepoch" type="boolean" default="no">
4600 + <option name="promoteepoch" type="boolean" default="no" op="PROMOTEPOCH">
4602 Epoch autopromotion during dependency comparision. RPM specific.
4603 Set it up if you are using system with rpm prior to 4.2.1 version.
4607 - <option name="confirm installation" type="boolean" default="no">
4608 + <option name="confirm installation" type="boolean" default="no" op="CONFIRM_INST">
4610 Confirm packages installation.
4612 - <alias name="confirm installs" legacy="yes"/>
4613 + <alias name="confirm installs" obsoleted="yes"/>
4616 - <option name="confirm removal" type="boolean" default="yes">
4617 + <option name="confirm removal" type="boolean" default="yes" op="CONFIRM_UNINST">
4619 Confirm packages removal.
4623 - <option name="choose equivalents manually" type="boolean" default="no">
4624 + <option name="choose equivalents manually" type="boolean" default="no" op="EQPKG_ASKUSER">
4626 Let the user select package among equivalents.
4630 - <option name="hold" type="string-list" default="" multiple="yes">
4631 + <option name="hold" type="string" list="yes" default="" multiple="yes">
4633 Prevent package listed from being upgraded if they are already installed.
4638 + <alias name="a hold alias for testing purposes" obsoleted="yes" />
4641 - <option name="ignore" type="string-list" default="" multiple="yes">
4642 + <option name="ignore" type="string" list="yes" default="" multiple="yes">
4644 Ignore package list - packages fits given mask will be invisible.
4650 - <option name="allow duplicates" type="boolean" default="yes">
4651 + <option name="allow duplicates" type="boolean" default="yes" op="ALLOWDUPS">
4653 Conflicts with already installed packages are treated as resolved
4654 if at least one of multiple-installed package satisfies conflict.
4655 @@ -385,21 +411,22 @@
4656 Subtle dependency processing options, they should not be changed
4657 unless you know what you are doing
4659 + <option name="multilib" type="boolean3" default="auto" hidden="yes" op="MULTILIB"/>
4661 - <option name="follow" type="boolean" default="yes">
4662 + <option name="follow" type="boolean" default="yes" op="FOLLOW">
4664 Automatically install packages required by installed ones.
4668 - <option name="greedy" type="boolean" default="yes">
4669 + <option name="greedy" type="boolean" default="yes" op="GREEDY">
4671 Greedy upgrades, i.e. upgrade packages which dependencies are broken
4672 by being uninstalled ones.
4676 - <option name="aggressive greedy" type="boolean" default="yes">
4677 + <option name="aggressive greedy" type="boolean" default="yes" op="AGGREEDY">
4679 Be yet more greedy; if successor of orphaned package found, and this
4680 successor drags no packages then upgrade the package instead of process
4685 - <option name="mercy" type="boolean" default="no">
4686 + <option name="mercy" type="boolean" default="no" op="VRFYMERCY">
4688 Be tolerant for unmatched versioned dependencies which rpm tolerates, e.g.
4689 package A requires capability foo >= 1.0 while package B provides "foo"
4690 @@ -415,17 +442,21 @@
4694 - <option name="obsoletes" type="boolean" default="yes">
4695 + <option name="obsoletes" type="boolean" default="yes" op="OBSOLETES">
4697 Taking into account package Obsoletes.
4701 - <option name="conflicts" type="boolean" default="yes">
4702 + <option name="conflicts" type="boolean" default="yes" op="CONFLICTS">
4704 Taking into account package Conflicts.
4708 + <!-- internal tag -->
4709 + <!-- <option name="__dirname" type="string" hidden="yes" /> -->
4712 </confsection> <!-- end of "global" -->
4718 -<confsection name="source" id="section.source" config="source.conf">
4719 +<confsection name="source" id="section.source" config="source.conf" multiple="yes">
4721 This section contains poldek's repository configuration.
4722 Every repository is configured in its own [ source ] section.
4727 - <option name="type" type="string" value="pndir">
4728 + <option name="type" type="string" required="yes" value="pndir">
4730 Type of repository index. Permitted values are 'pndir', 'pdir', 'apt', 'yum'
4731 and 'dir' as listed by [option]--stl[/option] switch.
4736 - <option name="path" type="string" env="yes" value="/some/url/or/dir">
4737 + <option name="path" type="string" env="yes" required="yes" value="/some/url/or/dir">
4739 Unique name of the repository. May be either path or URL.
4742 Controls visibility of multiple package instances with different EVR.
4743 If on, only one, highest version will be visible.
4745 + <alias name="unique package names" />
4748 <option name="pri" type="integer" default="0">
4753 + <option name="noauto" type="boolean" default="no" obsoleted="yes" />
4754 + <option name="noautoup" type="boolean" default="no" obsoleted="yes"/>
4756 <option name="signed" type="boolean" default="no">
4758 Packages PGP/GPG signatures (if any) will be verified before their
4763 - <option name="hold" type="string-list" default="" multiple="yes">
4764 + <option name="hold" type="string" list="yes" default="" multiple="yes">
4766 Have the same meaning as [ global ] parameter. Example:
4772 - <option name="ignore" type="string-list" default="" multiple="yes">
4773 + <option name="ignore" type="string" list="yes" default="" multiple="yes">
4775 Have the same meaning as [ global ] parameter. Example:
4781 - <option name="exclude path" type="path-list" default="" multiple="yes">
4782 + <option name="exclude path" type="string" list="yes" path="yes" default="" multiple="yes">
4784 Parameter have the same meaning as [ global ] parameter.
4786 @@ -557,6 +592,13 @@
4790 + <alias name="dscr" obsoleted="yes" />
4793 + <option name="sources" type="string" list="yes" value="foo foo-updates">
4795 + Make sense for 'group' source type only. A list of names of sources.
4798 <footer target="config">
4804 -<confsection name="fetcher" id="section.fetcher" config="fetch.conf">
4805 +<confsection name="fetcher" id="section.fetcher" config="fetch.conf" multiple="yes">
4807 This section contains external downloaders configuration.
4808 Each section describes one fetcher.
4813 - <option name="proto" type="string-list" value="foo,bar">
4814 + <option name="proto" type="string" value="foo,bar" required="yes">
4816 Protocol or protocols supported by fetcher. Name of the protocol can be
4817 completely arbitrary, i.e. if you can handle protocol "foo" by writing
4822 - <option name="cmd" type="string" env="yes" value="foogetter.sh -N %D %Pn">
4823 + <option name="cmd" type="string" env="yes" required="yes" value="foogetter.sh -N %D %Pn">
4825 Parameter specifies an external command and its invoking syntax.
4826 The syntax of "cmd" is:
4827 diff -urN poldek-0.20.org/gensym.sh poldek-0.20/gensym.sh
4828 --- poldek-0.20.org/gensym.sh 1970-01-01 01:00:00.000000000 +0100
4829 +++ poldek-0.20/gensym.sh 2006-07-26 20:25:54.115320750 +0200
4834 +if [ -n "$1" ]; then libNAME="lib$1"; fi
4836 +LIB=.libs/${libNAME}_allsyms.a
4837 +if [ ! -f $LIB ]; then echo "$LIB: no such file"; exit 1; fi
4839 +INCLUDES=$(grep ^libHEADERS Makefile.am | perl -ne 's|^libHEADERS\s*=\s*||; print')
4843 +for i in $INCLUDES; do
4844 + gcc -E $i 2>/dev/null >>$HH;
4848 +symlist=$(nm --defined-only $LIB | pcregrep '^\w+\s+[tT]' | awk '{print $3}' | sort -u)
4850 +#out=$(basename $LIB .so)
4852 +out="${libNAME}.sym"
4854 +for s in $symlist; do
4855 + if pcregrep -s "\b$s\(" $HH; then
4861 +# libpoldek hack - add constans
4862 +if [ "$libNAME" = "libpoldek" ]; then
4863 + nm --defined-only $LIB | pcregrep '^\w+\s+[RB]' | awk '{print $3}' | grep -v poldek_conf_| grep poldek_ | sort -u >> $out
4865 +# provide rpmlog to cover rpmlib's one -- haaack
4866 + nm --defined-only $LIB | pcregrep '\brpmlog\b' | awk '{print $3}' >> $out
4871 +if [ "$libNAME" = "libpoclidek" ]; then
4872 + nm --defined-only $LIB | pcregrep '^\w+\s+[D]' | awk '{print $3}' | grep poclidek_ | sort -u >> $out
4874 diff -urN poldek-0.20.org/getlib.sh poldek-0.20/getlib.sh
4875 --- poldek-0.20.org/getlib.sh 1970-01-01 01:00:00.000000000 +0100
4876 +++ poldek-0.20/getlib.sh 2006-07-26 20:25:54.119321000 +0200
4884 + [ -d $nn ] || exit 1
4885 + [ -f $nn/configure ] || (cd $nn && ./autogen.sh --no-configure)
4888 +PATH="/bin/:/usr/bin:/sbin:/usr/sbin"
4889 +if [ ! -f capreq.h ]; then
4891 + if [ ! -f capreq.h ]; then
4892 + echo "$0: `pwd`: not a poldek directory"
4900 +[ -n "$name" ] || exit 1
4902 +# no ../$name => we are propably in distribution tree
4903 +if [ ! -d ../$name -a -d $name ]; then
4904 + do_configure $name;
4908 +if [ "$mode" = "link" ]; then
4909 + if [ -h $name ]; then do_configure $name; exit 0; fi
4910 + if [ -d $name ]; then rm -rf $name; fi
4913 +if [ "$mode" = "copy" ]; then
4914 + if [ -h $name ]; then rm -f $name; fi
4915 + if [ -d $name ]; then do_configure $name; exit 0; fi
4918 +if [ ! -d $name ]; then
4919 + if [ -n "$mode" -a $mode == "link" ]; then
4928 diff -urN poldek-0.20.org/install/conflicts.c poldek-0.20/install/conflicts.c
4929 --- poldek-0.20.org/install/conflicts.c 2005-07-09 19:51:18.000000000 +0200
4930 +++ poldek-0.20/install/conflicts.c 2006-07-26 20:25:54.119321000 +0200
4942 struct pkg *real_tomark = tomark;
4943 if (tomark_candidates) {
4945 - n = ictx->ts->askpkg_fn(capreq_snprintf_s(req), tomark_candidates, tomark);
4946 - real_tomark = tomark_candidates[n];
4947 + real_tomark = in_choose_equiv(ictx->ts, req, tomark_candidates,
4949 n_cfree(&tomark_candidates);
4950 + if (real_tomark == NULL) { /* user aborts */
4951 + ictx->nerr_fatal++;
4955 tomark = real_tomark;
4957 diff -urN poldek-0.20.org/install/icaps.c poldek-0.20/install/icaps.c
4958 --- poldek-0.20.org/install/icaps.c 2005-07-09 19:51:18.000000000 +0200
4959 +++ poldek-0.20/install/icaps.c 2006-07-26 20:25:54.123321250 +0200
4971 capreq_new_name_a(capname, cap);
4972 dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cap, NULL, 0);
4974 if (dbpkgs == NULL) {
4976 + struct pkg *pkg = NULL;
4978 if (ts->getop(ts, POLDEK_OP_FRESHEN))
4981 n_array_sort_ex(pkgs, (tn_fn_cmp)pkg_cmp_name_evr_rev);
4982 - pkg = n_array_nth(pkgs, 0);
4984 + if (ts->getop(ts, POLDEK_OP_EQPKG_ASKUSER) && ts->askpkg_fn &&
4985 + n_array_size(pkgs) > 1) {
4987 + struct pkg **candidates = alloca(sizeof(struct pkg *) *
4988 + (n_array_size(pkgs) + 1));
4989 + for (i=0; i < n_array_size(pkgs); i++)
4990 + candidates[i] = n_array_nth(pkgs, i);
4991 + candidates[i] = NULL;
4993 + pkg = in_choose_equiv(ts, cap, candidates, NULL);
4994 + if (pkg == NULL) { /* user aborts */
5001 + pkg = n_array_nth(pkgs, 0);
5003 pkg_hand_mark(ts->pms, pkg);
5008 else if (cmprc < 0 && poldek_ts_issetf(ts, POLDEK_TS_DOWNGRADE))
5014 msgn(1, _("%s: marked as %s's provider"), pkg_id(pkg),
5015 @@ -82,10 +103,10 @@
5026 n_array_free(dbpkgs);
5027 @@ -93,20 +114,26 @@
5031 +/* handles --caplookup */
5032 int in_prepare_icaps(struct poldek_ts *ts)
5040 icaps = arg_packages_get_resolved_caps(ts->aps);
5041 keys = n_hash_keys_cp(icaps);
5042 for (i=0; i < n_array_size(keys); i++) {
5043 const char *cap = n_array_nth(keys, i);
5044 tn_array *pkgs = n_hash_get(icaps, cap);
5045 - prepare_icap(ts, cap, pkgs);
5047 + if (prepare_icap(ts, cap, pkgs) == -1) {
5058 diff -urN poldek-0.20.org/install/ictx.h poldek-0.20/install/ictx.h
5059 --- poldek-0.20.org/install/ictx.h 2005-10-18 20:02:16.000000000 +0200
5060 +++ poldek-0.20/install/ictx.h 2006-07-26 20:25:54.131321750 +0200
5062 int in_process_package(int indent, struct install_ctx *ictx,
5063 struct pkg *pkg, int process_as);
5066 +struct pkg *in_choose_equiv(struct poldek_ts *ts, struct capreq *cap,
5067 + struct pkg **candidates, struct pkg *defaultpkg);
5069 diff -urN poldek-0.20.org/install/install.c poldek-0.20/install/install.c
5070 --- poldek-0.20.org/install/install.c 2005-10-20 19:39:12.000000000 +0200
5071 +++ poldek-0.20/install/install.c 2006-07-26 20:25:54.131321750 +0200
5080 #include <vfile/vfile.h>
5082 struct install_ctx ictx;
5083 n_assert(ts->type == POLDEK_TS_INSTALL);
5085 - in_prepare_icaps(ts);
5086 + if (in_prepare_icaps(ts) < 0) /* user aborts, no error */
5089 if (unmark_name_dups(ts->pms, ts->ctx->ps->pkgs) == 0) {
5090 msgn(1, _("Nothing to do"));
5092 diff -urN poldek-0.20.org/install/misc.c poldek-0.20/install/misc.c
5093 --- poldek-0.20.org/install/misc.c 2005-10-20 19:57:51.000000000 +0200
5094 +++ poldek-0.20/install/misc.c 2006-07-26 20:25:54.139322250 +0200
5108 - if (candidates && nsuspkgs) {
5109 + if (candidates && nsuspkgs > 1) {
5111 *candidates = suspkgs;
5113 @@ -460,3 +460,16 @@
5114 ictx->uninst_set->dbpkgs);
5117 +struct pkg *in_choose_equiv(struct poldek_ts *ts, struct capreq *cap,
5118 + struct pkg **candidates, struct pkg *defaultpkg)
5122 + if (defaultpkg == NULL)
5123 + defaultpkg = candidates[0];
5125 + n = ts->askpkg_fn(capreq_snprintf_s(cap), candidates, defaultpkg);
5128 + return candidates[n];
5130 diff -urN poldek-0.20.org/install/requirements.c poldek-0.20/install/requirements.c
5131 --- poldek-0.20.org/install/requirements.c 2005-10-20 20:19:16.000000000 +0200
5132 +++ poldek-0.20/install/requirements.c 2006-07-26 20:25:54.139322250 +0200
5142 @@ -165,12 +165,15 @@
5144 struct pkg *real_tomark = tomark;
5145 if (tomark_candidates) {
5147 - n = ictx->ts->askpkg_fn(capreq_snprintf_s(req),
5148 - tomark_candidates, tomark);
5149 - real_tomark = tomark_candidates[n];
5150 + real_tomark = in_choose_equiv(ictx->ts, req, tomark_candidates,
5152 free(tomark_candidates);
5153 tomark_candidates = NULL;
5155 + if (real_tomark == NULL) { /* user abort */
5156 + ictx->nerr_fatal++;
5161 if (in_is_marked_for_removal_by_req(ictx, real_tomark, req)) {
5162 @@ -265,7 +268,10 @@
5163 memset(&successor, 0, sizeof(successor));
5164 if (process_as == PROCESS_AS_ORPHAN &&
5165 ictx->ts->getop(ictx->ts, POLDEK_OP_AGGREEDY)) {
5166 - if (in_pkg_drags(ictx, pkg) == 0) {
5169 + pkg_ndragged = in_pkg_drags(ictx, pkg);
5170 + if (pkg_ndragged == 0 || 1) { /* XXX: see note in pkgset-install.c */
5172 int is_marked = 0, ndragged = 0, by_obsoletes = 0;
5175 successor.realpkg = p;
5176 successor.by_obsoletes = by_obsoletes;
5178 - /* do not follow successor if package drags something and
5180 - if (p && (ndragged = in_pkg_drags(ictx, p)) > 0 && is_marked == 0) {
5181 + /* do not follow successor if it drags more than its predecessor
5182 + and successor itself is not marked */
5183 + if (p && (ndragged = in_pkg_drags(ictx, p)) > pkg_ndragged && is_marked == 0) {
5184 DBGF("OMIT select_successor %s -> %s (%d)\n",
5185 pkg_id(pkg), pkg_id(p), ndragged);
5187 diff -urN poldek-0.20.org/INSTALL poldek-0.20/INSTALL
5188 --- poldek-0.20.org/INSTALL 2002-05-13 22:24:43.000000000 +0200
5189 +++ poldek-0.20/INSTALL 2006-07-26 20:25:54.139322250 +0200
5191 Build requirements: $ grep ^BuildReq poldek.spec
5192 +To build without libxml2, use --without-xml-metadata option as follows:
5195 +$ ./configure [--without-xml-metadata] && make
5197 -$ ./configure && make
5200 +or better build rpm package:
5202 -$ rpm -tb poldek-<VERSION>.tar.gz --define 'distro <distro>'
5203 -Possible distro values: pld, rh or mdk.
5204 +$ rpmbuild -tb poldek-${version}.tar.gz --define 'distro <distro>' \
5205 + [--without xml_metadata]
5207 +Possible distro values: pld, rh, fedora and centos
5210 diff -urN poldek-0.20.org/lib_init.c poldek-0.20/lib_init.c
5211 --- poldek-0.20.org/lib_init.c 2005-10-27 00:49:40.000000000 +0200
5212 +++ poldek-0.20/lib_init.c 2006-07-26 20:25:54.147322750 +0200
5221 #ifdef HAVE_CONFIG_H
5223 #include "poldek_intern.h"
5224 #include "poldek_term.h"
5226 +#include "conf_intern.h"
5228 -extern void (*poldek_log_say_goodbye)(const char *msg); /* log.c */
5229 +extern int (*poldek_log_say_goodbye)(const char *msg); /* log.c */
5231 static int poldeklib_init_called = 0;
5235 static const char *poldek_logprefix = "poldek";
5237 -static void say_goodbye(const char *msg);
5238 -void (*poldek_say_goodbye)(const char *msg) = say_goodbye;
5239 +static int say_goodbye(const char *msg);
5240 +int (*poldek_say_goodbye)(const char *msg) = say_goodbye;
5243 void (*poldek_assert_hook)(const char *expr, const char *file, int line) = NULL;
5246 void (*poldek_die_hook)(const char *msg) = NULL;
5250 static void register_vf_handlers_compat(const tn_hash *htcnf);
5251 static void register_vf_handlers(const tn_array *fetchers);
5255 int poldek_load_sources__internal(struct poldek_ctx *ctx, int load_dbdepdirs);
5261 +struct default_op_map_ent {
5262 + int config; /* configuration var? */
5267 -} default_op_map[] = {
5268 - { 1, "use_sudo", POLDEK_OP_USESUDO, 0 },
5269 - { 1, "confirm_installation", POLDEK_OP_CONFIRM_INST, 0 },
5270 - { 1, "confirm_removal", POLDEK_OP_CONFIRM_UNINST, 1 },
5271 - { 1, "keep_downloads", POLDEK_OP_KEEP_DOWNLOADS, 0 },
5272 - { 1, "choose_equivalents_manually", POLDEK_OP_EQPKG_ASKUSER, 0 },
5273 - { 1, "particle_install", POLDEK_OP_PARTICLE, 1 },
5274 - { 1, "follow", POLDEK_OP_FOLLOW, 1 },
5275 - { 1, "obsoletes", POLDEK_OP_OBSOLETES, 1 },
5276 - { 1, "conflicts", POLDEK_OP_CONFLICTS, 1 },
5277 - { 1, "mercy", POLDEK_OP_VRFYMERCY, 1 },
5278 - { 1, "greedy", POLDEK_OP_GREEDY, 1 },
5279 - { 1, "allow_duplicates", POLDEK_OP_ALLOWDUPS, 1 },
5280 - { 1, "unique_package_names", POLDEK_OP_UNIQN, 0 },
5281 - { 1, "promoteepoch", POLDEK_OP_PROMOTEPOCH, 0 },
5282 - { 1, "multilib", POLDEK_OP_MULTILIB, 0 },
5283 - { 0, "(!no)hold", POLDEK_OP_HOLD, 1 },
5284 - { 0, "(!no)ingore", POLDEK_OP_IGNORE, 1 },
5289 +static tn_array *default_op_map = NULL; /* see build_default_op_map() */
5291 int poldek__is_setup_done(struct poldek_ctx *ctx)
5293 return (ctx->_iflags & SETUP_DONE) == SETUP_DONE;
5297 static inline void check_if_setup_done(struct poldek_ctx *ctx)
5299 if ((ctx->_iflags & SETUP_DONE) == SETUP_DONE)
5300 @@ -684,34 +666,142 @@
5304 +int default_op_map_ent_cmp(struct default_op_map_ent *e1,
5305 + struct default_op_map_ent *e2)
5307 + return strcmp(e1->name, e2->name);
5310 +static tn_array *build_default_op_map(void)
5312 + struct poldek_conf_tag *tags = NULL;
5315 + struct default_op_map_ent *ent;
5316 + struct default_op_map_ent addon[] = {
5317 + { 0, "(!no)hold", POLDEK_OP_HOLD, 1, 1, CONF_TYPE_BOOLEAN },
5318 + { 0, "(!no)ingore", POLDEK_OP_IGNORE, 1, 1, CONF_TYPE_BOOLEAN },
5319 + { 0, NULL, 0, 0, 0, 0 }
5322 + op_map = n_array_new(32, free, (tn_fn_cmp)default_op_map_ent_cmp);
5324 + while (poldek_conf_sections[i].name) {
5325 + if (n_str_eq(poldek_conf_sections[i].name, "global")) {
5326 + tags = poldek_conf_sections[i].tags;
5334 + while (tags[i].name) {
5335 + if (tags[i]._op_no == 0) {
5340 + ent = n_malloc(sizeof(*ent));
5341 + n_assert(tags[i].flags & (CONF_TYPE_BOOLEAN | CONF_TYPE_BOOLEAN3));
5343 + ent->name = tags[i].name;
5344 + ent->op = tags[i]._op_no;
5346 + if (tags[i].flags & CONF_TYPE_BOOLEAN) {
5347 + ent->_defaultv = poldek_util_parse_bool(tags[i].defaultv);
5348 + ent->defaultv = ent->_defaultv;
5349 + n_assert(ent->defaultv == 0 || ent->defaultv == 1);
5350 + ent->optype = CONF_TYPE_BOOLEAN;
5352 + } else if (tags[i].flags & CONF_TYPE_BOOLEAN3) {
5353 + ent->_defaultv = poldek_util_parse_bool3(tags[i].defaultv);
5354 + n_assert(ent->_defaultv == 0 || ent->_defaultv == 1 ||
5355 + ent->_defaultv == 2);
5357 + ent->defaultv = ent->_defaultv;
5358 + ent->optype = CONF_TYPE_BOOLEAN3;
5364 + n_array_push(op_map, ent);
5369 + while (addon[i].name) {
5370 + ent = n_malloc(sizeof(*ent));
5372 + ent->name = addon[i].name;
5373 + ent->op = addon[i].op;
5374 + ent->_defaultv = ent->defaultv = addon[i].defaultv;
5375 + ent->optype = addon[i].optype;
5376 + n_array_push(op_map, ent);
5380 + for (i=0; i<n_array_size(op_map); i++) {
5381 + struct default_op_map_ent *ent = n_array_nth(op_map, i);
5382 + DBGF("%s %d\n", ent->name, ent->_defaultv);
5385 + n_array_sort(op_map);
5390 void poldek__ts_apply_config(struct poldek_ctx *ctx, struct poldek_ts *ts)
5392 tn_hash *htcnf = NULL;
5395 + n_assert(default_op_map);
5397 if (ctx->htconf == NULL)
5400 htcnf = poldek_conf_get_section_ht(ctx->htconf, "global");
5403 DBGF("ts %p, tsctx %p\n", ts, ctx->ts);
5404 - while (default_op_map[i].name && default_op_map[i].config) {
5405 - const char *name = default_op_map[i].name;
5406 - int op = default_op_map[i].op;
5407 + DBGF("default_op_map size = %d\n", n_array_size(default_op_map));
5409 + for (i=0; i < n_array_size(default_op_map); i++) {
5410 + struct default_op_map_ent *ent = n_array_nth(default_op_map, i);
5412 + DBGF("op[%d] %s (config %d)\n", i, ent->name, ent->config);
5414 + if (ent->config == 0) /* omit non-config options */
5417 - if (poldek_ts_op_touched(ts, op)) { /* modified by cmdl opts */
5418 - DBGF(" - ldconfig %s(%d) = %d\n", name, op, ts->getop(ts, op));
5420 + n_assert(ent->defaultv >= 0);
5422 + if (poldek_ts_op_touched(ts, ent->op)) { /* modified by cmdl opts */
5423 + DBGF(" %d. - ldconfig %s(%d) = %d\n", i, ent->name, ent->op,
5424 + ts->getop(ts, ent->op));
5427 - int v = poldek_conf_get_bool(htcnf, name,
5428 - default_op_map[i].defaultv);
5430 + if (ent->optype == CONF_TYPE_BOOLEAN)
5431 + v = poldek_conf_get_bool(htcnf, ent->name, ent->defaultv);
5433 + else if (ent->optype == CONF_TYPE_BOOLEAN3)
5434 + v = poldek_conf_get_bool3(htcnf, ent->name, ent->defaultv);
5438 - DBGF(" + ldconfig %s(%d) = %d\n", name, op, v);
5439 - poldek_ts_xsetop(ts, op, v, 0);
5440 + if (ent->optype == CONF_TYPE_BOOLEAN3 && v == 2) { /* auto */
5441 + if (ent->defaultv != 0 && ent->defaultv != 1)
5443 + v = ent->defaultv;
5446 + n_assert(v == 0 || v == 1);
5447 + DBGF(" %d. + ldconfig %s(%d) = %d\n", i, ent->name, ent->op, v);
5448 + poldek_ts_xsetop(ts, ent->op, v, 0);
5454 if (ts->getop(ts, POLDEK_OP_CONFIRM_INST) && poldek_VERBOSE < 1)
5455 @@ -726,15 +816,17 @@
5457 void poldek__ts_dump_settings(struct poldek_ctx *ctx, struct poldek_ts *ts)
5463 + n_assert(default_op_map);
5464 DBGF_F("ts %p, tsctx %p\n", ts, ctx->ts);
5465 - while (default_op_map[i].op) {
5466 - const char *name = default_op_map[i].name;
5467 - int op = default_op_map[i++].op;
5469 - DBGF_F("%% %s=%s (ctx=%s)\n", name, ts->getop(ts, op) ? "y" : "n",
5470 - ctx->ts->getop(ctx->ts, op) ? "y" : "n");
5471 + for (i=0; i<n_array_size(default_op_map); i++) {
5472 + struct default_op_map_ent *ent = n_array_nth(default_op_map, i);
5474 + DBGF_F("%% %s=%s (ctx=%s)\n", ent->name,
5475 + ts->getop(ts, ent->op) ? "y" : "n",
5476 + ctx->ts->getop(ctx->ts, ent->op) ? "y" : "n");
5480 @@ -744,29 +836,29 @@
5481 struct poldek_ts *ts)
5486 + n_assert(default_op_map);
5487 DBGF("ts %p, tsctx %p\n", ts, ctx->ts);
5488 - while (default_op_map[i].op) {
5489 - const char *name = default_op_map[i].name;
5490 - int op = default_op_map[i++].op;
5492 - name = name; /* compiler warn */
5493 - if (poldek_ts_op_touched(ts, op)) { /* modified by cmdl opts */
5494 - DBGF(" - skip touched %s(%d) = %d, ctxv %d\n", name, op,
5495 - ts->getop(ts, op), ctx->ts->getop(ctx->ts, op));
5497 + for (i=0; i<n_array_size(default_op_map); i++) {
5498 + struct default_op_map_ent *ent = n_array_nth(default_op_map, i);
5500 + if (poldek_ts_op_touched(ts, ent->op)) { /* modified by cmdl opts */
5501 + DBGF(" - skip touched %s(%d) = %d, ctxv %d\n", ent->name, ent->op,
5502 + ts->getop(ts, ent->op), ctx->ts->getop(ctx->ts, ent->op));
5506 - if (poldek_ts_op_touched(ctx->ts, op)) {
5507 - DBGF(" + apply %s(%d) = %d (was %d)\n", name, op,
5508 - ctx->ts->getop(ctx->ts, op), ts->getop(ts, op));
5509 + if (poldek_ts_op_touched(ctx->ts, ent->op)) {
5510 + DBGF(" + apply %s(%d) = %d (was %d)\n", ent->name, ent->op,
5511 + ctx->ts->getop(ctx->ts, ent->op), ts->getop(ts, ent->op));
5513 - ts->setop(ts, op, ctx->ts->getop(ctx->ts, op));
5514 + ts->setop(ts, ent->op, ctx->ts->getop(ctx->ts, ent->op));
5517 - DBGF(" - NOT apply %s(%d) = %d (touched=%d)\n", name,
5518 - op, ctx->ts->getop(ctx->ts, op),
5519 - poldek_ts_op_touched(ctx->ts, op));
5520 + DBGF(" - NOT apply %s(%d) = %d (touched=%d)\n", ent->name,
5521 + ent->op, ctx->ts->getop(ctx->ts, ent->op),
5522 + poldek_ts_op_touched(ctx->ts, ent->op));
5526 @@ -880,16 +972,17 @@
5530 -static void say_goodbye(const char *msg)
5531 +static int say_goodbye(const char *msg)
5534 + return 1; /* let the caller die() itself */
5537 static void n_malloc_fault(void)
5539 - poldek_say_goodbye("Something wrong, something not quite right...\n"
5540 - "Memory exhausted\n");
5541 - exit(EXIT_FAILURE);
5542 + if (poldek_say_goodbye("Something wrong, something not quite right...\n"
5543 + "Memory exhausted\n"))
5544 + exit(EXIT_FAILURE);
5549 "Assertion '%s' failed, %s:%d\n"
5550 "Please report this bug to %s.\n\n",
5551 expr, file, line, poldek_BUG_MAILADDR);
5552 - poldek_say_goodbye(msg);
5554 + if (poldek_say_goodbye(msg))
5558 static void n_die_hook(const char *msg)
5559 @@ -909,11 +1002,12 @@
5561 n_snprintf(buf, sizeof(buf),
5562 "Something wrong, something not quite right.\ndie: %s\n", msg);
5563 - poldek_say_goodbye(buf);
5566 + if (poldek_say_goodbye(buf))
5570 -static void self_init(void)
5571 +static void verify_setuid(void)
5575 @@ -1084,6 +1178,12 @@
5577 void poldeklib_destroy(void)
5579 + if (poldeklib_init_called == 0)
5582 + n_array_free(default_op_map);
5583 + default_op_map = NULL;
5587 int poldeklib_init(void)
5588 @@ -1097,7 +1197,10 @@
5590 poldek_set_verbose(0);
5591 poldek_log_init(NULL, stdout, poldek_logprefix);
5595 + default_op_map = build_default_op_map();
5596 + n_assert(default_op_map);
5598 bindtextdomain(PACKAGE, NULL);
5599 textdomain(PACKAGE);
5600 @@ -1163,24 +1266,42 @@
5602 ctx->ts = poldek_ts_new(NULL, 0);
5606 - while (default_op_map[i].op) {
5607 - poldek_ts_xsetop(ts, default_op_map[i].op,
5608 - default_op_map[i].defaultv, 0);
5612 - if (getuid() != 0)
5613 - poldek_ts_setop(ts, POLDEK_OP_USESUDO, 1);
5615 + /* set default option values without "touching" them in ts */
5616 + for (i=0; i < n_array_size(default_op_map); i++) {
5617 + struct default_op_map_ent *ent = n_array_nth(default_op_map, i);
5618 + int v = ent->_defaultv;
5620 + if (v == 2) { /* "auto" */
5621 + switch (ent->op) {
5622 + case POLDEK_OP_USESUDO:
5624 + if (getuid() != 0)
5628 + case POLDEK_OP_MULTILIB: /* do not touch, will
5629 + be determined later */
5635 + DBGF("auto %s = %d\n", ent->name, v);
5636 + ent->defaultv = v;
5640 + poldek_ts_xsetop(ts, ent->op, v, 0);
5642 + DBGF("default_op_map size = %d\n", n_array_size(default_op_map));
5646 struct poldek_ctx *poldek_new(unsigned flags)
5648 struct poldek_ctx *ctx;
5651 if (!poldeklib_init_called) {
5652 logn(LOGERR | LOGDIE, "poldeklib_init() call is a must...");
5654 @@ -1260,6 +1381,54 @@
5658 +static void __setup_multilib(struct poldek_ctx *ctx)
5660 + struct default_op_map_ent *ent, tmp;
5662 + int color, multilib = 2;
5665 + if (!pm_conf_get(ctx->pmctx, "%{_transaction_color}", scolor, sizeof(scolor)))
5668 + if (sscanf(scolor, "%u", &color) != 1)
5671 + if (ctx->htconf) {
5672 + tn_hash *htcnf = poldek_conf_get_section_ht(ctx->htconf, "global");
5673 + multilib = poldek_conf_get_bool3(htcnf, "multilib", 2);
5676 + if (color && multilib == 0) {
5677 + logn(LOGWARN, _("RPM works in multilib mode, while poldek not"));
5680 + } else if (!color && multilib == 1) {
5681 + logn(LOGWARN, _("poldek works in multilib mode, while rpm not"));
5685 + if (multilib == 2) { /* auto */
5686 + ctx->_rpm_tscolor = color;
5688 + tmp.name = "multilib";
5689 + ent = n_array_bsearch(default_op_map, &tmp);
5692 + ent->defaultv = 0;
5694 + ent->defaultv = 1;
5697 + msgn(2, "Enabling multilib mode, rpm's transaction color = %d",
5700 + DBGF("multilib(auto) = %d\n", ent->defaultv);
5701 + poldek_ts_xsetop(ctx->ts, ent->op, ent->defaultv, 0);
5708 static int setup_pm(struct poldek_ctx *ctx)
5709 @@ -1271,7 +1440,8 @@
5710 if (strcmp(pm, "rpm") == 0) {
5711 ctx->pmctx = pm_new(pm);
5712 pm_configure(ctx->pmctx, "macros", ctx->ts->rpmacros);
5714 + __setup_multilib(ctx);
5716 } else if (strcmp(pm, "pset") == 0) {
5717 n_array_sort_ex(ctx->dest_sources, (tn_fn_cmp)source_cmp_no);
5718 if (n_array_size(ctx->dest_sources) == 0) {
5719 diff -urN poldek-0.20.org/libpoldek.sym poldek-0.20/libpoldek.sym
5720 --- poldek-0.20.org/libpoldek.sym 2005-10-21 01:01:10.000000000 +0200
5721 +++ poldek-0.20/libpoldek.sym 2006-07-26 20:25:54.147322750 +0200
5725 poldek_ts_vconfigure
5726 +poldek_util_expand_vars
5727 +poldek_util_expand_env_vars
5728 poldek_util_get_gmt_offs
5729 poldek_util_is_rwxdir
5731 diff -urN poldek-0.20.org/log.c poldek-0.20/log.c
5732 --- poldek-0.20.org/log.c 2005-10-27 00:46:07.000000000 +0200
5733 +++ poldek-0.20/log.c 2006-07-26 20:25:54.155323250 +0200
5745 int poldek_VERBOSE = 0;
5747 -static void say_goodbye(const char *msg);
5748 -void (*poldek_log_say_goodbye)(const char *msg) = say_goodbye;
5749 +static int say_goodbye(const char *msg);
5750 +int (*poldek_log_say_goodbye)(const char *msg) = say_goodbye;
5752 static char l_prefix[64];
5753 -static FILE *l_stream, *l_fstream = NULL;
5754 +static FILE *l_stream = NULL, *l_filestream = NULL;
5756 static void vlog_tty(int pri, const char *fmt, va_list args);
5758 -static void say_goodbye(const char *msg)
5759 +static int say_goodbye(const char *msg)
5762 - /* do nothing, msg is logged before die */
5764 + msg = msg; /* do nothing, msg is logged before die */
5768 int poldek_verbose(void)
5771 static int last_endlined = 1;
5772 char buf[1024], tmp_fmt[1024];
5773 - int n = 0, flags, is_cont = 0, is_endlined = 0;
5774 + int n = 0, flags, is_continuation = 0, is_endlined = 0;
5779 + is_continuation = 1;
5781 } else if (*fmt == '\n') {
5783 @@ -112,18 +111,18 @@
5787 - if (last_endlined == 0 && !is_cont && (pri & (LOGERR|LOGWARN)))
5788 + if (last_endlined == 0 && !is_continuation && (pri & (LOGERR|LOGWARN)))
5790 last_endlined = is_endlined;
5793 + if (indent > 0 && indent < 256) { /* have buf[1024] */
5794 memset(&buf[n], ' ', indent);
5800 - /* revert LOG[TTY|FLAGS] */
5801 + /* revert LOG[TTY|FILE] */
5802 flags = LOGTTY | LOGFILE;
5805 @@ -140,12 +139,12 @@
5809 - if ((flags & LOGFILE) && l_fstream) {
5810 + if ((flags & LOGFILE) && l_filestream) { /* logging to file */
5812 - fprintf(l_fstream, "%s", buf);
5813 + fprintf(l_filestream, "%s", buf);
5817 + if (!is_continuation) {
5821 @@ -153,24 +152,24 @@
5822 strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M:%S ",
5825 - fprintf(l_fstream, "%s", timbuf);
5826 + fprintf(l_filestream, "%s", timbuf);
5829 - fprintf(l_fstream, "%s", _("error: "));
5830 + fprintf(l_filestream, "%s", _("error: "));
5831 else if (pri & LOGWARN)
5832 - fprintf(l_fstream, "%s", _("warn: "));
5833 + fprintf(l_filestream, "%s", _("warn: "));
5835 - fprintf(l_fstream, "%s", buf);
5836 - vfprintf(l_fstream, fmt, args);
5837 - fflush(l_fstream);
5838 + fprintf(l_filestream, "%s", buf);
5839 + vfprintf(l_filestream, fmt, args);
5840 + fflush(l_filestream);
5846 n_snprintf(msg, sizeof(msg), fmt, args);
5849 + if (poldek_log_say_goodbye(msg))
5854 @@ -222,19 +221,20 @@
5855 if (l_stream != NULL && is_not_stdstream)
5859 - fclose(l_fstream);
5861 + fclose(l_filestream);
5866 - l_fstream = fopen(pathname, "a");
5867 + l_filestream = fopen(pathname, "a");
5871 snprintf(l_prefix, sizeof(l_prefix), "%s:", prefix);
5874 - return l_fstream != NULL;
5875 + return l_filestream != NULL;
5884 - fclose(l_fstream);
5886 + if (l_filestream) {
5887 + fclose(l_filestream);
5888 + l_filestream = NULL;
5892 @@ -261,12 +261,12 @@
5894 FILE *poldek_log_file_stream(void)
5897 + return l_filestream;
5900 int poldek_log_enabled_filelog(void)
5902 - return l_fstream != NULL;
5903 + return l_filestream != NULL;
5907 @@ -294,27 +294,3 @@
5912 -static char *text_wrap(char *dest, int size, const char *text, int tolen)
5924 - if (len > tolen) {
5935 diff -urN poldek-0.20.org/Makefile.am poldek-0.20/Makefile.am
5936 --- poldek-0.20.org/Makefile.am 2005-10-28 18:06:59.000000000 +0200
5937 +++ poldek-0.20/Makefile.am 2006-07-26 20:25:54.155323250 +0200
5943 ACLOCAL_AMFLAGS = -I m4
5950 lib_LTLIBRARIES = libpoldek.la
5951 noinst_LTLIBRARIES = libpoldek_allsym.la
5956 arg_packages.c arg_packages.h \
5958 + conf.c conf.h conf_intern.h conf_sections.c \
5959 dbpkgset.c dbpkgset.h \
5961 pkgroup.c pkgroup.h \
5966 +conf_sections.c: doc/poldek.conf.xml doc/*.xsl
5967 + doc/conf-xml2.sh c doc/poldek.conf.xml > $@
5972 diff -urN poldek-0.20.org/make.sh poldek-0.20/make.sh
5973 --- poldek-0.20.org/make.sh 1970-01-01 01:00:00.000000000 +0100
5974 +++ poldek-0.20/make.sh 2006-07-26 20:25:54.155323250 +0200
5978 +cd $(dirname $0) || exit 1
5979 +make CFLAGS="-fno-builtin-log -O0 -g -Wall -W -pipe -std=gnu99" $@
5980 diff -urN poldek-0.20.org/misc.c poldek-0.20/misc.c
5981 --- poldek-0.20.org/misc.c 2005-07-21 20:06:41.000000000 +0200
5982 +++ poldek-0.20/misc.c 2006-07-26 20:25:54.163323750 +0200
5991 #ifdef HAVE_CONFIG_H
5992 @@ -578,20 +578,29 @@
5997 -const char *expand_env_vars(char *dest, int size, const char *str)
5998 +const char *poldek_util_expand_vars(char *dest, int size, const char *src,
5999 + char varmark, tn_hash *varh, unsigned flags)
6001 const char **tl, **tl_save;
6002 + tn_array *usedvars = NULL;
6006 + if (varmark == '\0')
6009 + n_snprintf(smark, sizeof(smark), "%c", varmark);
6011 - tl = tl_save = n_str_tokl(str, "$");
6012 - if (*str != '$' && tl[1] == NULL) {
6013 + tl = tl_save = n_str_tokl(src, smark);
6014 + if (*src != varmark && tl[1] == NULL) {
6015 n_str_tokl_free(tl);
6020 + if (flags & POLDEK_UTIL_EXPANDVARS_RMUSED)
6021 + usedvars = n_array_new(16, free, (tn_fn_cmp)strcmp);
6023 - if (*str != '$') {
6024 + if (*src != varmark) {
6025 n = n_snprintf(dest, size, *tl);
6028 @@ -621,13 +630,24 @@
6031 if (v_len + 1 > (int)sizeof(val))
6035 n_snprintf(val, v_len + 1, v);
6036 - DBGF("env %s\n", val);
6037 + DBGF("var %c{%s}\n", varmark, val);
6040 + if (varh && varmark != '$') {
6041 + var = n_hash_get(varh, val);
6043 + n_array_push(usedvars, n_strdup(val));
6045 - if ((var = get_env(buf, sizeof(buf), val)) == NULL) {
6046 - n += n_snprintf(&dest[n], size - n, "$%s", p);
6047 + } else if (varmark == '$') {
6048 + var = get_env(buf, sizeof(buf), val);
6052 + if (var == NULL) {
6053 + n += n_snprintf(&dest[n], size - n, "%c%s", varmark, p);
6056 n += n_snprintf(&dest[n], size - n, "%s", var);
6057 @@ -636,9 +656,26 @@
6060 n_str_tokl_free(tl_save);
6062 + if (usedvars) { /* RMUSED is requested */
6065 + n_array_sort(usedvars);
6066 + n_array_uniq(usedvars);
6067 + for (i=0; i < n_array_size(usedvars); i++)
6068 + n_hash_remove(varh, n_array_nth(usedvars, i));
6076 +const char *poldek_util_expand_env_vars(char *dest, int size, const char *str)
6078 + return poldek_util_expand_vars(dest, size, str, '$', NULL, 0);
6081 const char *abs_path(char *buf, int size, const char *path)
6084 @@ -818,6 +855,18 @@
6088 +int poldek_util_parse_bool3(const char *v)
6092 + if ((rv = poldek_util_parse_bool(v)) == -1) {
6093 + if (strcasecmp(v, "auto") == 0 || strcasecmp(v, "a"))
6101 char *strtime_(time_t t)
6103 diff -urN poldek-0.20.org/misc.h poldek-0.20/misc.h
6104 --- poldek-0.20.org/misc.h 2005-05-18 21:43:08.000000000 +0200
6105 +++ poldek-0.20/misc.h 2006-07-26 20:25:54.163323750 +0200
6109 #ifndef POLDEK_MISC_H
6110 #define POLDEK_MISC_H
6113 char *setup_cachedir(const char *path);
6114 const char *tmpdir(void);
6116 -const char *expand_env_vars(char *dest, int size, const char *str);
6120 diff -urN poldek-0.20.org/mkpackagedir poldek-0.20/mkpackagedir
6121 --- poldek-0.20.org/mkpackagedir 1970-01-01 01:00:00.000000000 +0100
6122 +++ poldek-0.20/mkpackagedir 2006-07-26 20:25:54.167324000 +0200
6127 +PATH="/bin:/usr/bin:/usr/sbin:/sbin"
6128 +NAME=packages.dir.gz
6132 + echo "usage: `basename $0` [--nodiff] DIR..."
6135 +if [ "$#" = 0 ]; then
6141 +while [ $# -gt 0 ]; do
6142 + if [ "$1" == "--nodiff" ]; then
6148 + if [ ! -d "$1" ]; then
6149 + echo "$1: no such directory"
6153 + poldek --noconf -s "$1" --mkidxz
6155 + if [ $? -ne 0 ]; then
6159 + if [ ! -f "$1/$NAME" ]; then
6165 diff -urN poldek-0.20.org/pkg.c poldek-0.20/pkg.c
6166 --- poldek-0.20.org/pkg.c 2005-10-13 20:24:49.000000000 +0200
6167 +++ poldek-0.20/pkg.c 2006-07-26 20:25:54.175324500 +0200
6170 - Copyright (C) 2000 - 2004 Pawel A. Gajda <mis@k2.net.pl>
6171 + Copyright (C) 2000 - 2006 Pawel A. Gajda (mis@k2.net.pl)
6173 This program is free software; you can redistribute it and/or modify
6174 it under the terms of the GNU General Public License, version 2 as
6183 #ifdef HAVE_CONFIG_H
6186 len += len + 1; /* for id (nvr) */
6189 if (poldek_conf_MULTILIB && arch) {
6190 arch_len = strlen(arch);
6191 len += arch_len + 1;
6195 if (strcmp(pkg->name, "poldek") == 0) {
6196 - DBGF_F("%p %s (pdir %s, na->refcnt=%d), refcnt=%d (%p)\n",
6197 + DBGF("%p %s (pdir %s, na->refcnt=%d), refcnt=%d (%p)\n",
6198 pkg, pkg_snprintf_s(pkg),
6199 pkg->pkgdir ? pkgdir_idstr(pkg->pkgdir) : "<none>",
6200 pkg->na ? pkg->na->_refcnt : -1,
6204 DBGF("\npkg_caps_match_req %s %s\n", pkg_snprintf_s(pkg),
6205 - capreq_snprintf_s(req));
6207 + capreq_snprintf_s(req));
6209 if (pkg->caps == NULL || n_array_size(pkg->caps) == 0)
6210 return 0; /* not match */
6212 @@ -703,40 +702,25 @@
6216 - struct capreq *cap;
6218 + for (i = n; i < n_array_size(pkg->caps); i++) {
6219 + struct capreq *cap = n_array_nth(pkg->caps, i);
6221 - cap = n_array_nth(pkg->caps, n);
6222 - if (cap_xmatch_req(cap, req, flags)) {
6223 - DBGF("chk%d (%s-%s-%s) -> match (flags=%d)\n", n, capreq_name(cap),
6224 - capreq_ver(cap), capreq_rel(cap), flags);
6229 - for (i = n; i<n_array_size(pkg->caps); i++) {
6230 - struct capreq *cap;
6232 - cap = n_array_nth(pkg->caps, n);
6233 - if (strcmp(capreq_name(cap), capreq_name(req)) != 0) {
6234 - DBGF("chk%d %s-%s-%s -> NOT match IRET\n", i,
6235 - capreq_name(cap), capreq_ver(cap),
6237 + /* names not equal -> return with false;
6238 + eq test omitting for first cap */
6239 + if (i > n && n_str_ne(capreq_name(cap), capreq_name(req))) {
6240 + DBGF(" cap[%d] %s -> NOT match, IRET\n", i,
6241 + capreq_snprintf_s(cap));
6247 if (cap_xmatch_req(cap, req, flags)) {
6248 - DBGMSG("chk %s-%s-%s -> match\n", capreq_name(cap),
6249 - capreq_ver(cap), capreq_rel(cap));
6250 + DBGF(" cap[%d] %s -> match\n", i, capreq_snprintf_s(cap));
6253 - DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
6254 - capreq_name(cap), capreq_ver(cap),
6258 + DBGF(" cap[%d] %s -> NOT match\n", i, capreq_snprintf_s(cap));
6264 diff -urN poldek-0.20.org/pkgdir/metadata/load.c poldek-0.20/pkgdir/metadata/load.c
6265 --- poldek-0.20.org/pkgdir/metadata/load.c 2005-10-18 20:01:35.000000000 +0200
6266 +++ poldek-0.20/pkgdir/metadata/load.c 2006-07-26 20:25:54.183325000 +0200
6276 //<rpm:entry name="glibc-devel" flags="LT" epoch="0" ver="2.2.3", rel="foo" pri="1" />
6277 -static tn_array *load_caps(tn_alloc *na, tn_array *arr, xmlNode *node, unsigned cr_flags)
6278 +static tn_array *load_caps(tn_alloc *na, tn_array *arr, xmlNode *node,
6279 + unsigned cr_flags)
6282 arr = capreq_arr_new(0);
6287 -static struct pkg *load_package(tn_alloc *na, struct pkgroup_idx *pkgroups, xmlNode *node)
6288 +static struct pkg *load_package(tn_alloc *na, struct pkgroup_idx *pkgroups,
6291 struct pkg pkg, *rpkg = NULL;
6295 else if (x_node_eq(n, "file")) {
6296 char *path = xmlNodeGetContent(n);
6297 - struct capreq *cr = capreq_new(na, path, 0, NULL, NULL, 0, 0);
6298 + struct capreq *cr = capreq_new(na, path, 0, NULL,
6300 if (pkg.caps == NULL)
6301 pkg.caps = capreq_arr_new(0);
6302 n_array_push(pkg.caps, cr);
6303 diff -urN poldek-0.20.org/pkgdir/pdir/pdir_pkg_store.c poldek-0.20/pkgdir/pdir/pdir_pkg_store.c
6304 --- poldek-0.20.org/pkgdir/pdir/pdir_pkg_store.c 2005-10-13 20:24:50.000000000 +0200
6305 +++ poldek-0.20/pkgdir/pdir/pdir_pkg_store.c 2006-07-26 20:25:54.183325000 +0200
6314 #ifdef HAVE_CONFIG_H
6317 n_buf_printf(nbuf, "n: %s\n", pkg->fn);
6320 + if (pkg->fmtime && (flags & PKGSTORE_NOTIMESTAMP) == 0)
6321 n_buf_printf(nbuf, "t: %u\n", pkg->fmtime);
6323 n_buf_printf(nbuf, "F:\n");
6324 diff -urN poldek-0.20.org/pkgdir/pndir/pndir.c poldek-0.20/pkgdir/pndir/pndir.c
6325 --- poldek-0.20.org/pkgdir/pndir/pndir.c 2005-10-21 17:38:28.000000000 +0200
6326 +++ poldek-0.20/pkgdir/pndir/pndir.c 2006-07-26 20:25:54.191325500 +0200
6335 #ifdef HAVE_CONFIG_H
6336 @@ -198,13 +198,14 @@
6340 -int open_dscr(struct pndir *idx, time_t ts, const char *lang)
6341 +struct tndb *do_open_dscr(struct pndir *idx, int vfmode, struct vfile **vf,
6342 + time_t ts, const char *lang)
6344 char buf[128], tmpath[PATH_MAX], tss[32];
6347 const char *dbid, *langid;
6350 pndir_db_dscr_idstr(lang, &dbid, &langid);
6352 idxpath = idx->idxpath;
6353 @@ -244,24 +245,48 @@
6355 DBGF("mk %s, %s\n", idxpath, suffix);
6356 pndir_mkidx_pathname(tmpath, sizeof(tmpath), idxpath, suffix);
6359 + msgn(3, _("Opening %s..."), vf_url_slim_s(tmpath, 0));
6360 + return do_dbopen(tmpath, vfmode, vf, idx->srcnam);
6365 +int open_dscr(struct pndir *idx, int vfmode, time_t ts, const char *lang)
6367 + struct tndb *db = NULL;
6368 + struct vfile *vf = NULL;
6370 if (idx->db_dscr_h == NULL)
6371 idx->db_dscr_h = pndir_db_dscr_h_new();
6373 - if (!pndir_db_dscr_h_get(idx->db_dscr_h, lang)) {
6375 + if (pndir_db_dscr_h_get(idx->db_dscr_h, lang))
6378 + if ((db = do_open_dscr(idx, vfmode, &vf, ts, lang)) == NULL)
6381 + if (tndb_verify(db)) {
6382 + pndir_db_dscr_h_insert(idx->db_dscr_h, lang, db);
6384 - msgn(3, _("Opening %s..."), vf_url_slim_s(tmpath, 0));
6385 - if ((db = do_dbopen(tmpath, idx->_vf->vf_mode, NULL, idx->srcnam))) {
6386 - if (tndb_verify(db))
6387 - pndir_db_dscr_h_insert(idx->db_dscr_h, lang, db);
6390 - logn(LOGERR, "%s: broken file", vf_url_slim_s(tmpath, 0));
6393 + logn(LOGERR, "%s: broken file", vf_url_slim_s(tndb_path(db), 0));
6395 + if (vf->vf_flags & VF_FRMCACHE) { /* not fully downloaded? */
6396 + n_assert(vfmode & VFM_CACHE);
6397 + vfmode &= ~VFM_CACHE;
6398 + vfmode |= VFM_NODEL;
6403 + return open_dscr(idx, vfmode, ts, lang);
6411 return pndir_db_dscr_h_get(idx->db_dscr_h, lang) != NULL;
6418 -int pndir_open_verify(struct pndir *idx, const char *path, int vfmode, unsigned flags,
6419 - const char *srcnam)
6420 +int pndir_open_verify(struct pndir *idx, const char *path, int vfmode,
6421 + unsigned flags, const char *srcnam)
6425 @@ -514,12 +539,12 @@
6429 - if (!open_dscr(&idx, pkgdir->orig_ts, "C"))
6430 + if (!open_dscr(&idx, vfmode, pkgdir->orig_ts, "C"))
6433 if (nerr == 0 && loadi18n) {
6435 - if (!open_dscr(&idx, pkgdir->orig_ts, "i18n"))
6436 + if (!open_dscr(&idx, vfmode, pkgdir->orig_ts, "i18n"))
6440 diff -urN poldek-0.20.org/pkgdir/source.c poldek-0.20/pkgdir/source.c
6441 --- poldek-0.20.org/pkgdir/source.c 2005-10-27 00:59:33.000000000 +0200
6442 +++ poldek-0.20/pkgdir/source.c 2006-07-26 20:25:54.199326000 +0200
6452 @@ -1034,6 +1034,10 @@
6454 if (pkgdir_load(pkgdir, NULL, ldflags)) {
6455 n_assert((pkgdir->_ldflags & PKGDIR_LD_DOIGNORE) == 0);
6457 + if (kw && n_hash_exists(kw, "v018x"))
6458 + cr_flags |= PKGDIR_CREAT_v018x;
6460 rc = pkgdir_save_as(pkgdir, type, idxpath, cr_flags);
6463 diff -urN poldek-0.20.org/pkgdir/source.h poldek-0.20/pkgdir/source.h
6464 --- poldek-0.20.org/pkgdir/source.h 2005-05-05 20:54:32.000000000 +0200
6465 +++ poldek-0.20/pkgdir/source.h 2006-07-26 20:25:54.199326000 +0200
6469 #ifndef POLDEK_SOURCE_H
6470 #define POLDEK_SOURCE_H
6474 int sources_clean(tn_array *sources, unsigned flags);
6476 -#define PKGSOURCE_MKIDX_NODIFF (1 << 0)
6477 -#define PKGSOURCE_MKIDX_COMPRESSED_GZ (1 << 1)
6478 -#define PKGSOURCE_MKIDX_COMPRESSED_BZ2 (1 << 2)
6480 +/* flags = PKGDIR_CREAT_* */
6481 int source_make_idx(struct source *src, const char *stype,
6482 const char *dtype, const char *idxpath,
6483 unsigned flags, tn_hash *kw);
6484 diff -urN poldek-0.20.org/pkgfl.c poldek-0.20/pkgfl.c
6485 --- poldek-0.20.org/pkgfl.c 2005-10-12 21:28:02.000000000 +0200
6486 +++ poldek-0.20/pkgfl.c 2006-07-26 20:25:54.207326500 +0200
6496 @@ -636,5 +636,65 @@
6500 +/* returns list of directories not belong to filelist itself */
6501 +int pkgfl_owned_and_required_dirs(tn_tuple *fl, tn_array **owned,
6502 + tn_array **required)
6504 + const char *dn = NULL;
6506 + tn_array *od = NULL, *rd = NULL;
6509 + od = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
6512 + rd = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
6514 + for (i=0; i < n_tuple_size(fl); i++) {
6515 + struct pkgfl_ent *flent = n_tuple_nth(fl, i);
6517 + if (dn && strncmp(dn, flent->dirname, dnlen) == 0) {
6519 + n_array_push(od, flent->dirname);
6523 + dn = flent->dirname;
6524 + if (*dn == '/' && *(dn + 1) == '\0') {
6530 + dnlen = strlen(dn);
6532 + n_array_push(rd, dn);
6538 + for (i = 0; i < n_array_size(od); i++)
6539 + printf("O %s\n", n_array_nth(od, i));
6545 + for (i = 0; i < n_array_size(rd); i++)
6546 + printf("R %s\n", n_array_nth(rd, i));
6552 +tn_array *pkgfl_required_directories(tn_tuple *fl)
6554 + tn_array *required = NULL;
6556 + pkgfl_owned_and_required_dirs(fl, NULL, &required);
6562 diff -urN poldek-0.20.org/pkgset.c poldek-0.20/pkgset.c
6563 --- poldek-0.20.org/pkgset.c 2005-06-17 00:15:19.000000000 +0200
6564 +++ poldek-0.20/pkgset.c 2006-07-26 20:25:54.211326750 +0200
6574 @@ -136,9 +136,13 @@
6575 int pkgset_pmprovides(const struct pkgset *ps, const struct capreq *req)
6580 if (ps->rpmcaps == NULL)
6581 - return 1; /* no caps -> assume yes */
6582 + return 0; /* no caps -> assume NO */
6584 + /* internal caps have names like name(feature) */
6585 + if (!capreq_is_rpmlib(req) && strstr(capreq_name(req), "(") == NULL)
6588 cap = n_array_bsearch_ex(ps->rpmcaps, req,
6589 (tn_fn_cmp)capreq_cmp_name);
6590 diff -urN poldek-0.20.org/pkgset-install.c poldek-0.20/pkgset-install.c
6591 --- poldek-0.20.org/pkgset-install.c 2005-10-24 17:30:40.000000000 +0200
6592 +++ poldek-0.20/pkgset-install.c 2006-07-26 20:25:54.211326750 +0200
6602 + Dependency resolver module.
6603 + This file is going to be obsoleted soon, the same code splitted and
6604 + partially redesigned was moved to install/ subdir
6607 #ifdef HAVE_CONFIG_H
6608 @@ -1174,7 +1180,9 @@
6609 memset(&successor, 0, sizeof(successor));
6610 if (process_as == PROCESS_AS_ORPHAN &&
6611 upg->ts->getop(upg->ts, POLDEK_OP_AGGREEDY)) {
6612 - if (pkg_drags(pkg, ps, upg) == 0) {
6613 + int ndrags = pkg_drags(pkg, ps, upg);
6614 + DBGF("%s, ndrags %d\n", pkg_id(pkg), ndrags);
6615 + if (ndrags == 0 || 1) { /* XXX cond temporary disabled - needs test */
6617 int is_marked = 0, ndragged = 0, by_obsoletes = 0;
6619 @@ -1186,9 +1194,10 @@
6620 successor.realpkg = p;
6621 successor.by_obsoletes = by_obsoletes;
6623 - /* do not follow successor if package drags something and
6625 - if (p && (ndragged = pkg_drags(p, ps, upg)) > 0 && is_marked == 0) {
6626 + /* do not follow successor if it drags more packages than orphaned one
6627 + * and successor is not marked */
6629 + if (p && (ndragged = pkg_drags(p, ps, upg)) > ndrags && is_marked == 0) {
6630 DBGF("OMIT select_successor %s -> %s (%d)\n",
6631 pkg_id(pkg), pkg_id(p), ndragged);
6633 @@ -1240,7 +1249,8 @@
6635 DBGF("req %s\n", capreq_snprintf_s(req));
6637 - if (upg->ts->getop(upg->ts, POLDEK_OP_EQPKG_ASKUSER) && upg->ts->askpkg_fn)
6638 + if (upg->ts->getop(upg->ts, POLDEK_OP_EQPKG_ASKUSER) &&
6639 + upg->ts->askpkg_fn)
6640 tomark_candidates_ptr = &tomark_candidates;
6642 if (find_req(pkg, req, &tomark, tomark_candidates_ptr, ps, upg)) {
6643 @@ -1298,6 +1308,14 @@
6645 n = upg->ts->askpkg_fn(capreq_snprintf_s(req),
6646 tomark_candidates, tomark);
6648 + if (n == -1) { /* user abort */
6649 + free(tomark_candidates);
6650 + tomark_candidates = NULL;
6651 + upg->nerr_fatal++;
6655 real_tomark = tomark_candidates[n];
6656 free(tomark_candidates);
6657 tomark_candidates = NULL;
6658 @@ -1434,12 +1452,15 @@
6661 process_pkg_reqs(indent, pkg, ps, upg, process_as);
6664 if (process_as == PROCESS_AS_NEW) {
6665 process_pkg_conflicts(indent, pkg, ps, upg);
6666 //process_pkg_obsl(pkg, ps, upg, indent);
6669 + if (upg->nerr_fatal || sigint_reached())
6672 DBGF("END PROCESSING [%d] %s as %s\n", indent, pkg_id(pkg),
6673 process_as == PROCESS_AS_NEW ? "NEW" : "ORPHAN");
6675 @@ -1529,7 +1550,14 @@
6676 struct pkg *real_tomark = tomark;
6677 if (tomark_candidates) {
6679 - n = upg->ts->askpkg_fn(capreq_snprintf_s(req), tomark_candidates, tomark);
6680 + n = upg->ts->askpkg_fn(capreq_snprintf_s(req), tomark_candidates,
6683 + n_cfree(&tomark_candidates);
6684 + upg->nerr_fatal++;
6688 real_tomark = tomark_candidates[n];
6689 n_cfree(&tomark_candidates);
6691 @@ -1805,6 +1833,9 @@
6695 + if (upg->nerr_fatal || sigint_reached())
6698 if (!upg->ts->getop(upg->ts, POLDEK_OP_CONFLICTS))
6701 @@ -1847,7 +1878,9 @@
6703 pkg_set_unmetdeps(upg->unmetpms, pkg);
6707 + if (upg->nerr_fatal || sigint_reached())
6710 if (pkg->cnfls != NULL)
6711 for (i = 0; i < n_array_size(pkg->cnfls); i++) {
6712 @@ -2314,103 +2347,8 @@
6717 -int prepare_icap(struct poldek_ts *ts, const char *capname, tn_array *pkgs)
6721 - struct capreq *cap;
6723 - capreq_new_name_a(capname, cap);
6724 - dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cap, NULL, 0);
6725 - if (dbpkgs == NULL) {
6727 - if (ts->getop(ts, POLDEK_OP_FRESHEN))
6730 - n_array_sort_ex(pkgs, (tn_fn_cmp)pkg_cmp_name_evr_rev);
6731 - pkg = n_array_nth(pkgs, 0);
6732 - pkg_hand_mark(ts->pms, pkg);
6736 - n_array_sort_ex(pkgs, (tn_fn_cmp)pkg_cmp_name_evr_rev);
6737 - for (i=0; i < n_array_size(dbpkgs); i++) {
6738 - struct pkg *dbpkg = n_array_nth(dbpkgs, i);
6739 - int n = n_array_bsearch_idx_ex(pkgs, dbpkg,
6740 - (tn_fn_cmp)pkg_cmp_name);
6742 - DBGF("%s: %s\n", capname, pkg_id(dbpkg));
6747 - for (; n < n_array_size(pkgs); n++) {
6748 - struct pkg *pkg = n_array_nth(pkgs, n);
6749 - int cmprc, mark = 0;
6751 - DBGF("%s: %s cmp %s\n", capname, pkg_id(pkg),
6753 - if (pkg_cmp_name(pkg, dbpkg) != 0)
6756 - cmprc = pkg_cmp_name_evr(pkg, dbpkg);
6760 - else if (cmprc == 0 && poldek_ts_issetf(ts, POLDEK_TS_REINSTALL))
6763 - else if (cmprc < 0 && poldek_ts_issetf(ts, POLDEK_TS_DOWNGRADE))
6768 - msgn(1, _("%s: marked as %s's provider"), pkg_id(pkg),
6771 - pkg_hand_mark(ts->pms, pkg);
6774 - } else if (cmprc <= 0) {
6775 - char *eqs = cmprc == 0 ? "equal" : "newer";
6776 - msgn(1, _("%s: %s version of %s is installed (%s), skipped"),
6777 - capname, eqs, pkg_id(dbpkg),
6788 - n_array_free(dbpkgs);
6794 -int prepare_icaps(struct poldek_ts *ts)
6800 - icaps = arg_packages_get_resolved_caps(ts->aps);
6801 - keys = n_hash_keys_cp(icaps);
6802 - for (i=0; i < n_array_size(keys); i++) {
6803 - const char *cap = n_array_nth(keys, i);
6804 - tn_array *pkgs = n_hash_get(icaps, cap);
6805 - prepare_icap(ts, cap, pkgs);
6807 - n_array_free(keys);
6808 - n_hash_free(icaps);
6813 +/* use install/ in_prepare_icaps() */
6814 +extern int in_prepare_icaps(struct poldek_ts *ts);
6816 int do_poldek_ts_install(struct poldek_ts *ts, struct poldek_iinf *iinf)
6818 @@ -2421,7 +2359,9 @@
6820 n_assert(ts->type == POLDEK_TS_INSTALL);
6822 - prepare_icaps(ts);
6823 + if (in_prepare_icaps(ts) == -1) /* user abort */
6826 if (unmark_name_dups(ts->pms, ps->pkgs) == 0) {
6827 msgn(1, _("Nothing to do"));
6829 diff -urN poldek-0.20.org/pkgset-req.c poldek-0.20/pkgset-req.c
6830 --- poldek-0.20.org/pkgset-req.c 2005-10-20 19:27:27.000000000 +0200
6831 +++ poldek-0.20/pkgset-req.c 2006-07-26 20:25:54.219327250 +0200
6841 @@ -332,32 +332,25 @@
6845 - if (capreq_is_rpmlib(req)) {
6848 + if (capreq_is_rpmlib(req) && matched) {
6851 - for (i=0; i<*npkgs; i++) {
6852 - if (strcmp((*suspkgs)[i]->name, "rpm") != 0) {
6853 - logn(LOGERR, _("%s: provides rpmlib cap \"%s\""),
6854 - pkg_snprintf_s((*suspkgs)[i]), reqname);
6857 + for (i=0; i<*npkgs; i++) {
6858 + if (strcmp((*suspkgs)[i]->name, "rpm") != 0) {
6859 + logn(LOGERR, _("%s: provides rpmlib cap \"%s\""),
6860 + pkg_snprintf_s((*suspkgs)[i]), reqname);
6869 - if (pkgset_pmprovides(ps, req)) {
6871 - capreq_set_satisfied(req);
6872 - msg(4, " req %-35s --> PM_CAP\n", capreq_snprintf_s(req));
6876 - if (!matched && (ps->flags & (PSMODE_VERIFY | PSMODE_MKIDX))) {
6878 - logn(LOGWARN, "%s: not found (poldek needs to be linked with newer"
6879 - " rpmlib)\n", capreq_snprintf_s(req));
6882 + if (!matched && pkgset_pmprovides(ps, req)) {
6884 + capreq_set_satisfied(req);
6885 + msg(4, " req %-35s --> PM_CAP\n", capreq_snprintf_s(req));
6894 +/* find packages satisfies req and (optionally) best fitted to pkg */
6895 int psreq_find_match_packages(struct pkgset *ps,
6896 const struct pkg *pkg, struct capreq *req,
6897 struct pkg ***packages, int *npackages,
6902 - if (poldek_conf_MULTILIB) {
6903 + if (poldek_conf_MULTILIB && pkg) {
6904 struct pkg **tmp = alloca(sizeof(*tmp) * nsuspkgs);
6907 diff -urN poldek-0.20.org/pkgu.c poldek-0.20/pkgu.c
6908 --- poldek-0.20.org/pkgu.c 2005-10-18 20:01:34.000000000 +0200
6909 +++ poldek-0.20/pkgu.c 2006-07-26 20:25:54.219327250 +0200
6922 pkgu->vendor = cp_tag(pkgu->_na, h, RPMTAG_VENDOR);
6923 - pkgu->license = cp_tag(pkgu->_na, h, RPMTAG_COPYRIGHT);
6924 + pkgu->license = cp_tag(pkgu->_na, h, PM_RPMTAG_LICENSE);
6925 pkgu->url = cp_tag(pkgu->_na, h, RPMTAG_URL);
6926 pkgu->distro = cp_tag(pkgu->_na, h, RPMTAG_DISTRIBUTION);
6927 pkgu->buildhost = cp_tag(pkgu->_na, h, RPMTAG_BUILDHOST);
6929 headerAddEntry(hdr, RPMTAG_VENDOR, RPM_STRING_TYPE, pkgu->vendor, 1);
6932 - headerAddEntry(hdr, RPMTAG_COPYRIGHT, RPM_STRING_TYPE, pkgu->license, 1);
6933 + headerAddEntry(hdr, PM_RPMTAG_LICENSE, RPM_STRING_TYPE, pkgu->license, 1);
6936 headerAddEntry(hdr, RPMTAG_URL, RPM_STRING_TYPE, pkgu->url, 1);
6937 diff -urN poldek-0.20.org/pm/mod.h poldek-0.20/pm/mod.h
6938 --- poldek-0.20.org/pm/mod.h 2005-10-24 11:37:32.000000000 +0200
6939 +++ poldek-0.20/pm/mod.h 2006-07-26 20:25:54.227327750 +0200
6941 void *(*init)(void);
6942 void (*destroy)(void *modh);
6943 int (*configure)(void *modh, const char *key, void *val);
6944 + int (*conf_get)(void *modh, const char *key, char *value, int vsize);
6946 tn_array *(*pm_caps)(void *modh);
6947 char *(*dbpath)(void *modh, char *path, size_t size);
6948 diff -urN poldek-0.20.org/pm/pkgdb.c poldek-0.20/pm/pkgdb.c
6949 --- poldek-0.20.org/pm/pkgdb.c 2005-10-24 17:25:58.000000000 +0200
6950 +++ poldek-0.20/pm/pkgdb.c 2006-07-26 20:25:54.235328250 +0200
6961 tn_array *unistdbpkgs, unsigned ldflags)
6963 tn_array *dbpkgs = NULL;
6967 pkgdb_search(db, &dbpkgs, PMTAG_CAP, capreq_name(cap),
6968 unistdbpkgs, ldflags);
6970 diff -urN poldek-0.20.org/pm/pm.c poldek-0.20/pm/pm.c
6971 --- poldek-0.20.org/pm/pm.c 2005-05-15 17:48:46.000000000 +0200
6972 +++ poldek-0.20/pm/pm.c 2006-07-26 20:25:54.235328250 +0200
6981 #include <sys/param.h> /* for PATH_MAX */
6982 @@ -161,4 +161,13 @@
6986 +int pm_conf_get(struct pm_ctx *ctx, const char *key, char *val, int vsize)
6988 + if (ctx->mod->conf_get)
6989 + return ctx->mod->conf_get(ctx->modh, key, val, vsize);
6996 diff -urN poldek-0.20.org/pm/pm.h poldek-0.20/pm/pm.h
6997 --- poldek-0.20.org/pm/pm.h 2005-10-24 17:12:32.000000000 +0200
6998 +++ poldek-0.20/pm/pm.h 2006-07-26 20:25:54.235328250 +0200
7000 void pm_free(struct pm_ctx *ctx);
7002 int pm_configure(struct pm_ctx *ctx, const char *key, void *val);
7003 +int pm_conf_get(struct pm_ctx *ctx, const char *key, char *value, int vsize);
7005 const char *pm_get_name(struct pm_ctx *ctx);
7008 diff -urN poldek-0.20.org/pm/pset/mod.c poldek-0.20/pm/pset/mod.c
7009 --- poldek-0.20.org/pm/pset/mod.c 2005-10-24 11:49:07.000000000 +0200
7010 +++ poldek-0.20/pm/pset/mod.c 2006-07-26 20:25:54.243328750 +0200
7013 pm_pset_init, pm_pset_destroy,
7020 diff -urN poldek-0.20.org/pm/rpm/misc.c poldek-0.20/pm/rpm/misc.c
7021 --- poldek-0.20.org/pm/rpm/misc.c 2005-05-13 20:15:53.000000000 +0200
7022 +++ poldek-0.20/pm/rpm/misc.c 2006-07-26 20:25:54.247329000 +0200
7031 #ifdef HAVE_CONFIG_H
7035 #include <rpm/rpmlib.h>
7036 +#if HAVE_RPMDSRPMLIB
7037 +# include <rpm/rpmds.h>
7040 #include <trurl/nassert.h>
7041 #include <trurl/nstr.h>
7046 -tn_array *pm_rpm_rpmlib_caps(void)
7047 +#if HAVE_RPMDSRPMLIB /* rpmdsRpmlib() => rpm >= 4.4.3 */
7049 +static int extract_rpmds(tn_array *caps, rpmds ds)
7051 + ds = rpmdsInit(ds);
7052 + while (rpmdsNext(ds) >= 0) {
7053 + const char *name, *evr;
7054 + char tmp[256], *tmpptr;
7055 + struct capreq *cr;
7056 + uint32_t flags, crflags;
7058 + name = rpmdsN(ds);
7059 + evr = rpmdsEVR(ds);
7060 + flags = rpmdsFlags(ds);
7062 + if ((flags & RPMSENSE_EQUAL)) {
7063 + n_strncpy(tmp, evr, 128);
7067 + } else { /* cap without version */
7072 + cr = capreq_new_evr(name, tmpptr, crflags, 0);
7074 + msgn(3, " - %s", capreq_snprintf_s(cr));
7075 + n_array_push(caps, cr);
7078 + ds = rpmdsFree(ds);
7079 + return n_array_size(caps);
7082 +typedef int (*rpmcap_fn)(rpmds *ds, void *);
7084 +static int get_rpmlib_caps(tn_array *caps)
7088 + rpmcap_fn functions[] = {
7090 +#ifdef HAVE_RPMDSCPUINFO
7091 + (rpmcap_fn)rpmdsCpuinfo,
7093 +#ifdef HAVE_RPMDSGETCONF
7094 + (rpmcap_fn)rpmdsGetconf,
7096 +#ifdef HAVE_RPMDSSYSINFO
7097 + (rpmcap_fn)rpmdsSysinfo,
7099 +#ifdef HAVE_RPMDSUNAME
7100 + (rpmcap_fn)rpmdsUname,
7106 + msgn(3, "Loading internal capabilities");
7107 + while (functions[i]) {
7108 + functions[i++](&ds, NULL);
7111 + return extract_rpmds(caps, ds);
7114 +#endif /* HAVE_RPMDSRPMLIB */
7116 +#if HAVE_RPMGETRPMLIBPROVIDES /* rpmGetRpmlibProvides() => rpm < 4.4.3 */
7117 +static int get_rpmlib_caps_rpm_lt_4_4_3(tn_array *caps)
7119 char **names = NULL, **versions = NULL, *evr;
7120 int *flags = NULL, n = 0, i;
7123 -#if HAVE_RPMGETRPMLIBPROVIDES
7126 n = rpmGetRpmlibProvides((const char ***)&names, &flags, (const char ***)&versions);
7133 - caps = capreq_arr_new(0);
7138 for (i=0; i<n; i++) {
7141 @@ -62,19 +130,39 @@
7142 n_array_push(caps, cr);
7152 + n_cfree(&versions);
7159 +tn_array *pm_rpm_rpmlib_caps(void)
7164 + caps = capreq_arr_new(0);
7166 +#if HAVE_RPMDSRPMLIB /* rpm >= 4.4.3 */
7167 + rc = get_rpmlib_caps(caps);
7169 +# if HAVE_RPMGETRPMLIBPROVIDES
7170 + rc = get_rpmlib_caps_rpm_lt_4_4_3(caps);
7174 - n_array_sort(caps);
7176 + n_array_sort(caps);
7179 + n_array_free(caps);
7186 const char *pm_rpm_get_arch(void *pm_rpm)
7189 diff -urN poldek-0.20.org/pm/rpm/mod.c poldek-0.20/pm/rpm/mod.c
7190 --- poldek-0.20.org/pm/rpm/mod.c 2004-10-10 17:31:22.000000000 +0200
7191 +++ poldek-0.20/pm/rpm/mod.c 2006-07-26 20:25:54.255329500 +0200
7194 (void *(*)(void))pm_rpm_init, pm_rpm_destroy,
7196 - pm_rpm_rpmlib_caps,
7200 + pm_rpm_rpmlib_caps, /* XXX: TODO replace with pm_rpm_conf_get() */
7204 diff -urN poldek-0.20.org/pm/rpm/pm_rpm.h poldek-0.20/pm/rpm/pm_rpm.h
7205 --- poldek-0.20.org/pm/rpm/pm_rpm.h 2005-10-24 11:39:29.000000000 +0200
7206 +++ poldek-0.20/pm/rpm/pm_rpm.h 2006-07-26 20:25:54.255329500 +0200
7208 # include <rpm/rpmts.h>
7211 +/* RPMTAG_COPYRIGHT disappears in 4.4.3 but don't know from
7212 + when RPMTAG_LICENSE starts */
7213 +#ifdef RPMTAG_COPYRIGHT
7214 +# define PM_RPMTAG_LICENSE RPMTAG_COPYRIGHT
7216 +# define PM_RPMTAG_LICENSE RPMTAG_LICENSE
7219 #include <trurl/trurl.h>
7223 void *pm_rpm_init(void);
7224 void pm_rpm_destroy(void *pm_rpm);
7225 int pm_rpm_configure(void *modh, const char *key, void *val);
7226 +int pm_rpm_conf_get(void *pm_rpm, const char *key, char *value, int vsize);
7228 tn_array *pm_rpm_rpmlib_caps(void *pm_rpm);
7229 const char *pm_rpm_get_arch(void *pm_rpm);
7231 diff -urN poldek-0.20.org/pm/rpm/rpm.c poldek-0.20/pm/rpm/rpm.c
7232 --- poldek-0.20.org/pm/rpm/rpm.c 2005-10-08 02:05:46.000000000 +0200
7233 +++ poldek-0.20/pm/rpm/rpm.c 2006-07-26 20:25:54.263330000 +0200
7242 #ifdef HAVE_CONFIG_H
7243 @@ -146,6 +146,26 @@
7247 +int pm_rpm_conf_get(void *pm_rpm, const char *key, char *value, int vsize)
7253 + if (*key == '%') {
7254 + char *v = rpmExpand(key, NULL);
7259 + if (strlen(v)) /* rpmExpand returns empty strings */
7260 + n = n_snprintf(value, vsize, "%s", v);
7269 static int db_exists(void *pm_rpm, const char *rootdir, const char *dbpath)
7270 diff -urN poldek-0.20.org/po/POTFILES.in poldek-0.20/po/POTFILES.in
7271 --- poldek-0.20.org/po/POTFILES.in 2005-10-23 15:45:26.000000000 +0200
7272 +++ poldek-0.20/po/POTFILES.in 2006-07-26 20:25:54.263330000 +0200
7273 @@ -118,11 +118,9 @@
7276 vfile/test_progress.c
7285 diff -urN poldek-0.20.org/poldek_intern.h poldek-0.20/poldek_intern.h
7286 --- poldek-0.20.org/poldek_intern.h 2005-10-21 01:01:10.000000000 +0200
7287 +++ poldek-0.20/poldek_intern.h 2006-07-26 20:25:54.263330000 +0200
7289 unsigned ps_setup_flags;
7291 struct pm_ctx *pmctx;
7293 + int _rpm_tscolor; /* rpm transaction color */
7294 // tn_array *inst_pkgs; /* array of installed packages */
7295 // time_t ts_instpkgs; /* inst_pkgs timestamp */
7297 diff -urN poldek-0.20.org/poldek_ts.c poldek-0.20/poldek_ts.c
7298 --- poldek-0.20.org/poldek_ts.c 2005-10-26 16:41:05.000000000 +0200
7299 +++ poldek-0.20/poldek_ts.c 2006-07-26 20:25:54.271330500 +0200
7309 @@ -1036,6 +1036,7 @@
7311 if (rc && !ts->getop(ts, POLDEK_OP_RPMTEST))
7312 pkgdb_tx_commit(ts->db);
7317 diff -urN poldek-0.20.org/poldek_ts.h poldek-0.20/poldek_ts.h
7318 --- poldek-0.20.org/poldek_ts.h 2005-07-10 14:38:13.000000000 +0200
7319 +++ poldek-0.20/poldek_ts.h 2006-07-26 20:25:54.271330500 +0200
7323 #ifndef POLDEK_LIB_TX_H
7324 #define POLDEK_LIB_TX_H
7327 int (*getop_v)(const struct poldek_ts *, int op, ...);
7328 void (*setop)(struct poldek_ts *, int op, int onoff);
7330 - int uninstall_greedy_deep;
7332 + int uninstall_greedy_deep; /* greediness of uninstall, is set
7333 + by ts->setop(POLDEK_OP_GREEDY, v)
7337 struct poldek_ts *poldek_ts_new(struct poldek_ctx *ctx, unsigned flags);
7338 diff -urN poldek-0.20.org/poldek_util.h poldek-0.20/poldek_util.h
7339 --- poldek-0.20.org/poldek_util.h 2004-10-09 16:41:42.000000000 +0200
7340 +++ poldek-0.20/poldek_util.h 2006-07-26 20:25:54.279331000 +0200
7342 #ifndef POLDEK_UTIL_H
7344 +#include <trurl/nhash.h>
7346 const char *poldek_util_lc_lang(const char *category);
7347 int poldek_util_get_gmt_offs(void);
7348 int poldek_util_is_rwxdir(const char *path);
7350 const char *poldek_util_ngettext_n_packages_fmt(int n);
7352 int poldek_util_parse_bool(const char *v);
7354 +/* returns 0 - false, 1 - true, 2 - auto */
7355 +int poldek_util_parse_bool3(const char *v);
7358 +/* remove used variables from varh */
7359 +#define POLDEK_UTIL_EXPANDVARS_RMUSED (1 << 0)
7361 +/* expands "foo %{foo} bar */
7362 +const char *poldek_util_expand_vars(char *dest, int size, const char *src,
7363 + char varmark, tn_hash *varh,
7366 +const char *poldek_util_expand_env_vars(char *dest, int size, const char *str);
7369 diff -urN poldek-0.20.org/python/local_stdint.c poldek-0.20/python/local_stdint.c
7370 --- poldek-0.20.org/python/local_stdint.c 1970-01-01 01:00:00.000000000 +0100
7371 +++ poldek-0.20/python/local_stdint.c 2006-07-26 20:25:54.279331000 +0200
7373 +#define __extension__ /* prevent swig warning */
7374 +#include <stdint.h>
7375 diff -urN poldek-0.20.org/python/qrowser/mainWindow.ui poldek-0.20/python/qrowser/mainWindow.ui
7376 --- poldek-0.20.org/python/qrowser/mainWindow.ui 1970-01-01 01:00:00.000000000 +0100
7377 +++ poldek-0.20/python/qrowser/mainWindow.ui 2006-07-26 20:25:54.335334500 +0200
7379 +<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
7380 +<class>mainWindow</class>
7381 +<widget class="QMainWindow">
7382 + <property name="name">
7383 + <cstring>mainWindow</cstring>
7385 + <property name="geometry">
7389 + <width>761</width>
7390 + <height>764</height>
7393 + <property name="sizePolicy">
7395 + <hsizetype>5</hsizetype>
7396 + <vsizetype>5</vsizetype>
7397 + <horstretch>0</horstretch>
7398 + <verstretch>0</verstretch>
7401 + <property name="caption">
7402 + <string>poldek package browser (python module demo)</string>
7405 + <property name="name">
7406 + <cstring>unnamed</cstring>
7408 + <property name="margin">
7409 + <number>0</number>
7411 + <property name="spacing">
7412 + <number>0</number>
7414 + <widget class="QSplitter">
7415 + <property name="name">
7416 + <cstring>splitter10</cstring>
7418 + <property name="orientation">
7419 + <enum>Vertical</enum>
7421 + <widget class="QListView">
7423 + <property name="text">
7424 + <string>Name</string>
7426 + <property name="clickable">
7429 + <property name="resizable">
7434 + <property name="text">
7435 + <string>Version</string>
7437 + <property name="clickable">
7440 + <property name="resizable">
7445 + <property name="text">
7446 + <string>Size</string>
7448 + <property name="clickable">
7451 + <property name="resizable">
7455 + <property name="name">
7456 + <cstring>PackageListView</cstring>
7459 + <widget class="QTabWidget">
7460 + <property name="name">
7461 + <cstring>packageTab</cstring>
7463 + <property name="tabPosition">
7464 + <enum>Bottom</enum>
7466 + <property name="tabShape">
7467 + <enum>Rounded</enum>
7469 + <widget class="QWidget">
7470 + <property name="name">
7471 + <cstring>descr</cstring>
7473 + <attribute name="title">
7474 + <string>Description</string>
7477 + <property name="name">
7478 + <cstring>unnamed</cstring>
7480 + <property name="margin">
7481 + <number>0</number>
7483 + <property name="spacing">
7484 + <number>0</number>
7486 + <widget class="QTextBrowser">
7487 + <property name="name">
7488 + <cstring>DescriptionText</cstring>
7493 + <widget class="QWidget">
7494 + <property name="name">
7495 + <cstring>caps</cstring>
7497 + <attribute name="title">
7498 + <string>Provides</string>
7501 + <property name="name">
7502 + <cstring>unnamed</cstring>
7504 + <property name="margin">
7505 + <number>0</number>
7507 + <widget class="QListView">
7509 + <property name="text">
7510 + <string>Capability</string>
7512 + <property name="clickable">
7515 + <property name="resizable">
7519 + <property name="name">
7520 + <cstring>CapsListView</cstring>
7525 + <widget class="QWidget">
7526 + <property name="name">
7527 + <cstring>TabPage</cstring>
7529 + <attribute name="title">
7530 + <string>Requires</string>
7533 + <property name="name">
7534 + <cstring>unnamed</cstring>
7536 + <property name="margin">
7537 + <number>0</number>
7539 + <widget class="QListView">
7541 + <property name="text">
7542 + <string>Capability</string>
7544 + <property name="clickable">
7547 + <property name="resizable">
7552 + <property name="text">
7553 + <string>Type</string>
7555 + <property name="clickable">
7558 + <property name="resizable">
7562 + <property name="name">
7563 + <cstring>ReqsListView</cstring>
7568 + <widget class="QWidget">
7569 + <property name="name">
7570 + <cstring>TabPage</cstring>
7572 + <attribute name="title">
7573 + <string>Conflicts</string>
7576 + <property name="name">
7577 + <cstring>unnamed</cstring>
7579 + <property name="margin">
7580 + <number>0</number>
7582 + <widget class="QListView">
7584 + <property name="text">
7585 + <string>Capability</string>
7587 + <property name="clickable">
7590 + <property name="resizable">
7595 + <property name="text">
7596 + <string>Type</string>
7598 + <property name="clickable">
7601 + <property name="resizable">
7605 + <property name="name">
7606 + <cstring>CnflListView</cstring>
7611 + <widget class="QWidget">
7612 + <property name="name">
7613 + <cstring>files</cstring>
7615 + <attribute name="title">
7616 + <string>Files</string>
7619 + <property name="name">
7620 + <cstring>unnamed</cstring>
7622 + <property name="margin">
7623 + <number>0</number>
7625 + <property name="spacing">
7626 + <number>0</number>
7628 + <widget class="QListView">
7630 + <property name="text">
7631 + <string>Name</string>
7633 + <property name="clickable">
7636 + <property name="resizable">
7641 + <property name="text">
7642 + <string>Mode</string>
7644 + <property name="clickable">
7647 + <property name="resizable">
7652 + <property name="text">
7653 + <string>Size</string>
7655 + <property name="clickable">
7658 + <property name="resizable">
7662 + <property name="name">
7663 + <cstring>FileListView</cstring>
7673 + <property name="name">
7674 + <cstring>qt_dead_widget_MenuBar</cstring>
7676 + <property name="enabled">
7677 + <bool>false</bool>
7679 + <item text="&File" name="File">
7680 + <action name="fileNewAction"/>
7681 + <action name="fileOpenAction"/>
7682 + <action name="fileSaveAction"/>
7683 + <action name="fileSaveAsAction"/>
7685 + <action name="filePrintAction"/>
7687 + <action name="fileExitAction"/>
7689 + <item text="&Help" name="Help">
7690 + <action name="helpContentsAction"/>
7691 + <action name="helpIndexAction"/>
7693 + <action name="helpAboutAction"/>
7701 + <property name="name">
7702 + <cstring>fileNewAction</cstring>
7704 + <property name="iconSet">
7705 + <iconset>image0</iconset>
7707 + <property name="text">
7708 + <string>New</string>
7710 + <property name="menuText">
7711 + <string>&New</string>
7713 + <property name="accel">
7714 + <string>Ctrl+N</string>
7718 + <property name="name">
7719 + <cstring>fileOpenAction</cstring>
7721 + <property name="iconSet">
7722 + <iconset>image1</iconset>
7724 + <property name="text">
7725 + <string>Open</string>
7727 + <property name="menuText">
7728 + <string>&Open...</string>
7730 + <property name="accel">
7731 + <string>Ctrl+O</string>
7735 + <property name="name">
7736 + <cstring>fileSaveAction</cstring>
7738 + <property name="iconSet">
7739 + <iconset>image2</iconset>
7741 + <property name="text">
7742 + <string>Save</string>
7744 + <property name="menuText">
7745 + <string>&Save</string>
7747 + <property name="accel">
7748 + <string>Ctrl+S</string>
7752 + <property name="name">
7753 + <cstring>fileSaveAsAction</cstring>
7755 + <property name="text">
7756 + <string>Save As</string>
7758 + <property name="menuText">
7759 + <string>Save &As...</string>
7761 + <property name="accel">
7766 + <property name="name">
7767 + <cstring>filePrintAction</cstring>
7769 + <property name="iconSet">
7770 + <iconset>image3</iconset>
7772 + <property name="text">
7773 + <string>Print</string>
7775 + <property name="menuText">
7776 + <string>&Print...</string>
7778 + <property name="accel">
7779 + <string>Ctrl+P</string>
7783 + <property name="name">
7784 + <cstring>fileExitAction</cstring>
7786 + <property name="text">
7787 + <string>Exit</string>
7789 + <property name="menuText">
7790 + <string>E&xit</string>
7792 + <property name="accel">
7797 + <property name="name">
7798 + <cstring>helpContentsAction</cstring>
7800 + <property name="text">
7801 + <string>Contents</string>
7803 + <property name="menuText">
7804 + <string>&Contents...</string>
7806 + <property name="accel">
7811 + <property name="name">
7812 + <cstring>helpIndexAction</cstring>
7814 + <property name="text">
7815 + <string>Index</string>
7817 + <property name="menuText">
7818 + <string>&Index...</string>
7820 + <property name="accel">
7825 + <property name="name">
7826 + <cstring>helpAboutAction</cstring>
7828 + <property name="text">
7829 + <string>About</string>
7831 + <property name="menuText">
7832 + <string>&About</string>
7834 + <property name="accel">
7839 + <property name="name">
7840 + <cstring>Action</cstring>
7842 + <property name="text">
7843 + <string>Unnamed</string>
7848 + <image name="image0">
7849 + <data format="PNG" length="173">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000007449444154789cedd5c109c0200c05d06fe936812c10b2ffdd85d25385b6a991480f053f081af0291210f828c5a9d9c4de96cd2b9ad9eb0000660e2fe0c2519839c4f70c4c446d5e6b3538cf928245e4b2f6f014acaa8fda1d4fc1a5741b22079f9d111d96ea8a912c78c10bee64e60719f57e9203ad452a040318f5f70000000049454e44ae426082</data>
7851 + <image name="image1">
7852 + <data format="PNG" length="210">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000009949444154789ced94410e85200c445f89c7367f61bc775d2848a42860ffced9548bbe8e13043e1d928177f481a123dc2b34f6f47a3de2b865a8843f4001982a0b3d5f62c58300aa1ad70550449ab9d507a773a8a4ba4f92a2df333c64c63bebbd82e5b8addecbcc7820eb4266c639745dfa80f36faf66c66fa19c3f882fb470ec05cdc0bed07893f68e171492635f686c3eeff6ba3c8fdd366dc4c0452cf153a9590000000049454e44ae426082</data>
7854 + <image name="image2">
7855 + <data format="PNG" length="217">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000a049444154789cd5954d0a802010859fd14668e18de662d222bc98376a21b4ac451992c66469e0b7f187f1f11c47052a218e762daddbfb9e99f6568f80b5364b8588ce35440400e80a398ce8f99034d2292cc37c8ebd530feb583a05e954341f8a027b2a7d3a1f09bf854dc5d5d953aa396e4f38cab199e2d2e108abe156f82e30977fcb4d8ff942d75dbebed2e143953a93f6caad3d6111f44b7d4f820ff9c0069bb51ecd122066740000000049454e44ae426082</data>
7857 + <image name="image3">
7858 + <data format="PNG" length="725">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000029c49444154789c8d95ad76db4010853ff718cc3289d950d06136344c98c362964087256f503f426161021be6b2842550612e8be14299496c866dc14ab2fc77da2192665777eedc3b5af53813afafaf414448d3742f6f6600a82a005555912409575757bdeebefe396011613299b440876b4d946589f7fe68cf596080cd6673047658485571cefd3ff02900333b2a70aa23806fa792799e07336b9938e770ceede9dde82f2247fa9e65acaa244942599688486b54374eb5ff4fc6105b3c9c882e6853ec9c142719376c4e31ede655756f42ba71a40dc06ab50a5996311c0ecf8237467e7e7e022092309f5fb7787b8cdfdfdf83f79efc2347668288b40087d786695994e479ceb6daf2f0f01066b319d7d7d7bd5e1774b3f154c5163580d34c019ca408020e7ce159afffb0dd16a81a1717198bc5224ad130bd9c5ee2d2145503538e6c3103849c4f3e78656a53d2af94e79767fc57fcfad4946c7411419f9e7e85b228c3ffc457f80aa3300a12248cc228acd7ebf0e3fbcf301e8fc360908524494236c842bfda56dcdddd9c75f73052522e999223cc98311e8f4964486905cfbf5ea8aa8a7490d237c0fb22cea31988106b48ed36385c54dc14c4f160dfb9c133b4217fd88019e97018d76b77fa6551e045a29e66b4be39882ed69d38031520e604f0b6c5886788df6c5a4f1cf5b835096b00b17628148b35746f673b39d278da0945e9236065e705adc976371a200a76b8e2302ba9fb6c7a633299f20debb06cc96a7cb4faba07ea9a6d35680d58cb39180c582cee2263ef7d631588412540159d338b30d2b0b21d183bcd31430496cb25f3f9bcd7cfb28c8fb70f7ebfbda16ac4f347d81b3ee93ccb0eb2edb39ea6e572c9e3e3630f3a87d06ab50aabd51bdbfaffa5686dcace99dd5f0354cb785f1993e984dbdb5beeefef5bbcbfd1f69e0c0f8448030000000049454e44ae426082</data>
7863 + <sender>fileNewAction</sender>
7864 + <signal>activated()</signal>
7865 + <receiver>mainWindow</receiver>
7866 + <slot>fileNew()</slot>
7869 + <sender>fileOpenAction</sender>
7870 + <signal>activated()</signal>
7871 + <receiver>mainWindow</receiver>
7872 + <slot>fileOpen()</slot>
7875 + <sender>fileSaveAction</sender>
7876 + <signal>activated()</signal>
7877 + <receiver>mainWindow</receiver>
7878 + <slot>fileSave()</slot>
7881 + <sender>fileSaveAsAction</sender>
7882 + <signal>activated()</signal>
7883 + <receiver>mainWindow</receiver>
7884 + <slot>fileSaveAs()</slot>
7887 + <sender>filePrintAction</sender>
7888 + <signal>activated()</signal>
7889 + <receiver>mainWindow</receiver>
7890 + <slot>filePrint()</slot>
7893 + <sender>fileExitAction</sender>
7894 + <signal>activated()</signal>
7895 + <receiver>mainWindow</receiver>
7896 + <slot>fileExit()</slot>
7899 + <sender>helpIndexAction</sender>
7900 + <signal>activated()</signal>
7901 + <receiver>mainWindow</receiver>
7902 + <slot>helpIndex()</slot>
7905 + <sender>helpContentsAction</sender>
7906 + <signal>activated()</signal>
7907 + <receiver>mainWindow</receiver>
7908 + <slot>helpContents()</slot>
7911 + <sender>helpAboutAction</sender>
7912 + <signal>activated()</signal>
7913 + <receiver>mainWindow</receiver>
7914 + <slot>helpAbout()</slot>
7918 + <tabstop>PackageListView</tabstop>
7919 + <tabstop>packageTab</tabstop>
7920 + <tabstop>DescriptionText</tabstop>
7923 + <slot>fileNew()</slot>
7924 + <slot>fileOpen()</slot>
7925 + <slot>fileSave()</slot>
7926 + <slot>fileSaveAs()</slot>
7927 + <slot>filePrint()</slot>
7928 + <slot>fileExit()</slot>
7929 + <slot>helpIndex()</slot>
7930 + <slot>helpContents()</slot>
7931 + <slot>helpAbout()</slot>
7933 +<layoutdefaults spacing="6" margin="11"/>
7935 diff -urN poldek-0.20.org/python/qrowser/qrowser.py poldek-0.20/python/qrowser/qrowser.py
7936 --- poldek-0.20.org/python/qrowser/qrowser.py 1970-01-01 01:00:00.000000000 +0100
7937 +++ poldek-0.20/python/qrowser/qrowser.py 2006-07-26 20:25:54.335334500 +0200
7940 +# Package browser app to try and train poldek python module
7944 +from optparse import OptionParser
7949 +from mainWindow import mainWindow
7951 +class MainWindow(mainWindow):
7952 + def fillPackageList(self, list):
7954 + evr = "%s-%s" % (p.ver, p.rel)
7955 + item = qt.QListViewItem(self.PackageListView, p.name, evr, "%ldK" % (p.size / 1024))
7956 + item.__package = p
7958 + self.connect( self.PackageListView, qt.SIGNAL("selectionChanged(QListViewItem *)"),
7959 + self.selectedSlot)
7961 + def selectedSlot(self, item, *args, **kw):
7962 + #print "package ", item.__package
7963 + qt.QApplication.setOverrideCursor(qt.QCursor(qt.QApplication.WaitCursor))
7965 + self.showPackageDescription(item.__package)
7966 + self.showPackageCaps(item.__package)
7967 + self.showPackageFiles(item.__package)
7969 + qt.QApplication.restoreOverrideCursor()
7972 + def showPackageFiles(self, pkg):
7973 + self.FileListView.clear()
7975 + it = pkg.get_flist_it()
7977 + fi = it.get_tuple()
7979 + item = qt.QListViewItem(self.FileListView, fi[0], "%o" % fi[2], "%i" % fi[1])
7980 + fi = it.get_tuple()
7982 + def showPackageCaps(self, pkg):
7983 + self.CapsListView.clear()
7984 + self.ReqsListView.clear()
7985 + self.CnflListView.clear()
7988 + caps = pkg.provides()
7991 + item = qt.QListViewItem(self.CapsListView, str(c))
7993 + caps = pkg.requires()
7999 + if c.is_prereq_un():
8000 + if len(type): type += ', '
8003 + item = qt.QListViewItem(self.ReqsListView, str(c), type)
8005 + caps = pkg.conflicts()
8008 + type = 'conflict';
8012 + item = qt.QListViewItem(self.CnflListView, str(c), type)
8015 + def showPackageDescription(self, pkg):
8020 + dsc += "<table><tr><td><b>Package: </b></td><td>";
8022 + dsc += "</td></tr><tr><td><b>Summary: </b></td><td>";
8023 + dsc += inf.get(inf.SUMMARY)
8025 + dsc += "</td></tr><tr><td><b>License: </b></td><td>";
8026 + dsc += inf.get(inf.LICENSE)
8028 + if inf.get(inf.URL):
8029 + dsc += "</td></tr><tr><td><b>URL: </b></td><td>";
8030 + dsc += '<a href="%s">%s</a>' % (inf.get(inf.URL), inf.get(inf.URL))
8032 + dsc += "</td></tr></table>";
8033 + dsc += inf.get(inf.DESCRIPTION)
8034 + self.DescriptionText.setText(dsc);
8038 + parser = OptionParser()
8039 + parser.add_option("-n", "--sn", dest="source")
8040 + (options, args) = parser.parse_args()
8044 +locale.setlocale(locale.LC_ALL, '')
8045 +options = get_options()
8046 +if not options.source:
8047 + print "no source specified"
8052 +ctx = poldek.poldek_ctx()
8053 +#poldek_set_verbose(1)
8054 +src = poldek.source(options.source)
8055 +ctx.configure(ctx.CONF_SOURCE, src)
8057 +if not ctx.setup():
8058 + print "poldek setup failed"
8061 +print "Loading packages..."
8062 +arr = ctx.get_avail_packages()
8063 +print "Loaded %d packages" % len(arr)
8067 +a = qt.QApplication(sys.argv)
8070 +w.setGeometry(100, 100, 900, 700)
8073 +w.fillPackageList(arr)
8075 +sys.exit(a.exec_loop())
8076 diff -urN poldek-0.20.org/python/qrowser/qrowser.sh poldek-0.20/python/qrowser/qrowser.sh
8077 --- poldek-0.20.org/python/qrowser/qrowser.sh 1970-01-01 01:00:00.000000000 +0100
8078 +++ poldek-0.20/python/qrowser/qrowser.sh 2006-07-26 20:25:54.335334500 +0200
8082 +PYTHONPATH=../:../.libs python qrowser.py $@
8083 diff -urN poldek-0.20.org/python/run.sh poldek-0.20/python/run.sh
8084 --- poldek-0.20.org/python/run.sh 1970-01-01 01:00:00.000000000 +0100
8085 +++ poldek-0.20/python/run.sh 2006-07-26 20:25:54.335334500 +0200
8089 +PYTHONPATH=.libs python $@
8090 diff -urN poldek-0.20.org/python/test.py poldek-0.20/python/test.py
8091 --- poldek-0.20.org/python/test.py 1970-01-01 01:00:00.000000000 +0100
8092 +++ poldek-0.20/python/test.py 2006-07-26 20:25:54.335334500 +0200
8099 +from types import *
8102 +def test_pkguinf(ctx):
8103 + arr = ctx.get_avail_packages()
8104 + print "Loaded %d packages" % len(arr)
8110 + print "Package: ", pkg
8111 + print "Summary: ", inf.get(inf.SUMMARY)
8112 + print "License: ", inf.get(inf.LICENSE)
8113 + print "URL: ", inf.get(inf.URL)
8114 + print "Description:\n", inf.get(inf.DESCRIPTION)
8116 + it = pkg.get_flist_it()
8117 + f = it.get_tuple()
8120 + f = it.get_tuple()
8123 +def test_avail(ctx):
8124 + arr = ctx.get_avail_packages()
8125 + print "Loaded %d packages" % len(arr)
8132 +def test_search(ctx):
8133 + arr = ctx.get_avail_packages()
8134 + print "Found %d package(s)" % len(arr)
8140 +def test_install(ctx):
8141 + ts = ctx.ts_new(poldek.poldek_ts.INSTALL | poldek.poldek_ts.UPGRADE)
8142 + ts.add_pkgmask("python")
8143 + ts.add_pkgmask("swig")
8144 + ts.setop(ts.OP_TEST, True)
8149 +def test_cli_ls(cctx):
8150 + cmd = cctx.rcmd_new(None)
8151 + if cmd.execline("ls poldek*"):
8152 + pkgs = cmd.get_packages()
8158 + caps = p.requires()
8161 + print " R: %s" % cap
8165 + print cmd.get_str()
8169 +ctx = poldek.poldek_ctx()
8170 +#poldek_set_verbose(1)
8171 +src = poldek.source('ac-test')
8172 +ctx.configure(ctx.CONF_SOURCE, src)
8174 +if not ctx.setup():
8175 + raise Exception, "error"
8178 +cctx = poldek.poclidek_ctx(ctx);
8179 +cctx.load_packages(cctx.LOAD_ALL)
8184 +#test_cli_ls(poldctx)
8185 +#arr = poldctx.get_avail_packages()
8189 +ctx = poldek.poldek_ctx()
8190 +#poldek_set_verbose(1)
8191 +src = poldek.source('tt2')
8192 +ctx.configure(ctx.CONF_SOURCE, poldek.source('tt2'))
8202 diff -urN poldek-0.20.org/README poldek-0.20/README
8203 --- poldek-0.20.org/README 2002-04-03 17:43:39.000000000 +0200
8204 +++ poldek-0.20/README 2006-07-26 20:25:54.335334500 +0200
8209 -See man page for user documentation.
8210 +See man and info pages for user documentation.
8212 Project homepage: <http://team.pld.org.pl/~mis/poldek/>.
8215 mail to <poldek-subscribe@pld-linux.org>
8218 -Copyright (C) 2000 - 2002 Pawel A. Gajda
8219 +Copyright (C) 2000 - 2002 Pawel A. Gajda <mis @ pld.org.pl>
8220 The poldek is free software; you can redistribute it and/or modify
8221 it under the terms of the GNU General Public License, version 2 as
8222 published by the Free Software Foundation (see file COPYING for details).
8223 diff -urN poldek-0.20.org/README.package-sets poldek-0.20/README.package-sets
8224 --- poldek-0.20.org/README.package-sets 1970-01-01 01:00:00.000000000 +0100
8225 +++ poldek-0.20/README.package-sets 2006-07-26 20:25:54.335334500 +0200
8229 +Syntax of package set file.
8231 +Each package is specified in one line:
8233 +[!]NAME [EVR] | @VIRTUAL [DEFAULT_NAME [DEFAULT_EVR]]
8235 +'~' ('~' obsolets '!') before means that poldek in interactive mode
8236 +will ask user before install it, in batch mode package will not be
8239 +'@' specifies virtual package, like '~', in interactive mode poldek
8240 +will ask user which one of available packages he want to install,
8241 +otherwise, in batch mode the default package will be selected.
8243 +Hashed lines are treated as comments.
8250 +@bootloader lilo 2.1
8254 +After every modification set should be verified by:
8255 +$ poldek -s YOUR_SOURCE -V --pkgset=PKGSETFILE
8256 diff -urN poldek-0.20.org/scparchive.sh poldek-0.20/scparchive.sh
8257 --- poldek-0.20.org/scparchive.sh 1970-01-01 01:00:00.000000000 +0100
8258 +++ poldek-0.20/scparchive.sh 2006-07-26 20:25:54.335334500 +0200
8263 +ROOTDIR="public_html/poldek"
8264 +HOST="team.pld.org.pl"
8266 +if [ -z "$1" -o -z "$2" ]; then
8267 + echo "usage: $(basename $0) [FILE...] (${ROOTDIR}/)DESTDIR"
8272 +while test $# -gt 1 ; do
8280 +DESTDIR="${ROOTDIR}/$DEST"
8282 +scp -p $FILES "${HOST}:${DESTDIR}" && \
8284 +"(cd $DESTDIR && find . -type f | xargs md5sum > md5sums && \
8285 + \$HOME/mkindexpage.pl *.* > index.html && find . -type f | xargs chmod 644 && ls -l)"
8286 diff -urN poldek-0.20.org/swigs.h poldek-0.20/swigs.h
8287 --- poldek-0.20.org/swigs.h 1970-01-01 01:00:00.000000000 +0100
8288 +++ poldek-0.20/swigs.h 2006-07-26 20:25:54.335334500 +0200
8290 +#ifndef SWIGMACRO_H
8291 +#define SWIGMACRO_H
8294 +# define STINLINE static inline
8295 +# define STINLINE_END
8296 +# define SWIG_immutable %immutable;
8297 +# define SWIG_mutable %mutable;
8301 +# define STINLINE %inline %{
8302 +# define STINLINE_END %}
8303 +# define SWIG_immutable
8304 +# define SWIG_mutable
8309 diff -urN poldek-0.20.org/test_patch.sh poldek-0.20/test_patch.sh
8310 --- poldek-0.20.org/test_patch.sh 1970-01-01 01:00:00.000000000 +0100
8311 +++ poldek-0.20/test_patch.sh 2006-07-26 20:25:54.335334500 +0200
8316 +export POLDEK_TESTING
8318 +while [ $# -gt 0 ]; do
8321 + shift; ST=$1; shift ;;
8324 + shift; DISTDIR="$1"; shift;;
8327 + shift; SRCDIR="$1"; shift;;
8330 + shift; SRCURL="$1"; shift;;
8333 + shift; POLDEK="$1"; shift;;
8336 + shift; POLDEKUP="$1"; shift;;
8341 +if [ -z "$DISTDIR" -o -z "$SRCDIR" -o -z "$SRCURL" ]; then
8342 + echo "usage $(basename $0): -t INDEXTYPE --distdir DISTDIR --sdir $SRCDIR --surl $SRCURL"
8346 +TMPDIR=${TMPDIR:-"/tmp"}
8347 +POLDEK=${POLDEK:-"poldek"}
8348 +POLDEKUP=${POLDEKUP:-"poldek"}
8350 +echo "$POLDEK, $POLDEKUP"
8353 +if $POLDEK --noconf --version | grep -q 0.18; then
8358 +if $POLDEKUP --noconf --version | grep -q 0.18; then
8365 + if [ -n "$POLDEK018" ]; then
8366 + $POLDEK --noconf -s $SRCDIR --mkidxz
8368 + $POLDEK --noconf -s $SRCDIR --mkidx --mt $ST
8374 + if [ -n "$POLDEKUP018" ]; then
8375 + $POLDEKUP --noconf -s $SRCURL --up
8377 + $POLDEKUP --noconf --st $ST -s $SRCURL --up -Oautoupa=n
8384 + up_skip=$(perl -e 'print int(rand(2))');
8385 + toadd=$(perl -e 'print chr(65 + rand(50))');
8386 + torm=$(perl -e 'print chr(65 + rand(50))');
8387 + while [ "$toadd" == "$torm" ]; do
8388 + torm=$(perl -e 'print chr(65 + rand(56))');
8391 + echo "ADD $toadd, REMOVE $torm";
8395 + for i in $SRCDIR/${torm}*.rpm; do
8396 + bn=$(basename $i);
8398 + if [ ! -f $i ]; then
8402 + nremoved=$(expr $nremoved + 1)
8407 + for i in $DISTDIR/${toadd}*.rpm; do
8408 + bn=$(basename $i);
8410 + if [ ! -f $i ]; then
8414 + if [ -f $SRCDIR/$bn ]; then
8417 + nadded=$(expr $n + 1)
8419 + ln -sf $i $SRCDIR/$bn
8422 + if [ "$nadded" = "0" -a "$nremoved" = "0" ]; then
8426 + echo -e "\n**** MAKE ****\n"
8427 + echo "Added $nadded and $nremoved removed"
8430 + if [ $? -ne 0 ]; then
8431 + echo "MKIDX ERRROR"
8436 + if [ ${up_skip} = "0" ]; then
8437 + echo -e "\n**** UP ****\n"
8440 + if [ $? -ne 0 ]; then
8447 +rm -f $SRCDIR/packages.$ST.*
8448 +rm -f $SRCDIR/packages.i/packages.$ST.*
8449 +create_index || exit 1
8451 +if [ -n "$POLDEKUP018" ]; then
8452 + $POLDEKUP --noconf -s $SRCURL --upa
8454 + $POLDEKUP --noconf --st $ST -s $SRCURL --upa -Oautoupa=n
8457 +for n in $(seq 1 22000); do
8462 diff -urN poldek-0.20.org/tests/build-test-rpm.sh poldek-0.20/tests/build-test-rpm.sh
8463 --- poldek-0.20.org/tests/build-test-rpm.sh 1970-01-01 01:00:00.000000000 +0100
8464 +++ poldek-0.20/tests/build-test-rpm.sh 2006-07-26 20:25:54.339334750 +0200
8468 +# Script for quick build fake foo-packages
8478 + echo "Usage $0 -n NAME -v VERSION-[RELEASE [-p PROVIDES] [-r REQUIRES] [-f file] "
8482 +while test $# -gt 0 ; do
8485 + shift; name="${1}"; shift ;;
8488 + shift; version="${1}"; shift ;;
8491 + shift; provides="$provides ${1},"; shift ;;
8494 + shift; requires="$requires ${1},"; shift ;;
8497 + shift; files="$files ${1} "; shift ;;
8500 + echo "unknown option ${1}"; exit 1;
8504 +[ -n "$name" -a -n "$version" ] || usage_and_exit;
8506 +if echo $version | grep -q '-'; then
8507 + release=$(echo $version | cut -f 2 -d -)
8508 + version=$(echo $version | cut -f 1 -d -)
8509 + [ -n "$version" -a -n "$release" ] || exit 1;
8512 +SPEC="/tmp/$name.spec"
8514 +echo "Building $name $version-$release"
8515 +echo "Name: $name" >> $SPEC
8516 +echo "Version: $version" >> $SPEC
8517 +echo "Release: $release" >> $SPEC
8518 +echo "Summary: $name" >> $SPEC
8519 +echo "Group: System" >> $SPEC
8520 +echo "License: foo" >> $SPEC
8521 +echo "BuildArch: noarch" >> $SPEC
8522 +echo "BuildRoot: /tmp/%{name}-%{version}-root-%(id -u -n)" >> $SPEC
8523 +[ -n "$provides" ] && echo "Provides: $provides" >> $SPEC
8524 +[ -n "$requires" ] && echo "Requires: $requires" >> $SPEC
8526 +echo -e "%description\n$name" >> $SPEC
8527 +echo -e "%prep\n%pre\n" >> $SPEC
8529 +if [ -n "$files" ]; then
8530 + echo "%install" >> $SPEC
8531 + for f in $files; do
8533 + echo "mkdir -p \$RPM_BUILD_ROOT/$dn" >> $SPEC
8534 + echo "touch \$RPM_BUILD_ROOT/$f" >> $SPEC
8538 +echo -e "%files\n%defattr(644,root,root,755)" >> $SPEC
8539 +if [ -n "$files" ]; then
8540 + for f in $files; do
8542 + echo "%dir $dn" >> $SPEC
8543 + echo "$f" >> $SPEC
8547 +echo -e "%clean\nrm -rf \$RPM_BUILD_ROOT" >> $SPEC
8549 diff -urN poldek-0.20.org/tests/httpd.py poldek-0.20/tests/httpd.py
8550 --- poldek-0.20.org/tests/httpd.py 1970-01-01 01:00:00.000000000 +0100
8551 +++ poldek-0.20/tests/httpd.py 2006-07-26 20:25:54.339334750 +0200
8555 +import SimpleHTTPServer
8556 +import SocketServer
8560 +Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
8561 +httpd = SocketServer.TCPServer(("127.0.0.1", PORT), Handler)
8563 +print "serving at port", PORT
8564 +httpd.serve_forever()
8565 diff -urN poldek-0.20.org/tests/Makefile.am poldek-0.20/tests/Makefile.am
8566 --- poldek-0.20.org/tests/Makefile.am 2005-10-27 00:52:42.000000000 +0200
8567 +++ poldek-0.20/tests/Makefile.am 2006-07-26 20:25:54.339334750 +0200
8570 noinst_PROGRAMS = test_poldek
8571 test_poldek_SOURCES = test_poldek.c test_match.c test_env.c \
8572 - test_pmdb.c test_op.c
8573 + test_pmdb.c test_op.c test_config.c
8575 EXTRA_DIST = utest_mkidx.sh
8577 test_poldek_INCLUDES= @CHECK_CFLAGS@
8578 test_poldek_LDADD = @CHECK_LIBS@ ../libpoldek_allsym.la ../vfile/libvfile.la
8580 +poldek_test_conf.conf: ../doc/conf-xml2testconf.xsl ../doc/poldek.conf.xml
8581 + xsltproc ../doc/conf-xml2testconf.xsl ../doc/poldek.conf.xml > poldek_test_conf.conf
8584 - -rm -f core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa*
8585 + -rm -f *.tmp core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa*
8588 +runtests: poldek_test_conf.conf
8590 + @echo; echo "Running *.sh tests"; \
8592 + for i in utest_*.sh; do \
8593 + [ -f $$i ] || continue; \
8594 + n=$$(expr $$n + 1); \
8595 + echo " running $$i"; \
8597 + if [ $$? -ne 0 ]; then \
8598 + nfails=$$(expr $$nfails + 1); \
8599 + echo " $$i FAILED"; \
8601 + echo " $$i PASSED"; \
8604 + echo "====================================="; \
8605 + echo "$$n tests passed / $$nfails failed"; \
8606 + echo "====================================="
8608 diff -urN poldek-0.20.org/tests/repo/foo.spec poldek-0.20/tests/repo/foo.spec
8609 --- poldek-0.20.org/tests/repo/foo.spec 1970-01-01 01:00:00.000000000 +0100
8610 +++ poldek-0.20/tests/repo/foo.spec 2006-07-26 20:25:54.339334750 +0200
8612 +# $Revision$, $Date$
8619 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
8620 +Requires: foo-lib = %{version}
8636 +%defattr(644,root,root,755)
8639 +%defattr(644,root,root,755)
8642 +rm -rf $RPM_BUILD_ROOT
8644 +%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
8649 +Revision 1.1 2005/10/26 22:43:24 mis
8652 diff -urN poldek-0.20.org/tests/repo/poldek.conf poldek-0.20/tests/repo/poldek.conf
8653 --- poldek-0.20.org/tests/repo/poldek.conf 1970-01-01 01:00:00.000000000 +0100
8654 +++ poldek-0.20/tests/repo/poldek.conf 2006-07-26 20:25:54.339334750 +0200
8668 diff -urN poldek-0.20.org/tests/test_config.c poldek-0.20/tests/test_config.c
8669 --- poldek-0.20.org/tests/test_config.c 1970-01-01 01:00:00.000000000 +0100
8670 +++ poldek-0.20/tests/test_config.c 2006-07-26 20:25:54.339334750 +0200
8673 +#include "conf_intern.h"
8675 +#include <trurl/nhash.h>
8677 +const char *expand_env_var(const char *v)
8679 + char tmp[PATH_MAX];
8682 + s = poldek_util_expand_env_vars(tmp, sizeof(tmp), v);
8683 + fail_if(s == NULL);
8684 + return n_strdup(s);
8688 +START_TEST (test_config) {
8689 + struct poldek_conf_tag *tags = NULL;
8693 + cnf = poldek_conf_load("poldek_test_conf.conf", 0);
8694 + fail_if(cnf == NULL, "load config failed");
8696 + s = poldek_conf_get_section_ht(cnf, "global");
8697 + fail_if(s == NULL, "no global section?");
8700 + while (poldek_conf_sections[i].name) {
8701 + const char *sname = poldek_conf_sections[i].name;
8702 + tags = poldek_conf_sections[i++].tags;
8704 + s = poldek_conf_get_section_ht(cnf, sname);
8705 + fail_if(s == NULL, "no %s section?", s);
8708 + while (tags[j].name) {
8709 + struct poldek_conf_tag *t = &tags[j++];
8710 + const char *dv, *v;
8712 + if (strchr(t->name, '*')) /* legacy source?* and prefix*? */
8715 + if (t->flags & CONF_TYPE_F_ALIAS)
8718 + v = poldek_conf_get(s, t->name, NULL);
8719 + fail_if(v == NULL, "%s: %s: missing?", sname, t->name);
8723 + if (t->defaultv == NULL) { /* the xsl sets it to op name */
8725 + p = n_strdup(t->name);
8728 + if (*p == ' ') *p = '_';
8731 + DBGF("\n%s: %s %s\n", t->name, dv, v);
8734 + if (t->flags & CONF_TYPE_BOOLEAN) { /* reverse value, see xsl */
8735 + if (n_str_eq(dv, "yes"))
8741 + if (t->flags & CONF_TYPE_F_ENV) {
8742 + fail_ifnot(t->flags & CONF_TYPE_STRING);
8743 + dv = expand_env_var(dv);
8746 + fail_if(n_str_ne(dv, v), "%s: %s: %s != %s",
8747 + sname, t->name, v, dv);
8754 +static char *values_list[] = { "foo", "bar", "baz", NULL };
8756 +static char *make_conf_line(const char *opname, int no, int sep)
8761 + n = n_snprintf(line, sizeof(line), "%s = ", opname);
8762 + while (values_list[i]) {
8764 + n_snprintf(buf, sizeof(buf), "%s%d", values_list[i], no);
8765 + n += n_snprintf(&line[n], sizeof(line) - n,
8766 + "%s %c", buf, sep);
8769 + line[n - 1] = '\0'; /* remove last sep */
8770 + return n_strdup(line);
8773 +static int verify_list(tn_array *list, int maxno, const char *op)
8775 + tn_hash *dict = n_hash_new(64, NULL);
8778 + fail_if(n_array_size(list) != 3 * maxno,
8779 + "%s: have %d, expected %d - some values lost",
8780 + op, n_array_size(list), 3 * maxno);
8782 + for (no = maxno - 1; no >= 0; no--) { /* from max to 0, to test
8784 + (test_config_lists_excl) */
8786 + while (values_list[i]) {
8788 + n_snprintf(buf, sizeof(buf), "%s%d", values_list[i], no);
8789 + n_hash_insert(dict, buf, NULL);
8794 + while (n_array_size(list) > 0) {
8795 + const char *op = n_array_pop(list);
8796 + fail_ifnot(n_hash_exists(dict, op), "missing list element %s", op);
8801 +void make_conf_file(const char *name, tn_array *lines)
8806 + f = fopen(name, "w");
8807 + fail_if(f == NULL, "file open failed");
8808 + for (i=0; i<n_array_size(lines); i++)
8809 + fprintf(f, "%s\n", n_array_nth(lines, i));
8815 +START_TEST (test_config_lists) {
8816 + char *list_ops[] = { "hold", "ignore", "noproxy", "exclude_path", NULL };
8817 + char maxno_ops[] = { 0, 0, 0, 0, 0 };
8819 + tn_array *lines, *list;
8823 + lines = n_array_new(16, 0, 0);
8826 + while (list_ops[i]) {
8828 + n_array_push(lines, make_conf_line(list_ops[i], maxno++, ' '));
8829 + n_array_push(lines, make_conf_line(list_ops[i], maxno++, ','));
8830 + n_array_push(lines, make_conf_line(list_ops[i], maxno++, '\t'));
8831 + if (n_str_eq(list_ops[i], "exclude_path"))
8832 + n_array_push(lines, make_conf_line(list_ops[i], maxno++, ':'));
8833 + if (n_str_eq(list_ops[i], "hold"))
8834 + n_array_push(lines, make_conf_line("a hold alias for testing purposes",
8836 + maxno_ops[i] = maxno;
8839 + make_conf_file("poldek_test_conf.tmp", lines);
8840 + cnf = poldek_conf_load("poldek_test_conf.tmp", 0);
8841 + fail_if(cnf == NULL, "load config failed");
8843 + s = poldek_conf_get_section_ht(cnf, "global");
8844 + fail_if(s == NULL, "no global section?");
8847 + while (list_ops[i]) {
8848 + list = poldek_conf_get_multi(s, list_ops[i]);
8849 + fail_if(list == NULL, "no %s?", list_ops[i]);
8850 + verify_list(list, maxno_ops[i], list_ops[i]);
8857 +START_TEST (test_config_lists_excl) {
8858 + char *list_ops[] = { "sources", NULL };
8860 + tn_array *lines, *list;
8863 + lines = n_array_new(16, 0, 0);
8866 + while (list_ops[i]) {
8868 + while (maxno >= 0) {
8869 + n_array_push(lines, make_conf_line(list_ops[i], maxno, ' '));
8875 + cnf = poldek_conf_addlines(NULL, "source", lines);
8876 + fail_if(cnf == NULL, "load config failed");
8878 + s = poldek_conf_get_section_ht(cnf, "source");
8879 + fail_if(s == NULL, "no source section?");
8882 + while (list_ops[i]) {
8883 + list = poldek_conf_get_multi(s, list_ops[i]);
8884 + fail_if(list == NULL, "no %s?", list_ops[i]);
8885 + verify_list(list, 1, list_ops[i]); /* maxno = 1 */
8891 +struct test_suite test_suite_config = {
8894 + { "raw", test_config },
8895 + { "lists", test_config_lists },
8897 +// XXX: excl list not implemented yet
8898 + { "lists excl", test_config_lists_excl },
8913 diff -urN poldek-0.20.org/tests/test_env.c poldek-0.20/tests/test_env.c
8914 --- poldek-0.20.org/tests/test_env.c 2005-10-23 10:12:45.000000000 +0200
8915 +++ poldek-0.20/tests/test_env.c 2006-07-26 20:25:54.339334750 +0200
8918 START_TEST (test_env) {
8919 char buf[PATH_MAX], tmp[PATH_MAX];
8922 n_snprintf(buf, sizeof(buf), "${ENV1}${ENV2}");
8923 setenv("ENV1", "pol", 1);
8924 setenv("ENV2", "dek", 1);
8926 + s = poldek_util_expand_env_vars(tmp, sizeof(tmp), buf);
8927 + fail_if(s == NULL, "expand_env_vars failed");
8929 + fail_if(n_str_ne(s, "poldek"),
8930 + "expand_env_vars() failed: %s -> %s", buf, s);
8932 + fail_if(n_str_ne(tmp, "poldek"),
8933 + "expand_env_vars() failed: %s -> %s", buf, tmp);
8936 + n_snprintf(buf, sizeof(buf), "foobar");
8937 + s = poldek_util_expand_env_vars(tmp, sizeof(tmp), buf);
8939 + fail_if(s == NULL, "expand_env_vars failed");
8940 + fail_if(n_str_ne(s, buf),
8941 + "expand_env_vars() failed: %s -> %s", buf, s);
8947 +START_TEST (test_var) {
8948 + char buf[PATH_MAX], tmp[PATH_MAX];
8952 + n_snprintf(buf, sizeof(buf), "%{1}%{2}");
8954 + vars = n_hash_new(16, NULL);
8955 + n_hash_insert(vars, "1", "pol");
8956 + n_hash_insert(vars, "2", "dek");
8958 + s = poldek_util_expand_vars(tmp, sizeof(tmp), buf, '%', vars);
8959 + fail_if(s == NULL, "expand_vars failed");
8961 + fail_if(n_str_ne(s, "poldek"),
8962 + "expand_vars() failed: %s -> %s", buf, s);
8964 + fail_if(n_str_ne(tmp, "poldek"),
8965 + "expand_vars() failed: %s -> %s", buf, tmp);
8967 - expand_env_vars(tmp, sizeof(tmp), buf);
8968 - fail_unless(n_str_eq(tmp, "poldek"),
8969 - "expand_env_vars() failed: %s -> %s", buf, tmp);
8971 + n_snprintf(buf, sizeof(buf), "foobar");
8972 + s = poldek_util_expand_vars(tmp, sizeof(tmp), buf, '%', vars);
8974 + fail_if(s == NULL, "expand_vars failed");
8975 + fail_if(n_str_ne(s, buf),
8976 + "expand_vars() failed: %s -> %s", buf, s);
8981 -struct test_case test_case_misc_env = {
8982 - "env vars expanding", test_env
8983 +struct test_case test_case_misc_env0 = {
8984 + "env vars expanding", test_env,
8987 +struct test_case test_case_misc_env1 = {
8988 + "vars expanding", test_var
8990 diff -urN poldek-0.20.org/tests/test.h poldek-0.20/tests/test.h
8991 --- poldek-0.20.org/tests/test.h 1970-01-01 01:00:00.000000000 +0100
8992 +++ poldek-0.20/tests/test.h 2006-07-26 20:25:54.339334750 +0200
8994 +#ifndef POLDEK_TEST_H
8995 +#define POLDEK_TEST_H
8997 +#include <stdlib.h>
8998 +#include <string.h>
9000 +#include <sys/param.h> /* for PATH_MAX */
9001 +#include <sys/types.h>
9002 +#include <sys/stat.h>
9005 +#include <trurl/nassert.h>
9006 +#include <trurl/nmalloc.h>
9013 +#include "capreq.h"
9015 +#include "pm/rpm/pm_rpm.h"
9016 +#include "pkgmisc.h"
9018 +#define fail_ifnot fail_unless
9022 + void (*test_fn)(void);
9025 +struct test_suite {
9027 + struct test_case cases[];
9031 diff -urN poldek-0.20.org/tests/test_op.c poldek-0.20/tests/test_op.c
9032 --- poldek-0.20.org/tests/test_op.c 2005-10-23 10:12:45.000000000 +0200
9033 +++ poldek-0.20/tests/test_op.c 2006-07-26 20:25:54.339334750 +0200
9036 fail_unless(is_op(ts, op, !defaultv),
9037 "%s not propagated to ts", opname);
9042 START_TEST (test_op_ts_postconf) {
9043 diff -urN poldek-0.20.org/tests/test_poldek.c poldek-0.20/tests/test_poldek.c
9044 --- poldek-0.20.org/tests/test_poldek.c 2005-10-23 10:12:45.000000000 +0200
9045 +++ poldek-0.20/tests/test_poldek.c 2006-07-26 20:25:54.339334750 +0200
9053 -//#include "test_env.c"
9055 extern struct test_suite test_suite_match;
9056 extern struct test_suite test_suite_pmdb;
9057 extern struct test_suite test_suite_op;
9058 +extern struct test_suite test_suite_config;
9060 struct test_suite *suites[] = {
9064 + &test_suite_config,
9068 -extern struct test_case test_case_misc_env;
9069 +extern struct test_case test_case_misc_env0;
9070 +extern struct test_case test_case_misc_env1;
9072 struct test_case *misc_cases[] = {
9073 - &test_case_misc_env,
9074 + &test_case_misc_env0,
9075 + &test_case_misc_env1,
9080 if (argc > 1 && n_str_eq(argv[1], "-v"))
9083 - while (suites[i]) {
9084 - Suite *s = make_suite(suites[i]);
9085 + if (misc_cases[0]) {
9086 + Suite *s = make_themisc_suite();
9087 SRunner *sr = srunner_create(s);
9088 srunner_run_all(sr, CK_NORMAL);
9089 nerr += srunner_ntests_failed(sr);
9094 - if (misc_cases[0]) {
9095 - Suite *s = make_themisc_suite();
9097 + while (suites[i]) {
9098 + Suite *s = make_suite(suites[i]);
9099 SRunner *sr = srunner_create(s);
9101 srunner_run_all(sr, CK_NORMAL);
9102 nerr += srunner_ntests_failed(sr);
9109 return (nerr == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
9111 diff -urN poldek-0.20.org/trurlib/autogen.sh poldek-0.20/trurlib/autogen.sh
9112 --- poldek-0.20.org/trurlib/autogen.sh 1970-01-01 01:00:00.000000000 +0100
9113 +++ poldek-0.20/trurlib/autogen.sh 2003-01-18 15:39:25.000000000 +0100
9121 +if [ ! -f $FILE ]; then
9123 + if [ ! -f $FILE ]; then
9124 + echo "`pwd`: not a $PKG directory"
9132 + test $? -eq 0 || exit 1
9135 +runcmd libtoolize --force --automake
9138 +runcmd automake --add-missing --no-force
9141 +if [ -z "$1" -o "$1" != "--no-configure" ]; then
9142 + CONFOPTS="--enable-maintainer-mode --enable-compile-warnings $@"
9143 + runcmd ./configure $CONFOPTS
9145 diff -urN poldek-0.20.org/trurlib/ChangeLog poldek-0.20/trurlib/ChangeLog
9146 --- poldek-0.20.org/trurlib/ChangeLog 2005-10-17 23:37:27.000000000 +0200
9147 +++ poldek-0.20/trurlib/ChangeLog 2005-11-06 21:01:23.000000000 +0100
9149 +2005-11-06 Pawe³ Gajda <mis@pld.org.pl>
9151 + * nbuf.c: - be paranoid
9153 + * include/trurl/narray.h:
9154 + - new n_array_ctl_get_freefn(), to be consitent
9156 +2005-10-17 Pawe³ Gajda <mis@pld.org.pl>
9158 + * include/trurl/nstream.h, nstream.c:
9159 + - prefixed nstream members to avoid conflicts with stdio macros (thanks to Olivier Thauvin (olivier.thauvin att aerov jussieu fr)
9161 + * include/trurl/narray.h: - more comments
9163 +2005-06-13 Pawe³ Gajda <mis@pld.org.pl>
9165 + * include/trurl/nstream.h: - comments
9167 + * configure.in, nmalloc.c:
9168 + - do not make unalign obstack on sparc, alpha, etc
9170 +2005-05-13 Pawe³ Gajda <mis@pld.org.pl>
9172 + * lib/obstack.c: - missing include
9174 + * libtrurl.sym: - missing symbols
9176 + * libtrurl.sym: - symtab
9178 + * configure.in, lib/.cvsignore, lib/Makefile.am, lib/obstack.c, lib/obstack.h, nmalloc.c, Makefile.am:
9179 + - be more portable (obstack)
9181 +2005-05-12 Pawe³ Gajda <mis@pld.org.pl>
9184 + - disabled usage of stdio cookies, too much troubles with them
9187 + - disaled usage of stdio cookies, too much troubles with them
9189 + * ndie.c: - horrible bug
9191 +2005-04-21 Pawe³ Gajda <mis@pld.org.pl>
9193 + * include/trurl/narray.h, n_array_new.c: - new n_array_cfree()
9195 +2005-04-16 Pawe³ Gajda <mis@pld.org.pl>
9198 + - cookie's gzfseek() fix: set offset to proper value (qboosh at pld-linux org)
9200 + * nbuf.c, test_common.c: - bugfix
9202 +2005-04-11 Pawe³ Gajda <mis@pld.org.pl>
9204 + * configure.in, nstream.c:
9205 + - tolerate missing gzungetc() (not used in fact)
9207 +2004-11-16 Pawe³ Gajda <mis@pld.org.pl>
9209 + * include/trurl/narray.h, n_array_sorts.c, test_array.c:
9210 + - +n_array_reverse()
9212 +2004-11-03 Pawe³ Gajda <mis@pld.org.pl>
9214 + * include/trurl/n_obj_ref.h, include/trurl/trurl.h, include/trurl/nbuf.h:
9217 +2004-10-23 Pawe³ Gajda <mis@pld.org.pl>
9219 + * Makefile.am, include/trurl/nstr.h, nstr.c, test_nstr.c:
9220 + - n_str_strip_ws()
9222 +2004-10-15 Pawe³ Gajda <mis@pld.org.pl>
9224 + * include/trurl/nassert.h, nassert.c, ndie.c:
9225 + - set_hook() schema for both die and assert; die() cosmetics
9227 +2004-10-14 Pawe³ Gajda <mis@pld.org.pl>
9229 + * include/trurl/nstream.h, nstream.c, test_stream.c:
9230 + - +n_stream_getline()
9232 +2004-10-07 Pawe³ Gajda <mis@pld.org.pl>
9234 + * n_hash_dup.c: - dup()ed hash could not inherit NOCPKEY
9236 +2004-10-05 Pawe³ Gajda <mis@pld.org.pl>
9238 + * include/trurl/narray.h, n_array_new.c: - cleanup
9240 +2004-10-04 Pawe³ Gajda <mis@pld.org.pl>
9242 + * nstr_tokl.c: - do not assume that WHITE is after quoted string
9244 + * nstr_tokl.c: - normal characters are not escapeable
9246 + * include/trurl/nstr.h, nstr_tokl.c: - no default escape char
9248 +2004-10-02 Pawe³ Gajda <mis@pld.org.pl>
9250 + * include/trurl/narray.h, n_array_new.c: - +n_array_ctl_get_cmpfn()
9252 + * configure.in: - missing check
9254 + * n_array_sorts.c: - trace
9256 +2004-09-30 Pawe³ Gajda <mis@pld.org.pl>
9258 + * include/trurl/narray.h: - SWIGing
9260 +2004-09-27 Pawe³ Gajda <mis@pld.org.pl>
9262 + * test_stream.c: - more tests
9264 +2004-09-26 Pawe³ Gajda <mis@pld.org.pl>
9266 + * include/trurl/trurl.h: - missing inc
9268 + * test_array.c: - more tests
9270 +2004-09-21 Pawe³ Gajda <mis@pld.org.pl>
9272 + * include/trurl/nstr.h, nstr_tok.c, nstr_tokl.c: - delim is const char
9274 +2004-09-12 Pawe³ Gajda <mis@pld.org.pl>
9276 + * include/trurl/Attic/nobstack.h, Attic/test_obstack.c, Makefile.am, nmalloc.c:
9277 + - obsoleted obstack.h
9279 +2004-09-01 Pawe³ Gajda <mis@pld.org.pl>
9281 + * Makefile.am: - 'symlink' is useless
9283 + * include/trurl/narray.h: - missing include
9285 +2004-08-06 Pawe³ Gajda <mis@pld.org.pl>
9287 + * Attic/n_array_dup.c, include/trurl/narray.h, n_array_new.c:
9288 + - +n_array_ctl_set*fn
9290 + * nmalloc.c: - smaller min. chunks
9292 +2004-07-23 Pawe³ Gajda <mis@pld.org.pl>
9294 + * n_hash_keys.c: - fix
9296 + * include/trurl/nhash.h, n_hash_keys.c: - +n_hash_values()
9298 +2004-07-14 Pawe³ Gajda <mis@pld.org.pl>
9300 + * include/trurl/nhash.h, n_hash_free.c, n_hash_int.h, n_hash_new.c, n_hash_put.c:
9301 + - tn_alloc support
9303 + * nbuf.c, include/trurl/nbuf.h: - n_ref() aware
9305 +2004-07-13 Pawe³ Gajda <mis@pld.org.pl>
9307 + * nmalloc.c: - refcount-able
9309 +2004-07-12 Pawe³ Gajda <mis@pld.org.pl>
9311 + * n_hash_new.c, n_hash_put.c, trurl_internal.h, Attic/hash-string.h, Makefile.am, n_hash_int.h:
9314 + * nmalloc.c: - bugfix
9316 +2004-07-11 Pawe³ Gajda <mis@pld.org.pl>
9318 + * .cvsignore, Makefile.am, include/trurl/ntuple.h, n_array_sorts.c, ntuple.c:
9319 + - +ntuple - python-like, semi-array
9321 + * include/trurl/narray.h: - bugfix
9323 +2004-07-09 Pawe³ Gajda <mis@pld.org.pl>
9325 + * Attic/n_array_free.c, Makefile.am, include/trurl/narray.h, include/trurl/nmalloc.h, n_array_new.c, nmalloc.c:
9328 + * n_hash_map.c: - dump()
9330 +2004-06-24 Pawe³ Gajda <mis@pld.org.pl>
9332 + * nbuf.c: - improved restore()
9334 +2004-06-23 Pawe³ Gajda <mis@pld.org.pl>
9336 + * include/trurl/nhash.h, n_hash_free.c, n_hash_get.c, n_hash_int.h, n_hash_new.c, n_hash_put.c, nbuf.c:
9337 + - fixes && improvements
9339 +2004-06-22 Pawe³ Gajda <mis@pld.org.pl>
9341 + * Attic/n_hash_exists.c, Makefile.am, include/trurl/nbuf.h, n_hash_int.h, nbuf.c:
9344 + * n_hash_dup.c, n_hash_free.c, n_hash_get.c, n_hash_map.c, n_hash_new.c, n_hash_put.c, n_hash_remove.c, n_hash_stats.c, test_hash.c, trurl_internal.h:
9345 + - hash table improvements
9347 +2004-05-06 Pawe³ Gajda <mis@pld.org.pl>
9349 + * n_array_dump_stats.c, n_hash_stats.c, nstr_tokl.c:
9350 + - type fixes, incl. SEGV on 64-bit archs (qboosh)
9352 +2004-03-22 Pawe³ Gajda <mis@pld.org.pl>
9354 + * include/trurl/narray.h, include/trurl/trurl.h, n_array_push.c:
9355 + - n_array_concat()
9357 +2004-02-23 Pawe³ Gajda <mis@pld.org.pl>
9359 + * include/trurl/narray.h, n_array_nth.c: - SWIG'ed
9361 +2004-02-22 Pawe³ Gajda <mis@pld.org.pl>
9363 + * include/trurl/Attic/nobstack.h, Attic/test_obstack.c, Makefile.am:
9364 + - glibc's obstack wrapper
9366 +2004-02-17 Pawe³ Gajda <mis@pld.org.pl>
9368 + * Makefile.am: - 'make distcheck' fixes (wiget at pld-linux org)
9370 + * n_array_clone.c, include/trurl/narray.h:
9371 + - merged _dup() and _clone() funcs
9373 +2004-01-05 Pawe³ Gajda <mis@pld.org.pl>
9375 + * include/trurl/nstr.h, nstr_basenam.c:
9376 + - + n_dirname() alias for n_basedirnam()
9378 + * nstr_tokl.c: - commented out debug message
9380 + * include/trurl/nbuf.h: - new n_buf_it_read()
9382 + - n_buf_it_read_*int*() aliases to n_buf_it_get_int*
9384 + * include/trurl/nstr.h: - new n_str_[eq,ne] macros
9386 +2003-12-31 Pawe³ Gajda <mis@pld.org.pl>
9388 + * include/trurl/nbuf.h: - replaced macros with inline funcs
9390 +2003-12-30 Pawe³ Gajda <mis@pld.org.pl>
9392 + * include/trurl/nmalloc.h, n_hash_free.c, n_hash_remove.c, nbuf.c, nstr_concat.c, nstr_len.c, nstring.c, test_nstr.c:
9393 + - nothing shocking
9395 + * Makefile.am: - fixed *.h list
9397 + * nstream.c: - bugfix (added gzseek stdio-like wrapper)
9399 +2003-04-30 Pawe³ Gajda <mis@pld.org.pl>
9401 + * include/trurl/nstr.h, nstr_tokl.c: - + n_str_etokl() (line tokenizer)
9403 +2003-04-23 Pawe³ Gajda <mis@pld.org.pl>
9405 + * include/trurl/nstr.h, nstr_tokl.c: + n_str_tokl_n()
9407 +2003-04-14 Pawe³ Gajda <mis@pld.org.pl>
9409 + * include/trurl/nmalloc.h: + n_strdupap()
9411 +2003-02-07 Pawe³ Gajda <mis@pld.org.pl>
9413 + * include/trurl/nbuf.h: - missing inclusion
9415 + * n_hash_put.c: - do not free NULL pointers...
9417 +2003-01-18 Pawe³ Gajda <mis@pld.org.pl>
9419 + * autogen.sh: - added --no-configure option
9421 + * include/trurl/narray.h, n_array_new.c: - +n_array_init()
9423 + * configure.in: - missing zlib
9425 +2003-01-14 Pawe³ Gajda <mis@pld.org.pl>
9427 + * include/trurl/nmalloc.h, nmalloc.c:
9428 + +n_cfree() (frees and sets to NULL a pointer)
9430 +2003-01-06 Pawe³ Gajda <mis@pld.org.pl>
9432 + * n_hash_dup.c: - bugfix
9434 +2002-12-13 Pawe³ Gajda <mis@pld.org.pl>
9436 + * include/trurl/nmalloc.h, include/trurl/narray.h, n_array_ctl.c, n_array_int.h, n_array_new.c, n_array_nth.c, n_array_push.c, n_array_set_nth.c, n_array_sorts.c, n_array_unshift.c, n_hash_new.c, nbuf.c, nmalloc.c, test_array.c:
9438 + - few n_array's improvements
9440 +2002-12-12 Pawe³ Gajda <mis@pld.org.pl>
9442 + * include/trurl/n_obj_ref.h, include/trurl/narray.h, include/trurl/nhash.h, include/trurl/nlist.h, Attic/n_array_dup.c, Attic/n_array_free.c, n_array_clone.c, n_array_int.h, n_array_new.c, n_hash_free.c, n_hash_int.h, n_hash_new.c, n_list_free.c, n_list_int.h, n_list_new.c, nstr_tok.c, nstr_tokl.c, test_nstr.c:
9443 + - + n_(array|hash|list)_ref()
9446 +2002-12-10 Pawe³ Gajda <mis@pld.org.pl>
9448 + * include/trurl/nhash.h, Makefile.am, n_hash_dup.c: + n_hash_dup()
9450 +2002-12-02 Pawe³ Gajda <mis@pld.org.pl>
9452 + * include/trurl/nbuf.h: - n_buf_it_get* fixes
9454 + * nbuf.c: - buffer with constant data may be cleaned too
9456 +2002-11-13 Pawe³ Gajda <mis@pld.org.pl>
9458 + * nmalloc.c, nstream.c: - cosmetics
9460 + * include/trurl/nhash.h, n_hash_keys.c: - improved n_hash_keys()
9462 + * include/trurl/nbuf.h, nbuf.c: - n_buf_gets() and co
9464 +2002-11-07 Pawe³ Gajda <mis@pld.org.pl>
9466 + * ndie.c: - missing include
9468 + * include/trurl/nhash.h, Makefile.am, configure.in, n_hash_keys.c, n_hash_new.c:
9469 + - new fn n_hash_keys()
9470 + - released as 0.44.0
9472 +2002-11-04 Pawe³ Gajda <mis@pld.org.pl>
9474 + * include/trurl/n2h.h, include/trurl/nbuf.h, include/trurl/nstream.h, nmalloc.c, nstream.c, test_common.c, test_stream.c, Makefile.am, Makefile.extra, configure.in, n_array_remove_ex.c, n_hash_int.h, n_hash_new.c, nbuf.c, ndie.c:
9475 + - improved tn_buf: moved add_intXX() from poldek, stdio like interface
9478 + - moved n2h from poldek
9479 + - killed gcc's warnings
9481 +2002-10-29 Pawe³ Gajda <mis@pld.org.pl>
9483 + * include/trurl/nbuf.h, include/trurl/nstore.h, include/trurl/nstream.h, Makefile.extra, configure.in, nbuf.c, nstore.c, nstream.c, test_array.c, test_stream.c, Makefile.am:
9484 + - new tn_steam module with support for transparent access to compressed
9485 + files and stdio-like interface.
9486 + - new n_buf_(re)store*() functions
9488 + * Makefile.am: - updated library version info
9490 +2002-10-18 Pawe³ Gajda <mis@pld.org.pl>
9493 + - ,,automake requires 'AM_CONFIG_HEADER', not 'AC_CONFIG_HEADER' ''
9495 +2002-10-18 Artur Frysiak <wiget@pld.org.pl>
9497 + * .cvsignore: more ignores
9499 + * Attic/acconfig.h, configure.in, Makefile.am: - make distcheck passed
9501 +2002-10-17 Pawe³ Gajda <mis@pld.org.pl>
9503 + * Makefile.am, autogen.sh, configure.in:
9504 + - adaptation to include/trurl headers location
9506 +2002-10-16 Pawe³ Gajda <mis@pld.org.pl>
9508 + * include/trurl/narray.h: - +n_array_has_free_fn()
9510 +2002-06-03 Pawe³ Gajda <mis@pld.org.pl>
9512 + * nbuf.c: - minor bugfix
9514 +2002-05-06 Pawe³ Gajda <mis@pld.org.pl>
9516 + * Makefile.am, NEWS, configure.in, include/trurl/narray.h, n_array_int.h, n_array_nth.c:
9517 + - make n_array_nth() inline (speed!)
9519 + * Attic/trurl_die.c, include/trurl/ndie.h, ndie.c:
9520 + - make n_die() public
9522 + * include/trurl/nbuf.h, nbuf.c: - new n_buf_*printf()
9524 + * Makefile.am, nmalloc.c, xmalloc.c:
9525 + - fixed static link: moved xmalloc*()s to separate module
9527 + * Makefile.am: - released as 0.43.7
9529 +2002-04-26 Pawe³ Gajda <mis@pld.org.pl>
9531 + * NEWS, README: - updated && merged with PL versions
9533 + * Attic/CHANGES.PL, Attic/README.PL: - obsoleted
9535 +2002-04-25 Pawe³ Gajda <mis@pld.org.pl>
9537 + * include/trurl/nmalloc.h, nmalloc.c, test_common.c: - nicer fn name
9539 + * Attic/xmalloc.h, include/trurl/trurl.h, nstr_tok.c, nstr_tokl.c, nstring.c, test_array.c, test_common.c, test_list.c, xmalloc.c, include/trurl/nmalloc.h, n_array_grow_priv.c, n_array_int.h, n_array_new.c, n_hash_int.h, n_hash_new.c, n_hash_put.c, n_list_int.h, n_list_new.c, n_list_push.c, n_list_unshift.c, nbuf.c, nmalloc.c, nstr_basenam.c, nstr_concat.c, nstr_cpy.c, nstr_len.c, configure.in, n_array_clone.c, Makefile.am:
9540 + - xmalloc()s -> n_malloc()s
9542 +2002-04-21 Pawe³ Gajda <mis@pld.org.pl>
9544 + * Makefile.am: - released as 0.43.6
9546 +2002-04-05 Pawe³ Gajda <mis@pld.org.pl>
9548 + * include/trurl/n_snprintf.h: - bugfix
9550 + * include/trurl/trurl.h: - +#include <trurl/n_snprintf.h>
9552 + * NEWS, configure.in, include/trurl/n_snprintf.h, Makefile.am:
9553 + - n_snprintf.h with [v]snprintf wrappers which always returns
9554 + the number of characters printed
9555 + - released as 0.43.6
9557 +2002-03-15 Pawe³ Gajda <mis@pld.org.pl>
9559 + * Makefile.am, NEWS, configure.in: - released as 0.43.5
9561 + * nbuf.c: - be 0.43.3 compatibile and provide n_buf_add symbol too
9563 +2002-03-13 Pawe³ Gajda <mis@pld.org.pl>
9565 + * NEWS: - released as 0.43.4
9567 +2002-03-12 Pawe³ Gajda <mis@pld.org.pl>
9569 + * include/trurl/nstr.h, nstr_concat.c, nstr_len.c:
9570 + - copy va_list via __va_copy() macro (to be portable to PPC)
9572 +2002-02-19 Pawe³ Gajda <mis@pld.org.pl>
9574 + * .cvsignore, Makefile.am, configure.in, include/trurl/nbuf.h, nbuf.c:
9575 + - added n_buff_addz(); pre 0.43.4
9577 + * Attic/ndbhash.c, Attic/ndbhash.h, Attic/test_dbhash.c:
9578 + - removed dead code
9580 +2002-02-08 Pawe³ Gajda <mis@pld.org.pl>
9582 + * test_array.c: - one more test
9584 +2002-02-07 Pawe³ Gajda <mis@pld.org.pl>
9586 + * n_array_remove_ex.c, test_array.c: - bugfix
9588 + * include/trurl/nhash.h, n_hash_new.c: - added n_hash_size
9590 +2001-09-06 Pawe³ Gajda <mis@pld.org.pl>
9592 + * Makefile.am, configure.in, n_array_sorts.c: - fixed AUTOSORTED
9593 + - simplified sort code
9595 +2001-06-09 Pawe³ Gajda <mis@pld.org.pl>
9597 + * configure.in, NEWS: - 0.43.2
9599 + * n_array_clone.c: - fixed buggy func
9601 + * include/trurl/narray.h, nbuf.c: - bugfix
9603 +2001-04-24 Tomasz K³oczko <kloczek@pld.org.pl>
9605 + * Makefile.am: - removed VERSION from EXTRA_DIST.
9607 + * Attic/VERSION, configure.in: - changed version to 0.43.1,
9608 + - removed usinf VERSION file.
9610 +2001-04-23 Rafa³ Kleger-Rudomin <klakier@pld.org.pl>
9612 + * configure.in: - AC_PROG_LIBTOOL -> AM_PROG_LIBTOOL
9614 +2001-02-10 Pawe³ Gajda <mis@pld.org.pl>
9616 + * Makefile.am, include/trurl/narray.h, n_array_clone.c: - new function
9618 +2001-02-08 Pawe³ Gajda <mis@pld.org.pl>
9620 + * Attic/ChangeLog: - don't like ChangeLog from whole installer
9622 + * Makefile.am, configure.in: - cosmetics (up to new automake)
9624 + * n_array_map.c, n_array_map_arg.c, n_array_remove_nth.c: - bugfix
9626 + * include/trurl/narray.h, n_array_remove_ex.c: - new function
9628 +2001-02-02 Nobody <nobody@pld.org.pl>
9630 + * Attic/ChangeLog: - ChangeLog update by changelog.sh
9631 + (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9633 +2000-11-28 Nobody <nobody@pld.org.pl>
9635 + * Attic/ChangeLog: - ChangeLog update by changelog.sh
9636 + (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9638 +2000-11-24 Nobody <nobody@pld.org.pl>
9640 + * Attic/ChangeLog: - ChangeLog update by changelog.sh
9641 + (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9643 +2000-11-24 Pawe³ Gajda <mis@pld.org.pl>
9645 + * Attic/VERSION: - marked as 0.431
9647 + * .cvsignore, Makefile.am: - added spec to EXTRA_DIST
9649 +2000-11-12 Nobody <nobody@pld.org.pl>
9651 + * Attic/ChangeLog: - ChangeLog update by changelog.sh
9652 + (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9654 +2000-11-10 Pawe³ Gajda <mis@pld.org.pl>
9656 + * Attic/mkmake.sh, autogen.sh: - be more traditional
9658 +2000-11-09 Pawe³ Gajda <mis@pld.org.pl>
9660 + * Makefile.am, Makefile.extra: - make trurl -> . symlink
9661 + - am's *CLEAN variables are used instead of removals in mclean goal
9663 +2000-11-08 Pawe³ Gajda <mis@pld.org.pl>
9665 + * nbuf.c: - fixed some bugs
9667 +2000-10-31 Pawe³ Gajda <mis@pld.org.pl>
9669 + * configure.in: - check for db*.h headers instead of library
9671 + * Makefile.am: - use libtool version-info
9673 +2000-10-29 Pawe³ Gajda <mis@pld.org.pl>
9675 + * Attic/narray.c, Attic/nhash.c, Attic/nlist.c, Attic/trurlib.spec, n_list_nth.c, n_list_pop.c, n_list_push.c, n_list_remove_ex.c, n_list_remove_nth.c, n_list_shift.c, n_list_size.c, n_list_unshift.c, nstr_cpy.c, nstring.c, trurlib.spec.in, Attic/VERSION, Attic/acconfig.h, Attic/mkmake.sh, Attic/n_array_dup.c, Attic/n_array_free.c, Attic/n_hash_exists.c, Makefile.am, Makefile.extra, NEWS, README, configure.in, mkarch.sh, n_array_bsearch_ex.c, n_array_clean.c, n_array_ctl.c, n_array_dump_stats.c, n_array_eq_ex.c, n_array_grow_priv.c, n_array_int.h, n_array_map.c, n_array_map_arg.c, n_array_new.c, n_array_nth.c, n_array_pop.c, n_array_push.c, n_array_remove_nth.c, n_array_set_nth.c, n_array_shift.c, n_array_sorts.c, n_array_uniq_ex.c, n_array_unshift.c, n_hash_clean.c, n_hash_ctl.c, n_hash_free.c, n_hash_get.c, n_hash_int.h, n_hash_map.c, n_hash_map_arg.c, n_hash_new.c, n_hash_put.c, n_hash_remove.c, n_hash_stats.c, n_list_contains_ex.c, n_list_free.c, n_list_int.h, n_list_iterator.c, n_list_lookup_ex.c, n_list_map_arg.c, n_list_new.c, .cvsignore, AUTHORS, Attic/ChangeLog, Attic/Makefile, COPYING, INSTALL:
9676 + - automake/autoconf support
9678 +2000-10-25 Pawe³ Gajda <mis@pld.org.pl>
9680 + * xmalloc.c: - allow NULL as xrealloc() arg
9682 +2000-10-17 Pawe³ Gajda <mis@pld.org.pl>
9684 + * include/trurl/nbuf.h, nbuf.c: - nbuf redesign
9686 +2000-10-01 Tomasz K³oczko <kloczek@pld.org.pl>
9688 + * configure.in: - generated by autoscan.
9690 +2000-09-20 Pawe³ Gajda <mis@pld.org.pl>
9692 + * Attic/Makefile, include/trurl/nstr.h, nstr_basenam.c:
9693 + - basename() functions added
9695 + * Attic/trurlib.spec:
9696 + - %{tmpdir} -> /tmp, distribution spec shouldn't be PLD dependent
9698 + * Attic/Makefile, Attic/VERSION, Attic/trurlib.spec:
9699 + - current working version is v0.42
9701 + * Attic/Makefile: - bugfix
9703 + * include/trurl/nstr.h, nstr_cpy.c: - n_strncpy() added
9705 +2000-09-07 Pawe³ Gajda <mis@pld.org.pl>
9707 + * nstr_tok.c: - bugfix
9709 + * Attic/Makefile: - misarch goal added
9711 + * Attic/nhash.c, include/trurl/nhash.h, test_hash.c:
9712 + - added hash function from D. J. Bernstein's cdb
9713 + - n_hash_stats() added
9715 + * Attic/narray.c, include/trurl/narray.h, test_array.c:
9716 + - removed growth control (nobody needs it)
9717 + - autosort option added
9720 +2000-08-07 Pawe³ Gajda <mis@pld.org.pl>
9722 + * include/trurl/tfn_types.h: - typedefs tn_fn_map{1,2,3} added
9724 +2000-08-03 Pawe³ Gajda <mis@pld.org.pl>
9726 + * include/trurl/nhash.h, Attic/Makefile, Attic/nhash.c:
9727 + - added n_hash_clean()
9729 +2000-08-02 Pawe³ Gajda <mis@pld.org.pl>
9731 + * nstr_tokl.c: - yet another bug is killed
9733 + * nstr_tokl.c: - another horrible bug is fixed
9735 +2000-07-28 Pawe³ Gajda <mis@pld.org.pl>
9737 + * nbuf.c: - fixed horrible bug
9739 +2000-07-27 Pawe³ Gajda <mis@pld.org.pl>
9741 + * Attic/nhash.c: - do not remalloc buckets during rehashing
9743 + * Attic/Makefile, Attic/nhash.c: - bugfix: n_hash_ctl.o is compiled now
9745 +2000-07-20 Pawe³ Gajda <mis@pld.org.pl>
9747 + * Attic/VERSION, Attic/trurlib.spec: - version 0.41
9750 + - added fid-arch goal, which creates subset of library for fix-info-dir
9752 + * include/trurl/trurl.h: - nbuf header added
9754 + * include/trurl/nbuf.h, nbuf.c: - initial version
9756 + * Attic/narray.c, include/trurl/narray.h:
9757 + - added n_array_bsearch_idx() (returns index of finded item)
9759 + * Attic/nhash.c, include/trurl/nhash.h, test_hash.c:
9760 + - more flexible hash table: grow with rehashing and do not always copy keys,
9761 + n_hash_ctl() added
9763 + * Attic/ndbhash.c, Attic/ndbhash.h, Attic/nlist.c, Attic/trurl_die.c, include/trurl/nassert.h, include/trurl/nlist.h, include/trurl/nstr.h, include/trurl/tfn_types.h, nassert.c, nstr_concat.c, nstr_len.c, nstr_tokl.c, trurl_cmpf.c, trurl_internal.h, xmalloc.c:
9766 +2000-07-15 Pawe³ Gajda <mis@pld.org.pl>
9768 + * Attic/Makefile, Attic/narray.c, Attic/nhash.c, Attic/nlist.c, Attic/trurlib.spec, trurl_internal.h:
9769 + - modularized narray, nhash and nlist modules
9771 +2000-06-09 Pawe³ Gajda <mis@pld.org.pl>
9773 + * Attic/Makefile, Attic/trurlib.spec: - spec
9775 + * Attic/test_dbhash.c, nstr_tokl.c, test_array.c, test_common.c, test_hash.c, test_list.c, test_nstr.c, xmalloc.c:
9776 + - minor #include fixes
9778 +2000-05-22 Pawe³ Gajda <mis@pld.org.pl>
9780 + * Attic/nlist.c, include/trurl/nlist.h, test_list.c:
9781 + - fixed list iterator
9783 + * Attic/nlist.c: - bugfix
9785 +2000-05-19 Pawe³ Gajda <mis@pld.org.pl>
9787 + * .cvsignore: *** empty log message ***
9789 + * Attic/Makefile, Attic/README.PL, Attic/VERSION, Attic/hash-string.h, Attic/narray.c, Attic/nhash.c, Attic/nlist.c, include/trurl/narray.h, include/trurl/nhash.h, include/trurl/nlist.h, include/trurl/tfn_types.h, include/trurl/trurl.h, test_array.c, test_list.c:
9790 + - allowed interlaced iterations on list (new tn_list_iterator type)
9791 + - removed libc's qsort() i bsearch() functions from array
9792 + - removed useless dup_fn member from list and array
9793 + - reduced args list of n_array_new() (narray_ctl_growth() added)
9795 +2000-05-04 Pawe³ Gajda <mis@pld.org.pl>
9797 + * Attic/xmalloc.h: - undef glibc's strdup macro
9799 + * Attic/VERSION: *** empty log message ***
9801 + * include/trurl/narray.h: - comment
9803 + * Attic/Makefile: - allow override CFLAGS
9804 + - allow compilation without ndbhash
9806 +2000-03-25 Pawe³ Gajda <mis@pld.org.pl>
9808 + * Attic/Makefile, Attic/narray.c, Attic/nhash.c, Attic/nlist.c, include/trurl/narray.h, include/trurl/nlist.h, include/trurl/nstr.h, trurl_cmpf.c, trurl_internal.h:
9809 + - added n_list_map_arg()
9810 + - added default compare function for array and list
9811 + - bugfix in n_array_bsearch()
9813 +2000-03-20 Pawe³ Gajda <mis@pld.org.pl>
9815 + * Attic/Makefile, Attic/xmalloc.h: - works with rpmlib.h
9818 +2000-03-17 Pawe³ Gajda <mis@pld.org.pl>
9820 + * Attic/nlist.c: - fix bug in n_list_remove_ex()
9822 +2000-01-18 Pawe³ Ko³odziej <pawelk@pld.org.pl>
9824 + * Attic/narray.c: Bug in qsort? Uses isort
9826 +1999-11-06 Artur Frysiak <wiget@pld.org.pl>
9828 + * .cvsignore, Makefile.am: New file.
9830 +1999-10-17 Pawe³ Gajda <mis@pld.org.pl>
9832 + * Attic/Makefile, Attic/README.PL, Attic/ndbhash.c, Attic/xmalloc.h:
9833 + Detekcja wersji glibc na podstawie __GLIBC_MINOR__
9835 +1999-09-17 Jarek Wo³oszyn <yossa@pld.org.pl>
9837 + * Attic/Makefile: gentocf - moje ostatnie zmiany
9838 + main - przenioslem win.* i scrmsgs.* do newt-addon
9839 + trurlib - glibc 2.1
9841 +1999-07-22 Artur Frysiak <wiget@pld.org.pl>
9843 + * Attic/CHANGES.PL, Attic/Makefile, Attic/README.PL, Attic/VERSION, Attic/hash-string.h, Attic/narray.c, Attic/ndbhash.c, Attic/ndbhash.h, Attic/nhash.c, Attic/nlist.c, Attic/test_dbhash.c, Attic/trurl_die.c, Attic/xmalloc.h, include/trurl/narray.h, include/trurl/nassert.h, include/trurl/nhash.h, include/trurl/nlist.h, include/trurl/nstr.h, include/trurl/tfn_types.h, include/trurl/trurl.h, nassert.c, nstr_concat.c, nstr_len.c, nstr_tok.c, nstr_tokl.c, nstring.c, test_array.c, test_common.c, test_hash.c, test_list.c, test_nstr.c, xmalloc.c:
9846 + * TODO.PL, nstring.h: pozbierane z diony
9848 diff -urN poldek-0.20.org/trurlib/include/trurl/narray.h poldek-0.20/trurlib/include/trurl/narray.h
9849 --- poldek-0.20.org/trurlib/include/trurl/narray.h 2005-10-17 23:19:39.000000000 +0200
9850 +++ poldek-0.20/trurlib/include/trurl/narray.h 2005-11-06 20:29:52.000000000 +0100
9854 Dynamic array of void*
9859 #ifndef TRURL_ARRAY_H
9863 #define n_array_ctl_growth(arr, inctype) ((void) 0) /* backward API compat */
9864 -#define n_array_has_free_fn(arr) (arr)->free_fn
9865 +#define n_array_has_free_fn(arr) (arr)->free_fn /* -"- */
9867 +#define n_array_ctl_get_freefn(arr) (arr)->free_fn
9868 tn_fn_free n_array_ctl_set_freefn(tn_array *arr, tn_fn_free free_fn);
9870 tn_fn_cmp n_array_ctl_set_cmpfn(tn_array *arr, tn_fn_cmp cmp_fn);
9871 tn_fn_cmp n_array_ctl_get_cmpfn(tn_array *arr);
9873 diff -urN poldek-0.20.org/trurlib/mkarch.sh poldek-0.20/trurlib/mkarch.sh
9874 --- poldek-0.20.org/trurlib/mkarch.sh 1970-01-01 01:00:00.000000000 +0100
9875 +++ poldek-0.20/trurlib/mkarch.sh 2000-10-29 22:12:21.000000000 +0100
9879 +make -f Makefile.extra mclean
9881 +if [ -w $CPDIR ]; then
9882 + make -f Makefile.extra backup cparch=1 backupdir=$CPDIR
9884 + make -f Makefile.extra backup
9886 diff -urN poldek-0.20.org/trurlib/nbuf.c poldek-0.20/trurlib/nbuf.c
9887 --- poldek-0.20.org/trurlib/nbuf.c 2005-10-26 10:11:00.000000000 +0200
9888 +++ poldek-0.20/trurlib/nbuf.c 2005-11-06 20:32:22.000000000 +0100
9898 diff -urN poldek-0.20.org/trurlib/nstring.c poldek-0.20/trurlib/nstring.c
9899 --- poldek-0.20.org/trurlib/nstring.c 1970-01-01 01:00:00.000000000 +0100
9900 +++ poldek-0.20/trurlib/nstring.c 2003-12-30 19:07:57.000000000 +0100
9905 +#include <stdarg.h>
9906 +#include <stdlib.h>
9907 +#include <string.h>
9909 +#ifdef USE_N_ASSERT
9910 +#include "nassert.h"
9912 +#include <assert.h>
9913 +#define n_assert(expr) assert(expr)
9916 +#include "nstring.h"
9918 +static char *vconcat(const char *s, va_list * ap);
9919 +static char *concat(const char *s,...);
9921 +struct trurl_string {
9928 +tn_string n_string_construct(char *s)
9935 + str.s = n_strdup(s);
9937 + str.size = len + 1;
9943 +static tn_string *n_string_generic_new(char *s)
9948 + if ((str = n_malloc(sizeof(*str))) == NULL)
9955 + str->size = len + 1;
9967 +tn_string *n_string_new(char *s)
9969 + return n_string_generic_new(n_strdup(s));
9973 +tn_string *n_string_vnew(const char *s,...)
9979 + t = vconcat(s, ap);
9982 + return n_string_generic_new(t);
9987 +tn_string *n_string_clean(tn_string * str)
9989 + if (str->s != NULL)
9991 + str->size = str->len = 0;
9997 +void n_string_free(tn_string * str)
9999 + n_string_clean(str);
10004 +static tn_string *n_string_grow(tn_string * str, size_t size)
10007 + if (str->len + size >= str->size) {
10009 + if ((s = n_realloc(str->s, str->size + size)) == NULL)
10013 + str->size += size;
10019 +const char *n_string_ptr(const tn_string * str)
10025 +tn_string *n_string_dup(const tn_string * str)
10027 + return n_string_new(str->s);
10031 +/* s += "aaaaa" + "bbbbbbb" + "ccccccc" */
10032 +tn_string *n_string_append_ptr(tn_string * str, const char *src)
10034 + register int len;
10035 + register char *p;
10037 + if (str->s == src) { /* self */
10042 + len = strlen(src);
10043 + p = (char *) src;
10046 + n_string_grow(str, len);
10047 + strncpy(str->s + str->len, p, len);
10054 +tn_string *n_string_append(tn_string * str, const tn_string * src)
10056 + return n_string_append_ptr(str, n_string_ptr(src));
10060 +tn_string *n_string_prepend_ptr(tn_string * str, const char *src)
10064 + len = strlen(src);
10065 + n_string_grow(str, len);
10067 + memmove(str->s + str->len, src, len);
10074 +tn_string *n_string_add(const tn_string * str1, const tn_string * str2)
10077 + s = concat(n_string_ptr(str1), n_string_ptr(str2), NULL);
10079 + return n_string_generic_new(s);
10083 +int n_string_cmp(const tn_string * str1, const tn_string * str2)
10085 + return strcmp(str1->s, str2->s);
10088 +int n_string_eq(const tn_string * str1, const tn_string * str2)
10090 + return strcmp(str1->s, str2->s) == 0;
10096 +static char *concat(const char *s,...)
10102 + t = vconcat(s, ap);
10109 +static char *vconcat(const char *s, va_list * ap)
10119 + while ((p = va_arg(ap, char *)) != NULL) { /* calculate length of args */
10120 + len += strlen(p);
10123 + if ((rstr = n_malloc(len + 1)) == NULL)
10130 + while ((p = va_arg(ap, char *)) != NULL) {
10136 diff -urN poldek-0.20.org/trurlib/nstring.h poldek-0.20/trurlib/nstring.h
10137 --- poldek-0.20.org/trurlib/nstring.h 1970-01-01 01:00:00.000000000 +0100
10138 +++ poldek-0.20/trurlib/nstring.h 1999-07-22 17:29:29.000000000 +0200
10145 +#ifndef __TN_STRING_H
10146 +#define __TN_STRING_H
10148 +typedef struct string tn_string;
10150 +tn_string n_string_construct(char *s);
10151 +tn_string *n_string_new(char *s);
10152 +tn_string *n_string_newv(const char *s, ...);
10153 +void n_string_free(tn_string *str);
10156 +tn_string *n_string_clean(tn_string *str);
10157 +const char *n_string_ptr(const tn_string *str);
10159 +/* s = new String(s2) */
10160 +tn_string *n_string_dup(const tn_string *str);
10162 +/* s += "aaaaa" */
10163 +tn_string *n_string_append_ptr(tn_string *str, const char *src);
10166 +tn_string *n_string_prepend_ptr(tn_string *str, const char *src);
10170 +tn_string *n_string_append(tn_string *str, const tn_string *src);
10174 +tn_string *n_string_add(const tn_string *str1, const tn_string *str2);
10177 +int n_string_cmp(const tn_string *str1, const tn_string *str2);
10178 +int n_string_eq(const tn_string *str1, const tn_string *str2);
10182 diff -urN poldek-0.20.org/trurlib/TODO.PL poldek-0.20/trurlib/TODO.PL
10183 --- poldek-0.20.org/trurlib/TODO.PL 1970-01-01 01:00:00.000000000 +0100
10184 +++ poldek-0.20/trurlib/TODO.PL 1999-07-22 17:29:29.000000000 +0200
10187 + - obs³uga listy posortowanej
10188 + - lista 2-kierunkowa, jako opcja
10191 + - dokoñczenie (odpowiedniki str* z libc)
10193 diff -urN poldek-0.20.org/uninstall.c poldek-0.20/uninstall.c
10194 --- poldek-0.20.org/uninstall.c 2005-10-12 21:28:02.000000000 +0200
10195 +++ poldek-0.20/uninstall.c 2006-07-26 20:25:54.343335000 +0200
10198 - Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
10199 + Copyright (C) 2000 - 2006 Pawel A. Gajda <mis@k2.net.pl>
10201 This program is free software; you can redistribute it and/or modify
10202 it under the terms of the GNU General Public License, version 2 as
10212 @@ -227,6 +227,7 @@
10214 DBGF("%s\n", pkg_id(pkg));
10216 + msg_i(3, indent, "%s\n", pkg_id(pkg));
10217 for (i=0; i < n_array_size(pkg->reqs); i++) {
10218 struct capreq *req = n_array_nth(pkg->reqs, i);
10220 @@ -235,7 +236,7 @@
10222 DBGF("req %s\n", capreq_snprintf_s(req));
10224 - if (pkg_satisfies_req(pkg, req, 1)) { /* self match, should be handled
10225 + if (pkg_satisfies_req(pkg, req, 1)) { /* XXX: self match, should be handled
10226 at lower level; TOFIX */
10227 DBGF("%s: satisfied by itself\n", capreq_snprintf_s(req));
10229 @@ -243,7 +244,7 @@
10230 uctx->uninst_set->dbpkgs)) {
10232 DBGF("%s: satisfied by db\n", capreq_snprintf_s(req));
10233 - msg_i(3, indent, "%s: satisfied by db\n", capreq_snprintf_s(req));
10234 + msg_i(3, indent, " %s: satisfied by db\n", capreq_snprintf_s(req));
10236 } else if (!uctx->ts->getop(uctx->ts, POLDEK_OP_FOLLOW)) {
10237 logn(LOGERR, _("%s (cap %s) is required by %s"),
10238 @@ -402,12 +403,13 @@
10241 int do_resolve_package(struct uninstall_ctx *uctx, struct poldek_ts *ts,
10242 - const char *mask, const struct capreq *cr)
10243 + const char *mask, const struct capreq *cr,
10244 + const char *arch)
10247 int i, nmatches = 0;
10251 DBGF("get_provides %s\n", capreq_snprintf_s(cr));
10252 dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cr, NULL, uninst_LDFLAGS);
10254 @@ -431,7 +433,8 @@
10255 } else { /* with version */
10256 if (ts->getop(ts, POLDEK_OP_CAPLOOKUP)) {
10257 if (pkg_xmatch_req(dbpkg, cr, POLDEK_MA_PROMOTE_REQEPOCH))
10262 if (strcmp(dbpkg->name, capreq_name(cr)) == 0) {
10263 DBGF("n (%s, %s) %d\n", dbpkg->name,
10264 @@ -445,6 +448,12 @@
10265 pkg_evr_match_req(dbpkg, cr, POLDEK_MA_PROMOTE_REQEPOCH))
10269 + if (matched && arch) {
10270 + const char *dbarch = pkg_arch(dbpkg);
10271 + matched = n_str_eq(arch, dbarch ? dbarch : "none");
10277 @@ -457,15 +466,20 @@
10281 -static int resolve_package(struct uninstall_ctx *uctx, struct poldek_ts *ts, const char *mask)
10282 +static int resolve_package(struct uninstall_ctx *uctx, struct poldek_ts *ts,
10283 + const char *mask, const char *arch)
10286 struct capreq *cr, *cr_evr;
10289 cr = NULL; cr_evr = NULL;
10291 - if ((p = strchr(mask, '#')) == NULL) {
10293 + DBGF("mask=%s\n", mask);
10294 + /* No EVR mask or empty EVR (last char '#') */
10295 + if ((p = strchr(mask, '#')) == NULL || *(p + 1) == '\0') {
10298 capreq_new_name_a(mask, cr);
10301 @@ -479,11 +493,13 @@
10305 - if (poldek_util_parse_evr(p, &epoch, &ver, &rel))
10306 + if (poldek_util_parse_evr(p, &epoch, &ver, &rel)) {
10307 cr = cr_evr = capreq_new(NULL, tmp, epoch, ver, rel, REL_EQ, 0);
10308 + DBGF("cap=%s\n", capreq_snprintf_s(cr));
10312 - if (do_resolve_package(uctx, ts, mask, cr))
10313 + if (do_resolve_package(uctx, ts, mask, cr, arch))
10317 @@ -492,6 +508,58 @@
10321 +static int resolve_mask(struct uninstall_ctx *uctx, struct poldek_ts *ts,
10322 + const char *mask)
10325 + const char *n, *v, *r;
10330 + msgn(2, "Trying %s\n", mask);
10331 + if (resolve_package(uctx, ts, mask, NULL))
10334 + if ((p = strchr(mask, '-')) == NULL) /* try N-[E:]V */
10337 + /* try N-[E:]V-R */
10338 + n_strdupap(mask, &tmp);
10339 + p = strrchr(tmp, '-');
10342 + msgn(2, " Trying %s\n", tmp);
10344 + if (resolve_package(uctx, ts, tmp, NULL))
10347 + n_strdupap(mask, &tmp);
10348 + if (poldek_util_parse_nevr(tmp, &n, &e, &v, &r)) {
10350 + n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10352 + n_snprintf(nmask, sizeof(nmask), "%s#%s-%s", n, v, r);
10354 + msgn(2, " Trying %s\n", nmask);
10355 + DBGF("try %s => %s (%s, %s, %s)\n", mask, nmask, n, v, r);
10356 + matched = resolve_package(uctx, ts, nmask, NULL);
10358 + if (!matched && (p = strchr(r, '.'))) { /* try N-[E:]-V-R.ARCH */
10363 + n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10365 + n_snprintf(nmask, sizeof(nmask), "%s#%s-%s", n, v, r);
10366 + msgn(2, " Trying %s (arch=%s)\n", nmask, p);
10367 + matched = resolve_package(uctx, ts, nmask, p);
10374 static int resolve_packages(struct uninstall_ctx *uctx, struct poldek_ts *ts)
10376 @@ -501,52 +569,11 @@
10377 masks = poldek_ts_get_args_asmasks(ts, 1);
10379 for (i=0; i < n_array_size(masks); i++) {
10380 - char *mask = n_array_nth(masks, i);
10383 - msgn(2, "Trying %s\n", mask);
10384 - if (resolve_package(uctx, ts, mask)) {
10390 - if ((p = strchr(mask, '-'))) { /* try N-[E:]V */
10392 - n_strdupap(mask, &tmp);
10394 - p = strrchr(tmp, '-');
10397 - msgn(2, " Trying %s\n", tmp);
10399 - if (resolve_package(uctx, ts, tmp)) {
10402 - } else { /* try N-[E:]V-R */
10403 - const char *n, *v, *r;
10406 + char *mask = n_array_nth(masks, i);
10408 - n_strdupap(mask, &tmp);
10410 - if (poldek_util_parse_nevr(tmp, &n, &e, &v, &r)) {
10412 - n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10414 - n_snprintf(nmask, sizeof(nmask), "%s#%s-%s", n, v, r);
10416 - msgn(2, " Trying %s\n", nmask);
10417 - DBGF("try %s => %s (%s, %s, %s)\n", mask, nmask, n, v, r);
10418 - matched = resolve_package(uctx, ts, tmp);
10424 - logn(LOGERR, _("%s: no such package"), mask);
10427 + if (!resolve_mask(uctx, ts, mask)) {
10428 + logn(LOGERR, _("%s: no such package"), mask);
10433 diff -urN poldek-0.20.org/vfcompr poldek-0.20/vfcompr
10434 --- poldek-0.20.org/vfcompr 2004-09-21 01:47:00.000000000 +0200
10435 +++ poldek-0.20/vfcompr 2006-07-26 20:25:54.343335000 +0200
10441 +# File (de)compression helper script. Used by vfile library when external
10442 +# (de)compression requested ("vfile external compress" config option).
10444 PATH="/bin:/sbin:/usr/bin:/usr/sbin"
10450 - md5file="${src}-vfcompr.md5"
10451 + md5file="${dest}-vfcompr.md5"
10453 if [ -f $dest -a -f "$md5file" ]; then
10454 #echo md5sum --check "$md5file"
10455 diff -urN poldek-0.20.org/vfile/extcompr.c poldek-0.20/vfile/extcompr.c
10456 --- poldek-0.20.org/vfile/extcompr.c 2005-05-15 17:46:59.000000000 +0200
10457 +++ poldek-0.20/vfile/extcompr.c 2006-07-26 20:25:54.343335000 +0200
10459 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10467 @@ -195,7 +195,7 @@
10468 if (uncompr == NULL)
10471 - if (*vfile_verbose)
10472 + if (*vfile_verbose > 0)
10473 vf_loginfo(_("Decompressing %s...\n"), n_basenam(path));
10474 return vf_do_compr(uncompr, "-d", path, destpath);
10476 diff -urN poldek-0.20.org/vfile/fetch.c poldek-0.20/vfile/fetch.c
10477 --- poldek-0.20.org/vfile/fetch.c 2005-07-16 13:56:12.000000000 +0200
10478 +++ poldek-0.20/vfile/fetch.c 2006-07-26 20:25:54.351335500 +0200
10480 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10488 @@ -440,16 +440,12 @@
10490 vf_loginfo(_("Running %s\n"), s);
10496 verbose = *vfile_verbose;
10497 if (fftch->urltypes & VFURL_CDROM) {
10498 p_open_flags |= P_OPEN_KEEPSTDIN;
10499 if (*vfile_verbose < 1)
10500 *vfile_verbose = 1;
10505 diff -urN poldek-0.20.org/vfile/foo.sh poldek-0.20/vfile/foo.sh
10506 --- poldek-0.20.org/vfile/foo.sh 1970-01-01 01:00:00.000000000 +0100
10507 +++ poldek-0.20/vfile/foo.sh 2006-07-26 20:25:54.351335500 +0200
10511 +echo "$0: ARGS: $@"
10512 +while read LINE; do
10513 + echo "grep.sh: $LINE"
10516 diff -urN poldek-0.20.org/vfile/Makefile.am poldek-0.20/vfile/Makefile.am
10517 --- poldek-0.20.org/vfile/Makefile.am 2005-05-15 17:16:13.000000000 +0200
10518 +++ poldek-0.20/vfile/Makefile.am 2006-07-26 20:25:54.351335500 +0200
10523 -VFCURL_SRCS = vfcurl.c # obsoleted
10526 LIBS = -ltrurl -lz @INTLLIBS@
10528 -#if ENABLE_VFILE_CURL
10529 -#VFCURL_SRCS_ = $(VFCURL_SRCS)
10532 INCLUDES = @TRURL_INCLUDE@ -I$(top_srcdir)
10533 AM_CFLAGS = @AM_CFLAGS@
10537 libvfile_la_SOURCES = vfile.c fetch.c vfetch.c vfprogress.c misc.c \
10538 p_open.c extcompr.c vfreq.c vfreq.h \
10540 - vfffmod.c $(VFCURL_SRCS_) \
10541 + vflock.c vfffmod.c \
10542 vopen3.c vopen3.h vfile_intern.h
10544 libvfile_la_LIBADD = vfff/libvfff.la
10546 pkgincludedir = $(includedir)/vfile
10547 pkginclude_HEADERS = vfile.h p_open.h vopen3.h
10549 -noinst_PROGRAMS = vfget test_vopen3 test_vfile
10550 +noinst_PROGRAMS = vfget test_vopen3
10551 TEST_LDADDS = libvfile.la -lutil
10553 vfget_SOURCES = vfget.c
10556 test_vopen3_SOURCES = test_vopen3.c
10557 test_vopen3_LDADD = $(TEST_LDADDS)
10558 -test_vfile_SOURCES = test_vfile.c
10559 -test_vfile_LDADD = $(TEST_LDADDS)
10561 -EXTRA_DIST = libvfile.sym $(VFCURL_SRCS) \
10562 - testcookie.c test_progress.c test_vfile.c
10565 +EXTRA_DIST = libvfile.sym testcookie.c test_progress.c
10568 rm -rf $(distdir)/.deps
10569 diff -urN poldek-0.20.org/vfile/misc.c poldek-0.20/vfile/misc.c
10570 --- poldek-0.20.org/vfile/misc.c 2005-07-17 19:07:40.000000000 +0200
10571 +++ poldek-0.20/vfile/misc.c 2006-07-26 20:25:54.359336000 +0200
10579 #ifdef HAVE_CONFIG_H
10580 # include "config.h"
10590 @@ -71,11 +71,12 @@
10603 if (!isalnum(*p) && strchr("-+/._@!~", *p) == NULL) {
10604 vf_logerr("%s:%c non alphanumeric characters not allowed\n",
10605 diff -urN poldek-0.20.org/vfile/sample.c poldek-0.20/vfile/sample.c
10606 --- poldek-0.20.org/vfile/sample.c 1970-01-01 01:00:00.000000000 +0100
10607 +++ poldek-0.20/vfile/sample.c 2006-07-26 20:25:54.359336000 +0200
10609 +#include <stdio.h>
10610 +#include <stdlib.h>
10612 +#include <stdio.h>
10613 +#include <stdlib.h>
10614 +#include <errno.h>
10615 +#include <signal.h>
10617 +#include "vfile.h"
10619 +void dump_file(const char *url)
10621 + struct vfile *vf;
10624 + vf = vfile_open(url, VFT_STDIO, VFM_RO | VFM_NORM);
10628 + while (fgets(buf, sizeof(buf), vf->vf_stream))
10629 + printf("%s", buf);
10634 +void fetch_ext(const char *url)
10636 + tn_array *protocols;
10638 + protocols = n_array_new(4, NULL, NULL);
10639 + n_array_push(protocols, "http");
10640 + n_array_push(protocols, "ftp");
10641 + if (!vfile_register_ext_handler("wget", protocols,
10642 + "/usr/bin/wget -N -P %d %Pn")) {
10643 + printf("bad handler def\n");
10647 + if (vf_fetch("/tmp", url))
10653 +void fetch(const char *url)
10655 + if (vf_fetch("/tmp", url))
10663 +int main(int argc, char *argv[])
10665 + int verbose = 10;
10667 + vfile_verbose = &verbose;
10668 + vfile_configure(VFILE_CONF_CACHEDIR, "/tmp");
10671 + printf("verbose = %d\n", *vfile_verbose);
10672 + fetch("ftp://localhost/bigg");
10673 + unlink("/tmp/bigg");
10676 +//dump_file("ftp://ftp.pld.org.pl/PLD-1.0/i686/PLD/RPMS/tocfile.lst");
10677 + //fetch_ext("http://sunsite.icm.edu.pl/index.html");
10678 + //dump_file("/tmp/index.html");
10681 diff -urN poldek-0.20.org/vfile/test_retr.sh poldek-0.20/vfile/test_retr.sh
10682 --- poldek-0.20.org/vfile/test_retr.sh 1970-01-01 01:00:00.000000000 +0100
10683 +++ poldek-0.20/vfile/test_retr.sh 2006-07-26 20:25:54.359336000 +0200
10689 + md5sum $1 | awk '{print $1}'
10698 +# echo -e "\n$md0 $fn0\n$md1 $fn1" >&2
10699 + if [ "$md0" != "$md1" ]; then
10705 +TMPDIR=${TMPDIR:-"/tmp"}
10712 + [ -d $dir ] || mkdir $dir
10713 + cp -a $fn $dir || return 1
10715 + bn=$(basename $fn)
10717 + ./vfget $url $TMPDIR || return 1
10719 + files_eq $TMPDIR/$bn $dir/$bn
10725 +uri=$(basename $0)
10731 + echo -n "test $no $@.."
10732 + $@ # > $TMPDIR/$(basename 0).log
10733 + if [ $? -eq 0 ]; then
10740 +HTTP_DIR=/home/httpd/html/tmp
10741 +FTP_DIR=/home/ftp/incoming/tmp
10744 +run_test "01" "do_test" $HTTP_DIR $file http://localhost/tmp
10745 +#run_test "02" "do_test" $FTP_DIR $file ftp://localhost/incoming/tmp
10746 diff -urN poldek-0.20.org/vfile/tests/httpd.py poldek-0.20/vfile/tests/httpd.py
10747 --- poldek-0.20.org/vfile/tests/httpd.py 1970-01-01 01:00:00.000000000 +0100
10748 +++ poldek-0.20/vfile/tests/httpd.py 2006-07-26 20:25:54.367336500 +0200
10752 +import SimpleHTTPServer
10753 +import SocketServer
10757 +Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
10758 +httpd = SocketServer.TCPServer(("127.0.0.1", PORT), Handler)
10760 +print "serving at port", PORT
10761 +httpd.serve_forever()
10762 diff -urN poldek-0.20.org/vfile/tests/Makefile.am poldek-0.20/vfile/tests/Makefile.am
10763 --- poldek-0.20.org/vfile/tests/Makefile.am 1970-01-01 01:00:00.000000000 +0100
10764 +++ poldek-0.20/vfile/tests/Makefile.am 2006-07-26 20:25:54.367336500 +0200
10768 +TESTS = test_vfile
10769 +noinst_PROGRAMS = test_vfile
10770 +test_vfile_SOURCES = test_vfile.c test_misc.c test_file.c
10772 +EXTRA_DIST = utest_mkidx.sh
10774 +test_vfile_INCLUDES= @CHECK_CFLAGS@
10775 +test_vfile_LDADD = @CHECK_LIBS@ ../libvfile.la
10778 + -rm -f *.tmp core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa*
10781 +runtests: poldek_test_conf.conf
10783 + @echo; echo "Running *.sh tests"; \
10785 + for i in utest_*.sh; do \
10786 + [ -f $$i ] || continue; \
10787 + n=$$(expr $$n + 1); \
10788 + echo " running $$i"; \
10790 + if [ $$? -ne 0 ]; then \
10791 + nfails=$$(expr $$nfails + 1); \
10792 + echo " $$i FAILED"; \
10794 + echo " $$i PASSED"; \
10797 + echo "====================================="; \
10798 + echo "$$n tests passed / $$nfails failed"; \
10799 + echo "====================================="
10801 diff -urN poldek-0.20.org/vfile/tests/test_file.c poldek-0.20/vfile/tests/test_file.c
10802 --- poldek-0.20.org/vfile/tests/test_file.c 1970-01-01 01:00:00.000000000 +0100
10803 +++ poldek-0.20/vfile/tests/test_file.c 2006-07-26 20:25:54.367336500 +0200
10807 +int test_append(const char *path, int vft_io)
10809 + struct vfile *vf;
10811 + vf = vfile_open(path, vft_io, VFM_APPEND);
10812 + fail_if(vf == NULL);
10813 + fail_if(n_stream_write(vf->vf_tnstream, "foo\n", 4) != 4);
10818 +START_TEST (test_vfile_append) {
10821 + test_append("tmp.txt.gz", VFT_TRURLIO);
10822 + test_append("tmp.txt.gz", VFT_TRURLIO);
10823 + test_append("tmp.txt.gz", VFT_TRURLIO);
10825 + test_append("tmp.txt", VFT_TRURLIO);
10826 + test_append("tmp.txt", VFT_TRURLIO);
10827 + test_append("tmp.txt", VFT_TRURLIO);
10829 + ec = system("zdiff tmp.txt tmp.txt.gz");
10830 + fail_if(ec != 0);
10836 +struct test_suite test_suite_vfile = {
10839 + { "append", test_vfile_append },
10843 diff -urN poldek-0.20.org/vfile/tests/test.h poldek-0.20/vfile/tests/test.h
10844 --- poldek-0.20.org/vfile/tests/test.h 1970-01-01 01:00:00.000000000 +0100
10845 +++ poldek-0.20/vfile/tests/test.h 2006-07-26 20:25:54.367336500 +0200
10847 +#ifndef VFILE_TEST_H
10848 +#define VFILE_TEST_H
10849 +#include <stdio.h>
10850 +#include <stdlib.h>
10851 +#include <string.h>
10852 +#include <errno.h>
10853 +#include <sys/param.h> /* for PATH_MAX */
10854 +#include <sys/types.h>
10855 +#include <sys/stat.h>
10856 +#include <fcntl.h>
10858 +#include <trurl/nassert.h>
10859 +#include <trurl/nmalloc.h>
10860 +#include <check.h>
10862 +#include "../vfile.h"
10863 +#define fail_ifnot fail_unless
10865 +struct test_case {
10866 + const char *name;
10867 + void (*test_fn)(void);
10870 +struct test_suite {
10871 + const char *name;
10872 + struct test_case cases[];
10876 diff -urN poldek-0.20.org/vfile/tests/test_misc.c poldek-0.20/vfile/tests/test_misc.c
10877 --- poldek-0.20.org/vfile/tests/test_misc.c 1970-01-01 01:00:00.000000000 +0100
10878 +++ poldek-0.20/vfile/tests/test_misc.c 2006-07-26 20:25:54.371336750 +0200
10882 +START_TEST (test_valid_path) {
10883 + char *inv_paths[] = {
10884 + "../ala/ma/kota",
10889 + char *valid_paths[] = {
10894 + "/home/foo/.poldek-cache/_www.rpm.xx.redhat-7.3../.vflock__home.foo..poldek-cache..www.rpm.xx.redhat-7.3..",
10900 + while (inv_paths[i] != NULL) {
10901 + fail_if(vf_valid_path(inv_paths[i]),
10902 + "validated invalid '%s'", inv_paths[i]);
10907 + while (valid_paths[i] != NULL) {
10908 + fail_if(!vf_valid_path(valid_paths[i]),
10909 + "invalid valid '%s'", valid_paths[i]);
10916 +struct test_case test_case_misc = {
10917 + "vf_valid_path", test_valid_path
10919 diff -urN poldek-0.20.org/vfile/tests/test_vfile.c poldek-0.20/vfile/tests/test_vfile.c
10920 --- poldek-0.20.org/vfile/tests/test_vfile.c 1970-01-01 01:00:00.000000000 +0100
10921 +++ poldek-0.20/vfile/tests/test_vfile.c 2006-07-26 20:25:54.379337250 +0200
10926 +#include <check.h>
10929 +//extern struct test_suite test_suite_match;
10931 +extern struct test_case test_case_misc;
10934 +struct test_suite test_suite_vfile;
10935 +struct test_suite *suites[] = {
10936 + &test_suite_vfile,
10940 +extern struct test_case test_case_misc_env;
10941 +struct test_case *misc_cases[] = {
10946 +Suite *make_suite(struct test_suite *tsuite)
10948 + Suite *s = suite_create(tsuite->name);
10951 + while (tsuite->cases[i].name) {
10952 + TCase *tc = tcase_create(tsuite->cases[i].name);
10953 + tcase_add_test(tc, tsuite->cases[i].test_fn);
10954 + suite_add_tcase(s, tc);
10960 +Suite *make_themisc_suite(void)
10962 + Suite *s = suite_create("misc");
10965 + while (misc_cases[i]) {
10966 + TCase *tc = tcase_create(misc_cases[i]->name);
10967 + tcase_add_test(tc, misc_cases[i]->test_fn);
10968 + suite_add_tcase(s, tc);
10975 + tc = tcase_create("op_ts_postconf");
10976 + tcase_add_test(tc, test_op_ts_postconf);
10977 + suite_add_tcase (s, tc);
10983 +int main(int argc, char *argv[])
10985 + int i = 0, nerr = 0;
10987 + //if (argc > 1 && n_str_eq(argv[1], "-v"))
10989 + if (misc_cases[0]) {
10990 + Suite *s = make_themisc_suite();
10991 + SRunner *sr = srunner_create(s);
10992 + srunner_run_all(sr, CK_NORMAL);
10993 + nerr += srunner_ntests_failed(sr);
10994 + srunner_free(sr);
10998 + while (suites[i]) {
10999 + Suite *s = make_suite(suites[i]);
11000 + SRunner *sr = srunner_create(s);
11002 + srunner_run_all(sr, CK_NORMAL);
11003 + nerr += srunner_ntests_failed(sr);
11004 + srunner_free(sr);
11010 + return (nerr == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
11013 diff -urN poldek-0.20.org/vfile/ttest.c poldek-0.20/vfile/ttest.c
11014 --- poldek-0.20.org/vfile/ttest.c 1970-01-01 01:00:00.000000000 +0100
11015 +++ poldek-0.20/vfile/ttest.c 2006-07-26 20:25:54.379337250 +0200
11017 +#include <stdio.h>
11018 +#include <stdlib.h>
11020 +#include <stdio.h>
11021 +#include <stdlib.h>
11024 +#include "vfile.h"
11026 +void fetch(const char *url)
11028 + vf_fetch("/tmp", url);
11032 +int main(int argc, char *argv[])
11035 +// const char *up = "/a/b/c/d/e/f/ftp.pld.org.pl/PLD-1.0/i686/PLD/RPMS/kernel-video-nvidia-1.0.2880-1@2.2.20_18.i686.rpm";
11037 + const char *up = "ftp://mis:dupa@smok/a/b/c/d/e/f/ftp.pld.org.pl/PLD-1.0/i686/PLD/RPMS/kernel-video-nvidia-1.0.2880-1kldd4443.i686.rpm";
11040 + const char *u = "ftp://ftp.pld.org.pl/PLD-1.0/i686/PLD/RPMS/kernel-video-nvidia-1.0.2880-1@2.2.20_18.i686.rpm";
11042 + const char *uu = "/a/v/b/ftp:,,ftp.pld.org.pl,PLD-1.0,i686,PLD,RPMS,kernel-video-nvidia-1.0.2880-1@2.2.20_18.i686.rpm";
11044 + vfile_configure(VFILE_CONF_CACHEDIR, ",tmp");
11045 + vfile_verbose = &verbose;
11047 + printf("%s\n", vf_url_slim_s(up, 0));
11048 + printf("%s\n", vf_url_slim_s(u, 0));
11049 + printf("%s\n", vf_url_slim_s(uu, 0));
11052 + fetch("ftp://bb/PLD/i686/PLD/RPMS/glibc-2.2.3-3.i686.rpm");
11053 + fetch("ftp://bb/PLD/i686/PLD/RPMS/portmap-5beta-6.i686.rpm");
11054 + fetch("ftp://bb/PLD/i686/PLD/RPMS/nfs-utils-0.3.1-1.i686.rpm");
11057 diff -urN poldek-0.20.org/vfile/vfetch.c poldek-0.20/vfile/vfetch.c
11058 --- poldek-0.20.org/vfile/vfetch.c 2005-09-11 15:07:07.000000000 +0200
11059 +++ poldek-0.20/vfile/vfetch.c 2006-07-26 20:25:54.379337250 +0200
11067 #ifdef HAVE_CONFIG_H
11068 # include "config.h"
11073 -#include <rpm/rpmlib.h>
11074 -#include <rpm/rpmio.h>
11075 -#include <rpm/rpmurl.h>
11076 -#include <rpm/rpmmacro.h>
11077 #include <trurl/nassert.h>
11078 #include <trurl/nstr.h>
11079 #include <trurl/nhash.h>
11080 @@ -299,7 +295,7 @@
11081 snprintf(url, sizeof(url), req->url);
11082 vf_request_free(req);
11084 - rc = vf_fetch(req->url, destdir, flags, NULL);
11085 + rc = vf_fetch(url, destdir, flags, NULL);
11089 diff -urN poldek-0.20.org/vfile/vfff/vfff.c poldek-0.20/vfile/vfff/vfff.c
11090 --- poldek-0.20.org/vfile/vfff/vfff.c 2005-05-15 14:50:30.000000000 +0200
11091 +++ poldek-0.20/vfile/vfff/vfff.c 2006-07-26 20:25:54.387337750 +0200
11094 - Copyright (C) 2002 Pawel A. Gajda <mis@k2.net.pl>
11095 + Copyright (C) 2002 - 2005 Pawel A. Gajda <mis@k2.net.pl>
11097 This program is free software; you can redistribute it and/or modify
11098 it under the terms of the GNU General Public License version 2 as
11099 @@ -10,24 +10,24 @@
11100 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
11106 +#include <arpa/inet.h>
11111 +#include <signal.h>
11112 #include <stdarg.h>
11114 #include <stdlib.h>
11115 #include <string.h>
11117 #include <sys/socket.h>
11118 #include <sys/time.h>
11119 #include <sys/types.h>
11121 #include <unistd.h>
11122 -#include <signal.h>
11124 -#include <arpa/inet.h>
11125 #include <trurl/nbuf.h>
11126 #include <trurl/nassert.h>
11127 #include <trurl/nhash.h>
11128 @@ -39,11 +39,11 @@
11130 #include "vfile/vfile_intern.h"
11132 +#define VCN_ALIVE_TTL 10
11134 extern void vhttp_vcn_init(struct vcn *cn);
11135 extern void vftp_vcn_init(struct vcn *cn);
11139 static char errmsg[512] = { '\0' };
11140 static int verbose = 0;
11142 @@ -146,8 +146,6 @@
11146 - vfile_sigint_reached(1); /* just reset */
11148 sockfd = socket(resp->ai_family, resp->ai_socktype, resp->ai_protocol);
11151 @@ -173,6 +171,8 @@
11154 *af = resp->ai_family;
11156 + //DBGF("sigint reached %d, errno %m\n", vfff_sigint_reached());
11160 @@ -321,6 +321,15 @@
11161 int vcn_is_alive(struct vcn *cn)
11165 + if (cn->ts_is_alive > 0) {
11166 + time_t ts = time(0);
11168 + if (ts - cn->ts_is_alive < VCN_ALIVE_TTL)
11172 + cn->ts_is_alive = time(0);
11173 return cn->m_is_alive(cn);
11176 diff -urN poldek-0.20.org/vfile/vfff/vfff.h poldek-0.20/vfile/vfff/vfff.h
11177 --- poldek-0.20.org/vfile/vfff/vfff.h 2005-05-15 17:47:05.000000000 +0200
11178 +++ poldek-0.20/vfile/vfff/vfff.h 2006-07-26 20:25:54.387337750 +0200
11183 Copyright (C) 2000 - 2003 Pawel A. Gajda <mis@pld.org.pl>
11187 void (*m_free)(void *resp);
11190 + time_t ts_is_alive;
11193 struct vcn *vcn_new(int proto, const char *host, int port,
11194 diff -urN poldek-0.20.org/vfile/vfile.c poldek-0.20/vfile/vfile.c
11195 --- poldek-0.20.org/vfile/vfile.c 2005-10-07 21:00:19.000000000 +0200
11196 +++ poldek-0.20/vfile/vfile.c 2006-07-26 20:25:54.387337750 +0200
11204 #ifdef HAVE_CONFIG_H
11205 # include "config.h"
11210 -#include <rpm/rpmlib.h>
11211 -#include <rpm/rpmio.h>
11212 -#include <rpm/rpmurl.h>
11213 -#include <rpm/rpmmacro.h>
11214 #include <trurl/nassert.h>
11215 #include <trurl/nstr.h>
11216 #include <trurl/nhash.h>
11217 @@ -171,12 +167,12 @@
11223 case VFILE_CONF_STUBBORN_NRETRIES:
11224 v = va_arg(ap, int);
11226 - vfile_conf.nretries = v;
11229 + vfile_conf.nretries = v;
11232 case VFILE_CONF_SIGINT_REACHED: