FWIW, there's a need to search indices for a primary key generally,
not custom crafted crapola buried in the rpm implementation like what
I just checked in.
The issue is plain and simply meeting user expectations of error
messages.
(aside)
In fact, if lusers weren't already trained to expect rpm to report every
bleeping action or result, silence would be perfectly acceptable
behavior
for the primary key not found in index condition.
E.g, at least in English, a luser wants to see this error message for
a failed --whatconflicts or --triggeredby (perhaps imprecisely worded)
rpmlog(RPMLOG_NOTICE, _("no package conflicts with %s\n"), arg);
rpmlog(RPMLOG_NOTICE, _("no package triggers %s\n"), arg);
but all of requires/provides/obsoletes not found can be stated as
rpmlog(RPMLOG_NOTICE, _("no package requires %s\n"), arg);
rpmlog(RPMLOG_NOTICE, _("no package provides %s\n"), arg);
rpmlog(RPMLOG_NOTICE, _("no package obsoletes %s\n"), arg);
There's a slew of examples in lib/query.c of custom crafted crapola
that differs solely by the error message that is spewed if/when a
primary
key is not found in an index.
Most of that code could be collapsed into a generic "Do the usual
thing."
if someone could figure a phrasing that satisifes (at least English)
lusers.
I'm embarassed to say that I haven't been able to figure an acceptable
phrasing for a generic error message, and have largely given up.
But its silly to have boilerplate code that differs solely because of
an error
message imho.
Any suggestions which achieve consensus will be most gratefully received
and promptly checked into HEAD.
73 de Jeff
On Oct 14, 2008, at 6:03 PM, Jeff Johnson wrote:
> RPM Package Manager, CVS Repository
> http://rpm5.org/cvs/
>
> ______________________________________________________________________
> ______
>
> Server: rpm5.org Name: Jeff Johnson
> Root: /v/rpm/cvs Email: jbj@rpm5.org
> Module: rpm Date: 15-Oct-2008
> 00:03:53
> Branch: HEAD Handle: 2008101422035201
>
> Modified files:
> rpm CHANGES
> rpm/lib poptQV.c query.c rpmcli.h
>
> Log:
> - add --whatconflicts/--whatobsoletes, hidden for now.
>
> Summary:
> Revision Changes Path
> 1.2610 +1 -0 rpm/CHANGES
> 2.55 +10 -0 rpm/lib/poptQV.c
> 2.208 +22 -0 rpm/lib/query.c
> 2.90 +3 -1 rpm/lib/rpmcli.h
>
> ______________________________________________________________________
> ______
>
> patch -p0 <<'@@ .'
> Index: rpm/CHANGES
>
> ======================================================================
> ======
> $ cvs diff -u -r1.2609 -r1.2610 CHANGES
> --- rpm/CHANGES 14 Oct 2008 21:47:49 -0000 1.2609
> +++ rpm/CHANGES 14 Oct 2008 22:03:52 -0000 1.2610
> @@ -1,5 +1,6 @@
>
> 5.2a1 -> 5.2a2:
> + - jbj: add --whatconflicts/--whatobsoletes, hidden for now.
> - jbj: generate Obsoletename index.
> - jbj: use rpmdsMatch to detect rpmdb trigger firing.
> - jbj: add rpmdsMatch to match dependency against set.
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/lib/poptQV.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.54 -r2.55 poptQV.c
> --- rpm/lib/poptQV.c 31 Jul 2008 00:21:40 -0000 2.54
> +++ rpm/lib/poptQV.c 14 Oct 2008 22:03:52 -0000 2.55
> @@ -40,6 +40,8 @@
> #define POPT_WHATNEEDS -1038
> #define POPT_SPECSRPM -1039
> #define POPT_QUERYBYSOURCEPKGID -1040
> +#define POPT_WHATCONFLICTS -1041
> +#define POPT_WHATOBSOLETES -1042
>
> /* ========== Query/Verify/Signature source args */
> static void rpmQVSourceArgCallback( /*@unused@*/ poptContext con,
> @@ -76,6 +78,10 @@
> qva->qva_sourceCount++; break;
> case POPT_WHATREQUIRES: qva->qva_source |= RPMQV_WHATREQUIRES;
> qva->qva_sourceCount++; break;
> + case POPT_WHATCONFLICTS: qva->qva_source |=
> RPMQV_WHATCONFLICTS;
> + qva->qva_sourceCount++; break;
> + case POPT_WHATOBSOLETES: qva->qva_source |=
> RPMQV_WHATOBSOLETES;
> + qva->qva_sourceCount++; break;
> case POPT_TRIGGEREDBY: qva->qva_source |= RPMQV_TRIGGEREDBY;
> qva->qva_sourceCount++; break;
> case POPT_QUERYBYSOURCEPKGID: qva->qva_source |=
> RPMQV_SOURCEPKGID;
> @@ -166,6 +172,10 @@
>
> { "whatprovides", '\0', 0, NULL, POPT_WHATPROVIDES,
> N_("query/verify the package(s) which provide a dependency"),
> "CAPABILITY" },
> + { "whatconflicts", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL,
> POPT_WHATCONFLICTS,
> + N_("query/verify the package(s) which conflict with a
> dependency"), "CAPABILITY" },
> + { "whatobsoletes", '\0', POPT_ARGFLAG_DOC_HIDDEN, NULL,
> POPT_WHATOBSOLETES,
> + N_("query/verify the package(s) which obsolete a dependency"),
> "CAPABILITY" },
>
> { "transaction", 'T', POPT_BIT_SET|POPT_ARGFLAG_DOC_HIDDEN,
> &giFlags, (RPMGI_TSADD|RPMGI_TSORDER),
> N_("create transaction set"), NULL},
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/lib/query.c
>
> ======================================================================
> ======
> $ cvs diff -u -r2.207 -r2.208 query.c
> --- rpm/lib/query.c 2 Aug 2008 16:49:54 -0000 2.207
> +++ rpm/lib/query.c 14 Oct 2008 22:03:52 -0000 2.208
> @@ -396,6 +396,10 @@
> Header h;
> int rc;
>
> +#ifdef NOTYET /* XXX exiting here will leave stale locks. */
> + (void) rpmdbCheckSignals();
> +#endif
> +
> h = rpmgiHeader(gi);
> if (h == NULL) /* XXX perhaps stricter break instead? */
> continue;
> @@ -610,6 +614,24 @@
> res = rpmcliShowMatches(qva, ts);
> break;
>
> + case RPMQV_WHATCONFLICTS:
> + qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, arg, 0);
> + if (qva->qva_mi == NULL) {
> + rpmlog(RPMLOG_NOTICE, _("no package conflicts with %s\n"),
> arg);
> + res = 1;
> + } else
> + res = rpmcliShowMatches(qva, ts);
> + break;
> +
> + case RPMQV_WHATOBSOLETES:
> + qva->qva_mi = rpmtsInitIterator(ts, RPMTAG_OBSOLETENAME, arg, 0);
> + if (qva->qva_mi == NULL) {
> + rpmlog(RPMLOG_NOTICE, _("no package obsoletes %s\n"), arg);
> + res = 1;
> + } else
> + res = rpmcliShowMatches(qva, ts);
> + break;
> +
> case RPMQV_WHATPROVIDES:
> if (arg[0] != '/') {
> provides_checked = 1;
> @@ .
> patch -p0 <<'@@ .'
> Index: rpm/lib/rpmcli.h
>
> ======================================================================
> ======
> $ cvs diff -u -r2.89 -r2.90 rpmcli.h
> --- rpm/lib/rpmcli.h 2 Aug 2008 17:56:47 -0000 2.89
> +++ rpm/lib/rpmcli.h 14 Oct 2008 22:03:53 -0000 2.90
> @@ -127,7 +127,9 @@
> RPMQV_FTSWALK, /*!< ... from fts(3) walk. */
> RPMQV_WHATNEEDS, /*!< ... from requires using contained
> provides. */
> RPMQV_SPECSRPM, /*!< ... srpm from spec file parse (query
> only). */
> - RPMQV_SOURCEPKGID /*!< ... from source package id (header
> +payload MD5). */
> + RPMQV_SOURCEPKGID, /*!< ... from source package id (header
> +payload MD5). */
> + RPMQV_WHATCONFLICTS,/*!< ... from conflicts db search. */
> + RPMQV_WHATOBSOLETES /*!< ... from obsoletes db search. */
> } rpmQVSources;
>
> /** \ingroup rpmcli
> @@ .
> ______________________________________________________________________
> RPM Package Manager http://rpm5.org
> CVS Sources Repository rpm-cvs@rpm5.org
Received on Wed Oct 15 00:24:17 2008