From: Marcin Krol Date: Sun, 6 Nov 2022 15:02:51 +0000 (+0100) Subject: - PLD merge X-Git-Url: https://git.tld-linux.org/?a=commitdiff_plain;h=6885e3f24ac122b1f5fa08f9349d967235a5a96d;p=packages%2Fpoldek.git - PLD merge --- diff --git a/boolean-deps.patch b/boolean-deps.patch new file mode 100644 index 0000000..325d1c7 --- /dev/null +++ b/boolean-deps.patch @@ -0,0 +1,335 @@ +diff -ur poldek-0.42.2/capreq.h poldek-0.42.2-boolean-deps/capreq.h +--- poldek-0.42.2/capreq.h 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-boolean-deps/capreq.h 2022-06-08 20:48:12.797280673 +0200 +@@ -58,6 +58,22 @@ + char _buff[0]; /* for evr, first byte is always '\0' */ + }; + ++#define CAPREQ_BOOL_OP_AND (1 << 0) ++#define CAPREQ_BOOL_OP_OR (1 << 1) ++#define CAPREQ_BOOL_OP_IF (1 << 2) ++#define CAPREQ_BOOL_OP_UNLESS (1 << 3) ++#define CAPREQ_BOOL_OP_ELSE (1 << 4) ++#define CAPREQ_BOOL_OP_WITH (1 << 5) ++#define CAPREQ_BOOL_OP_WITHOUT (1 << 6) ++ ++struct boolean_req { ++ uint16_t op; // and, or, ir (else), with, without, unless (else) ++ struct capreq* req; ++ struct boolean_req* left; // left (and|or|with|without) right ++ struct boolean_req* leftn; // left (if|unless) right (else leftn) ++ struct boolean_req* right; ++}; ++ + /* CAUTION: side effects! */ + #define capreq_name(cr) (cr)->name + #define capreq_name_len(cr) (cr)->namelen +diff -ur poldek-0.42.2/install3/requirements.c poldek-0.42.2-boolean-deps/install3/requirements.c +--- poldek-0.42.2/install3/requirements.c 2020-04-06 14:24:18.000000000 +0200 ++++ poldek-0.42.2-boolean-deps/install3/requirements.c 2022-06-08 20:48:12.797280673 +0200 +@@ -16,13 +16,163 @@ + + #include "ictx.h" + +-static int skip_boolean_dep(const struct capreq *cr) { +- if (capreq_is_boolean(cr)) { +- logn(LOGWARN, "%s: skipping boolean dependency (not supported yet)", +- capreq_stra(cr)); +- return 1; ++static struct BooleanOpComp { ++ const char *n; ++ int l; ++ uint16_t op; ++} BooleanOps[] = { ++ { "and", 3, CAPREQ_BOOL_OP_AND }, ++ { "or", 2, CAPREQ_BOOL_OP_OR }, ++ { "if", 2, CAPREQ_BOOL_OP_IF }, ++ { "unless", 6, CAPREQ_BOOL_OP_UNLESS }, ++ { "with", 4, CAPREQ_BOOL_OP_WITH }, ++ { "without", 7, CAPREQ_BOOL_OP_WITHOUT }, ++ { NULL, 0, 0}, ++}; ++ ++static struct capreq* parse_single_dep(char *req, int *len) { ++ char *q, *cap, *name, *evr = NULL; ++ int name_len, evr_len; ++ struct capreq* cr = NULL; ++ uint16_t op; ++ ++ cap = q = strdup(req); ++ DBGF("dep: %s", q); ++ // skip whitespace ++ while (*q == ' ') ++ q++; ++ DBGF("ltrim: %s", q); ++ name = q; ++ // look for the end of normal dep ++ while (*q != ' ') ++ q++; ++ name_len = q - name; ++ DBGF("to parse: %s, name: %s, name_len: %d", q, name, name_len); ++ while (*q == ' ') ++ q++; ++ DBGF("ltrim: %s", q); ++ op = 0; ++ while (*q != ' ') { ++ if (*q == '<') ++ op |= REL_LT; ++ else if (*q == '=') ++ op |= REL_EQ; ++ else if (*q == '>') ++ op |= REL_GT; ++ else ++ break; ++ q++; ++ } ++ DBGF("to parse: %s, op: %d", q, op); ++ while (*q == ' ') ++ q++; ++ DBGF("ltrim: %s", q); ++ if (op) { ++ evr = q; ++ while (*q != ' ' && *q != ')') ++ q++; ++ evr_len = q - evr; ++ DBGF("to parse: evr: %s, evr_len: %d", evr, evr_len); ++ } ++ DBGF("to parse: %s", q); ++ while (*q == ' ') ++ q++; ++ DBGF("ltrim: %s", q); ++ *len = q - cap; ++ *(name + name_len) = '\0'; ++ DBGF("name: %s, name_len: %d", name, name_len); ++ if (evr) { ++ *(evr + evr_len) = '\0'; ++ DBGF("evr: %s, evr_len: %d", evr, evr_len); ++ } ++ cr = capreq_new_evr(NULL, name, evr, op, 0); ++ free(cap); ++ return cr; ++} ++ ++static struct boolean_req* parse_boolean_dep(const char *strreq, uint16_t op, int* len) { ++ char *p, *q, *cap; ++ struct boolean_req *breq; ++ int parsed_len; ++ struct BooleanOpComp *o; ++ ++ cap = p = strdup(strreq); ++ // boolean dep must start with '(' except if we're chaining 'and' or 'or' ++ if (op != CAPREQ_BOOL_OP_AND && op != CAPREQ_BOOL_OP_OR) { ++ if (*p != '(') ++ return NULL; ++ p++; ++ } ++ DBGF("breq: %s", p); ++ breq = malloc(sizeof(struct boolean_req)); ++ bzero(breq, sizeof(struct boolean_req)); ++ // skip whitespace ++ while (*p == ' ') ++ p++; ++ DBGF("breq ltrim: %s", p); ++ // nested dep ++ q = p; ++ if (*p == '(') ++ breq->left = parse_boolean_dep(p, 0, &parsed_len); ++ else ++ breq->req = parse_single_dep(p, &parsed_len); ++ q += parsed_len; ++ DBGF("breq to parse: %s", q); ++ if (*q == ')') { ++ if (len) ++ *len = q - cap; ++ return breq; + } +- return 0; ++ ++ for (o = BooleanOps; o->n; o++) ++ if (!strncmp(q, o->n, o->l)) ++ break; ++ breq->op = o->op; ++ if (!breq->op) { ++ DBGF("fail no-op"); ++ return NULL; ++ } ++ q += o->l; ++ while (*q == ' ') ++ q++; ++ if (*q == '(') ++ breq->right = parse_boolean_dep(q, breq->op, &parsed_len); ++ else { ++ breq->right = malloc(sizeof(struct boolean_req)); ++ bzero(breq->right, sizeof(struct boolean_req)); ++ breq->right->req = parse_single_dep(q, &parsed_len); ++ } ++ q += parsed_len; ++ if (*q == ')') { ++ if (len) ++ *len = q - cap; ++ return breq; ++ } ++ ++ if (breq->op == CAPREQ_BOOL_OP_IF || breq->op == CAPREQ_BOOL_OP_UNLESS) { ++ if (!strncmp(q, "else", 4)) { ++ q += 4; ++ while (*q == ' ') ++ q++; ++ if (*q == '(') ++ breq->leftn = parse_boolean_dep(q, breq->op, &parsed_len); ++ else { ++ breq->leftn = malloc(sizeof(struct boolean_req)); ++ bzero(breq->leftn, sizeof(struct boolean_req)); ++ breq->leftn->req = parse_single_dep(q, &parsed_len); ++ } ++ } ++ } ++ while (*q == ' ') ++ q++; ++ if (*q != ')' && op != CAPREQ_BOOL_OP_AND && op != CAPREQ_BOOL_OP_OR) { ++ DBGF("fail no closing paren"); ++ return NULL; ++ } ++ ++ if (len) ++ *len = q - cap; ++ return breq; + } + + static +@@ -553,8 +703,11 @@ + + } + ++ ++// i3pkg - package to be installed ++// req - dependency we are looking for + static int process_req(int indent, struct i3ctx *ictx, +- struct i3pkg *i3pkg, const struct capreq *req) ++ struct i3pkg *i3pkg, const struct capreq *req, int boolean) + { + struct poldek_ts *ts = ictx->ts; /* just for short */ + struct pkg *pkg, *tomark = NULL; +@@ -644,7 +797,8 @@ + else + errfmt = _("%s: req %s not found"); + +- i3_error(ictx, pkg, I3ERR_NOTFOUND, errfmt, pkg_id(pkg), strreq); ++ if (boolean == 0) ++ i3_error(ictx, pkg, I3ERR_NOTFOUND, errfmt, pkg_id(pkg), strreq); + rc = 0; + + l_end: +@@ -653,6 +807,49 @@ + return rc; + } + ++static int process_boolean_req(int indent, struct i3ctx *ictx, ++ struct i3pkg *i3pkg, const struct boolean_req *breq) ++{ ++ int rcl, rcr, rce; ++ if (breq->req) ++ rcl = process_req(indent, ictx, i3pkg, breq->req, 1); ++ else ++ rcl = process_boolean_req(indent, ictx, i3pkg, breq->left); ++ if (breq->op != CAPREQ_BOOL_OP_OR) ++ if (breq->right) ++ rcr = process_boolean_req(indent, ictx, i3pkg, breq->right); ++ else ++ return rcl; ++ switch (breq->op) { ++ case CAPREQ_BOOL_OP_AND: ++ return (rcl > 0 && rcr > 0) ? 1 : -1; ++ case CAPREQ_BOOL_OP_OR: ++ if (rcl <= 0 && breq->right) ++ return process_boolean_req(indent, ictx, i3pkg, breq->right); ++ return rcl; ++ case CAPREQ_BOOL_OP_IF: ++ if (rcr > 0) ++ return rcl; ++ if (breq->leftn) ++ return process_boolean_req(indent, ictx, i3pkg, breq->leftn); ++ return 1; ++ case CAPREQ_BOOL_OP_UNLESS: ++ if (rcr <= 0) ++ return rcl; ++ if (breq->leftn) ++ return process_boolean_req(indent, ictx, i3pkg, breq->leftn); ++ return 1; ++ case CAPREQ_BOOL_OP_WITH: ++ // TODO: check that both deps are stisfied by the same package ++ return (rcl > 0 && rcr > 0) ? 1 : -1; ++ case CAPREQ_BOOL_OP_WITHOUT: ++ // TODO: check that both deps are stisfied by the same package ++ return (rcl > 0 && rcr <= 0) ? 1 : -1; ++ default: ++ return -1; ++ } ++ return -1; ++} + + static tn_array *with_suggests(int indent, struct i3ctx *ictx, struct pkg *pkg) + { +@@ -660,6 +857,7 @@ + struct pkg *oldpkg = NULL; + char *autochoice = NULL; /* testing only */ + int i; ++ struct boolean_req* breq; + + if (pkg->sugs == NULL) + return NULL; +@@ -693,8 +891,14 @@ + + //trace(indent, "%d) suggested %s", i, reqstr); + +- if (skip_boolean_dep(req)) ++ if (capreq_is_boolean(req)) { ++ logn(LOGWARN, "%s: skipping boolean dependency (weak deps not supported yet)", ++ capreq_stra(req)); ++ // TODO ++ // breq = parse_boolean_dep(capreq_name(req), 0, NULL); ++ // process_boolean_req(indent, ictx, i3pkg, breq); + continue; ++ } + + if (iset_provides(ictx->inset, req)) { + trace(indent, "- %s: already marked", reqstr); +@@ -791,6 +995,7 @@ + const struct capreq *req = NULL; + unsigned itflags = PKG_ITER_REQIN; + int nerrors = 0, backtrack = 0; ++ struct boolean_req* breq; + + pkg = i3pkg->pkg; + n_assert(pkg); +@@ -806,10 +1011,18 @@ + while ((req = pkg_req_iter_get(it))) { + int rc; + +- if (skip_boolean_dep(req)) +- continue; ++ if (capreq_is_boolean(req)) { ++ msgn_i(1, indent, "%s required by %s", ++ capreq_stra(req), pkg->name ? pkg->name : "(null)"); ++ breq = parse_boolean_dep(capreq_name(req), 0, NULL); ++ rc = process_boolean_req(indent + 2, ictx, i3pkg, breq); ++ if (rc <= 0) ++ i3_error(ictx, i3pkg->pkg, I3ERR_NOTFOUND, _("%s: req %s not found"), pkg_id(i3pkg->pkg), capreq_stra(req)); ++ } else { ++ rc = process_req(indent, ictx, i3pkg, req, 0); ++ } + +- if ((rc = process_req(indent, ictx, i3pkg, req)) <= 0) { ++ if (rc <= 0) { + nerrors++; + if (rc < 0) { + backtrack = 1; +@@ -836,7 +1049,7 @@ + + req = n_array_nth(suggests, i); + +- if ((rc = process_req(indent, ictx, i3pkg, req)) <= 0) { ++ if ((rc = process_req(indent, ictx, i3pkg, req, 0)) <= 0) { + nerrors++; + if (rc < 0) { + backtrack = 1; diff --git a/egrep-is-obsolete.patch b/egrep-is-obsolete.patch new file mode 100644 index 0000000..d2a434e --- /dev/null +++ b/egrep-is-obsolete.patch @@ -0,0 +1,107 @@ +--- poldek-0.42.2/scripts/vfcompr~ 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2/scripts/vfcompr 2022-09-11 12:57:50.696482611 +0200 +@@ -11,7 +11,7 @@ + typeset dest=$2 + + cmd="bzip2 --stdout ${src}" +- if echo ${dest} | egrep ".gz" >/dev/null; then ++ if echo ${dest} | grep -E ".gz" >/dev/null; then + cmd="gzip -9nf --stdout ${src}" + fi + echo "$cmd > $dest" +@@ -34,7 +34,7 @@ + fi + + cmd="bunzip2 --keep --stdout ${src}" +- if echo ${src} | egrep ".gz" >/dev/null; then ++ if echo ${src} | grep -E ".gz" >/dev/null; then + cmd="gunzip --stdout ${src}" + fi + rm -f "$dest" +--- poldek-0.42.2/Makefile.extra~ 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2/Makefile.extra 2022-09-11 12:59:01.885518021 +0200 +@@ -72,7 +72,7 @@ + + POTFILES_in: + -rm -f poldek-git* +- -find . -type f -name \*.c | egrep -v '(poldek-.*/|Cellar/|intl/|trurlib/|tndb/|python/|tests/|conf_sections.c)' | sed 's|^\./||' | LC_ALL=C sort > po/POTFILES.in ++ -find . -type f -name \*.c | grep -E -v '(poldek-.*/|Cellar/|intl/|trurlib/|tndb/|python/|tests/|conf_sections.c)' | sed 's|^\./||' | LC_ALL=C sort > po/POTFILES.in + + misarch: mclean + $(MAKE) -C . backup cparch=1 backupdir=/z +--- poldek-0.42.2/tests/sh/03-up-loop~ 2020-04-09 12:53:57.000000000 +0200 ++++ poldek-0.42.2/tests/sh/03-up-loop 2022-09-11 13:00:01.988044987 +0200 +@@ -15,10 +15,10 @@ + + load() { + $POLDEK_UP -q --skip-installed -Osource="test,type=pndir $REPOURL" -n test \ +- --cmd 'desc -al *' | egrep -v '^Path:' > $TMPDIR/local-dump ++ --cmd 'desc -al *' | grep -E -v '^Path:' > $TMPDIR/local-dump + + $POLDEK_NOCONF -q --skip-installed --st pndir -s $REPO \ +- --cmd 'desc -al *' | egrep -v '^Path:' > $TMPDIR/remote-dump ++ --cmd 'desc -al *' | grep -E -v '^Path:' > $TMPDIR/remote-dump + + #less $TMPDIR/remote-dump + #ls -l $TMPDIR/remote-dump $TMPDIR/local-dump +--- poldek-0.42.2/tests/sh/lib/setup~ 2020-03-27 08:50:43.000000000 +0100 ++++ poldek-0.42.2/tests/sh/lib/setup 2022-09-11 13:00:26.557717267 +0200 +@@ -56,7 +56,7 @@ + while test $# -gt 0 ; do + case "${1}" in + -l) +- egrep -B 1 ^test $0 | sed 's|()||g;s|{||g'; exit; shift ;; ++ grep -E -B 1 ^test $0 | sed 's|()||g;s|{||g'; exit; shift ;; + + --source-repo) + shift; SOURCE_REPO="${1}"; shift ;; +--- poldek-0.42.2/tests/sh/lib/solver-setup~ 2020-03-31 11:46:23.000000000 +0200 ++++ poldek-0.42.2/tests/sh/lib/solver-setup 2022-09-11 13:00:42.930832785 +0200 +@@ -8,7 +8,7 @@ + [ $# -gt 0 ] && version="$1"; + #echo "v $version" + if [ -n "$version" ]; then +- if echo "$version" | egrep -qv -- '^-'; then ++ if echo "$version" | grep -E -qv -- '^-'; then + shift + else + version="1-1" +@@ -85,17 +85,17 @@ + fi + + # run again to check installation results +- typeset out=$($POLDEK_INSTALL $cmd --parsable-tr-summary | egrep "^%[IDR]") ++ typeset out=$($POLDEK_INSTALL $cmd --parsable-tr-summary | grep -E "^%[IDR]") + if [ -n "$expected" ]; then +- typeset n_all=$(echo $out | sed 's|%|\n%|g' | egrep '^%[ID]' | wc -l) +- typeset n=$(echo $out | sed 's|%|\n%|g' | egrep "^%[ID] ($regexp)" | wc -l) ++ typeset n_all=$(echo $out | sed 's|%|\n%|g' | grep -E '^%[ID]' | wc -l) ++ typeset n=$(echo $out | sed 's|%|\n%|g' | grep -E "^%[ID] ($regexp)" | wc -l) + assertEquals "unexpected ($n_all) number of packages (expected $n)" "$n_all" "$n" + assertEquals "not all or non expected packages installed (expected $expected)" "$n" "$n_expected" + fi + + if [ -n "$rm_expected" ]; then +- typeset n_all=$(echo $out | sed 's|%|\n%|g' | egrep '^%R' | wc -l) +- typeset n=$(echo $out | sed 's|%|\n%|g' | egrep "^%R ($rm_regexp)" | wc -l) ++ typeset n_all=$(echo $out | sed 's|%|\n%|g' | grep -E '^%R' | wc -l) ++ typeset n=$(echo $out | sed 's|%|\n%|g' | grep -E "^%R ($rm_regexp)" | wc -l) + assertEquals "unexpected ($n_all) number of packages removed (expected $n)" "$n_all" "$n" + assertEquals "not all or non expected packages removed (expected $rm_expected)" "$n" "$rm_n_expected" + fi +@@ -127,12 +127,12 @@ + $POLDEK_UNINSTALL $cmd --test + fi + +- typeset out=$($POLDEK_UNINSTALL $cmd --parsable-tr-summary | egrep "^%[DR]") ++ typeset out=$($POLDEK_UNINSTALL $cmd --parsable-tr-summary | grep -E "^%[DR]") + [ $? -eq 0 ] || fail "$POLDEK_INSTALL $cmd failed" + + if [ -n "$expected" ]; then +- typeset n_all=$(echo $out | sed 's|%|\n%|g' | egrep '^%[RD]' | wc -l) +- typeset n=$(echo $out | sed 's|%|\n%|g' | egrep "^%[RD] ($regexp)" | wc -l) ++ typeset n_all=$(echo $out | sed 's|%|\n%|g' | grep -E '^%[RD]' | wc -l) ++ typeset n=$(echo $out | sed 's|%|\n%|g' | grep -E "^%[RD] ($regexp)" | wc -l) + assertEquals "unexpected ($n_all) number of packages (expected $n)" "$n_all" "$n" + assertEquals "not all or non expected packages uninstalled (expected $expected)" "$n" "$n_expected" + fi diff --git a/minus.patch b/minus.patch new file mode 100644 index 0000000..3f394cf --- /dev/null +++ b/minus.patch @@ -0,0 +1,12 @@ +diff -up poldek-0.42.2/ts_summary.c.rel poldek-0.42.2/ts_summary.c +--- poldek-0.42.2/ts_summary.c.rel ++++ poldek-0.42.2/ts_summary.c +@@ -202,7 +202,7 @@ + poldek_term_snprintf_c(old_color, old, sizeof(old), "%s", old_pkg->rel); + poldek_term_snprintf_c(new_color, new, sizeof(new), "%s", pkg->rel); + +- n = n_snprintf(line, size, "%s-%s.(%s => %s).%s", ++ n = n_snprintf(line, size, "%s-%s-(%s => %s).%s", + pkg->name, pkg->ver, old, new, arch); + + } else if (!eq_ver && !eq_rel) { diff --git a/more-trace.patch b/more-trace.patch new file mode 100644 index 0000000..d96c7a9 --- /dev/null +++ b/more-trace.patch @@ -0,0 +1,259 @@ +diff -ur poldek-0.42.2/cli/cmd_chain.c poldek-0.42.2-booldeps/cli/cmd_chain.c +--- poldek-0.42.2/cli/cmd_chain.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/cli/cmd_chain.c 2022-05-19 16:33:21.159335140 +0200 +@@ -29,7 +29,6 @@ + #include "compiler.h" + #include "i18n.h" + #include "poldek_util.h" +-#define ENABLE_TRACE 0 + #include "log.h" + #include "cli.h" + #include "cmd_chain.h" +diff -ur poldek-0.42.2/conf.c poldek-0.42.2-booldeps/conf.c +--- poldek-0.42.2/conf.c 2020-03-10 11:19:28.000000000 +0100 ++++ poldek-0.42.2-booldeps/conf.c 2022-05-19 16:32:35.185649828 +0200 +@@ -34,7 +34,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/depdirs.c poldek-0.42.2-booldeps/depdirs.c +--- poldek-0.42.2/depdirs.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/depdirs.c 2022-05-19 16:32:32.922297335 +0200 +@@ -22,7 +22,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "log.h" + #include "i18n.h" +diff -ur poldek-0.42.2/install3/ictx.h poldek-0.42.2-booldeps/install3/ictx.h +--- poldek-0.42.2/install3/ictx.h 2020-04-04 21:01:09.000000000 +0200 ++++ poldek-0.42.2-booldeps/install3/ictx.h 2022-05-19 16:32:43.675720130 +0200 +@@ -17,7 +17,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "i18n.h" + #include "log.h" + #include "misc.h" +diff -ur poldek-0.42.2/install3/iset.c poldek-0.42.2-booldeps/install3/iset.c +--- poldek-0.42.2/install3/iset.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/install3/iset.c 2022-05-19 16:32:41.449035264 +0200 +@@ -14,8 +14,6 @@ + # include "config.h" + #endif + +-#define ENABLE_TRACE 0 +- + #include + #include + #include /* for PATH_MAX */ +diff -ur poldek-0.42.2/pkg.c poldek-0.42.2-booldeps/pkg.c +--- poldek-0.42.2/pkg.c 2022-05-20 16:21:07.639370807 +0200 ++++ poldek-0.42.2-booldeps/pkg.c 2022-05-19 16:49:06.084231070 +0200 +@@ -27,7 +27,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +@@ -683,7 +682,7 @@ + } + + if (cap_xmatch_req(cap, req, flags)) { +- DBGF(" cap[%d] %s -> match\n", i, capreq_snprintf_s(cap)); ++ DBGF(" cap[%d] %s -> match (pkg: %s)\n", i, capreq_snprintf_s(cap), pkg->name); + return 1; + } + +diff -ur poldek-0.42.2/pkgcmp.c poldek-0.42.2-booldeps/pkgcmp.c +--- poldek-0.42.2/pkgcmp.c 2020-03-16 14:27:06.000000000 +0100 ++++ poldek-0.42.2-booldeps/pkgcmp.c 2022-05-19 16:34:31.123077977 +0200 +@@ -22,7 +22,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +@@ -360,9 +359,9 @@ + + #if ENABLE_TRACE + if (pkg_cmp_name_evr_rev(p1, p2) == 0) +- logn(LOGNOTICE, "uniq %s: keep %s (score %d), removed %s (score %d)", ++ logn(LOGNOTICE, "uniq %s: keep %s (score %d), removed %s", + pkg_snprintf_s(p1), pkg_arch(p1), pkg_arch_score(p1), +- pkg_arch(p2), pkg_archscore(p2)); ++ pkg_arch(p2)); + #endif + rc = pkg_cmp_name_evr_rev(p1, p2); + +diff -ur poldek-0.42.2/pkgdir/pkgdir.c poldek-0.42.2-booldeps/pkgdir/pkgdir.c +--- poldek-0.42.2/pkgdir/pkgdir.c 2020-03-26 10:22:47.000000000 +0100 ++++ poldek-0.42.2-booldeps/pkgdir/pkgdir.c 2022-05-19 16:33:01.562526953 +0200 +@@ -35,7 +35,6 @@ + + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/pkgdir/source.c poldek-0.42.2-booldeps/pkgdir/source.c +--- poldek-0.42.2/pkgdir/source.c 2020-03-16 15:23:52.000000000 +0100 ++++ poldek-0.42.2-booldeps/pkgdir/source.c 2022-05-19 16:32:57.605830198 +0200 +@@ -29,8 +29,6 @@ + + #include + +-#define ENABLE_TRACE 0 +- + #include "compiler.h" + #include "pkgdir.h" + #include "pkgdir_intern.h" +diff -ur poldek-0.42.2/pkgdir/source_mkidx.c poldek-0.42.2-booldeps/pkgdir/source_mkidx.c +--- poldek-0.42.2/pkgdir/source_mkidx.c 2020-03-25 21:14:48.000000000 +0100 ++++ poldek-0.42.2-booldeps/pkgdir/source_mkidx.c 2022-05-19 16:32:55.049143819 +0200 +@@ -29,8 +29,6 @@ + + #include + +-#define ENABLE_TRACE 0 +- + #include "compiler.h" + #include "pkgdir.h" + #include "pkgdir_intern.h" +diff -ur poldek-0.42.2/pkgiter.c poldek-0.42.2-booldeps/pkgiter.c +--- poldek-0.42.2/pkgiter.c 2020-04-04 21:01:09.000000000 +0200 ++++ poldek-0.42.2-booldeps/pkgiter.c 2022-05-19 16:33:05.289221486 +0200 +@@ -24,7 +24,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/pkgroup.c poldek-0.42.2-booldeps/pkgroup.c +--- poldek-0.42.2/pkgroup.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/pkgroup.c 2022-05-19 16:33:19.022653641 +0200 +@@ -21,8 +21,6 @@ + + #include + +-#define ENABLE_TRACE 0 +- + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/pm/pkgdb.c poldek-0.42.2-booldeps/pm/pkgdb.c +--- poldek-0.42.2/pm/pkgdb.c 2020-04-05 21:03:29.000000000 +0200 ++++ poldek-0.42.2-booldeps/pm/pkgdb.c 2022-05-19 18:03:20.192624394 +0200 +@@ -409,6 +409,7 @@ + struct pkg pkg; + int rc; + ++ DBGF("header_cap_match_req\n"); + rc = 0; + memset(&pkg, 0, sizeof(pkg)); + pkg.caps = capreq_arr_new(0); +@@ -456,7 +457,7 @@ + int is_file; + + is_file = (*capreq_name(req) == '/' ? 1 : 0); +- //tracef(0, "%s %d", capreq_snprintf_s(req), n_array_size(exclude)); ++ tracef(0, "%s %d", capreq_snprintf_s(req), n_array_size(exclude)); + + if (!is_file && db_match(db, PMTAG_NAME, req, exclude, ma_flags)) + return 1; +diff -ur poldek-0.42.2/pm/rpm/rpmdb_it.c poldek-0.42.2-booldeps/pm/rpm/rpmdb_it.c +--- poldek-0.42.2/pm/rpm/rpmdb_it.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/pm/rpm/rpmdb_it.c 2022-05-19 16:32:46.145740124 +0200 +@@ -14,7 +14,6 @@ + # include "config.h" + #endif + +-#define ENABLE_TRACE 0 + #include "i18n.h" + #include "misc.h" + #include "log.h" +diff -ur poldek-0.42.2/pm/rpmorg/rpmdb_it.c poldek-0.42.2-booldeps/pm/rpmorg/rpmdb_it.c +--- poldek-0.42.2/pm/rpmorg/rpmdb_it.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/pm/rpmorg/rpmdb_it.c 2022-05-19 16:32:49.022429816 +0200 +@@ -14,7 +14,6 @@ + # include "config.h" + #endif + +-#define ENABLE_TRACE 0 + #include "i18n.h" + #include "misc.h" + #include "log.h" +diff -ur poldek-0.42.2/pm/rpmorg/rpm_pkg_ld.c poldek-0.42.2-booldeps/pm/rpmorg/rpm_pkg_ld.c +--- poldek-0.42.2/pm/rpmorg/rpm_pkg_ld.c 2022-05-20 16:21:07.646037483 +0200 ++++ poldek-0.42.2-booldeps/pm/rpmorg/rpm_pkg_ld.c 2022-05-20 15:27:51.747648780 +0200 +@@ -218,10 +218,10 @@ + goto l_end; + + } else { +- msg(5, "%s%s: %s\n", ++ DBGF("%s%s: %s, %s\n", + cr->cr_flags & CAPREQ_PREREQ ? + (pmcap_tag == PMCAP_OBSL ? "obsl" : "pre" ):"", +- tgs->label, capreq_snprintf_s(cr)); ++ tgs->label, capreq_snprintf_s(cr), name); + n_array_push(arr, cr); + } + } +diff -ur poldek-0.42.2/tndb/write.c poldek-0.42.2-booldeps/tndb/write.c +--- poldek-0.42.2/tndb/write.c 2020-01-25 23:27:30.000000000 +0100 ++++ poldek-0.42.2-booldeps/tndb/write.c 2022-05-19 16:33:15.672630089 +0200 +@@ -28,7 +28,6 @@ + #include + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "tndb_int.h" + #include "tndb.h" +diff -ur poldek-0.42.2/uninstall.c poldek-0.42.2-booldeps/uninstall.c +--- poldek-0.42.2/uninstall.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/uninstall.c 2022-05-19 16:32:52.129121034 +0200 +@@ -27,7 +27,6 @@ + #include + + #include "sigint/sigint.h" +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/upgrade-dist.c poldek-0.42.2-booldeps/upgrade-dist.c +--- poldek-0.42.2/upgrade-dist.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/upgrade-dist.c 2022-05-19 16:33:23.476017725 +0200 +@@ -29,7 +29,6 @@ + + #include + +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" +diff -ur poldek-0.42.2/vfile/vopen3.c poldek-0.42.2-booldeps/vfile/vopen3.c +--- poldek-0.42.2/vfile/vopen3.c 2020-01-25 22:59:59.000000000 +0100 ++++ poldek-0.42.2-booldeps/vfile/vopen3.c 2022-05-19 16:32:37.749004646 +0200 +@@ -50,7 +50,6 @@ + + #include + #include +-#define ENABLE_TRACE 0 + #include "compiler.h" + #include "i18n.h" + #include "log.h" /* for DBGF */ diff --git a/poldek.spec b/poldek.spec index 92e28bd..2e7c7ce 100644 --- a/poldek.spec +++ b/poldek.spec @@ -16,7 +16,7 @@ Summary(hu.UTF-8): RPM csomagkezelést segítő eszköz Summary(pl.UTF-8): Pomocnicze narzędzie do zarządzania pakietami RPM Name: poldek Version: 0.42.2 -Release: 9 +Release: 16 License: GPL v2 Group: Applications/System #Source0: http://poldek.pld-linux.org/download/snapshots/%{name}-%{version}-cvs%{snap}.tar.bz2 @@ -49,6 +49,11 @@ Patch15: skip-buildid-obsoletes.patch Patch16: verify-signature.patch Patch17: %{name}-rsa_sig_rpmorg.patch Patch18: no-bdb-for-rpm-org.patch +Patch19: more-trace.patch +Patch20: boolean-deps.patch +Patch21: sorted-ls-upgradable.patch +Patch22: egrep-is-obsolete.patch +Patch23: minus.patch URL: http://poldek.pld-linux.org/ BuildRequires: autoconf >= 2.63 BuildRequires: automake >= 1:1.11 @@ -236,6 +241,11 @@ cd .. %patch16 -p1 %patch17 -p1 %patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 +%patch23 -p1 %{__rm} doc/poldek.info %{__rm} m4/libtool.m4 m4/lt*.m4 diff --git a/sorted-ls-upgradable.patch b/sorted-ls-upgradable.patch new file mode 100644 index 0000000..b97253f --- /dev/null +++ b/sorted-ls-upgradable.patch @@ -0,0 +1,53 @@ +From b7c0f1246788d1716c519387d75d7920ef59865a Mon Sep 17 00:00:00 2001 +From: Jan Palus +Date: Tue, 30 Aug 2022 16:32:24 +0200 +Subject: [PATCH] cli/ls: sort entries just before listing (after filtering) + +fixes global entries order being broken after doing `ls -ut`. +"upgradable" listing overrides `ls_ents` and hence sort order +restoration operates on wrong array. observed broken beavior: + +- invoking: + (1) ls -u + (2) ls -ut + (3) ls -u + + should result in (1) and (3) being the same while in fact (2) and (3) + are the same + +- after invoking `ls -ut` package name completion is broken since it + uses binary search and therefore relies on correct order + +also doing `ls -u` might get marginally faster since it no longer needs +to sort all available packages, but only those which are upgradable. +--- + cli/ls.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cli/ls.c b/cli/ls.c +index 1808f43..5a94374 100644 +--- a/cli/ls.c ++++ b/cli/ls.c +@@ -368,9 +368,6 @@ static int ls(struct cmdctx *cmdctx) + goto l_end; + } + +- if ((cmpf = select_cmpf(cmdctx->_flags))) +- n_array_sort_ex(ls_ents, cmpf); +- + if (cmdctx->_flags & OPT_LS_UPGRADEABLE) { + tn_array *tmp; + +@@ -386,6 +383,9 @@ static int ls(struct cmdctx *cmdctx) + } + + if (n_array_size(ls_ents)) { ++ if ((cmpf = select_cmpf(cmdctx->_flags))) ++ n_array_sort_ex(ls_ents, cmpf); ++ + rc = do_ls(ls_ents, cmdctx, evrs); + + if (cmpf) +-- +2.37.2 +