diff options
author | jbj <devnull@localhost> | 2003-04-16 22:13:18 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2003-04-16 22:13:18 +0000 |
commit | f7aaeb11df0bdbdffd6916ca083d0d8be4afb253 (patch) | |
tree | 853570d599566450a065ab5cd9f91bf39c71f1a3 | |
parent | 27785211ad035c1f5e36628771ca4f4b8cd017f5 (diff) | |
download | librpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.tar.gz librpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.tar.bz2 librpm-tizen-f7aaeb11df0bdbdffd6916ca083d0d8be4afb253.zip |
- permit secondary tag match patterns with RPMQV_ALL.
CVS patchset: 6754
CVS date: 2003/04/16 22:13:18
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | Doxyfile.in | 22 | ||||
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | build/expression.c | 18 | ||||
-rw-r--r-- | build/files.c | 32 | ||||
-rw-r--r-- | build/parseDescription.c | 34 | ||||
-rw-r--r-- | build/rpmbuild.h | 5 | ||||
-rw-r--r-- | configure.ac | 7 | ||||
-rw-r--r-- | file/src/Makefile.am | 2 | ||||
-rw-r--r-- | file/src/print.c | 2 | ||||
-rw-r--r-- | lib/query.c | 28 | ||||
-rw-r--r-- | system.h | 14 |
12 files changed, 99 insertions, 68 deletions
@@ -6,6 +6,7 @@ - fix: short option help missing string terminator. - unify signal handling in librpmio, use condvar to deliver signal. - resurrect manifests, RPMRC_NOTFOUND returned by readLead(). + - permit secondary tag match patterns with RPMQV_ALL. 4.1 -> 4.2: - set cachesize without a dbenv, the default is far too small. diff --git a/Doxyfile.in b/Doxyfile.in index 9146b352f..84d90a3d7 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -431,16 +431,18 @@ INPUT = \ @top_srcdir@/doc/manual/spec \ @top_srcdir@/doc/manual/triggers \ @top_srcdir@/doc/manual/tsort \ - @top_srcdir@/file/apprentice.c \ - @top_srcdir@/file/ascmagic.c \ - @top_srcdir@/file/compress.c \ - @top_srcdir@/file/file.c \ - @top_srcdir@/file/file.h \ - @top_srcdir@/file/fsmagic.c \ - @top_srcdir@/file/print.c \ - @top_srcdir@/file/readelf.c \ - @top_srcdir@/file/readelf.h \ - @top_srcdir@/file/softmagic.c \ + @top_srcdir@/file/src/apprentice.c \ + @top_srcdir@/file/src/ascmagic.c \ + @top_srcdir@/file/src/compress.c \ + @top_srcdir@/file/src/file.c \ + @top_srcdir@/file/src/file.h \ + @top_srcdir@/file/src/fsmagic.c \ + @top_srcdir@/file/src/names.h \ + @top_srcdir@/file/src/print.c \ + @top_srcdir@/file/src/readelf.c \ + @top_srcdir@/file/src/readelf.h \ + @top_srcdir@/file/src/softmagic.c \ + @top_srcdir@/file/src/tar.h \ @top_srcdir@/lib/cpio.c \ @top_srcdir@/lib/cpio.h \ @top_srcdir@/lib/depends.c \ diff --git a/Makefile.am b/Makefile.am index 3e6ca76f8..ac040328c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -116,7 +116,7 @@ lint: `make -s sources -C rpmdb` \ `make -s sources -C rpmio` \ `make -s sources -C beecrypt` \ - `make -s sources -C file` \ + `make -s sources -C file/src` \ `make -s sources -C popt` CVSTAG = r$(subst .,-,$(VERSION)) diff --git a/build/expression.c b/build/expression.c index 5ba366984..84400d41f 100644 --- a/build/expression.c +++ b/build/expression.c @@ -101,11 +101,14 @@ static void valueDump(const char *msg, Value v, FILE *fp) * Parser state. */ typedef struct _parseState { - /*@owned@*/ char *str; /*!< expression string */ - /*@dependent@*/ char *p; /*!< current position in expression string */ - int nextToken; /*!< current lookahead token */ - Value tokenValue; /*!< valid when TOK_INTEGER or TOK_STRING */ - Spec spec; /*!< spec file that we are parsing inside of */ +/*@owned@*/ + char *str; /*!< expression string */ +/*@dependent@*/ + char *p; /*!< current position in expression string */ + int nextToken; /*!< current lookahead token */ +/*@relnull@*/ + Value tokenValue; /*!< valid when TOK_INTEGER or TOK_STRING */ + Spec spec; /*!< spec file that we are parsing inside of */ } *ParseState; @@ -320,6 +323,7 @@ static int rdToken(ParseState state) } /*@=boundswrite@*/ +/*@null@*/ static Value doLogical(ParseState state) /*@globals rpmGlobalMacroContext @*/ /*@modifies state->nextToken, state->p, state->tokenValue, @@ -328,6 +332,7 @@ static Value doLogical(ParseState state) /** * @param state expression parser state */ +/*@null@*/ static Value doPrimary(ParseState state) /*@globals rpmGlobalMacroContext @*/ /*@modifies state->nextToken, state->p, state->tokenValue, @@ -409,6 +414,7 @@ static Value doPrimary(ParseState state) /** * @param state expression parser state */ +/*@null@*/ static Value doMultiplyDivide(ParseState state) /*@globals rpmGlobalMacroContext @*/ /*@modifies state->nextToken, state->p, state->tokenValue, @@ -464,6 +470,7 @@ static Value doMultiplyDivide(ParseState state) * @param state expression parser state */ /*@-boundswrite@*/ +/*@null@*/ static Value doAddSubtract(ParseState state) /*@globals rpmGlobalMacroContext @*/ /*@modifies state->nextToken, state->p, state->tokenValue, @@ -528,6 +535,7 @@ static Value doAddSubtract(ParseState state) /** * @param state expression parser state */ +/*@null@*/ static Value doRelational(ParseState state) /*@globals rpmGlobalMacroContext @*/ /*@modifies state->nextToken, state->p, state->tokenValue, diff --git a/build/files.c b/build/files.c index 64764c31f..bb3f5c412 100644 --- a/build/files.c +++ b/build/files.c @@ -207,43 +207,27 @@ static void dumpAttrRec(const char * msg, AttrRec ar) } #endif -/* strtokWithQuotes() modified from glibc strtok() */ -/* Copyright (C) 1991, 1996 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If - not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - /** + * @param s + * @param delim */ /*@-boundswrite@*/ -static char *strtokWithQuotes(char *s, char *delim) +/*@null@*/ +static char *strtokWithQuotes(/*@null@*/ char *s, char *delim) /*@modifies *s @*/ { static char *olds = NULL; char *token; - if (s == NULL) { + if (s == NULL) s = olds; - } + if (s == NULL) + return NULL; /* Skip leading delimiters */ s += strspn(s, delim); - if (*s == '\0') { + if (*s == '\0') return NULL; - } /* Find the end of the token. */ token = s; diff --git a/build/parseDescription.c b/build/parseDescription.c index bd0b37301..e76666b36 100644 --- a/build/parseDescription.c +++ b/build/parseDescription.c @@ -27,8 +27,10 @@ extern int noLang; }; int parseDescription(Spec spec) + /*@globals name, lang @*/ + /*@modifies name, lang @*/ { - int nextPart; + int nextPart = RPMERR_BADSPEC; /* assume error */ StringBuf sb; int flag = PART_SUBNAME; Package pkg; @@ -38,10 +40,8 @@ int parseDescription(Spec spec) poptContext optCon = NULL; spectag t = NULL; - /*@-mods@*/ name = NULL; lang = RPMBUILD_DEFAULT_LANG; - /*@=mods@*/ if ((rc = poptParseArgvString(spec->line, &argc, &argv))) { rpmError(RPMERR_BADSPEC, _("line %d: Error parsing %%description: %s\n"), @@ -61,32 +61,24 @@ int parseDescription(Spec spec) spec->lineNum, poptBadOption(optCon, POPT_BADOPTION_NOALIAS), spec->line); - argv = _free(argv); - optCon = poptFreeContext(optCon); - return RPMERR_BADSPEC; + goto exit; } if (poptPeekArg(optCon)) { - /*@-mods@*/ if (name == NULL) name = poptGetArg(optCon); - /*@=mods@*/ if (poptPeekArg(optCon)) { rpmError(RPMERR_BADSPEC, _("line %d: Too many names: %s\n"), spec->lineNum, spec->line); - argv = _free(argv); - optCon = poptFreeContext(optCon); - return RPMERR_BADSPEC; + goto exit; } } if (lookupPackage(spec, name, flag, &pkg)) { rpmError(RPMERR_BADSPEC, _("line %d: Package does not exist: %s\n"), spec->lineNum, spec->line); - argv = _free(argv); - optCon = poptFreeContext(optCon); - return RPMERR_BADSPEC; + goto exit; } @@ -96,9 +88,7 @@ int parseDescription(Spec spec) if (headerIsEntry(pkg->header, RPMTAG_DESCRIPTION)) { rpmError(RPMERR_BADSPEC, _("line %d: Second description\n"), spec->lineNum); - argv = _free(argv); - optCon = poptFreeContext(optCon); - return RPMERR_BADSPEC; + goto exit; } #endif @@ -110,18 +100,20 @@ int parseDescription(Spec spec) nextPart = PART_NONE; } else { if (rc) { - return rc; + nextPart = RPMERR_BADSPEC; + goto exit; } while (! (nextPart = isPart(spec->line))) { appendLineStringBuf(sb, spec->line); if (t) t->t_nlines++; if ((rc = - readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) { + readLine(spec, STRIP_TRAILINGSPACE | STRIP_COMMENTS)) > 0) { nextPart = PART_NONE; break; } if (rc) { - return rc; + nextPart = RPMERR_BADSPEC; + goto exit; } } } @@ -134,8 +126,8 @@ int parseDescription(Spec spec) sb = freeStringBuf(sb); +exit: argv = _free(argv); optCon = poptFreeContext(optCon); - return nextPart; } diff --git a/build/rpmbuild.h b/build/rpmbuild.h index 9a224e3ca..b4070f46d 100644 --- a/build/rpmbuild.h +++ b/build/rpmbuild.h @@ -328,7 +328,7 @@ int parseExpressionBoolean(Spec spec, const char * expr) * @param expr expression to parse * @return */ -/*@unused@*/ +/*@unused@*/ /*@null@*/ char * parseExpressionString(Spec spec, const char * expr) /*@globals rpmGlobalMacroContext @*/ /*@modifies rpmGlobalMacroContext @*/; @@ -343,7 +343,8 @@ char * parseExpressionString(Spec spec, const char * expr) * @param test don't execute scripts or package if testing * @return 0 on success, RPMERR_SCRIPT on failure */ -int doScript(Spec spec, int what, const char * name, StringBuf sb, int test) +int doScript(Spec spec, int what, /*@null@*/ const char * name, + /*@null@*/ StringBuf sb, int test) /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ /*@modifies spec->macros, diff --git a/configure.ac b/configure.ac index c0cda9053..e26337d26 100644 --- a/configure.ac +++ b/configure.ac @@ -425,6 +425,8 @@ AC_CHECK_FUNC(socket, [], [ AC_CHECK_LIB(socket, socket) ]) +AC_CHECK_HEADERS(error.h) +AC_CHECK_FUNCS(error) AC_CHECK_HEADERS(thread.h pthread.h synch.h semaphore.h) AC_CHECK_LIB(pthread, pthread_mutex_trylock, [], [ @@ -764,8 +766,11 @@ AC_TRY_LINK([#include <time.h>],printf("%ld", timezone), AC_MSG_RESULT($HAS_TIMEZONE) dnl Check for missing typedefs -AC_TYPE_MODE_T +AC_TYPE_OFF_T AC_TYPE_PID_T +AC_TYPE_MODE_T +AC_TYPE_SIZE_T +AC_STRUCT_ST_RDEV dnl Checks for library functions. AC_FUNC_ALLOCA diff --git a/file/src/Makefile.am b/file/src/Makefile.am index 87afb36e9..f131e8d73 100644 --- a/file/src/Makefile.am +++ b/file/src/Makefile.am @@ -38,5 +38,5 @@ lint: .PHONY: sources sources: - @echo $(libfmagic_la_SOURCES:%=file/%) + @echo $(libfmagic_la_SOURCES:%=file/src/%) diff --git a/file/src/print.c b/file/src/print.c index 0bc005454..93ecc0337 100644 --- a/file/src/print.c +++ b/file/src/print.c @@ -212,7 +212,7 @@ file_fmttime(uint32_t v, int local) if (local) { pp = ctime(&t); } else { -#ifndef HAVE_DAYLIGHT +#ifndef HAVE_DAYLIGHT && !defined(__LCLINT__) static int daylight = 0; #ifdef HAVE_TM_ISDST static time_t now = (time_t)0; diff --git a/lib/query.c b/lib/query.c index c8102dc5c..767182fc3 100644 --- a/lib/query.c +++ b/lib/query.c @@ -518,9 +518,33 @@ restart: res = 1; } else { if (arg != NULL) - for (av = (const char **) arg; *av; av++) { - if (!rpmdbSetIteratorRE(qva->qva_mi, RPMTAG_NAME, RPMMIRE_DEFAULT, *av)) + for (av = (const char **) arg; *av != NULL; av++) { + int tag = RPMTAG_NAME; + const char * pat; + char * a, * ae; + + pat = a = xstrdup(*av); + tag = RPMTAG_NAME; + + /* Parse for "tag=pattern" args. */ + if ((ae = strchr(a, '=')) != NULL) { + *ae++ = '\0'; + tag = tagValue(a); + if (tag < 0) { + rpmError(RPMERR_QUERYINFO, + _("unknown tag: \"%s\"\n"), a); + res = 1; + } + pat = ae; + } + + if (!res) + res = rpmdbSetIteratorRE(qva->qva_mi, tag, RPMMIRE_DEFAULT, pat); + a = _free(a); + + if (res == 0) continue; + qva->qva_mi = rpmdbFreeIterator(qva->qva_mi); res = 1; /*@loopbreak@*/ break; @@ -109,6 +109,20 @@ extern int errno; /*@=declundef @*/ #endif +#if defined(__LCLINT__) +/*@-declundef @*/ +/*@exits@*/ +extern void error(int status, int errnum, const char *format, ...) + __attribute__ ((__format__ (__printf__, 3, 4))) + /*@globals fileSystem @*/ + /*@modifies fileSystem @*/; +/*@=declundef @*/ +#else +#if HAVE_ERROR && HAVE_ERROR_H +#include <error.h> +#endif +#endif + #ifdef STDC_HEADERS /*@-macrounrecog -incondefs -globuse -mustmod @*/ /* FIX: shrug */ #define getopt system_getopt |