diff options
author | jbj <devnull@localhost> | 2001-06-17 22:18:03 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2001-06-17 22:18:03 +0000 |
commit | 29ea1567e7eafc457aed5529b240161cf8d4657f (patch) | |
tree | a791a4344419b7b942fd4d755d25a3a6b4c4e5a3 | |
parent | c32276cdf5c28d7d701d7211e55f28ebc6f097d7 (diff) | |
download | librpm-tizen-29ea1567e7eafc457aed5529b240161cf8d4657f.tar.gz librpm-tizen-29ea1567e7eafc457aed5529b240161cf8d4657f.tar.bz2 librpm-tizen-29ea1567e7eafc457aed5529b240161cf8d4657f.zip |
Sync with rpm-4_0 branch.
CVS patchset: 4876
CVS date: 2001/06/17 22:18:03
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | Doxyfile.in | 293 | ||||
-rw-r--r-- | lib/Makefile.am | 6 | ||||
-rw-r--r-- | lib/depends.c | 4 | ||||
-rw-r--r-- | lib/header.c | 241 | ||||
-rw-r--r-- | lib/header.h | 28 | ||||
-rw-r--r-- | lib/header_internal.c | 128 | ||||
-rw-r--r-- | lib/header_internal.h | 127 | ||||
-rw-r--r-- | lib/misc.c | 112 | ||||
-rw-r--r-- | lib/misc.h | 7 | ||||
-rw-r--r-- | lib/rpmcli.h | 6 | ||||
-rw-r--r-- | lib/rpminstall.c | 2 | ||||
-rw-r--r-- | lib/rpmlib.h | 36 | ||||
-rw-r--r-- | lib/rpmvercmp.c | 103 | ||||
-rw-r--r-- | lib/signature.c | 4 | ||||
-rw-r--r-- | lib/transaction.c | 2 | ||||
-rw-r--r-- | lib/verify.c | 2 | ||||
-rw-r--r-- | macros.in | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | python/rpmmodule.c | 2 | ||||
-rw-r--r-- | rpm2cpio.c | 26 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 6 | ||||
-rw-r--r-- | rpmio/rpmio.h | 6 | ||||
-rw-r--r-- | rpmio/rpmurl.h | 6 | ||||
-rw-r--r-- | tools/dump.c | 10 | ||||
-rw-r--r-- | tools/dumpdb.c | 9 | ||||
-rw-r--r-- | tools/rpmarchive.c | 5 | ||||
-rw-r--r-- | tools/rpmheader.c | 5 | ||||
-rw-r--r-- | tools/rpmlead.c | 3 | ||||
-rw-r--r-- | tools/rpmsignature.c | 3 |
30 files changed, 604 insertions, 585 deletions
@@ -117,6 +117,7 @@ - popt: add POPT_CONTEXT_ARG_OPTS for all opts to return 1 (#30912). - fix: fsm reads/writes now return error on partial I/O. - fix: Ferror returned spurious error for gzdio/bzdio. + - check for API/ABI creep, diddle up some compatibility. 4.0 -> 4.0.[12] - add doxygen and lclint annotations most everywhere. diff --git a/Doxyfile.in b/Doxyfile.in index bfa2d1369..380ed09e1 100644 --- a/Doxyfile.in +++ b/Doxyfile.in @@ -104,7 +104,7 @@ FULL_PATH_NAMES = YES # only done if one of the specified strings matches the left-hand part of # the path. It is allowed to use relative paths in the argument list. -STRIP_FROM_PATH = @top_sourcedir@/ +STRIP_FROM_PATH = @top_srcdir@/ # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set @@ -304,149 +304,152 @@ WARN_LOGFILE = # with spaces. INPUT = \ - ./Doxyheader \ - ./build.c \ - ./build.h \ - ./config.h \ - ./debug.h \ - ./macros \ - ./rpmqv.c \ - ./rpmpopt-@VERSION@ \ - ./rpmrc \ - ./rpm2cpio.c \ - ./system.h \ - ./build/build.c \ - ./build/buildio.h \ - ./build/expression.c \ - ./build/files.c \ - ./build/misc.c \ - ./build/myftw.c \ - ./build/myftw.h \ - ./build/names.c \ - ./build/pack.c \ - ./build/parseBuildInstallClean.c \ - ./build/parseChangelog.c \ - ./build/parseDescription.c \ - ./build/parseFiles.c \ - ./build/parsePreamble.c \ - ./build/parsePrep.c \ - ./build/parseReqs.c \ - ./build/parseScript.c \ - ./build/parseSpec.c \ - ./build/reqprov.c \ - ./build/rpmbuild.h \ - ./build/rpmspec.h \ - ./build/spec.c \ - ./doc/manual/builddependencies \ - ./doc/manual/buildroot \ - ./doc/manual/conditionalbuilds \ - ./doc/manual/dependencies \ - ./doc/manual/format \ - ./doc/manual/hregions \ - ./doc/manual/macros \ - ./doc/manual/multiplebuilds \ - ./doc/manual/queryformat \ - ./doc/manual/signatures \ - ./doc/manual/relocatable \ - ./doc/manual/spec \ - ./doc/manual/triggers \ - ./doc/manual/tsort \ - ./lib/cpio.c \ - ./lib/cpio.h \ - ./lib/depends.c \ - ./lib/depends.h \ - ./lib/formats.c \ - ./lib/fs.c \ - ./lib/fsm.c \ - ./lib/fsm.h \ - ./lib/header.c \ - ./lib/header.h \ - ./lib/manifest.c \ - ./lib/manifest.h \ - ./lib/md5.c \ - ./lib/md5.h \ - ./lib/md5sum.c \ - ./lib/misc.c \ - ./lib/misc.h \ - ./lib/package.c \ - ./lib/poptBT.c \ - ./lib/poptI.c \ - ./lib/poptK.c \ - ./lib/poptQV.c \ - ./lib/problems.c \ - ./lib/psm.c \ - ./lib/psm.h \ - ./lib/query.c \ - ./lib/rpmchecksig.c \ - ./lib/rpmcli.h \ - ./lib/rpminstall.c \ - ./lib/rpmlead.c \ - ./lib/rpmlead.h \ - ./lib/rpmlib.h \ - ./lib/rpmlibprov.c \ - ./lib/rpmrc.c \ - ./lib/signature.c \ - ./lib/signature.h \ - ./lib/stringbuf.c \ - ./lib/stringbuf.h \ - ./lib/tagName.c \ - ./lib/tagtable.c \ - ./lib/transaction.c \ - ./lib/verify.c \ - ./rpmdb/db1.c \ - ./rpmdb/db3.c \ - ./rpmdb/dbconfig.c \ - ./rpmdb/falloc.c \ - ./rpmdb/falloc.h \ - ./rpmdb/fprint.c \ - ./rpmdb/fprint.h \ - ./rpmdb/poptDB.c \ - ./rpmdb/rpmhash.c \ - ./rpmdb/rpmhash.h \ - ./rpmdb/rpmdb.c \ - ./rpmdb/rpmdb.h \ - ./rpmio/base64.c \ - ./rpmio/base64.h \ - ./rpmio/digest.c \ - ./rpmio/macro.c \ - ./rpmio/rpmlog.c \ - ./rpmio/rpmerr.h \ - ./rpmio/rpmio.c \ - ./rpmio/rpmio.h \ - ./rpmio/rpmio_internal.h \ - ./rpmio/rpmio_api.c \ - ./rpmio/rpmmacro.h \ - ./rpmio/rpmmalloc.c \ - ./rpmio/rpmmessages.h \ - ./rpmio/rpmrpc.c \ - ./rpmio/rpmurl.h \ - ./rpmio/strcasecmp.c \ - ./rpmio/stubs.c \ - ./rpmio/ugid.c \ - ./rpmio/ugid.h \ - ./rpmio/url.c \ - ./popt/findme.c \ - ./popt/findme.h \ - ./popt/popt.c \ - ./popt/popt.h \ - ./popt/poptconfig.c \ - ./popt/popthelp.c \ - ./popt/poptint.h \ - ./popt/poptparse.c \ - ./python/hash.c \ - ./python/hash.h \ - ./python/rpmmodule.c \ - ./python/upgrade.c \ - ./python/upgrade.h \ - ./tools/dump.c \ - ./tools/dumpdb.c \ - ./tools/javadeps.c \ - ./tools/rpmarchive.c \ - ./tools/rpmchecksig.c \ - ./tools/rpmheader.c \ - ./tools/rpminject.c \ - ./tools/rpmlead.c \ - ./tools/rpmsignature.c + @top_srcdir@/Doxyheader \ + @top_srcdir@/build.c \ + @top_srcdir@/build.h \ + @top_srcdir@/config.h \ + @top_srcdir@/debug.h \ + @top_srcdir@/macros \ + @top_srcdir@/rpmqv.c \ + @top_srcdir@/rpmpopt-@VERSION@ \ + @top_srcdir@/rpmrc \ + @top_srcdir@/rpm2cpio.c \ + @top_srcdir@/system.h \ + @top_srcdir@/build/build.c \ + @top_srcdir@/build/buildio.h \ + @top_srcdir@/build/expression.c \ + @top_srcdir@/build/files.c \ + @top_srcdir@/build/misc.c \ + @top_srcdir@/build/myftw.c \ + @top_srcdir@/build/myftw.h \ + @top_srcdir@/build/names.c \ + @top_srcdir@/build/pack.c \ + @top_srcdir@/build/parseBuildInstallClean.c \ + @top_srcdir@/build/parseChangelog.c \ + @top_srcdir@/build/parseDescription.c \ + @top_srcdir@/build/parseFiles.c \ + @top_srcdir@/build/parsePreamble.c \ + @top_srcdir@/build/parsePrep.c \ + @top_srcdir@/build/parseReqs.c \ + @top_srcdir@/build/parseScript.c \ + @top_srcdir@/build/parseSpec.c \ + @top_srcdir@/build/reqprov.c \ + @top_srcdir@/build/rpmbuild.h \ + @top_srcdir@/build/rpmspec.h \ + @top_srcdir@/build/spec.c \ + @top_srcdir@/doc/manual/builddependencies \ + @top_srcdir@/doc/manual/buildroot \ + @top_srcdir@/doc/manual/conditionalbuilds \ + @top_srcdir@/doc/manual/dependencies \ + @top_srcdir@/doc/manual/format \ + @top_srcdir@/doc/manual/hregions \ + @top_srcdir@/doc/manual/macros \ + @top_srcdir@/doc/manual/multiplebuilds \ + @top_srcdir@/doc/manual/queryformat \ + @top_srcdir@/doc/manual/signatures \ + @top_srcdir@/doc/manual/relocatable \ + @top_srcdir@/doc/manual/spec \ + @top_srcdir@/doc/manual/triggers \ + @top_srcdir@/doc/manual/tsort \ + @top_srcdir@/lib/cpio.c \ + @top_srcdir@/lib/cpio.h \ + @top_srcdir@/lib/depends.c \ + @top_srcdir@/lib/depends.h \ + @top_srcdir@/lib/formats.c \ + @top_srcdir@/lib/fs.c \ + @top_srcdir@/lib/fsm.c \ + @top_srcdir@/lib/fsm.h \ + @top_srcdir@/lib/header.c \ + @top_srcdir@/lib/header.h \ + @top_srcdir@/lib/header_internal.c \ + @top_srcdir@/lib/header_internal.h \ + @top_srcdir@/lib/manifest.c \ + @top_srcdir@/lib/manifest.h \ + @top_srcdir@/lib/md5.c \ + @top_srcdir@/lib/md5.h \ + @top_srcdir@/lib/md5sum.c \ + @top_srcdir@/lib/misc.c \ + @top_srcdir@/lib/misc.h \ + @top_srcdir@/lib/package.c \ + @top_srcdir@/lib/poptBT.c \ + @top_srcdir@/lib/poptI.c \ + @top_srcdir@/lib/poptK.c \ + @top_srcdir@/lib/poptQV.c \ + @top_srcdir@/lib/problems.c \ + @top_srcdir@/lib/psm.c \ + @top_srcdir@/lib/psm.h \ + @top_srcdir@/lib/query.c \ + @top_srcdir@/lib/rpmchecksig.c \ + @top_srcdir@/lib/rpmcli.h \ + @top_srcdir@/lib/rpminstall.c \ + @top_srcdir@/lib/rpmlead.c \ + @top_srcdir@/lib/rpmlead.h \ + @top_srcdir@/lib/rpmlib.h \ + @top_srcdir@/lib/rpmlibprov.c \ + @top_srcdir@/lib/rpmrc.c \ + @top_srcdir@/lib/rpmvercmp.c \ + @top_srcdir@/lib/signature.c \ + @top_srcdir@/lib/signature.h \ + @top_srcdir@/lib/stringbuf.c \ + @top_srcdir@/lib/stringbuf.h \ + @top_srcdir@/lib/tagName.c \ + @top_srcdir@/lib/tagtable.c \ + @top_srcdir@/lib/transaction.c \ + @top_srcdir@/lib/verify.c \ + @top_srcdir@/rpmdb/db1.c \ + @top_srcdir@/rpmdb/db3.c \ + @top_srcdir@/rpmdb/dbconfig.c \ + @top_srcdir@/rpmdb/falloc.c \ + @top_srcdir@/rpmdb/falloc.h \ + @top_srcdir@/rpmdb/fprint.c \ + @top_srcdir@/rpmdb/fprint.h \ + @top_srcdir@/rpmdb/poptDB.c \ + @top_srcdir@/rpmdb/rpmhash.c \ + @top_srcdir@/rpmdb/rpmhash.h \ + @top_srcdir@/rpmdb/rpmdb.c \ + @top_srcdir@/rpmdb/rpmdb.h \ + @top_srcdir@/rpmio/base64.c \ + @top_srcdir@/rpmio/base64.h \ + @top_srcdir@/rpmio/digest.c \ + @top_srcdir@/rpmio/macro.c \ + @top_srcdir@/rpmio/rpmlog.c \ + @top_srcdir@/rpmio/rpmerr.h \ + @top_srcdir@/rpmio/rpmio.c \ + @top_srcdir@/rpmio/rpmio.h \ + @top_srcdir@/rpmio/rpmio_internal.h \ + @top_srcdir@/rpmio/rpmio_api.c \ + @top_srcdir@/rpmio/rpmmacro.h \ + @top_srcdir@/rpmio/rpmmalloc.c \ + @top_srcdir@/rpmio/rpmmessages.h \ + @top_srcdir@/rpmio/rpmrpc.c \ + @top_srcdir@/rpmio/rpmurl.h \ + @top_srcdir@/rpmio/strcasecmp.c \ + @top_srcdir@/rpmio/stubs.c \ + @top_srcdir@/rpmio/ugid.c \ + @top_srcdir@/rpmio/ugid.h \ + @top_srcdir@/rpmio/url.c \ + @top_srcdir@/popt/findme.c \ + @top_srcdir@/popt/findme.h \ + @top_srcdir@/popt/popt.c \ + @top_srcdir@/popt/popt.h \ + @top_srcdir@/popt/poptconfig.c \ + @top_srcdir@/popt/popthelp.c \ + @top_srcdir@/popt/poptint.h \ + @top_srcdir@/popt/poptparse.c \ + @top_srcdir@/python/hash.c \ + @top_srcdir@/python/hash.h \ + @top_srcdir@/python/rpmmodule.c \ + @top_srcdir@/python/upgrade.c \ + @top_srcdir@/python/upgrade.h \ + @top_srcdir@/tools/dump.c \ + @top_srcdir@/tools/dumpdb.c \ + @top_srcdir@/tools/javadeps.c \ + @top_srcdir@/tools/rpmarchive.c \ + @top_srcdir@/tools/rpmchecksig.c \ + @top_srcdir@/tools/rpmheader.c \ + @top_srcdir@/tools/rpminject.c \ + @top_srcdir@/tools/rpmlead.c \ + @top_srcdir@/tools/rpmsignature.c # If the value of the INPUT tag contains directories, you can use the # FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp @@ -477,7 +480,7 @@ EXCLUDE_PATTERNS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = @top_sourcedir@/doc/manual +EXAMPLE_PATH = @top_srcdir@/doc/manual # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/lib/Makefile.am b/lib/Makefile.am index f442f9879..245883c49 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -16,7 +16,7 @@ pkgincdir = $(pkgincludedir) pkginc_HEADERS = \ header.h misc.h rpmcli.h rpmlib.h stringbuf.h noinst_HEADERS = \ - cpio.h depends.h fsm.h \ + cpio.h depends.h fsm.h header_internal.h \ manifest.h md5.h psm.h \ rpmlead.h signature.h @@ -32,9 +32,9 @@ LIBS = lib_LTLIBRARIES = librpm.la librpm_la_SOURCES = \ cpio.c depends.c formats.c fs.c fsm.c getdate.c \ - header.c manifest.c md5.c md5sum.c misc.c package.c \ + header.c header_internal.c manifest.c md5.c md5sum.c misc.c package.c \ problems.c poptBT.c poptI.c poptK.c poptQV.c psm.c query.c \ - rpmchecksig.c rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c \ + rpmchecksig.c rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c rpmvercmp.c \ signature.c stringbuf.c tagName.c tagtable.c transaction.c \ verify.c diff --git a/lib/depends.c b/lib/depends.c index dd4917be7..44e33b7cb 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -11,8 +11,8 @@ #include <rpmlib.h> #include "depends.h" -#include "rpmdb.h" -#include "misc.h" +#include "rpmdb.h" /* XXX response cache needs dbiOpen et al. */ + #include "debug.h" /*@access dbiIndex@*/ /* XXX compared with NULL */ diff --git a/lib/header.c b/lib/header.c index 5a1c5ee95..3237a9d4e 100644 --- a/lib/header.c +++ b/lib/header.c @@ -14,11 +14,7 @@ #include "system.h" -#if !defined(__LCLINT__) -#include <netinet/in.h> -#endif /* __LCLINT__ */ - -#include <header.h> +#include <header_internal.h> #include "debug.h" @@ -59,98 +55,6 @@ static int typeSizes[] = { }; /** - * Description of tag data. - */ -struct entryInfo { - int_32 tag; /*!< Tag identifier. */ - int_32 type; /*!< Tag data type. */ - int_32 offset; /*!< Offset into data segment (ondisk only). */ - int_32 count; /*!< Number of tag elements. */ -}; - -#define REGION_TAG_TYPE RPM_BIN_TYPE -#define REGION_TAG_COUNT sizeof(struct entryInfo) - -#define ENTRY_IS_REGION(_e) ((_e)->info.tag < HEADER_I18NTABLE) -#define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0) - -/** - * A single tag from a Header. - */ -struct indexEntry { - struct entryInfo info; /*!< Description of tag data. */ -/*@owned@*/ void * data; /*!< Location of tag data. */ - int length; /*!< No. bytes of data. */ - int rdlen; /*!< No. bytes of data in region. */ -}; - -/** - * The Header data structure. - */ -struct headerToken { -/*@owned@*/ struct indexEntry * index; /*!< Array of tags. */ - int indexUsed; /*!< Current size of tag array. */ - int indexAlloced; /*!< Allocated size of tag array. */ - int region_allocated; /*!< Is 1st header region allocated? */ - int sorted; /*!< Are header entries sorted? */ - int legacy; /*!< Header came from legacy source? */ -/*@refs@*/ int nrefs; /*!< Reference count. */ -}; - -/** - */ -struct sprintfTag { -/*@null@*/ headerTagTagFunction ext; /*!< if NULL tag element is invalid */ - int extNum; - int_32 tag; - int justOne; - int arrayCount; -/*@kept@*/ char * format; -/*@kept@*/ /*@null@*/ char * type; - int pad; -}; - -/** - */ -struct extensionCache { - int_32 type; - int_32 count; - int avail; - int freeit; -/*@owned@*/ const void * data; -}; - -/** - */ -struct sprintfToken { - enum { - PTOK_NONE = 0, - PTOK_TAG, - PTOK_ARRAY, - PTOK_STRING, - PTOK_COND - } type; - union { - struct { - /*@only@*/ struct sprintfToken * format; - int numTokens; - } array; - struct sprintfTag tag; - struct { - /*@dependent@*/ char * string; - int len; - } string; - struct { - /*@only@*/ /*@null@*/ struct sprintfToken * ifFormat; - int numIfTokens; - /*@only@*/ /*@null@*/ struct sprintfToken * elseFormat; - int numElseTokens; - struct sprintfTag tag; - } cond; - } u; -}; - -/** * Wrapper to free(3), hides const compilation noise, permit NULL, return NULL. * @param p memory to free * @return NULL always @@ -1062,124 +966,6 @@ exit: return h; } -void headerDump(Header h, FILE *f, int flags, - const struct headerTagTableEntry * tags) -{ - int i; - struct indexEntry *p; - const struct headerTagTableEntry * tage; - const char *tag; - char *type; - - /* First write out the length of the index (count of index entries) */ - fprintf(f, "Entry count: %d\n", h->indexUsed); - - /* Now write the index */ - p = h->index; - fprintf(f, "\n CT TAG TYPE " - " OFSET COUNT\n"); - for (i = 0; i < h->indexUsed; i++) { - switch (p->info.type) { - case RPM_NULL_TYPE: type = "NULL"; break; - case RPM_CHAR_TYPE: type = "CHAR"; break; - case RPM_BIN_TYPE: type = "BIN"; break; - case RPM_INT8_TYPE: type = "INT8"; break; - case RPM_INT16_TYPE: type = "INT16"; break; - case RPM_INT32_TYPE: type = "INT32"; break; - /*case RPM_INT64_TYPE: type = "INT64"; break;*/ - case RPM_STRING_TYPE: type = "STRING"; break; - case RPM_STRING_ARRAY_TYPE: type = "STRING_ARRAY"; break; - case RPM_I18NSTRING_TYPE: type = "I18N_STRING"; break; - default: type = "(unknown)"; break; - } - - tage = tags; - while (tage->name && tage->val != p->info.tag) tage++; - - if (!tage->name) - tag = "(unknown)"; - else - tag = tage->name; - - fprintf(f, "Entry : %3.3d (%d)%-14s %-18s 0x%.8x %.8d\n", i, - p->info.tag, tag, type, (unsigned) p->info.offset, - (int) p->info.count); - - if (flags & HEADER_DUMP_INLINE) { - char *dp = p->data; - int c = p->info.count; - int ct = 0; - - /* Print the data inline */ - switch (p->info.type) { - case RPM_INT32_TYPE: - while (c--) { - fprintf(f, " Data: %.3d 0x%08x (%d)\n", ct++, - (unsigned) *((int_32 *) dp), - (int) *((int_32 *) dp)); - dp += sizeof(int_32); - } - break; - - case RPM_INT16_TYPE: - while (c--) { - fprintf(f, " Data: %.3d 0x%04x (%d)\n", ct++, - (unsigned) (*((int_16 *) dp) & 0xffff), - (int) *((int_16 *) dp)); - dp += sizeof(int_16); - } - break; - case RPM_INT8_TYPE: - while (c--) { - fprintf(f, " Data: %.3d 0x%02x (%d)\n", ct++, - (unsigned) (*((int_8 *) dp) & 0xff), - (int) *((int_8 *) dp)); - dp += sizeof(int_8); - } - break; - case RPM_BIN_TYPE: - while (c > 0) { - fprintf(f, " Data: %.3d ", ct); - while (c--) { - fprintf(f, "%02x ", (unsigned) (*(int_8 *)dp & 0xff)); - ct++; - dp += sizeof(int_8); - if (! (ct % 8)) { - /*@loopbreak@*/ break; - } - } - fprintf(f, "\n"); - } - break; - case RPM_CHAR_TYPE: - while (c--) { - char ch = (char) *((char *) dp); - fprintf(f, " Data: %.3d 0x%2x %c (%d)\n", ct++, - (unsigned)(ch & 0xff), - (isprint(ch) ? ch : ' '), - (int) *((char *) dp)); - dp += sizeof(char); - } - break; - case RPM_STRING_TYPE: - case RPM_STRING_ARRAY_TYPE: - case RPM_I18NSTRING_TYPE: - while (c--) { - fprintf(f, " Data: %.3d %s\n", ct++, (char *) dp); - dp = strchr(dp, 0); - dp++; - } - break; - default: - fprintf(stderr, _("Data type %d not supported\n"), - (int) p->info.type); - break; - } - } - p++; - } -} - /** * Find matching (tag,type) entry in header. * @param h header @@ -1497,11 +1283,6 @@ Header headerLink(Header h) /*@-refcounttrans@*/ return h; /*@=refcounttrans@*/ } -int headerUsageCount(Header h) -{ - return h->nrefs; -} - unsigned int headerSizeof(Header h, enum hMagic magicp) { struct indexEntry * entry; @@ -1641,26 +1422,6 @@ int headerAddEntry(Header h, int_32 tag, int_32 type, const void *p, int_32 c) return 1; } -char ** -headerGetLangs(Header h) -{ - char **s, *e, **table; - int i, type, count; - - if (!headerGetRawEntry(h, HEADER_I18NTABLE, &type, (const void **)&s, &count)) - return NULL; - - /* XXX xcalloc never returns NULL. */ - if ((table = (char **)xcalloc((count+1), sizeof(char *))) == NULL) - return NULL; - - for (i = 0, e = *s; i < count > 0; i++, e += strlen(e)+1) - table[i] = e; - table[count] = NULL; - - /*@-nullret@*/ return table; /*@=nullret@*/ /* LCL: double indirection? */ -} - int headerAddI18NString(Header h, int_32 tag, const char * string, const char * lang) { struct indexEntry * table, * entry; diff --git a/lib/header.h b/lib/header.h index 0412507f2..1bb5b3c1d 100644 --- a/lib/header.h +++ b/lib/header.h @@ -266,25 +266,6 @@ Header headerLink(Header h) /*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h) /*@modifies h @*/; -/** \ingroup header - * Return header reference count. - * @param h header - * @return no. of references - */ -/*@unused@*/ -int headerUsageCount(Header h) /*@*/; - -/** \ingroup header - * Dump a header in human readable format (for debugging). - * @param h header - * @param flags 0 or HEADER_DUMP_LINLINE - * @param tags array of tag name/value pairs - */ -/*@unused@*/ -void headerDump(Header h, FILE *f, int flags, - const struct headerTagTableEntry * tags); -#define HEADER_DUMP_INLINE 1 - /*@-redef@*/ /* LCL: no clue */ typedef const char * errmsg_t; /*@=redef@*/ @@ -339,15 +320,6 @@ int headerModifyEntry(Header h, int_32 tag, int_32 type, /*@modifies h @*/; /** \ingroup header - * Return array of locales found in header. - * The array is terminated with a NULL sentinel. - * @param h header - * @return array of locales (or NULL on error) - */ -/*@unused@*/ -/*@only@*/ /*@null@*/ char ** headerGetLangs(Header h) /*@*/; - -/** \ingroup header * Add locale specific tag to header. * A NULL lang is interpreted as the C locale. Here are the rules: * \verbatim diff --git a/lib/header_internal.c b/lib/header_internal.c new file mode 100644 index 000000000..3e77222c5 --- /dev/null +++ b/lib/header_internal.c @@ -0,0 +1,128 @@ +/** \ingroup header + * \file lib/header_internal.c + */ + +#include "system.h" + +#include <header_internal.h> + +#include "debug.h" + +void headerDump(Header h, FILE *f, int flags, + const struct headerTagTableEntry * tags) +{ + int i; + struct indexEntry *p; + const struct headerTagTableEntry * tage; + const char *tag; + char *type; + + /* First write out the length of the index (count of index entries) */ + fprintf(f, "Entry count: %d\n", h->indexUsed); + + /* Now write the index */ + p = h->index; + fprintf(f, "\n CT TAG TYPE " + " OFSET COUNT\n"); + for (i = 0; i < h->indexUsed; i++) { + switch (p->info.type) { + case RPM_NULL_TYPE: type = "NULL"; break; + case RPM_CHAR_TYPE: type = "CHAR"; break; + case RPM_BIN_TYPE: type = "BIN"; break; + case RPM_INT8_TYPE: type = "INT8"; break; + case RPM_INT16_TYPE: type = "INT16"; break; + case RPM_INT32_TYPE: type = "INT32"; break; + /*case RPM_INT64_TYPE: type = "INT64"; break;*/ + case RPM_STRING_TYPE: type = "STRING"; break; + case RPM_STRING_ARRAY_TYPE: type = "STRING_ARRAY"; break; + case RPM_I18NSTRING_TYPE: type = "I18N_STRING"; break; + default: type = "(unknown)"; break; + } + + tage = tags; + while (tage->name && tage->val != p->info.tag) tage++; + + if (!tage->name) + tag = "(unknown)"; + else + tag = tage->name; + + fprintf(f, "Entry : %3.3d (%d)%-14s %-18s 0x%.8x %.8d\n", i, + p->info.tag, tag, type, (unsigned) p->info.offset, + (int) p->info.count); + + if (flags & HEADER_DUMP_INLINE) { + char *dp = p->data; + int c = p->info.count; + int ct = 0; + + /* Print the data inline */ + switch (p->info.type) { + case RPM_INT32_TYPE: + while (c--) { + fprintf(f, " Data: %.3d 0x%08x (%d)\n", ct++, + (unsigned) *((int_32 *) dp), + (int) *((int_32 *) dp)); + dp += sizeof(int_32); + } + break; + + case RPM_INT16_TYPE: + while (c--) { + fprintf(f, " Data: %.3d 0x%04x (%d)\n", ct++, + (unsigned) (*((int_16 *) dp) & 0xffff), + (int) *((int_16 *) dp)); + dp += sizeof(int_16); + } + break; + case RPM_INT8_TYPE: + while (c--) { + fprintf(f, " Data: %.3d 0x%02x (%d)\n", ct++, + (unsigned) (*((int_8 *) dp) & 0xff), + (int) *((int_8 *) dp)); + dp += sizeof(int_8); + } + break; + case RPM_BIN_TYPE: + while (c > 0) { + fprintf(f, " Data: %.3d ", ct); + while (c--) { + fprintf(f, "%02x ", (unsigned) (*(int_8 *)dp & 0xff)); + ct++; + dp += sizeof(int_8); + if (! (ct % 8)) { + /*@loopbreak@*/ break; + } + } + fprintf(f, "\n"); + } + break; + case RPM_CHAR_TYPE: + while (c--) { + char ch = (char) *((char *) dp); + fprintf(f, " Data: %.3d 0x%2x %c (%d)\n", ct++, + (unsigned)(ch & 0xff), + (isprint(ch) ? ch : ' '), + (int) *((char *) dp)); + dp += sizeof(char); + } + break; + case RPM_STRING_TYPE: + case RPM_STRING_ARRAY_TYPE: + case RPM_I18NSTRING_TYPE: + while (c--) { + fprintf(f, " Data: %.3d %s\n", ct++, (char *) dp); + dp = strchr(dp, 0); + dp++; + } + break; + default: + fprintf(stderr, _("Data type %d not supported\n"), + (int) p->info.type); + break; + } + } + p++; + } +} + diff --git a/lib/header_internal.h b/lib/header_internal.h new file mode 100644 index 000000000..db87fdbab --- /dev/null +++ b/lib/header_internal.h @@ -0,0 +1,127 @@ +#ifndef H_HEADER_INTERNAL +#define H_HEADER_INTERNAL + +/** \ingroup header + * \file lib/header_internal.h + */ + +#include <header.h> + +#if !defined(__LCLINT__) +#include <netinet/in.h> +#endif /* __LCLINT__ */ + + +/** + * Description of tag data. + */ +struct entryInfo { + int_32 tag; /*!< Tag identifier. */ + int_32 type; /*!< Tag data type. */ + int_32 offset; /*!< Offset into data segment (ondisk only). */ + int_32 count; /*!< Number of tag elements. */ +}; + +#define REGION_TAG_TYPE RPM_BIN_TYPE +#define REGION_TAG_COUNT sizeof(struct entryInfo) + +#define ENTRY_IS_REGION(_e) ((_e)->info.tag < HEADER_I18NTABLE) +#define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0) + +/** + * A single tag from a Header. + */ +struct indexEntry { + struct entryInfo info; /*!< Description of tag data. */ +/*@owned@*/ void * data; /*!< Location of tag data. */ + int length; /*!< No. bytes of data. */ + int rdlen; /*!< No. bytes of data in region. */ +}; + +/** + * The Header data structure. + */ +struct headerToken { +/*@owned@*/ struct indexEntry * index; /*!< Array of tags. */ + int indexUsed; /*!< Current size of tag array. */ + int indexAlloced; /*!< Allocated size of tag array. */ + int region_allocated; /*!< Is 1st header region allocated? */ + int sorted; /*!< Are header entries sorted? */ + int legacy; /*!< Header came from legacy source? */ +/*@refs@*/ int nrefs; /*!< Reference count. */ +}; + +/** + */ +struct sprintfTag { +/*@null@*/ headerTagTagFunction ext; /*!< if NULL tag element is invalid */ + int extNum; + int_32 tag; + int justOne; + int arrayCount; +/*@kept@*/ char * format; +/*@kept@*/ /*@null@*/ char * type; + int pad; +}; + +/** + */ +struct extensionCache { + int_32 type; + int_32 count; + int avail; + int freeit; +/*@owned@*/ const void * data; +}; + +/** + */ +struct sprintfToken { + enum { + PTOK_NONE = 0, + PTOK_TAG, + PTOK_ARRAY, + PTOK_STRING, + PTOK_COND + } type; + union { + struct { + /*@only@*/ struct sprintfToken * format; + int numTokens; + } array; + struct sprintfTag tag; + struct { + /*@dependent@*/ char * string; + int len; + } string; + struct { + /*@only@*/ /*@null@*/ struct sprintfToken * ifFormat; + int numIfTokens; + /*@only@*/ /*@null@*/ struct sprintfToken * elseFormat; + int numElseTokens; + struct sprintfTag tag; + } cond; + } u; +}; + +#ifdef __cplusplus +extern "C" { +#endif + + +/** \ingroup header + * Dump a header in human readable format (for debugging). + * @param h header + * @param flags 0 or HEADER_DUMP_LINLINE + * @param tags array of tag name/value pairs + */ +/*@unused@*/ +void headerDump(Header h, FILE *f, int flags, + const struct headerTagTableEntry * tags); +#define HEADER_DUMP_INLINE 1 + +#ifdef __cplusplus +} +#endif + +#endif /* H_HEADER_INTERNAL */ diff --git a/lib/misc.c b/lib/misc.c index 08d14ae6a..a8ca602e6 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -94,129 +94,25 @@ int rpmfileexists(const char * urlfn) return 1; } -/* compare alpha and numeric segments of two versions */ -/* return 1: a is newer than b */ -/* 0: a and b are the same version */ -/* -1: b is newer than a */ -int rpmvercmp(const char * a, const char * b) -{ - char oldch1, oldch2; - char * str1, * str2; - char * one, * two; - int rc; - int isnum; - - /* easy comparison to see if versions are identical */ - if (!strcmp(a, b)) return 0; - - str1 = alloca(strlen(a) + 1); - str2 = alloca(strlen(b) + 1); - - strcpy(str1, a); - strcpy(str2, b); - - one = str1; - two = str2; - - /* loop through each version segment of str1 and str2 and compare them */ - while (*one && *two) { - while (*one && !xisalnum(*one)) one++; - while (*two && !xisalnum(*two)) two++; - - str1 = one; - str2 = two; - - /* grab first completely alpha or completely numeric segment */ - /* leave one and two pointing to the start of the alpha or numeric */ - /* segment and walk str1 and str2 to end of segment */ - if (xisdigit(*str1)) { - while (*str1 && xisdigit(*str1)) str1++; - while (*str2 && xisdigit(*str2)) str2++; - isnum = 1; - } else { - while (*str1 && xisalpha(*str1)) str1++; - while (*str2 && xisalpha(*str2)) str2++; - isnum = 0; - } - - /* save character at the end of the alpha or numeric segment */ - /* so that they can be restored after the comparison */ - oldch1 = *str1; - *str1 = '\0'; - oldch2 = *str2; - *str2 = '\0'; - - /* take care of the case where the two version segments are */ - /* different types: one numeric, the other alpha (i.e. empty) */ - if (one == str1) return -1; /* arbitrary */ - if (two == str2) return 1; - - if (isnum) { - /* this used to be done by converting the digit segments */ - /* to ints using atoi() - it's changed because long */ - /* digit segments can overflow an int - this should fix that. */ - - /* throw away any leading zeros - it's a number, right? */ - while (*one == '0') one++; - while (*two == '0') two++; - - /* whichever number has more digits wins */ - if (strlen(one) > strlen(two)) return 1; - if (strlen(two) > strlen(one)) return -1; - } - - /* strcmp will return which one is greater - even if the two */ - /* segments are alpha or if they are numeric. don't return */ - /* if they are equal because there might be more segments to */ - /* compare */ - rc = strcmp(one, two); - if (rc) return rc; - - /* restore character that was replaced by null above */ - *str1 = oldch1; - one = str1; - *str2 = oldch2; - two = str2; - } - - /* this catches the case where all numeric and alpha segments have */ - /* compared identically but the segment sepparating characters were */ - /* different */ - if ((!*one) && (!*two)) return 0; - - /* whichever version still has characters left over wins */ - if (!*one) return -1; else return 1; -} - int doputenv(const char *str) { char * a; /* FIXME: this leaks memory! */ - a = xmalloc(strlen(str) + 1); strcpy(a, str); - return putenv(a); } -int dosetenv(const char *name, const char *value, int overwrite) +int dosetenv(const char * name, const char * value, int overwrite) { - int i; char * a; - /* FIXME: this leaks memory! */ - if (!overwrite && getenv(name)) return 0; - i = strlen(name) + strlen(value) + 2; - a = xmalloc(i); - if (!a) return 1; - - strcpy(a, name); - strcat(a, "="); - strcat(a, value); - + /* FIXME: this leaks memory! */ + a = xmalloc(strlen(name) + strlen(value) + sizeof("=")); + (void) stpcpy( stpcpy( stpcpy( a, name), "="), value); return putenv(a); } diff --git a/lib/misc.h b/lib/misc.h index 965bb0b3b..1b36478b8 100644 --- a/lib/misc.h +++ b/lib/misc.h @@ -47,10 +47,12 @@ void freeSplitString( /*@only@*/ char ** list) int rpmfileexists(const char * urlfn) /*@modifies fileSystem @*/; +#ifdef DYING /** */ int rpmvercmp(const char * a, const char * b) /*@*/; +#endif /* * These are like the libc functions, but they malloc() the space which @@ -72,7 +74,7 @@ int doputenv(const char * str) * A unique temporaray file path will be generated using * rpmGenPath(prefix, "%{_tmppath}/", "rpm-tmp.XXXXX") * where "XXXXXX" is filled in using rand(3). The file is opened, and - * the link count and (dev,ino) location are * verified after opening. + * the link count and (dev,ino) location are verified after opening. * The file name and the open file handle are returned. * * @param prefix leading part of temp file path @@ -86,7 +88,8 @@ int makeTempFile(/*@null@*/ const char * prefix, /*@modifies *fnptr, *fdptr, fileSystem @*/; /** - * @return cureent working directory (malloc'ed) + * Return (malloc'd) current working directory. + * @return current working directory (malloc'ed) */ /*@only@*/ char * currentDirectory(void) /*@modifies fileSystem @*/; diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 358a43854..f90a21bee 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -5,9 +5,9 @@ * \file lib/rpmcli.h */ -#include <rpmlib.h> -#include <rpmurl.h> -#include <rpmmacro.h> +#include "rpmlib.h" +#include "rpmurl.h" +#include "rpmmacro.h" /** \ingroup rpmcli * Should version 3 packages be produced? diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 01ca59a59..01619a176 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -7,7 +7,7 @@ #include <rpmcli.h> #include "manifest.h" -#include "misc.h" +#include "misc.h" /* XXX for rpmGlob() */ #include "debug.h" /*@access rpmTransactionSet@*/ /* XXX compared with NULL */ diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 2bb66da18..1c82d7850 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -841,6 +841,12 @@ int rpmdbSetIteratorModified(/*@null@*/ rpmdbMatchIterator mi, int modified) /*@null@*/ Header rpmdbNextIterator(/*@null@*/ rpmdbMatchIterator mi) /*@modifies mi @*/; +/** @todo Remove debugging entry from the ABI. */ +/*@unused@*/ +/*@null@*/ Header XrpmdbNextIterator(rpmdbMatchIterator mi, + const char * f, unsigned int l) + /*@modifies mi @*/; + /** \ingroup rpmdb * Return database iterator. * @param db rpm database @@ -931,19 +937,21 @@ void printDepFlags(FILE *fp, const char *version, int flags) /*@modifies *fp, fileSystem @*/; /** - */ -typedef /*@abstract@*/ struct rpmDependencyConflict_s { - const char * byName; - const char * byVersion; - const char * byRelease; - Header byHeader; + * Dependency problems found by rpmdepCheck(). + * @todo Rename, but rpmfind prevents "struct rpmDependencyConflict_s". + */ +typedef /*@abstract@*/ struct rpmDependencyConflict { + const char * byName; /*!< package name */ + const char * byVersion; /*!< package version */ + const char * byRelease; /*!< package release */ + Header byHeader; /*!< header with dependency problems */ /* * These needs fields are misnamed -- they are used for the package * which isn't needed as well. */ - const char * needsName; - const char * needsVersion; - int needsFlags; + const char * needsName; /*!< dependency name */ + const char * needsVersion; /*!< dependency epoch:version-release */ + int needsFlags; /*!< dependency flags */ /*@owned@*/ /*@null@*/ const void ** suggestedPackages; /* terminated by NULL */ enum { RPMDEP_SENSE_REQUIRES, /*!< requirement not satisfied. */ @@ -1374,6 +1382,16 @@ int rpmGetRpmlibProvides(/*@null@*/ /*@out@*/ const char *** provNames, /*@ modifies *provNames, *provFlags, *provVersions @*/; /** \ingroup rpmtrans + * Segmented string compare for version and/or release. + * + * @param a 1st string + * @param b 2nd string + * @return +1 if a is "newer", 0 if equal, -1 if b is "newer" + */ +int rpmvercmp(const char * a, const char * b) + /*@*/; + +/** \ingroup rpmtrans * Compare two versioned dependency ranges, looking for overlap. * @param AName 1st dependncy name string * @param AEVR 1st dependency [epoch:]version[-release] string diff --git a/lib/rpmvercmp.c b/lib/rpmvercmp.c new file mode 100644 index 000000000..ec09447dd --- /dev/null +++ b/lib/rpmvercmp.c @@ -0,0 +1,103 @@ +/** \ingroup rpmtrans + * \file lib/rpmvercmp.c + */ + +#include "system.h" + +#include <rpmio.h> + +#include "debug.h" + +/* compare alpha and numeric segments of two versions */ +/* return 1: a is newer than b */ +/* 0: a and b are the same version */ +/* -1: b is newer than a */ +int rpmvercmp(const char * a, const char * b) +{ + char oldch1, oldch2; + char * str1, * str2; + char * one, * two; + int rc; + int isnum; + + /* easy comparison to see if versions are identical */ + if (!strcmp(a, b)) return 0; + + str1 = alloca(strlen(a) + 1); + str2 = alloca(strlen(b) + 1); + + strcpy(str1, a); + strcpy(str2, b); + + one = str1; + two = str2; + + /* loop through each version segment of str1 and str2 and compare them */ + while (*one && *two) { + while (*one && !xisalnum(*one)) one++; + while (*two && !xisalnum(*two)) two++; + + str1 = one; + str2 = two; + + /* grab first completely alpha or completely numeric segment */ + /* leave one and two pointing to the start of the alpha or numeric */ + /* segment and walk str1 and str2 to end of segment */ + if (xisdigit(*str1)) { + while (*str1 && xisdigit(*str1)) str1++; + while (*str2 && xisdigit(*str2)) str2++; + isnum = 1; + } else { + while (*str1 && xisalpha(*str1)) str1++; + while (*str2 && xisalpha(*str2)) str2++; + isnum = 0; + } + + /* save character at the end of the alpha or numeric segment */ + /* so that they can be restored after the comparison */ + oldch1 = *str1; + *str1 = '\0'; + oldch2 = *str2; + *str2 = '\0'; + + /* take care of the case where the two version segments are */ + /* different types: one numeric, the other alpha (i.e. empty) */ + if (one == str1) return -1; /* arbitrary */ + if (two == str2) return 1; + + if (isnum) { + /* this used to be done by converting the digit segments */ + /* to ints using atoi() - it's changed because long */ + /* digit segments can overflow an int - this should fix that. */ + + /* throw away any leading zeros - it's a number, right? */ + while (*one == '0') one++; + while (*two == '0') two++; + + /* whichever number has more digits wins */ + if (strlen(one) > strlen(two)) return 1; + if (strlen(two) > strlen(one)) return -1; + } + + /* strcmp will return which one is greater - even if the two */ + /* segments are alpha or if they are numeric. don't return */ + /* if they are equal because there might be more segments to */ + /* compare */ + rc = strcmp(one, two); + if (rc) return rc; + + /* restore character that was replaced by null above */ + *str1 = oldch1; + one = str1; + *str2 = oldch2; + two = str2; + } + + /* this catches the case where all numeric and alpha segments have */ + /* compared identically but the segment sepparating characters were */ + /* different */ + if ((!*one) && (!*two)) return 0; + + /* whichever version still has characters left over wins */ + if (!*one) return -1; else return 1; +} diff --git a/lib/signature.c b/lib/signature.c index c3c987dde..e1b3e0fec 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -18,10 +18,10 @@ #endif #include <rpmlib.h> -#include <rpmmacro.h> /* XXX for rpmGetPath */ +#include <rpmmacro.h> /* XXX for rpmGetPath() */ #include "md5.h" -#include "misc.h" +#include "misc.h" /* XXX for dosetenv() and makeTempFile() */ #include "rpmlead.h" #include "signature.h" #include "debug.h" diff --git a/lib/transaction.c b/lib/transaction.c index 4b5d307a3..fe5f8e286 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -11,7 +11,7 @@ #include "fprint.h" #include "rpmhash.h" #include "md5.h" -#include "misc.h" +#include "misc.h" /* XXX stripTrailingChar, splitString, currentDirectory */ #include "rpmdb.h" /* XXX FIXME: merge with existing (broken?) tests in system.h */ diff --git a/lib/verify.c b/lib/verify.c index f897f56a8..11a5ed83d 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -9,7 +9,7 @@ #include "psm.h" #include "md5.h" -#include "misc.h" +#include "misc.h" /* XXX for uidToUname() and gnameToGid() */ #include "debug.h" /*@access TFI_t*/ @@ -1,7 +1,7 @@ #/*! \page config_macros Default configuration: /usr/lib/rpm/macros # \verbatim # -# $Id: macros.in,v 1.81 2001/06/15 21:52:47 jbj Exp $ +# $Id: macros.in,v 1.82 2001/06/17 22:18:03 jbj Exp $ # # This is a global RPM configuration file. All changes made here will # be lost when the rpm package is upgraded. Any per-system configuration @@ -705,7 +705,7 @@ cd %{u2p:%{_builddir}}\ CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \ CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \ FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \ -%{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} ; \ +%{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force ;} \ ./configure \\\ --target=%{_target_platform} \\\ --prefix=%{_prefix} \\\ diff --git a/po/POTFILES.in b/po/POTFILES.in index 5dc648f01..e0d9ce847 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -30,6 +30,7 @@ lib/formats.c lib/fs.c lib/fsm.c lib/header.c +lib/header_internal.c lib/manifest.c lib/md5.c lib/md5sum.c @@ -46,6 +47,7 @@ lib/rpmchecksig.c lib/rpminstall.c lib/rpmlead.c lib/rpmrc.c +lib/rpmvercmp.c lib/signature.c lib/stringbuf.c lib/transaction.c diff --git a/python/rpmmodule.c b/python/rpmmodule.c index 03a56095a..6e4fff898 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -1273,7 +1273,7 @@ static PyObject * rpmtransRemove(rpmtransObject * s, PyObject * args) { /** \ingroup python */ static PyObject * rpmtransDepCheck(rpmtransObject * s, PyObject * args) { - struct rpmDependencyConflict_s * conflicts; + rpmDependencyConflict conflicts; int numConflicts; PyObject * list, * cf; int i; diff --git a/rpm2cpio.c b/rpm2cpio.c index cc7c2dc23..c82d38c67 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -14,14 +14,14 @@ int main(int argc, char **argv) FD_t gzdi; setprogname(argv[0]); /* Retrofit glibc __progname */ - if (argc == 1) { + if (argc == 1) fdi = fdDup(STDIN_FILENO); - } else { + else fdi = Fopen(argv[1], "r.ufdio"); - } - if (fdi == NULL || Ferror(fdi)) { - fprintf(stderr, _("cannot open package: %s\n"), Fstrerror(fdi)); + if (Ferror(fdi)) { + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } fdo = fdDup(STDOUT_FILENO); @@ -61,25 +61,9 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } -#ifdef DYING - { char buffer[BUFSIZ]; - int ct; - while ((ct = Fread(buffer, sizeof(buffer[0]), sizeof(buffer), gzdi)) > 0) { - Fwrite(buffer, sizeof(buffer[0]), ct, fdo); - } - - if (ct < 0) { - fprintf (stderr, "rpm2cpio: zlib: %s\n", Fstrerror(gzdi)); - rc = EXIT_FAILURE; - } else { - rc = EXIT_SUCCESS; - } - } -#else rc = ufdCopy(gzdi, fdo); rc = (rc <= 0) ? EXIT_FAILURE : EXIT_SUCCESS; Fclose(fdo); -#endif Fclose(gzdi); /* XXX gzdi == fdi */ diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 0d9f9a106..c28fe7b14 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -1859,6 +1859,12 @@ int rpmdbSetIteratorModified(rpmdbMatchIterator mi, int modified) { return rc; } +Header XrpmdbNextIterator(rpmdbMatchIterator mi, + /*@unused@*/ const char * f, /*@unused@*/ unsigned int l) +{ + return rpmdbNextIterator(mi); +} + Header rpmdbNextIterator(rpmdbMatchIterator mi) { dbiIndex dbi; diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h index 468f0fa03..721eafed0 100644 --- a/rpmio/rpmio.h +++ b/rpmio/rpmio.h @@ -389,12 +389,14 @@ ssize_t fdWrite(void * cookie, const char * buf, size_t count) int fdClose( /*@only@*/ void * cookie) /*@modifies *cookie, fileSystem @*/; -/* XXX FD_t reference count debugging wrappers */ +/** + * FD_t reference count debugging wrappers. + * @todo Remove debugging entries from the ABI. + */ #define fdLink(_fd, _msg) fdio->_fdref(_fd, _msg, __FILE__, __LINE__) #define fdFree(_fd, _msg) fdio->_fdderef(_fd, _msg, __FILE__, __LINE__) #define fdNew(_msg) fdio->_fdnew(_msg, __FILE__, __LINE__) - /** \ingroup rpmio */ int fdWritable(FD_t fd, int secs) diff --git a/rpmio/rpmurl.h b/rpmio/rpmurl.h index a08b565db..11dbf53b2 100644 --- a/rpmio/rpmurl.h +++ b/rpmio/rpmurl.h @@ -59,6 +59,8 @@ extern int url_iobuf_size; * @return new instance */ urlinfo urlNew(const char * msg) /*@*/; + +/** @todo Remove debugging entry from the ABI. */ urlinfo XurlNew(const char * msg, const char * file, unsigned line) /*@*/; #define urlNew(_msg) XurlNew(_msg, __FILE__, __LINE__) @@ -70,6 +72,8 @@ urlinfo XurlNew(const char * msg, const char * file, unsigned line) /*@*/; */ urlinfo urlLink(urlinfo u, const char * msg) /*@modifies u @*/; + +/** @todo Remove debugging entry from the ABI. */ urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line) /*@modifies u @*/; #define urlLink(_u, _msg) XurlLink(_u, _msg, __FILE__, __LINE__) @@ -82,6 +86,8 @@ urlinfo XurlLink(urlinfo u, const char * msg, const char * file, unsigned line) */ urlinfo urlFree( /*@killref@*/ urlinfo u, const char * msg) /*@modifies u @*/; + +/** @todo Remove debugging entry from the ABI. */ urlinfo XurlFree( /*@killref@*/ urlinfo u, const char * msg, const char * file, unsigned line) /*@modifies u @*/; diff --git a/tools/dump.c b/tools/dump.c index 6d05af679..584372fab 100644 --- a/tools/dump.c +++ b/tools/dump.c @@ -1,6 +1,7 @@ #include "system.h" #include <rpmlib.h> +#include "header_internal.h" #include "debug.h" int main(int argc, char ** argv) @@ -15,20 +16,21 @@ int main(int argc, char ** argv) fdi = Fopen(argv[1], "r.ufdio"); } - if (fdi == NULL || Ferror(fdi)) { - fprintf(stderr, _("cannot open %s: %s\n"), argv[1], strerror(errno)); + if (Ferror(fdi)) { + fprintf(stderr, _("cannot open %s: %s\n"), + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } h = headerRead(fdi, HEADER_MAGIC_YES); if (!h) { - fprintf(stderr, _("headerRead error: %s\n"), strerror(errno)); + fprintf(stderr, _("headerRead error: %s\n"), Fstrerror(fdi)); exit(EXIT_FAILURE); } Fclose(fdi); headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable); - headerFree(h); + h = headerFree(h); return 0; } diff --git a/tools/dumpdb.c b/tools/dumpdb.c index 0fc2ef781..66fdd642e 100644 --- a/tools/dumpdb.c +++ b/tools/dumpdb.c @@ -1,6 +1,7 @@ #include "system.h" -#include "rpmlib.h" +#include <rpmlib.h> +#include "header_internal.h" #include "debug.h" int main(int argc, char ** argv) @@ -19,7 +20,7 @@ int main(int argc, char ** argv) } if (rpmdbOpen("", &db, O_RDONLY, 0644)) { - fprintf(stderr, _("cannot open /var/lib/rpm/packages.rpm\n")); + fprintf(stderr, _("cannot open Packages\n")); exit(1); } @@ -36,14 +37,14 @@ int main(int argc, char ** argv) if (!(dspBlockNum != 0 && dspBlockNum != blockNum)) continue; - headerDump(h, stdout, 1, rpmTagTable); + headerDump(h, stdout, HEADER_DUMP_INLINE, rpmTagTable); fprintf(stdout, "Offset: %d\n", _RECNUM); if (dspBlockNum && blockNum > dspBlockNum) exit(0); } - rpmdbFreeIterator(mi); + mi = rpmdbFreeIterator(mi); } diff --git a/tools/rpmarchive.c b/tools/rpmarchive.c index c9c49acdb..210fda1f1 100644 --- a/tools/rpmarchive.c +++ b/tools/rpmarchive.c @@ -22,8 +22,9 @@ int main(int argc, char **argv) } else { fdi = Fopen(argv[1], "r.ufdio"); } - if (fdi == NULL || Ferror(fdi)) { - perror("input"); + if (Ferror(fdi)) { + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } diff --git a/tools/rpmheader.c b/tools/rpmheader.c index d48e85bfc..2cc79ec48 100644 --- a/tools/rpmheader.c +++ b/tools/rpmheader.c @@ -21,8 +21,9 @@ int main(int argc, char **argv) fdi = Fopen(argv[1], "r.ufdio"); } - if (fdi == NULL || Ferror(fdi)) { - perror("input"); + if (Ferror(fdi)) { + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } diff --git a/tools/rpmlead.c b/tools/rpmlead.c index 4f7994aad..7eb5c02f4 100644 --- a/tools/rpmlead.c +++ b/tools/rpmlead.c @@ -18,7 +18,8 @@ int main(int argc, char **argv) fdi = Fopen(argv[1], "r.ufdio"); } if (fdi == NULL || Ferror(fdi)) { - perror(argv[1]); + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(EXIT_FAILURE); } diff --git a/tools/rpmsignature.c b/tools/rpmsignature.c index 977842ccd..e39c5142a 100644 --- a/tools/rpmsignature.c +++ b/tools/rpmsignature.c @@ -19,7 +19,8 @@ int main(int argc, char **argv) fdi = Fopen(argv[1], "r.ufdio"); } if (Ferror(fdi)) { - perror("input"); + fprintf(stderr, "%s: %s: %s\n", argv[0], + (argc == 1 ? "<stdin>" : argv[1]), Fstrerror(fdi)); exit(1); } |