]> git.pld-linux.org Git - packages/poldek.git/blob - poldek-20060726cvs.patch
- playing with new poldek from cvs
[packages/poldek.git] / poldek-20060726cvs.patch
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
4 @@ -11,7 +11,7 @@
5  */
6  
7  /*
8 -  $Id$
9 +  $Id$
10  */
11  
12  #include <limits.h>
13 @@ -42,6 +42,8 @@
14  #include "pkgset.h"
15  #include "pm/pm.h"
16  
17 +extern int poldek_conf_MULTILIB;
18 +
19  #define ARG_PACKAGES_SETUPDONE    (1 << 0)
20  
21  /* @VIRTUAL [DEFAULT_MASK [EVR]] */
22 @@ -227,36 +229,6 @@
23  //        n_hash_size(aps->resolved_caps);
24  }
25  
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) 
29 -{
30 -    const char *name, *ver, *rel, *p;
31 -    char nmask[1024], e[32] = "", *tmp;
32 -    int32_t epoch = 0;
33 -    int n;
34 -    
35 -    n_strdupap(mask, &tmp);
36 -    if (!poldek_util_parse_nevr(tmp, &name, &epoch, &ver, &rel))
37 -        return NULL;
38 -    
39 -    p = ver;          /* check if it is really version */
40 -    while (*p) {
41 -        if (isdigit(*p))
42 -            break;
43 -        p++;
44 -    }
45 -    
46 -    if (*p == '\0')    /* no digits => part of name propably */
47 -        return NULL;
48 -            
49 -    if (epoch)
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);
53 -}
54 -#endif
55 -
56  tn_array *arg_packages_get_masks(struct arg_packages *aps, int hashed)
57  {
58      tn_array *masks;
59 @@ -264,19 +236,11 @@
60  
61      masks = n_array_clone(aps->package_masks);
62      for (i=0; i < n_array_size(aps->package_masks); i++) {
63 -        const char *mask;
64 -
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  */
68 -            char *nmask;
69 -            if ((nmask = mask2evrhashedmask(mask)))
70 -                mask = nmask;
71 -#endif            
72 -        }
73 +        const char *mask = n_array_nth(aps->package_masks, i);
74          n_array_push(masks, n_strdup(mask));
75      }
76 -    
77 +
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] = "";
82 @@ -284,9 +248,13 @@
83          
84          if (pkg->epoch)
85              snprintf(e, sizeof(e), "%d:", pkg->epoch);
86 -        
87 +
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);
91 +
92 +        if (0 && poldek_conf_MULTILIB && pkg_arch(pkg))
93 +            n += n_snprintf(&mask[n], sizeof(mask) - n, ".%s", pkg_arch(pkg));
94 +        
95          n_array_push(masks, n_strdupl(mask, n));
96      }
97                     
98 @@ -532,7 +500,7 @@
99          if (matches[j] == 0 && (flags & ARG_PACKAGES_RESOLV_MISSINGOK) == 0) {
100              logn(LOGERR, _("%s: no such package"), mask);
101              rc = 0;
102 -        }
103 +        } 
104  
105          if ((flags & ARG_PACKAGES_RESOLV_UNAMBIGUOUS) == 0 && matches_bycmp[j] > 1) {
106              int pri = (flags & ARG_PACKAGES_RESOLV_EXACT) ? LOGERR : LOGWARN;
107 @@ -675,7 +643,7 @@
108  int arg_packages_resolve(struct arg_packages *aps, tn_array *avpkgs,
109                           struct pkgset *ps, unsigned flags)
110  {
111 -    int i, j, nmasks, rc = 0;
112 +    int i, j, nmasks, rc = 1;
113  
114      n_hash_clean(aps->resolved_caps);
115      n_array_clean(aps->resolved_pkgs);
116 @@ -697,12 +665,16 @@
117          }
118      }
119      
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))
124 +        rc = 0;
125 +
126 +    if (!resolve_masks(aps->resolved_pkgs, aps, avpkgs, ps, flags))
127 +        rc = 0;
128      
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))
133 +            rc = 0;
134 +    }
135  
136      if (!rc) {
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
141 @@ -1,4 +1,4 @@
142 -/* $Id$ */
143 +/* $Id$ */
144  #ifndef POLDEK_USRSET_H
145  #define POLDEK_USRSET_H
146  
147 @@ -15,6 +15,7 @@
148  
149  void arg_packages_clean(struct arg_packages *aps);
150  int arg_packages_size(struct arg_packages *aps);
151 +
152  tn_array *arg_packages_get_masks(struct arg_packages *aps, int hashed);
153  
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
158 @@ -11,7 +11,7 @@
159  */
160  
161  /*
162 -  $Id$
163 +  $Id$
164  */
165  
166  #ifdef HAVE_CONFIG_H
167 @@ -92,13 +92,18 @@
168          *p++ = 'a' + i;
169          i++;
170      }
171 +    *p++ = 'Q';
172      
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]"),
175 +        'a' + default_i); 
176      a = poldek_term_ask(STDIN_FILENO, validchrs, NULL);
177      msg(-1, "_\n");
178      
179      if (a == '\n')
180          return default_i;
181 +
182 +    if (a == 'Q')
183 +        return -1;
184      
185      a -= 'a';
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
190 @@ -7,13 +7,13 @@
191  */
192  
193  /*
194 -  $Id$
195 +  $Id$
196  */
197  
198 +#include <errno.h>
199  #include <limits.h>
200  #include <stdint.h>
201  #include <string.h>
202 -#include <errno.h>
203  #include <unistd.h>
204  
205  #include <trurl/nassert.h>
206 @@ -24,6 +24,7 @@
207  #include "i18n.h"
208  #include "log.h"
209  #include "cli.h"
210 +#include "cmd_chain.h"
211  #include "conf.h"
212  
213  
214 @@ -33,7 +34,7 @@
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
220  };
221  
222  static int alias(struct cmdctx *cmdctx) 
223 @@ -53,6 +54,7 @@
224      if (cmd->flags & COMMAND_IS_ALIAS) {
225          n_cfree(&cmd->cmdline);
226          n_cfree(&cmd->name);
227 +        n_cfree(&cmd->aliasto);
228          memset(cmd, 0, sizeof(*cmd));
229      }
230  }
231 @@ -68,7 +70,10 @@
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;
239      return alias;
240  }
241  
242 @@ -77,17 +82,18 @@
243  int add_alias(struct poclidek_ctx *cctx,
244                const char *aliasname, const char *cmdline)
245  {
246 -       struct poclidek_cmd          *cmd;
247 -    struct poclidek_cmd          tmpcmd;
248 -
249 +    struct poclidek_cmd *cmd, tmpcmd;
250 +    int rc = 1;
251      
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);
258          
259      } else {
260          if ((cmd->flags & COMMAND_IS_ALIAS) == 0) {
261              logn(LOGWARN, _("%s: alias could not shadow a command"), aliasname);
262 +            rc = 0;
263              
264          } else {
265              if (poldek_verbose() > 1)
266 @@ -102,15 +108,61 @@
267         }
268      
269         n_array_sort(cctx->commands);
270 -       return 1;
271 +       return rc;
272 +}
273 +
274 +/* determine to what command alias is aliased */
275 +static char *alias_to(struct poclidek_ctx *cctx, const char *cmdline) 
276 +{
277 +    tn_array *ents;
278 +    char *p, *cmd = NULL;
279 +
280 +    if (strchr(cmdline, '|') == NULL) {
281 +        cmd = n_strdup(cmdline);
282 +        
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;
287 +        
288 +        cmd = n_strdup(ent->cmd->name);
289 +        n_array_free(ents);
290 +    }
291 +
292 +    if (cmd == NULL)
293 +        return NULL;
294 +
295 +    if ((p = strchr(cmd, ' ')))
296 +        *p = '\0';
297 +
298 +    return cmd;
299  }
300  
301 +static void find_aliased_commands(struct poclidek_ctx *cctx) 
302 +{
303 +    struct poclidek_cmd *cmd;
304 +    int i;
305 +    
306 +    for (i=0; i < n_array_size(cctx->commands); i++) {
307 +        cmd = n_array_nth(cctx->commands, i);
308 +        
309 +        if ((cmd->flags & COMMAND_IS_ALIAS) == 0)
310 +            continue;
311 +
312 +        cmd->aliasto = alias_to(cctx, cmd->cmdline);
313 +        if (cmd->aliasto == NULL)
314 +            logn(LOGWARN, _("%s: could not determine aliased command"),
315 +                 cmd->name);
316 +        else
317 +            msgn(3, "%s => aliased %s", cmd->name, cmd->aliasto);
318 +    }
319 +}
320  
321  int poclidek_load_aliases(struct poclidek_ctx *cctx, const char *path) 
322  {
323      tn_hash *aliases_htcnf, *ht;
324      tn_array *keys;
325 -    int i;
326 +    int i, n = 0;
327      
328      if (access(path, R_OK) != 0)
329          return 0;
330 @@ -126,16 +178,22 @@
331          const char *name, *cmdline;
332  
333          name = n_array_nth(keys, i);
334 +        if (*name == '_')       /* config macro */
335 +            continue;
336 +        
337          if ((cmdline = poldek_conf_get(ht, name, NULL)))
338 -            add_alias(cctx, name, cmdline);
339 +            if (add_alias(cctx, name, cmdline))
340 +                n++;
341      }
342      
343      n_array_free(keys);
344      n_hash_free(aliases_htcnf);
345 +    
346 +    if (n)
347 +        find_aliased_commands(cctx);
348 +        
349      return 1;
350  }
351  
352  
353  
354 -
355 -
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
359 @@ -11,7 +11,7 @@
360  */
361  
362  /*
363 -  $Id$
364 +  $Id$
365  */
366  
367  #include <sys/param.h>          /* for PATH_MAX */
368 @@ -30,14 +30,14 @@
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
374  };
375  
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
382  };
383  
384  
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
388 @@ -1,5 +1,5 @@
389  /*
390 -  Copyright (C) 2000 - 2004 Pawel A. Gajda <mis@pld.org.pl>
391 +  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
392  
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
395 @@ -11,23 +11,23 @@
396  */
397  
398  /*
399 -  $Id$
400 +  $Id$
401  */
402  
403  #ifdef HAVE_CONFIG_H
404  # include "config.h"
405  #endif
406  
407 +#include <signal.h>
408 +#include <stdint.h>
409  #include <stdio.h>
410  #include <stdlib.h>
411 -#include <stdint.h>
412  #include <string.h>
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>
420 -#include <signal.h>
421 +#include <sys/types.h>
422  #include <time.h>
423  #include <argp.h>
424  
425 @@ -161,14 +161,22 @@
426      
427      if (cmd->flags & COMMAND_IS_ALIAS)
428          return NULL;
429 -    
430 +
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);
434 +        int found = 0;
435 +        
436          if ((cm->flags & COMMAND_IS_ALIAS) == 0)
437              continue;
438 +        
439 +        if (cm->aliasto && n_str_eq(cmd->name, cm->aliasto))
440 +            found = 1;
441 +        
442 +        else if (strncmp(nam, cm->cmdline, n) == 0)
443 +            found = 1;
444  
445 -        if (strncmp(nam, cm->cmdline, n) == 0) {
446 +        if (found) {
447              if (aliases == NULL)
448                  aliases = n_array_new(4, NULL, (tn_fn_cmp)command_cmp);
449              n_array_push(aliases, cm);
450 @@ -316,45 +324,50 @@
451      return *fmt == '!';
452  }
453  
454 -int cmdctx_printf(struct cmdctx *cmdctx, const char *fmt, ...)
455 +static
456 +int do_cmdctx_printf(struct cmdctx *cmdctx, int color, const char *fmt,
457 +                     va_list args)
458  {
459 -    va_list args;
460 -    int n = 0;
461 +    int is_ctrl, n = 0;
462      
463 -    if (cmdctx_isctrlmsg(fmt)) {
464 +    if ((is_ctrl = cmdctx_isctrlmsg(fmt))) {
465          if (cmdctx->rtflags & CMDCTX_NOCTRLMSGS)
466              return 1;
467          fmt++;
468      }
469  
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);
475 +        
476 +    } else {
477          n = cmd_pipe_vprintf(cmdctx->pipe_right, fmt, args);
478 -    else 
479 -        n = vfprintf(stdout, fmt, args);
480 +    }
481  
482 -    va_end(args);
483      return n;
484 +}
485 +
486 +int cmdctx_printf(struct cmdctx *cmdctx, const char *fmt, ...)
487 +{
488 +    va_list args;
489 +    int n;
490      
491 +    va_start(args, fmt);
492 +    n = do_cmdctx_printf(cmdctx, 0, fmt, args);
493 +    va_end(args);
494 +    
495 +    return n;
496  }
497  
498  int cmdctx_printf_c(struct cmdctx *cmdctx, int color, const char *fmt, ...)
499  {
500      va_list args;
501 -    int n = 0;
502 -
503 -    if (cmdctx_isctrlmsg(fmt)) {
504 -        if (cmdctx->rtflags & CMDCTX_NOCTRLMSGS)
505 -            return 1;
506 -        fmt++;
507 -    }
508 -
509 +    int n;
510 +    
511      va_start(args, fmt);
512 -    if (cmdctx->pipe_right)
513 -        n = cmd_pipe_vprintf(cmdctx->pipe_right, fmt, args);
514 -    else 
515 -        n = poldek_term_vprintf_c(color, fmt, args);
516 -
517 +    n = do_cmdctx_printf(cmdctx, color, fmt, args);
518 +    va_end(args);
519 +    
520      return n;
521  }
522  
523 @@ -577,25 +590,22 @@
524      return argv;
525  }
526  
527 -tn_array *poclidek_prepare_cmdline(struct poclidek_ctx *cctx, const char *line);
528 -
529 -
530 +/* executes command chain (a pipeline) */
531  static
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)
534  {
535      struct cmdctx  cmdctx;
536      char **argv;
537 -    int rc = 0;
538 +    int rc = 0, runit = 1;
539      
540      DBGF("ent %s, %d, %p\n", ent->cmd->name, n_array_size(ent->a_argv),
541           ent->next_piped);
542 -
543 -    
544      
545      memset(&cmdctx, 0, sizeof(cmdctx));
546      cmdctx.cmd = ent->cmd;
547      cmdctx.cctx = cctx;
548 +
549      if ((cmdctx.ts = ts) == NULL)
550          cmdctx.ts = poldek_ts_new(cctx->ctx, 0);
551  
552 @@ -609,7 +619,7 @@
553          cmdctx.pipe_right = ent->pipe_right;
554      }
555  
556 -    if (ent->prev_piped) {
557 +    if (ent->prev_piped) {      /* | cmd */
558          struct cmd_pipe *pipe;
559          tn_array *pipe_args = NULL;
560  
561 @@ -624,9 +634,15 @@
562              else
563                  pipe_args = cmd_pipe_xargs(pipe, CMD_PIPE_CTX_ASCII);
564              
565 -            if (pipe_args) {
566 +            if (pipe_args == NULL) {
567 +                runit = 0;      /* do not execute command if pipe is empty */
568 +                rc = 0;
569 +                goto l_end;
570 +                
571 +            } else {
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);
575              }
576          }
577      }
578 @@ -636,11 +652,12 @@
579      a_argv_to_argv(ent->a_argv, argv);
580  
581      rc = do_exec_cmd_ent(&cmdctx, n_array_size(ent->a_argv), argv);
582 -    
583 +
584 + l_end:
585      if (ts == NULL) 
586          poldek_ts_free(cmdctx.ts);
587  
588 -    if (ent->next_piped)
589 +    if (runit && ent->next_piped)
590          return poclidek_exec_cmd_ent(cctx, ts, ent->next_piped, cmd_pipe);
591      
592      return rc;
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
596 @@ -1,32 +1,37 @@
597 -/* 
598 -  Copyright (C) 2000 - 2004 Pawel A. Gajda (mis@k2.net.pl)
599
600 +/*
601 +  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
602 +
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).
608 +
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.
612  */
613  
614  /*
615 -  $Id$
616 +  $Id$
617  */
618  
619  #ifdef HAVE_CONFIG_H
620  # include "config.h"
621  #endif
622  
623 +#include <stdint.h>
624  #include <stdio.h>
625  #include <stdlib.h>
626 -#include <stdint.h>
627  #include <string.h>
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>
634  
635  #include <trurl/trurl.h>
636  #include <sigint/sigint.h>
637  
638  #include "i18n.h"
639 +#include "poldek_util.h"
640  #define ENABLE_TRACE 0
641  #include "log.h"
642  #include "cli.h"
643 @@ -39,7 +44,8 @@
644  
645  static
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,
649 +                                        tn_array *a_argv)
650  {
651      struct cmd_chain_ent *ent;
652      ent = n_malloc(sizeof(*ent));
653 @@ -207,6 +213,58 @@
654      return cmd;
655  }
656  
657 +static const char *apply_params(const char *cmdline, tn_array *a_argv)
658 +{
659 +    tn_hash *vars;
660 +    tn_array *new_a_argv = NULL;
661 +    char newline[1024];
662 +    int i;
663 +
664 +    n_assert(n_array_size(a_argv) > 0);
665 +
666 +    vars = n_hash_new(n_array_size(a_argv) < 16 ? 16:n_array_size(a_argv) * 2,
667 +                      NULL);
668 +
669 +    for (i=0; i < n_array_size(a_argv); i++) {
670 +        char no[64];
671 +        n_snprintf(no, sizeof(no), "%d", i);
672 +        
673 +        n_hash_insert(vars, no, n_array_nth(a_argv, i));
674 +    }
675 +    
676 +    cmdline = poldek_util_expand_vars(newline, sizeof(newline),
677 +                                      cmdline, '%', vars,
678 +                                      POLDEK_UTIL_EXPANDVARS_RMUSED);
679 +    
680 +    if (strchr(cmdline, '%')) {/* still unexpanded vars */
681 +        cmdline = NULL;
682 +        goto l_end;
683 +    }
684 +    
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);
688 +
689 +    i = 0;
690 +    while (n_array_size(a_argv) > 0) {
691 +        char no[64], *arg = n_array_shift(a_argv);
692 +
693 +        n_snprintf(no, sizeof(no), "%d", i++);
694 +        if (n_hash_exists(vars, no))
695 +            n_array_push(new_a_argv, arg);
696 +        else
697 +            free(arg);
698 +    }
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);
703 +
704 +    
705 + l_end:
706 +    n_hash_free(vars);
707 +    return cmdline;
708 +}
709  
710  static
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);
715      
716 -    } else {
717 +    } else {                    /* alias */
718          const char *cmdline;
719  
720          n_assert(cmd->cmdline);
721          cmdline = cmd->cmdline;
722 +
723 +        if (cmd->flags & COMMAND_PARAMETERIZED) {
724 +            if (n_array_size(a_argv) == 0) {
725 +                logn(LOGERR, _("%s: alias needs an arguments"), acmd);
726 +                return NULL;
727 +            }
728 +            
729 +            if ((cmdline = apply_params(cmdline, a_argv)) == NULL) {
730 +                logn(LOGERR,
731 +                     _("%s: apply arguments failed (not enough arguments?)"),
732 +                     acmd);
733 +                return NULL;
734 +            }
735 +        }
736 +        msgn(2, "%s => %s\n", acmd, cmdline); 
737          
738          if (n_array_size(a_argv) > 1) { /* any arguments? -> pass them */
739              char *line;
740 @@ -247,7 +320,7 @@
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; 
747              len++;
748          
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
752 @@ -1,4 +1,4 @@
753 -/* $Id$ */
754 +/* $Id$ */
755  #ifndef  POCLIDEK_CMD_H
756  #define  POCLIDEK_CMD_H
757  
758 @@ -46,8 +46,9 @@
759  #define COMMAND_HIDDEN       (1 << 5) /* help doesn't displays it */
760  #define COMMAND_SELFARGS     (1 << 7) /* cmd parses its args itself */
761  
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)
767  
768  #define COMMAND_PIPEABLE_LEFT  (1 << 13)
769  #define COMMAND_PIPEABLE_RIGTH (1 << 14)
770 @@ -79,6 +80,7 @@
771      char                 *extra_help;
772  
773      char                 *cmdline;   /* alias content */
774 +    char                 *aliasto;   /* if alias, a cmd name is aliased to */
775      int                  _seqno;
776      void                 (*_free)(struct poclidek_cmd *);
777  };
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
781 @@ -11,7 +11,7 @@
782  */
783  
784  /*
785 -  $Id$
786 +  $Id$
787  */
788  
789  #ifdef HAVE_CONFIG_H
790 @@ -181,6 +181,9 @@
791              xargs_packages(p, args);
792      }
793      
794 +    if (n_array_size(args) == 0)
795 +        n_array_cfree(&args);
796 +    
797      return args;
798  }
799  
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
803 @@ -11,7 +11,7 @@
804  */
805  
806  /*
807 -  $Id$
808 +  $Id$
809  */
810  
811  #ifdef HAVE_CONFIG_H
812 @@ -30,7 +30,6 @@
813  #include <signal.h>
814  #include <time.h>
815  #include <argp.h>
816 -#include <time.h>
817  
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
823 @@ -11,7 +11,7 @@
824  */
825  
826  /*
827 -  $Id$
828 +  $Id$
829  */
830  
831  #ifdef HAVE_CONFIG_H
832 @@ -140,6 +140,12 @@
833      return strcmp(ent->name, name);
834  }
835  
836 +static 
837 +int pkg_dent_cmp_ptr(struct pkg_dent *e1, struct pkg_dent *e2)
838 +{
839 +    return e1 != e2;
840 +}
841 +
842  
843  int pkg_dent_cmp_btime(struct pkg_dent *ent1, struct pkg_dent *ent2)
844  {
845 @@ -542,17 +548,15 @@
846  
847      if ((ents = poclidek_get_dent_ents(cctx, dir)) == NULL)
848          return NULL;
849 -    
850 -    pkgs = n_array_new(n_array_size(ents), (tn_fn_free)pkg_free,
851 -                       (tn_fn_cmp)pkg_nvr_strcmp);
852 -    
853 +
854 +    pkgs = pkgs_array_new_ex(n_array_size(ents), pkg_cmp_name_evr_rev);
855 +
856      for (i=0; i < n_array_size(ents); i++) {
857          struct pkg *pkg;
858  
859          if ((pkg = pkg_dent_getpkg(n_array_nth(ents, i))))
860              n_array_push(pkgs, pkg_link(pkg));
861      }
862 -    n_array_ctl(pkgs, TN_ARRAY_AUTOSORTED);
863      n_array_sort(pkgs);
864      return pkgs;
865  }
866 @@ -641,6 +645,7 @@
867              } /* else */
868              
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));
872                  matches[j]++;
873              } 
874 @@ -666,7 +671,7 @@
875  
876      
877      n_array_sort(ments);
878 -    n_array_uniq(ments);
879 +    n_array_uniq_ex(ments, (tn_fn_cmp)pkg_dent_cmp_ptr);
880      n_array_free(masks);
881      
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
886 @@ -11,7 +11,7 @@
887  */
888  
889  /*
890 -  $Id$
891 +  $Id$
892  */
893  
894  #include <limits.h>
895 @@ -99,7 +99,7 @@
896      "desc", N_("PACKAGE..."), N_("Display packages info"), 
897      options, parse_opt,
898      NULL, desc,
899 -    NULL, NULL, NULL, NULL, 0, 0
900 +    NULL, NULL, NULL, NULL, NULL, 0, 0
901  };
902  
903  static
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
907 @@ -11,7 +11,7 @@
908  */
909  
910  /*
911 -  $Id$
912 +  $Id$
913  */
914  
915  #include <string.h>
916 @@ -34,7 +34,7 @@
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
922  };
923  
924  
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
928 @@ -11,7 +11,7 @@
929  */
930  
931  /*
932 -  $Id$
933 +  $Id$
934  */
935  
936  #include <limits.h>
937 @@ -37,20 +37,19 @@
938  #define OPT_GET_DIR          (1 << 1) /* cmd_state->flags */
939  
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 },
945  };
946  
947 -
948  struct poclidek_cmd command_get = {
949      0, 
950      "get", N_("PACKAGE..."), N_("Download packages"), 
951      options, parse_opt,
952 -    NULL, get, NULL, NULL, NULL, 0, 5, 0
953 +    NULL, get, NULL, NULL, NULL, NULL, 0, 5, 0
954  };
955  
956  
957 -
958  static
959  error_t parse_opt(int key, char *arg, struct argp_state *state)
960  {
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
964 @@ -1,5 +1,5 @@
965  /*
966 -  Copyright (C) 2000 - 2002 Pawel A. Gajda <mis@k2.net.pl>
967 +  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
968  
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
971 @@ -11,11 +11,10 @@
972  */
973  
974  /*
975 -  $Id$
976 +  $Id$
977  */
978  
979  #include <string.h>
980 -#include <time.h>
981  
982  #include <trurl/trurl.h>
983  
984 @@ -28,7 +27,7 @@
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
990  };
991  
992  static
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
996 @@ -7,7 +7,7 @@
997  */
998  
999  /*
1000 -  $Id$
1001 +  $Id$
1002  */
1003  
1004  #include <limits.h>
1005 @@ -64,6 +64,7 @@
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)
1010  
1011  static struct argp_option options[] = {
1012  {0, 'I', 0, 0, N_("Install, not upgrade packages"), OPT_GID },
1013 @@ -184,8 +185,11 @@
1014  
1015  {"parsable-tr-summary", OPT_INST_PARSABLETS, 0, 0,
1016       N_("Print installation summary in parseable form"), OPT_GID },
1017 -                                                
1018 -    { 0, 0, 0, 0, 0, 0 },
1019 +
1020 +{"mkdir", OPT_INST_MKDIR, 0, OPTION_HIDDEN, /* legacy */
1021 +     "make %{_dbpath} directory if not exists", OPT_GID },
1022 +    
1023 +{ 0, 0, 0, 0, 0, 0 },
1024  };
1025  
1026  
1027 @@ -194,7 +198,7 @@
1028      COMMAND_PIPEABLE_LEFT | COMMAND_PIPE_XARGS | COMMAND_PIPE_PACKAGES, 
1029      "install", N_("PACKAGE..."), N_("Install packages"), 
1030      options, parse_opt,
1031 -    NULL, install, NULL, NULL, NULL, NULL, 0, 0
1032 +    NULL, install, NULL, NULL, NULL, NULL, NULL, 0, 0
1033  };
1034  
1035  static struct argp cmd_argp = {
1036 @@ -340,6 +344,9 @@
1037              ts->setop(ts, POLDEK_OP_PARSABLETS, 1);
1038              break;
1039  
1040 +        case OPT_INST_MKDIR:
1041 +            break;              /* ignored, directory is created by default */
1042 +            
1043          case 'I':               /* silently ignore */
1044              break;
1045  
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
1049 @@ -11,7 +11,7 @@
1050  */
1051  
1052  /*
1053 -  $Id$
1054 +  $Id$
1055  */
1056  
1057  #include <string.h>
1058 @@ -19,6 +19,7 @@
1059  
1060  #include "sigint/sigint.h"
1061  #include "poldek_util.h"
1062 +#include "pkgcmp.h"
1063  #include "i18n.h"
1064  #include "pkgu.h"
1065  #include "cli.h"
1066 @@ -71,7 +72,7 @@
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
1072  };
1073  
1074  
1075 @@ -159,11 +160,9 @@
1076                     char *evr, size_t size) 
1077  {
1078      struct pkg *pkg = NULL;
1079 -    char name[256];
1080      int n, found = 0;
1081  
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);
1085  
1086      if (n == -1)
1087          return 0;
1088 @@ -213,6 +212,9 @@
1089          return NULL;
1090      }
1091  
1092 +    n_assert(n_array_ctl_get_cmpfn(cmpto_pkgs) ==
1093 +             (tn_fn_cmp)pkg_cmp_name_evr_rev);
1094 +
1095      ls_ents2 = n_array_clone(ls_ents);
1096      
1097      for (i=0; i < n_array_size(ls_ents); i++) {
1098 @@ -243,6 +245,9 @@
1099          if (sigint_reached())
1100              break;
1101      }
1102 +
1103 +    if (cmpto_pkgs)
1104 +        n_array_free(cmpto_pkgs);
1105      
1106      return ls_ents2;
1107  }
1108 @@ -294,6 +299,10 @@
1109              n_array_sort_ex(ls_ents, cmpf);
1110          
1111          rc = do_ls(ls_ents, cmdctx, evrs);
1112 +        
1113 +        if (cmpf)
1114 +            n_array_sort(ls_ents);  /* sort them back, ls_ents could be reference
1115 +                                       to global packages array */
1116      }
1117      
1118  
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
1122 @@ -11,7 +11,7 @@
1123  */
1124  
1125  /*
1126 -  $Id$
1127 +  $Id$
1128  */
1129  
1130  #ifdef HAVE_CONFIG_H
1131 @@ -26,7 +26,6 @@
1132  #include <sys/types.h>
1133  #include <sys/stat.h> 
1134  #include <unistd.h>
1135 -#include <time.h>
1136  
1137  #include <trurl/trurl.h>
1138  
1139 @@ -116,8 +115,8 @@
1140  {"upconf", OPT_UPCONF, 0, 0, N_("Update remote configuration files (if any)"),
1141       OPT_GID },
1142  
1143 -{"version", OPT_BANNER, 0, 0, N_("Display program version information and exit"),
1144 -     OPT_GID },
1145 +{"version", OPT_BANNER, 0, OPTION_HIDDEN,
1146 +     N_("Display program version information and exit"), OPT_GID },
1147      
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
1153 @@ -11,7 +11,7 @@
1154  */
1155  
1156  /*
1157 -  $Id$
1158 +  $Id$
1159  */
1160  
1161  #ifdef HAVE_CONFIG_H
1162 @@ -74,9 +74,6 @@
1163  {"nocompress", OPT_NOCOMPR, NULL, 0, 
1164   N_("Create uncompressed index"), OPT_GID },
1165  
1166 -{"compress", OPT_COMPR, "type", OPTION_HIDDEN, /* not finished yet */
1167 - N_("Sets compression type (none, bz2, gz)"), OPT_GID },
1168 -
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 },
1172 @@ -85,6 +82,20 @@
1173  { 0, 0, 0, 0, 0, 0 },    
1174  };
1175  
1176 +struct mopt {
1177 +    char *name;
1178 +    unsigned flag;
1179 +};
1180 +
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 */
1187 +    { NULL, 0 },
1188 +};
1189 +
1190  struct arg_s {
1191      unsigned            cnflags;
1192      unsigned            crflags;
1193 @@ -95,6 +106,9 @@
1194  };
1195  #define DO_MAKEIDX (1 << 0)
1196  
1197 +
1198 +static int parse_mopts(struct arg_s *arg_s, char *opstr);
1199 +
1200  static
1201  error_t parse_opt(int key, char *arg, struct argp_state *state);
1202  
1203 @@ -171,23 +185,30 @@
1204              break;
1205              
1206          case OPT_NODESC:
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;
1211              break;
1212  
1213          case OPT_NODIFF:
1214 -            arg_s->crflags |= PKGDIR_CREAT_NOPATCH;
1215 +            parse_mopts(arg_s, "nodiff");
1216              break;
1217              
1218 -        case OPT_COMPR:
1219 -            n_hash_replace(arg_s->opts, "compress", n_strdup(arg));
1220 +        case OPT_COMPR: {
1221 +            char tmp[128];
1222 +            n_snprintf(tmp, sizeof(tmp), "compress=%s", arg);
1223 +            parse_mopts(arg_s, tmp);
1224              break;
1225 +        }
1226  
1227          case OPT_NOCOMPR:
1228 -            n_hash_replace(arg_s->opts, "compress", n_strdup("none"));
1229 +            parse_mopts(arg_s, "nocompress");
1230              break;
1231 -           
1232 +
1233 +        case OPT_MOPT:
1234 +            parse_mopts(arg_s, arg);
1235 +            break;
1236 +            
1237          default:
1238              return ARGP_ERR_UNKNOWN;
1239      }
1240 @@ -195,6 +216,73 @@
1241      return 0;
1242  }
1243  
1244 +
1245 +static int parse_mopt(struct arg_s *arg_s, const char *opstr)
1246 +{
1247 +    char *p, *tmp;
1248 +    int i, valid;
1249 +    
1250 +    n_strdupap(opstr, &tmp);
1251 +    
1252 +    if ((p = strchr(tmp, '='))) {
1253 +        *p = 0;
1254 +        p++;
1255 +        p = n_str_strip_ws(p);
1256 +        tmp = n_str_strip_ws(tmp);
1257 +    }
1258 +
1259 +    n_hash_replace(arg_s->opts, tmp, p ? n_strdup(p) : NULL);
1260 +    
1261 +    i = 0;
1262 +    valid = 0;
1263 +    while (valid_mopts[i].name) {
1264 +        if (n_str_eq(tmp, valid_mopts[i].name)) {
1265 +            arg_s->crflags |= valid_mopts[i].flag;
1266 +            valid = 1;
1267 +            break;
1268 +        }
1269 +        i++;
1270 +    }
1271 +    
1272 +    if (!valid) {
1273 +        logn(LOGERR, _("%s: unknown option"), tmp);
1274 +    
1275 +    } else {
1276 +        if (n_str_eq(tmp, "nocompress"))
1277 +            n_hash_replace(arg_s->opts, "compress", n_strdup("none"));
1278 +        else 
1279 +            n_hash_replace(arg_s->opts, tmp, p ? n_strdup(p) : NULL);
1280 +    }
1281 +    
1282 +    return valid;
1283 +}
1284 +
1285 +
1286 +static int parse_mopts(struct arg_s *arg_s, char *opstr) 
1287 +{
1288 +    opstr = n_str_strip_ws(opstr);
1289 +
1290 +    if (opstr == NULL || *opstr == '\0')
1291 +        return 1;
1292 +    
1293 +    if (strchr(opstr, ',') == NULL) {
1294 +        parse_mopt(arg_s, opstr);
1295 +        
1296 +    } else {
1297 +        const char **tl_save, **tl;
1298 +        
1299 +        tl = tl_save = n_str_tokl(opstr, ",");
1300 +        while (*tl) {
1301 +            parse_mopt(arg_s, *tl);
1302 +            tl++;
1303 +        }
1304 +        n_str_tokl_free(tl_save);
1305 +    }
1306 +    
1307 +    return 1;
1308 +}
1309 +
1310 +
1311  static tn_array *parse_types(const char *type) 
1312  {
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
1317 @@ -11,11 +11,12 @@
1318  */
1319  
1320  /*
1321 -  $Id$
1322 +  $Id$
1323  */
1324  
1325  #include <string.h>
1326  #include <sys/param.h>
1327 +#include <time.h>
1328  
1329  #include "sigint/sigint.h"
1330  #include "poldek_util.h"
1331 @@ -31,7 +32,7 @@
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
1337  };
1338  
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
1343 @@ -11,7 +11,7 @@
1344  */
1345  
1346  /*
1347 -  $Id$
1348 +  $Id$
1349  */
1350  
1351  #include <limits.h>
1352 @@ -121,7 +121,7 @@
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
1358  };
1359  
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
1364 @@ -11,7 +11,7 @@
1365  */
1366  
1367  /*
1368 -  $Id$
1369 +  $Id$
1370  */
1371  
1372  #ifdef HAVE_CONFIG_H
1373 @@ -28,10 +28,8 @@
1374  #include <sys/errno.h>
1375  #include <sys/param.h>
1376  #include <signal.h>
1377 -#include <time.h>
1378  #include <argp.h>
1379  #include <fnmatch.h>
1380 -#include <time.h>
1381  #include <unistd.h>
1382  
1383  #include <readline/readline.h>
1384 @@ -52,7 +50,7 @@
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
1390  };
1391  
1392  static volatile sig_atomic_t shDone   = 0;
1393 @@ -78,13 +76,13 @@
1394      struct pkg *ipkg = NULL;
1395      tn_array *dents;
1396      char name[256];
1397 -    int n;
1398 +    int n, name_len;
1399  
1400      dents = poclidek_get_dent_ents(cctx, POCLIDEK_INSTALLEDDIR);
1401      if (dents == NULL)
1402          return 1;
1403      
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);
1407  
1408      if (n == -1)
1409 @@ -92,14 +90,15 @@
1410  
1411      while (n < n_array_size(dents)) {
1412          struct pkg_dent *ent = n_array_nth(dents, n++);
1413 +
1414          if (pkg_dent_isdir(ent))
1415              continue;
1416 +
1417 +        if (strncmp(name, ent->name, name_len) != 0) 
1418 +            break;
1419          
1420          ipkg = ent->pkg_dent_pkg;
1421 -        if (strcmp(pkg->name, ipkg->name) != 0)
1422 -            break;
1423 -
1424 -        if (pkg_cmp_evr(pkg, ipkg) > 0) 
1425 +        if (strcmp(pkg->name, ipkg->name) == 0 && pkg_cmp_evr(pkg, ipkg) > 0)
1426              return 1;
1427          
1428      }
1429 @@ -357,22 +356,34 @@
1430          snprintf(prompt, sizeof(prompt), "poldek:%s%s> ",
1431                   currdir == NULL ? "/" : *currdir->name == '/' ? "" : "/",
1432                   currdir == NULL ? "" : currdir->name);
1433 +
1434          if ((line = readline(prompt)) == NULL)
1435              break;
1436  
1437 +        /* add to history? */
1438 +        s = line;
1439 +        while (isspace(*s))
1440 +            s++;
1441 +        
1442 +        if (*s)
1443 +            add_history(line);
1444 +                
1445          s = n_str_strip_ws(line);
1446          if (*s) {
1447              int _verbose = poldek_verbose();
1448 -            add_history(s);
1449 -            //print_mem_info("BEFORE");
1450 +            
1451              shInCmd = 1;
1452              DBGF("(%s)\n", s);
1453 +
1454 +            MEMINF("BEFORE %s\n", s);
1455              poclidek_execline(cctx, NULL, s);
1456 +            MEMINF("AFTER  %s\n", s);
1457 +            
1458              sigint_reset();
1459              shDone = 0;
1460              shInCmd = 0;
1461 +
1462              poldek_set_verbose(_verbose);
1463 -            //print_mem_info("AFTER ");
1464          }
1465          free(line);
1466          
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
1470 @@ -11,7 +11,7 @@
1471  */
1472  
1473  /*
1474 -  $Id$
1475 +  $Id$
1476  */
1477  
1478  #include <limits.h>
1479 @@ -64,7 +64,7 @@
1480      COMMAND_PIPEABLE_LEFT | COMMAND_PIPE_XARGS | COMMAND_PIPE_PACKAGES, 
1481      "uninstall", N_("PACKAGE..."), N_("Uninstall packages"), 
1482      options, parse_opt,
1483 -    NULL, uninstall, NULL, NULL, NULL, NULL, 0, 0
1484 +    NULL, uninstall, NULL, NULL, NULL, NULL, NULL, 0, 0
1485  };
1486  
1487  static struct argp cmd_argp = {
1488 @@ -171,6 +171,7 @@
1489                  
1490                  ts->setop(ts, POLDEK_OP_GREEDY, bool);
1491              }
1492 +            break;
1493              
1494          case 't':
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
1499 @@ -0,0 +1,41 @@
1500 +# $Id$
1501 +
1502 +# CentOS 4
1503 +_arch    = i386
1504 +_prefix  = http://mirror.centos.org/centos/4.2/apt/%{_arch}/
1505 +
1506 +[source]
1507 +name   = co
1508 +type   = apt
1509 +url    = %{_prefix}/base/pkglist.os.bz2
1510 +prefix = %{_prefix}/RPMS.os
1511 +
1512 +[source]
1513 +name   = co-updates
1514 +type   = apt
1515 +url    = %{_prefix}/base/pkglist.updates.bz2
1516 +prefix = %{_prefix}/RPMS.updates
1517 +
1518 +[source]
1519 +name   = co-plus
1520 +type   = apt
1521 +url    = %{_prefix}/base/pkglist.centosplus.bz2
1522 +prefix = %{_prefix}/RPMS.centosplus
1523 +
1524 +# CentOS yum indexes
1525 +#_prefix  = http://mirror.centos.org/centos/4.2
1526 +#[source]
1527 +#name   = co
1528 +#type   = yum
1529 +#url    = %{_prefix}/os/%{_arch}/
1530 +#
1531 +#[source]
1532 +#name   = co-updates
1533 +#type   = yum
1534 +#url    = %{_prefix}/updates/%{_arch}/
1535 +#
1536 +#[source]
1537 +#name   = co-plus
1538 +#type   = yum
1539 +#url    = %{_prefix}/centosplus/%{_arch}/
1540 +#auto   = no
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
1544 @@ -1,13 +1,14 @@
1545 -# $Id$
1546 +# $Id$
1547  
1548  # generated configs
1549  GENCONFIGS = fetch.conf source.conf poldek.conf
1550  
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
1555  
1556  EXTRA_DIST = $(CONFIGS) \
1557 -                        sample-source-remoteconf.conf \
1558 +            sample-source-remoteconf.conf \
1559               sample-cdrom-source.conf \
1560               poldek-pri-sample.conf
1561  
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
1565 @@ -0,0 +1,6 @@
1566 +# $Id$
1567 +
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
1575 @@ -1,5 +1,5 @@
1576  /*
1577 -  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
1578 +  Copyright (C) 2000 - 2006 Pawel A. Gajda <mis@k2.net.pl>
1579  
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
1582 @@ -11,7 +11,7 @@
1583  */
1584  
1585  /*
1586 -  $Id$
1587 +  $Id$
1588  */
1589  
1590  #include <ctype.h>
1591 @@ -38,146 +38,29 @@
1592  #include "conf.h"
1593  #include "misc.h"
1594  #include "poldek_util.h"
1595 +#include "conf_intern.h"
1596  
1597  #define POLDEK_LDCONF_APTSOURCES  (1 << 15) 
1598  
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)
1604 -
1605 -#define TYPE_MULTI      (1 << 5)
1606 -#define TYPE_MULTI_EXCL (1 << 6)
1607 -#define TYPE_ENUM       (1 << 7)
1608 -
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)
1613 -
1614  static const char *global_tag = "global";
1615  static const char *include_tag = "%include";
1616  
1617 -struct tag {
1618 -    char      *name;
1619 -    unsigned  flags;
1620 -    char      *enums[8];
1621 -};
1622 -
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,
1627 +    NULL, 0, { 0 },
1628  };
1629  
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 } },
1635 -    
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 */
1642 -
1643 -    { "ignore req",    TYPE_STR | TYPE_MULTI, { 0 } },
1644 -    { "ignore pkg",    TYPE_STR | TYPE_MULTI, { 0 } },
1645 -
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 } },
1651 -
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 } }, 
1686 -};
1687 -
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 } }, 
1693 -};
1694 -
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 } },
1704      {  NULL,        0, { 0 } }, 
1705  };
1706 +    { "pri",         CONF_TYPE_STRING , { 0 } },
1707 +*/
1708  
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 } }, 
1731 -};
1732 -
1733 -struct section {
1734 -    char        *name;
1735 -    struct tag  *tags;
1736 -    int         is_multi;
1737 -};
1738 -
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 },
1745 -};
1746 +struct poldek_conf_section *sections = poldek_conf_sections; /* just for short */
1747  
1748  #define COPT_MULTIPLE (1 << 0)
1749  struct copt {
1750 @@ -254,9 +137,15 @@
1751          sep = " \t,";
1752      
1753      p = v = n_str_tokl(vstr, sep);
1754 -    if (v == NULL)
1755 +
1756 +    if (v == NULL)              /* n_str_tokl error */
1757          return 0;
1758  
1759 +    if (*v == NULL) {             /* empty option value */
1760 +        n_str_tokl_free(v);
1761 +        return 1;
1762 +    }
1763 +
1764      if (n_hash_exists(ht, name)) {
1765          opt = n_hash_get(ht, name);
1766          
1767 @@ -283,6 +172,7 @@
1768          }
1769          p++;
1770      }
1771 +
1772      n_str_tokl_free(v);
1773      return 1;
1774  }
1775 @@ -327,7 +217,7 @@
1776  }
1777  
1778  static
1779 -const struct section *find_section(const char *name) 
1780 +const struct poldek_conf_section *find_section(const char *name) 
1781  {
1782      int i = 0;
1783  
1784 @@ -343,11 +233,11 @@
1785  
1786  static
1787  int find_tag(const char *sectname, const char *key,
1788 -             const struct section **sectp) 
1789 +             const struct poldek_conf_section **sectp) 
1790  {
1791      int i = 0;
1792 -    struct tag   *tags = NULL;
1793 -    const struct section *sect;
1794 +    struct poldek_conf_tag *tags = NULL;
1795 +    const struct poldek_conf_section *sect;
1796  
1797      *sectp = NULL;
1798      if ((sect = find_section(sectname)) == NULL)
1799 @@ -450,17 +340,17 @@
1800  }
1801  
1802  
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)
1805  {
1806      int i = 0, nerr = 0;
1807 -    struct tag *tags;
1808 +    struct poldek_conf_tag *tags;
1809      struct copt *fl;
1810  
1811      fl = n_hash_get(ht, "__file__line");
1812      tags = sect->tags;
1813      
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;
1818  
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)
1823  
1824 +static int verify_param_presence(tn_hash *ht_sect, const char *section,
1825 +                                 const char *name, 
1826 +                                 const struct poldek_conf_tag *tag,
1827 +                                 unsigned flags,
1828 +                                 const char *filemark)
1829
1830 +{
1831 +    int gotit = 0, overwrite = (flags & ADD_PARAM_OVERWRITE), rc = 1;
1832 +
1833 +    if (n_hash_exists(ht_sect, name)) {
1834 +        struct copt *opt = n_hash_get(ht_sect, name);
1835 +        gotit = (opt->val != NULL);
1836 +    }
1837 +        
1838 +    if (!gotit)
1839 +        return rc;
1840 +    
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);
1845 +        
1846 +    } else if ((tag->flags & CONF_TYPE_F_MULTI) == 0) {
1847 +        logn(LOGWARN, _("%s: multiple '%s' not allowed"), filemark, name);
1848 +        rc = 0;
1849 +    }
1850 +    
1851 +    return rc;
1852 +}
1853 +
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)
1857  {
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;
1863      struct copt *opt;
1864      int tagindex, validate, overwrite;
1865  
1866 @@ -635,14 +555,15 @@
1867          
1868      msgn_i(3, 2, "%s::%s = %s", section, name, value);
1869  
1870 -    if (tag->flags & TYPE_F_ALIAS) {
1871 +    if (tag->flags & CONF_TYPE_F_ALIAS) {
1872          int n = tagindex;
1873          char *p = NULL;
1874          while (n > 0) {
1875              n--;
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 = &sect->tags[n];
1881                  break;
1882              }
1883          }
1884 @@ -652,10 +573,13 @@
1885          }
1886          
1887      }
1888 +
1889 +    if (!verify_param_presence(ht_sect, section, name, tag, flags, filemark))
1890 +        return 0;
1891      
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,",
1897                          path, nline);
1898          
1899      val = getv(value, path, nline);
1900 @@ -669,7 +593,7 @@
1901          return 0;
1902      }
1903  
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);
1911      }
1912  
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);
1918      
1919      if (opt->val == NULL) {
1920          opt->val = n_strdup(val);
1921          DBGF("ADD %p %s -> %s\n", ht_sect, name, val);
1922  
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 */
1928          free(opt->val);
1929          opt->val = n_strdup(val);
1930          
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);
1936          return 0;
1937              
1938      } else if (opt->vals != NULL) {
1939 @@ -824,14 +749,16 @@
1940          p = (char*)do_expand_value(expval, sizeof(expval), p, ht, ht_global);
1941      
1942      if (strchr(p, '$'))
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),
1945 +                                               p);
1946  
1947      n_snprintf(path, size, "%s", p);
1948      return path;
1949  }
1950  
1951  static
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)
1956  {
1957      tn_array *arr_sect;
1958 @@ -883,8 +810,8 @@
1959  
1960  void *poldek_conf_add_section(tn_hash *htconf, const char *name)
1961  {
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;
1966      
1967      if ((sect = find_section(name)) == NULL) {
1968          logn(LOGERR, _("'%s': invalid section name"), name);
1969 @@ -1086,7 +1013,7 @@
1970              continue;
1971  
1972          if (*p == '[') {        /* section */
1973 -            const struct section *sect = NULL;
1974 +            const struct poldek_conf_section *sect = NULL;
1975              
1976              p++;
1977              name = p;
1978 @@ -1392,7 +1319,7 @@
1979          return default_v;
1980  
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);
1984          v = default_v;
1985      }
1986      
1987 @@ -1409,6 +1336,22 @@
1988          return default_v;
1989  
1990      if ((bool = poldek_util_parse_bool(v)) < 0) {
1991 +        logn(LOGERR, _("invalid value ('%s') of boolean option '%s'"), v, name);
1992 +        bool = default_v;
1993 +    }
1994 +
1995 +    return bool;
1996 +}
1997 +
1998 +int poldek_conf_get_bool3(const tn_hash *htconf, const char *name, int default_v)
1999 +{
2000 +    const char *v;
2001 +    int bool;
2002 +    
2003 +    if ((v = poldek_conf_get(htconf, name, NULL)) == NULL)
2004 +        return default_v;
2005 +
2006 +    if ((bool = poldek_util_parse_bool3(v)) < 0) {
2007          logn(LOGERR, _("invalid value ('%s') of option '%s'"), v, name);
2008          bool = default_v;
2009      }
2010 @@ -1438,7 +1381,7 @@
2011  
2012  static void load_apt_sources_list(tn_hash *htconf, const char *path) 
2013  {
2014 -    const struct section *sect = NULL;
2015 +    const struct poldek_conf_section *sect = NULL;
2016      const char **tl, **tl_save, *sectnam;
2017      char buf[1024];
2018      FILE *stream;
2019 @@ -1527,89 +1470,3 @@
2020      fclose(stream);
2021  }
2022  
2023 -#define XML 0
2024 -#if XML
2025 -static const char *strtype(unsigned flags) 
2026 -{
2027 -    if (flags & TYPE_PATHLIST)
2028 -        return "str-list";
2029 -    
2030 -    if (flags & TYPE_STR)
2031 -        return "str";
2032 -    
2033 -    if (flags & TYPE_BOOL)
2034 -        return "bool";
2035 -
2036 -    if (flags & TYPE_INT)
2037 -        return "int";
2038 -
2039 -
2040 -    if (flags & TYPE_ENUM)
2041 -        return "enum";
2042 -
2043 -    n_assert(0);
2044 -    return NULL;
2045 -}
2046 -
2047 -
2048 -static void dump_section(struct section *sect) 
2049 -{
2050 -    struct tag tag;
2051 -    int i = 0;
2052 -    
2053 -    printf("<section name=\"%s\">\n", sect->name);
2054 -    
2055 -    while (1) {
2056 -        tag = sect->tags[i++];
2057 -        if (tag.name == NULL)
2058 -            break;
2059 -
2060 -        if (tag.flags & TYPE_F_OBSL)
2061 -            continue;
2062 -        
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\"");
2069 -
2070 -        if (tag.flags & TYPE_MULTI)
2071 -            printf(" multiple=\"yes\"");
2072 -
2073 -        if (tag.flags & TYPE_F_ENV)
2074 -            printf(" env=\"yes\"");
2075 -
2076 -        if (tag.flags & TYPE_F_ALIAS)
2077 -            printf(" alias=\"yes\"");
2078 -
2079 -        if (tag.flags & TYPE_F_REQUIRED)
2080 -            printf(" required=\"yes\"");
2081 -
2082 -        printf(">\n");
2083 -        
2084 -        if (tag.flags & TYPE_ENUM) {
2085 -            int n = 0;
2086 -            printf("    <values>\n");
2087 -            while (tag.enums[n]) 
2088 -                printf("      <enum>%s</enum>\n", tag.enums[n++]);
2089 -            printf("    </values>\n");
2090 -        }
2091 -        printf("    <descripion>\n");
2092 -        printf("    </descripion>\n");
2093 -
2094 -        printf("  </option>\n\n");
2095 -    }
2096 -    printf("</section> <!-- end of \"%s\" -->\n", sect->name);
2097 -}
2098 -
2099 -static
2100 -void dump_sections(const char *name) 
2101 -{
2102 -    int i = 0;
2103 -    while (sections[i].name) {
2104 -        dump_section(&sections[i]);
2105 -        i++;
2106 -    }
2107 -}
2108 -#endif /* xml */
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
2112 @@ -1,4 +1,4 @@
2113 -/* $Id$ */
2114 +/* $Id$ */
2115  /* ini-like config parsing module */
2116  #ifndef POLDEK_CONF_H
2117  #define POLDEK_CONF_H
2118 @@ -13,6 +13,14 @@
2119  
2120  tn_hash *poldek_conf_load(const char *path, unsigned flags);
2121  tn_hash *poldek_conf_loadefault(unsigned flags);
2122 +
2123 +
2124 +/*
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'
2129 +*/
2130  tn_hash *poldek_conf_addlines(tn_hash *htconf, const char *sectnam,
2131                                tn_array *lines);
2132  
2133 @@ -21,6 +29,7 @@
2134  
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);
2140  
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
2144 @@ -1,5 +1,5 @@
2145  dnl Process this file with autoconf to produce a configure script.
2146 -dnl $Id$
2147 +dnl $Id$
2148  
2149  AC_INIT(poldek,0.20)
2150  AC_CONFIG_SRCDIR([capreq.c])
2151 @@ -293,9 +293,16 @@
2152         LIBS="$LIBS -lbz2 -lrpmio"
2153  fi
2154  
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])
2162 +
2163 +AC_CHECK_FUNCS(rpmdsUname)
2164 +AC_CHECK_FUNCS(rpmdsSysinfo)
2165 +AC_CHECK_FUNCS(rpmdsGetconf)
2166 +AC_CHECK_FUNCS(rpmdsCpuinfo)
2167 +
2168  
2169  
2170  dnl metadata & xml2
2171 @@ -473,6 +480,7 @@
2172          sigint/Makefile
2173          vfile/Makefile
2174          vfile/vfff/Makefile
2175 +        vfile/tests/Makefile
2176          python/Makefile
2177          conf/Makefile
2178          doc/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
2182 @@ -0,0 +1,41 @@
2183 +/* $Id$ */
2184 +/* ini-like config parsing module */
2185 +
2186 +
2187 +#ifndef POLDEK_CONF_INTERN_H
2188 +#define POLDEK_CONF_INTERN_H
2189 +
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)
2195 +
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 */
2201 +
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 */
2206 +
2207 +struct poldek_conf_tag {
2208 +    char      *name;
2209 +    unsigned  flags;
2210 +    char      *defaultv;
2211 +    int       _op_no;           /* internal option number */
2212 +    char      *enums[8];
2213 +};
2214 +
2215 +struct poldek_conf_section {
2216 +    char                    *name;
2217 +    struct poldek_conf_tag  *tags;
2218 +    int                     is_multi;
2219 +};
2220 +
2221 +extern struct poldek_conf_section poldek_conf_sections[];
2222 +
2223 +#endif
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
2227 @@ -0,0 +1,59 @@
2228 +<xsl:stylesheet version="1.0" 
2229 +               xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2230 +
2231 +<!-- poldek.conf.xml -> conf_sections.c -->
2232 +<!-- $Id$ -->
2233 +
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 &lt;stdlib.h&gt;
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>,
2252 +             <xsl:choose>
2253 +               <xsl:when test="string-length(@default) > 0">"<xsl:value-of select="@default"/>"</xsl:when>
2254 +               <xsl:otherwise>NULL</xsl:otherwise>
2255 +             </xsl:choose>,
2256 +             <xsl:choose>
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 } },
2262 +             </xsl:for-each>
2263 +             
2264 +        </xsl:for-each>
2265 +      </xsl:for-each>
2266 +          { NULL, 0, NULL, 0, { 0 } }
2267 +};
2268 +
2269 +    </xsl:for-each>
2270 +
2271 +
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, 
2275 +       <xsl:choose>
2276 +         <xsl:when test="@multiple='yes'">1</xsl:when>
2277 +         <xsl:otherwise>0</xsl:otherwise>
2278 +       </xsl:choose>,
2279 +    },
2280 + </xsl:for-each>   
2281 +    { NULL, 0, 0 }
2282 +};
2283 +
2284 +</xsl:template>
2285 +</xsl:stylesheet>
2286 +
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
2290 @@ -22,6 +22,10 @@
2291  }
2292  
2293  
2294 +to_c() {
2295 +    xsltproc $DN/conf-xml2c.xsl $FILE
2296 +}
2297 +
2298  to_conf() {
2299      tmp=$FILE.tmp
2300      # - replace [screen] to '=remove' (removed at end)
2301 @@ -55,6 +59,9 @@
2302  elif [ "$TO" = "docb" ]; then
2303     to_docb
2304  
2305 +elif [ "$TO" = "c" ]; then
2306 +   to_c
2307 +
2308  elif [ "$TO" = "conf" ]; then
2309     NAME=$3
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
2314 @@ -0,0 +1,59 @@
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 -->
2318 +<!-- $Id$ -->
2319 +
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']">
2326 +          <xsl:choose>
2327 +            <xsl:when test="@default='yes'">
2328 +<xsl:value-of select="@name"/> = no
2329 +            </xsl:when>
2330 +            <xsl:when test="@default='no'">
2331 +<xsl:value-of select="@name"/> = yes
2332 +            </xsl:when>
2333 +            <xsl:when test="@default='auto'">
2334 +<xsl:value-of select="@name"/> = auto
2335 +            </xsl:when>
2336 +            <xsl:otherwise>
2337 +<xsl:value-of select="@name"/> = yes
2338 +            </xsl:otherwise>
2339 +          </xsl:choose>
2340 +        </xsl:for-each>
2341 +
2342 +        <xsl:for-each select="option[@type='string']">
2343 +          <xsl:if test="not(contains(@name, '*'))">
2344 +          <xsl:choose>
2345 +            <xsl:when test="string-length(@default) > 0">
2346 +              <xsl:value-of select="@name"/> = <xsl:value-of select="@default"/>
2347 +            </xsl:when>
2348 +            <xsl:otherwise>
2349 +              <xsl:value-of select="@name"/> = <xsl:value-of select="translate(@name,' ','_')"/>
2350 +            </xsl:otherwise>
2351 +          </xsl:choose>
2352 +            #
2353 +          </xsl:if>
2354 +        </xsl:for-each>
2355 +
2356 +        <xsl:for-each select="option[@type='integer']">
2357 +          <xsl:choose>
2358 +            <xsl:when test="string-length(@default) > 0">
2359 +              <xsl:value-of select="@name"/> = <xsl:value-of select="@default"/>
2360 +            </xsl:when>
2361 +            <xsl:otherwise>
2362 +              <xsl:value-of select="@name"/> = 100;
2363 +            </xsl:otherwise>
2364 +          </xsl:choose>
2365 +            #
2366 +        </xsl:for-each>
2367 +        
2368 +
2369 +      </xsl:for-each>
2370 +    </xsl:for-each>
2371 +</xsl:template>
2372 +</xsl:stylesheet>
2373 +
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
2377 @@ -7,22 +7,27 @@
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>
2380  </ul>
2381 -<p>An older versions are available <a href="download/">here</a>.
2382 - Development snapshots are available <a href="download/snapshots/">here</a></p>
2383 +<p>
2384 +An older versions are available <a href="download/">here</a>.
2385 +Development snapshots are available <a href="download/snapshots/">here</a>
2386 +</p>
2387  
2388  <h1> Binary packages </h1>
2389  
2390 -<h2> PLD Linux </h2>
2391 +<h2> <a href="http://pld-linux.org/">PLD Linux</a> </h2>
2392  <ul>
2393  <li> PLD 1.0 (Ra) 
2394       <a href="download/pld/ra/poldek-POLDEK_VERSION-1.i386.rpm">poldek-POLDEK_VERSION-1.i386.rpm</a>  
2395  </li>
2396  </ul>
2397  
2398 -<p> Packages for other architectures as for developement PLD branches are available on PLD 
2399 +<p> 
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>.
2402 +</p>
2403 +
2404 +<h2> <a href="http://fedora.redhat.com/">Fedora Core</a> </h2>
2405  
2406 -<h2> Fedora Core </h2>
2407  <ul>
2408  <li> Fedora Core 4
2409  <a href="download/fedora/c4/poldek-POLDEK_VERSION-1.i386.rpm">poldek-POLDEK_VERSION-1.i386.rpm</a>  
2410 @@ -36,15 +41,28 @@
2411  <p> An older versions of packages for previous Fedora Core releases can be found <a href="download/fedora/">here</a>.
2412  </p>
2413  
2414 -<h2> RedHat </h2>
2415 +<h2> <a href="http://www.redhat.com/">RedHat</a> </h2>
2416  <ul>
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> 
2419  </li>
2420  </ul>
2421  
2422 -<p> An older versions of packages for several RedHat versions can be found <a href="download/rh/">here</a>.
2423 -</li>
2424 -</ul>
2425 +<p> 
2426 +An older versions of packages for several RedHat versions can be found <a href="download/rh/">here</a>.
2427 +</p>
2428  
2429 +<h2> <a href="http://www.centos.org/">CentOS</a> </h2>
2430 +<p>
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>.
2433 +</p>
2434 +<p>
2435 +Packages maintained by Arkadiusz Patyk &lt;<em>areq att pld-linux org</em>&gt;,
2436 +available <a href="http://rescuecd.pld-linux.org/poldek/CentOS/">here</a>.
2437 +</p>
2438  
2439 +<h2> Other </h2>
2440 +<p> Send <a href="mailto: mis @ pld.org.pl">me</a> a links to packages
2441 +    for your system
2442 +</p> 
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
2446 @@ -1,4 +1,4 @@
2447 -# $Id$
2448 +# $Id$
2449  
2450  WWW_PAGES  = page-template.html \
2451              devel-body.html download-body.html index-body.html related-body.html \
2452 @@ -11,8 +11,11 @@
2453  
2454  EXTRA_DIST = $(WWW_PAGES) $(WWWBINS)
2455  
2456 +site-only:
2457 +       ./genhomepage --clean --destdir site
2458 +       ./genhomepage --destdir site || exit 1
2459  
2460 -site:  $(WWW_PAGES)
2461 +site:  $(WWW_PAGES) ../manual.xml ../NEWS.xml ../NEWSto
2462         $(MAKE) -C .. manual-web
2463         $(MAKE) -C ../.. NEWS
2464         $(MAKE) -C .. NEWS.html
2465 @@ -22,7 +25,7 @@
2466         cp ../NEWS.html ../manual.css style.css logo90.png site
2467         rm -rf site/manual && cp -a ../manual-web site/manual
2468  
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
2473  
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
2477 @@ -0,0 +1,147 @@
2478 +html {
2479 +  background: white;
2480 +  margin: 0;
2481 +  padding: 1em 1em;
2482 +}
2483 +
2484 +body {
2485 +  background: white;
2486 +  color: black;
2487 +  margin: 0;
2488 +  padding: 0;
2489 +  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
2490 +  font-size: small;
2491 +  line-height: 1.5;
2492 +}
2493 +
2494 +a {
2495 +  font-weight: bold;
2496 +}
2497 +
2498 +a img {
2499 +  border: none;
2500 +}
2501 +
2502 +a, a:link, a:visited {
2503 +  text-decoration: none;
2504 +  color: #577c9b;
2505 +}
2506 +
2507 +a:hover {
2508 +  text-decoration: underline;
2509 +}
2510 +
2511 +a.current {
2512 +  text-decoration: none;
2513 +  color: #555555;
2514 +}
2515 +
2516 +acronym, abbr {
2517 +  cursor: help;
2518 +}
2519 +
2520 +h1 {
2521 +  font-size: 1.3em;
2522 +  color: #577c9b;
2523 +}
2524 +
2525 +h2, h3, h4 {
2526 +  font-size: 1.1em;
2527 +  color: #577c9b;
2528 +}
2529 +
2530 +.term { 
2531 +  color: #577c9b;
2532 +  font-weight: bold;
2533 +}
2534 +
2535 +#head {
2536 +  border: 0;
2537 +  padding: 0;
2538 +  margin: 0;
2539 +  //border: 1px solid #ccc;
2540 +}
2541 +
2542 +#head h1 {
2543 +  margin-left: 10px;
2544 +  display: inline;
2545 +  font-size: 16px;
2546 +  color: #555555;
2547 +}
2548 +
2549 +#head img {
2550 +  vertical-align: middle;
2551 +}
2552 +
2553 +#nav {
2554 +  #position: absolute;
2555 +  #left: 0;
2556 +  float: left;
2557 +  
2558 +  margin: 0;
2559 +  padding: 5px;
2560 +  background-color: #EEEEEE;
2561 +  border: 1px dashed #ccc;
2562 +  margin-top: 5px;
2563 +  text-align: left;
2564 +  width: 150px;
2565 +}
2566 +
2567 +#nav ul {
2568 +  list-style: none;
2569 +  padding: 0;
2570 +  margin: 0;
2571 +}
2572 +
2573 +#nav li {
2574 +  padding: 0;
2575 +  margin: 0;
2576 +}
2577 +
2578 +#content {
2579 +  padding: 0 1em;
2580 +  margin: 0;
2581 +  margin-top: 5px;
2582 +  margin-left: 165px;
2583 +  //border: 1px solid #ccc;
2584 +}
2585 +
2586 +/* from manual.css */
2587 +.option, .filename   { font-weight: bold; font-size: 12px; }
2588 +#.application { }
2589 +
2590 +.prompt { font-family: courier, monospace; }
2591 +
2592 +.screen { 
2593 +  background-color: #EEEEEE; 
2594 +  font-family: courier, monospace; 
2595 +  font-size: 13px;
2596 +  padding: 2px;
2597 +  padding-left: 5px;
2598 +  padding-top: 0;
2599 +  border: 1pt solid #DDDDDD;
2600 +  /* background: #fff8eb; */
2601 +  white-space: pre;
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 */
2611 +}
2612 +
2613 +.replaceable { 
2614 +  font-weight: normal; 
2615 +  font-family: courier, monospace;
2616 +  font-style: normal;
2617 +}
2618 +
2619 +ul.plain {
2620 +  list-style: none;
2621 +}
2622 +
2623 +
2624 +
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
2628 @@ -1,3 +1,12 @@
2629 +<!-- 
2630 +
2631 +<h1> Documentation & co.</h1>
2632 +<ul>
2633 +<li> poldek <a href="http://team.pld.org.pl/~mis/poldek/manual/">manual</a>
2634 +</ul>
2635 +
2636 +-->
2637 +
2638  <h1>Mailing list</h1>
2639  
2640  <p>Program mailing list <code>poldek@pld-linux.org</code>. 
2641 @@ -5,14 +14,18 @@
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>.
2644  </p> 
2645 +
2646  <p> List archives: 
2647  <a href="http://lists.pld-linux.org/mailman/pipermail/poldek/">http://lists.pld-linux.org/mailman/pipermail/poldek/</a>.
2648 +</p>
2649  
2650  <p>
2651  List traffic is rather low, most poldek issues are discussed on PLD <a href="http://pld-linux.org/MailingLists">mailing lists</a>.
2652 -
2653 +</p>
2654  
2655  <h1>Issue Tracker</h1>
2656 +<p>
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.
2660 +</p>
2661  
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
2665 @@ -1,4 +1,4 @@
2666 -# $Id$
2667 +# $Id$
2668  
2669  # NOTE
2670  # $(GEN) files are automatically generated, don't modify them. See
2671 @@ -53,7 +53,7 @@
2672  CREDITS: CREDITS.docb.tmp
2673          xmlto -m NEWS.xsl txt CREDITS.docb.tmp && mv CREDITS.docb.txt $@
2674  
2675 -CREDITS-body.html:
2676 +CREDITS-body.html: NEWS.xml NEWSto
2677          ./NEWSto CREDITS.html_body > $@
2678  
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
2683 @@ -0,0 +1,11 @@
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"
2687 +                version='1.0'>
2688 +<xsl:template name="user.header.navigation">
2689 +  <div align="right">
2690 +    [<a href="../">poldek home</a>]
2691 +  </div>
2692 +</xsl:template>
2693 +
2694 +</xsl:stylesheet>
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
2698 @@ -66,8 +66,8 @@
2699  </author>
2700  </authorgroup>
2701  
2702 -<date>$Date$</date>
2703 -<releaseinfo>$Id$</releaseinfo>
2704 +<date>$Date$</date>
2705 +<releaseinfo>$Id$</releaseinfo>
2706  
2707  <keywordset>
2708  <keyword>package management</keyword>
2709 @@ -85,7 +85,7 @@
2710  <sect1 id="overview"> <title id="overview.title">Overview</title>
2711  <para>
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.
2717  </para>
2718 @@ -95,11 +95,12 @@
2719  <varlistentry><term>Easy to use</term>
2720    <listitem>
2721      <para> 
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.
2727 +    
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.
2732      </para>
2733    </listitem>
2734  </varlistentry>
2735 @@ -108,12 +109,11 @@
2736    <listitem>
2737      <para>
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.
2750      </para>
2751    </listitem>
2752  </varlistentry>
2753 @@ -121,9 +121,11 @@
2754  <varlistentry><term>Incremental repository updates</term>
2755    <listitem>
2756      <para>
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. 
2765      </para>
2766    </listitem>
2767  </varlistentry>
2768 @@ -582,12 +584,13 @@
2769  <sect1 id="pkgmanaging"> <title>Managing packages</title>
2770  <para>
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>
2777  
2778  <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>.
2785  </para>
2786 @@ -664,7 +667,7 @@
2787  <para>
2788  To install packages in &rpm; sense, i.e. do not upgrade even if older version is already installed:
2789  <screen>
2790 -&poldek-prompt;  [OPTION..] --install                 (&rpm; mode)
2791 +&poldek-prompt;  [OPTION..] --install                 (command line mode)
2792  &ipoldek-prompt; [OPTION..] install -IN               (interactive mode)
2793  </screen>
2794  
2795 @@ -686,9 +689,9 @@
2796  </para>
2797  
2798  <para>
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:
2801  <screen>
2802 -&poldek-prompt;  [OPTION..] --upgrade                 (&rpm; mode)
2803 +&poldek-prompt;  [OPTION..] --upgrade                 (command line mode)
2804  &ipoldek-prompt; [OPTION..] install                   (interactive mode)
2805  </screen>
2806  This is most used installation type. Example:
2807 @@ -732,7 +735,7 @@
2808  <para>
2809  To upgrade packages, i.e. install only if older version is already installed:
2810  <screen>
2811 -&poldek-prompt;  [OPTION..] --upgrade --fresh         (&rpm; mode)
2812 +&poldek-prompt;  [OPTION..] --upgrade --fresh         (command line mode)
2813  &ipoldek-prompt; [OPTION..] upgrade                   (interactive mode)
2814  </screen>
2815  </para>
2816 @@ -763,8 +766,9 @@
2817  <screen>
2818  &poldek-prompt; --install-dist=DIR [PACKAGE...]
2819  </screen>
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.
2825  </para>
2826  <para>
2827  As example, command which installs system under <filename>/mnt/dest</filename> might looks like:
2828 @@ -789,7 +793,7 @@
2829  <para>
2830  To remove installed packages:
2831  <screen>
2832 -&poldek-prompt;  [OPTION..] --erase                      (&rpm; mode)
2833 +&poldek-prompt;  [OPTION..] --erase                      (command line mode)
2834  &ipoldek-prompt; [OPTION..] uninstall [ERASE_OPTION...]  (interactive mode)
2835  </screen>
2836  </para>
2837 @@ -803,6 +807,7 @@
2838  </screen>
2839  </para>
2840  
2841 +
2842  <!--
2843  <para>
2844  See also package removal command line options <link linkend="ref.cmdl.package_deinstallation">reference</link>.
2845 @@ -900,19 +905,26 @@
2846  
2847  <sect2 id="security.sudo"> <title>Using sudo</title>
2848  <para>
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. 
2854 +
2855  </para><para>
2856  Of course it is necessary to configure <application>sudo</application>
2857  to allow the user to run <command>rpm</command> binary. 
2858  </para>
2859 +
2860 +<para>
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.
2864 +</para>
2865  </sect2>
2866  
2867  <sect2 id="security.runas"> <title>Automatic switching to an ordinary user</title>
2868  <para>
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:
2873  <screen>
2874  runas = poldek
2875 @@ -967,7 +979,7 @@
2876  
2877  <varlistentry><term>Package conflicts</term>
2878    <listitem><para>
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 '*'):
2884 @@ -986,7 +998,7 @@
2885  
2886  <varlistentry><term>File conflicts</term>
2887    <listitem><para>
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>:
2892      <screen>
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
2896 @@ -10,7 +10,7 @@
2897  <xsl:param name="html.stylesheet.type">text/css</xsl:param>
2898  <xsl:param name="html.stylesheet" select="'manual.css'"></xsl:param>
2899  
2900 -
2901 +<xsl:param name="css.decoration" select="0"/>
2902  <xsl:param name="draft.mode" select="'no'"></xsl:param>
2903  
2904  </xsl:stylesheet>
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
2908 @@ -0,0 +1,92 @@
2909 +#!/usr/bin/perl -w
2910 +use strict;
2911 +require XML::Simple;
2912 +use Data::Dumper;
2913 +use vars qw($file $xs $ref $xml $current_id);
2914 +
2915 +my %out = ();
2916 +foreach my $file (@ARGV) {
2917 +    #print STDERR "FILE $file\n";
2918 +    $xs = new XML::Simple();
2919 +
2920 +    open(F, "<$file") || die;
2921 +    my @lines = <F>;
2922 +    close(F);
2923 +    if ($lines[0] !~ /\<\?xml\s/) {
2924 +        unshift @lines, "<xml>";
2925 +        push @lines, "</xml>";
2926 +    }
2927 +    $ref = $xs->XMLin(join('', @lines), keeproot => 1, keyattr => [], forcecontent => 1);
2928 +    #print Dumper($ref);
2929 +    traverse(undef, $ref, \%out);
2930 +}
2931 +
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};
2936 +}
2937 +
2938 +sub traverse {
2939 +    my $key = shift || 'undef';
2940 +    my $xml = shift;
2941 +    my $outhref = shift || die;
2942 +
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};
2947 +
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;
2954 +    }
2955 +
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);
2961 +        }
2962 +
2963 +    } elsif (ref $xml eq 'HASH') {
2964 +        foreach (keys %$xml) {
2965 +            my $akey = $_;
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}) {
2971 +                    $akey = $key;
2972 +                    #print STDERR " DO $akey $xml->{id} $xml->{content}\n";
2973 +                }
2974 +            }
2975 +            traverse($akey, $xml->{$_}, $outhref);
2976 +        }
2977 +    }
2978 +
2979 +    return if ref $xml;
2980 +    return if $key ne 'option' && $key ne 'filename';
2981 +
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} ||= [];
2988 +
2989 +    push @{$outhref->{$content}}, $current_id;
2990 +    #print STDERR "  do $content $current_id\n";
2991 +
2992 +    return;
2993 +    if ($content =~ /\-\-/) {
2994 +        my ($opt) = ($content =~ /\-\-([\w\-]+)/);
2995 +        if ($opt) {
2996 +            $outhref->{$opt} ||= [];
2997 +            push @{$outhref->{$opt}}, $current_id;
2998 +        }
2999 +    }
3000 +}
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
3004 @@ -0,0 +1,99 @@
3005 +<!-- convert NEWS.xml to docbook document -->
3006 +<xsl:stylesheet version="1.0" 
3007 +                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3008 +
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"
3013 +    indent="yes"/>
3014 +<xsl:strip-space elements="*"/>
3015 +
3016 +<xsl:template match="/">
3017 +<article lang="en">
3018 +<articleinfo>
3019 +<title>poldek NEWS</title>
3020 +<releaseinfo><xsl:value-of select="news/cvsid"/></releaseinfo>
3021 +</articleinfo>
3022 +
3023 +<xsl:apply-templates select="news"/>
3024 +</article>
3025 +</xsl:template>
3026 +
3027 +<xsl:template match="news">
3028 +<xsl:for-each select="release[string-length(@date) > 0]">
3029 +  <xsl:text>  
3030 +  </xsl:text>
3031 +
3032 +  <xsl:variable name="id_version">
3033 +      <xsl:value-of select="translate(@version, '.', '_')"/>
3034 +  </xsl:variable>
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>
3038 +  </xsl:if>
3039 +
3040 +
3041 +  <xsl:choose>
3042 +    <xsl:when test='section'>
3043 +      <xsl:for-each select="section">
3044 +        <sect2><title><xsl:value-of select="title"/></title>
3045 +        <itemizedlist>
3046 +          <xsl:apply-templates select="entry"/>
3047 +        </itemizedlist>
3048 +        </sect2>
3049 +      </xsl:for-each>
3050 +    </xsl:when>
3051 +    <xsl:otherwise>
3052 +      <itemizedlist>
3053 +        <xsl:apply-templates select="entry"/>
3054 +      </itemizedlist>
3055 +    </xsl:otherwise>
3056 +  </xsl:choose>
3057 +</sect1>
3058 +</xsl:for-each>
3059 +</xsl:template>
3060 +
3061 +<xsl:template match="entry">
3062 +  <xsl:text>
3063 +  </xsl:text>
3064 +  <listitem>
3065 +  <xsl:if test="count(para) = 1"> 
3066 +    <para> 
3067 +    <xsl:value-of select="para"/> 
3068 +    <xsl:if test="author">
3069 +      (<xsl:apply-templates select="author"/>)
3070 +    </xsl:if>
3071 +    </para>
3072 +  </xsl:if>
3073 +  <xsl:if test="count(para) > 1"> 
3074 +    <xsl:for-each select="para">
3075 +      <xsl:choose>
3076 +        <xsl:when test='@nowrap'>
3077 +          <screen>
3078 +            <xsl:value-of select="."/> 
3079 +          </screen>
3080 +        </xsl:when>
3081 +        <xsl:otherwise>
3082 +          <para>
3083 +            <xsl:value-of select="."/> 
3084 +          </para>
3085 +        </xsl:otherwise>
3086 +      </xsl:choose>
3087 +    </xsl:for-each>
3088 +  </xsl:if>
3089 +  </listitem>
3090 +</xsl:template>
3091 +
3092 +
3093 +<xsl:template match="author">
3094 +  <emphasis><xsl:if test="@part">with help of </xsl:if><xsl:value-of select="."/></emphasis> &lt;<emphasis><xsl:value-of select="@email"/></emphasis>&gt;<xsl:if test="not(position()=last())">, </xsl:if>
3095 +</xsl:template>
3096 +
3097 +<xsl:template match="para">
3098 +</xsl:template>
3099 +
3100 +
3101 +</xsl:stylesheet>
3102 +
3103 +
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
3107 @@ -0,0 +1,140 @@
3108 +#!/usr/bin/perl -w
3109 +# $Id$
3110 +use strict;
3111 +require XML::Simple;
3112 +#use Data::Dumper;
3113 +use vars qw($xs $xml $PREABLE %op);
3114 +
3115 +%op = ('NEWS.docb'         => \&to_NEWS_docb,
3116 +       'CREDITS.docb'      => \&to_CREDITS_docb,
3117 +       'CREDITS.html_body' => \&to_CREDITS_html_body);
3118 +
3119 +$PREABLE = q{
3120 +<para>
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.
3128 +</para>
3129 +};
3130 +
3131 +die "Usage: $0 {" . join('|', sort keys %op) . "}\n"
3132 +  if @ARGV == 0 || !exists $op{$ARGV[0]};
3133 +
3134 +$xs = new XML::Simple();
3135 +$xml = $xs->XMLin('NEWS.xml', keeproot => 1,
3136 +                  keyattr => [], forcecontent => 1) || die "XML::Simple error";
3137 +
3138 +&{$op{$ARGV[0]}}($xml);
3139 +
3140 +sub to_NEWS_docb {
3141 +    system("xsltproc NEWSdocb.xsl NEWS.xml") == 0 ||
3142 +      die "xsltproc failed: $?";
3143 +}
3144 +
3145 +sub to_CREDITS_html_body {
3146 +    my $ref = shift;
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">};
3155 +
3156 +    foreach (@$credits) {
3157 +        #print STDERR "$_->{name}\n";
3158 +        print qq{<li>$_->{name} &lt;<em>$_->{email}</em>&gt;</li>\n};
3159 +    }
3160 +    print q{</ul>};
3161 +}
3162 +
3163 +sub to_CREDITS_docb {
3164 +    my $ref = shift;
3165 +    my $credits = get_credits($ref);
3166 +
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>};
3171 +
3172 +    print $PREABLE;
3173 +
3174 +    print q{
3175 +<itemizedlist id="creditslist">
3176 +           };
3177 +
3178 +    foreach (@$credits) {
3179 +        print qq{
3180 +  <listitem id="$_->{id}"><para>
3181 +     $_->{name} &lt;<emphasis>$_->{email}</emphasis>&gt;
3182 +   </para></listitem>
3183 +                };
3184 +    }
3185 +    print q{
3186 +</itemizedlist>
3187 +</sect1>
3188 +</article>
3189 +           };
3190 +}
3191 +
3192 +sub get_credits {
3193 +    my $ref = shift;
3194 +
3195 +    my %credits = ();
3196 +
3197 +    foreach my $rel (@{$ref->{news}->{release}}) {
3198 +        $rel->{entry} = [ $rel->{entry} ] if ref $rel->{entry} eq 'HASH';
3199 +        process_entry($rel->{entry}, \%credits);
3200 +
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);
3207 +            }
3208 +        }
3209 +    }
3210 +    my @credits = ();
3211 +    foreach my $au (sort { $credits{$a}->{orderby} cmp $credits{$b}->{orderby} } keys %credits) {
3212 +        push @credits, $credits{$au};
3213 +    }
3214 +    return \@credits;
3215 +}
3216 +
3217 +sub process_entry {
3218 +    my $aref = shift;
3219 +    my $credits = shift;
3220 +
3221 +    foreach my $e (@{$aref}) {
3222 +        next if !$e->{author};
3223 +        $e->{author} = [ $e->{author} ] if ref $e->{author} eq 'HASH';
3224 +
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+/ /;
3232 +
3233 +            my $orderby = $name;
3234 +            if ($name =~ /\s/) {
3235 +                my ($n, $ln) = ($name =~ /(\S+)\s(\S+)/);
3236 +                $orderby = $ln if $ln;
3237 +            }
3238 +
3239 +            $credits->{$au->{id}} = {
3240 +                                     id => $au->{id},
3241 +                                     name => $name,
3242 +                                     orderby => $orderby,
3243 +                                     email => $au->{email},
3244 +                                    };
3245 +        }
3246 +    }
3247 +}
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
3251 @@ -0,0 +1,1133 @@
3252 +<?xml version="1.0"?>
3253 +<news>
3254 +<cvsid>$Id$</cvsid>
3255 +
3256 +<release version="0.20.1" date="" focus="bugfix release">
3257 +  <entry><para>
3258 +   let a user to choose equivalents selected by --caplookup option
3259 +  </para></entry>
3260 +
3261 +  <entry><para>
3262 +   choosing equivalents prompt are interrupt-able now.
3263 +  </para></entry>
3264 +
3265 +  <entry><para>
3266 +    added 0.18.x's --mkdir to be bacward compatible
3267 +  </para></entry> 
3268 +
3269 +  <entry><para>
3270 +    fixed path validation ("/foo../" is not a relative path)
3271 +  </para></entry>
3272 +
3273 +  <entry><para> 
3274 +    vfcompr: temporary *vfcompr.md5 files moved from source to destination 
3275 +    (a cache) directory
3276 +  </para></entry> 
3277 +
3278 +  <entry><para> 
3279 +    orphaned package are upgraded if its successor drags more new packages 
3280 +    than orphaned one
3281 +  </para></entry>
3282
3283 +  <entry><para> 
3284 +    "use sudo" default value is explicit set to "auto" (new 3var boolean-like 
3285 +     type is added).
3286 +  </para></entry>
3287 +
3288 +  <entry><para> 
3289 +     configuration for CentOS has been added.
3290 +    <author id="areq" email="areq att areq eu org">Arkadiusz Patyk</author>
3291 +  </para></entry>
3292 +</release>
3293 +
3294 +<release version="0.20" date="2005/10/28" focus="major enhancements release">
3295 +<para>
3296 +This release introduces new series of poldek. 
3297 +Significant changes and differences from 0.18.x series
3298 +</para>
3299 +
3300 +<section><title>Package repositories</title>
3301 +  <entry>
3302 +    <para>
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 
3305 +      new formats.
3306 +    </para>
3307 +  </entry>
3308 +  
3309 +  <entry>
3310 +    <para>
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). 
3316 +    </para>
3317 +  </entry>
3318 +  
3319 +  <entry>
3320 +    <para>'hdrl' aka 'apt' format are update-able</para>
3321 +  </entry>
3322 +
3323 +  <entry>
3324 +   <para>support for Yum and Metadata XML repositories</para>
3325 +  </entry>
3326 +
3327 +  <entry>
3328 +   <para>
3329 +    repository indexes could be created in many formats at once
3330 +    using --mt switch, ex:
3331 +   </para>
3332 +   <para nowrap="yes">  
3333 +    $ poldek -s /foo/bar --mkdix --mt=pdir,pndir
3334 +   </para>
3335 +  </entry>
3336 +
3337 +  <entry>
3338 +   <para>
3339 +    indexes may be created from any index format, i.e conversion to
3340 +    to another format is supported, ex:
3341 +   </para>
3342 +   <para nowrap="yes">  
3343 +    $ poldek --st apt -s /foo/bar --mkidx=/ala/ma --mt=pdir
3344 +   </para>
3345 +  </entry>
3346 +
3347 +  <entry> 
3348 +    <para>
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.
3352 +    </para>
3353 + </entry>
3354 + </section>
3355 +
3356 + <section><title>Installation related</title>
3357 +  <entry>
3358 +   <para>
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
3362 +   </para>
3363 +  </entry>
3364 +
3365 +  <entry>
3366 +   <para>
3367 +    poldek can perform 'to repository' installation, i.e packages
3368 +    are copied from source to destination repository with full
3369 +    dependency checking, ex:
3370 +   </para>
3371 +   <para nowrap="yes">
3372 +    $ poldek -n ...  --dt pdir --destination /foo/bar/RPMS --upgrade-dist -v
3373 +    $ poldek -n ...  --dn name --upgrade-dist -v
3374 +   </para>
3375 +  </entry>
3376 + </section>
3377 + <section><title>Interactive mode</title>
3378 +  <entry>
3379 +   <para>
3380 +   interactive mode commands are available directly from command line
3381 +   </para>
3382 +   <para nowrap="yes">
3383 +   $ poldek --cmd ls foo
3384 +   $ ipoldek ls foo
3385 +   </para>
3386 +  </entry>
3387 +
3388 +  <entry>
3389 +   <para>
3390 +    command aliases are defined in external configuration file 
3391 +   </para>
3392 +   <author id="mmazur" email="mmazur a kernel pl">Mariusz Mazur</author>
3393 +  </entry>
3394 +
3395 +  <entry>
3396 +   <para>commands may be piped, ex:</para>
3397 +   <para nowrap="yes">
3398 +     poldek&gt; rsearch /poldek/ | ls -l
3399 +   </para>
3400 +  </entry>
3401 +
3402 +  <entry>
3403 +   <para>external commands are supported: </para>
3404 +   <para nowrap="yes">
3405 +     poldek&gt; rsearch /pol/ | !grep ^pol
3406 +   </para>
3407 +  </entry>
3408 + </section>
3409 +
3410 + <section><title>Configuration</title>
3411 +  <entry>
3412 +   <para>
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. 
3415 +   </para>
3416 +  </entry>
3417 +
3418 +  <entry>
3419 +   <para>
3420 +   default location of configuration file has been changed to "${_sysconfdir}/poldek/poldek.conf", old /etc location is still supported. 
3421 +   </para>
3422 +  </entry>
3423 +
3424 +  <entry>
3425 +   <para>
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. 
3429 +   </para>
3430 +  </entry>
3431 +  
3432 +  <entry> 
3433 +   <para> 
3434 +   environment variables in config files are expanded, for example:
3435 +   </para>
3436 +   <para nowrap="yes">
3437 +   cachedir = $HOME/.cache
3438 +   </para>
3439 +  </entry>
3440 +
3441 +  <entry> 
3442 +   <para> 
3443 +   support for simple macros has been added to make configuration easier to write 
3444 +   and read, for example: 
3445 +   </para>
3446 +   <para nowrap="yes">
3447 +   _arch   = i686
3448 +   _prefix = ftp://ftp.pld.org.pl/dists
3449 +
3450 +   [source]
3451 +   type  = pdir
3452 +   name  = pld-ra 
3453 +   path  = %{_prefix}/ra/PLD/%{_arch}/PLD/RPMS/
3454 +
3455 +   [source]
3456 +   type  = pdir
3457 +   name  = pld-ra-updates 
3458 +   path  = %{_prefix}/ra/updates/general/%{_arch}/
3459 +   </para>
3460 +  </entry>
3461 +
3462 +  <entry> 
3463 +   <para> 
3464 +   %include directive has been added, it can include both local and remote files:
3465 +   </para>
3466 +   <para nowrap="yes">
3467 +   %include source.conf
3468 +   %include ftp://ftp.pld.org.pl/dists/ra/source.conf
3469 +   </para>
3470 +   <para>
3471 +    Remote files once downloaded are stored in cache directory. To resynchronize them 
3472 +    with it's remote copy use --upconf option.
3473 +   </para>
3474 +  </entry>
3475 +
3476 +  <entry> 
3477 +   <para> 
3478 +   support for APT sources configuration has been added - new 
3479 +  "load apt sources list" configuration option.
3480 +   </para>
3481 +  </entry>
3482 +</section>
3483 + <section><title>General</title>
3484 +  <entry>
3485 +   <para>
3486 +   some command line switches has been changed, but all obsoleted switches are still 
3487 +   supported *except* "-f" (not important IMO). 
3488 +   Changes:
3489 +   </para>
3490 +   <para nowrap="yes">
3491 +      0.18.x                     0.20
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)
3498 +   </para>
3499 +  </entry>
3500 +  <entry> 
3501 +   <para> 
3502 +   configuration options may be set from command line by -O switch, for
3503 +   example:
3504 +   </para>
3505 +   <para nowrap="yes">
3506 +    $ poldek -Ovfile_external_compress=yes  
3507 +   </para>
3508 +  </entry>
3509 +
3510 +  <entry> 
3511 +   <para> 
3512 +   PLD-FreeBSD port (ftp://beliar.pld-freebsd.org/dists/1.0/ready/i386/RPMS/)
3513 +   </para>
3514 +   <author id="trojan" email="tomek att uninet com pl">Tomasz Trojanowski</author>
3515 +  </entry>
3516 +
3517 +  <entry> 
3518 +   <para>manual have been rewritten and enhanced</para>
3519 +  </entry>
3520 +</section>
3521 +</release>
3522 +
3523 +
3524 +<!-- ============================ 0.18.x ============================ -->
3525 +
3526 +<release version="0.18.9.1" date="2005/10/17" focus="bugfix release">
3527 +  <entry>
3528 +    <para>fixed writing diff list file (packages.diff.toc)</para>
3529 +  </entry>
3530 +  <entry>
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>
3533 +  </entry>
3534 +  <entry>
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>
3537 +  </entry>
3538 +  <entry>
3539 +    <para>fixed package version selection on greedy upgrade</para>
3540 +  </entry>
3541 +</release>
3542 +
3543 +
3544 +<release version="0.18.9" date="2005/07/03" focus="bugfix release">
3545 +  <entry>
3546 +    <para>handle package file 'mtime' tag ('t' tag) to be compatible with devel branch.</para>
3547 +  </entry>
3548 +  <entry>
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>
3552 +    <ul>
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>
3556 +    </ul>
3557 +  </entry>
3558 +  <entry>
3559 +    <para>fixed compilation with gcc 4.x (PLD's poldek-gcc4.patch)</para>
3560 +  </entry>
3561 +  <entry>
3562 +    <para>dependency resolving issues</para>
3563 +    <author id="mrk" email="mrk att sed pl">Mariusz Krynski</author>
3564 +    <ul>
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>
3567 +    </ul>
3568 +  </entry>
3569 +  <entry>
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>
3572 +  </entry>
3573 +</release>
3574 +<release version="0.18.8" date="2004/12/30" focus="bugfix release">
3575 +  <entry>
3576 +    <para>fixed checking file-based dependencies of packages being removed</para>
3577 +  </entry>
3578 +  <entry>
3579 +    <para>fixed another dependency processing bug (hard to explain)</para>
3580 +  </entry>
3581 +  <entry>
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>
3584 +  </entry>
3585 +  <entry>
3586 +    <para>removed usage of superfluous n_free()</para>
3587 +    <author id="twittner" email="twittner att o2 pl">Tomasz Wittner</author>
3588 +  </entry>
3589 +  <entry>
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>
3592 +  </entry>
3593 +  <entry>
3594 +    <para>support for RPM 4.4 </para>
3595 +  </entry>
3596 +  <entry>
3597 +    <para>fixed build under Owl (rpm 4.0.2 without libelf)</para>
3598 +  </entry>
3599 +  <entry>
3600 +    <para>workaround for "group not found" bug </para>
3601 +  </entry>
3602 +  <entry>
3603 +    <para>pl and de translation fixes (PLD Team)</para>
3604 +  </entry>
3605 +</release>
3606 +<release version="0.18.7" date="2004/09/24" focus="major bugfix release">
3607 +  <entry>
3608 +    <para>another stupid SIGSEGV killed (happened occasionally while dependency processing)</para>
3609 +  </entry>
3610 +  <entry>
3611 +    <para>vfile's progress bar improvements</para>
3612 +    <author id="patrys" email="p zawadzki att vegaballs com">Patryk Zawadzki</author>
3613 +  </entry>
3614 +  <entry>
3615 +    <para>fix: disabled package Epoch's autopromotion while checking if it matches requirement</para>
3616 +  </entry>
3617 +  <entry>
3618 +    <para>with rpm &gt;= 4.1 packages with same provide are obsoleted, not just name</para>
3619 +  </entry>
3620 +  <entry>
3621 +    <para>fixed processing dependencies of orphaned packages </para>
3622 +  </entry>
3623 +  <entry>
3624 +    <para>SIGSEGV killed while reading packages with dir/file names longer than 127 bytes</para>
3625 +  </entry>
3626 +  <entry>
3627 +    <para>fixed package ordering bug</para>
3628 +  </entry>
3629 +  <entry>
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>
3633 +  </entry>
3634 +</release>
3635 +<release version="0.18.6" date="2004/06/28" focus="major bugfix release">
3636 +  <entry>
3637 +    <para>fixed broken dist installation</para>
3638 +  </entry>
3639 +  <entry>
3640 +    <para>fixed serious bug with  dependency processing of obsoleted packages</para>
3641 +  </entry>
3642 +  <entry>
3643 +    <para>fixed --rpmdef '_dbpath DIR' (do not read rpm's configs many times)   </para>
3644 +  </entry>
3645 +  <entry>
3646 +    <para>fix: --nofollow with --install-dist works as expected (#920)</para>
3647 +  </entry>
3648 +  <entry>
3649 +    <para>vfile: fixed progress bar displaying on std sized terminal (79 cols)</para>
3650 +  </entry>
3651 +</release>
3652 +<release version="0.18.5" date="2004/05/23" focus="bugfix release">
3653 +  <entry>
3654 +    <para>fixed dowloading packages from apt-like sources </para>
3655 +  </entry>
3656 +</release>
3657 +<release version="0.18.4" date="2004/05/10" focus="bugfix and minor improvements release">
3658 +  <entry>
3659 +    <para>package filenames in "non-standard" form (N-V.R.ARCH.rpm) are supported</para>
3660 +  </entry>
3661 +  <entry>
3662 +    <para>killed SIGSEGVs on 64bit architecture</para>
3663 +    <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3664 +  </entry>
3665 +  <entry>
3666 +    <para>fixed Epoch comparison bug while checking uninstalled capabilities</para>
3667 +  </entry>
3668 +  <entry>
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>
3671 +  </entry>
3672 +  <entry>
3673 +    <para>fixed setting cache directory bug</para>
3674 +    <author id="a.piesk" email="a.piesk att gmx net">Andreas Piesk</author>
3675 +  </entry>
3676 +  <entry>
3677 +    <para>fixed serious bug of checking unversioned dependencies </para>
3678 +  </entry>
3679 +  <entry>
3680 +    <para>--ignore{arch,os} rpm options are honored</para>
3681 +  </entry>
3682 +  <entry>
3683 +    <para>rpm options could be passed as --rpm=OPTION too,
3684 +i.e. --rpm=ignorearch is equivalent of -- --rpm-ignorearch</para>
3685 +  </entry>
3686 +  <entry>
3687 +    <para>new cmdline options --rpm-{force,nodeps} which are passed
3688 +as --force and --nodeps to /bin/rpm only.</para>
3689 +  </entry>
3690 +  <entry>
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
3694 +config. </para>
3695 +  </entry>
3696 +  <entry>
3697 +    <para>"greedy" upgrade mode is enabled by default</para>
3698 +  </entry>
3699 +  <entry>
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
3705 +it.</para>
3706 +  </entry>
3707 +  <entry>
3708 +    <para>displaying package size summary of installed package
3709 +set</para>
3710 +  </entry>
3711 +  <entry>
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>
3715 +  </entry>
3716 +</release>
3717 +<release version="0.18.3" date="2004/01/10" focus="bugfix and improvements release">
3718 +  <entry>
3719 +    <para>internal HTTP client does not prevent proxy caching</para>
3720 +    <author id="arekm" email="arekm att pld-linux org">Arkadiusz Miskiewicz</author>
3721 +  </entry>
3722 +  <entry>
3723 +    <para>fixed bug on getting package capabilities having EVR with
3724 +empty Epoch like "foo = :1.0-1"</para>
3725 +  </entry>
3726 +  <entry>
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>
3729 +  </entry>
3730 +  <entry>
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>
3734 +  </entry>
3735 +  <entry>
3736 +    <para>kill unaligned traps on Alpha, time_t is not 32bit long (Jakub Bogusz &lt;qboosh att pld-linux org&gt;)</para>
3737 +    <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3738 +  </entry>
3739 +  <entry>
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>
3743 +  </entry>
3744 +  <entry>
3745 +    <para>support for RPM 4.2/4.3</para>
3746 +  </entry>
3747 +  <entry>
3748 +    <para>dependency processing fixes</para>
3749 +  </entry>
3750 +  <entry>
3751 +    <para>RPM 4.1 related fixes </para>
3752 +  </entry>
3753 +</release>
3754 +<release version="0.18.1" date="2002/11/27" focus="major bugfix release">
3755 +  <entry>
3756 +    <para>ability of creation empty indexes</para>
3757 +  </entry>
3758 +  <entry>
3759 +    <para>killed SIGSEV on '$ poldek -s /' (#443)</para>
3760 +  </entry>
3761 +  <entry>
3762 +    <para>fixed presentation of dependency tree during
3763 +unistallations; information about what package marks an others was
3764 +completely broken </para>
3765 +  </entry>
3766 +  <entry>
3767 +    <para>killed SIGSEV during dependencies processing</para>
3768 +  </entry>
3769 +  <entry>
3770 +    <para>fixed vfile's progress bar </para>
3771 +  </entry>
3772 +  <entry>
3773 +    <para>fixed 'hold' and 'ignore' package patterns matching</para>
3774 +  </entry>
3775 +  <entry>
3776 +    <para>fixed bug of interactive mode; after interrupted
3777 +installation selected packages are properly unmarked
3778 +now. </para>
3779 +  </entry>
3780 +</release>
3781 +<release version="0.18" date="2002/11/07" focus="bugfix/minor enhancements release">
3782 +  <entry>
3783 +    <para>support for RPM 4.1</para>
3784 +    <author part="yes" id="wiget" email="wiget att pld-linux org">Artur Frysiak</author>
3785 +  </entry>
3786 +  <entry>
3787 +    <para>few dependency processing improvements</para>
3788 +    <ul>
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>
3791 +    </ul>
3792 +  </entry>
3793 +  <entry>
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>
3796 +  </entry>
3797 +  <entry>
3798 +    <para>new: with --unique-pkg-names (-Q) packages with the same name 
3799 +           are removed from available package set</para>
3800 +  </entry>
3801 +  <entry>
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>
3806 +  </entry>
3807 +  <entry>
3808 +    <para>fixed available package list management in interactive mode </para>
3809 +  </entry>
3810 +  <entry>
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>
3814 +  </entry>
3815 +  <entry>
3816 +    <para>Polish translation of manual page</para>
3817 +    <author id="gotar" email="gotar att pld-linux org">Tomasz Pala</author>
3818 +  </entry>
3819 +  <entry>
3820 +    <para>fix: progress bar isn't refreshed so frequently (#367)</para>
3821 +  </entry>
3822 +</release>
3823 +<release version="0.17.9" date="2002/09/20" focus="bugfix/minor enhancements release">
3824 +  <entry>
3825 +    <para>Obsoletes tag is used during upgrades (if --greedy is set)</para>
3826 +  </entry>
3827 +
3828 +  <entry>
3829 +    <para>fixed dependency EVR matching</para>
3830 +  </entry>
3831 +
3832 +  <entry>
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
3837 + file.</para>
3838 +  </entry>
3839 +
3840 +  <entry>
3841 +    <para>bugfix: -s URL works fine </para>
3842 +  </entry>
3843
3844 +  <entry>
3845 +    <para> added poldek's logo </para>
3846 +    <author id="mimooh" email="mimooh att sgsp edu pl">Karol Krenski</author>
3847 +  </entry>
3848 +
3849 +</release>
3850 +<release version="0.17.8" date="2002/08/18" focus="major bugfix release">
3851 +  <entry>
3852 +    <para>package installation is verified with rpm database if rpm reports failure</para>
3853 +  </entry>
3854 +  <entry>
3855 +    <para>fixed obsoletes matching</para>
3856 +    <author id="qboosh" email="qboosh att pld-linux org">Jakub Bogusz</author>
3857 +  </entry>
3858 +  <entry>
3859 +    <para>improved and fixed file based conflicts detection</para>
3860 +  </entry>
3861 +  <entry>
3862 +    <para>fixed size units display</para>
3863 +    <author id="gotar" email="gotar att poczta.onet.pl">Tomasz Pala</author>
3864 +  </entry>
3865 +</release>
3866 +<release version="0.17.7" date="2002/06/14" focus="bugfix release">
3867 +  <entry>
3868 +    <para>improved package conflicts resolving</para>
3869 +  </entry>
3870 +  <entry>
3871 +    <para>split: SIGSEV killed </para>
3872 +  </entry>
3873 +  <entry>
3874 +    <para>fixed package removal  </para>
3875 +  </entry>
3876 +  <entry>
3877 +    <para>shell: search: fixed default options processing</para>
3878 +  </entry>
3879 +  <entry>
3880 +    <para>another "desynchronized index" bug is fixed</para>
3881 +  </entry>
3882 +  <entry>
3883 +    <para>fixed Epoch matching </para>
3884 +  </entry>
3885 +  <entry>
3886 +    <para>vhttp: program doesn't die on doubled HTTP headers </para>
3887 +  </entry>
3888 +</release>
3889 +<release version="0.17.6" date="2002/06/03" focus="minor bugfix release">
3890 +  <entry>
3891 +    <para>new "--ignore" option makes packages invisible to the poldek </para>
3892 +  </entry>
3893 +  <entry>
3894 +    <para>"hdrl" sources can be refreshed with --upa </para>
3895 +  </entry>
3896 +  <entry>
3897 +    <para>fixed package removal: don't follow dependencies if only one of 
3898 +multiple-installed packages is intended to uninstall </para>
3899 +  </entry>
3900 +  <entry>
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>
3904 +  </entry>
3905 +  <entry>
3906 +    <para>fixed package auto-selection among equivalents: dependencies aren't verified strictly 
3907 +during package scoring. </para>
3908 +  </entry>
3909 +  <entry>
3910 +    <para>fixed bug of equivalent package selection (&lt;Enter&gt; was select first, 
3911 +notdefault package).</para>
3912 +  </entry>
3913 +  <entry>
3914 +    <para>shell: with 'upgrade' and 'greedy-upgrade' commands only upgradeable 
3915 +packages are auto-completed.  </para>
3916 +  </entry>
3917 +</release>
3918 +<release version="0.17.5" date="2002/05/15" focus="minor bugfix release">
3919 +  <entry>
3920 +    <para>about 75% less memory is used by incremental update of packages.dir </para>
3921 +  </entry>
3922 +  <entry>
3923 +    <para>improved package auto-selection among equivalents: package which marks
3924 + less packages to install is preferred</para>
3925 +  </entry>
3926 +  <entry>
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>
3929 +  </entry>
3930 +  <entry>
3931 +    <para>bugfix: root directory (--rootdir) is always passed to rpm as absolute path  </para>
3932 +  </entry>
3933 +  <entry>
3934 +    <para>shell: desc: file mode is displayed in human readable form</para>
3935 +  </entry>
3936 +  <entry>
3937 +    <para>fixed vfjuggle: packages.dir.md* are copied to hdd too</para>
3938 +  </entry>
3939 +  <entry>
3940 +    <para>few SIGSEVs killed on "search" command when APT's pkglist file is used as package index 
3941 +</para>
3942 +    <author part="yes" id="niemeyer" email="niemeyer att conectiva com">Gustavo Niemeyer</author>
3943 +  </entry>
3944 +</release>
3945 +<release version="0.17.4" date="2002/05/06" focus="bugfix/minor enhancements release">
3946 +  <entry>
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>
3950 +  </entry>
3951 +  <entry>
3952 +    <para>shell: fixed C-c handling (connecting phase can be interrupted)</para>
3953 +  </entry>
3954 +  <entry>
3955 +    <para>improved splitting</para>
3956 +    <ul>
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>
3959 +    </ul>
3960 +  </entry>
3961 +  <entry>
3962 +    <para>killed SIGSEV on long URL's basenames</para>
3963 +  </entry>
3964 +  <entry>
3965 +    <para>source prefix is handled properly with --mkidx*</para>
3966 +  </entry>
3967 +</release>
3968 +<release version="0.17.3" date="2002/04/23" focus="major enhancements release">
3969 +  <entry>
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 
3976 +configuration.
3977 +</para>
3978 +  </entry>
3979 +  <entry>
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>
3981 +  </entry>
3982 +  <entry>
3983 +    <para>support for GPG/PGP signatures verification (new "gpg" and "pgp" source options). Verification works well with rpm &gt;= 4.0.4 or patched PLD's rpm 4.0.2 package (release 62). </para>
3984 +  </entry>
3985 +  <entry>
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>
3987 +  </entry>
3988 +  <entry>
3989 +    <para>added IPv6 support to internal FTP client</para>
3990 +  </entry>
3991 +  <entry>
3992 +    <para>new "--clean" and "--clean-whole" options for cache directorycleanup</para>
3993 +  </entry>
3994 +  <entry>
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>
3997 +  </entry>
3998 +  <entry>
3999 +    <para>new "ftp_sysuser_as_anon_passwd" option causes sending login at 
4000 +           hostname as anonymous FTP password </para>
4001 +  </entry>
4002 +  <entry>
4003 +    <para>new "noautoup" source option tells poldek to do not update source by default. </para>
4004 +  </entry>
4005 +  <entry>
4006 +    <para>shell: added long listig format of file list (poldek&gt; desc -ll)</para>
4007 +  </entry>
4008 +  <entry>
4009 +    <para>misc fixes to compile on SuSE</para>
4010 +  </entry>
4011 +  <entry>
4012 +    <para>fixed rpm 3.x support</para>
4013 +    <author part="yes" id="rl" email="rl att hellgate.ch">Roger Luethi</author>
4014 +  </entry>
4015 +  <entry>
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>
4019 +  </entry>
4020 +  <entry>
4021 +    <para>fixed detection of file based conflicts between available packages. </para>
4022 +  </entry>
4023 +  <entry>
4024 +    <para>packages with capabilities with the same name and different
4025 +     versions are handled properly</para>
4026 +  </entry>
4027 +  <entry>
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>
4030 +  </entry>
4031 +  <entry>
4032 +    <para>installation of multiple instances of package is allowed (by poldek -i)</para>
4033 +  </entry>
4034 +  <entry>
4035 +    <para>fixes and improvements of dependency resolution</para>
4036 +    <ul>
4037 +      <li>fixed greedy mode</li>
4038 +      <li>fixed handling package conflicts added by poldek</li>
4039 +      <li>faster dependency checking</li>
4040 +    </ul>
4041 +  </entry>
4042 +  <entry>
4043 +    <para>German translation</para>
4044 +    <author id="a.piesk" email="a.piesk att gmx.net">Andreas Piesk</author>
4045 +  </entry>
4046 +  <entry>
4047 +    <para>various bugs are fixed</para>
4048 +    <ul>
4049 +      <li>double '/' in paths handling</li>
4050 +      <li>huge mem leak on --update </li>
4051 +      <li>ambiguous p_open() flags (Michal Moskal &lt;malekith att pld-linux org&gt;)</li>
4052 +      <li>removed [v]snprintf() (wrong) usage; trurlib's n_[v]snprintf() are used instead</li>
4053 +      <li>automake/autoconf fixes (Artur Frysiak &lt;wiget att pld-linux org&gt;)</li>
4054 +    </ul>
4055 +  </entry>
4056 +</release>
4057 +<release version="0.17.2" date="2002/03/26" focus="bugfix release">
4058 +  <entry>
4059 +    <para>"ported" to RedHat 7.2 (with rpm 4.0.4)</para>
4060 +  </entry>
4061 +  <entry>
4062 +    <para>install-dist: --force forces installation of broken package sets</para>
4063 +  </entry>
4064 +  <entry>
4065 +    <para>corrected package installation progress bar</para>
4066 +    <author id="malekith" email="malekith att pld-linux org">Michal Moskal</author>
4067 +  </entry>
4068 +  <entry>
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>
4071 +  </entry>
4072 +  <entry>
4073 +    <para>--dump* works properly</para>
4074 +  </entry>
4075 +  <entry>
4076 +    <para>vftp: fixed error handling</para>
4077 +  </entry>
4078 +</release>
4079 +<release version="0.17.1" date="2002/03/26" focus="bugfix release">
4080 +  <entry>
4081 +    <para>ftp: fixed multiline responses handling</para>
4082 +  </entry>
4083 +</release>
4084 +<release version="0.17" date="2002/02/21" focus="major enhancements release">
4085 +  <entry>
4086 +    <para>added support for package.dir's "patches" (new option --update-whole updates 
4087 +           whole index; --update looking for patches first)</para>
4088 +  </entry>
4089 +  <entry>
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
4092 +           the rest. </para>
4093 +  </entry>
4094 +  <entry>
4095 +    <para>improved dependency processing</para>
4096 +    <ul>
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>
4101 +    </ul>
4102 +  </entry>
4103 +  <entry>
4104 +    <para>added simple ftp client; it is used for FTP downloads by default</para>
4105 +  </entry>
4106 +  <entry>
4107 +    <para>shell</para>
4108 +    <ul>
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>
4113 +    </ul>
4114 +  </entry>
4115 +  <entry>
4116 +    <para>added log file support (--log option)</para>
4117 +  </entry>
4118 +  <entry>
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>
4121 +  </entry>
4122 +  <entry>
4123 +    <para>packages.dir's integrity is verified before each loadingwhat prevents program 
4124 +           SIGSEVs on load broken indexes</para>
4125 +  </entry>
4126 +  <entry>
4127 +    <para>changed default cache directory to $HOME/.poldek-cache</para>
4128 +  </entry>
4129 +  <entry>
4130 +    <para>package MD5 sums are verified before install</para>
4131 +  </entry>
4132 +  <entry>
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>
4136 +  </entry>
4137 +  <entry>
4138 +    <para>few (nice) improvements and (not so nice ;-) bugs fixed</para>
4139 +  </entry>
4140 +</release>
4141 +<release version="0.16" date="2002/01/29" focus="bugfix release">
4142 +  <entry>
4143 +    <para>fixed removable media support in non-install-dist modes</para>
4144 +  </entry>
4145 +  <entry>
4146 +    <para>shell: uninstall: fix: don't remove pkg from install list if removal fails</para>
4147 +  </entry>
4148 +</release>
4149 +<release version="0.15.9" date="2002/01/11" focus="major enhancements release">
4150 +  <entry>
4151 +    <para>shell</para>
4152 +    <ul>
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>
4158 +    </ul>
4159 +  </entry>
4160 +  <entry>
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>
4163 +  </entry>
4164 +  <entry>
4165 +    <para>fix: don't include trailing whitespaces in config values</para>
4166 +  </entry>
4167 +</release>
4168 +<release version="0.15.8" date="2001/10/29" focus="bugfix release">
4169 +  <entry>
4170 +    <para>curl: disabled timeouts, cURL's timeout it's a time to transfer file </para>
4171 +  </entry>
4172 +  <entry>
4173 +    <para>curl: amount and total sizes are displayed in progress bar</para>
4174 +  </entry>
4175 +  <entry>
4176 +    <para>fix: enabled --hold </para>
4177 +  </entry>
4178 +  <entry>
4179 +    <para>fix: SIGSEV killed when pkg description requested while pkg index
4180 +doesn't contain package descriptions at all</para>
4181 +  </entry>
4182 +  <entry>
4183 +    <para>shell: fixed installed package list management</para>
4184 +  </entry>
4185 +  <entry>
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>
4188 +  </entry>
4189 +  <entry>
4190 +    <para>"mercy" mode bugfix</para>
4191 +  </entry>
4192 +</release>
4193 +<release version="0.15.7" date="2001/10/10" focus="major enhancements release">
4194 +  <entry>
4195 +    <para>downloaded packages are removed after successful installation by default 
4196 +(keep_downloads=yes in config can change to previous behavior)</para>
4197 +  </entry>
4198 +  <entry>
4199 +    <para>changed semantics of --test: -t causes poldek's checks only, 
4200 +      -tt turns on tests performed by rpm too.</para>
4201 +  </entry>
4202 +  <entry>
4203 +    <para>"mercy" dependency checking mode may be enabled in config</para>
4204 +  </entry>
4205 +  <entry>
4206 +    <para>added workarounds and traps for (probably) curl's bugs</para>
4207 +  </entry>
4208 +  <entry>
4209 +    <para>"update" option can be used with other commands simultaneously</para>
4210 +  </entry>
4211 +  <entry>
4212 +    <para>shell mode is now the default</para>
4213 +  </entry>
4214 +  <entry>
4215 +    <para>shell: added greedy option to install cmd</para>
4216 +  </entry>
4217 +</release>
4218 +<release version="0.15.6" date="2001/08/12" focus="bugfix/major enhancements release">
4219 +  <entry>
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>
4222 +  </entry>
4223 +  <entry>
4224 +    <para>added global config /etc/poldek.conf usage </para>
4225 +  </entry>
4226 +  <entry>
4227 +    <para>fixed prereq loop detection</para>
4228 +  </entry>
4229 +  <entry>
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>
4232 +  </entry>
4233 +  <entry>
4234 +    <para>vfjuggle: sed is used instead of awk</para>
4235 +    <author id="klakier" email="klakier att pld-linux org">Rafal Kleger-Rudomin</author>
4236 +  </entry>
4237 +  <entry>
4238 +    <para>shell: ls: fixed packages sorting </para>
4239 +  </entry>
4240 +  <entry>
4241 +    <para>minor bugfixes </para>
4242 +  </entry>
4243 +</release>
4244 +<release version="0.15.5" date="2001/07/20" focus="bugfix release">
4245 +  <entry>
4246 +    <para>another bugfix of dependency processing</para>
4247 +  </entry>
4248 +  <entry>
4249 +    <para>shell: new ls options: -t, -T, -r</para>
4250 +  </entry>
4251 +  <entry>
4252 +    <para>added --shcmd option which allows to execute poldek's shell command 
4253 +without entering shell mode </para>
4254 +  </entry>
4255 +  <entry>
4256 +    <para>detect if stdout is connected to a terminal and display progress bars accordingly.</para>
4257 +  </entry>
4258 +  <entry>
4259 +    <para>install-dist: retry to fetch packages if connection is down</para>
4260 +  </entry>
4261 +</release>
4262 +<release version="0.15.4" date="2001/07/17" focus="bugfix release">
4263 +  <entry>
4264 +    <para>conflicts detection bugfix </para>
4265 +  </entry>
4266 +</release>
4267 +<release version="0.15.3" date="2001/07/16" focus="bugfix release">
4268 +  <entry>
4269 +    <para>another bugfix of dependency processing</para>
4270 +  </entry>
4271 +  <entry>
4272 +    <para>splitted verify option to verify, verify-conflicts and verify-fileconflicts</para>
4273 +  </entry>
4274 +  <entry>
4275 +    <para>more user friendly output on package set verification</para>
4276 +  </entry>
4277 +</release>
4278 +<release version="0.15.2" date="2001/07/13" focus="bugfix/major enhancements release">
4279 +  <entry>
4280 +    <para>added "hold" and "greedy" commands </para>
4281 +  </entry>
4282 +  <entry>
4283 +    <para>added FIRST_FREE_SPACE param to split option</para>
4284 +  </entry>
4285 +  <entry>
4286 +    <para>fixed bug of dependency processing</para>
4287 +  </entry>
4288 +  <entry>
4289 +    <para>minor bugfixes </para>
4290 +  </entry>
4291 +</release>
4292 +<release version="0.15.1" date="2001/06/28" focus="major bugfix release">
4293 +  <entry>
4294 +    <para>spliting: changed packages.chunk* format: full package filenames are printed 
4295 + and removed comments. </para>
4296 +  </entry>
4297 +  <entry>
4298 +    <para>bugfixes </para>
4299 +  </entry>
4300 +</release>
4301 +<release version="0.15" date="2001/06/26" focus="bugfix/major enhancements release">
4302 +  <entry>
4303 +    <para>updated vfcurl progress bar handling (according to curl 7.8)</para>
4304 +  </entry>
4305 +  <entry>
4306 +    <para>better index format version handling (minor.major ver schema), current 
4307 +     version is 1.0, older versions not supported...</para>
4308 +  </entry>
4309 +  <entry>
4310 +    <para>package's integer fields are stored in binary form, groups are stored as separate, global tag</para>
4311 +  </entry>
4312 +  <entry>
4313 +    <para>remote indexes are verified after download</para>
4314 +  </entry>
4315 +  <entry>
4316 +    <para>added checking of package architecture and OS</para>
4317 +  </entry>
4318 +  <entry>
4319 +    <para>added support for removable media (vfjuggle script is added)</para>
4320 +  </entry>
4321 +  <entry>
4322 +    <para>added package file size to index (for spliting)</para>
4323 +  </entry>
4324 +  <entry>
4325 +    <para>added "nofollow" option to cmdline and "follow" one to config        </para>
4326 +  </entry>
4327 +  <entry>
4328 +    <para>renamed "freshen" to "fresh" and changed its semantics, now rpm's 
4329 +"--freshen" &lt;=&gt; "--nofollow --fresh"</para>
4330 +  </entry>
4331 +  <entry>
4332 +    <para>changed default index name to "packages.dir"</para>
4333 +  </entry>
4334 +  <entry>
4335 +    <para>added mkpackagedir script</para>
4336 +  </entry>
4337 +  <entry>
4338 +    <para>added spliting (--split* options)</para>
4339 +  </entry>
4340 +  <entry>
4341 +    <para>package-set file syntax: changed "maybe" mark to '~' ('!' still work, but obsoleted)</para>
4342 +  </entry>
4343 +  <entry>
4344 +    <para>shell</para>
4345 +    <ul>
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>
4350 +    </ul>
4351 +  </entry>
4352 +  <entry>
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>
4356 +  </entry>
4357 +</release>
4358 +<release version="0.14" date="2001/06/12" focus="bugfix/major enhancements release">
4359 +  <entry>
4360 +    <para>support for multiple sources</para>
4361 +  </entry>
4362 +  <entry>
4363 +    <para>Packages SHA1 digest is computed and checked (Packages.md is created) </para>
4364 +  </entry>
4365 +  <entry>
4366 +    <para>capabilities/requirement are stored in binary form (v0.4 of Packages format)</para>
4367 +  </entry>
4368 +  <entry>
4369 +    <para>default name (Packages[.gz]) is used if only dir is given as source (i.e. it's last character is '/') </para>
4370 +  </entry>
4371 +  <entry>
4372 +    <para>shell: both installed and available packages list is maintained properly during installs/unistalls without reloading rpm database </para>
4373 +  </entry>
4374 +  <entry>
4375 +    <para>shell: added "search" command</para>
4376 +  </entry>
4377 +  <entry>
4378 +    <para>removed unused support for rpmidx (aka tocfile)</para>
4379 +  </entry>
4380 +  <entry>
4381 +    <para>cleanup and bugfixes </para>
4382 +  </entry>
4383 +</release>
4384 +</news>
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
4388 @@ -0,0 +1,16 @@
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"
4392 +                version='1.0'>
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>
4397 +
4398 +<xsl:param name="html.stylesheet.type">text/css</xsl:param>
4399 +<xsl:param name="html.stylesheet" select="'manual.css'"></xsl:param>
4400 +
4401 +<xsl:param name="draft.mode" select="'no'"></xsl:param>
4402 +
4403 +<xsl:param name="generate.toc"/>
4404 +</xsl:stylesheet>
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
4408 @@ -42,8 +42,8 @@
4409  </para>
4410  
4411  <para>
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.
4416  </para>
4417    </refsect1>
4418  
4419 @@ -61,6 +61,15 @@
4420  &ref-miscellaneous_options;
4421  </refsect1>
4422  
4423 +<refsect1><title>AUTHOR</title>
4424 +<para>
4425 +Pawel A. Gajda &lt;mis at pld.org.pl&gt;
4426 +</para>
4427 +<para>
4428 +See CREDITS file for a list of contributors.
4429 +</para>
4430 +</refsect1>
4431 +
4432  <refsect1><title>See also</title>
4433  <para>
4434    <citerefentry>
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
4438 @@ -1,4 +1,23 @@
4439  <?xml version='1.0'?>
4440 +
4441 +<!--  
4442 +option syntax
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.
4453 +>
4454 +<description> OPTION DESCRIPTION </description>
4455 +<alias name="ALIAS NAME" obsoleted="{yes,no}" /> an option alias
4456 +</option>
4457 +-->
4458 +
4459  <config name="poldek.conf">
4460  
4461  <section id="synopsis" target="manual">
4462 @@ -133,6 +152,18 @@
4463  
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" />
4476 +
4477 +
4478    <option name="default index type" type="string" default="pndir">
4479      <description>
4480      This parameter allows to configure the default repository index type.
4481 @@ -141,7 +172,7 @@
4482  
4483    <option name="cachedir" type="string" default="$HOME/.poldek-cache" env="yes">
4484      <description>
4485 -     Cache directory for downloaded files. NOTE: that parent directory of cachedir 
4486 +     Cache directory for downloaded files. NOTE that parent directory of cachedir 
4487       must exists.
4488      </description>
4489    </option>
4490 @@ -153,10 +184,10 @@
4491      <alias name="run as" />
4492    </option>
4493  
4494 -  <option name="use sudo" type="boolean" default="no">
4495 +  <option name="use sudo" type="boolean3" default="auto" op="USESUDO">
4496      <description>
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.
4501      </description>
4502    </option>
4503  
4504 @@ -182,21 +213,13 @@
4505      </description>
4506    </option>
4507  
4508 -  <option name="rpm" type="string" default="" env="yes" hide="yes">
4509 -    <description></description>
4510 -  </option>
4511 -
4512 -  <option name="sudo" type="string" default="" env="yes" hide="yes">
4513 -    <description></description>
4514 -  </option>
4515 -
4516 -  <option name="autoupa" type="boolean" default="yes" hide="yes">
4517 +  <option name="autoupa" type="boolean" default="yes">
4518      <description>
4519      Automatically download whole index if incremental update fails.
4520      </description>
4521    </option>
4522  
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">
4525      <description>
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 @@
4529      </description>
4530    </option>
4531  
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">
4534      <description>
4535      Full path name to a PM (rpm for now) binary. 
4536      </description>
4537 +    <alias name="rpm command" obsoleted="yes" />
4538    </option>
4539  
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">
4542      <description>
4543      Full path name to sudo binary. 
4544      </description>
4545 @@ -226,7 +250,7 @@
4546      Send ${USER}@${HOSTNAME} as anonymous FTP password (by default 
4547      [literal]'poldek@znienacka.net'[/literal] is sent) 
4548      </description>
4549 -    <alias name="ftp sysuser as anon passwd" /> <!-- legacy -->
4550 +    <alias name="ftp sysuser as anon passwd" obsoleted="yes" /> <!-- legacy -->
4551    </option>
4552  
4553    <option name="default fetcher" type="string" default="http,ftp: internal" multiple="yes">
4554 @@ -266,7 +290,7 @@
4555      </description>
4556    </option>
4557  
4558 -  <option name="noproxy" type="string" default="" multiple="yes">
4559 +  <option name="noproxy" type="string" list="yes" default="" multiple="yes">
4560      <description>
4561      Comma separated list of hosts or domains which will not be accessed via proxy.
4562      Option overrides no_proxy environment variable.
4563 @@ -275,6 +299,7 @@
4564   noproxy = localhost, .pl, ftp.foo.bar.org
4565      [/screen]
4566      </description>
4567 +    <alias name="no proxy" />
4568    </option>
4569  
4570    <option name="vfile retries" type="integer" default="128">
4571 @@ -287,20 +312,20 @@
4572  </optiongroup>
4573  
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">
4577      <description>
4578       Install packages in small groups instead of doing all-or-nothing 
4579       installations.
4580      </description>
4581    </option>
4582  
4583 -  <option name="keep downloads" type="boolean" default="no">
4584 +  <option name="keep downloads" type="boolean" default="no" op="KEEP_DOWNLOADS">
4585      <description>
4586      Do not remove downloaded packages after its successful installation.
4587      </description>
4588    </option>
4589  
4590 -  <option name="unique package names" type="boolean" default="no">
4591 +  <option name="unique package names" type="boolean" default="no" op="UNIQN">
4592      <description>
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 @@
4596    </option>
4597  
4598  
4599 -  <option name="promoteepoch" type="boolean" default="no">
4600 +  <option name="promoteepoch" type="boolean" default="no" op="PROMOTEPOCH">
4601      <description>
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.
4604      </description>
4605    </option>
4606  
4607 -  <option name="confirm installation" type="boolean" default="no">
4608 +  <option name="confirm installation" type="boolean" default="no" op="CONFIRM_INST">
4609      <description>
4610      Confirm packages installation.
4611      </description>
4612 -    <alias name="confirm installs" legacy="yes"/> 
4613 +    <alias name="confirm installs" obsoleted="yes"/> 
4614    </option>
4615  
4616 -  <option name="confirm removal" type="boolean" default="yes">
4617 +  <option name="confirm removal" type="boolean" default="yes" op="CONFIRM_UNINST">
4618      <description>
4619      Confirm packages removal.
4620      </description>
4621    </option>
4622  
4623 -  <option name="choose equivalents manually" type="boolean" default="no">
4624 +  <option name="choose equivalents manually" type="boolean" default="no" op="EQPKG_ASKUSER">
4625      <description>
4626      Let the user select package among equivalents.
4627      </description>
4628    </option>
4629  
4630 -  <option name="hold" type="string-list" default="" multiple="yes">
4631 +  <option name="hold" type="string" list="yes" default="" multiple="yes">
4632      <description>
4633      Prevent package listed from being upgraded if they are already installed.
4634      [screen]
4635   hold = kernel* dev
4636      [/screen]
4637      </description>
4638 +    <alias name="a hold alias for testing purposes" obsoleted="yes" />
4639    </option>
4640  
4641 -  <option name="ignore" type="string-list" default="" multiple="yes">
4642 +  <option name="ignore" type="string" list="yes" default="" multiple="yes">
4643      <description>
4644      Ignore package list - packages fits given mask will be invisible.
4645      [screen]
4646 @@ -352,7 +378,7 @@
4647      </description>
4648    </option>
4649  
4650 -  <option name="allow duplicates" type="boolean" default="yes">
4651 +  <option name="allow duplicates" type="boolean" default="yes" op="ALLOWDUPS">
4652      <description>
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
4658  </description>
4659 +  <option name="multilib" type="boolean3" default="auto" hidden="yes" op="MULTILIB"/>
4660  
4661 -  <option name="follow" type="boolean" default="yes">
4662 +  <option name="follow" type="boolean" default="yes" op="FOLLOW">
4663      <description>
4664      Automatically install packages required by installed ones.
4665      </description>
4666    </option>
4667  
4668 -  <option name="greedy" type="boolean" default="yes">
4669 +  <option name="greedy" type="boolean" default="yes" op="GREEDY">
4670      <description>
4671      Greedy upgrades, i.e. upgrade packages which dependencies are broken
4672      by being uninstalled ones.
4673      </description>
4674    </option>
4675  
4676 -  <option name="aggressive greedy" type="boolean" default="yes">
4677 +  <option name="aggressive greedy" type="boolean" default="yes" op="AGGREEDY">
4678      <description>
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
4681 @@ -407,7 +434,7 @@
4682      </description>
4683    </option>
4684  
4685 -  <option name="mercy" type="boolean" default="no">
4686 +  <option name="mercy" type="boolean" default="no" op="VRFYMERCY">
4687      <description>
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 @@
4691      </description>
4692    </option>
4693  
4694 -  <option name="obsoletes" type="boolean" default="yes">
4695 +  <option name="obsoletes" type="boolean" default="yes" op="OBSOLETES">
4696      <description>
4697      Taking into account package Obsoletes.
4698      </description>
4699    </option>
4700  
4701 -  <option name="conflicts" type="boolean" default="yes">
4702 +  <option name="conflicts" type="boolean" default="yes" op="CONFLICTS">
4703      <description>
4704      Taking into account package Conflicts.
4705      </description>
4706    </option>
4707 +
4708 +  <!-- internal tag -->
4709 +  <!-- <option name="__dirname" type="string" hidden="yes" /> -->
4710 +
4711  </optiongroup>
4712  </confsection> <!-- end of "global" -->
4713  
4714 @@ -439,7 +470,7 @@
4715  </description>
4716  </section>
4717  
4718 -<confsection name="source" id="section.source" config="source.conf">
4719 +<confsection name="source" id="section.source" config="source.conf" multiple="yes">
4720  <description>
4721  This section contains poldek's repository configuration. 
4722  Every repository is configured in its own [ source ] section.
4723 @@ -453,7 +484,7 @@
4724      </description>
4725    </option>  
4726  
4727 -  <option name="type" type="string" value="pndir">
4728 +  <option name="type" type="string" required="yes" value="pndir">
4729      <description>
4730      Type of repository index. Permitted values are 'pndir', 'pdir', 'apt', 'yum' 
4731      and 'dir' as listed by [option]--stl[/option] switch.
4732 @@ -468,7 +499,7 @@
4733      </description>
4734    </option>
4735  
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">
4738      <description>
4739      Unique name of the repository. May be either path or URL.
4740      </description>
4741 @@ -487,6 +518,7 @@
4742      Controls visibility of multiple package instances with different EVR.
4743      If on, only one, highest version will be visible.
4744      </description>
4745 +    <alias name="unique package names" /> 
4746    </option>
4747  
4748    <option name="pri" type="integer" default="0">
4749 @@ -515,6 +547,9 @@
4750      </description>
4751    </option>
4752  
4753 +  <option name="noauto" type="boolean" default="no" obsoleted="yes" />
4754 +  <option name="noautoup" type="boolean" default="no" obsoleted="yes"/>
4755 +
4756    <option name="signed" type="boolean" default="no">
4757      <description>
4758      Packages PGP/GPG signatures (if any) will be verified before their 
4759 @@ -522,7 +557,7 @@
4760      </description>
4761    </option>
4762  
4763 -  <option name="hold" type="string-list" default="" multiple="yes">
4764 +  <option name="hold" type="string" list="yes" default="" multiple="yes">
4765      <description>
4766      Have the same meaning as [ global ] parameter. Example:
4767      [screen]
4768 @@ -531,7 +566,7 @@
4769      </description>
4770    </option>
4771  
4772 -  <option name="ignore" type="string-list" default="" multiple="yes">
4773 +  <option name="ignore" type="string" list="yes" default="" multiple="yes">
4774      <description>
4775      Have the same meaning as [ global ] parameter. Example:
4776      [screen]
4777 @@ -540,7 +575,7 @@
4778      </description>
4779    </option>
4780  
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">
4783      <description>
4784      Parameter have the same meaning as [ global ] parameter.
4785      [screen]
4786 @@ -557,6 +592,13 @@
4787   lang = pl_PL:lt_LT
4788      [/screen]
4789      </description>
4790 +    <alias name="dscr" obsoleted="yes" />
4791 +  </option>
4792 +
4793 +  <option name="sources" type="string" list="yes" value="foo foo-updates">
4794 +    <description>  
4795 +    Make sense for 'group' source type only. A list of names of sources.
4796 +    </description> 
4797    </option>
4798    <footer target="config">
4799  
4800 @@ -596,7 +638,7 @@
4801  </description>
4802  </section>
4803  
4804 -<confsection name="fetcher" id="section.fetcher" config="fetch.conf">
4805 +<confsection name="fetcher" id="section.fetcher" config="fetch.conf" multiple="yes">
4806  <description>
4807  This section contains external downloaders configuration. 
4808  Each section describes one fetcher.
4809 @@ -610,7 +652,7 @@
4810      </description>
4811    </option>  
4812  
4813 -  <option name="proto" type="string-list" value="foo,bar">
4814 +  <option name="proto" type="string" value="foo,bar" required="yes">
4815      <description>
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
4818 @@ -618,7 +660,7 @@
4819      </description>
4820    </option>  
4821  
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">
4824      <description>
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
4830 @@ -0,0 +1,43 @@
4831 +#!/bin/sh
4832 +
4833 +libNAME=libpoldek
4834 +if [ -n "$1" ]; then libNAME="lib$1"; fi
4835 +
4836 +LIB=.libs/${libNAME}_allsyms.a
4837 +if [ ! -f $LIB ]; then echo "$LIB: no such file"; exit 1; fi
4838 +
4839 +INCLUDES=$(grep ^libHEADERS Makefile.am | perl -ne 's|^libHEADERS\s*=\s*||; print')
4840 +
4841 +HH="/tmp/hh";
4842 +> /tmp/hh
4843 +for i in $INCLUDES; do 
4844 +    gcc -E $i 2>/dev/null >>$HH;
4845 +done
4846 +
4847 +
4848 +symlist=$(nm --defined-only $LIB | pcregrep '^\w+\s+[tT]' | awk '{print $3}' | sort -u)
4849 +
4850 +#out=$(basename $LIB .so)
4851 +#out="$out.sym"
4852 +out="${libNAME}.sym"
4853 +> $out
4854 +for s in $symlist; do
4855 +    if pcregrep -s "\b$s\(" $HH; then
4856 +       echo "+ $s"
4857 +       echo $s >> $out
4858 +    fi
4859 +done  
4860 +  
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
4864 +
4865 +# provide rpmlog to cover rpmlib's one -- haaack 
4866 +    nm --defined-only $LIB | pcregrep '\brpmlog\b' | awk '{print $3}' >> $out
4867 +
4868 +fi
4869 +
4870 +
4871 +if [ "$libNAME" = "libpoclidek" ]; then
4872 +    nm --defined-only $LIB | pcregrep '^\w+\s+[D]' | awk '{print $3}' | grep poclidek_ | sort -u >> $out
4873 +fi
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
4877 @@ -0,0 +1,50 @@
4878 +#!/bin/sh
4879 +# $Id$
4880 +
4881 +do_configure() 
4882 +{
4883 +   nn="$1"
4884 +   [ -d $nn ] || exit 1
4885 +   [ -f $nn/configure ] || (cd $nn && ./autogen.sh --no-configure)
4886 +}
4887 +
4888 +PATH="/bin/:/usr/bin:/sbin:/usr/sbin"
4889 +if [ ! -f capreq.h ]; then
4890 +    cd `dirname $0`;
4891 +    if [ ! -f capreq.h ]; then
4892 +        echo "$0: `pwd`: not a poldek directory"
4893 +        exit 1
4894 +    fi  
4895 +fi
4896 +
4897 +name=$1
4898 +mode=$2
4899 +
4900 +[ -n "$name" ] || exit 1
4901 +
4902 +# no ../$name => we are propably in distribution tree
4903 +if [ ! -d ../$name -a -d $name ]; then 
4904 +   do_configure $name;
4905 +   exit;
4906 +fi
4907 +
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
4911 +fi
4912 +
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
4916 +fi     
4917 +
4918 +if [ ! -d $name ]; then 
4919 +        if [ -n "$mode" -a $mode == "link" ]; then 
4920 +                ln ../$name -sf 
4921 +        else 
4922 +                cp -a ../$name .
4923 +    fi
4924 +fi
4925 +
4926 +do_configure $name        
4927 +
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
4931 @@ -11,7 +11,7 @@
4932  */
4933  
4934  /*
4935 -  $Id$
4936 +  $Id$
4937  */
4938  
4939  #include "ictx.h"
4940 @@ -96,10 +96,13 @@
4941      if (found) {
4942          struct pkg *real_tomark = tomark;
4943          if (tomark_candidates) {
4944 -            int n;
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,
4948 +                                          tomark);
4949              n_cfree(&tomark_candidates);
4950 +            if (real_tomark == NULL) { /* user aborts */
4951 +                ictx->nerr_fatal++;
4952 +                found = 0;
4953 +            }
4954          }
4955          tomark = real_tomark;
4956          
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
4960 @@ -11,7 +11,7 @@
4961  */
4962  
4963  /*
4964 -  $Id$
4965 +  $Id$
4966  */
4967  
4968  #include "ictx.h"
4969 @@ -25,13 +25,34 @@
4970  
4971      capreq_new_name_a(capname, cap);
4972      dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cap, NULL, 0);
4973 +
4974      if (dbpkgs == NULL) {
4975 -        struct pkg *pkg;
4976 +        struct pkg *pkg = NULL;
4977 +        
4978          if (ts->getop(ts, POLDEK_OP_FRESHEN))
4979              return 0;
4980  
4981          n_array_sort_ex(pkgs, (tn_fn_cmp)pkg_cmp_name_evr_rev);
4982 -        pkg = n_array_nth(pkgs, 0);
4983 +
4984 +        if (ts->getop(ts, POLDEK_OP_EQPKG_ASKUSER) && ts->askpkg_fn &&
4985 +            n_array_size(pkgs) > 1) {
4986 +            
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;
4992 +
4993 +            pkg = in_choose_equiv(ts, cap, candidates, NULL);
4994 +            if (pkg == NULL) {    /* user aborts */
4995 +                found = -1;
4996 +                goto l_end;
4997 +            }
4998 +        }
4999 +        
5000 +        if (pkg == NULL)
5001 +            pkg = n_array_nth(pkgs, 0);
5002 +        
5003          pkg_hand_mark(ts->pms, pkg);
5004          return 1;
5005      }
5006 @@ -65,7 +86,7 @@
5007                  
5008              else if (cmprc < 0 && poldek_ts_issetf(ts, POLDEK_TS_DOWNGRADE))
5009                  mark = 1;
5010 -
5011 +            
5012              if (mark) {
5013                  found = 1;
5014                  msgn(1, _("%s: marked as %s's provider"), pkg_id(pkg),
5015 @@ -82,10 +103,10 @@
5016                  
5017              } else {
5018                  n_assert(0);
5019 -                
5020              }
5021          }
5022      }
5023 +    
5024  l_end:
5025      if (dbpkgs)
5026          n_array_free(dbpkgs);
5027 @@ -93,20 +114,26 @@
5028      return found;
5029  }
5030  
5031 +/* handles  --caplookup */
5032  int in_prepare_icaps(struct poldek_ts *ts) 
5033  {
5034      tn_array *keys;
5035      tn_hash *icaps;
5036 -    int i;
5037 -
5038 +    int i, rc = 1;
5039 +    
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);
5046 +        
5047 +        if (prepare_icap(ts, cap, pkgs) == -1) {
5048 +            rc = -1;
5049 +            break;
5050 +        }
5051      }
5052 +    
5053      n_array_free(keys);
5054      n_hash_free(icaps);
5055 -    return 1;
5056 +    return rc;
5057  }
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
5061 @@ -138,4 +138,7 @@
5062  int in_process_package(int indent, struct install_ctx *ictx,
5063                         struct pkg *pkg, int process_as);
5064  
5065 +
5066 +struct pkg *in_choose_equiv(struct poldek_ts *ts, struct capreq *cap,
5067 +                            struct pkg **candidates, struct pkg *defaultpkg);
5068  #endif
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
5072 @@ -11,7 +11,7 @@
5073  */
5074  
5075  /*
5076 -  $Id$
5077 +  $Id$
5078  */
5079  
5080  #include <vfile/vfile.h>
5081 @@ -352,7 +352,9 @@
5082      struct install_ctx ictx;
5083      n_assert(ts->type == POLDEK_TS_INSTALL);
5084  
5085 -    in_prepare_icaps(ts);
5086 +    if (in_prepare_icaps(ts) < 0) /* user aborts, no error */
5087 +        return 1;
5088 +    
5089      if (unmark_name_dups(ts->pms, ts->ctx->ps->pkgs) == 0) {
5090          msgn(1, _("Nothing to do"));
5091          return 1;
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
5095 @@ -11,7 +11,7 @@
5096  */
5097  
5098  /*
5099 -  $Id$
5100 +  $Id$
5101  */
5102  
5103  #include "ictx.h"
5104 @@ -439,7 +439,7 @@
5105      
5106   l_end:
5107      
5108 -    if (candidates && nsuspkgs) {
5109 +    if (candidates && nsuspkgs > 1) {
5110          n_assert(suspkgs);
5111          *candidates = suspkgs;
5112          
5113 @@ -460,3 +460,16 @@
5114                             ictx->uninst_set->dbpkgs);
5115  }
5116  
5117 +struct pkg *in_choose_equiv(struct poldek_ts *ts, struct capreq *cap,
5118 +                            struct pkg **candidates, struct pkg *defaultpkg)
5119 +{
5120 +    int n;
5121 +
5122 +    if (defaultpkg == NULL)
5123 +        defaultpkg = candidates[0];
5124 +    
5125 +    n = ts->askpkg_fn(capreq_snprintf_s(cap), candidates, defaultpkg);
5126 +    if (n == -1)
5127 +        return NULL;
5128 +    return candidates[n];
5129 +}
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
5133 @@ -11,7 +11,7 @@
5134  */
5135  
5136  /*
5137 -  $Id$
5138 +  $Id$
5139  */
5140  
5141  #include "ictx.h"
5142 @@ -165,12 +165,15 @@
5143          
5144          struct pkg *real_tomark = tomark;
5145          if (tomark_candidates) {
5146 -            int n;
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,
5151 +                                          tomark);
5152              free(tomark_candidates);
5153              tomark_candidates = NULL;
5154 +            
5155 +            if (real_tomark == NULL) { /* user abort */
5156 +                ictx->nerr_fatal++;
5157 +                return 0;
5158 +            }
5159          }
5160              
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) {
5167 +        int pkg_ndragged;
5168 +       
5169 +        pkg_ndragged = in_pkg_drags(ictx, pkg);
5170 +        if (pkg_ndragged == 0 || 1) { /* XXX: see note in pkgset-install.c */
5171              struct pkg *p;
5172              int is_marked = 0, ndragged = 0, by_obsoletes = 0;
5173  
5174 @@ -277,9 +283,9 @@
5175              successor.realpkg = p;
5176              successor.by_obsoletes = by_obsoletes;
5177              
5178 -            /* do not follow successor if package drags something and
5179 -              is not marked */
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);
5186                  p = NULL;
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
5190 @@ -1,12 +1,14 @@
5191  Build requirements: $ grep ^BuildReq poldek.spec
5192 +To build without libxml2, use --without-xml-metadata option as follows:
5193  
5194 -Build
5195 +$ ./configure [--without-xml-metadata] && make 
5196  
5197 -$ ./configure && make 
5198  
5199 -or better 
5200 +or better build rpm package:
5201  
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]
5206 +
5207 +Possible distro values: pld, rh, fedora and centos
5208  
5209  
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
5213 @@ -11,7 +11,7 @@
5214  */
5215  
5216  /*
5217 -  $Id$
5218 +  $Id$
5219  */
5220  
5221  #ifdef HAVE_CONFIG_H
5222 @@ -41,8 +41,9 @@
5223  #include "poldek_intern.h"
5224  #include "poldek_term.h"
5225  #include "pm/pm.h"
5226 +#include "conf_intern.h"
5227  
5228 -extern void (*poldek_log_say_goodbye)(const char *msg); /* log.c */
5229 +extern int (*poldek_log_say_goodbye)(const char *msg); /* log.c */
5230  
5231  static int poldeklib_init_called = 0;
5232  
5233 @@ -60,8 +61,8 @@
5234  
5235  static const char *poldek_logprefix = "poldek";
5236  
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;
5241  
5242  static
5243  void (*poldek_assert_hook)(const char *expr, const char *file, int line) = NULL;
5244 @@ -72,8 +73,6 @@
5245  static
5246  void (*poldek_die_hook)(const char *msg) = NULL;
5247  
5248 -
5249 -
5250  static void register_vf_handlers_compat(const tn_hash *htcnf);
5251  static void register_vf_handlers(const tn_array *fetchers);
5252  
5253 @@ -93,39 +92,22 @@
5254  extern
5255  int poldek_load_sources__internal(struct poldek_ctx *ctx, int load_dbdepdirs);
5256  
5257 -
5258 -static struct {
5259 -    int config;
5260 -    const char *name;
5261 +struct default_op_map_ent {
5262 +    int config;                 /* configuration var? */
5263 +    char *name;
5264      int op;
5265 +    int _defaultv;
5266      int defaultv;
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  }, 
5285 -    { 0, NULL, 0, 0 }
5286 +    int optype;
5287  };
5288  
5289 +static tn_array *default_op_map = NULL; /* see build_default_op_map() */
5290 +
5291  int poldek__is_setup_done(struct poldek_ctx *ctx) 
5292  {
5293      return (ctx->_iflags & SETUP_DONE) == SETUP_DONE;
5294  }
5295  
5296 -
5297  static inline void check_if_setup_done(struct poldek_ctx *ctx) 
5298  {
5299      if ((ctx->_iflags & SETUP_DONE) == SETUP_DONE)
5300 @@ -684,34 +666,142 @@
5301      p_st_destroy(&pst);
5302  }
5303  
5304 +int default_op_map_ent_cmp(struct default_op_map_ent *e1,
5305 +                           struct default_op_map_ent *e2)
5306 +{
5307 +    return strcmp(e1->name, e2->name);
5308 +}
5309 +
5310 +static tn_array *build_default_op_map(void)
5311 +{
5312 +    struct poldek_conf_tag *tags = NULL;
5313 +    tn_array *op_map;
5314 +    int i = 0;
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 }
5320 +    };
5321 +    
5322 +    op_map = n_array_new(32, free, (tn_fn_cmp)default_op_map_ent_cmp);
5323 +    
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;
5327 +            break;
5328 +        }
5329 +        i++;
5330 +    }
5331 +    n_assert(tags);
5332 +
5333 +    i = 0;
5334 +    while (tags[i].name) {
5335 +        if (tags[i]._op_no == 0) {
5336 +            i++;
5337 +            continue;
5338 +        }
5339 +        
5340 +        ent = n_malloc(sizeof(*ent));
5341 +        n_assert(tags[i].flags & (CONF_TYPE_BOOLEAN | CONF_TYPE_BOOLEAN3));
5342 +        ent->config = 1;
5343 +        ent->name = tags[i].name;
5344 +        ent->op = tags[i]._op_no;
5345 +        
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;
5351 +            
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);
5356 +            
5357 +            ent->defaultv = ent->_defaultv;
5358 +            ent->optype = CONF_TYPE_BOOLEAN3;
5359 +
5360 +        } else {
5361 +            n_assert(0);
5362 +        }
5363 +        
5364 +        n_array_push(op_map, ent);
5365 +        i++;
5366 +    }
5367 +    
5368 +    i = 0;
5369 +    while (addon[i].name) {
5370 +        ent = n_malloc(sizeof(*ent));
5371 +        ent->config = 0;
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);
5377 +        i++;
5378 +    }
5379 +#if ENABLE_TRACE
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);
5383 +    }
5384 +#endif
5385 +    n_array_sort(op_map);
5386 +    return op_map;
5387 +}
5388 +
5389  static
5390  void poldek__ts_apply_config(struct poldek_ctx *ctx, struct poldek_ts *ts)
5391  {
5392      tn_hash           *htcnf = NULL;
5393      int               i;
5394 +
5395 +    n_assert(default_op_map);
5396      
5397      if (ctx->htconf == NULL)
5398          return;
5399      
5400      htcnf = poldek_conf_get_section_ht(ctx->htconf, "global");
5401 -    i = 0;
5402 +
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));
5408 +
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);
5411 +
5412 +        DBGF("op[%d] %s (config %d)\n", i, ent->name,  ent->config);
5413 +        
5414 +        if (ent->config == 0)   /* omit non-config options */
5415 +            continue;
5416          
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));
5419 +
5420 +        n_assert(ent->defaultv >= 0);
5421 +        
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));
5425              
5426          } else {
5427 -            int v = poldek_conf_get_bool(htcnf, name, 
5428 -                                         default_op_map[i].defaultv);
5429 +            int v;
5430 +            if (ent->optype == CONF_TYPE_BOOLEAN)
5431 +                v = poldek_conf_get_bool(htcnf, ent->name, ent->defaultv);
5432 +            
5433 +            else if (ent->optype == CONF_TYPE_BOOLEAN3)
5434 +                v = poldek_conf_get_bool3(htcnf, ent->name, ent->defaultv);
5435 +            else
5436 +                n_assert(0);
5437              
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)  
5442 +                    continue;
5443 +                v = ent->defaultv;
5444 +            }
5445 +                    
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);
5449          }
5450 -        
5451 -        i++;
5452      }
5453      
5454      if (ts->getop(ts, POLDEK_OP_CONFIRM_INST) && poldek_VERBOSE < 1)
5455 @@ -726,15 +816,17 @@
5456  
5457  void poldek__ts_dump_settings(struct poldek_ctx *ctx, struct poldek_ts *ts)
5458  {
5459 -    int i = 0;
5460 -    
5461 +    int i;
5462 +
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;
5468  
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);
5473 +
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");
5477      }
5478  }
5479  
5480 @@ -744,29 +836,29 @@
5481                                        struct poldek_ts *ts)
5482  {
5483      int i = 0;
5484 -    
5485 +
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;
5491 -
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));
5496 +    
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);
5499 +
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));
5503              continue;
5504          }
5505          
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));
5512              
5513 -            ts->setop(ts, op, ctx->ts->getop(ctx->ts, op));
5514 +            ts->setop(ts, ent->op, ctx->ts->getop(ctx->ts, ent->op));
5515              
5516          } else {
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));
5523          }
5524          
5525      }
5526 @@ -880,16 +972,17 @@
5527      return 1;
5528  }
5529  
5530 -static void say_goodbye(const char *msg) 
5531 +static int say_goodbye(const char *msg) 
5532  {
5533      printf("%s", msg);
5534 +    return 1;                   /* let the caller die() itself */
5535  }
5536  
5537  static void n_malloc_fault(void) 
5538  {
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);
5545  }
5546  
5547  
5548 @@ -900,8 +993,8 @@
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);
5553 -    abort();
5554 +    if (poldek_say_goodbye(msg))
5555 +        abort();
5556  }
5557  
5558  static void n_die_hook(const char *msg) 
5559 @@ -909,11 +1002,12 @@
5560      char buf[1024];
5561      n_snprintf(buf, sizeof(buf),
5562                 "Something wrong, something not quite right.\ndie: %s\n", msg);
5563 -    poldek_say_goodbye(buf);
5564 -    abort();
5565 +    
5566 +    if (poldek_say_goodbye(buf))
5567 +        abort();
5568  }
5569  
5570 -static void self_init(void) 
5571 +static void verify_setuid(void) 
5572  {
5573      uid_t uid;
5574  
5575 @@ -1084,6 +1178,12 @@
5576  
5577  void poldeklib_destroy(void)
5578  {
5579 +    if (poldeklib_init_called == 0)
5580 +        return;
5581 +    
5582 +    n_array_free(default_op_map);
5583 +    default_op_map = NULL;
5584 +    
5585  }
5586  
5587  int poldeklib_init(void)
5588 @@ -1097,7 +1197,10 @@
5589      pmmodule_init();
5590      poldek_set_verbose(0);
5591      poldek_log_init(NULL, stdout, poldek_logprefix);
5592 -    self_init();
5593 +    verify_setuid();
5594 +
5595 +    default_op_map = build_default_op_map();
5596 +    n_assert(default_op_map);
5597  
5598      bindtextdomain(PACKAGE, NULL);
5599      textdomain(PACKAGE);
5600 @@ -1163,24 +1266,42 @@
5601      
5602      ctx->ts = poldek_ts_new(NULL, 0);
5603      ts = ctx->ts;
5604 -    
5605 -    i = 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);
5609 -        i++;
5610 -    }
5611  
5612 -    if (getuid() != 0)
5613 -        poldek_ts_setop(ts, POLDEK_OP_USESUDO, 1);
5614 -    
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;
5619 +        
5620 +        if (v == 2) {      /* "auto" */
5621 +            switch (ent->op) {
5622 +                case POLDEK_OP_USESUDO:
5623 +                    v = 0;
5624 +                    if (getuid() != 0)
5625 +                        v = 1;
5626 +                    break;
5627 +
5628 +                case POLDEK_OP_MULTILIB: /* do not touch, will
5629 +                                            be determined later */
5630 +                    break;
5631 +                    
5632 +                default:
5633 +                    n_assert(0);
5634 +            }
5635 +            DBGF("auto %s  = %d\n",  ent->name,  v);
5636 +            ent->defaultv = v;
5637 +        }
5638 +        
5639 +        if (v != 2)  
5640 +            poldek_ts_xsetop(ts, ent->op, v, 0);
5641 +    }
5642 +    DBGF("default_op_map size = %d\n", n_array_size(default_op_map));
5643      return 1;
5644  }
5645  
5646  struct poldek_ctx *poldek_new(unsigned flags)
5647  {
5648      struct poldek_ctx *ctx;
5649 -
5650 +    
5651      if (!poldeklib_init_called) {
5652          logn(LOGERR | LOGDIE, "poldeklib_init() call is a must...");
5653          return 0;
5654 @@ -1260,6 +1381,54 @@
5655      return 1;
5656  }
5657  
5658 +static void __setup_multilib(struct poldek_ctx *ctx)
5659 +{
5660 +    struct default_op_map_ent *ent, tmp;
5661 +    char     scolor[64];
5662 +    int      color, multilib = 2;
5663 +    
5664 +    
5665 +    if (!pm_conf_get(ctx->pmctx, "%{_transaction_color}", scolor, sizeof(scolor)))
5666 +        return;
5667 +    
5668 +    if (sscanf(scolor, "%u", &color) != 1) 
5669 +        return;
5670 +
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);
5674 +    }
5675 +    
5676 +    if (color && multilib == 0) {
5677 +        logn(LOGWARN, _("RPM works in multilib mode, while poldek not"));
5678 +        return;
5679 +        
5680 +    } else if (!color && multilib == 1) {
5681 +        logn(LOGWARN, _("poldek works in multilib mode, while rpm not"));
5682 +        return;
5683 +    }
5684 +
5685 +    if (multilib == 2) {        /* auto */
5686 +        ctx->_rpm_tscolor = color;
5687 +    
5688 +        tmp.name = "multilib";
5689 +        ent = n_array_bsearch(default_op_map, &tmp);
5690 +        n_assert(ent);
5691 +        
5692 +        ent->defaultv = 0;
5693 +        if (color)
5694 +            ent->defaultv = 1;
5695 +
5696 +        if (color)
5697 +            msgn(2, "Enabling multilib mode, rpm's transaction color = %d",
5698 +                 color);
5699 +        
5700 +        DBGF("multilib(auto) = %d\n", ent->defaultv);
5701 +        poldek_ts_xsetop(ctx->ts, ent->op, ent->defaultv, 0);
5702 +    }
5703 +}
5704 +
5705 +
5706  
5707  /*  */
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);
5713 -                         
5714 +        __setup_multilib(ctx);
5715 +        
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
5722 @@ -272,6 +272,8 @@
5723  poldek_ts_setop
5724  poldek_ts_type
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
5730  poldek_util_lc_lang
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
5734 @@ -11,7 +11,7 @@
5735  */
5736  
5737  /*
5738 -  $Id$
5739 +  $Id$
5740  */
5741  
5742  #include <stdarg.h>
5743 @@ -32,19 +32,18 @@
5744  
5745  int  poldek_VERBOSE = 0;
5746  
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;
5751  
5752  static char l_prefix[64];
5753 -static FILE *l_stream, *l_fstream = NULL;
5754 +static FILE *l_stream = NULL, *l_filestream = NULL;
5755  
5756  static void vlog_tty(int pri, const char *fmt, va_list args);
5757  
5758 -static void say_goodbye(const char *msg)
5759 +static int say_goodbye(const char *msg)
5760  {
5761 -    msg = msg;
5762 -    /* do nothing, msg is logged before die */
5763 -    return;
5764 +    msg = msg; /* do nothing, msg is logged before die */
5765 +    return 1;
5766  }
5767  
5768  int poldek_verbose(void)
5769 @@ -83,11 +82,11 @@
5770  {
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;
5775      
5776      if (*fmt == '_') {
5777          fmt++;
5778 -        is_cont = 1;
5779 +        is_continuation = 1;
5780          
5781      } else if (*fmt == '\n') {
5782          buf[n++] = '\n';
5783 @@ -112,18 +111,18 @@
5784          }
5785      }
5786  
5787 -    if (last_endlined == 0 && !is_cont && (pri & (LOGERR|LOGWARN)))
5788 +    if (last_endlined == 0 && !is_continuation && (pri & (LOGERR|LOGWARN)))
5789          buf[n++] = '\n';        
5790      last_endlined = is_endlined;
5791          
5792 -    if (indent > 0) {
5793 +    if (indent > 0 && indent < 256) { /* have buf[1024] */
5794          memset(&buf[n], ' ', indent);
5795          n += indent;
5796      }
5797  
5798      buf[n] = '\0';
5799  
5800 -    /* revert LOG[TTY|FLAGS]  */
5801 +    /* revert LOG[TTY|FILE]  */
5802      flags = LOGTTY | LOGFILE;
5803      if (pri & LOGTTY)
5804          flags &= ~LOGFILE;
5805 @@ -140,12 +139,12 @@
5806          fflush(l_stream);
5807      }
5808  
5809 -    if ((flags & LOGFILE) && l_fstream) {
5810 +    if ((flags & LOGFILE) && l_filestream) { /* logging to file */
5811          if (*fmt == '\0') {
5812 -            fprintf(l_fstream, "%s", buf);
5813 +            fprintf(l_filestream, "%s", buf);
5814              
5815          } else {
5816 -            if (!is_cont) {
5817 +            if (!is_continuation) {
5818                  char timbuf[64];
5819                  time_t t;
5820              
5821 @@ -153,24 +152,24 @@
5822                  strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M:%S ",
5823                           localtime(&t));
5824  
5825 -                fprintf(l_fstream, "%s", timbuf);
5826 +                fprintf(l_filestream, "%s", timbuf);
5827              }
5828              if (pri & LOGERR)
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: "));
5834              
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);
5841          }
5842      }
5843      
5844      if (pri & LOGDIE) {
5845          char msg[1024];
5846          n_snprintf(msg, sizeof(msg), fmt, args);
5847 -        say_goodbye(msg);
5848 -        abort();
5849 +        if (poldek_log_say_goodbye(msg))
5850 +            abort();
5851      }
5852  }
5853  
5854 @@ -222,19 +221,20 @@
5855      if (l_stream != NULL && is_not_stdstream) 
5856          fclose(l_stream);
5857  
5858 -    if (l_fstream)
5859 -        fclose(l_fstream);
5860 +    if (l_filestream)
5861 +        fclose(l_filestream);
5862      
5863      l_stream = tty;
5864 +    
5865      if (pathname)
5866 -        l_fstream = fopen(pathname, "a");
5867 +        l_filestream = fopen(pathname, "a");
5868  
5869      l_prefix[0] = '\0';
5870      if (prefix)
5871          snprintf(l_prefix, sizeof(l_prefix), "%s:", prefix);
5872      
5873      if (pathname)
5874 -        return l_fstream != NULL;
5875 +        return l_filestream != NULL;
5876      return 1;
5877  }
5878  
5879 @@ -246,9 +246,9 @@
5880      
5881      l_stream = NULL;
5882  
5883 -    if (l_fstream) {
5884 -        fclose(l_fstream);
5885 -        l_fstream = NULL;
5886 +    if (l_filestream) {
5887 +        fclose(l_filestream);
5888 +        l_filestream = NULL;
5889      }
5890  }
5891  
5892 @@ -261,12 +261,12 @@
5893  
5894  FILE *poldek_log_file_stream(void) 
5895  {
5896 -    return l_fstream;
5897 +    return l_filestream;
5898  }
5899  
5900  int poldek_log_enabled_filelog(void)
5901  {
5902 -    return l_fstream != NULL;
5903 +    return l_filestream != NULL;
5904  }
5905  
5906  static
5907 @@ -294,27 +294,3 @@
5908      fflush(l_stream);
5909  }
5910  
5911 -#if 0
5912 -static char *text_wrap(char *dest, int size, const char *text, int tolen) 
5913 -{
5914 -    char *p, *q;
5915 -    int n = 0;
5916 -    
5917 -        
5918 -    p = dest;
5919 -    while (*p) {
5920 -        n++;
5921 -        if (isspace(*p)) 
5922 -            q = p;
5923 -        
5924 -        if (len > tolen) {
5925 -            if (isspace(*p))
5926 -                dest = '\n';
5927 -            else
5928 -                dest
5929 -            
5930 -        
5931 -
5932 -}
5933 -#endif
5934 -        
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
5938 @@ -1,4 +1,4 @@
5939 -# $Id$
5940 +# $Id$
5941  
5942  AUTOMAKE_OPTIONS = 
5943  ACLOCAL_AMFLAGS = -I m4
5944 @@ -16,7 +16,7 @@
5945  
5946  POD2MAN   = @POD2MAN@
5947  
5948 -libVERINFO         = 0:0:0
5949 +libVERINFO         = 1:0:1
5950  lib_LTLIBRARIES    = libpoldek.la
5951  noinst_LTLIBRARIES = libpoldek_allsym.la
5952  
5953 @@ -43,7 +43,7 @@
5954           pkgset-install.c              \
5955           dbdep.c dbdep.h               \
5956           arg_packages.c arg_packages.h         \
5957 -         conf.c conf.h         \
5958 +         conf.c conf.h conf_intern.h conf_sections.c \
5959           dbpkgset.c dbpkgset.h \
5960           split.c split.h               \
5961           pkgroup.c pkgroup.h   \
5962 @@ -110,6 +110,9 @@
5963         $(MAKE) -C doc NEWS
5964         cp doc/NEWS .
5965  
5966 +conf_sections.c: doc/poldek.conf.xml doc/*.xsl
5967 +                        doc/conf-xml2.sh c doc/poldek.conf.xml > $@
5968 +
5969  vfjuggle: 
5970  
5971  dist-hook: 
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
5975 @@ -0,0 +1,4 @@
5976 +#!/bin/sh
5977 +
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
5983 @@ -11,7 +11,7 @@
5984  */
5985  
5986  /*
5987 -  $Id$
5988 +  $Id$
5989  */
5990  
5991  #ifdef HAVE_CONFIG_H
5992 @@ -578,20 +578,29 @@
5993      return val;
5994  }
5995  
5996 -
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)
6000  {
6001      const char **tl, **tl_save;
6002 +    tn_array *usedvars = NULL;
6003 +    char smark[16];
6004      int n = 0;
6005  
6006 +    if (varmark == '\0')
6007 +        varmark = '$';
6008 +
6009 +    n_snprintf(smark, sizeof(smark), "%c", varmark);
6010      
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);
6016 -        return str;
6017 +        return src;
6018      }
6019 +
6020 +    if (flags & POLDEK_UTIL_EXPANDVARS_RMUSED)
6021 +        usedvars = n_array_new(16, free, (tn_fn_cmp)strcmp);
6022      
6023 -    if (*str != '$') {
6024 +    if (*src != varmark) {
6025          n = n_snprintf(dest, size, *tl);
6026          tl++;
6027      }
6028 @@ -621,13 +630,24 @@
6029              vv++;
6030          
6031          if (v_len + 1 > (int)sizeof(val))
6032 -            return str;
6033 +            return src;
6034          
6035          n_snprintf(val, v_len + 1, v);
6036 -        DBGF("env %s\n", val);
6037 +        DBGF("var %c{%s}\n", varmark, val);
6038 +
6039 +        var = NULL;
6040 +        if (varh && varmark != '$') {
6041 +            var = n_hash_get(varh, val);
6042 +            if (usedvars)
6043 +                n_array_push(usedvars, n_strdup(val));
6044          
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);
6049 +            
6050 +        }
6051 +        
6052 +        if (var == NULL) {
6053 +            n += n_snprintf(&dest[n], size - n, "%c%s", varmark, p);
6054              
6055          } else {
6056              n += n_snprintf(&dest[n], size - n, "%s", var);
6057 @@ -636,9 +656,26 @@
6058      }
6059      
6060      n_str_tokl_free(tl_save);
6061 +    
6062 +    if (usedvars) {             /* RMUSED is requested */
6063 +        int i;
6064 +            
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));
6069 +    }
6070 +
6071      return dest;
6072  }
6073  
6074 +
6075 +
6076 +const char *poldek_util_expand_env_vars(char *dest, int size, const char *str)
6077 +{
6078 +    return poldek_util_expand_vars(dest, size, str, '$', NULL, 0);
6079 +}
6080 +
6081  const char *abs_path(char *buf, int size, const char *path) 
6082  {
6083      
6084 @@ -818,6 +855,18 @@
6085      return -1;
6086  }
6087  
6088 +int poldek_util_parse_bool3(const char *v)
6089 +{
6090 +    int rv = -1;
6091 +    
6092 +    if ((rv = poldek_util_parse_bool(v)) == -1) {
6093 +        if (strcasecmp(v, "auto") == 0 || strcasecmp(v, "a"))
6094 +            rv = 2;
6095 +    }
6096 +    
6097 +    return rv;
6098 +}
6099 +
6100      
6101  char *strtime_(time_t t) 
6102  {
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
6106 @@ -1,4 +1,4 @@
6107 -/* $Id$ */
6108 +/* $Id$ */
6109  #ifndef POLDEK_MISC_H
6110  #define POLDEK_MISC_H
6111  
6112 @@ -33,7 +33,6 @@
6113  char *setup_cachedir(const char *path);
6114  const char *tmpdir(void);
6115  
6116 -const char *expand_env_vars(char *dest, int size, const char *str);
6117  
6118  void die(void);
6119  
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
6123 @@ -0,0 +1,41 @@
6124 +#!/bin/sh
6125 +# $Id$
6126 +
6127 +PATH="/bin:/usr/bin:/usr/sbin:/sbin"
6128 +NAME=packages.dir.gz
6129 +
6130 +usage()
6131 +{
6132 +    echo "usage: `basename $0` [--nodiff] DIR..."
6133 +}
6134 +
6135 +if [ "$#" = 0 ]; then
6136 +    usage
6137 +    exit 1
6138 +fi
6139 +
6140 +nodiff=""
6141 +while  [ $# -gt 0 ]; do
6142 +    if [ "$1" == "--nodiff" ]; then
6143 +       nodiff="--nodiff"
6144 +       shift
6145 +       continue
6146 +    fi
6147 +       
6148 +    if [ ! -d "$1" ]; then
6149 +       echo "$1: no such directory"
6150 +       exit 1
6151 +    fi 
6152 +    
6153 +    poldek --noconf -s "$1" --mkidxz 
6154 +
6155 +    if [ $? -ne 0 ]; then 
6156 +       exit 1
6157 +    fi
6158 +
6159 +    if [ ! -f "$1/$NAME" ]; then 
6160 +       exit 1
6161 +    fi
6162 +       
6163 +    shift
6164 +done    
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
6168 @@ -1,5 +1,5 @@
6169  /*
6170 -  Copyright (C) 2000 - 2004 Pawel A. Gajda <mis@k2.net.pl>
6171 +  Copyright (C) 2000 - 2006 Pawel A. Gajda (mis@k2.net.pl)
6172  
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
6175 @@ -15,7 +15,7 @@
6176   */
6177  
6178  /*
6179 -  $Id$
6180 +  $Id$
6181  */
6182  
6183  #ifdef HAVE_CONFIG_H
6184 @@ -215,7 +215,6 @@
6185  
6186      len += len + 1;             /* for id (nvr) */
6187      
6188 -    
6189      if (poldek_conf_MULTILIB && arch) {
6190          arch_len = strlen(arch); 
6191          len += arch_len + 1;
6192 @@ -356,7 +355,7 @@
6193  {
6194  #if ENABLE_TRACE   
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,
6201 @@ -694,8 +693,8 @@
6202      int n;
6203          
6204      DBGF("\npkg_caps_match_req %s %s\n", pkg_snprintf_s(pkg), 
6205 -         capreq_snprintf_s(req));
6206 -        
6207 +           capreq_snprintf_s(req));
6208 +    
6209      if (pkg->caps == NULL || n_array_size(pkg->caps) == 0)
6210          return 0;     /* not match */
6211      
6212 @@ -703,40 +702,25 @@
6213          return 0;
6214              
6215      } else {
6216 -        struct capreq *cap;
6217          int i;
6218 +        for (i = n; i < n_array_size(pkg->caps); i++) {
6219 +            struct capreq *cap = n_array_nth(pkg->caps, i);
6220  
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);
6225 -            return 1;
6226 -        }
6227 -        n++;
6228 -            
6229 -        for (i = n; i<n_array_size(pkg->caps); i++) {
6230 -            struct capreq *cap;
6231 -
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),
6236 -                     capreq_rel(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));
6242                  return 0;
6243              }
6244 -                
6245 -                
6246 +            
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));
6251                  return 1;
6252 -            } else {
6253 -                DBGMSG("chk%d %s-%s-%s -> NOT match\n", i,
6254 -                       capreq_name(cap), capreq_ver(cap),
6255 -                       capreq_rel(cap));
6256              }
6257 +            
6258 +            DBGF("  cap[%d] %s -> NOT match\n", i, capreq_snprintf_s(cap));
6259          }
6260 -        DBGMSG("NONE\n");
6261      }
6262      
6263      return 0;
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
6267 @@ -1,4 +1,4 @@
6268 -/* $Id$ */
6269 +/* $Id$ */
6270  
6271  #include <stdio.h>
6272  #include <stdint.h>
6273 @@ -134,7 +134,8 @@
6274  }
6275  
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)
6280  {
6281      if (arr == NULL)
6282          arr = capreq_arr_new(0);
6283 @@ -192,7 +193,8 @@
6284      return arr;
6285  }
6286  
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,
6289 +                                xmlNode *node)
6290  {
6291      struct pkg pkg, *rpkg = NULL;
6292      char *arch;
6293 @@ -269,7 +271,8 @@
6294                  
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,
6299 +                                                   NULL, 0, 0);
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
6306 @@ -7,7 +7,7 @@
6307  */
6308  
6309  /*
6310 -  $Id$
6311 +  $Id$
6312  */
6313  
6314  #ifdef HAVE_CONFIG_H
6315 @@ -132,7 +132,7 @@
6316      if (pkg->fn)
6317          n_buf_printf(nbuf, "n: %s\n", pkg->fn);
6318  
6319 -    if (pkg->fmtime)
6320 +    if (pkg->fmtime && (flags & PKGSTORE_NOTIMESTAMP) == 0)
6321          n_buf_printf(nbuf, "t: %u\n", pkg->fmtime);
6322      
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
6327 @@ -11,7 +11,7 @@
6328  */
6329  
6330  /*
6331 -  $Id$
6332 +  $Id$
6333  */
6334  
6335  #ifdef HAVE_CONFIG_H
6336 @@ -198,13 +198,14 @@
6337  
6338  
6339  static
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)
6343  {
6344      char        buf[128], tmpath[PATH_MAX], tss[32];
6345      const char  *suffix;
6346      char        *idxpath;
6347      const char  *dbid, *langid;
6348 -
6349 +    
6350      pndir_db_dscr_idstr(lang, &dbid, &langid);
6351      
6352      idxpath = idx->idxpath;
6353 @@ -244,24 +245,48 @@
6354  
6355      DBGF("mk %s, %s\n", idxpath, suffix);
6356      pndir_mkidx_pathname(tmpath, sizeof(tmpath), idxpath, suffix);
6357 -    
6358 +        
6359 +    msgn(3, _("Opening %s..."), vf_url_slim_s(tmpath, 0));
6360 +    return do_dbopen(tmpath, vfmode, vf, idx->srcnam);
6361 +}
6362 +
6363 +
6364 +static
6365 +int open_dscr(struct pndir *idx, int vfmode, time_t ts, const char *lang)
6366 +{
6367 +    struct tndb  *db = NULL;
6368 +    struct vfile *vf = NULL;
6369 +
6370      if (idx->db_dscr_h == NULL)
6371          idx->db_dscr_h = pndir_db_dscr_h_new();
6372  
6373 -    if (!pndir_db_dscr_h_get(idx->db_dscr_h, lang)) {
6374 -        struct tndb *db;
6375 +    if (pndir_db_dscr_h_get(idx->db_dscr_h, lang))
6376 +        return 1;
6377 +    
6378 +    if ((db = do_open_dscr(idx, vfmode, &vf, ts, lang)) == NULL)
6379 +        return 0;
6380 +
6381 +    if (tndb_verify(db)) {
6382 +        pndir_db_dscr_h_insert(idx->db_dscr_h, lang, db);
6383          
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);
6388 -            else {
6389 -                tndb_close(db);
6390 -                logn(LOGERR, "%s: broken file", vf_url_slim_s(tmpath, 0));
6391 -            }
6392 +    } else {
6393 +        logn(LOGERR, "%s: broken file", vf_url_slim_s(tndb_path(db), 0));
6394 +
6395 +        if (vf->vf_flags & VF_FRMCACHE) { /* not fully downloaded? */
6396 +            n_assert(vfmode & VFM_CACHE);
6397 +            vfmode &= ~VFM_CACHE;
6398 +            vfmode |= VFM_NODEL;
6399 +            
6400 +            tndb_close(db);
6401 +            vfile_close(vf);
6402 +            
6403 +            return open_dscr(idx, vfmode, ts, lang);
6404          }
6405 +        tndb_close(db);
6406      }
6407 -
6408 +    
6409 +    if (vf)
6410 +        vfile_close(vf);
6411      return pndir_db_dscr_h_get(idx->db_dscr_h, lang) != NULL;
6412  }
6413  
6414 @@ -291,8 +316,8 @@
6415  }
6416  
6417  static
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)
6422  {
6423      int rc;
6424      
6425 @@ -514,12 +539,12 @@
6426              n_assert(loadC);
6427              
6428              if (loadC)
6429 -                if (!open_dscr(&idx, pkgdir->orig_ts, "C"))
6430 +                if (!open_dscr(&idx, vfmode, pkgdir->orig_ts, "C"))
6431                      nerr++;
6432  
6433              if (nerr == 0 && loadi18n) {
6434                  n_assert(loadC);
6435 -                if (!open_dscr(&idx, pkgdir->orig_ts, "i18n"))
6436 +                if (!open_dscr(&idx, vfmode, pkgdir->orig_ts, "i18n"))
6437                      nerr++;
6438              }
6439          }
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
6443 @@ -11,7 +11,7 @@
6444  */
6445  
6446  /*
6447 -  $Id$
6448 +  $Id$
6449  */
6450  
6451  #include <string.h>
6452 @@ -1034,6 +1034,10 @@
6453      rc = 0;
6454      if (pkgdir_load(pkgdir, NULL, ldflags)) {
6455          n_assert((pkgdir->_ldflags & PKGDIR_LD_DOIGNORE) == 0);
6456 +        
6457 +        if (kw && n_hash_exists(kw, "v018x"))
6458 +            cr_flags |= PKGDIR_CREAT_v018x;
6459 +        
6460          rc = pkgdir_save_as(pkgdir, type, idxpath, cr_flags);
6461      }
6462      
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
6466 @@ -1,4 +1,4 @@
6467 -/* $Id$ */
6468 +/* $Id$ */
6469  #ifndef POLDEK_SOURCE_H
6470  #define POLDEK_SOURCE_H
6471  
6472 @@ -96,10 +96,7 @@
6473  
6474  int sources_clean(tn_array *sources, unsigned flags);
6475  
6476 -#define PKGSOURCE_MKIDX_NODIFF         (1 << 0)
6477 -#define PKGSOURCE_MKIDX_COMPRESSED_GZ  (1 << 1)
6478 -#define PKGSOURCE_MKIDX_COMPRESSED_BZ2 (1 << 2)
6479 -
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
6487 @@ -11,7 +11,7 @@
6488  */
6489  
6490  /*
6491 -  $Id$
6492 +  $Id$
6493  */
6494  
6495  #include <stdlib.h>
6496 @@ -636,5 +636,65 @@
6497      return path;
6498  }
6499  
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)
6503 +{
6504 +    const char *dn = NULL;
6505 +    int i, dnlen, r;
6506 +    tn_array *od = NULL, *rd = NULL;
6507 +
6508 +    if (owned)
6509 +        od = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
6510 +    
6511 +    if (required)
6512 +        rd = n_array_new(n_tuple_size(fl), NULL, (tn_fn_cmp)strcmp);
6513 +    
6514 +    for (i=0; i < n_tuple_size(fl); i++) {
6515 +        struct pkgfl_ent *flent = n_tuple_nth(fl, i);
6516 +
6517 +        if (dn && strncmp(dn, flent->dirname, dnlen) == 0) {
6518 +            if (od)
6519 +                n_array_push(od, flent->dirname);
6520 +            continue;
6521 +        }
6522 +        
6523 +        dn = flent->dirname;
6524 +        if (*dn == '/' && *(dn + 1) == '\0') {
6525 +            dn = "";
6526 +            dnlen = 0;
6527 +            continue;
6528 +        }
6529 +        
6530 +        dnlen = strlen(dn);
6531 +        if (rd)
6532 +            n_array_push(rd, dn);
6533 +    }
6534 +
6535 +    r = 0;
6536 +    if (od) {
6537 +        *owned = od;
6538 +        for (i = 0; i < n_array_size(od); i++)            
6539 +            printf("O %s\n", n_array_nth(od, i));
6540 +        r += i;
6541 +    }
6542 +    
6543 +    if (rd) {
6544 +        *required = rd;
6545 +        for (i = 0; i < n_array_size(rd); i++)            
6546 +            printf("R %s\n", n_array_nth(rd, i));
6547 +        r += i;
6548 +    }
6549 +    return r;
6550 +}
6551 +
6552 +tn_array *pkgfl_required_directories(tn_tuple *fl) 
6553 +{
6554 +    tn_array *required = NULL;
6555 +
6556 +    pkgfl_owned_and_required_dirs(fl, NULL, &required);
6557 +
6558 +    return required;
6559 +}
6560  
6561                               
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
6565 @@ -11,7 +11,7 @@
6566  */
6567  
6568  /*
6569 -  $Id$
6570 +  $Id$
6571  */
6572  
6573  #include <limits.h>
6574 @@ -136,9 +136,13 @@
6575  int pkgset_pmprovides(const struct pkgset *ps, const struct capreq *req)
6576  {
6577      struct capreq *cap;
6578 -    
6579 +
6580      if (ps->rpmcaps == NULL)
6581 -        return 1;               /* no caps -> assume yes */
6582 +        return 0;               /* no caps -> assume NO */
6583 +
6584 +    /* internal caps have names like name(feature) */
6585 +    if (!capreq_is_rpmlib(req) && strstr(capreq_name(req), "(") == NULL)
6586 +        return 0;
6587  
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
6593 @@ -11,7 +11,13 @@
6594  */
6595  
6596  /*
6597 -  $Id$
6598 +  $Id$
6599 +*/
6600 +
6601 +/*
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
6605  */
6606  
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 */
6616              struct pkg *p;
6617              int is_marked = 0, ndragged = 0, by_obsoletes = 0;
6618  
6619 @@ -1186,9 +1194,10 @@
6620              successor.realpkg = p;
6621              successor.by_obsoletes = by_obsoletes;
6622              
6623 -            /* do not follow successor if package drags something and
6624 -              is not marked */
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 */
6628 +           
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);
6632                  p = NULL;
6633 @@ -1240,7 +1249,8 @@
6634  
6635          DBGF("req %s\n", capreq_snprintf_s(req));
6636  
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;
6641          
6642          if (find_req(pkg, req, &tomark, tomark_candidates_ptr, ps, upg)) {
6643 @@ -1298,6 +1308,14 @@
6644                  int n;
6645                  n = upg->ts->askpkg_fn(capreq_snprintf_s(req),
6646                                         tomark_candidates, tomark);
6647 +                
6648 +                if (n == -1) {  /* user abort */
6649 +                    free(tomark_candidates);
6650 +                    tomark_candidates = NULL;
6651 +                    upg->nerr_fatal++;
6652 +                    return 0;
6653 +                }
6654 +                
6655                  real_tomark = tomark_candidates[n];
6656                  free(tomark_candidates);
6657                  tomark_candidates = NULL;
6658 @@ -1434,12 +1452,15 @@
6659  
6660      if (pkg->reqs)
6661          process_pkg_reqs(indent, pkg, ps, upg, process_as);
6662 -
6663 +        
6664      if (process_as == PROCESS_AS_NEW) {
6665          process_pkg_conflicts(indent, pkg, ps, upg);
6666          //process_pkg_obsl(pkg, ps, upg, indent);
6667      }
6668  
6669 +    if (upg->nerr_fatal || sigint_reached())
6670 +        return 0;
6671 +
6672      DBGF("END PROCESSING [%d] %s as %s\n", indent, pkg_id(pkg),
6673           process_as == PROCESS_AS_NEW ? "NEW" : "ORPHAN");
6674  
6675 @@ -1529,7 +1550,14 @@
6676          struct pkg *real_tomark = tomark;
6677          if (tomark_candidates) {
6678              int n;
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,
6681 +                                   tomark);
6682 +            if (n == -1) {
6683 +                n_cfree(&tomark_candidates);
6684 +                upg->nerr_fatal++;
6685 +                goto l_end;
6686 +            }
6687 +            
6688              real_tomark = tomark_candidates[n];
6689              n_cfree(&tomark_candidates);
6690          }
6691 @@ -1805,6 +1833,9 @@
6692  
6693      db = upg->ts->db;
6694  
6695 +    if (upg->nerr_fatal || sigint_reached())
6696 +        return 0;
6697 +
6698      if (!upg->ts->getop(upg->ts, POLDEK_OP_CONFLICTS))
6699          return 1;
6700      
6701 @@ -1847,7 +1878,9 @@
6702          if (n)
6703              pkg_set_unmetdeps(upg->unmetpms, pkg);
6704      }
6705 -        
6706 +
6707 +    if (upg->nerr_fatal || sigint_reached())
6708 +        return 0;
6709          
6710      if (pkg->cnfls != NULL)
6711          for (i = 0; i < n_array_size(pkg->cnfls); i++) {
6712 @@ -2314,103 +2347,8 @@
6713      return nmarked;
6714  }
6715  
6716 -static
6717 -int prepare_icap(struct poldek_ts *ts, const char *capname, tn_array *pkgs) 
6718 -{
6719 -    int i, found = 0;
6720 -    tn_array *dbpkgs;
6721 -    struct capreq *cap;
6722 -
6723 -    capreq_new_name_a(capname, cap);
6724 -    dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cap, NULL, 0);
6725 -    if (dbpkgs == NULL) {
6726 -        struct pkg *pkg;
6727 -        if (ts->getop(ts, POLDEK_OP_FRESHEN))
6728 -            return 0;
6729 -
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);
6733 -        return 1;
6734 -    }
6735 -    
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);
6741 -
6742 -        DBGF("%s: %s\n", capname, pkg_id(dbpkg));
6743 -        
6744 -        if (n < 0)
6745 -            continue;
6746 -    
6747 -        for (; n < n_array_size(pkgs); n++) {
6748 -            struct pkg *pkg = n_array_nth(pkgs, n);
6749 -            int cmprc, mark = 0;
6750 -
6751 -            DBGF("%s: %s cmp %s\n", capname, pkg_id(pkg),
6752 -                 pkg_id(dbpkg));
6753 -            if (pkg_cmp_name(pkg, dbpkg) != 0)
6754 -                break;
6755 -            
6756 -            cmprc = pkg_cmp_name_evr(pkg, dbpkg);
6757 -            if (cmprc > 0)
6758 -                mark = 1;
6759 -                
6760 -            else if (cmprc == 0 && poldek_ts_issetf(ts, POLDEK_TS_REINSTALL))
6761 -                mark = 1;
6762 -                
6763 -            else if (cmprc < 0 && poldek_ts_issetf(ts, POLDEK_TS_DOWNGRADE))
6764 -                mark = 1;
6765 -
6766 -            if (mark) {
6767 -                found = 1;
6768 -                msgn(1, _("%s: marked as %s's provider"), pkg_id(pkg),
6769 -                     capname);
6770 -                
6771 -                pkg_hand_mark(ts->pms, pkg);
6772 -                goto l_end;
6773 -                
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),
6778 -                     pkg_id(pkg));
6779 -                
6780 -            } else {
6781 -                n_assert(0);
6782 -                
6783 -            }
6784 -        }
6785 -    }
6786 -l_end:
6787 -    if (dbpkgs)
6788 -        n_array_free(dbpkgs);
6789 -    
6790 -    return found;
6791 -}
6792 -
6793 -static
6794 -int prepare_icaps(struct poldek_ts *ts) 
6795 -{
6796 -    tn_array *keys;
6797 -    tn_hash *icaps;
6798 -    int i;
6799 -
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);
6806 -    }
6807 -    n_array_free(keys);
6808 -    n_hash_free(icaps);
6809 -    return 1;
6810 -}
6811 -
6812 -
6813 +/* use install/ in_prepare_icaps() */
6814 +extern int in_prepare_icaps(struct poldek_ts *ts);
6815  
6816  int do_poldek_ts_install(struct poldek_ts *ts, struct poldek_iinf *iinf)
6817  {
6818 @@ -2421,7 +2359,9 @@
6819      
6820      n_assert(ts->type == POLDEK_TS_INSTALL);
6821  
6822 -    prepare_icaps(ts);
6823 +    if (in_prepare_icaps(ts) == -1) /* user abort */
6824 +        return 1;
6825 +    
6826      if (unmark_name_dups(ts->pms, ps->pkgs) == 0) {
6827          msgn(1, _("Nothing to do"));
6828          return 1;
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
6832 @@ -11,7 +11,7 @@
6833  */
6834  
6835  /*
6836 -  $Id$
6837 +  $Id$
6838  */
6839  
6840  #include <limits.h>
6841 @@ -332,32 +332,25 @@
6842           n_assert(0);
6843      */ 
6844      
6845 -    if (capreq_is_rpmlib(req)) {
6846 -        if (matched) {
6847 -            int i;
6848 +    if (capreq_is_rpmlib(req) && matched) {
6849 +        int i;
6850              
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);
6855 -                    matched = 0;
6856 -                }
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);
6861 +                matched = 0;
6862              }
6863          }
6864 +        
6865 +        *suspkgs = NULL;
6866 +        *npkgs = 0;
6867 +    }
6868  
6869 -        if (pkgset_pmprovides(ps, req)) {
6870 -            matched = 1;
6871 -            capreq_set_satisfied(req);
6872 -            msg(4, " req %-35s --> PM_CAP\n", capreq_snprintf_s(req));
6873 -        }
6874 -#if 0
6875 -DUPA        
6876 -        if (!matched && (ps->flags & (PSMODE_VERIFY | PSMODE_MKIDX))) {
6877 -            matched = 1;
6878 -            logn(LOGWARN, "%s: not found (poldek needs to be linked with newer"
6879 -                 " rpmlib)\n", capreq_snprintf_s(req));
6880 -        }
6881 -#endif        
6882 +    if (!matched && pkgset_pmprovides(ps, req)) {
6883 +        matched = 1;
6884 +        capreq_set_satisfied(req);
6885 +        msg(4, " req %-35s --> PM_CAP\n", capreq_snprintf_s(req));
6886          
6887          *suspkgs = NULL;
6888          *npkgs = 0;
6889 @@ -407,7 +400,7 @@
6890      return nmatch;
6891  }
6892  
6893 -
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,
6898 @@ -431,7 +424,7 @@
6899          
6900      found = 0;
6901  
6902 -    if (poldek_conf_MULTILIB) {
6903 +    if (poldek_conf_MULTILIB && pkg) {
6904          struct pkg **tmp = alloca(sizeof(*tmp) * nsuspkgs);
6905          int i, j = 0;
6906  
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
6910 @@ -11,7 +11,7 @@
6911  */
6912  
6913  /*
6914 -  $Id$
6915 +  $Id$
6916  */
6917  
6918  #include <ctype.h>
6919 @@ -337,7 +337,7 @@
6920      }
6921  
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);
6928 @@ -370,7 +370,7 @@
6929          headerAddEntry(hdr, RPMTAG_VENDOR, RPM_STRING_TYPE, pkgu->vendor, 1);
6930      
6931      if (pkgu->license)
6932 -        headerAddEntry(hdr, RPMTAG_COPYRIGHT, RPM_STRING_TYPE, pkgu->license, 1);
6933 +        headerAddEntry(hdr, PM_RPMTAG_LICENSE, RPM_STRING_TYPE, pkgu->license, 1);
6934      
6935      if (pkgu->url)
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
6940 @@ -22,6 +22,7 @@
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);
6945  
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
6951 @@ -11,7 +11,7 @@
6952  */
6953  
6954  /*
6955 -  $Id$
6956 +  $Id$
6957  */
6958  
6959  #include <stdlib.h>
6960 @@ -440,6 +440,9 @@
6961                                      tn_array *unistdbpkgs, unsigned ldflags)
6962  {
6963      tn_array *dbpkgs = NULL;
6964 +
6965 +    n_assert(db);
6966 +    n_assert(cap);
6967      pkgdb_search(db, &dbpkgs, PMTAG_CAP, capreq_name(cap),
6968                   unistdbpkgs, ldflags);
6969      return dbpkgs;
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
6973 @@ -11,7 +11,7 @@
6974  */
6975  
6976  /*
6977 -  $Id$
6978 +  $Id$
6979  */
6980  
6981  #include <sys/param.h>          /* for PATH_MAX */
6982 @@ -161,4 +161,13 @@
6983      return 0;
6984  }
6985  
6986 +int pm_conf_get(struct pm_ctx *ctx, const char *key, char *val, int vsize)
6987 +{
6988 +    if (ctx->mod->conf_get)
6989 +        return ctx->mod->conf_get(ctx->modh, key, val, vsize);
6990 +    
6991 +    return 0;
6992 +}
6993 +
6994 +
6995  
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
6999 @@ -21,6 +21,8 @@
7000  void pm_free(struct pm_ctx *ctx);
7001  
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);
7004 +
7005  const char *pm_get_name(struct pm_ctx *ctx);
7006  
7007  
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
7011 @@ -6,7 +6,7 @@
7012      0, "pset",
7013      pm_pset_init, pm_pset_destroy,
7014      pm_pset_configure, 
7015 -    
7016 +    NULL, 
7017      NULL,
7018  
7019  //    pm_pset_dbpath, 
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
7023 @@ -11,7 +11,7 @@
7024  */
7025  
7026  /*
7027 -  $Id$
7028 +  $Id$
7029  */
7030  
7031  #ifdef HAVE_CONFIG_H
7032 @@ -23,6 +23,9 @@
7033  #include <string.h>
7034  
7035  #include <rpm/rpmlib.h>
7036 +#if HAVE_RPMDSRPMLIB
7037 +# include <rpm/rpmds.h>
7038 +#endif
7039  
7040  #include <trurl/nassert.h>
7041  #include <trurl/nstr.h>
7042 @@ -33,23 +36,88 @@
7043  #include "log.h"
7044  #include "pm/pm.h"
7045  
7046 -tn_array *pm_rpm_rpmlib_caps(void) 
7047 +#if HAVE_RPMDSRPMLIB            /* rpmdsRpmlib() => rpm >= 4.4.3 */
7048 +
7049 +static int extract_rpmds(tn_array *caps, rpmds ds)
7050 +{
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;
7057 +
7058 +        name = rpmdsN(ds);
7059 +        evr = rpmdsEVR(ds);
7060 +        flags = rpmdsFlags(ds);
7061 +        
7062 +        if ((flags & RPMSENSE_EQUAL)) {
7063 +            n_strncpy(tmp, evr, 128);
7064 +            tmpptr = tmp;
7065 +            crflags = REL_EQ;
7066 +            
7067 +        } else {                /* cap without version */
7068 +            tmpptr = NULL;
7069 +            crflags = 0;
7070 +        }
7071 +        
7072 +        cr = capreq_new_evr(name, tmpptr, crflags, 0);
7073 +        if (cr) {
7074 +            msgn(3, "  - %s", capreq_snprintf_s(cr));
7075 +            n_array_push(caps, cr);
7076 +        }
7077 +    }
7078 +    ds = rpmdsFree(ds);
7079 +    return n_array_size(caps);
7080 +}
7081 +
7082 +typedef int (*rpmcap_fn)(rpmds *ds, void *);
7083 +
7084 +static int get_rpmlib_caps(tn_array *caps)
7085 +{
7086 +    rpmds     ds = NULL;
7087 +    int       i;
7088 +    rpmcap_fn functions[] = {
7089 +        rpmdsRpmlib,
7090 +#ifdef HAVE_RPMDSCPUINFO
7091 +        (rpmcap_fn)rpmdsCpuinfo,
7092 +#endif
7093 +#ifdef HAVE_RPMDSGETCONF
7094 +        (rpmcap_fn)rpmdsGetconf,
7095 +#endif
7096 +#ifdef HAVE_RPMDSSYSINFO
7097 +        (rpmcap_fn)rpmdsSysinfo,
7098 +#endif        
7099 +#ifdef HAVE_RPMDSUNAME
7100 +        (rpmcap_fn)rpmdsUname,
7101 +#endif        
7102 +        NULL,
7103 +    };
7104 +
7105 +    i = 0;
7106 +    msgn(3, "Loading internal capabilities");
7107 +    while (functions[i]) {
7108 +        functions[i++](&ds, NULL);
7109 +    }
7110 +    
7111 +    return extract_rpmds(caps, ds);
7112 +}
7113 +
7114 +#endif  /* HAVE_RPMDSRPMLIB */
7115 +
7116 +#if HAVE_RPMGETRPMLIBPROVIDES   /* rpmGetRpmlibProvides() => rpm < 4.4.3 */
7117 +static int get_rpmlib_caps_rpm_lt_4_4_3(tn_array *caps) 
7118  {
7119      char **names = NULL, **versions = NULL, *evr;
7120      int *flags = NULL, n = 0, i;
7121 -    tn_array *caps;
7122 -    
7123 -#if HAVE_RPMGETRPMLIBPROVIDES
7124 +
7125 +    n_assert(caps);
7126      n = rpmGetRpmlibProvides((const char ***)&names, &flags, (const char ***)&versions);
7127 -#endif
7128 -    
7129      if (n <= 0)
7130 -        return NULL;
7131 +        return 0;
7132  
7133 -    caps = capreq_arr_new(0);
7134 -    
7135      evr = alloca(128);
7136 -    
7137 +
7138      for (i=0; i<n; i++) {
7139          struct capreq *cr;
7140  
7141 @@ -62,19 +130,39 @@
7142              n_array_push(caps, cr);
7143      }
7144  
7145 -    if (names)
7146 -        free(names);
7147 -    
7148 -    if (flags)
7149 -        free(flags);
7150 +    n_cfree(&names);
7151 +    n_cfree(&flags);
7152 +    n_cfree(&versions);
7153 +    return 1;
7154 +}
7155 +#endif
7156  
7157 -    if (versions)
7158 -        free(versions);
7159 +tn_array *pm_rpm_rpmlib_caps(void) 
7160 +{
7161 +    tn_array *caps;
7162 +    int rc = 0;
7163 +    
7164 +    caps = capreq_arr_new(0);
7165 +    
7166 +#if HAVE_RPMDSRPMLIB            /* rpm >= 4.4.3 */
7167 +    rc = get_rpmlib_caps(caps);
7168 +#else
7169 +# if HAVE_RPMGETRPMLIBPROVIDES
7170 +    rc = get_rpmlib_caps_rpm_lt_4_4_3(caps);
7171 +# endif
7172 +#endif
7173      
7174 -    n_array_sort(caps);
7175 +    if (rc) {
7176 +        n_array_sort(caps);
7177 +        
7178 +    } else {
7179 +        n_array_free(caps);
7180 +        caps = NULL;
7181 +    }
7182      return caps;
7183  }
7184  
7185 +
7186  const char *pm_rpm_get_arch(void *pm_rpm) 
7187  {
7188      pm_rpm = 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
7192 @@ -6,8 +6,9 @@
7193      0, "rpm",
7194      (void *(*)(void))pm_rpm_init, pm_rpm_destroy,
7195      pm_rpm_configure,
7196 -    pm_rpm_rpmlib_caps,
7197 -    
7198 +    pm_rpm_conf_get,
7199 +
7200 +    pm_rpm_rpmlib_caps, /* XXX: TODO replace with pm_rpm_conf_get() */
7201      pm_rpm_dbpath, 
7202      pm_rpm_dbmtime,
7203      pm_rpm_dbdepdirs,
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
7207 @@ -10,6 +10,14 @@
7208  # include <rpm/rpmts.h>
7209  #endif
7210  
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
7215 +#else
7216 +# define PM_RPMTAG_LICENSE RPMTAG_LICENSE
7217 +#endif
7218 +
7219  #include <trurl/trurl.h>
7220  #include "poldek.h"
7221  #include "pm/pm.h"
7222 @@ -25,6 +33,8 @@
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);
7227 +
7228  tn_array *pm_rpm_rpmlib_caps(void *pm_rpm);
7229  const char *pm_rpm_get_arch(void *pm_rpm);
7230  
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
7234 @@ -11,7 +11,7 @@
7235  */
7236  
7237  /*
7238 -  $Id$
7239 +  $Id$
7240  */
7241  
7242  #ifdef HAVE_CONFIG_H
7243 @@ -146,6 +146,26 @@
7244      return 1;
7245  }
7246  
7247 +int pm_rpm_conf_get(void *pm_rpm, const char *key, char *value, int vsize)
7248 +{
7249 +    int n = 0;
7250 +
7251 +    pm_rpm = pm_rpm;
7252 +    
7253 +    if (*key == '%') {
7254 +        char *v = rpmExpand(key, NULL);
7255 +        
7256 +        if (v == NULL)
7257 +            return 0;
7258 +
7259 +        if (strlen(v))          /* rpmExpand returns empty strings */
7260 +            n = n_snprintf(value, vsize, "%s", v);
7261 +
7262 +        free(v);
7263 +    }
7264 +    
7265 +    return n;
7266 +}
7267  
7268  
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 @@
7274  vfile/p_open.c
7275  vfile/sample.c
7276  vfile/test_progress.c
7277 -vfile/test_vfile.c
7278  vfile/test_vopen3.c
7279  vfile/testcookie.c
7280  vfile/ttest.c
7281 -vfile/vfcurl.c
7282  vfile/vfetch.c
7283  vfile/vfff/base64.c
7284  vfile/vfff/ftp.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
7288 @@ -27,7 +27,7 @@
7289      unsigned         ps_setup_flags;
7290      struct pkgset    *ps;
7291      struct pm_ctx    *pmctx;
7292 -
7293 +    int              _rpm_tscolor; /* rpm transaction color */
7294  //    tn_array       *inst_pkgs;  /* array of installed packages  */
7295  //    time_t         ts_instpkgs; /* inst_pkgs timestamp */
7296      
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
7300 @@ -11,7 +11,7 @@
7301  */
7302  
7303  /*
7304 -  $Id$
7305 +  $Id$
7306  */
7307  
7308  #include <stdarg.h>
7309 @@ -1036,6 +1036,7 @@
7310  
7311      if (rc && !ts->getop(ts, POLDEK_OP_RPMTEST))
7312          pkgdb_tx_commit(ts->db);
7313 +
7314      pkgdb_free(ts->db);
7315      ts->db = NULL;
7316      return rc;
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
7320 @@ -1,4 +1,4 @@
7321 -/* $Id$ */
7322 +/* $Id$ */
7323  #ifndef  POLDEK_LIB_TX_H
7324  #define  POLDEK_LIB_TX_H
7325  
7326 @@ -126,8 +126,9 @@
7327      int   (*getop_v)(const struct poldek_ts *, int op, ...);
7328      void  (*setop)(struct poldek_ts *, int op, int onoff);
7329  
7330 -    int                 uninstall_greedy_deep;
7331 -    
7332 +    int   uninstall_greedy_deep; /* greediness of uninstall, is set
7333 +                                    by ts->setop(POLDEK_OP_GREEDY, v)
7334 +                                  */
7335  };
7336  #endif
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
7341 @@ -1,9 +1,27 @@
7342  #ifndef POLDEK_UTIL_H
7343  
7344 +#include <trurl/nhash.h>
7345 +
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);
7349  
7350  const char *poldek_util_ngettext_n_packages_fmt(int n);
7351 +
7352  int poldek_util_parse_bool(const char *v);
7353 +
7354 +/* returns 0 - false, 1 - true, 2 - auto */
7355 +int poldek_util_parse_bool3(const char *v);
7356 +
7357 +
7358 +/* remove used variables from varh */
7359 +#define POLDEK_UTIL_EXPANDVARS_RMUSED (1 << 0)
7360 +
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,
7364 +                                    unsigned flags);
7365 +
7366 +const char *poldek_util_expand_env_vars(char *dest, int size, const char *str);
7367 +
7368  #endif
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
7372 @@ -0,0 +1,2 @@
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
7378 @@ -0,0 +1,556 @@
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>
7384 +    </property>
7385 +    <property name="geometry">
7386 +        <rect>
7387 +            <x>0</x>
7388 +            <y>0</y>
7389 +            <width>761</width>
7390 +            <height>764</height>
7391 +        </rect>
7392 +    </property>
7393 +    <property name="sizePolicy">
7394 +        <sizepolicy>
7395 +            <hsizetype>5</hsizetype>
7396 +            <vsizetype>5</vsizetype>
7397 +            <horstretch>0</horstretch>
7398 +            <verstretch>0</verstretch>
7399 +        </sizepolicy>
7400 +    </property>
7401 +    <property name="caption">
7402 +        <string>poldek package browser (python module demo)</string>
7403 +    </property>
7404 +    <vbox>
7405 +        <property name="name">
7406 +            <cstring>unnamed</cstring>
7407 +        </property>
7408 +        <property name="margin">
7409 +            <number>0</number>
7410 +        </property>
7411 +        <property name="spacing">
7412 +            <number>0</number>
7413 +        </property>
7414 +        <widget class="QSplitter">
7415 +            <property name="name">
7416 +                <cstring>splitter10</cstring>
7417 +            </property>
7418 +            <property name="orientation">
7419 +                <enum>Vertical</enum>
7420 +            </property>
7421 +            <widget class="QListView">
7422 +                <column>
7423 +                    <property name="text">
7424 +                        <string>Name</string>
7425 +                    </property>
7426 +                    <property name="clickable">
7427 +                        <bool>true</bool>
7428 +                    </property>
7429 +                    <property name="resizable">
7430 +                        <bool>true</bool>
7431 +                    </property>
7432 +                </column>
7433 +                <column>
7434 +                    <property name="text">
7435 +                        <string>Version</string>
7436 +                    </property>
7437 +                    <property name="clickable">
7438 +                        <bool>true</bool>
7439 +                    </property>
7440 +                    <property name="resizable">
7441 +                        <bool>true</bool>
7442 +                    </property>
7443 +                </column>
7444 +                <column>
7445 +                    <property name="text">
7446 +                        <string>Size</string>
7447 +                    </property>
7448 +                    <property name="clickable">
7449 +                        <bool>true</bool>
7450 +                    </property>
7451 +                    <property name="resizable">
7452 +                        <bool>true</bool>
7453 +                    </property>
7454 +                </column>
7455 +                <property name="name">
7456 +                    <cstring>PackageListView</cstring>
7457 +                </property>
7458 +            </widget>
7459 +            <widget class="QTabWidget">
7460 +                <property name="name">
7461 +                    <cstring>packageTab</cstring>
7462 +                </property>
7463 +                <property name="tabPosition">
7464 +                    <enum>Bottom</enum>
7465 +                </property>
7466 +                <property name="tabShape">
7467 +                    <enum>Rounded</enum>
7468 +                </property>
7469 +                <widget class="QWidget">
7470 +                    <property name="name">
7471 +                        <cstring>descr</cstring>
7472 +                    </property>
7473 +                    <attribute name="title">
7474 +                        <string>Description</string>
7475 +                    </attribute>
7476 +                    <vbox>
7477 +                        <property name="name">
7478 +                            <cstring>unnamed</cstring>
7479 +                        </property>
7480 +                        <property name="margin">
7481 +                            <number>0</number>
7482 +                        </property>
7483 +                        <property name="spacing">
7484 +                            <number>0</number>
7485 +                        </property>
7486 +                        <widget class="QTextBrowser">
7487 +                            <property name="name">
7488 +                                <cstring>DescriptionText</cstring>
7489 +                            </property>
7490 +                        </widget>
7491 +                    </vbox>
7492 +                </widget>
7493 +                <widget class="QWidget">
7494 +                    <property name="name">
7495 +                        <cstring>caps</cstring>
7496 +                    </property>
7497 +                    <attribute name="title">
7498 +                        <string>Provides</string>
7499 +                    </attribute>
7500 +                    <hbox>
7501 +                        <property name="name">
7502 +                            <cstring>unnamed</cstring>
7503 +                        </property>
7504 +                        <property name="margin">
7505 +                            <number>0</number>
7506 +                        </property>
7507 +                        <widget class="QListView">
7508 +                            <column>
7509 +                                <property name="text">
7510 +                                    <string>Capability</string>
7511 +                                </property>
7512 +                                <property name="clickable">
7513 +                                    <bool>true</bool>
7514 +                                </property>
7515 +                                <property name="resizable">
7516 +                                    <bool>true</bool>
7517 +                                </property>
7518 +                            </column>
7519 +                            <property name="name">
7520 +                                <cstring>CapsListView</cstring>
7521 +                            </property>
7522 +                        </widget>
7523 +                    </hbox>
7524 +                </widget>
7525 +                <widget class="QWidget">
7526 +                    <property name="name">
7527 +                        <cstring>TabPage</cstring>
7528 +                    </property>
7529 +                    <attribute name="title">
7530 +                        <string>Requires</string>
7531 +                    </attribute>
7532 +                    <hbox>
7533 +                        <property name="name">
7534 +                            <cstring>unnamed</cstring>
7535 +                        </property>
7536 +                        <property name="margin">
7537 +                            <number>0</number>
7538 +                        </property>
7539 +                        <widget class="QListView">
7540 +                            <column>
7541 +                                <property name="text">
7542 +                                    <string>Capability</string>
7543 +                                </property>
7544 +                                <property name="clickable">
7545 +                                    <bool>true</bool>
7546 +                                </property>
7547 +                                <property name="resizable">
7548 +                                    <bool>true</bool>
7549 +                                </property>
7550 +                            </column>
7551 +                            <column>
7552 +                                <property name="text">
7553 +                                    <string>Type</string>
7554 +                                </property>
7555 +                                <property name="clickable">
7556 +                                    <bool>true</bool>
7557 +                                </property>
7558 +                                <property name="resizable">
7559 +                                    <bool>true</bool>
7560 +                                </property>
7561 +                            </column>
7562 +                            <property name="name">
7563 +                                <cstring>ReqsListView</cstring>
7564 +                            </property>
7565 +                        </widget>
7566 +                    </hbox>
7567 +                </widget>
7568 +                <widget class="QWidget">
7569 +                    <property name="name">
7570 +                        <cstring>TabPage</cstring>
7571 +                    </property>
7572 +                    <attribute name="title">
7573 +                        <string>Conflicts</string>
7574 +                    </attribute>
7575 +                    <vbox>
7576 +                        <property name="name">
7577 +                            <cstring>unnamed</cstring>
7578 +                        </property>
7579 +                        <property name="margin">
7580 +                            <number>0</number>
7581 +                        </property>
7582 +                        <widget class="QListView">
7583 +                            <column>
7584 +                                <property name="text">
7585 +                                    <string>Capability</string>
7586 +                                </property>
7587 +                                <property name="clickable">
7588 +                                    <bool>true</bool>
7589 +                                </property>
7590 +                                <property name="resizable">
7591 +                                    <bool>true</bool>
7592 +                                </property>
7593 +                            </column>
7594 +                            <column>
7595 +                                <property name="text">
7596 +                                    <string>Type</string>
7597 +                                </property>
7598 +                                <property name="clickable">
7599 +                                    <bool>true</bool>
7600 +                                </property>
7601 +                                <property name="resizable">
7602 +                                    <bool>true</bool>
7603 +                                </property>
7604 +                            </column>
7605 +                            <property name="name">
7606 +                                <cstring>CnflListView</cstring>
7607 +                            </property>
7608 +                        </widget>
7609 +                    </vbox>
7610 +                </widget>
7611 +                <widget class="QWidget">
7612 +                    <property name="name">
7613 +                        <cstring>files</cstring>
7614 +                    </property>
7615 +                    <attribute name="title">
7616 +                        <string>Files</string>
7617 +                    </attribute>
7618 +                    <vbox>
7619 +                        <property name="name">
7620 +                            <cstring>unnamed</cstring>
7621 +                        </property>
7622 +                        <property name="margin">
7623 +                            <number>0</number>
7624 +                        </property>
7625 +                        <property name="spacing">
7626 +                            <number>0</number>
7627 +                        </property>
7628 +                        <widget class="QListView">
7629 +                            <column>
7630 +                                <property name="text">
7631 +                                    <string>Name</string>
7632 +                                </property>
7633 +                                <property name="clickable">
7634 +                                    <bool>true</bool>
7635 +                                </property>
7636 +                                <property name="resizable">
7637 +                                    <bool>true</bool>
7638 +                                </property>
7639 +                            </column>
7640 +                            <column>
7641 +                                <property name="text">
7642 +                                    <string>Mode</string>
7643 +                                </property>
7644 +                                <property name="clickable">
7645 +                                    <bool>true</bool>
7646 +                                </property>
7647 +                                <property name="resizable">
7648 +                                    <bool>true</bool>
7649 +                                </property>
7650 +                            </column>
7651 +                            <column>
7652 +                                <property name="text">
7653 +                                    <string>Size</string>
7654 +                                </property>
7655 +                                <property name="clickable">
7656 +                                    <bool>true</bool>
7657 +                                </property>
7658 +                                <property name="resizable">
7659 +                                    <bool>true</bool>
7660 +                                </property>
7661 +                            </column>
7662 +                            <property name="name">
7663 +                                <cstring>FileListView</cstring>
7664 +                            </property>
7665 +                        </widget>
7666 +                    </vbox>
7667 +                </widget>
7668 +            </widget>
7669 +        </widget>
7670 +    </vbox>
7671 +</widget>
7672 +<menubar>
7673 +    <property name="name">
7674 +        <cstring>qt_dead_widget_MenuBar</cstring>
7675 +    </property>
7676 +    <property name="enabled">
7677 +        <bool>false</bool>
7678 +    </property>
7679 +    <item text="&amp;File" name="File">
7680 +        <action name="fileNewAction"/>
7681 +        <action name="fileOpenAction"/>
7682 +        <action name="fileSaveAction"/>
7683 +        <action name="fileSaveAsAction"/>
7684 +        <separator/>
7685 +        <action name="filePrintAction"/>
7686 +        <separator/>
7687 +        <action name="fileExitAction"/>
7688 +    </item>
7689 +    <item text="&amp;Help" name="Help">
7690 +        <action name="helpContentsAction"/>
7691 +        <action name="helpIndexAction"/>
7692 +        <separator/>
7693 +        <action name="helpAboutAction"/>
7694 +    </item>
7695 +    <separator/>
7696 +</menubar>
7697 +<toolbars>
7698 +</toolbars>
7699 +<actions>
7700 +    <action>
7701 +        <property name="name">
7702 +            <cstring>fileNewAction</cstring>
7703 +        </property>
7704 +        <property name="iconSet">
7705 +            <iconset>image0</iconset>
7706 +        </property>
7707 +        <property name="text">
7708 +            <string>New</string>
7709 +        </property>
7710 +        <property name="menuText">
7711 +            <string>&amp;New</string>
7712 +        </property>
7713 +        <property name="accel">
7714 +            <string>Ctrl+N</string>
7715 +        </property>
7716 +    </action>
7717 +    <action>
7718 +        <property name="name">
7719 +            <cstring>fileOpenAction</cstring>
7720 +        </property>
7721 +        <property name="iconSet">
7722 +            <iconset>image1</iconset>
7723 +        </property>
7724 +        <property name="text">
7725 +            <string>Open</string>
7726 +        </property>
7727 +        <property name="menuText">
7728 +            <string>&amp;Open...</string>
7729 +        </property>
7730 +        <property name="accel">
7731 +            <string>Ctrl+O</string>
7732 +        </property>
7733 +    </action>
7734 +    <action>
7735 +        <property name="name">
7736 +            <cstring>fileSaveAction</cstring>
7737 +        </property>
7738 +        <property name="iconSet">
7739 +            <iconset>image2</iconset>
7740 +        </property>
7741 +        <property name="text">
7742 +            <string>Save</string>
7743 +        </property>
7744 +        <property name="menuText">
7745 +            <string>&amp;Save</string>
7746 +        </property>
7747 +        <property name="accel">
7748 +            <string>Ctrl+S</string>
7749 +        </property>
7750 +    </action>
7751 +    <action>
7752 +        <property name="name">
7753 +            <cstring>fileSaveAsAction</cstring>
7754 +        </property>
7755 +        <property name="text">
7756 +            <string>Save As</string>
7757 +        </property>
7758 +        <property name="menuText">
7759 +            <string>Save &amp;As...</string>
7760 +        </property>
7761 +        <property name="accel">
7762 +            <string></string>
7763 +        </property>
7764 +    </action>
7765 +    <action>
7766 +        <property name="name">
7767 +            <cstring>filePrintAction</cstring>
7768 +        </property>
7769 +        <property name="iconSet">
7770 +            <iconset>image3</iconset>
7771 +        </property>
7772 +        <property name="text">
7773 +            <string>Print</string>
7774 +        </property>
7775 +        <property name="menuText">
7776 +            <string>&amp;Print...</string>
7777 +        </property>
7778 +        <property name="accel">
7779 +            <string>Ctrl+P</string>
7780 +        </property>
7781 +    </action>
7782 +    <action>
7783 +        <property name="name">
7784 +            <cstring>fileExitAction</cstring>
7785 +        </property>
7786 +        <property name="text">
7787 +            <string>Exit</string>
7788 +        </property>
7789 +        <property name="menuText">
7790 +            <string>E&amp;xit</string>
7791 +        </property>
7792 +        <property name="accel">
7793 +            <string></string>
7794 +        </property>
7795 +    </action>
7796 +    <action>
7797 +        <property name="name">
7798 +            <cstring>helpContentsAction</cstring>
7799 +        </property>
7800 +        <property name="text">
7801 +            <string>Contents</string>
7802 +        </property>
7803 +        <property name="menuText">
7804 +            <string>&amp;Contents...</string>
7805 +        </property>
7806 +        <property name="accel">
7807 +            <string></string>
7808 +        </property>
7809 +    </action>
7810 +    <action>
7811 +        <property name="name">
7812 +            <cstring>helpIndexAction</cstring>
7813 +        </property>
7814 +        <property name="text">
7815 +            <string>Index</string>
7816 +        </property>
7817 +        <property name="menuText">
7818 +            <string>&amp;Index...</string>
7819 +        </property>
7820 +        <property name="accel">
7821 +            <string></string>
7822 +        </property>
7823 +    </action>
7824 +    <action>
7825 +        <property name="name">
7826 +            <cstring>helpAboutAction</cstring>
7827 +        </property>
7828 +        <property name="text">
7829 +            <string>About</string>
7830 +        </property>
7831 +        <property name="menuText">
7832 +            <string>&amp;About</string>
7833 +        </property>
7834 +        <property name="accel">
7835 +            <string></string>
7836 +        </property>
7837 +    </action>
7838 +    <action>
7839 +        <property name="name">
7840 +            <cstring>Action</cstring>
7841 +        </property>
7842 +        <property name="text">
7843 +            <string>Unnamed</string>
7844 +        </property>
7845 +    </action>
7846 +</actions>
7847 +<images>
7848 +    <image name="image0">
7849 +        <data format="PNG" length="173">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000007449444154789cedd5c109c0200c05d06fe936812c10b2ffdd85d25385b6a991480f053f081af0291210f828c5a9d9c4de96cd2b9ad9eb0000660e2fe0c2519839c4f70c4c446d5e6b3538cf928245e4b2f6f014acaa8fda1d4fc1a5741b22079f9d111d96ea8a912c78c10bee64e60719f57e9203ad452a040318f5f70000000049454e44ae426082</data>
7850 +    </image>
7851 +    <image name="image1">
7852 +        <data format="PNG" length="210">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000009949444154789ced94410e85200c445f89c7367f61bc775d2848a42860ffced9548bbe8e13043e1d928177f481a123dc2b34f6f47a3de2b865a8843f4001982a0b3d5f62c58300aa1ad70550449ab9d507a773a8a4ba4f92a2df333c64c63bebbd82e5b8addecbcc7820eb4266c639745dfa80f36faf66c66fa19c3f882fb470ec05cdc0bed07893f68e171492635f686c3eeff6ba3c8fdd366dc4c0452cf153a9590000000049454e44ae426082</data>
7853 +    </image>
7854 +    <image name="image2">
7855 +        <data format="PNG" length="217">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000000a049444154789cd5954d0a802010859fd14668e18de662d222bc98376a21b4ac451992c66469e0b7f187f1f11c47052a218e762daddbfb9e99f6568f80b5364b8588ce35440400e80a398ce8f99034d2292cc37c8ebd530feb583a05e954341f8a027b2a7d3a1f09bf854dc5d5d953aa396e4f38cab199e2d2e108abe156f82e30977fcb4d8ff942d75dbebed2e143953a93f6caad3d6111f44b7d4f820ff9c0069bb51ecd122066740000000049454e44ae426082</data>
7856 +    </image>
7857 +    <image name="image3">
7858 +        <data format="PNG" length="725">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b0000029c49444154789c8d95ad76db4010853ff718cc3289d950d06136344c98c362964087256f503f426161021be6b2842550612e8be14299496c866dc14ab2fc77da2192665777eedc3b5af53813afafaf414448d3742f6f6600a82a005555912409575757bdeebefe396011613299b440876b4d946589f7fe68cf596080cd6673047658485571cefd3ff02900333b2a70aa23806fa792799e07336b9938e770ceede9dde82f2247fa9e65acaa244942599688486b54374eb5ff4fc6105b3c9c882e6853ec9c142719376c4e31ede655756f42ba71a40dc06ab50a5996311c0ecf8237467e7e7e022092309f5fb7787b8cdfdfdf83f79efc2347668288b40087d786695994e479ceb6daf2f0f01066b319d7d7d7bd5e1774b3f154c5163580d34c019ca408020e7ce159afffb0dd16a81a1717198bc5224ad130bd9c5ee2d2145503538e6c3103849c4f3e78656a53d2af94e79767fc57fcfad4946c7411419f9e7e85b228c3ffc457f80aa3300a12248cc228acd7ebf0e3fbcf301e8fc360908524494236c842bfda56dcdddd9c75f73052522e999223cc98311e8f4964486905cfbf5ea8aa8a7490d237c0fb22cea31988106b48ed36385c54dc14c4f160dfb9c133b4217fd88019e97018d76b77fa6551e045a29e66b4be39882ed69d38031520e604f0b6c5886788df6c5a4f1cf5b835096b00b17628148b35746f673b39d278da0945e9236065e705adc976371a200a76b8e2302ba9fb6c7a633299f20debb06cc96a7cb4faba07ea9a6d35680d58cb39180c582cee2263ef7d631588412540159d338b30d2b0b21d183bcd31430496cb25f3f9bcd7cfb28c8fb70f7ebfbda16ac4f347d81b3ee93ccb0eb2edb39ea6e572c9e3e3630f3a87d06ab50aabd51bdbfaffa5686dcace99dd5f0354cb785f1993e984dbdb5beeefef5bbcbfd1f69e0c0f8448030000000049454e44ae426082</data>
7859 +    </image>
7860 +</images>
7861 +<connections>
7862 +    <connection>
7863 +        <sender>fileNewAction</sender>
7864 +        <signal>activated()</signal>
7865 +        <receiver>mainWindow</receiver>
7866 +        <slot>fileNew()</slot>
7867 +    </connection>
7868 +    <connection>
7869 +        <sender>fileOpenAction</sender>
7870 +        <signal>activated()</signal>
7871 +        <receiver>mainWindow</receiver>
7872 +        <slot>fileOpen()</slot>
7873 +    </connection>
7874 +    <connection>
7875 +        <sender>fileSaveAction</sender>
7876 +        <signal>activated()</signal>
7877 +        <receiver>mainWindow</receiver>
7878 +        <slot>fileSave()</slot>
7879 +    </connection>
7880 +    <connection>
7881 +        <sender>fileSaveAsAction</sender>
7882 +        <signal>activated()</signal>
7883 +        <receiver>mainWindow</receiver>
7884 +        <slot>fileSaveAs()</slot>
7885 +    </connection>
7886 +    <connection>
7887 +        <sender>filePrintAction</sender>
7888 +        <signal>activated()</signal>
7889 +        <receiver>mainWindow</receiver>
7890 +        <slot>filePrint()</slot>
7891 +    </connection>
7892 +    <connection>
7893 +        <sender>fileExitAction</sender>
7894 +        <signal>activated()</signal>
7895 +        <receiver>mainWindow</receiver>
7896 +        <slot>fileExit()</slot>
7897 +    </connection>
7898 +    <connection>
7899 +        <sender>helpIndexAction</sender>
7900 +        <signal>activated()</signal>
7901 +        <receiver>mainWindow</receiver>
7902 +        <slot>helpIndex()</slot>
7903 +    </connection>
7904 +    <connection>
7905 +        <sender>helpContentsAction</sender>
7906 +        <signal>activated()</signal>
7907 +        <receiver>mainWindow</receiver>
7908 +        <slot>helpContents()</slot>
7909 +    </connection>
7910 +    <connection>
7911 +        <sender>helpAboutAction</sender>
7912 +        <signal>activated()</signal>
7913 +        <receiver>mainWindow</receiver>
7914 +        <slot>helpAbout()</slot>
7915 +    </connection>
7916 +</connections>
7917 +<tabstops>
7918 +    <tabstop>PackageListView</tabstop>
7919 +    <tabstop>packageTab</tabstop>
7920 +    <tabstop>DescriptionText</tabstop>
7921 +</tabstops>
7922 +<slots>
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>
7932 +</slots>
7933 +<layoutdefaults spacing="6" margin="11"/>
7934 +</UI>
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
7938 @@ -0,0 +1,137 @@
7939 +# $Id$
7940 +# Package browser app to try and train poldek python module
7941 +
7942 +import sys
7943 +import locale
7944 +from optparse import OptionParser
7945 +
7946 +import qt
7947 +import poldek
7948 +
7949 +from mainWindow import mainWindow
7950 +
7951 +class MainWindow(mainWindow):
7952 +    def fillPackageList(self, list):
7953 +        for p in 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
7957 +            
7958 +        self.connect( self.PackageListView, qt.SIGNAL("selectionChanged(QListViewItem *)"),
7959 +                      self.selectedSlot)
7960 +
7961 +    def selectedSlot(self, item, *args, **kw):
7962 +        #print "package ", item.__package
7963 +        qt.QApplication.setOverrideCursor(qt.QCursor(qt.QApplication.WaitCursor))
7964 +        
7965 +        self.showPackageDescription(item.__package)
7966 +        self.showPackageCaps(item.__package)
7967 +        self.showPackageFiles(item.__package)
7968 +
7969 +        qt.QApplication.restoreOverrideCursor()
7970 +
7971 +
7972 +    def showPackageFiles(self, pkg):
7973 +        self.FileListView.clear()
7974 +        
7975 +        it = pkg.get_flist_it()
7976 +       
7977 +        fi = it.get_tuple()
7978 +        while fi:
7979 +            item = qt.QListViewItem(self.FileListView, fi[0], "%o" % fi[2], "%i" % fi[1])
7980 +            fi = it.get_tuple()
7981 +
7982 +    def showPackageCaps(self, pkg):
7983 +        self.CapsListView.clear()
7984 +        self.ReqsListView.clear()
7985 +        self.CnflListView.clear()
7986 +
7987 +        
7988 +        caps = pkg.provides()
7989 +        if caps:
7990 +            for c in caps:
7991 +                item = qt.QListViewItem(self.CapsListView, str(c))
7992 +        
7993 +        caps = pkg.requires()
7994 +        if caps:
7995 +            for c in caps:
7996 +                type = ''
7997 +                if c.is_prereq():
7998 +                    type += 'pre'
7999 +                if c.is_prereq_un():
8000 +                    if len(type): type += ', '
8001 +                    type += 'preun'
8002 +                    
8003 +                item = qt.QListViewItem(self.ReqsListView, str(c), type)
8004 +
8005 +        caps = pkg.conflicts()
8006 +        if caps:
8007 +            for c in caps:
8008 +                type = 'conflict';
8009 +                if c.is_obsl():
8010 +                    type = 'obsolete'
8011 +
8012 +                item = qt.QListViewItem(self.CnflListView, str(c), type)
8013 +        
8014 +        
8015 +    def showPackageDescription(self, pkg):
8016 +       dsc = "";
8017 +
8018 +       inf = pkg.uinf()
8019 +       
8020 +       dsc += "<table><tr><td><b>Package: </b></td><td>";
8021 +       dsc += str(pkg)
8022 +       dsc += "</td></tr><tr><td><b>Summary: </b></td><td>";
8023 +       dsc += inf.get(inf.SUMMARY)
8024 +
8025 +       dsc += "</td></tr><tr><td><b>License: </b></td><td>";
8026 +       dsc += inf.get(inf.LICENSE)
8027 +       
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))
8031 +           
8032 +       dsc += "</td></tr></table>";
8033 +       dsc += inf.get(inf.DESCRIPTION)
8034 +       self.DescriptionText.setText(dsc);
8035 +
8036 +
8037 +def get_options():
8038 +    parser = OptionParser()
8039 +    parser.add_option("-n", "--sn", dest="source")
8040 +    (options, args) = parser.parse_args()
8041 +    return options
8042 +
8043 +
8044 +locale.setlocale(locale.LC_ALL, '')
8045 +options = get_options()        
8046 +if not options.source:
8047 +    print "no source specified"
8048 +    sys.exit(1)        
8049 +
8050 +poldek.lib_init()
8051 +
8052 +ctx = poldek.poldek_ctx()
8053 +#poldek_set_verbose(1)
8054 +src = poldek.source(options.source)
8055 +ctx.configure(ctx.CONF_SOURCE, src)
8056 +ctx.load_config()
8057 +if not ctx.setup():
8058 +    print "poldek setup failed"
8059 +    sys.exit(1)
8060 +
8061 +print "Loading packages..."
8062 +arr = ctx.get_avail_packages()
8063 +print "Loaded %d packages" % len(arr)
8064 +if len(arr) == 0:
8065 +    sys.exit(0)
8066 +
8067 +a = qt.QApplication(sys.argv)
8068 +
8069 +w = MainWindow()
8070 +w.setGeometry(100, 100, 900, 700)
8071 +a.setMainWidget(w)
8072 +
8073 +w.fillPackageList(arr)
8074 +w.show()
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
8079 @@ -0,0 +1,3 @@
8080 +#!/bin/sh
8081 +
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
8086 @@ -0,0 +1,3 @@
8087 +#!/bin/sh
8088 +
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
8093 @@ -0,0 +1,108 @@
8094 +#!/usr/bin/python
8095 +import os
8096 +import re
8097 +import sys
8098 +import string
8099 +from types import *
8100 +import poldek
8101 +
8102 +def test_pkguinf(ctx):
8103 +    arr = ctx.get_avail_packages()
8104 +    print "Loaded %d packages" % len(arr)
8105 +    if len(arr) == 0:
8106 +        return 
8107 +        
8108 +    pkg = arr[0]
8109 +    inf = pkg.uinf()
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)
8115 +
8116 +    it = pkg.get_flist_it()
8117 +    f = it.get_tuple()
8118 +    while f:
8119 +        print f
8120 +        f = it.get_tuple()
8121 +
8122 +
8123 +def test_avail(ctx):
8124 +    arr = ctx.get_avail_packages()
8125 +    print "Loaded %d packages" % len(arr)
8126 +    n = 0
8127 +    for ptr in arr:
8128 +        print n, ' ', ptr
8129 +        n += 1
8130 +
8131 +
8132 +def test_search(ctx):
8133 +    arr = ctx.get_avail_packages()
8134 +    print "Found %d package(s)" % len(arr)
8135 +    n = 0
8136 +    for ptr in arr:
8137 +        print n, ' ', ptr
8138 +        n += 1
8139 +
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)
8145 +    ts.run(None)
8146 +
8147 +
8148 +
8149 +def test_cli_ls(cctx):
8150 +    cmd = cctx.rcmd_new(None)
8151 +    if cmd.execline("ls poldek*"):
8152 +        pkgs = cmd.get_packages()
8153 +        return
8154 +        print pkgs
8155 +        n = 0
8156 +        for p in pkgs:
8157 +            print n, ' ', p
8158 +            caps = p.requires()
8159 +            print caps
8160 +            for cap in caps:
8161 +                print "   R:  %s" % cap
8162 +            n += 1
8163 +
8164 +        if not pkgs:    
8165 +            print cmd.get_str()
8166 +
8167 +poldek.lib_init()
8168 +
8169 +ctx = poldek.poldek_ctx()
8170 +#poldek_set_verbose(1)
8171 +src = poldek.source('ac-test')
8172 +ctx.configure(ctx.CONF_SOURCE, src)
8173 +ctx.load_config()
8174 +if not ctx.setup():
8175 +    raise Exception, "error"
8176 +
8177 +
8178 +cctx = poldek.poclidek_ctx(ctx);
8179 +cctx.load_packages(cctx.LOAD_ALL)
8180 +#test_cli_ls(cctx)
8181 +
8182 +
8183 +test_pkguinf(ctx)
8184 +#test_cli_ls(poldctx)
8185 +#arr = poldctx.get_avail_packages()
8186 +sys.exit(0)
8187 +    
8188 +
8189 +ctx = poldek.poldek_ctx()
8190 +#poldek_set_verbose(1)
8191 +src = poldek.source('tt2')
8192 +ctx.configure(ctx.CONF_SOURCE, poldek.source('tt2'))
8193 +ctx.load_config()
8194 +ctx.setup()
8195 +
8196 +test_search(ctx)
8197 +
8198 +
8199 +print "END"
8200 +
8201 +
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
8205 @@ -1,6 +1,6 @@
8206 -# $Id$ 
8207 +# $Id$ 
8208  
8209 -See man page for user documentation. 
8210 +See man and info pages for user documentation. 
8211  
8212  Project homepage: <http://team.pld.org.pl/~mis/poldek/>.  
8213  
8214 @@ -9,7 +9,7 @@
8215  mail to <poldek-subscribe@pld-linux.org>
8216  
8217  
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
8226 @@ -0,0 +1,29 @@
8227 +# $Id$
8228 +
8229 +Syntax of package set file.
8230 +
8231 +Each package is specified in one line: 
8232 +
8233 +[!]NAME [EVR] | @VIRTUAL [DEFAULT_NAME [DEFAULT_EVR]]
8234 +
8235 +'~' ('~' obsolets '!') before means that poldek in interactive mode
8236 +will ask user before install it, in batch mode package will not be
8237 +installed.
8238 +
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.
8242 +
8243 +Hashed lines are treated as comments.
8244 +
8245 +Example:
8246 +
8247 +FHS 2.1 
8248 +basesystem
8249 +pdksh
8250 +@bootloader lilo 2.1
8251 +@smtpdaemon exim
8252 +~dhcp-client
8253 +
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
8259 @@ -0,0 +1,26 @@
8260 +#! /bin/sh
8261 +# $Id$ 
8262 +
8263 +ROOTDIR="public_html/poldek"
8264 +HOST="team.pld.org.pl"
8265 +
8266 +if [ -z "$1" -o -z "$2" ]; then
8267 +    echo "usage: $(basename $0) [FILE...] (${ROOTDIR}/)DESTDIR"
8268 +    exit;
8269 +fi
8270 +
8271 +FILES=""
8272 +while test $# -gt 1 ; do
8273 +    FILES="$FILES $1"
8274 +    shift
8275 +done
8276 +
8277 +DEST=$1
8278 +
8279 +
8280 +DESTDIR="${ROOTDIR}/$DEST"
8281 +
8282 +scp -p $FILES "${HOST}:${DESTDIR}" && \
8283 +ssh $HOST \
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
8289 @@ -0,0 +1,19 @@
8290 +#ifndef SWIGMACRO_H
8291 +#define SWIGMACRO_H
8292 +
8293 +#ifndef SWIG
8294 +# define STINLINE static inline
8295 +# define STINLINE_END
8296 +# define SWIG_immutable %immutable;
8297 +# define SWIG_mutable %mutable;
8298 +
8299 +#else  /* SWIG */
8300 +
8301 +# define STINLINE %inline %{
8302 +# define STINLINE_END %}
8303 +# define SWIG_immutable
8304 +# define SWIG_mutable
8305 +
8306 +#endif /* SWIG */
8307 +
8308 +#endif
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
8312 @@ -0,0 +1,149 @@
8313 +#! /bin/sh
8314 +
8315 +POLDEK_TESTING=1
8316 +export POLDEK_TESTING
8317 +
8318 +while  [ $# -gt 0 ]; do
8319 +    case "$1" in
8320 +       -t )
8321 +           shift; ST=$1; shift ;;
8322 +
8323 +        --distdir )
8324 +           shift; DISTDIR="$1"; shift;;
8325 +
8326 +        --sdir )
8327 +           shift; SRCDIR="$1"; shift;;
8328 +
8329 +        --surl )
8330 +           shift; SRCURL="$1"; shift;;
8331 +
8332 +       --poldek )
8333 +           shift; POLDEK="$1"; shift;;
8334 +
8335 +       --poldekup )
8336 +            shift; POLDEKUP="$1"; shift;;
8337 +    esac
8338 +done
8339 +ST=${ST:-"pdir"}
8340 +
8341 +if [ -z "$DISTDIR" -o -z "$SRCDIR" -o -z "$SRCURL" ]; then
8342 +    echo "usage $(basename $0): -t INDEXTYPE --distdir DISTDIR --sdir $SRCDIR --surl $SRCURL"
8343 +    exit 1;
8344 +fi
8345 +
8346 +TMPDIR=${TMPDIR:-"/tmp"}
8347 +POLDEK=${POLDEK:-"poldek"}
8348 +POLDEKUP=${POLDEKUP:-"poldek"}
8349 +
8350 +echo "$POLDEK, $POLDEKUP"
8351 +
8352 +POLDEK018=
8353 +if $POLDEK --noconf --version | grep -q 0.18; then
8354 +      POLDEK018="1"
8355 +fi
8356 +
8357 +POLDEKUP018=
8358 +if $POLDEKUP --noconf --version | grep -q 0.18; then
8359 +      POLDEKUP018="1"
8360 +fi
8361 +
8362 +
8363 +create_index() 
8364 +{
8365 +  if [ -n "$POLDEK018" ]; then
8366 +      $POLDEK --noconf -s $SRCDIR --mkidxz 
8367 +  else 
8368 +      $POLDEK --noconf -s $SRCDIR --mkidx --mt $ST
8369 +  fi
8370 +}
8371 +
8372 +update_index() 
8373 +{
8374 +  if [ -n "$POLDEKUP018" ]; then
8375 +     $POLDEKUP --noconf -s $SRCURL --up
8376 +  else 
8377 +     $POLDEKUP --noconf --st $ST -s $SRCURL --up -Oautoupa=n
8378 +  fi
8379 +}
8380 +
8381 +
8382 +test_loop() 
8383 +{
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))');
8389 +    done       
8390 +    
8391 +    echo "ADD $toadd, REMOVE $torm";
8392 +
8393 +
8394 +    nremoved=0
8395 +    for i in $SRCDIR/${torm}*.rpm; do
8396 +        bn=$(basename $i);
8397 +
8398 +       if [ ! -f $i ]; then 
8399 +           continue
8400 +       fi
8401 +        rm -f $i
8402 +        nremoved=$(expr $nremoved + 1)
8403 +    done 
8404 +       
8405 +
8406 +    nadded=0
8407 +    for i in $DISTDIR/${toadd}*.rpm; do
8408 +        bn=$(basename $i);
8409 +
8410 +       if [ ! -f $i ]; then 
8411 +           continue
8412 +       fi    
8413 +
8414 +       if [ -f $SRCDIR/$bn ]; then 
8415 +           continue
8416 +       fi    
8417 +       nadded=$(expr $n + 1)
8418 +       #echo "ADD $bn"
8419 +        ln -sf $i $SRCDIR/$bn
8420 +    done
8421 +
8422 +    if [ "$nadded" = "0" -a "$nremoved" = "0" ]; then 
8423 +       return 
8424 +    fi
8425 +
8426 +    echo -e "\n**** MAKE ****\n"
8427 +    echo "Added $nadded and $nremoved removed"
8428 +    create_index
8429 +
8430 +    if [ $? -ne 0 ]; then
8431 +          echo "MKIDX ERRROR"
8432 +          exit 1;
8433 +    fi 
8434 +
8435 +    #up_skip=0
8436 +    if [ ${up_skip} = "0" ]; then
8437 +       echo -e "\n**** UP ****\n"
8438 +    update_index
8439 +
8440 +       if [ $? -ne 0 ]; then
8441 +          echo "ERRROR"
8442 +          exit 1;
8443 +       fi
8444 +    fi 
8445 +}
8446 +
8447 +rm -f $SRCDIR/packages.$ST.*
8448 +rm -f $SRCDIR/packages.i/packages.$ST.*
8449 +create_index || exit 1
8450 +
8451 +if [ -n "$POLDEKUP018" ]; then
8452 +  $POLDEKUP --noconf -s $SRCURL --upa
8453 +else 
8454 +  $POLDEKUP --noconf --st $ST -s $SRCURL --upa -Oautoupa=n
8455 +fi
8456 +
8457 +for n in $(seq 1 22000); do
8458 +    test_loop
8459 +    sleep 1
8460 +done
8461 +
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
8465 @@ -0,0 +1,83 @@
8466 +#!/bin/sh
8467 +# $Id$
8468 +# Script for quick build fake foo-packages
8469 +
8470 +name=
8471 +version=
8472 +release="1"
8473 +requires=
8474 +provides=
8475 +files=
8476 +
8477 +usage_and_exit() {
8478 +    echo "Usage $0 -n NAME -v VERSION-[RELEASE [-p PROVIDES] [-r REQUIRES] [-f file] "
8479 +    exit 1
8480 +}
8481 +
8482 +while test $# -gt 0 ; do
8483 +    case "${1}" in
8484 +        -n)
8485 +            shift; name="${1}"; shift ;;
8486 +
8487 +        -v)
8488 +            shift; version="${1}"; shift ;;
8489 +
8490 +        -p)
8491 +            shift; provides="$provides ${1},"; shift ;;
8492 +
8493 +        -r)
8494 +            shift; requires="$requires ${1},"; shift ;;
8495 +
8496 +        -f)
8497 +            shift; files="$files ${1} "; shift ;;
8498 +
8499 +        *)
8500 +            echo "unknown option ${1}"; exit 1;
8501 +    esac
8502 +done
8503 +
8504 +[ -n "$name" -a -n "$version" ] || usage_and_exit;
8505 +
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;
8510 +fi
8511 +
8512 +SPEC="/tmp/$name.spec"
8513 +> $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
8525 +
8526 +echo -e "%description\n$name" >> $SPEC
8527 +echo -e "%prep\n%pre\n" >> $SPEC
8528 +
8529 +if [ -n "$files" ]; then
8530 +    echo "%install" >> $SPEC
8531 +    for f in $files; do
8532 +        dn=$(dirname $f)
8533 +        echo "mkdir -p \$RPM_BUILD_ROOT/$dn" >> $SPEC
8534 +        echo "touch \$RPM_BUILD_ROOT/$f" >> $SPEC
8535 +    done
8536 +fi
8537 +
8538 +echo -e "%files\n%defattr(644,root,root,755)" >> $SPEC
8539 +if [ -n "$files" ]; then
8540 +    for f in $files; do
8541 +        dn=$(dirname $f)
8542 +        echo "%dir $dn" >> $SPEC
8543 +        echo "$f" >> $SPEC
8544 +    done
8545 +fi
8546 +
8547 +echo -e "%clean\nrm -rf \$RPM_BUILD_ROOT" >> $SPEC
8548 +rpmbuild -bb $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
8552 @@ -0,0 +1,12 @@
8553 +#!/usr/bin/python
8554 +
8555 +import SimpleHTTPServer
8556 +import SocketServer
8557 +
8558 +PORT = 10000
8559 +
8560 +Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
8561 +httpd = SocketServer.TCPServer(("127.0.0.1", PORT), Handler)
8562 +
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
8568 @@ -3,12 +3,37 @@
8569  TESTS = test_poldek
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
8574  
8575  EXTRA_DIST = utest_mkidx.sh
8576  
8577  test_poldek_INCLUDES= @CHECK_CFLAGS@
8578  test_poldek_LDADD = @CHECK_LIBS@ ../libpoldek_allsym.la ../vfile/libvfile.la  
8579  
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
8582 +
8583  clean-local:
8584 -       -rm -f core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa* 
8585 +       -rm -f *.tmp core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa* 
8586 +
8587 +
8588 +runtests: poldek_test_conf.conf
8589 +       $(MAKE) check
8590 +       @echo; echo "Running *.sh tests"; \
8591 +       n=0; nfails=0;                   \
8592 +       for i in utest_*.sh; do          \
8593 +           [ -f $$i ] || continue;      \
8594 +           n=$$(expr $$n + 1);          \
8595 +           echo "  running $$i";        \
8596 +           sh $$i;                      \
8597 +        if [ $$? -ne 0 ]; then       \
8598 +          nfails=$$(expr $$nfails + 1); \
8599 +          echo "    $$i FAILED";     \
8600 +        else                         \
8601 +          echo "    $$i PASSED";     \
8602 +        fi;                          \
8603 +   done;                             \
8604 +   echo "====================================="; \
8605 +   echo "$$n tests passed / $$nfails failed";    \
8606 +   echo "====================================="
8607 +
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
8611 @@ -0,0 +1,40 @@
8612 +# $Revision$, $Date$
8613 +Summary:       foo
8614 +Name:          foo
8615 +Version:       1.0
8616 +Release:    1
8617 +License:       GPL
8618 +Group:         Base
8619 +BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
8620 +Requires:   foo-lib = %{version}
8621 +
8622 +%description
8623 +foo
8624 +
8625 +%package lib
8626 +Summary:       foo lib
8627 +Group:         Base
8628 +
8629 +%description lib
8630 +
8631 +%prep
8632 +
8633 +%pre 
8634 +
8635 +%files
8636 +%defattr(644,root,root,755)
8637 +
8638 +%files lib
8639 +%defattr(644,root,root,755)
8640 +
8641 +%clean
8642 +rm -rf $RPM_BUILD_ROOT
8643 +
8644 +%define date   %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
8645 +%changelog
8646 +* %{date} foo
8647 +
8648 +$Log$
8649 +Revision 1.1  2005/10/26 22:43:24  mis
8650 +- and spec
8651 +
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
8655 @@ -0,0 +1,12 @@
8656 +vfile retries = 1
8657 +
8658 +[source]
8659 +name = repo-pdir
8660 +path = ${PWD}/repo
8661 +type = pdir
8662 +
8663 +[source]
8664 +name = repo-pndir
8665 +path = ${PWD}/repo
8666 +type = pndir
8667 +
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
8671 @@ -0,0 +1,241 @@
8672 +#include "test.h"
8673 +#include "conf_intern.h"
8674 +#include "conf.h"
8675 +#include <trurl/nhash.h>
8676 +
8677 +const char *expand_env_var(const char *v)
8678 +{
8679 +    char tmp[PATH_MAX];
8680 +    const char *s;
8681 +    
8682 +    s = poldek_util_expand_env_vars(tmp, sizeof(tmp), v);
8683 +    fail_if(s == NULL);
8684 +    return n_strdup(s);
8685 +}
8686 +
8687 +
8688 +START_TEST (test_config) {
8689 +    struct poldek_conf_tag *tags = NULL;
8690 +    tn_hash *cnf, *s;
8691 +    int i, j;
8692 +    
8693 +    cnf = poldek_conf_load("poldek_test_conf.conf", 0);
8694 +    fail_if(cnf == NULL, "load config failed");
8695 +
8696 +    s = poldek_conf_get_section_ht(cnf, "global");
8697 +    fail_if(s == NULL, "no global section?");
8698 +    
8699 +    i = 0;
8700 +    while (poldek_conf_sections[i].name) {
8701 +        const char *sname = poldek_conf_sections[i].name;
8702 +        tags = poldek_conf_sections[i++].tags;
8703 +
8704 +        s = poldek_conf_get_section_ht(cnf, sname);
8705 +        fail_if(s == NULL, "no %s section?", s);
8706 +
8707 +        j = 0;
8708 +        while (tags[j].name) {
8709 +            struct poldek_conf_tag *t = &tags[j++];
8710 +            const char *dv, *v;
8711 +
8712 +            if (strchr(t->name, '*')) /* legacy source?* and prefix*? */
8713 +                continue;
8714 +
8715 +            if (t->flags & CONF_TYPE_F_ALIAS)
8716 +                continue;
8717 +
8718 +            v = poldek_conf_get(s, t->name, NULL);
8719 +            fail_if(v == NULL, "%s: %s: missing?", sname, t->name);
8720 +            
8721 +            dv = t->defaultv;
8722 +            
8723 +            if (t->defaultv == NULL) { /* the xsl sets it to op name */
8724 +                char *p;
8725 +                p = n_strdup(t->name);
8726 +                dv = p;
8727 +                while (*p) {
8728 +                    if (*p == ' ') *p = '_';
8729 +                    p++;
8730 +                }
8731 +                DBGF("\n%s: %s %s\n", t->name, dv, v);
8732 +            }
8733 +
8734 +            if (t->flags & CONF_TYPE_BOOLEAN) { /* reverse value, see xsl */
8735 +                if (n_str_eq(dv, "yes"))
8736 +                    dv = "no";
8737 +                else
8738 +                    dv = "yes";
8739 +            }
8740 +            
8741 +            if (t->flags & CONF_TYPE_F_ENV) {
8742 +                fail_ifnot(t->flags & CONF_TYPE_STRING);
8743 +                dv = expand_env_var(dv);
8744 +            }
8745 +            
8746 +            fail_if(n_str_ne(dv, v), "%s: %s: %s != %s",
8747 +                    sname, t->name, v, dv);
8748 +        }
8749 +    }
8750 +}
8751 +END_TEST
8752 +
8753 +
8754 +static char *values_list[] = { "foo", "bar", "baz", NULL };
8755 +
8756 +static char *make_conf_line(const char *opname, int no, int sep) 
8757 +{
8758 +    char line[1024];
8759 +    int i = 0, n = 0;
8760 +        
8761 +    n = n_snprintf(line, sizeof(line), "%s = ", opname);
8762 +    while (values_list[i]) {
8763 +        char buf[64];
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);
8767 +        i++;
8768 +    }
8769 +    line[n - 1] = '\0';         /* remove last sep */
8770 +    return n_strdup(line);
8771 +}
8772 +
8773 +static int verify_list(tn_array *list, int maxno, const char *op) 
8774 +{
8775 +    tn_hash *dict = n_hash_new(64, NULL);
8776 +    int no;
8777 +
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);
8781 +    
8782 +    for (no = maxno - 1; no >= 0; no--) { /* from max to 0, to test
8783 +                                             param overwriting
8784 +                                             (test_config_lists_excl) */
8785 +        int i = 0;
8786 +        while (values_list[i]) {
8787 +            char buf[64];
8788 +            n_snprintf(buf, sizeof(buf), "%s%d", values_list[i], no);
8789 +            n_hash_insert(dict, buf, NULL);
8790 +            i++;
8791 +        }
8792 +    }
8793 +
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);
8797 +    }
8798 +    return 1;
8799 +}
8800 +
8801 +void make_conf_file(const char *name, tn_array *lines) 
8802 +{
8803 +    FILE *f;
8804 +    int i;
8805 +    
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));
8810 +    fclose(f);
8811 +}
8812 +
8813 +
8814 +
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 };
8818 +    tn_hash *cnf, *s;
8819 +    tn_array *lines, *list;
8820 +    int i, maxno = 0;
8821 +    FILE *f;
8822 +    
8823 +    lines = n_array_new(16, 0, 0);
8824 +    
8825 +    i = 0;
8826 +    while (list_ops[i]) {
8827 +        maxno = 0;
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",
8835 +                                               maxno++, ','));
8836 +        maxno_ops[i] = maxno;
8837 +        i++;
8838 +    }
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");
8842 +
8843 +    s = poldek_conf_get_section_ht(cnf, "global");
8844 +    fail_if(s == NULL, "no global section?");
8845 +
8846 +    i = 0;
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]);
8851 +        i++;
8852 +    }
8853 +}
8854 +END_TEST
8855 +
8856 +
8857 +START_TEST (test_config_lists_excl) {
8858 +    char *list_ops[] = { "sources", NULL };
8859 +    tn_hash *cnf, *s;
8860 +    tn_array *lines, *list;
8861 +    int i, maxno = 0;
8862 +
8863 +    lines = n_array_new(16, 0, 0);
8864 +    
8865 +    i = 0;
8866 +    while (list_ops[i]) {
8867 +        maxno = 3;
8868 +        while (maxno >= 0) {
8869 +            n_array_push(lines, make_conf_line(list_ops[i], maxno, ' '));
8870 +            maxno--;
8871 +        }
8872 +        i++;
8873 +    }
8874 +    
8875 +    cnf = poldek_conf_addlines(NULL, "source", lines);
8876 +    fail_if(cnf == NULL, "load config failed");
8877 +
8878 +    s = poldek_conf_get_section_ht(cnf, "source");
8879 +    fail_if(s == NULL, "no source section?");
8880 +
8881 +    i = 0;
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 */
8886 +        i++;
8887 +    }
8888 +}
8889 +END_TEST
8890 +
8891 +struct test_suite test_suite_config = {
8892 +    "config", 
8893 +    {
8894 +        { "raw", test_config },
8895 +        { "lists", test_config_lists },
8896 +        
8897 +//        XXX: excl list not implemented yet
8898 +        { "lists excl", test_config_lists_excl }, 
8899 +        { NULL, NULL }
8900 +    }
8901 +};
8902 +
8903 +    
8904 +        
8905 +    
8906 +        
8907 +    
8908 +        
8909 +    
8910 +        
8911 +    
8912 +        
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
8916 @@ -1,19 +1,68 @@
8917  #include "test.h"
8918  START_TEST (test_env) {
8919      char buf[PATH_MAX], tmp[PATH_MAX];
8920 +    const char *s;
8921  
8922      n_snprintf(buf, sizeof(buf), "${ENV1}${ENV2}");
8923      setenv("ENV1", "pol", 1);
8924      setenv("ENV2", "dek", 1);
8925 +    
8926 +    s = poldek_util_expand_env_vars(tmp, sizeof(tmp), buf);
8927 +    fail_if(s == NULL, "expand_env_vars failed");
8928 +    
8929 +    fail_if(n_str_ne(s, "poldek"),
8930 +            "expand_env_vars() failed: %s -> %s", buf, s);
8931 +
8932 +    fail_if(n_str_ne(tmp, "poldek"),
8933 +            "expand_env_vars() failed: %s -> %s", buf, tmp);
8934 +
8935 +    
8936 +    n_snprintf(buf, sizeof(buf), "foobar");
8937 +    s = poldek_util_expand_env_vars(tmp, sizeof(tmp), buf);
8938 +
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);
8942 +}
8943 +END_TEST
8944 +
8945 +
8946 +
8947 +START_TEST (test_var) {
8948 +    char buf[PATH_MAX], tmp[PATH_MAX];
8949 +    const char *s;
8950 +    tn_hash *vars;
8951 +    
8952 +    n_snprintf(buf, sizeof(buf), "%{1}%{2}");
8953 +
8954 +    vars = n_hash_new(16, NULL);
8955 +    n_hash_insert(vars, "1", "pol");
8956 +    n_hash_insert(vars, "2", "dek");
8957 +    
8958 +    s = poldek_util_expand_vars(tmp, sizeof(tmp), buf, '%', vars);
8959 +    fail_if(s == NULL, "expand_vars failed");
8960 +    
8961 +    fail_if(n_str_ne(s, "poldek"),
8962 +            "expand_vars() failed: %s -> %s", buf, s);
8963 +
8964 +    fail_if(n_str_ne(tmp, "poldek"),
8965 +            "expand_vars() failed: %s -> %s", buf, tmp);
8966  
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);
8970      
8971 +    n_snprintf(buf, sizeof(buf), "foobar");
8972 +    s = poldek_util_expand_vars(tmp, sizeof(tmp), buf, '%', vars);
8973 +
8974 +    fail_if(s == NULL, "expand_vars failed");
8975 +    fail_if(n_str_ne(s, buf),
8976 +                "expand_vars() failed: %s -> %s", buf, s);
8977  }
8978  END_TEST
8979  
8980  
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, 
8985 +};
8986 +
8987 +struct test_case test_case_misc_env1 = {
8988 +    "vars expanding", test_var
8989  };
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
8993 @@ -0,0 +1,37 @@
8994 +#ifndef POLDEK_TEST_H
8995 +#define POLDEK_TEST_H
8996 +#include <stdio.h>
8997 +#include <stdlib.h>
8998 +#include <string.h>
8999 +#include <errno.h>
9000 +#include <sys/param.h>          /* for PATH_MAX */
9001 +#include <sys/types.h>
9002 +#include <sys/stat.h>
9003 +#include <fcntl.h>
9004 +
9005 +#include <trurl/nassert.h>
9006 +#include <trurl/nmalloc.h>
9007 +#include <check.h>
9008 +
9009 +#include "i18n.h"
9010 +#include "log.h"
9011 +#include "pkg.h"
9012 +#include "misc.h"
9013 +#include "capreq.h"
9014 +#include "pm/pm.h"
9015 +#include "pm/rpm/pm_rpm.h"
9016 +#include "pkgmisc.h"
9017 +
9018 +#define fail_ifnot fail_unless
9019 +
9020 +struct test_case {
9021 +    const char *name;
9022 +    void (*test_fn)(void);
9023 +};
9024 +
9025 +struct test_suite {
9026 +    const char *name;
9027 +    struct test_case cases[];
9028 +};
9029 +
9030 +#endif
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
9034 @@ -30,6 +30,8 @@
9035  
9036      fail_unless(is_op(ts, op, !defaultv),
9037                  "%s not propagated to ts", opname);
9038 +    return 1;
9039 +    
9040  }
9041  
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
9046 @@ -1,24 +1,28 @@
9047  /*
9048 -  $Id$
9049 +  $Id$
9050  */
9051  #include <check.h>
9052  #include "test.h"
9053 -//#include "test_env.c"
9054  
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;
9059  
9060  struct test_suite *suites[] = {
9061      &test_suite_match,
9062      &test_suite_pmdb,
9063      &test_suite_op,
9064 +    &test_suite_config,
9065      NULL,
9066  };
9067  
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;
9071 +
9072  struct test_case *misc_cases[] = {
9073 -    &test_case_misc_env,
9074 +    &test_case_misc_env0,
9075 +    &test_case_misc_env1,
9076      NULL,
9077  };
9078  
9079 @@ -66,22 +70,25 @@
9080      if (argc > 1 && n_str_eq(argv[1], "-v"))
9081          poldek_VERBOSE = 1;
9082  
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);
9090          srunner_free(sr);
9091 -        i++;
9092      }
9093 -    
9094 -    if (misc_cases[0]) {
9095 -        Suite *s = make_themisc_suite();
9096 +
9097 +    while (suites[i]) {
9098 +        Suite *s = make_suite(suites[i]);
9099          SRunner *sr = srunner_create(s);
9100 +        printf("\n");
9101          srunner_run_all(sr, CK_NORMAL);
9102          nerr += srunner_ntests_failed(sr);
9103          srunner_free(sr);
9104 +        i++;
9105      }
9106 +    
9107 +    
9108  
9109      return (nerr == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
9110  }
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
9114 @@ -0,0 +1,30 @@
9115 +#!/bin/sh
9116 +# $Id$
9117 +
9118 +FILE=n_array_new.c
9119 +PKG=trurlib
9120
9121 +if [ ! -f $FILE ]; then
9122 +    cd `dirname $0`;
9123 +    if [ ! -f $FILE ]; then
9124 +       echo "`pwd`: not a $PKG directory"
9125 +       exit 1
9126 +    fi         
9127 +fi
9128 +
9129 +runcmd () {
9130 +    echo "$@"
9131 +    $@
9132 +    test $? -eq 0 || exit 1
9133 +}
9134 +
9135 +runcmd libtoolize --force --automake
9136 +runcmd aclocal
9137 +runcmd autoheader
9138 +runcmd automake --add-missing --no-force
9139 +runcmd autoconf
9140 +
9141 +if [ -z "$1" -o "$1" != "--no-configure" ]; then
9142 +       CONFOPTS="--enable-maintainer-mode --enable-compile-warnings $@"
9143 +       runcmd ./configure $CONFOPTS
9144 +fi
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
9148 @@ -0,0 +1,699 @@
9149 +2005-11-06  Pawe³ Gajda  <mis@pld.org.pl>
9150 +
9151 +       * nbuf.c: - be paranoid
9152 +
9153 +       * include/trurl/narray.h:
9154 +       - new n_array_ctl_get_freefn(), to be consitent
9155 +
9156 +2005-10-17  Pawe³ Gajda  <mis@pld.org.pl>
9157 +
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)
9160 +
9161 +       * include/trurl/narray.h: - more comments
9162 +
9163 +2005-06-13  Pawe³ Gajda  <mis@pld.org.pl>
9164 +
9165 +       * include/trurl/nstream.h: - comments
9166 +
9167 +       * configure.in, nmalloc.c:
9168 +       - do not make unalign obstack on sparc, alpha, etc
9169 +
9170 +2005-05-13  Pawe³ Gajda  <mis@pld.org.pl>
9171 +
9172 +       * lib/obstack.c: - missing include
9173 +
9174 +       * libtrurl.sym: - missing symbols
9175 +
9176 +       * libtrurl.sym: - symtab
9177 +
9178 +       * configure.in, lib/.cvsignore, lib/Makefile.am, lib/obstack.c, lib/obstack.h, nmalloc.c, Makefile.am:
9179 +       - be more portable (obstack)
9180 +
9181 +2005-05-12  Pawe³ Gajda  <mis@pld.org.pl>
9182 +
9183 +       * nstream.c:
9184 +       - disabled usage of stdio cookies, too much troubles with them
9185 +
9186 +       * configure.in:
9187 +       - disaled usage of stdio cookies, too much troubles with them
9188 +
9189 +       * ndie.c: - horrible bug
9190 +
9191 +2005-04-21  Pawe³ Gajda  <mis@pld.org.pl>
9192 +
9193 +       * include/trurl/narray.h, n_array_new.c: - new n_array_cfree()
9194 +
9195 +2005-04-16  Pawe³ Gajda  <mis@pld.org.pl>
9196 +
9197 +       * nstream.c:
9198 +       - cookie's gzfseek() fix: set offset to proper value (qboosh at pld-linux org)
9199 +
9200 +       * nbuf.c, test_common.c: - bugfix
9201 +
9202 +2005-04-11  Pawe³ Gajda  <mis@pld.org.pl>
9203 +
9204 +       * configure.in, nstream.c:
9205 +       - tolerate missing gzungetc() (not used in fact)
9206 +
9207 +2004-11-16  Pawe³ Gajda  <mis@pld.org.pl>
9208 +
9209 +       * include/trurl/narray.h, n_array_sorts.c, test_array.c:
9210 +       - +n_array_reverse()
9211 +
9212 +2004-11-03  Pawe³ Gajda  <mis@pld.org.pl>
9213 +
9214 +       * include/trurl/n_obj_ref.h, include/trurl/trurl.h, include/trurl/nbuf.h:
9215 +       - be c++ friendly
9216 +
9217 +2004-10-23  Pawe³ Gajda  <mis@pld.org.pl>
9218 +
9219 +       * Makefile.am, include/trurl/nstr.h, nstr.c, test_nstr.c:
9220 +       - n_str_strip_ws()
9221 +
9222 +2004-10-15  Pawe³ Gajda  <mis@pld.org.pl>
9223 +
9224 +       * include/trurl/nassert.h, nassert.c, ndie.c:
9225 +       - set_hook() schema for both die and assert; die() cosmetics
9226 +
9227 +2004-10-14  Pawe³ Gajda  <mis@pld.org.pl>
9228 +
9229 +       * include/trurl/nstream.h, nstream.c, test_stream.c:
9230 +       - +n_stream_getline()
9231 +
9232 +2004-10-07  Pawe³ Gajda  <mis@pld.org.pl>
9233 +
9234 +       * n_hash_dup.c: - dup()ed hash could not inherit NOCPKEY
9235 +
9236 +2004-10-05  Pawe³ Gajda  <mis@pld.org.pl>
9237 +
9238 +       * include/trurl/narray.h, n_array_new.c: - cleanup
9239 +
9240 +2004-10-04  Pawe³ Gajda  <mis@pld.org.pl>
9241 +
9242 +       * nstr_tokl.c: - do not assume that WHITE is after quoted string
9243 +
9244 +       * nstr_tokl.c: - normal characters are not escapeable
9245 +
9246 +       * include/trurl/nstr.h, nstr_tokl.c: - no default escape char
9247 +
9248 +2004-10-02  Pawe³ Gajda  <mis@pld.org.pl>
9249 +
9250 +       * include/trurl/narray.h, n_array_new.c: - +n_array_ctl_get_cmpfn()
9251 +
9252 +       * configure.in: - missing check
9253 +
9254 +       * n_array_sorts.c: - trace
9255 +
9256 +2004-09-30  Pawe³ Gajda  <mis@pld.org.pl>
9257 +
9258 +       * include/trurl/narray.h: - SWIGing
9259 +
9260 +2004-09-27  Pawe³ Gajda  <mis@pld.org.pl>
9261 +
9262 +       * test_stream.c: - more tests
9263 +
9264 +2004-09-26  Pawe³ Gajda  <mis@pld.org.pl>
9265 +
9266 +       * include/trurl/trurl.h: - missing inc
9267 +
9268 +       * test_array.c: - more tests
9269 +
9270 +2004-09-21  Pawe³ Gajda  <mis@pld.org.pl>
9271 +
9272 +       * include/trurl/nstr.h, nstr_tok.c, nstr_tokl.c: - delim is const char
9273 +
9274 +2004-09-12  Pawe³ Gajda  <mis@pld.org.pl>
9275 +
9276 +       * include/trurl/Attic/nobstack.h, Attic/test_obstack.c, Makefile.am, nmalloc.c:
9277 +       - obsoleted obstack.h
9278 +
9279 +2004-09-01  Pawe³ Gajda  <mis@pld.org.pl>
9280 +
9281 +       * Makefile.am: - 'symlink' is useless
9282 +
9283 +       * include/trurl/narray.h: - missing include
9284 +
9285 +2004-08-06  Pawe³ Gajda  <mis@pld.org.pl>
9286 +
9287 +       * Attic/n_array_dup.c, include/trurl/narray.h, n_array_new.c:
9288 +       - +n_array_ctl_set*fn
9289 +
9290 +       * nmalloc.c: - smaller min. chunks
9291 +
9292 +2004-07-23  Pawe³ Gajda  <mis@pld.org.pl>
9293 +
9294 +       * n_hash_keys.c: - fix
9295 +
9296 +       * include/trurl/nhash.h, n_hash_keys.c: - +n_hash_values()
9297 +
9298 +2004-07-14  Pawe³ Gajda  <mis@pld.org.pl>
9299 +
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
9302 +
9303 +       * nbuf.c, include/trurl/nbuf.h: - n_ref() aware
9304 +
9305 +2004-07-13  Pawe³ Gajda  <mis@pld.org.pl>
9306 +
9307 +       * nmalloc.c: - refcount-able
9308 +
9309 +2004-07-12  Pawe³ Gajda  <mis@pld.org.pl>
9310 +
9311 +       * n_hash_new.c, n_hash_put.c, trurl_internal.h, Attic/hash-string.h, Makefile.am, n_hash_int.h:
9312 +       - cleanups
9313 +
9314 +       * nmalloc.c: - bugfix
9315 +
9316 +2004-07-11  Pawe³ Gajda  <mis@pld.org.pl>
9317 +
9318 +       * .cvsignore, Makefile.am, include/trurl/ntuple.h, n_array_sorts.c, ntuple.c:
9319 +       - +ntuple - python-like, semi-array
9320 +
9321 +       * include/trurl/narray.h: - bugfix
9322 +
9323 +2004-07-09  Pawe³ Gajda  <mis@pld.org.pl>
9324 +
9325 +       * Attic/n_array_free.c, Makefile.am, include/trurl/narray.h, include/trurl/nmalloc.h, n_array_new.c, nmalloc.c:
9326 +       - +tn_alloc
9327 +
9328 +       * n_hash_map.c: - dump()
9329 +
9330 +2004-06-24  Pawe³ Gajda  <mis@pld.org.pl>
9331 +
9332 +       * nbuf.c: - improved restore()
9333 +
9334 +2004-06-23  Pawe³ Gajda  <mis@pld.org.pl>
9335 +
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
9338 +
9339 +2004-06-22  Pawe³ Gajda  <mis@pld.org.pl>
9340 +
9341 +       * Attic/n_hash_exists.c, Makefile.am, include/trurl/nbuf.h, n_hash_int.h, nbuf.c:
9342 +       - improvements
9343 +
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
9346 +
9347 +2004-05-06  Pawe³ Gajda  <mis@pld.org.pl>
9348 +
9349 +       * n_array_dump_stats.c, n_hash_stats.c, nstr_tokl.c:
9350 +       - type fixes, incl. SEGV on 64-bit archs (qboosh)
9351 +
9352 +2004-03-22  Pawe³ Gajda  <mis@pld.org.pl>
9353 +
9354 +       * include/trurl/narray.h, include/trurl/trurl.h, n_array_push.c:
9355 +       - n_array_concat()
9356 +
9357 +2004-02-23  Pawe³ Gajda  <mis@pld.org.pl>
9358 +
9359 +       * include/trurl/narray.h, n_array_nth.c: - SWIG'ed
9360 +
9361 +2004-02-22  Pawe³ Gajda  <mis@pld.org.pl>
9362 +
9363 +       * include/trurl/Attic/nobstack.h, Attic/test_obstack.c, Makefile.am:
9364 +       - glibc's obstack wrapper
9365 +
9366 +2004-02-17  Pawe³ Gajda  <mis@pld.org.pl>
9367 +
9368 +       * Makefile.am: - 'make distcheck' fixes (wiget at pld-linux org)
9369 +
9370 +       * n_array_clone.c, include/trurl/narray.h:
9371 +       - merged _dup() and _clone() funcs
9372 +
9373 +2004-01-05  Pawe³ Gajda  <mis@pld.org.pl>
9374 +
9375 +       * include/trurl/nstr.h, nstr_basenam.c:
9376 +       - + n_dirname() alias for n_basedirnam()
9377 +
9378 +       * nstr_tokl.c: - commented out debug message
9379 +
9380 +       * include/trurl/nbuf.h: - new n_buf_it_read()
9381 +       - bugfixes
9382 +       - n_buf_it_read_*int*() aliases to n_buf_it_get_int*
9383 +
9384 +       * include/trurl/nstr.h: - new n_str_[eq,ne] macros
9385 +
9386 +2003-12-31  Pawe³ Gajda  <mis@pld.org.pl>
9387 +
9388 +       * include/trurl/nbuf.h: - replaced macros with inline funcs
9389 +
9390 +2003-12-30  Pawe³ Gajda  <mis@pld.org.pl>
9391 +
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
9394 +
9395 +       * Makefile.am: - fixed *.h list
9396 +
9397 +       * nstream.c: - bugfix (added gzseek stdio-like wrapper)
9398 +
9399 +2003-04-30  Pawe³ Gajda  <mis@pld.org.pl>
9400 +
9401 +       * include/trurl/nstr.h, nstr_tokl.c: - + n_str_etokl() (line tokenizer)
9402 +
9403 +2003-04-23  Pawe³ Gajda  <mis@pld.org.pl>
9404 +
9405 +       * include/trurl/nstr.h, nstr_tokl.c: + n_str_tokl_n()
9406 +
9407 +2003-04-14  Pawe³ Gajda  <mis@pld.org.pl>
9408 +
9409 +       * include/trurl/nmalloc.h: + n_strdupap()
9410 +
9411 +2003-02-07  Pawe³ Gajda  <mis@pld.org.pl>
9412 +
9413 +       * include/trurl/nbuf.h: - missing inclusion
9414 +
9415 +       * n_hash_put.c: - do not free NULL pointers...
9416 +
9417 +2003-01-18  Pawe³ Gajda  <mis@pld.org.pl>
9418 +
9419 +       * autogen.sh: - added --no-configure option
9420 +
9421 +       * include/trurl/narray.h, n_array_new.c: - +n_array_init()
9422 +
9423 +       * configure.in: - missing zlib
9424 +
9425 +2003-01-14  Pawe³ Gajda  <mis@pld.org.pl>
9426 +
9427 +       * include/trurl/nmalloc.h, nmalloc.c:
9428 +        +n_cfree() (frees and sets to NULL a pointer)
9429 +
9430 +2003-01-06  Pawe³ Gajda  <mis@pld.org.pl>
9431 +
9432 +       * n_hash_dup.c: - bugfix
9433 +
9434 +2002-12-13  Pawe³ Gajda  <mis@pld.org.pl>
9435 +
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:
9437 +       - + n_memdup()
9438 +       - few n_array's improvements
9439 +
9440 +2002-12-12  Pawe³ Gajda  <mis@pld.org.pl>
9441 +
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()
9444 +       - cleanups
9445 +
9446 +2002-12-10  Pawe³ Gajda  <mis@pld.org.pl>
9447 +
9448 +       * include/trurl/nhash.h, Makefile.am, n_hash_dup.c: + n_hash_dup()
9449 +
9450 +2002-12-02  Pawe³ Gajda  <mis@pld.org.pl>
9451 +
9452 +       * include/trurl/nbuf.h: - n_buf_it_get* fixes
9453 +
9454 +       * nbuf.c: - buffer with constant data may be cleaned too
9455 +
9456 +2002-11-13  Pawe³ Gajda  <mis@pld.org.pl>
9457 +
9458 +       * nmalloc.c, nstream.c: - cosmetics
9459 +
9460 +       * include/trurl/nhash.h, n_hash_keys.c: - improved n_hash_keys()
9461 +
9462 +       * include/trurl/nbuf.h, nbuf.c: - n_buf_gets() and co
9463 +
9464 +2002-11-07  Pawe³ Gajda  <mis@pld.org.pl>
9465 +
9466 +       * ndie.c: - missing include
9467 +
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
9471 +
9472 +2002-11-04  Pawe³ Gajda  <mis@pld.org.pl>
9473 +
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
9476 +         is added
9477 +       - tn_stream fixes
9478 +       - moved n2h from poldek
9479 +       - killed gcc's warnings
9480 +
9481 +2002-10-29  Pawe³ Gajda  <mis@pld.org.pl>
9482 +
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
9487 +
9488 +       * Makefile.am: - updated library version info
9489 +
9490 +2002-10-18  Pawe³ Gajda  <mis@pld.org.pl>
9491 +
9492 +       * configure.in:
9493 +       - ,,automake requires 'AM_CONFIG_HEADER', not 'AC_CONFIG_HEADER' ''
9494 +
9495 +2002-10-18  Artur Frysiak  <wiget@pld.org.pl>
9496 +
9497 +       * .cvsignore: more ignores
9498 +
9499 +       * Attic/acconfig.h, configure.in, Makefile.am: - make distcheck passed
9500 +
9501 +2002-10-17  Pawe³ Gajda  <mis@pld.org.pl>
9502 +
9503 +       * Makefile.am, autogen.sh, configure.in:
9504 +       - adaptation to include/trurl headers location
9505 +
9506 +2002-10-16  Pawe³ Gajda  <mis@pld.org.pl>
9507 +
9508 +       * include/trurl/narray.h: - +n_array_has_free_fn()
9509 +
9510 +2002-06-03  Pawe³ Gajda  <mis@pld.org.pl>
9511 +
9512 +       * nbuf.c: - minor bugfix
9513 +
9514 +2002-05-06  Pawe³ Gajda  <mis@pld.org.pl>
9515 +
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!)
9518 +
9519 +       * Attic/trurl_die.c, include/trurl/ndie.h, ndie.c:
9520 +       - make n_die() public
9521 +
9522 +       * include/trurl/nbuf.h, nbuf.c: - new n_buf_*printf()
9523 +
9524 +       * Makefile.am, nmalloc.c, xmalloc.c:
9525 +       - fixed static link: moved xmalloc*()s to separate module
9526 +
9527 +       * Makefile.am: - released as 0.43.7
9528 +
9529 +2002-04-26  Pawe³ Gajda  <mis@pld.org.pl>
9530 +
9531 +       * NEWS, README: - updated && merged with PL versions
9532 +
9533 +       * Attic/CHANGES.PL, Attic/README.PL: - obsoleted
9534 +
9535 +2002-04-25  Pawe³ Gajda  <mis@pld.org.pl>
9536 +
9537 +       * include/trurl/nmalloc.h, nmalloc.c, test_common.c: - nicer fn name
9538 +
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
9541 +
9542 +2002-04-21  Pawe³ Gajda  <mis@pld.org.pl>
9543 +
9544 +       * Makefile.am: - released as 0.43.6
9545 +
9546 +2002-04-05  Pawe³ Gajda  <mis@pld.org.pl>
9547 +
9548 +       * include/trurl/n_snprintf.h: - bugfix
9549 +
9550 +       * include/trurl/trurl.h: - +#include <trurl/n_snprintf.h>
9551 +
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
9556 +
9557 +2002-03-15  Pawe³ Gajda  <mis@pld.org.pl>
9558 +
9559 +       * Makefile.am, NEWS, configure.in: - released as 0.43.5
9560 +
9561 +       * nbuf.c: - be 0.43.3 compatibile and provide n_buf_add symbol too
9562 +
9563 +2002-03-13  Pawe³ Gajda  <mis@pld.org.pl>
9564 +
9565 +       * NEWS: - released as 0.43.4
9566 +
9567 +2002-03-12  Pawe³ Gajda  <mis@pld.org.pl>
9568 +
9569 +       * include/trurl/nstr.h, nstr_concat.c, nstr_len.c:
9570 +       - copy va_list via __va_copy() macro (to be portable to PPC)
9571 +
9572 +2002-02-19  Pawe³ Gajda  <mis@pld.org.pl>
9573 +
9574 +       * .cvsignore, Makefile.am, configure.in, include/trurl/nbuf.h, nbuf.c:
9575 +       - added n_buff_addz(); pre 0.43.4
9576 +
9577 +       * Attic/ndbhash.c, Attic/ndbhash.h, Attic/test_dbhash.c:
9578 +       - removed dead code
9579 +
9580 +2002-02-08  Pawe³ Gajda  <mis@pld.org.pl>
9581 +
9582 +       * test_array.c: - one more test
9583 +
9584 +2002-02-07  Pawe³ Gajda  <mis@pld.org.pl>
9585 +
9586 +       * n_array_remove_ex.c, test_array.c: - bugfix
9587 +
9588 +       * include/trurl/nhash.h, n_hash_new.c: - added n_hash_size
9589 +
9590 +2001-09-06  Pawe³ Gajda  <mis@pld.org.pl>
9591 +
9592 +       * Makefile.am, configure.in, n_array_sorts.c: - fixed AUTOSORTED
9593 +       - simplified sort code
9594 +
9595 +2001-06-09  Pawe³ Gajda  <mis@pld.org.pl>
9596 +
9597 +       * configure.in, NEWS: - 0.43.2
9598 +
9599 +       * n_array_clone.c: - fixed buggy func
9600 +
9601 +       * include/trurl/narray.h, nbuf.c: - bugfix
9602 +
9603 +2001-04-24  Tomasz K³oczko  <kloczek@pld.org.pl>
9604 +
9605 +       * Makefile.am: - removed VERSION from EXTRA_DIST.
9606 +
9607 +       * Attic/VERSION, configure.in: - changed version to 0.43.1,
9608 +       - removed usinf VERSION file.
9609 +
9610 +2001-04-23  Rafa³ Kleger-Rudomin  <klakier@pld.org.pl>
9611 +
9612 +       * configure.in: - AC_PROG_LIBTOOL -> AM_PROG_LIBTOOL
9613 +
9614 +2001-02-10  Pawe³ Gajda  <mis@pld.org.pl>
9615 +
9616 +       * Makefile.am, include/trurl/narray.h, n_array_clone.c: - new function
9617 +
9618 +2001-02-08  Pawe³ Gajda  <mis@pld.org.pl>
9619 +
9620 +       * Attic/ChangeLog: - don't like ChangeLog from whole installer
9621 +
9622 +       * Makefile.am, configure.in: - cosmetics (up to new automake)
9623 +
9624 +       * n_array_map.c, n_array_map_arg.c, n_array_remove_nth.c: - bugfix
9625 +
9626 +       * include/trurl/narray.h, n_array_remove_ex.c: - new function
9627 +
9628 +2001-02-02  Nobody  <nobody@pld.org.pl>
9629 +
9630 +       * Attic/ChangeLog: - ChangeLog update by changelog.sh
9631 +         (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9632 +
9633 +2000-11-28  Nobody  <nobody@pld.org.pl>
9634 +
9635 +       * Attic/ChangeLog: - ChangeLog update by changelog.sh
9636 +         (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9637 +
9638 +2000-11-24  Nobody  <nobody@pld.org.pl>
9639 +
9640 +       * Attic/ChangeLog: - ChangeLog update by changelog.sh
9641 +         (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9642 +
9643 +2000-11-24  Pawe³ Gajda  <mis@pld.org.pl>
9644 +
9645 +       * Attic/VERSION: - marked as 0.431
9646 +
9647 +       * .cvsignore, Makefile.am: - added spec to EXTRA_DIST
9648 +
9649 +2000-11-12  Nobody  <nobody@pld.org.pl>
9650 +
9651 +       * Attic/ChangeLog: - ChangeLog update by changelog.sh
9652 +         (by Arkadiusz Miskiewicz <misiek@pld.org.pl>)
9653 +
9654 +2000-11-10  Pawe³ Gajda  <mis@pld.org.pl>
9655 +
9656 +       * Attic/mkmake.sh, autogen.sh: - be more traditional
9657 +
9658 +2000-11-09  Pawe³ Gajda  <mis@pld.org.pl>
9659 +
9660 +       * Makefile.am, Makefile.extra: - make trurl -> . symlink
9661 +       - am's *CLEAN variables are used instead of removals in mclean goal
9662 +
9663 +2000-11-08  Pawe³ Gajda  <mis@pld.org.pl>
9664 +
9665 +       * nbuf.c: - fixed some bugs
9666 +
9667 +2000-10-31  Pawe³ Gajda  <mis@pld.org.pl>
9668 +
9669 +       * configure.in: - check for db*.h headers instead of library
9670 +
9671 +       * Makefile.am: - use libtool version-info
9672 +
9673 +2000-10-29  Pawe³ Gajda  <mis@pld.org.pl>
9674 +
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
9677 +
9678 +2000-10-25  Pawe³ Gajda  <mis@pld.org.pl>
9679 +
9680 +       * xmalloc.c: - allow NULL as xrealloc() arg
9681 +
9682 +2000-10-17  Pawe³ Gajda  <mis@pld.org.pl>
9683 +
9684 +       * include/trurl/nbuf.h, nbuf.c: - nbuf redesign
9685 +
9686 +2000-10-01  Tomasz K³oczko  <kloczek@pld.org.pl>
9687 +
9688 +       * configure.in: - generated by autoscan.
9689 +
9690 +2000-09-20  Pawe³ Gajda  <mis@pld.org.pl>
9691 +
9692 +       * Attic/Makefile, include/trurl/nstr.h, nstr_basenam.c:
9693 +       - basename() functions added
9694 +
9695 +       * Attic/trurlib.spec:
9696 +       - %{tmpdir} -> /tmp, distribution spec shouldn't be PLD dependent
9697 +
9698 +       * Attic/Makefile, Attic/VERSION, Attic/trurlib.spec:
9699 +       - current working version is v0.42
9700 +
9701 +       * Attic/Makefile: - bugfix
9702 +
9703 +       * include/trurl/nstr.h, nstr_cpy.c: - n_strncpy() added
9704 +
9705 +2000-09-07  Pawe³ Gajda  <mis@pld.org.pl>
9706 +
9707 +       * nstr_tok.c: - bugfix
9708 +
9709 +       * Attic/Makefile: - misarch goal added
9710 +
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
9714 +
9715 +       * Attic/narray.c, include/trurl/narray.h, test_array.c:
9716 +       - removed growth control (nobody needs it)
9717 +       - autosort option added
9718 +       - cosmetics
9719 +
9720 +2000-08-07  Pawe³ Gajda  <mis@pld.org.pl>
9721 +
9722 +       * include/trurl/tfn_types.h: - typedefs tn_fn_map{1,2,3} added
9723 +
9724 +2000-08-03  Pawe³ Gajda  <mis@pld.org.pl>
9725 +
9726 +       * include/trurl/nhash.h, Attic/Makefile, Attic/nhash.c:
9727 +       - added n_hash_clean()
9728 +
9729 +2000-08-02  Pawe³ Gajda  <mis@pld.org.pl>
9730 +
9731 +       * nstr_tokl.c: - yet another bug is killed
9732 +
9733 +       * nstr_tokl.c: - another horrible bug is fixed
9734 +
9735 +2000-07-28  Pawe³ Gajda  <mis@pld.org.pl>
9736 +
9737 +       * nbuf.c: - fixed horrible bug
9738 +
9739 +2000-07-27  Pawe³ Gajda  <mis@pld.org.pl>
9740 +
9741 +       * Attic/nhash.c: - do not remalloc buckets during rehashing
9742 +
9743 +       * Attic/Makefile, Attic/nhash.c: - bugfix: n_hash_ctl.o is compiled now
9744 +
9745 +2000-07-20  Pawe³ Gajda  <mis@pld.org.pl>
9746 +
9747 +       * Attic/VERSION, Attic/trurlib.spec: - version 0.41
9748 +
9749 +       * Attic/Makefile:
9750 +       - added fid-arch goal, which creates subset of library for fix-info-dir
9751 +
9752 +       * include/trurl/trurl.h: - nbuf header added
9753 +
9754 +       * include/trurl/nbuf.h, nbuf.c: - initial version
9755 +
9756 +       * Attic/narray.c, include/trurl/narray.h:
9757 +       - added n_array_bsearch_idx() (returns index of finded item)
9758 +
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
9762 +
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:
9764 +       - cosmetics
9765 +
9766 +2000-07-15  Pawe³ Gajda  <mis@pld.org.pl>
9767 +
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
9770 +
9771 +2000-06-09  Pawe³ Gajda  <mis@pld.org.pl>
9772 +
9773 +       * Attic/Makefile, Attic/trurlib.spec: - spec
9774 +
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
9777 +
9778 +2000-05-22  Pawe³ Gajda  <mis@pld.org.pl>
9779 +
9780 +       * Attic/nlist.c, include/trurl/nlist.h, test_list.c:
9781 +       - fixed list iterator
9782 +
9783 +       * Attic/nlist.c: - bugfix
9784 +
9785 +2000-05-19  Pawe³ Gajda  <mis@pld.org.pl>
9786 +
9787 +       * .cvsignore: *** empty log message ***
9788 +
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)
9794 +
9795 +2000-05-04  Pawe³ Gajda  <mis@pld.org.pl>
9796 +
9797 +       * Attic/xmalloc.h: - undef glibc's strdup macro
9798 +
9799 +       * Attic/VERSION: *** empty log message ***
9800 +
9801 +       * include/trurl/narray.h: - comment
9802 +
9803 +       * Attic/Makefile: - allow override CFLAGS
9804 +       - allow compilation without ndbhash
9805 +
9806 +2000-03-25  Pawe³ Gajda  <mis@pld.org.pl>
9807 +
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()
9812 +
9813 +2000-03-20  Pawe³ Gajda  <mis@pld.org.pl>
9814 +
9815 +       * Attic/Makefile, Attic/xmalloc.h: - works with rpmlib.h
9816 +       - install: target
9817 +
9818 +2000-03-17  Pawe³ Gajda  <mis@pld.org.pl>
9819 +
9820 +       * Attic/nlist.c: - fix bug in n_list_remove_ex()
9821 +
9822 +2000-01-18  Pawe³ Ko³odziej  <pawelk@pld.org.pl>
9823 +
9824 +       * Attic/narray.c: Bug in qsort? Uses isort
9825 +
9826 +1999-11-06  Artur Frysiak  <wiget@pld.org.pl>
9827 +
9828 +       * .cvsignore, Makefile.am: New file.
9829 +
9830 +1999-10-17  Pawe³ Gajda  <mis@pld.org.pl>
9831 +
9832 +       * Attic/Makefile, Attic/README.PL, Attic/ndbhash.c, Attic/xmalloc.h:
9833 +       Detekcja wersji glibc na podstawie __GLIBC_MINOR__
9834 +
9835 +1999-09-17  Jarek Wo³oszyn  <yossa@pld.org.pl>
9836 +
9837 +       * Attic/Makefile: gentocf - moje ostatnie zmiany
9838 +       main - przenioslem win.* i scrmsgs.* do newt-addon
9839 +       trurlib - glibc 2.1
9840 +
9841 +1999-07-22  Artur Frysiak  <wiget@pld.org.pl>
9842 +
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:
9844 +       New file.
9845 +
9846 +       * TODO.PL, nstring.h: pozbierane z diony
9847 +
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
9851 @@ -1,7 +1,7 @@
9852  /* 
9853    TRURLib
9854    Dynamic array of void*
9855 -  $Id$
9856 +  $Id$
9857  */
9858  
9859  #ifndef TRURL_ARRAY_H
9860 @@ -57,9 +57,11 @@
9861  }
9862  #endif
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 /* -"- */
9866  
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);
9869 +
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);
9872  
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
9876 @@ -0,0 +1,9 @@
9877 +#! /bin/sh
9878 +CPDIR=/z
9879 +make -f Makefile.extra mclean
9880 +
9881 +if [ -w $CPDIR ]; then
9882 +    make -f Makefile.extra backup cparch=1 backupdir=$CPDIR
9883 +else 
9884 +    make -f Makefile.extra backup
9885 +fi
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
9889 @@ -20,7 +20,7 @@
9890   */
9891  
9892  /*
9893 -   $Id$
9894 +   $Id$
9895   */
9896  
9897  #include <stdlib.h>
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
9901 @@ -0,0 +1,234 @@
9902 +/*
9903 +   Not finished 
9904 + */
9905 +#include <stdarg.h>
9906 +#include <stdlib.h>
9907 +#include <string.h>
9908 +
9909 +#ifdef USE_N_ASSERT
9910 +#include "nassert.h"
9911 +#else
9912 +#include <assert.h>
9913 +#define n_assert(expr) assert(expr)
9914 +#endif
9915 +
9916 +#include "nstring.h"
9917 +
9918 +static char *vconcat(const char *s, va_list * ap);
9919 +static char *concat(const char *s,...);
9920 +
9921 +struct trurl_string {
9922 +    int16_t   _refcnt;
9923 +    int16_t   len;
9924 +    char      s[0];
9925 +};
9926 +
9927 +
9928 +tn_string n_string_construct(char *s)
9929 +{
9930 +    int len;
9931 +    tn_string str;
9932 +
9933 +    len = strlen(s);
9934 +    if (len > 0) {
9935 +       str.s = n_strdup(s);
9936 +       str.len = len;
9937 +       str.size = len + 1;
9938 +    }
9939 +    return str;
9940 +}
9941 +
9942 +
9943 +static tn_string *n_string_generic_new(char *s)
9944 +{
9945 +    int len;
9946 +    tn_string *str;
9947 +
9948 +    if ((str = n_malloc(sizeof(*str))) == NULL)
9949 +       return NULL;
9950 +
9951 +    len = strlen(s);
9952 +    if (len > 0) {
9953 +       str->s = s;
9954 +       str->len = len;
9955 +       str->size = len + 1;
9956 +    } else {
9957 +       str->s = NULL;
9958 +       str->len = 0;
9959 +       str->size = 0;
9960 +
9961 +    }
9962 +
9963 +    return str;
9964 +}
9965 +
9966 +
9967 +tn_string *n_string_new(char *s)
9968 +{
9969 +    return n_string_generic_new(n_strdup(s));
9970 +}
9971 +
9972 +
9973 +tn_string *n_string_vnew(const char *s,...)
9974 +{
9975 +    register char *t;
9976 +    va_list ap;
9977 +
9978 +    va_start(ap, s);
9979 +    t = vconcat(s, ap);
9980 +    va_end(ap);
9981 +
9982 +    return n_string_generic_new(t);
9983 +}
9984 +
9985 +
9986 +/* str = '' */
9987 +tn_string *n_string_clean(tn_string * str)
9988 +{
9989 +    if (str->s != NULL)
9990 +       free(str->s);
9991 +    str->size = str->len = 0;
9992 +
9993 +    return str;
9994 +}
9995 +
9996 +
9997 +void n_string_free(tn_string * str)
9998 +{
9999 +    n_string_clean(str);
10000 +    free(str);
10001 +}
10002 +
10003 +
10004 +static tn_string *n_string_grow(tn_string * str, size_t size)
10005 +{
10006 +
10007 +    if (str->len + size >= str->size) {
10008 +       char *s;
10009 +       if ((s = n_realloc(str->s, str->size + size)) == NULL)
10010 +           return NULL;
10011 +
10012 +       str->s = s;
10013 +       str->size += size;
10014 +    }
10015 +    return str;
10016 +}
10017 +
10018 +
10019 +const char *n_string_ptr(const tn_string * str)
10020 +{
10021 +    return str->s;
10022 +}
10023 +
10024 +
10025 +tn_string *n_string_dup(const tn_string * str)
10026 +{
10027 +    return n_string_new(str->s);
10028 +}
10029 +
10030 +
10031 +/* s += "aaaaa" + "bbbbbbb" + "ccccccc"  */
10032 +tn_string *n_string_append_ptr(tn_string * str, const char *src)
10033 +{
10034 +    register int len;
10035 +    register char *p;
10036 +
10037 +    if (str->s == src) {       /* self */
10038 +       len = str->len;
10039 +       strcpy(p, src);
10040 +
10041 +    } else {
10042 +       len = strlen(src);
10043 +       p = (char *) src;
10044 +    }
10045 +
10046 +    n_string_grow(str, len);
10047 +    strncpy(str->s + str->len, p, len);
10048 +    str->len += len;
10049 +
10050 +    return str;
10051 +}
10052 +
10053 +/* s += s2 */
10054 +tn_string *n_string_append(tn_string * str, const tn_string * src)
10055 +{
10056 +    return n_string_append_ptr(str, n_string_ptr(src));
10057 +}
10058 +
10059 +/* s = "a" + s */
10060 +tn_string *n_string_prepend_ptr(tn_string * str, const char *src)
10061 +{
10062 +    int len;
10063 +
10064 +    len = strlen(src);
10065 +    n_string_grow(str, len);
10066 +
10067 +    memmove(str->s + str->len, src, len);
10068 +    str->len += len;
10069 +    return str;
10070 +}
10071 +
10072 +
10073 +/* s = s1 + s2 */
10074 +tn_string *n_string_add(const tn_string * str1, const tn_string * str2)
10075 +{
10076 +    char *s;
10077 +    s = concat(n_string_ptr(str1), n_string_ptr(str2), NULL);
10078 +
10079 +    return n_string_generic_new(s);
10080 +}
10081 +
10082 +
10083 +int n_string_cmp(const tn_string * str1, const tn_string * str2)
10084 +{
10085 +    return strcmp(str1->s, str2->s);
10086 +}
10087 +
10088 +int n_string_eq(const tn_string * str1, const tn_string * str2)
10089 +{
10090 +    return strcmp(str1->s, str2->s) == 0;
10091 +}
10092 +
10093 +
10094 +
10095 +
10096 +static char *concat(const char *s,...)
10097 +{
10098 +    char *t;
10099 +    va_list ap;
10100 +
10101 +    va_start(ap, s);
10102 +    t = vconcat(s, ap);
10103 +    va_end(ap);
10104 +
10105 +    return t;
10106 +}
10107 +
10108 +
10109 +static char *vconcat(const char *s, va_list * ap)
10110 +{
10111 +    int len;
10112 +    char *p, *rstr;
10113 +    va_list *tmp_ap;
10114 +
10115 +    len = strlen(s);
10116 +
10117 +    tmp_ap = ap;
10118 +
10119 +    while ((p = va_arg(ap, char *)) != NULL) { /* calculate length of args */
10120 +       len += strlen(p);
10121 +    }
10122 +
10123 +    if ((rstr = n_malloc(len + 1)) == NULL)
10124 +       return NULL;
10125 +
10126 +    strcpy(rstr, s);
10127 +
10128 +    ap = tmp_ap;
10129 +
10130 +    while ((p = va_arg(ap, char *)) != NULL) {
10131 +       strcat(rstr, p);
10132 +    }
10133 +
10134 +    return rstr;
10135 +}
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
10139 @@ -0,0 +1,42 @@
10140 +/* 
10141 +  TRURLib
10142 +
10143 +  $Id$
10144 +*/
10145 +#ifndef __TN_STRING_H
10146 +#define __TN_STRING_H
10147 +
10148 +typedef struct string tn_string;
10149 +
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);
10154 +
10155 +/* str = '' */
10156 +tn_string *n_string_clean(tn_string *str);
10157 +const char *n_string_ptr(const tn_string *str);
10158 +
10159 +/* s = new String(s2) */
10160 +tn_string *n_string_dup(const tn_string *str);
10161 +
10162 +/* s += "aaaaa" */
10163 +tn_string *n_string_append_ptr(tn_string *str, const char *src);
10164 +
10165 +/* s = "a" + s */
10166 +tn_string *n_string_prepend_ptr(tn_string *str, const char *src);
10167 +
10168 +
10169 +/* s += s2 */
10170 +tn_string *n_string_append(tn_string *str, const tn_string *src);
10171 +
10172 +
10173 +/* s = s1 + s2 */
10174 +tn_string *n_string_add(const tn_string *str1, const tn_string *str2);
10175 +
10176 +
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);
10179 +
10180 +
10181 +#endif
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
10185 @@ -0,0 +1,7 @@
10186 +* nlist 
10187 +   - obs³uga listy posortowanej
10188 +   - lista 2-kierunkowa, jako opcja 
10189 +
10190 +* nstring 
10191 +   - dokoñczenie (odpowiedniki str* z libc)  
10192 +
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
10196 @@ -1,5 +1,5 @@
10197  /*
10198 -  Copyright (C) 2000 - 2005 Pawel A. Gajda <mis@k2.net.pl>
10199 +  Copyright (C) 2000 - 2006 Pawel A. Gajda <mis@k2.net.pl>
10200  
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
10203 @@ -11,7 +11,7 @@
10204  */
10205  
10206  /*
10207 -  $Id$
10208 +  $Id$
10209  */
10210  
10211  #include <errno.h>
10212 @@ -227,6 +227,7 @@
10213      MEMINF("START");
10214      DBGF("%s\n", pkg_id(pkg));
10215  
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);
10219          
10220 @@ -235,7 +236,7 @@
10221  
10222          DBGF("req %s\n", capreq_snprintf_s(req));
10223  
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));
10228  
10229 @@ -243,7 +244,7 @@
10230                                     uctx->uninst_set->dbpkgs)) {
10231  
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));
10235              
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 @@
10239  
10240  static
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)
10245  {
10246      tn_array *dbpkgs;
10247      int i, nmatches = 0;
10248  
10249 -    
10250 +    n_assert(cr);
10251      DBGF("get_provides %s\n", capreq_snprintf_s(cr));
10252      dbpkgs = pkgdb_get_provides_dbpkgs(ts->db, cr, NULL, uninst_LDFLAGS);
10253  
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))
10258 -                            matched = 1;
10259 +                    matched = 1;
10260 +                
10261              } else {
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))
10266                      matched = 1;
10267              }
10268 +            
10269 +            if (matched && arch) {
10270 +                const char *dbarch = pkg_arch(dbpkg);
10271 +                matched = n_str_eq(arch, dbarch ? dbarch : "none");
10272 +            }
10273 +            
10274          }
10275  
10276          if (matched) {
10277 @@ -457,15 +466,20 @@
10278      return nmatches;
10279  }
10280  
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)
10284  {
10285      char           *p;
10286      struct capreq  *cr, *cr_evr;
10287      int            resolved = 0;
10288      
10289      cr = NULL; cr_evr = NULL;
10290 -    
10291 -    if ((p = strchr(mask, '#')) == NULL) {
10292 +
10293 +    DBGF("mask=%s\n", mask); 
10294 +    /* No EVR mask or empty EVR (last char '#') */
10295 +    if ((p = strchr(mask, '#')) == NULL || *(p + 1) == '\0') {
10296 +        if (p)
10297 +            *p = '\0';
10298          capreq_new_name_a(mask, cr);
10299              
10300      } else {
10301 @@ -479,11 +493,13 @@
10302          *p = '\0';
10303          p++;
10304  
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)); 
10309 +        }
10310      }
10311      
10312 -    if (do_resolve_package(uctx, ts, mask, cr))
10313 +    if (do_resolve_package(uctx, ts, mask, cr, arch))
10314          resolved = 1;
10315  
10316      if (cr_evr)
10317 @@ -492,6 +508,58 @@
10318      return resolved;
10319  }
10320  
10321 +static int resolve_mask(struct uninstall_ctx *uctx, struct poldek_ts *ts,
10322 +                        const char *mask)
10323 +{
10324 +    char *p, *tmp;
10325 +    const char *n, *v, *r;
10326 +    char nmask[256];
10327 +    int32_t e = 0;
10328 +    int matched = 0;
10329 +    
10330 +    msgn(2, "Trying %s\n", mask);
10331 +    if (resolve_package(uctx, ts, mask, NULL))
10332 +        return 1;
10333 +            
10334 +    if ((p = strchr(mask, '-')) == NULL) /* try N-[E:]V */
10335 +        return 0;
10336 +
10337 +    /* try N-[E:]V-R */
10338 +    n_strdupap(mask, &tmp);
10339 +    p = strrchr(tmp, '-');
10340 +    *p = '#';
10341 +        
10342 +    msgn(2, "  Trying %s\n", tmp);
10343 +                
10344 +    if (resolve_package(uctx, ts, tmp, NULL))
10345 +        return 1;
10346 +    
10347 +    n_strdupap(mask, &tmp);
10348 +    if (poldek_util_parse_nevr(tmp, &n, &e, &v, &r)) {
10349 +        if (e)
10350 +            n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10351 +        else
10352 +            n_snprintf(nmask, sizeof(nmask), "%s#%s-%s", n, v, r);
10353 +
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);
10357 +        
10358 +        if (!matched && (p = strchr(r, '.'))) { /* try N-[E:]-V-R.ARCH */
10359 +            *p = '\0';
10360 +            p++;
10361 +            
10362 +            if (e)
10363 +                n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10364 +            else
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);
10368 +        }
10369 +    }
10370 +
10371 +    return matched;
10372 +}
10373  
10374  static int resolve_packages(struct uninstall_ctx *uctx, struct poldek_ts *ts)
10375  {
10376 @@ -501,52 +569,11 @@
10377      masks = poldek_ts_get_args_asmasks(ts, 1);
10378      
10379      for (i=0; i < n_array_size(masks); i++) {
10380 -        char            *mask = n_array_nth(masks, i);
10381 -        int             matched = 0;
10382 -
10383 -        msgn(2, "Trying %s\n", mask);
10384 -        if (resolve_package(uctx, ts, mask)) {
10385 -            matched = 1;
10386 -            
10387 -        } else {
10388 -            char *p;
10389 -            
10390 -            if ((p = strchr(mask, '-'))) { /* try N-[E:]V */
10391 -                char *tmp;
10392 -                n_strdupap(mask, &tmp);
10393 -                
10394 -                p = strrchr(tmp, '-');
10395 -                *p = '#';
10396 -
10397 -                msgn(2, "  Trying %s\n", tmp);
10398 -                
10399 -                if (resolve_package(uctx, ts, tmp)) {
10400 -                    matched = 1;
10401 -                    
10402 -                } else {        /* try N-[E:]V-R */
10403 -                    const char *n, *v, *r;
10404 -                    char nmask[256];
10405 -                    int32_t e = 0;
10406 +        char *mask = n_array_nth(masks, i);
10407  
10408 -                    n_strdupap(mask, &tmp);
10409 -                    
10410 -                    if (poldek_util_parse_nevr(tmp, &n, &e, &v, &r)) {
10411 -                        if (e)
10412 -                            n_snprintf(nmask, sizeof(nmask), "%s#%d:%s-%s", n, e, v, r);
10413 -                        else
10414 -                            n_snprintf(nmask, sizeof(nmask), "%s#%s-%s", n, v, r);
10415 -
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);
10419 -                    }
10420 -                }
10421 -            }
10422 -            
10423 -            if (!matched) {
10424 -                logn(LOGERR, _("%s: no such package"), mask);
10425 -                nerr++;
10426 -            }
10427 +        if (!resolve_mask(uctx, ts, mask)) {
10428 +            logn(LOGERR, _("%s: no such package"), mask);
10429 +            nerr++;
10430          }
10431      }
10432      
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
10436 @@ -1,5 +1,8 @@
10437  #! /bin/sh
10438 -# $Id$
10439 +# $Id$
10440 +# 
10441 +# File (de)compression helper script. Used by vfile library when external 
10442 +# (de)compression requested ("vfile external compress" config option).
10443  
10444  PATH="/bin:/sbin:/usr/bin:/usr/sbin"
10445  
10446 @@ -19,7 +22,7 @@
10447      typeset src=$1
10448      typeset dest=$2
10449  
10450 -    md5file="${src}-vfcompr.md5"
10451 +    md5file="${dest}-vfcompr.md5"
10452      #echo "$md5file"
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
10458 @@ -10,7 +10,7 @@
10459    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10460  */
10461  
10462 -/* $Id$ */
10463 +/* $Id$ */
10464  
10465  #include <ctype.h>
10466  #include <errno.h>
10467 @@ -195,7 +195,7 @@
10468      if (uncompr == NULL)
10469          return -1;
10470  
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);
10475  }
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
10479 @@ -10,7 +10,7 @@
10480    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
10481  */
10482  
10483 -/* $Id$ */
10484 +/* $Id$ */
10485  
10486  #include <ctype.h>
10487  #include <errno.h>
10488 @@ -440,16 +440,12 @@
10489          }
10490          vf_loginfo(_("Running %s\n"), s);
10491      }
10492 -    
10493 -    
10494 -
10495  
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;
10501 -        
10502      }
10503  
10504      p_st_init(&pst);
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
10508 @@ -0,0 +1,7 @@
10509 +#!/bin/sh 
10510 +
10511 +echo "$0: ARGS: $@"
10512 +while read LINE; do
10513 +       echo "grep.sh: $LINE"
10514 +done
10515 +echo "foo: exit!"
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
10519 @@ -1,14 +1,9 @@
10520 -# $Id$
10521 +# $Id$
10522  
10523 -VFCURL_SRCS = vfcurl.c                 # obsoleted
10524  SUBDIRS   = vfff
10525  
10526  LIBS = -ltrurl -lz @INTLLIBS@
10527  
10528 -#if ENABLE_VFILE_CURL
10529 -#VFCURL_SRCS_ = $(VFCURL_SRCS)
10530 -#endif
10531 -
10532  INCLUDES = @TRURL_INCLUDE@ -I$(top_srcdir)
10533  AM_CFLAGS = @AM_CFLAGS@
10534  
10535 @@ -18,8 +13,7 @@
10536  
10537  libvfile_la_SOURCES = vfile.c fetch.c vfetch.c vfprogress.c misc.c \
10538                                       p_open.c extcompr.c vfreq.c vfreq.h \
10539 -                                         vflock.c \
10540 -                                     vfffmod.c $(VFCURL_SRCS_) \
10541 +                                         vflock.c vfffmod.c \
10542                                           vopen3.c vopen3.h vfile_intern.h
10543  
10544  libvfile_la_LIBADD = vfff/libvfff.la
10545 @@ -27,7 +21,7 @@
10546  pkgincludedir = $(includedir)/vfile
10547  pkginclude_HEADERS = vfile.h p_open.h vopen3.h
10548  
10549 -noinst_PROGRAMS = vfget test_vopen3 test_vfile
10550 +noinst_PROGRAMS = vfget test_vopen3 
10551  TEST_LDADDS    = libvfile.la -lutil
10552  
10553  vfget_SOURCES  = vfget.c 
10554 @@ -35,13 +29,8 @@
10555  
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)
10560 -
10561 -EXTRA_DIST     = libvfile.sym $(VFCURL_SRCS) \
10562 -                                testcookie.c test_progress.c test_vfile.c
10563 -
10564  
10565 +EXTRA_DIST     = libvfile.sym testcookie.c test_progress.c
10566  
10567  dist-hook:
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
10572 @@ -11,7 +11,7 @@
10573  */
10574  
10575  /*
10576 -  $Id$
10577 +  $Id$
10578  */
10579  #ifdef HAVE_CONFIG_H
10580  # include "config.h"
10581 @@ -58,7 +58,7 @@
10582      
10583      p = path;
10584      p++;
10585 -    ndots = 0;
10586 +    ndots = -1;
10587      
10588      while (*p) {
10589          switch (*p) {
10590 @@ -71,11 +71,12 @@
10591                  break;
10592  
10593              case '.':
10594 -                ndots++;
10595 +                if (ndots >= 0)
10596 +                    ndots++;
10597                  break;
10598  
10599              default:
10600 -                ndots = 0;
10601 +                ndots = -1;
10602                  
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
10608 @@ -0,0 +1,72 @@
10609 +#include <stdio.h>
10610 +#include <stdlib.h>
10611 +
10612 +#include <stdio.h>
10613 +#include <stdlib.h>
10614 +#include <errno.h>
10615 +#include <signal.h>
10616 +#include "i18n.h"
10617 +#include "vfile.h"
10618 +
10619 +void dump_file(const char *url)
10620 +{
10621 +    struct vfile *vf;
10622 +    char buf[1024];
10623 +    
10624 +    vf = vfile_open(url, VFT_STDIO, VFM_RO | VFM_NORM);
10625 +    if (vf == NULL)
10626 +        return;
10627 +
10628 +    while (fgets(buf, sizeof(buf), vf->vf_stream)) 
10629 +        printf("%s", buf);
10630 +
10631 +    vfile_close(vf);
10632 +}
10633 +
10634 +void fetch_ext(const char *url)
10635 +{
10636 +    tn_array *protocols;
10637 +
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");
10644 +        return;
10645 +    }
10646 +
10647 +    if (vf_fetch("/tmp", url))
10648 +        puts("OK\n");
10649 +    else
10650 +        puts("FAIL\n");
10651 +}
10652 +
10653 +void fetch(const char *url)
10654 +{
10655 +    if (vf_fetch("/tmp", url))
10656 +        puts("OK\n");
10657 +    else
10658 +        puts("FAIL\n");
10659 +}
10660 +
10661 +                         
10662 +
10663 +int main(int argc, char *argv[])
10664 +{
10665 +    int verbose = 10;
10666 +    
10667 +    vfile_verbose = &verbose;
10668 +    vfile_configure(VFILE_CONF_CACHEDIR, "/tmp");
10669 +    
10670 +    while (1) {
10671 +        printf("verbose = %d\n", *vfile_verbose);
10672 +        fetch("ftp://localhost/bigg");
10673 +        unlink("/tmp/bigg");
10674 +    }
10675 +    
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");
10679 +    return 0;
10680 +}
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
10684 @@ -0,0 +1,61 @@
10685 +#! /bin/sh
10686 +
10687 +md5() {
10688 +       typeset fn=$1
10689 +    md5sum $1 | awk '{print $1}'
10690 +}
10691 +
10692 +files_eq() {
10693 +       typeset fn0=$1
10694 +       typeset fn1=$2
10695 +
10696 +       md0=$(md5 $fn0)
10697 +       md1=$(md5 $fn1)
10698 +#      echo -e "\n$md0 $fn0\n$md1 $fn1" >&2
10699 +       if [ "$md0" != "$md1" ]; then
10700 +               return 1
10701 +       fi
10702 +       return 0
10703 +}
10704 +
10705 +TMPDIR=${TMPDIR:-"/tmp"}
10706 +
10707 +do_test() {
10708 +       typeset dir=$1
10709 +       typeset fn=$2
10710 +       typeset url=$3
10711 +
10712 +       [ -d $dir ] || mkdir $dir
10713 +       cp -a $fn $dir || return 1
10714 +       
10715 +       bn=$(basename $fn)
10716 +       url="$url/$bn"
10717 +       ./vfget $url $TMPDIR || return 1
10718 +       
10719 +       files_eq $TMPDIR/$bn $dir/$bn
10720 +       return $?
10721 +}
10722 +#
10723 +
10724 +file=$0
10725 +uri=$(basename $0)
10726 +
10727 +
10728 +run_test() {
10729 +       no=$1; shift;
10730 +       
10731 +       echo -n "test $no $@.."
10732 +       $@ # > $TMPDIR/$(basename 0).log
10733 +       if [ $? -eq 0 ]; then
10734 +               echo "OK"
10735 +       else 
10736 +               echo "FAILED"
10737 +       fi
10738 +}
10739 +
10740 +HTTP_DIR=/home/httpd/html/tmp
10741 +FTP_DIR=/home/ftp/incoming/tmp
10742 +
10743 +
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
10749 @@ -0,0 +1,12 @@
10750 +#!/usr/bin/python
10751 +
10752 +import SimpleHTTPServer
10753 +import SocketServer
10754 +
10755 +PORT = 10000
10756 +
10757 +Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
10758 +httpd = SocketServer.TCPServer(("127.0.0.1", PORT), Handler)
10759 +
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
10765 @@ -0,0 +1,35 @@
10766 +
10767 +
10768 +TESTS = test_vfile
10769 +noinst_PROGRAMS = test_vfile
10770 +test_vfile_SOURCES = test_vfile.c test_misc.c test_file.c
10771 +
10772 +EXTRA_DIST = utest_mkidx.sh
10773 +
10774 +test_vfile_INCLUDES= @CHECK_CFLAGS@
10775 +test_vfile_LDADD = @CHECK_LIBS@ ../libvfile.la  
10776 +
10777 +clean-local:
10778 +       -rm -f *.tmp core *.o *.bak *~ *% *\# TAGS gmon.out \#*\# dupa* 
10779 +
10780 +
10781 +runtests: poldek_test_conf.conf
10782 +       $(MAKE) check
10783 +       @echo; echo "Running *.sh tests"; \
10784 +       n=0; nfails=0;                   \
10785 +       for i in utest_*.sh; do          \
10786 +           [ -f $$i ] || continue;      \
10787 +           n=$$(expr $$n + 1);          \
10788 +           echo "  running $$i";        \
10789 +           sh $$i;                      \
10790 +        if [ $$? -ne 0 ]; then       \
10791 +          nfails=$$(expr $$nfails + 1); \
10792 +          echo "    $$i FAILED";     \
10793 +        else                         \
10794 +          echo "    $$i PASSED";     \
10795 +        fi;                          \
10796 +   done;                             \
10797 +   echo "====================================="; \
10798 +   echo "$$n tests passed / $$nfails failed";    \
10799 +   echo "====================================="
10800 +
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
10804 @@ -0,0 +1,38 @@
10805 +#include "test.h"
10806 +
10807 +int test_append(const char *path, int vft_io) 
10808 +{
10809 +    struct vfile *vf;
10810 +    
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);
10814 +    vfile_close(vf);
10815 +    return 1;
10816 +}
10817 +
10818 +START_TEST (test_vfile_append) {
10819 +    int ec;
10820 +    
10821 +    test_append("tmp.txt.gz", VFT_TRURLIO);
10822 +    test_append("tmp.txt.gz", VFT_TRURLIO);
10823 +    test_append("tmp.txt.gz", VFT_TRURLIO);
10824 +    
10825 +    test_append("tmp.txt", VFT_TRURLIO);
10826 +    test_append("tmp.txt", VFT_TRURLIO);
10827 +    test_append("tmp.txt", VFT_TRURLIO);
10828 +    
10829 +    ec = system("zdiff tmp.txt tmp.txt.gz");
10830 +    fail_if(ec != 0);
10831 +    
10832 +    
10833 +}
10834 +END_TEST
10835 +
10836 +struct test_suite test_suite_vfile = {
10837 +    "vfile", 
10838 +    {
10839 +        { "append", test_vfile_append },
10840 +        { NULL, NULL }
10841 +    }
10842 +};
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
10846 @@ -0,0 +1,29 @@
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>
10857 +
10858 +#include <trurl/nassert.h>
10859 +#include <trurl/nmalloc.h>
10860 +#include <check.h>
10861 +
10862 +#include "../vfile.h"
10863 +#define fail_ifnot fail_unless
10864 +
10865 +struct test_case {
10866 +    const char *name;
10867 +    void (*test_fn)(void);
10868 +};
10869 +
10870 +struct test_suite {
10871 +    const char *name;
10872 +    struct test_case cases[];
10873 +};
10874 +
10875 +#endif
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
10879 @@ -0,0 +1,39 @@
10880 +#include "test.h"
10881 +
10882 +START_TEST (test_valid_path) {
10883 +    char *inv_paths[] = {
10884 +        "../ala/ma/kota",
10885 +        "dupa/blada",
10886 +        "/ala/../foo",
10887 +        NULL
10888 +    };
10889 +    char *valid_paths[] = {
10890 +        "/",
10891 +        "/ala/ma/kota",
10892 +        "/dupa/..blada",
10893 +        "/ala../foo",
10894 +       "/home/foo/.poldek-cache/_www.rpm.xx.redhat-7.3../.vflock__home.foo..poldek-cache..www.rpm.xx.redhat-7.3..",
10895 +        NULL
10896 +    };
10897 +    int i;
10898 +
10899 +    i = 0;
10900 +    while (inv_paths[i] != NULL) {
10901 +        fail_if(vf_valid_path(inv_paths[i]), 
10902 +                "validated invalid '%s'", inv_paths[i]);
10903 +        i++;
10904 +    }
10905 +
10906 +    i = 0;
10907 +    while (valid_paths[i] != NULL) {
10908 +        fail_if(!vf_valid_path(valid_paths[i]), 
10909 +                "invalid valid '%s'", valid_paths[i]);
10910 +        i++;
10911 +    }
10912 +}
10913 +END_TEST
10914 +
10915 +
10916 +struct test_case test_case_misc = {
10917 +    "vf_valid_path", test_valid_path
10918 +};
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
10922 @@ -0,0 +1,90 @@
10923 +/*
10924 +  $Id$
10925 +*/
10926 +#include <check.h>
10927 +#include "test.h"
10928 +
10929 +//extern struct test_suite test_suite_match;
10930 +
10931 +extern struct test_case test_case_misc;
10932 +
10933 +
10934 +struct test_suite test_suite_vfile;
10935 +struct test_suite *suites[] = {
10936 +    &test_suite_vfile,
10937 +    NULL,
10938 +};
10939 +
10940 +extern struct test_case test_case_misc_env;
10941 +struct test_case *misc_cases[] = {
10942 +    &test_case_misc,
10943 +    NULL,
10944 +};
10945 +
10946 +Suite *make_suite(struct test_suite *tsuite)
10947 +{
10948 +    Suite *s = suite_create(tsuite->name);
10949 +    int i = 0;
10950 +
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);
10955 +        i++;
10956 +    }
10957 +    return s;
10958 +}
10959 +
10960 +Suite *make_themisc_suite(void)
10961 +{
10962 +    Suite *s = suite_create("misc");
10963 +    int i = 0;
10964 +
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);
10969 +        i++;
10970 +    }
10971 +    return s;
10972 +}
10973 +
10974 +/*
10975 +  tc = tcase_create("op_ts_postconf");
10976 +  tcase_add_test(tc, test_op_ts_postconf);
10977 +  suite_add_tcase (s, tc);
10978 +  
10979 +  return s;
10980 +}
10981 +*/
10982 +
10983 +int main(int argc, char *argv[])
10984 +{
10985 +    int i = 0, nerr = 0;
10986 +    
10987 +    //if (argc > 1 && n_str_eq(argv[1], "-v"))
10988 +        
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);
10995 +    }
10996 +
10997 +    i = 0;
10998 +    while (suites[i]) {
10999 +        Suite *s = make_suite(suites[i]);
11000 +        SRunner *sr = srunner_create(s);
11001 +        printf("\n");
11002 +        srunner_run_all(sr, CK_NORMAL);
11003 +        nerr += srunner_ntests_failed(sr);
11004 +        srunner_free(sr);
11005 +        i++;
11006 +    }
11007 +    
11008 +    
11009 +
11010 +    return (nerr == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
11011 +}
11012 +
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
11016 @@ -0,0 +1,40 @@
11017 +#include <stdio.h>
11018 +#include <stdlib.h>
11019 +
11020 +#include <stdio.h>
11021 +#include <stdlib.h>
11022 +
11023 +#include "i18n.h"
11024 +#include "vfile.h"
11025 +
11026 +void fetch(const char *url)
11027 +{
11028 +    vf_fetch("/tmp", url);
11029 +}
11030 +
11031 +
11032 +int main(int argc, char *argv[])
11033 +{
11034 +    int verbose = 1;
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";
11036 +
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";
11038 +
11039 +    
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";
11041 +
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";
11043 +    
11044 +    vfile_configure(VFILE_CONF_CACHEDIR, ",tmp");
11045 +    vfile_verbose = &verbose;
11046 +
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));
11050 +    
11051 +
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");
11055 +    return 0;
11056 +}
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
11060 @@ -11,7 +11,7 @@
11061  */
11062  
11063  /*
11064 -  $Id$
11065 +  $Id$
11066  */
11067  #ifdef HAVE_CONFIG_H
11068  # include "config.h"
11069 @@ -32,10 +32,6 @@
11070  #include <time.h>
11071  
11072  #include <zlib.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);
11083              req = NULL;
11084 -            rc = vf_fetch(req->url, destdir, flags, NULL);
11085 +            rc = vf_fetch(url, destdir, flags, NULL);
11086          }
11087      }
11088      if (req)
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
11092 @@ -1,5 +1,5 @@
11093  /* 
11094 -  Copyright (C) 2002 Pawel A. Gajda <mis@k2.net.pl>
11095 +  Copyright (C) 2002 - 2005 Pawel A. Gajda <mis@k2.net.pl>
11096  
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.
11101  */
11102  
11103 -/* $Id$ */
11104 +/* $Id$ */
11105  
11106 +#include <arpa/inet.h>
11107  #include <ctype.h>
11108  #include <errno.h>
11109  #include <fcntl.h>
11110  #include <netdb.h>
11111 +#include <signal.h>
11112  #include <stdarg.h>
11113  #include <stdio.h>
11114  #include <stdlib.h>
11115  #include <string.h>
11116 -#include <time.h>
11117  #include <sys/socket.h>
11118  #include <sys/time.h>
11119  #include <sys/types.h>
11120 +#include <time.h>
11121  #include <unistd.h>
11122 -#include <signal.h>
11123  
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 @@
11129  #include "vfff.h"
11130  #include "vfile/vfile_intern.h"
11131  
11132 +#define  VCN_ALIVE_TTL  10
11133 +
11134  extern void vhttp_vcn_init(struct vcn *cn);
11135  extern void vftp_vcn_init(struct vcn *cn);
11136  
11137 -
11138 -
11139  static char errmsg[512] = { '\0' };
11140  static int verbose = 0;
11141  
11142 @@ -146,8 +146,6 @@
11143      vfff_errno = 0;
11144      
11145      do {
11146 -        vfile_sigint_reached(1);      /* just reset */
11147 -        
11148          sockfd = socket(resp->ai_family, resp->ai_socktype, resp->ai_protocol);
11149          if (sockfd < 0)
11150              continue;
11151 @@ -173,6 +171,8 @@
11152      
11153      else if (af)
11154          *af = resp->ai_family;
11155 +
11156 +    //DBGF("sigint reached %d, errno %m\n", vfff_sigint_reached());
11157      
11158      uninstall_alarm();
11159      freeaddrinfo(res);
11160 @@ -321,6 +321,15 @@
11161  int vcn_is_alive(struct vcn *cn) 
11162  {
11163      vfff_errno = 0;
11164 +    
11165 +    if (cn->ts_is_alive > 0) {
11166 +        time_t ts = time(0);
11167 +    
11168 +        if (ts - cn->ts_is_alive < VCN_ALIVE_TTL)
11169 +            return 1;
11170 +    }
11171 +
11172 +    cn->ts_is_alive = time(0);
11173      return cn->m_is_alive(cn);
11174  }
11175  
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
11179 @@ -1,4 +1,4 @@
11180 -/* $Id$ */
11181 +/* $Id$ */
11182  /*
11183    Copyright (C) 2000 - 2003 Pawel A. Gajda <mis@pld.org.pl>
11184  
11185 @@ -82,6 +82,8 @@
11186  
11187      void      (*m_free)(void *resp);
11188      void      *resp;
11189 +
11190 +    time_t    ts_is_alive;
11191  };
11192  
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
11197 @@ -11,7 +11,7 @@
11198  */
11199  
11200  /*
11201 -  $Id$
11202 +  $Id$
11203  */
11204  #ifdef HAVE_CONFIG_H
11205  # include "config.h"
11206 @@ -28,10 +28,6 @@
11207  #include <time.h>
11208  
11209  #include <zlib.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 @@
11218              
11219              break;    
11220          }
11221 -            
11222  
11223          case VFILE_CONF_STUBBORN_NRETRIES:
11224              v = va_arg(ap, int);
11225 -            if (v > 0)
11226 -                vfile_conf.nretries = v;
11227 +            if (v == 0)
11228 +                v = 1;
11229 +            vfile_conf.nretries = v;
11230              break;
11231              
11232          case VFILE_CONF_SIGINT_REACHED:
This page took 2.420967 seconds and 3 git commands to generate.