- permit secondary tag match patterns with RPMQV_ALL.

CVS patchset: 6754
CVS date: 2003/04/16 22:13:18
This commit is contained in:
jbj 2003-04-16 22:13:18 +00:00
parent 27785211ad
commit f7aaeb11df
12 changed files with 99 additions and 68 deletions

View File

@ -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.

View File

@ -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 \

View File

@ -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))

View File

@ -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,

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -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

View File

@ -38,5 +38,5 @@ lint:
.PHONY: sources
sources:
@echo $(libfmagic_la_SOURCES:%=file/%)
@echo $(libfmagic_la_SOURCES:%=file/src/%)

View File

@ -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;

View File

@ -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;

View File

@ -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