diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-12-01 17:15:18 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-12-01 17:15:18 +0200 |
commit | 534f512002d0a0d1148cdb225e190da352f60ad7 (patch) | |
tree | 7754b857a3d738f8feac62f40956b4b46c55dd86 /build/parseReqs.c | |
parent | 449f6c4bea509c2ce86761974053ca7e5571f980 (diff) | |
download | librpm-tizen-534f512002d0a0d1148cdb225e190da352f60ad7.tar.gz librpm-tizen-534f512002d0a0d1148cdb225e190da352f60ad7.tar.bz2 librpm-tizen-534f512002d0a0d1148cdb225e190da352f60ad7.zip |
Fix bogus error reporting from autogenerated dependencies (ticket #181)
- Automatically generated dependencies do not relate to spec lines,
use different error reporting for manually vs automatically added
dependencies.
Diffstat (limited to 'build/parseReqs.c')
-rw-r--r-- | build/parseReqs.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/build/parseReqs.c b/build/parseReqs.c index 6fe773a6c..8ffb3ed6a 100644 --- a/build/parseReqs.c +++ b/build/parseReqs.c @@ -39,6 +39,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, int index, rpmsenseFlags tagflags) { const char *r, *re, *v, *ve; + const char *emsg = NULL; char * N = NULL, * EVR = NULL; rpmTagVal nametag = RPMTAG_NOT_FOUND; rpmsenseFlags Flags; @@ -105,9 +106,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, * the spec's encoding so we only check what we can: plain ascii. */ if (isascii(r[0]) && !(risalnum(r[0]) || r[0] == '_' || r[0] == '/')) { - rpmlog(RPMLOG_ERR, - _("line %d: Dependency tokens must begin with alpha-numeric, '_' or '/': %s\n"), - spec->lineNum, spec->line); + emsg = _("Dependency tokens must begin with alpha-numeric, '_' or '/'"); goto exit; } @@ -132,9 +131,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, continue; if (r[0] == '/') { - rpmlog(RPMLOG_ERR, - _("line %d: Versioned file name not permitted: %s\n"), - spec->lineNum, spec->line); + emsg = _("Versioned file name not permitted"); goto exit; } @@ -163,8 +160,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, if (Flags & RPMSENSE_SENSEMASK) { if (*v == '\0' || ve == v) { - rpmlog(RPMLOG_ERR, _("line %d: Version required: %s\n"), - spec->lineNum, spec->line); + emsg = _("Version required"); goto exit; } EVR = xmalloc((ve-v) + 1); @@ -175,8 +171,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, EVR = NULL; if (addReqProv(h, nametag, N, EVR, Flags, index)) { - rpmlog(RPMLOG_ERR, _("line %d: invalid dependency: %s\n"), - spec->lineNum, spec->line); + emsg = _("invalid dependency"); goto exit; } @@ -187,6 +182,15 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN, rc = RPMRC_OK; exit: + if (emsg) { + /* Automatic dependencies don't relate to spec lines */ + if (tagflags & (RPMSENSE_FIND_REQUIRES|RPMSENSE_FIND_PROVIDES)) { + rpmlog(RPMLOG_ERR, "%s: %s\n", emsg, r); + } else { + rpmlog(RPMLOG_ERR, _("line %d: %s: %s\n"), + spec->lineNum, emsg, spec->line); + } + } free(N); free(EVR); |