- hpux w/o -D_OPEN_SOURCE has not h_errno.
- syntax to specify source of Requires: (PreReq: now legacy).
- md5 sums are little endian (no swap) so big endian needs the swap.
+ - merge signatures into header after reading from package.
+ - RPM_BIN_TYPE malloc'ed when retrieved through headerGetEntry().
+ - add headerFreeData() to free any data malloc'ed during retrieval.
+ - preserve exact image of original header when installing/upgrading.
+ - add missing headerFree for legacy signature header.
+ - fix: removed packages leaked DIRINDEXES tag data.
+ - reload tags added during install when loading header from rpmdb.
+ - avoid brp-compress hang with both compressed/uncompressed man pages.
- improved find-{requires,provides} for aix4/hpux/irix6/osf.
Tim Mooney<mooney@dogbert.cc.ndsu.NoDak.edu>
+ - portability: remove use of GNU make subst in lib/Makefile (Joe Orton).
3.0.6 -> 4.0
- use DIRNAMES/BASENAMES/DIRINDICES not FILENAMES in packages and db.
if (rpmdbOpen(rootdir, &db, mode, 0644)) {
const char *dn;
dn = rpmGetPath( (rootdir ? rootdir : ""), "%{_dbpath}", NULL);
- rpmError(RPMERR_OPEN, _("cannot open %s/packages.rpm\n"), dn);
+ rpmError(RPMERR_OPEN, _("cannot open rpm database in %s\n"), dn);
xfree(dn);
exit(EXIT_FAILURE);
}
Spec spec = NULL;
int rc;
+#ifndef DYING
+ rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
+#endif
+
if (ba->buildRootOverride)
buildRootURL = rpmGenPath(NULL, ba->buildRootOverride, NULL);
const char *specDir;
const char * tmpSpecFile;
char * cmd, *s;
- int res;
+ rpmCompressedMagic res = COMPRESSED_OTHER;
static const char *zcmds[] = { "cat", "gunzip", "bunzip2", "cat" };
specDir = rpmGetPath("%{_specdir}", NULL);
if (res) {
rpmError(RPMERR_RENAME, _("Failed to rename %s to %s: %m"),
- tmpSpecFile, s);
+ tmpSpecFile, s);
unlink(tmpSpecFile);
xfree(tmpSpecFile);
return 1;
FREE(argv);
FREE(buildCmd);
FREE(buildTemplate);
+ FREE(buildPost);
FREE(buildDirURL);
return rc;
}
-/** */
int buildSpec(Spec spec, int what, int test)
{
- int x, rc;
+ int rc = 0;
if (!spec->inBuildArchitectures && spec->buildArchitectureCount) {
+ int x;
/* When iterating over buildArchitectures, do the source */
/* packaging on the first run, and skip RMSOURCE altogether */
for (x = 0; x < spec->buildArchitectureCount; x++) {
if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
(rc = packageSources(spec)))
- goto exit;
+ return rc;
if (((what & RPMBUILD_PACKAGEBINARY) && !test) &&
(rc = packageBinaries(spec)))
if (what & RPMBUILD_RMSPEC)
unlink(spec->specFile);
- rc = 0;
exit:
if (rc && rpmlogGetNrecs() > 0) {
return fl.processingFailed;
}
-/** */
void initSourceHeader(Spec spec)
{
HeaderIterator hi;
- int tag, type, count;
+ int_32 tag, type, count;
const void * ptr;
spec->sourceHeader = headerNew();
/* Only specific tags are added to the source package header */
for (hi = headerInitIterator(spec->packages->header);
headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = ((type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
- ? xfree(ptr), NULL : NULL))
+ ptr = headerFreeData(ptr, type))
{
switch (tag) {
case RPMTAG_NAME:
/* Add the build restrictions */
for (hi = headerInitIterator(spec->buildRestrictions);
headerNextIterator(hi, &tag, &type, &ptr, &count);
- ptr = ((type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE)
- ? xfree(ptr), NULL : NULL))
+ ptr = headerFreeData(ptr, type))
{
headerAddEntry(spec->sourceHeader, tag, type, ptr, count);
}
}
}
-/** */
int processSourceFiles(Spec spec)
{
struct Source *srcPtr;
return readBuff;
}
+/** */
typedef struct {
const char *msg;
const char *argv[4];
FREE(versions);
}
-/** */
int processBinaryFiles(Spec spec, int installSpecialDoc, int test)
{
Package pkg;
return sb;
}
-static int addFileToTag(Spec spec, char *file, Header h, int tag)
+static int addFileToTag(Spec spec, const char *file, Header h, int tag)
{
- StringBuf sb;
+ StringBuf sb = newStringBuf();
char *s;
- sb = newStringBuf();
if (headerGetEntry(h, tag, NULL, (void **)&s, NULL)) {
appendLineStringBuf(sb, s);
headerRemoveEntry(h, tag);
}
- if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
+ if ((sb = addFileToTagAux(spec, file, sb)) == NULL)
return 1;
- }
headerAddEntry(h, tag, RPM_STRING_TYPE, getStringBuf(sb), 1);
static int addFileToArrayTag(Spec spec, char *file, Header h, int tag)
{
- StringBuf sb;
+ StringBuf sb = newStringBuf();
char *s;
- sb = newStringBuf();
- if ((sb = addFileToTagAux(spec, file, sb)) == NULL) {
+ if ((sb = addFileToTagAux(spec, file, sb)) == NULL)
return 1;
- }
s = getStringBuf(sb);
headerAddOrAppendEntry(h, tag, RPM_STRING_ARRAY_TYPE, &s, 1);
FD_t fd = NULL;
FD_t ifd = NULL;
int rc, count, sigtype;
- int archnum, osnum;
const char *sigtarget;
const char * rpmio_flags = NULL;
char *s;
char buf[BUFSIZ];
Header h = *hdrp;
- Header sig;
- struct rpmlead lead;
+ Header sig = NULL;
if (Fileno(csa->cpioFdIn) < 0) {
csa->cpioArchiveSize = 0;
}
/* Reallocate the header into one contiguous region. */
- *hdrp = h = headerReload(h);
+ *hdrp = h = headerReload(h, RPMTAG_HEADERIMMUTABLE);
/*
* Write the header+archive into a temp file so that the size of
*/
if (Fileno(csa->cpioFdIn) < 0) {
int_32 * archiveSize;
- headerGetEntry(h, RPMTAG_ARCHIVESIZE, NULL, &archiveSize, NULL);
- *archiveSize = csa->cpioArchiveSize;
+ if (headerGetEntry(h, RPMTAG_ARCHIVESIZE, NULL, (void *)&archiveSize, NULL))
+ *archiveSize = csa->cpioArchiveSize;
}
- (void)Fseek(fd, 0, SEEK_SET);
+ (void)Fseek(fd, 0, SEEK_SET);
if (headerWrite(fd, h, HEADER_MAGIC_YES))
rc = RPMERR_NOSPACE;
if (rc)
goto exit;
+ /* Generate the signature */
+ fflush(stdout);
+ sig = rpmNewSignature();
+ rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
+ rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
+ if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) {
+ rpmMessage(RPMMESS_NORMAL, _("Generating signature: %d\n"), sigtype);
+ rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
+ }
+
+ /* Reallocate the signature into one contiguous region. */
+ sig = headerReload(sig, RPMTAG_HEADERSIGNATURES);
+
/* Open the output file */
fd = Fopen(fileName, "w.ufdio");
if (fd == NULL || Ferror(fd)) {
goto exit;
}
- /* Now write the lead */
- archnum = -1;
- osnum = -1;
- if (Fileno(csa->cpioFdIn) < 0) {
-#ifndef DYING
- rpmGetArchInfo(NULL, &archnum);
- rpmGetOsInfo(NULL, &osnum);
+ /* Write the lead section into the package. */
+ { int archnum = -1;
+ int osnum = -1;
+ struct rpmlead lead;
+
+ if (Fileno(csa->cpioFdIn) < 0) {
+#ifndef DYING
+ rpmGetArchInfo(NULL, &archnum);
+ rpmGetOsInfo(NULL, &osnum);
#endif
- } else if (csa->lead != NULL) { /* XXX FIXME: exorcize lead/arch/os */
- archnum = csa->lead->archnum;
- osnum = csa->lead->osnum;
- }
-
- memset(&lead, 0, sizeof(lead));
- lead.major = RPM_MAJOR_NUMBER;
- lead.minor = 0;
- lead.type = type;
- lead.archnum = archnum;
- lead.osnum = osnum;
- lead.signature_type = RPMSIG_HEADERSIG; /* New-style signature */
- { const char *name, *version, *release;
- headerNVR(h, &name, &version, &release);
- sprintf(buf, "%s-%s-%s", name, version, release);
- strncpy(lead.name, buf, sizeof(lead.name));
- }
-
- if (writeLead(fd, &lead)) {
- rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
+ } else if (csa->lead != NULL) {
+ archnum = csa->lead->archnum;
+ osnum = csa->lead->osnum;
+ }
+
+ memset(&lead, 0, sizeof(lead));
+ lead.major = RPM_MAJOR_NUMBER;
+ lead.minor = 0;
+ lead.type = type;
+ lead.archnum = archnum;
+ lead.osnum = osnum;
+ lead.signature_type = RPMSIG_HEADERSIG; /* New-style signature */
+
+ { const char *name, *version, *release;
+ headerNVR(h, &name, &version, &release);
+ sprintf(buf, "%s-%s-%s", name, version, release);
+ strncpy(lead.name, buf, sizeof(lead.name));
+ }
+
+ if (writeLead(fd, &lead)) {
+ rpmError(RPMERR_NOSPACE, _("Unable to write package: %s"),
Fstrerror(fd));
- rc = RPMERR_NOSPACE;
- goto exit;
+ rc = RPMERR_NOSPACE;
+ goto exit;
+ }
}
- /* Generate the signature */
- fflush(stdout);
- sig = rpmNewSignature();
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
- if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0) {
- rpmMessage(RPMMESS_NORMAL, _("Generating signature: %d\n"), sigtype);
- rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
- }
- sig = headerReload(sig);
+ /* Write the signature section into the package. */
rc = rpmWriteSignature(fd, sig);
- rpmFreeSignature(sig);
- if (rc) {
+ if (rc)
goto exit;
- }
-
+
/* Append the header and archive */
ifd = Fopen(sigtarget, "r.ufdio");
if (ifd == NULL || Ferror(ifd)) {
rc = RPMERR_READ;
goto exit;
}
+
+ /* Add signatures to header, and write header into the package. */
+ { Header nh = headerRead(ifd, HEADER_MAGIC_YES);
+
+ if (nh == NULL) {
+ rpmError(RPMERR_READ, _("Unable to read header from %s: %s"),
+ sigtarget, Fstrerror(ifd));
+ rc = RPMERR_READ;
+ goto exit;
+ }
+
+#ifdef NOTYET
+ headerMergeLegacySigs(nh, sig);
+#endif
+
+ rc = headerWrite(fd, nh, HEADER_MAGIC_YES);
+ headerFree(nh);
+
+ if (rc) {
+ rpmError(RPMERR_NOSPACE, _("Unable to write header to %s: %s"),
+ fileName, Fstrerror(fd));
+ rc = RPMERR_NOSPACE;
+ goto exit;
+ }
+ }
+
+ /* Write the payload into the package. */
while ((count = Fread(buf, sizeof(buf[0]), sizeof(buf), ifd)) > 0) {
if (count == -1) {
- rpmError(RPMERR_READ, _("Unable to read sigtarget %s: %s"),
+ rpmError(RPMERR_READ, _("Unable to read payload from %s: %s"),
sigtarget, Fstrerror(ifd));
rc = RPMERR_READ;
goto exit;
}
if (Fwrite(buf, sizeof(buf[0]), count, fd) < 0) {
- rpmError(RPMERR_NOSPACE, _("Unable to write package %s: %s"),
+ rpmError(RPMERR_NOSPACE, _("Unable to write payload to %s: %s"),
fileName, Fstrerror(fd));
rc = RPMERR_NOSPACE;
goto exit;
rc = 0;
exit:
+ if (sig) {
+ rpmFreeSignature(sig);
+ sig = NULL;
+ }
if (ifd) {
Fclose(ifd);
ifd = NULL;
0
};
-/** */
int packageBinaries(Spec spec)
{
CSA_t csabuf, *csa = &csabuf;
return 0;
}
-/** */
int packageSources(Spec spec)
{
CSA_t csabuf, *csa = &csabuf;
#else
const char *arch = rpmExpand("%{_target_cpu}", NULL);
const char *os = rpmExpand("%{_target_os}", NULL);
- /* XXX FIXME memory leak here. */
#endif
if (isMemberInEntry(spec->buildRestrictions,
return 0;
}
-/* returns 0 - success */
-/* 1 - EOF */
-/* <0 - error */
-
int readLine(Spec spec, int strip)
{
#ifdef DYING
while (parsePart != PART_NONE) {
switch (parsePart) {
- case PART_PREAMBLE:
+ case PART_PREAMBLE:
parsePart = parsePreamble(spec, initialPackage);
initialPackage = 0;
break;
}
/* Check for description in each package and add arch and os */
- {
+ {
#ifdef DYING
const char *arch = NULL;
const char *os = NULL;
headerAddEntry(pkg->header, RPMTAG_OS, RPM_STRING_TYPE, os, 1);
headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, arch, 1);
- }
+ }
#ifdef DYING
FREE(myos);
#else
/*@observer@*/ const char *getGnameS(const char *gname);
/**
- * Return build time stamp.
- * @return build time stamp
- */
-/*@observer@*/ time_t *const getBuildTime(void);
-
-/**
* Return build hostname.
* @return build hostname
*/
/*@observer@*/ const char *const buildHost(void);
-/* from build/read.h */
+/**
+ * Return build time stamp.
+ * @return build time stamp
+ */
+/*@observer@*/ time_t *const getBuildTime(void);
/**
* @return 0 on success, 1 on EOF, <0 on error
/**
*/
typedef struct SpecStruct *Spec;
-#include "rpmmacro.h"
-#if 0
-struct ReqProvTrigger {
- int flags;
- char *name;
- char *version;
- int index; /* Only used for triggers */
- struct ReqProvTrigger *next;
-};
-#endif
+#include "rpmmacro.h"
/**
*/
struct TriggerFileEntry {
-/*@{*/
int index;
/*@only@*/ char *fileName;
/*@only@*/ char *script;
/*@only@*/ char *prog;
/*@owned@*/ struct TriggerFileEntry *next;
-/*@}*/
};
#define RPMBUILD_ISSOURCE 1
/**
*/
struct Source {
-/*@{*/
/*@owned@*/ char *fullSource;
/*@dependent@*/ char *source; /* Pointer into fullSource */
int flags;
int num;
/*@owned@*/ struct Source *next;
-/*@}*/
};
/**
*/
typedef struct ReadLevelEntry {
-/*@{*/
int reading;
/*@dependent@*/ struct ReadLevelEntry *next;
-/*@}*/
} RLE_t;
/**
*/
typedef struct OpenFileInfo {
-/*@{*/
- /*@only@*/ char *fileName;
+/*@only@*/ const char *fileName;
FD_t fd;
int lineNum;
char readBuf[BUFSIZ];
/*@dependent@*/ char *readPtr;
/*@owned@*/ struct OpenFileInfo *next;
-/*@}*/
} OFI_t;
/**
*/
struct spectag {
-/*@{*/
int t_tag;
int t_startx;
int t_nlines;
/*@only@*/ const char *t_lang;
/*@only@*/ const char *t_msgid;
-/*@}*/
};
/**
*/
struct spectags {
-/*@{*/
/*@owned@*/ struct spectag *st_t;
int st_nalloc;
int st_ntags;
-/*@}*/
};
/**
*/
struct speclines {
-/*@{*/
/*@only@*/ char **sl_lines;
int sl_nalloc;
int sl_nlines;
-/*@}*/
};
/**
* The structure used to store values parsed from a spec file.
*/
struct SpecStruct {
-/*@{*/
/*@only@*/ const char *specFile; /*!< Name of the spec file. */
/*@only@*/ const char *sourceRpmName;
+/*@only@*/ const char *buildRootURL;
+/*@only@*/ const char *buildSubdir;
+/*@only@*/ const char *rootURL;
/*@owned@*/ struct speclines *sl;
/*@owned@*/ struct spectags *st;
int anyarch;
int gotBuildRootURL;
-/*@only@*/ const char *buildRootURL;
-/*@only@*/ const char *buildSubdir;
char *passPhrase;
int timeCheck;
/*@dependent@*/ struct MacroContext *macros;
-/*@only@*/ const char *rootURL;
/*@only@*/ StringBuf prep; /*!< %prep scriptlet. */
/*@only@*/ StringBuf build; /*!< %build scriptlet. */
/*@only@*/ StringBuf install; /*!< %install scriptlet. */
/*@only@*/ StringBuf clean; /*!< %clean scriptlet. */
- /*@owned@*/ struct PackageStruct *packages; /*!< Package list. */
-/*@}*/
+/*@owned@*/ struct PackageStruct *packages; /*!< Package list. */
};
/**
* The structure used to store values for a package.
*/
struct PackageStruct {
-/*@{*/
- /*@refcounted@*/ Header header;
+/*@refcounted@*/ Header header;
int cpioCount;
/*@owned@*/ struct cpioFileMapping *cpioList;
int autoReq;
int autoProv;
- char *preInFile; /*!< %pre scriptlet. */
- char *postInFile; /*!< %post scriptlet. */
- char *preUnFile; /*!< %preun scriptlet. */
- char *postUnFile; /*!< %postun scriptlet. */
- char *verifyFile; /*!< %verifyscript scriptlet. */
+/*@only@*/ const char *preInFile; /*!< %pre scriptlet. */
+/*@only@*/ const char *postInFile; /*!< %post scriptlet. */
+/*@only@*/ const char *preUnFile; /*!< %preun scriptlet. */
+/*@only@*/ const char *postUnFile; /*!< %postun scriptlet. */
+/*@only@*/ const char *verifyFile; /*!< %verifyscript scriptlet. */
/*@only@*/ StringBuf specialDoc;
/*@only@*/ StringBuf fileList; /* If NULL, package will not be written */
/*@dependent@*/ struct PackageStruct *next;
-/*@}*/
};
/**
FREE(spec->buildRootURL);
FREE(spec->buildSubdir);
+ FREE(spec->rootURL);
FREE(spec->specFile);
FREE(spec->sourceRpmName);
libpthread=""
AC_CHECK_LIB(pthread, pthread_mutex_trylock,[libpthread="-lpthread"])
-DBLIBOBJS=""
+DBLIBSRCS=""
libdb3=""
libdb2=""
libdb1=""
dnl Check for Berkeley db3 API.
-AC_CHECK_FUNC(db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"],
- AC_CHECK_LIB(db-3.1, db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"; libdb3="-ldb-3.1"],
- AC_CHECK_LIB(db-3.0, db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"; libdb3="-ldb-3.0"],
- AC_CHECK_LIB(db, db_create, [DBLIBOBJS="$DBLIBOBJS db3.c"; libdb3="-ldb"],
+AC_CHECK_FUNC(db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"],
+ AC_CHECK_LIB(db-3.1, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.1"],
+ AC_CHECK_LIB(db-3.0, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb-3.0"],
+ AC_CHECK_LIB(db, db_create, [DBLIBSRCS="$DBLIBSRCS db3.c"; libdb3="-ldb"],
,$libpthread)
,$libpthread)
,$libpthread)
)
dnl Check for Berkeley db2 API.
-dnl AC_CHECK_FUNC(db_open, [DBLIBOBJS="$DBLIBOBJS db2.c"],
-dnl AC_CHECK_LIB(db, db_open, [LIBS="$LIBS"; DBLIBOBJS="$DBLIBOBJS db2.c" ; libdb2="-ldb"])
+dnl AC_CHECK_FUNC(db_open, [DBLIBSRCS="$DBLIBSRCS db2.c"],
+dnl AC_CHECK_LIB(db, db_open, [LIBS="$LIBS"; DBLIBSRCS="$DBLIBSRCS db2.c" ; libdb2="-ldb"])
dnl )
dnl Check for Berkeley db1 API retrofit to db2/db3 database.
-dnl AC_CHECK_FUNC(dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c"],
-dnl AC_CHECK_LIB(db, dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c"])
+dnl AC_CHECK_FUNC(dbopen, [DBLIBSRCS="$DBLIBSRCS db1.c"],
+dnl AC_CHECK_LIB(db, dbopen, [DBLIBSRCS="$DBLIBSRCS db1.c"])
dnl )
dnl Check for Berkeley db1 API in glibc.
-AC_CHECK_FUNC(dbopen, [DBLIBOBJS="$DBLIBOBJS db3.c"],
- AC_CHECK_LIB(db1, dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c falloc.c" ; libdb1="-ldb1"],
- AC_CHECK_LIB(db, dbopen, [DBLIBOBJS="$DBLIBOBJS db1.c falloc.c" ; libdb1="-ldb"])
+AC_CHECK_FUNC(dbopen, [DBLIBSRCS="$DBLIBSRCS db3.c"],
+ AC_CHECK_LIB(db1, dbopen, [DBLIBSRCS="$DBLIBSRCS db1.c falloc.c" ; libdb1="-ldb1"],
+ AC_CHECK_LIB(db, dbopen, [DBLIBSRCS="$DBLIBSRCS db1.c falloc.c" ; libdb1="-ldb"])
)
)
-if test X"$DBLIBOBJS" = X; then
+if test X"$DBLIBSRCS" = X; then
AC_MSG_ERROR([sorry rpm requires libdb-3.x.a or libdb1.a (from the Berkeley db package)])
fi
LIBS="$saveLIBS"
fi
+DBLIBOBJS=`echo $DBLIBSRCS | sed -e "s/\.c/\.lo/g"`
+
+AC_SUBST(DBLIBSRCS)
AC_SUBST(DBLIBOBJS)
AC_SUBST(libdb3)
AC_SUBST(libdb2)
AC_SUBST(libdb1)
-for dbi in $DBLIBOBJS; do
+for dbi in $DBLIBSRCS; do
case $dbi in
db3.c) AC_DEFINE(USE_DB3) ;;
db2.c) AC_DEFINE(USE_DB2) ;;
header.h misc.h rpmlib.h stringbuf.h
noinst_HEADERS = \
cpio.h depends.h falloc.h fprint.h hash.h install.h \
- md5.h rpmdb.h rpmlead.h signature.h
+ md5.h \
+ rpmdb.h rpmlead.h signature.h
mylibpaths = -L$(top_builddir)/lib/.libs -L$(top_builddir)/rpmio/.libs \
-L$(top_builddir)/popt/.libs
lib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \
- cpio.c $(DBLIBOBJS) depends.c \
+ cpio.c $(DBLIBSRCS) depends.c \
formats.c fprint.c fs.c hash.c header.c install.c \
md5.c md5sum.c misc.c package.c problems.c \
poptBT.c poptQV.c query.c rpmchecksig.c rpmdb.c rpminstall.c \
rpmlead.c rpmlibprov.c rpmrc.c signature.c stringbuf.c stubs.c \
tagName.c tagtable.c transaction.c uninstall.c verify.c
librpm_la_LDFLAGS = @libdb3@ @libdb2@ @libdb1@
-librpm_la_LIBADD = $(subst .c,.lo,$(DBLIBOBJS))
+librpm_la_LIBADD = $(DBLIBOBJS)
+librpm_la_DEPENDENCIES = $(DBLIBOBJS)
# XXX Add internal libtool dependence
install-data-local:
lclint:
lclint $(DEFS) $(INCLUDES) $(librpm_la_SOURCES)
-tmacro: macro.c
- $(CC) $(CFLAGS) $(DEFS) -DDEBUG_MACROS $(INCLUDES) -o $@ $<
-
-rpmeval: macro.c
- $(CC) $(CFLAGS) $(DEFS) -DDEBUG_MACROS -DEVAL_MACROS $(INCLUDES) -o $@ $<
-
-tufdio: tufdio.c
+th: th.c librpm.la
$(CC) $(CFLAGS) $(DEFS) $(INCLUDES) -o $@ $< $(mylibpaths) $(mylibs) $(LIBS)
/**
* Create file from payload stream.
+ * @todo Legacy: support brokenEndian MD5 checks?
* @param cfd payload file handle
* @param hdr file name and stat info
* @param filemd5 file md5 sum
if (ofd == NULL || Ferror(ofd))
return CPIOERR_OPEN_FAILED;
+ /* XXX This doesn't support brokenEndian checks. */
if (filemd5)
- fdInitMD5(ofd);
+ fdInitMD5(ofd, 0);
cbInfo.file = hdr->path;
cbInfo.fileSize = st->st_size;
#ifdef NOTYET
char * md5sum = NULL;
- fdInitMD5(cfd);
+ fdInitMD5(cfd, 0);
#endif
fdSetCpioPos(cfd, 0);
static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
+#ifdef HAVE_DB1_DB_H
#include <db1/db.h>
+#else
+#ifdef HAVE_DB_185_H
+#include <db_185.h> /* XXX there are too mant compat API's for this to work */
+#else
+#include <db.h>
+#endif
+#endif
#define DB_VERSION_MAJOR 0
#define DB_VERSION_MINOR 0
/*@notreached@*/ return DB_HASH;
}
-/** \ingroup db1
- */
-char * db1basename (int rpmtag) {
- char * base = NULL;
- switch (rpmtag) {
- case 0: base = "packages.rpm"; break;
- case RPMTAG_NAME: base = "nameindex.rpm"; break;
- case RPMTAG_BASENAMES: base = "fileindex.rpm"; break;
- case RPMTAG_GROUP: base = "groupindex.rpm"; break;
- case RPMTAG_REQUIRENAME: base = "requiredby.rpm"; break;
- case RPMTAG_PROVIDENAME: base = "providesindex.rpm"; break;
- case RPMTAG_CONFLICTNAME: base = "conflictsindex.rpm"; break;
- case RPMTAG_TRIGGERNAME: base = "triggerindex.rpm"; break;
- default:
- { const char * tn = tagName(rpmtag);
- base = alloca( strlen(tn) + sizeof(".idx") + 1 );
- (void) stpcpy( stpcpy(base, tn), ".idx");
- } break;
- }
- return xstrdup(base);
-}
-
static /*@observer@*/ const char * db_strerror(int error)
{
if (error == 0)
* list.
*/
if (!headerGetEntryMinMemory(h, RPMTAG_OLDFILENAMES, NULL,
- (void **) &fileNames, &fileCount)) goto exit;
+ (const void **) &fileNames, &fileCount)) goto exit;
for (i = 0; i < fileCount; i++)
if (*fileNames[i] != '/') break;
p->requireFlags = NULL;
}
- if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL, (void **)
- &p->baseNames, &p->filesCount)) {
+ if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
+ (const void **) &p->baseNames, &p->filesCount))
+ {
p->filesCount = 0;
p->baseNames = NULL;
} else {
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (void **)
- &dirNames, &numDirs);
- headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL, (void **)
- &dirIndexes, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
+ (const void **) &dirNames, &numDirs);
+ headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
+ (const void **) &dirIndexes, NULL);
headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
/* XXX FIXME: We ought to relocate the directory list here */
int_32 * dirIndexes;
if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
- (void **) &baseNames, &fileCount)) return;
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames,
- NULL);
- headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
-
- fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
+ (const void **) &baseNames, &fileCount)) return;
+ headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
+ (const void **) &dirNames, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
+ (const void **) &dirIndexes, NULL);
+ fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
free(dirNames);
free(baseNames);
}
#include <rpmio.h>
#include <header.h>
-
+#include <assert.h>
/* XXX avoid rpmlib.h for debugging. */
/*@observer@*/ const char *const tagName(int tag) /*@*/;
#define PARSER_IN_ARRAY 1
#define PARSER_IN_EXPR 2
-static unsigned char header_magic[4] = { 0x8e, 0xad, 0xe8, 0x01 };
+static unsigned char header_magic[8] = {
+ 0x8e, 0xad, 0xe8, 0x01, 0x00, 0x00, 0x00, 0x00
+};
/** \ingroup header
* Alignment needs (and sizeof scalars types) for internal rpm data types.
*/
static int typeSizes[] = {
- -1, /*!< RPM_NULL_TYPE */
+ 0, /*!< RPM_NULL_TYPE */
1, /*!< RPM_CHAR_TYPE */
1, /*!< RPM_INT8_TYPE */
2, /*!< RPM_INT16_TYPE */
int_32 count; /*!< Number of tag elements. */
};
-#define REGION_ID(_x, _y) (((_x) << 4) + ((_y) & 0xf))
#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 & 0xf) > 0)
+#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.
};
/**
- * A single contiguous region from a Header.
- */
-typedef struct {
- int allocated; /*!< Should region be freed? */
- int len; /*!< No. bytes in region. */
-/*@shared@*/ void * data; /*!< Region data. */
-} * headerRegion;
-
-/**
* The Header data structure.
*/
struct headerToken {
-/*@owned@*/ headerRegion regions;/*!< Data regions. */
struct indexEntry *index; /*!< Array of tags. */
- int nregions; /*!< No. of data regions. */
int indexUsed; /*!< Current size of tag array. */
int indexAlloced; /*!< Allocated size of tag array. */
- int sorted; /*!< Are header entries sorted? */
-/*@refs@*/ int nrefs; /*!< Reference count. */
+ int region_allocated; /*!< Is 1st header region allocated? */
+ int sorted; /*!< Are header entries sorted? */
+ int reloaded; /*!< Append region data? */
+/*@refs@*/ int nrefs; /*!< Reference count. */
};
/**
*/
struct sprintfTag {
- /* if NULL tag element is invalid */
- headerTagTagFunction ext;
+ headerTagTagFunction ext; /*!< if NULL tag element is invalid */
int extNum;
int_32 tag;
int justOne;
#define HEADERPROBE(_h, _msg)
#endif /* HAVE_MCHECK_H */
-static void copyEntry(const struct indexEntry * entry, /*@out@*/ int_32 * type,
- /*@out@*/ const void ** p, /*@out@*/ int_32 * c, int minimizeMemory)
- /*@modifies *type, *p, *c @*/
-{
- if (type)
- *type = entry->info.type;
- if (c)
- *c = entry->info.count;
- if (p == NULL)
- return;
-
- /* Now look it up */
- switch (entry->info.type) {
- case RPM_STRING_TYPE:
- if (entry->info.count == 1) {
- *p = entry->data;
- break;
- }
- /*@fallthrough@*/
- case RPM_STRING_ARRAY_TYPE:
- case RPM_I18NSTRING_TYPE:
- { const char ** ptrEntry;
- char * chptr;
- int i = entry->info.count;
- int tableSize = i * sizeof(char *);
-
- if (minimizeMemory) {
- ptrEntry = *p = xmalloc(tableSize);
- chptr = entry->data;
- } else {
- chptr = xmalloc(tableSize + entry->length); /* XXX memory leak */
- ptrEntry = *p = (void *)chptr;
- chptr += tableSize;
- memcpy(chptr, entry->data, entry->length);
- }
- while (i--) {
- *ptrEntry++ = chptr;
- chptr = strchr(chptr, 0);
- chptr++;
- }
- } break;
-
- default:
- *p = entry->data;
- break;
- }
-}
-
+/**
+ * Return length of entry data.
+ * @param type entry data type
+ * @param p entry data
+ * @param count entry item count
+ * @param onDisk data is concatenated strings (with NUL's))?
+ * @return no. bytes in data
+ */
static int dataLength(int_32 type, const void * p, int_32 count, int onDisk)
/*@*/
{
- int thisLen, length, i;
- char ** src, * chptr;
+ int length = 0;
- length = 0;
switch (type) {
case RPM_STRING_TYPE:
- if (count == 1) {
- /* Special case -- p is just the string */
+ if (count == 1) { /* Special case -- p is just the string */
length = strlen(p) + 1;
break;
}
/* This should not be allowed */
- fprintf(stderr, _("grabData() RPM_STRING_TYPE count must be 1.\n"));
+ fprintf(stderr, _("dataLength() RPM_STRING_TYPE count must be 1.\n"));
exit(EXIT_FAILURE);
/*@notreached@*/ break;
case RPM_STRING_ARRAY_TYPE:
case RPM_I18NSTRING_TYPE:
+ { int i;
+
/* This is like RPM_STRING_TYPE, except it's *always* an array */
/* Compute sum of length of all strings, including null terminators */
i = count;
- length = 0;
if (onDisk) {
- chptr = (char *) p;
+ const char * chptr = p;
+ int thisLen;
+
while (i--) {
thisLen = strlen(chptr) + 1;
length += thisLen;
chptr += thisLen;
}
} else {
- src = (char **) p;
+ const char ** src = (const char **)p;
while (i--) {
/* add one for null termination */
length += strlen(*src++) + 1;
}
}
- break;
+ } break;
default:
- if (typeSizes[type] != -1)
+ if (typeSizes[type] != -1) {
length = typeSizes[type] * count;
- else {
- fprintf(stderr, _("Data type %d not supported\n"), (int) type);
- exit(EXIT_FAILURE);
- /*@notreached@*/
+ break;
}
- break;
+ fprintf(stderr, _("Data type %d not supported\n"), (int) type);
+ exit(EXIT_FAILURE);
+ /*@notreached@*/ break;
}
return length;
}
-/********************************************************************/
-/* */
-/* Header iteration and copying */
-/* */
-/********************************************************************/
+/**
+ * Swap int_32 and int_16 arrays within header region.
+ * @param entry header entry
+ * @param il no. of entries
+ * @param dl start no. bytes of data
+ * @param pe header physical entry pointer (swapped)
+ * @param dataStart header data
+ * @param myoffset translate start of data (must be 0 now)
+ * @return no. bytes of data in region
+ */
+static int regionSwab(struct indexEntry * entry, int il, int dl,
+ const struct entryInfo * pe, char * dataStart, int myoff)
+{
+ for (; il > 0; il--, pe++) {
+ struct indexEntry ie;
+ void * t;
+
+ ie.info.tag = ntohl(pe->tag);
+ ie.info.type = ntohl(pe->type);
+assert(ie.info.type >= RPM_MIN_TYPE && ie.info.type <= RPM_MAX_TYPE);
+ ie.info.count = ntohl(pe->count);
+ ie.info.offset = ntohl(pe->offset);
+ ie.data = t = dataStart + ie.info.offset + myoff;
+ ie.length = dataLength(ie.info.type, ie.data, ie.info.count, 1);
+
+ if (entry) {
+ ie.info.offset = ((char *)pe - dataStart); /* negative offset */
+ *entry = ie; /* structure assignment */
+ entry++;
+ }
+
+ dl += ie.length;
+
+ /* Perform endian conversions */
+ switch (ntohl(pe->type)) {
+ case RPM_INT32_TYPE:
+ for (; ie.info.count > 0; ie.info.count--, ((int_32 *)t) += 1)
+ *((int_32 *)t) = htonl(*((int_32 *)t));
+ break;
+ case RPM_INT16_TYPE:
+ for (; ie.info.count > 0; ie.info.count--, ((int_16 *)t) += 1)
+ *((int_16 *)t) = htons(*((int_16 *)t));
+ break;
+ }
+ }
+ return dl;
+}
+
+/**
+ * Retrieve data from header entry.
+ * @param entry header entry
+ * @retval type address of type (or NULL)
+ * @retval p address of data (or NULL)
+ * @retval c address of count (or NULL)
+ * @param minMem string pointers refer to header memory?
+ */
+static void copyEntry(const struct indexEntry * entry, /*@out@*/ int_32 * type,
+ /*@out@*/ const void ** p, /*@out@*/ int_32 * c, int minMem)
+ /*@modifies *type, *p, *c @*/
+{
+ if (type)
+ *type = entry->info.type;
+ if (c)
+ *c = entry->info.count;
+ if (p == NULL)
+ return;
+
+ /* Now look it up */
+ switch (entry->info.type) {
+ case RPM_BIN_TYPE:
+ *p = (!minMem
+ ? memcpy(xmalloc(entry->length), entry->data, entry->length)
+ : entry->data);
+ break;
+ case RPM_STRING_TYPE:
+ if (entry->info.count == 1) {
+ *p = entry->data;
+ break;
+ }
+ /*@fallthrough@*/
+ case RPM_STRING_ARRAY_TYPE:
+ case RPM_I18NSTRING_TYPE:
+ { const char ** ptrEntry;
+ char * t;
+ int i = entry->info.count;
+ int tableSize = i * sizeof(char *);
+
+ if (minMem) {
+ ptrEntry = *p = xmalloc(tableSize);
+ t = entry->data;
+ } else {
+ t = xmalloc(tableSize + entry->length);
+ ptrEntry = *p = (void *)t;
+ t += tableSize;
+ memcpy(t, entry->data, entry->length);
+ }
+ while (i--) {
+ *ptrEntry++ = t;
+ t = strchr(t, 0);
+ t++;
+ }
+ } break;
+
+ default:
+ *p = entry->data;
+ break;
+ }
+}
/**
* Header tag iterator data structure.
free(iter);
}
-int headerNextIterator(HeaderIterator iter,
+int headerNextIterator(HeaderIterator hi,
int_32 * tag, int_32 * type, const void ** p, int_32 * c)
{
- Header h = iter->h;
- int slot = iter->next_index;
+ Header h = hi->h;
+ int slot = hi->next_index;
+ struct indexEntry * entry;
- if (slot == h->indexUsed)
+ if (slot >= h->indexUsed)
return 0;
- iter->next_index++;
+ hi->next_index++;
+ entry = h->index + slot;
if (tag)
- *tag = h->index[slot].info.tag;
+ *tag = entry->info.tag;
- copyEntry(h->index + slot, type, p, c, 0);
+ copyEntry(entry, type, p, c, 0);
return 1;
}
static int indexCmp(const void *avp, const void *bvp) /*@*/
{
- const struct indexEntry * ap = avp;
- const struct indexEntry * bp = bvp;
+ const struct indexEntry * ap = avp, * bp = bvp;
return (ap->info.tag - bp->info.tag);
}
}
}
-static int offsetCmp(const void *avp, const void *bvp) /*@*/
+static int offsetCmp(const void *avp, const void *bvp) /*@*/
{
- const struct indexEntry * ap = avp;
- const struct indexEntry * bp = bvp;
+ const struct indexEntry * ap = avp, * bp = bvp;
int rc = (ap->info.offset - bp->info.offset);
if (rc == 0)
Header headerCopy(Header h)
{
+ Header res = headerNew();
+ HeaderIterator hi;
int_32 tag, type, count;
const void *ptr;
- HeaderIterator headerIter;
- Header res = headerNew();
+ int prevtag = 0;
- headerIter = headerInitIterator(h);
-
- while (headerNextIterator(headerIter, &tag, &type, &ptr, &count)) {
+ for (hi = headerInitIterator(h);
+ headerNextIterator(hi, &tag, &type, &ptr, &count);
+ ptr = headerFreeData((void *)ptr, type))
+ {
+ if (prevtag && prevtag > tag)
+ res->sorted = 0;
+ prevtag = tag;
headerAddEntry(res, tag, type, ptr, count);
- if (type == RPM_STRING_ARRAY_TYPE ||
- type == RPM_I18NSTRING_TYPE) free((void *)ptr);
}
-
- res->sorted = 1;
-
- headerFreeIterator(headerIter);
+ headerFreeIterator(hi);
return res;
}
-/********************************************************************/
-/* */
-/* Header loading and unloading */
-/* */
-/********************************************************************/
-#if 0
-static void fprIndexEntry(const char *msg, struct indexEntry *entry, int i)
-{
- const char * val;
- fprintf(stderr, "%6d %*s %p: %p[%d]",
- i, (3*(entry->info.offset & 0xf)), "",
- entry, entry->data, entry->length);
-
- switch (entry->info.type) {
- case RPM_STRING_TYPE:
- case RPM_STRING_ARRAY_TYPE:
- case RPM_I18NSTRING_TYPE:
- val = (const char *) entry->data;
- break;
- case RPM_CHAR_TYPE:
- val = "CHAR";
- break;
- case RPM_INT8_TYPE:
- val = "INT8";
- break;
- case RPM_INT16_TYPE:
- val = "INT16";
- break;
- case RPM_INT32_TYPE:
- val = "INT32";
- break;
- case RPM_BIN_TYPE:
- val = "BIN";
- break;
- default:
- val = "";
- break;
- }
-
- fprintf(stderr, "\t%-8.8s %s(%d) %s\n",
- val,
- tagName(entry->info.tag), entry->info.tag,
- (msg ? msg : ""));
-}
-#endif
-
Header headerLoad(void *pv)
{
int_32 *ei = (int_32 *) pv;
int_32 il = ntohl(ei[0]); /* index length */
int_32 dl = ntohl(ei[1]); /* data length */
int pvlen = sizeof(il) + sizeof(dl) +
- (il * sizeof(struct entryInfo)) + dl;
- char *p = (char *) &ei[2];
- Header h = xmalloc(sizeof(*h));
+ (il * sizeof(struct entryInfo)) + dl;
+ Header h = xcalloc(1, sizeof(*h));
- const char * dataStart;
- struct entryInfo * pe;
+ struct entryInfo * pe = (struct entryInfo *) &ei[2];
+ char * dataStart = (char *) (pe + il);
struct indexEntry * entry;
- int prevtag = 0;
- int rid = 0;
int i;
- h->nregions = 1;
- h->regions = xcalloc(h->nregions, sizeof(*h->regions));
- h->regions[0].allocated = 0;
- h->regions[0].len = pvlen;
- h->regions[0].data = pv;
-
h->indexAlloced = il + 1;
h->indexUsed = il;
- h->index = xcalloc(h->indexAlloced, sizeof(struct indexEntry));
+ h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->sorted = 1;
+ h->reloaded = 0;
h->nrefs = 1;
- pe = (struct entryInfo *) p;
- dataStart = (char *) (pe + il);
-
entry = h->index;
i = 0;
if (!(htonl(pe->tag) < HEADER_I18NTABLE)) {
entry->info.type = REGION_TAG_TYPE;
- prevtag = entry->info.tag = HEADER_IMAGE;
+ entry->info.tag = HEADER_IMAGE;
entry->info.count = REGION_TAG_COUNT;
- entry->info.offset = rid;
- entry->data = h->regions[0].data;
- entry->length = h->regions[0].len;
+ entry->info.offset = ((char *)(pe-1) - dataStart); /* negative offset */
+ entry->data = pe;
+ entry->length = pvlen - sizeof(il) - sizeof(dl);
entry++;
+ regionSwab(entry, il, 0, pe, dataStart, 0);
i++;
il++;
h->indexUsed++;
- }
-
- for (; i < h->indexUsed; i++, entry++, pe++) {
- char * t;
- int j;
+ } else {
+ int_32 * stei = memcpy(alloca(REGION_TAG_COUNT), dataStart + ntohl(pe->offset), REGION_TAG_COUNT);
+ int_32 rdl = -ntohl(stei[2]); /* negative offset */
+ int_32 ril = rdl/sizeof(*pe);
+ int dlen;
+ int j = 0;
entry->info.type = htonl(pe->type);
if (entry->info.type < RPM_MIN_TYPE || entry->info.type > RPM_MAX_TYPE)
return NULL;
-
entry->info.tag = htonl(pe->tag);
-
- /* Check that header entries are sorted. */
- if (entry->info.tag < prevtag)
- h->sorted = 0;
- prevtag = entry->info.tag;
-
entry->info.count = htonl(pe->count);
- entry->info.offset = htonl(pe->offset);
+ entry->info.offset = -rdl; /* negative offset */
- if (ENTRY_IS_REGION(entry)) {
- int doff;
- h->regions = xrealloc(h->regions,
- (h->nregions + 1) * sizeof(*h->regions));
-
- { int_32 * stei = (int_32 *) (dataStart + entry->info.offset);
- doff = ntohl(stei[2]);
- h->regions[h->nregions].data = dataStart + doff;
- h->regions[h->nregions].len = ntohl(stei[3]);
- }
-
- h->regions[h->nregions].allocated = 0;
- rid = REGION_ID(h->nregions, 0);
- h->nregions++;
-
- entry->info.offset = rid;
- entry->data = h->regions[h->nregions - 1].data;
- entry->length = h->regions[h->nregions - 1].len;
- continue;
- }
+ entry->length = pvlen - sizeof(il) - sizeof(dl);
+ dlen = regionSwab(entry+1, ril-1, 0, pe+1, dataStart, 0);
+ entry->data = dataStart + entry->info.offset;
- entry->data = t = dataStart + entry->info.offset;
- entry->length = dataLength(entry->info.type, t, entry->info.count, 1);
- entry->info.offset = rid + 1;
+ j += ril;
- /* Perform endian conversions. */
- switch (entry->info.type) {
- case RPM_INT32_TYPE:
- for (j = entry->info.count; j > 0; j--, t += sizeof(int_32))
- *((int_32 *)t) = htonl(*((int_32 *)t));
- break;
- case RPM_INT16_TYPE:
- for (j = entry->info.count; j > 0; j--, t += sizeof(int_16))
- *((int_16 *)t) = htons(*((int_16 *)t));
- break;
+ if (j < h->indexUsed) {
+ dlen = regionSwab(entry+ril, h->indexUsed-ril, dlen, pe+ril, dataStart, 0);
}
}
- if (!h->sorted) headerSort(h);
+ h->sorted = 0;
+ headerSort(h);
return h;
}
{
int_32 * ei;
struct entryInfo * pe;
- const char * dataStart;
+ char * dataStart;
char * te;
unsigned pad = 0;
unsigned len;
int_32 il;
int_32 dl;
- struct indexEntry * entry;
+ struct indexEntry * entry;
int i;
/* Sort entries by (region,tag) */
headerUnsort(h);
+
+ /* XXX Hack to avoid the headerSort() undoing headerUnsort. */
i = h->sorted;
h->sorted = 1;
len = headerSizeof(h, HEADER_MAGIC_NO);
dataStart = te = (char *) (pe + il);
for (; i < h->indexUsed; i++, entry++, pe++) {
+const char *t;
const char * src;
- unsigned diff;
int_32 type;
int count;
+ int dlen;
- pe->type = htonl(entry->info.type);
- pe->tag = htonl(entry->info.tag);
-
+t = te;
if (ENTRY_IS_REGION(entry)) {
-
- pe->count = htonl(REGION_TAG_COUNT);
- pe->offset = htonl(te - dataStart);
-
- { int_32 * stei = (int_32 *) te;
- int_32 doff = ((char *)entry->data) - dataStart;
- stei[0] = htonl(0);
- stei[1] = htonl(0);
- stei[2] = htonl(doff);
- stei[3] = htonl(entry->length);
- te = (char *) &stei[4];
+ int_32 rdl = -entry->info.offset; /* negative offset */
+ int_32 ril = rdl/sizeof(*pe);
+
+src = (char *)entry->data;
+dlen = (entry->length - rdl + sizeof(*pe));
+
+ if (!(h->reloaded || entry->info.tag == HEADER_IMAGE)) {
+ src += sizeof(*pe);
+ dlen -= REGION_TAG_COUNT;
}
-
+
+ memcpy(pe+1, src, (rdl - sizeof(*pe)));
+ memcpy(te, src + rdl - sizeof(*pe), dlen);
+ count = regionSwab(NULL, ril-1, 0, pe+1, te, 0);
+ te += dlen;
+
+ pe->tag = htonl(entry->info.tag);
+ pe->type = htonl(entry->info.type);
+ pe->count = htonl(entry->info.count);
+
+ if (!(h->reloaded || entry->info.tag == HEADER_IMAGE)) {
+ pe->offset = htonl(te - dataStart - REGION_TAG_COUNT);
+ } else {
+ int_32 * stei = memcpy(alloca(REGION_TAG_COUNT), te, REGION_TAG_COUNT);
+ stei[0] = pe->tag;
+ stei[1] = pe->type;
+ stei[2] = htonl(-rdl); /* YYY +REGION_TAG_COUNT */
+ stei[3] = pe->count;
+ memcpy(te, stei, REGION_TAG_COUNT);
+ pe->offset = htonl(te - dataStart);
+ te += REGION_TAG_COUNT;
+ }
+
+ i += (ril-1);
+ entry += (ril-1);
+ pe += (ril-1);
continue;
}
/* Alignment */
type = entry->info.type;
if (typeSizes[type] > 1) {
+ unsigned diff;
diff = typeSizes[type] - ((te - dataStart) % typeSizes[type]);
if (diff != typeSizes[type]) {
memset(te, 0, diff);
}
}
+ pe->tag = htonl(entry->info.tag);
+ pe->type = htonl(entry->info.type);
pe->count = htonl(entry->info.count);
pe->offset = htonl(te - dataStart);
}
}
+ /* Insure that there are no memcpy dribbles. */
+ assert(((char *)pe) == dataStart);
+ assert((((char *)ei)+len) == te);
+
if (lengthPtr)
*lengthPtr = len;
+ h->sorted = 0;
headerSort(h);
return (void *)ei;
return uh;
}
-Header headerReload(Header h)
+Header headerReload(Header h, int tag)
{
+ Header nh;
int length;
void * uh = doHeaderUnload(h, &length);
+
headerFree(h);
- h = headerLoad(uh);
- h->regions[0].allocated = 1;
- return h;
+ nh = headerLoad(uh);
+ nh->region_allocated = 1;
+ nh->reloaded = 1;
+ if (ENTRY_IS_REGION(nh->index)) {
+ if (tag == HEADER_SIGNATURES || tag == HEADER_IMMUTABLE)
+ nh->index[0].info.tag = tag;
+ }
+ return nh;
}
-/********************************************************************/
-/* */
-/* Reading and writing headers */
-/* */
-/********************************************************************/
-
int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
int length;
- void * uh = doHeaderUnload(h, &length);
+ const void * uh;
ssize_t nb;
+ uh = doHeaderUnload(h, &length);
switch (magicp) {
case HEADER_MAGIC_YES:
- { int_32 l = htonl(0);
-
nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
if (nb != sizeof(header_magic))
goto exit;
- nb = Fwrite(&l, sizeof(char), sizeof(l), fd);
- if (nb != sizeof(l))
- goto exit;
- } break;
+ break;
case HEADER_MAGIC_NO:
break;
}
nb = Fwrite(uh, sizeof(char), length, fd);
exit:
- free(uh);
+ free((void *)uh);
return (nb == length ? 0 : 1);
}
int_32 il;
int_32 dl;
int_32 magic;
- Header h;
+ Header h = NULL;
int len;
int i;
i += 2;
if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
- return NULL;
+ goto exit;
i = 0;
if (magicp == HEADER_MAGIC_YES) {
magic = block[i++];
if (memcmp(&magic, header_magic, sizeof(magic)))
- return NULL;
+ goto exit;
reserved = block[i++];
}
* XXX Limit total size of header to 32Mb (~16 times largest known size).
*/
if (len > (32*1024*1024))
- return NULL;
+ goto exit;
ei = xmalloc(len);
ei[0] = htonl(il);
if (timedRead(fd, (char *)&ei[2], len) != len) {
free(ei);
- return NULL;
+ goto exit;
}
- h = headerLoad(ei);
-
- h->regions[0].allocated = 1;
+ if ((h = headerLoad(ei)) != NULL)
+ h->region_allocated = 1;
+exit:
return h;
}
-/********************************************************************/
-/* */
-/* Header dumping */
-/* */
-/********************************************************************/
-
void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry * tags)
{
}
}
-/********************************************************************/
-/* */
-/* Entry lookup */
-/* */
-/********************************************************************/
-
+/**
+ * Find matching (tag,type) entry in header.
+ * @param h header
+ * @param tag entry tag
+ * @param type entry type
+ * @return header entry
+ */
static struct indexEntry *findEntry(Header h, int_32 tag, int_32 type)
{
struct indexEntry * entry, * entry2, * last;
key.info.tag = tag;
entry2 = entry =
- bsearch(&key, h->index, h->indexUsed, sizeof(*entry), indexCmp);
+ bsearch(&key, h->index, h->indexUsed, sizeof(*h->index), indexCmp);
if (entry == NULL)
return NULL;
return 1;
}
+/**
+ * Does locale match entry in header i18n table?
+ *
+ * \verbatim
+ * The range [l,le) contains the next locale to match:
+ * ll[_CC][.EEEEE][@dddd]
+ * where
+ * ll ISO language code (in lowercase).
+ * CC (optional) ISO coutnry code (in uppercase).
+ * EEEEE (optional) encoding (not really standardized).
+ * dddd (optional) dialect.
+ * \endverbatim
+ *
+ * @param td header i18n table data, NUL terminated
+ * @param l start of locale to match
+ * @param le end of locale to match
+ * @return 1 on match, 0 on no match
+ */
static int headerMatchLocale(const char *td, const char *l, const char *le)
/*@*/
{
const char *fe;
- /*
- * The range [l,le) contains the next locale to match:
- * ll[_CC][.EEEEE][@dddd]
- * where
- * ll ISO language code (in lowercase).
- * CC (optional) ISO coutnry code (in uppercase).
- * EEEEE (optional) encoding (not really standardized).
- * dddd (optional) dialect.
- */
#if 0
{ const char *s, *ll, *CC, *EE, *dd;
return 0;
}
+/**
+ * Return i18n string from header that matches locale.
+ * @param h header
+ * @param entry i18n string data
+ * @return matching i18n string (or 1st string if no match)
+ */
/*@dependent@*/ static char *
headerFindI18NString(Header h, struct indexEntry *entry)
{
return entry->data;
}
+/**
+ * Retrieve tag data from header.
+ * @param h header
+ * @param tag tag to retrieve
+ * @retval type address of type (or NULL)
+ * @retval p address of data (or NULL)
+ * @retval c address of count (or NULL)
+ * @param minMem string pointers reference header memory?
+ * @return 1 on success, 0 on not found
+ */
static int intGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
/*@out@*/ const void **p, /*@out@*/ int_32 *c, int minMem)
/*@modifies *type, *p, *c @*/
{
struct indexEntry * entry;
- char * chptr;
HEADERPROBE(h, "intGetEntry");
/* First find the tag */
entry = findEntry(h, tag, RPM_NULL_TYPE);
- if (!entry) {
+ if (entry == NULL) {
+ if (type) type = 0;
if (p) *p = NULL;
if (c) *c = 0;
return 0;
}
- if (entry->info.type == RPM_I18NSTRING_TYPE) {
- chptr = headerFindI18NString(h, entry);
-
+ switch (entry->info.type) {
+ case RPM_I18NSTRING_TYPE:
if (type) *type = RPM_STRING_TYPE;
if (c) *c = 1;
-
- /*@-dependenttrans@*/ *p = chptr; /*@=dependenttrans@*/
- } else {
+ /*@-dependenttrans@*/
+ if (p) *p = headerFindI18NString(h, entry);
+ /*@=dependenttrans@*/
+ break;
+ default:
copyEntry(entry, type, p, c, minMem);
+ break;
}
return 1;
}
-int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type, void **p,
+int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type, const void **p,
int_32 *c)
{
- return intGetEntry(h, tag, type, (const void **)p, c, 1);
+ return intGetEntry(h, tag, type, p, c, 1);
}
int headerGetEntry(Header h, int_32 tag, int_32 * type, void **p, int_32 * c)
return intGetEntry(h, tag, type, (const void **)p, c, 0);
}
-/********************************************************************/
-/* */
-/* Header creation and deletion */
-/* */
-/********************************************************************/
-
Header headerNew()
{
Header h = xcalloc(1, sizeof(*h));
- h->nregions = 0;
h->indexAlloced = INDEX_MALLOC_SIZE;
h->indexUsed = 0;
+ h->region_allocated = 1;
h->sorted = 1;
+ h->reloaded = 0;
h->nrefs = 1;
h->index = (h->indexAlloced
? xcalloc(h->indexAlloced, sizeof(*h->index))
: NULL);
- h->regions = (h->nregions
- ? xcalloc(h->nregions, sizeof(*h->regions))
- : NULL);
return h;
}
void headerFree(Header h)
{
- if (--h->nrefs)
+
+ if (h == NULL || --h->nrefs > 0)
return;
if (h->index) {
struct indexEntry * entry = h->index;
int i;
for (i = 0; i < h->indexUsed; i++, entry++) {
- if (ENTRY_IS_REGION(entry))
- continue;
- if (ENTRY_IN_REGION(entry))
- continue;
- free(entry->data);
+ if (h->region_allocated && ENTRY_IS_REGION(entry)) {
+ if (entry->length > 0) {
+ int_32 * ei = entry->data;
+ ei -= 2; /* XXX HACK: adjust to beginning of header. */
+ free(ei);
+ }
+ } else if (!ENTRY_IN_REGION(entry)) {
+ free(entry->data);
+ }
entry->data = NULL;
}
free(h->index);
h->index = NULL;
}
- if (h->regions) {
- /* XXX only region[0] needs to be free'ed if regions are nested. */
- if (h->regions[0].allocated) {
- free(h->regions[0].data);
- h->regions[0].data = NULL;
- }
- free(h->regions);
- h->regions = NULL;
- }
/*@-refcounttrans@*/ free(h); /*@=refcounttrans@*/
}
unsigned int headerSizeof(Header h, enum hMagic magicp)
{
struct indexEntry * entry;
- unsigned int size = 0, pad = 0;
+ unsigned int size = 0, rsize = 0, pad = 0;
int i;
headerSort(h);
+ size += sizeof(int_32); /* count of index entries */
+ size += sizeof(int_32); /* length of data */
+ size += sizeof(struct entryInfo) * h->indexUsed;
+ switch (magicp) {
+ case HEADER_MAGIC_YES:
+ size += sizeof(header_magic);
+ break;
+ case HEADER_MAGIC_NO:
+ break;
+ }
+
entry = h->index;
for (i = 0; i < h->indexUsed; i++, entry++) {
unsigned diff;
int_32 type;
- if (ENTRY_IS_REGION(entry)) {
- if (entry->info.count > 0)
- size += entry->info.count;
- continue;
- }
+ if (ENTRY_IS_REGION(entry)) {
+ if (entry->info.count > 0)
+ rsize += entry->info.count;
+ continue;
+ }
/* Alignment */
type = entry->info.type;
size += entry->length;
}
-
- size += sizeof(struct entryInfo) * h->indexUsed;
- size += sizeof(int_32); /* count of index entries */
- size += sizeof(int_32); /* length of data */
- if (magicp)
- size += 2*sizeof(int_32);
+ size += rsize;
+
return size;
}
}
}
+/**
+ * Return (malloc'ed) copy of entry data.
+ * @param type entry data type
+ * @param p entry data
+ * @param c entry item count
+ * @retval lengthPtr no. bytes in returned data
+ * @return (malloc'ed) copy of entry data
+ */
static void * grabData(int_32 type, const void * p, int_32 c,
/*@out@*/ int * lengthPtr)
/*@modifies *lengthPtr @*/
return data;
}
-/********************************************************************/
-/* */
-/* Adding and modifying entries */
-/* */
-/********************************************************************/
-
int headerAddEntry(Header h, int_32 tag, int_32 type, const void *p, int_32 c)
{
struct indexEntry *entry;
return 0; /* this shouldn't ever happen!! */
if (!table && !entry) {
- errmsg_t charArray[2];
+ const char * charArray[2];
int count = 0;
if (!lang || (lang[0] == 'C' && lang[1] == '\0')) {
/*@-observertrans@*/
/* Replace I18N string array */
entry->length -= strlen(be) + 1;
entry->length += sn;
+
if (ENTRY_IN_REGION(entry)) {
entry->info.offset = 0;
} else
entry->info.offset = 0;
} else
entry->data = xrealloc(entry->data, entry->length + length);
+
copyData(type, ((char *) entry->data) + entry->length, p, c, length);
entry->length += length;
if (ne > 0)
memmove(entry, first, (ne * sizeof(*entry)));
}
-
+
return 0;
}
static int parseExpression(struct sprintfToken * token, char * str,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
- /*@out@*/char ** endPtr, /*@out@*/ errmsg_t * errmsg)
+ /*@out@*/char ** endPtr, /*@out@*/const char ** errmsg)
/*@modifies str, *str, *token, *endPtr, *errmsg @*/;
static int parseFormat(char * str, const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
/*@out@*/struct sprintfToken ** formatPtr, /*@out@*/int * numTokensPtr,
- /*@out@*/char ** endPtr, int state, /*@out@*/ errmsg_t * errmsg)
+ /*@out@*/char ** endPtr, int state, /*@out@*/const char ** errmsg)
/*@modifies str, *str, *formatPtr, *numTokensPtr, *endPtr, *errmsg @*/
{
char * chptr, * start, * next, * dst;
static int parseExpression(struct sprintfToken * token, char * str,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
- /*@out@*/ char ** endPtr, /*@out@*/ errmsg_t * errmsg)
+ /*@out@*/ char ** endPtr, /*@out@*/ const char ** errmsg)
{
const struct headerTagTableEntry * tag;
const struct headerSprintfExtension * ext;
if (tag->arrayCount) {
/*@-observertrans -modobserver@*/
- if (type == RPM_STRING_ARRAY_TYPE) free((void *)data);
+ headerFreeData(data, type);
/*@=observertrans =modobserver@*/
countBuf = count;
if (!headerGetEntry(h, token->u.array.format[i].u.tag.tag,
&type, (void **) &val, &numElements))
continue;
- if (type == RPM_STRING_ARRAY_TYPE) free(val);
+ headerFreeData(val, type);
}
break;
}
char * headerSprintf(Header h, const char * origFmt,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
- errmsg_t * errmsg)
+ const char ** errmsg)
{
char * fmtString;
struct sprintfToken * format;
int type, count;
if (headerIsEntry(headerTo, *p))
continue;
- if (!headerGetEntry(headerFrom, *p, &type, (void **) &s, &count))
+ if (!headerGetEntryMinMemory(headerFrom, *p, &type,
+ (const void **) &s, &count))
continue;
headerAddEntry(headerTo, *p, type, s, count);
- if (s != NULL &&
- (type == RPM_STRING_ARRAY_TYPE || type == RPM_I18NSTRING_TYPE))
- free(s);
+ headerFreeData(s, type);
}
}
* Convert header to on-disk representation, and then reload.
* This is used to insure that all header data is in one chunk.
* @param h header (with pointers)
+ * @param tag region tag
* @return on-disk header (with offsets)
*/
-Header headerReload(/*@only@*/ Header h) /*@*/;
+Header headerReload(/*@only@*/ Header h, int tag) /*@*/;
/** \ingroup header
* Create new (empty) header instance.
* Dereference a header instance.
* @param h header
*/
-void headerFree( /*@killref@*/ Header h);
+void headerFree( /*@only@*/ /*@null@*/ /*@killref@*/ Header h);
/** \ingroup header
* Return header reference count.
* @return 1 on success, 0 on failure
*/
int headerGetEntryMinMemory(Header h, int_32 tag, int_32 *type,
- /*@out@*/ void **p, /*@out@*/ int_32 *c)
+ /*@out@*/ const void **p, /*@out@*/ int_32 *c)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
/** \ingroup header
* Duplicate tag values from one header into another.
- * @param headerFrom source header
- * @param headerTo destination header
- * @param tagstocopy array of tags that are copied
+ * @param headerFrom source header
+ * @param headerTo destination header
+ * @param tagstocopy array of tags that are copied
*/
void headerCopyTags(Header headerFrom, Header headerTo, int_32 *tagstocopy)
/*@modifies headerFrom, headerTo @*/;
} rpmTagType;
/** \ingroup header
+ * Free data allocated when retrieved from header.
+ * @param data address of data
+ * @param type type of data
+ * @return NULL always
+ */
+/*@unused@*/ static inline /*@null@*/ void * headerFreeData(
+ /*@only@*/ const void * data, rpmTagType type)
+{
+ if (type == RPM_STRING_ARRAY_TYPE ||
+ type == RPM_I18NSTRING_TYPE ||
+ type == RPM_BIN_TYPE) {
+ if (data) free((void *)data);
+ }
+ return NULL;
+}
+
+/** \ingroup header
* New rpm data types under consideration/development.
* These data types may (or may not) be added to rpm at some point. In order
* to avoid incompatibility with legacy versions of rpm, these data (sub-)types
#define HEADER_IMMUTABLE 63
#define HEADER_REGIONS 64
#define HEADER_I18NTABLE 100
+#define HEADER_SIGBASE 256
+#define HEADER_TAGBASE 1000
#ifdef __cplusplus
}
free(fileGroups);
}
+#ifdef DYING
/**
* Truncate header changelog tag to configurable limit before installing.
* @param h header
free(names);
free(texts);
}
+#endif /* DYING */
/**
* Copy file data from h to newH.
fileSize += fileSizes[i];
}
headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
- for (i = 0; mergeTags[i]; i++)
- if (headerGetEntryMinMemory(newH, mergeTags[i], &type,
- (void **) &data, &count)) {
- switch (type) {
- case RPM_CHAR_TYPE:
- case RPM_INT8_TYPE:
- newdata = xmalloc(fileCount * sizeof(int_8));
- for (j = 0, k = 0; j < count; j++)
- if (actions[j] != FA_SKIPMULTILIB)
+ for (i = 0; mergeTags[i]; i++) {
+ if (!headerGetEntryMinMemory(newH, mergeTags[i], &type,
+ (const void **) &data, &count))
+ continue;
+ switch (type) {
+ case RPM_CHAR_TYPE:
+ case RPM_INT8_TYPE:
+ newdata = xmalloc(fileCount * sizeof(int_8));
+ for (j = 0, k = 0; j < count; j++)
+ if (actions[j] != FA_SKIPMULTILIB)
((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
- fileCount);
- free (newdata);
- break;
- case RPM_INT16_TYPE:
- newdata = xmalloc(fileCount * sizeof(int_16));
- for (j = 0, k = 0; j < count; j++)
- if (actions[j] != FA_SKIPMULTILIB)
- ((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
- fileCount);
- free (newdata);
- break;
- case RPM_INT32_TYPE:
- newdata = xmalloc(fileCount * sizeof(int_32));
- for (j = 0, k = 0; j < count; j++)
- if (actions[j] != FA_SKIPMULTILIB)
- ((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
- fileCount);
- free (newdata);
- break;
- case RPM_STRING_ARRAY_TYPE:
- newdata = xmalloc(fileCount * sizeof(char *));
- for (j = 0, k = 0; j < count; j++)
- if (actions[j] != FA_SKIPMULTILIB)
- ((char **) newdata)[k++] = ((char **) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
+ headerAddOrAppendEntry(h, mergeTags[i], type, newdata,
fileCount);
- free (newdata);
- free (data);
- break;
- default:
- fprintf(stderr, _("Data type %d not supported\n"), (int) type);
- exit(EXIT_FAILURE);
- /*@notreached@*/
- }
- }
+ free (newdata);
+ break;
+ case RPM_INT16_TYPE:
+ newdata = xmalloc(fileCount * sizeof(int_16));
+ for (j = 0, k = 0; j < count; j++)
+ if (actions[j] != FA_SKIPMULTILIB)
+ ((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
+ headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
+ free (newdata);
+ break;
+ case RPM_INT32_TYPE:
+ newdata = xmalloc(fileCount * sizeof(int_32));
+ for (j = 0, k = 0; j < count; j++)
+ if (actions[j] != FA_SKIPMULTILIB)
+ ((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
+ headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
+ free (newdata);
+ break;
+ case RPM_STRING_ARRAY_TYPE:
+ newdata = xmalloc(fileCount * sizeof(char *));
+ for (j = 0, k = 0; j < count; j++)
+ if (actions[j] != FA_SKIPMULTILIB)
+ ((char **) newdata)[k++] = ((char **) data)[j];
+ headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fileCount);
+ free (newdata);
+ free (data);
+ break;
+ default:
+ fprintf(stderr, _("Data type %d not supported\n"), (int) type);
+ exit(EXIT_FAILURE);
+ /*@notreached@*/
+ }
+ }
headerGetEntry(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes,
&count);
headerGetEntryMinMemory(newH, RPMTAG_DIRNAMES, NULL,
- (void **) &newDirNames, NULL);
+ (const void **) &newDirNames, NULL);
headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (void **) &data,
+ headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL, (const void **) &data,
&dirNamesCount);
dirNames = xcalloc(dirNamesCount + fileCount, sizeof(char *));
dirNames[i] = ((char **) data)[i];
dirCount = dirNamesCount;
newdata = xmalloc(fileCount * sizeof(int_32));
- for (i = 0, k = 0; i < count; i++)
- if (actions[i] != FA_SKIPMULTILIB) {
- for (j = 0; j < dirCount; j++)
- if (!strcmp(dirNames[j], newDirNames[newDirIndexes[i]]))
- break;
- if (j == dirCount)
- dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
- ((int_32 *) newdata)[k++] = j;
- }
+ for (i = 0, k = 0; i < count; i++) {
+ if (actions[i] == FA_SKIPMULTILIB)
+ continue;
+ for (j = 0; j < dirCount; j++)
+ if (!strcmp(dirNames[j], newDirNames[newDirIndexes[i]]))
+ break;
+ if (j == dirCount)
+ dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
+ ((int_32 *) newdata)[k++] = j;
+ }
headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata,
fileCount);
if (dirCount > dirNamesCount)
uint_32 *Flags, *newFlags;
int Count = 0, newCount = 0;
- if (headerGetEntryMinMemory(newH, requireTags[i], NULL,
- (void **) &newNames, &newCount)) {
- headerGetEntryMinMemory(newH, requireTags[i+1], NULL,
- (void **) &newEVR, NULL);
- headerGetEntry(newH, requireTags[i+2], NULL, (void **) &newFlags,
- NULL);
- if (headerGetEntryMinMemory(h, requireTags[i], NULL,
- (void **) &Names, &Count)) {
- headerGetEntryMinMemory(h, requireTags[i+1], NULL,
- (void **) &EVR, NULL);
- headerGetEntry(h, requireTags[i+2], NULL, (void **) &Flags,
- NULL);
- for (j = 0; j < newCount; j++)
- for (k = 0; k < Count; k++)
- if (!strcmp (newNames[j], Names[k])
- && !strcmp (newEVR[j], EVR[k])
- && (newFlags[j] & RPMSENSE_SENSEMASK) ==
- (Flags[k] & RPMSENSE_SENSEMASK)) {
- newNames[j] = NULL;
- break;
- }
- }
- for (j = 0, k = 0; j < newCount; j++) {
- if (!newNames[j] || !isDependsMULTILIB(newFlags[j]))
- continue;
- if (j != k) {
- newNames[k] = newNames[j];
- newEVR[k] = newEVR[j];
- newFlags[k] = newFlags[j];
- }
- k++;
+ if (!headerGetEntryMinMemory(newH, requireTags[i], NULL,
+ (const void **) &newNames, &newCount))
+ continue;
+
+ headerGetEntryMinMemory(newH, requireTags[i+1], NULL,
+ (const void **) &newEVR, NULL);
+ headerGetEntry(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
+ if (headerGetEntryMinMemory(h, requireTags[i], NULL,
+ (const void **) &Names, &Count))
+ {
+ headerGetEntryMinMemory(h, requireTags[i+1], NULL,
+ (const void **) &EVR, NULL);
+ headerGetEntry(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
+ for (j = 0; j < newCount; j++)
+ for (k = 0; k < Count; k++)
+ if (!strcmp (newNames[j], Names[k])
+ && !strcmp (newEVR[j], EVR[k])
+ && (newFlags[j] & RPMSENSE_SENSEMASK) ==
+ (Flags[k] & RPMSENSE_SENSEMASK))
+ {
+ newNames[j] = NULL;
+ break;
+ }
+ }
+ for (j = 0, k = 0; j < newCount; j++) {
+ if (!newNames[j] || !isDependsMULTILIB(newFlags[j]))
+ continue;
+ if (j != k) {
+ newNames[k] = newNames[j];
+ newEVR[k] = newEVR[j];
+ newFlags[k] = newFlags[j];
}
- if (k) {
- headerAddOrAppendEntry(h, requireTags[i],
+ k++;
+ }
+ if (k) {
+ headerAddOrAppendEntry(h, requireTags[i],
RPM_STRING_ARRAY_TYPE, newNames, k);
- headerAddOrAppendEntry(h, requireTags[i+1],
+ headerAddOrAppendEntry(h, requireTags[i+1],
RPM_STRING_ARRAY_TYPE, newEVR, k);
- headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
+ headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
newFlags, k);
- }
}
}
return 0;
#else
urltype = urlPath(files[i].relativePath, &map[mappedFiles].fsPath);
#endif
- /* XXX Can't do src rpm MD5 sum verification yet. */
- map[mappedFiles].md5sum =
- specFile == NULL ? files[i].md5sum : NULL;
/* XXX Can't do src rpm MD5 sum verification (yet). */
/* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
map[mappedFiles].md5sum = headerIsEntry(h, RPMTAG_SOURCERPM)
- ? files[i].md5sum : NULL;
+ ? files[i].md5sum : NULL;
map[mappedFiles].finalMode = files[i].mode;
map[mappedFiles].finalUid = files[i].uid;
map[mappedFiles].finalGid = files[i].gid;
Chdir(realSourceDir);
if (installArchive(fd, fileCount > 0 ? files : NULL,
fileCount, notify, notifyData, NULL, h,
- specFileIndex >=0 ? NULL : &specFile,
+ specFileIndex >= 0 ? NULL : &specFile,
archiveSizePtr ? *archiveSizePtr : 0)) {
rc = 2;
goto exit;
currDir = NULL;
}
+#ifdef DYING
trimChangelog(h);
+#endif
/* if this package has already been installed, remove it from the database
before adding the new one */
#include "system.h"
#include "md5.h"
+#include "rpmio_internal.h"
/**
* Calculate MD5 sum for file.
* @return 0 on success, 1 on error
*/
static int domd5(const char * fn, unsigned char * digest, int asAscii,
- int brokenEndian) {
+ int brokenEndian)
+{
+ int rc;
+
+#ifndef DYING
unsigned char buf[1024];
unsigned char bindigest[16];
FILE * fp;
MD5_CTX ctx;
- int n;
memset(bindigest, 0, sizeof(bindigest));
fp = fopen(fn, "r");
}
rpmMD5Init(&ctx, brokenEndian);
- while ((n = fread(buf, 1, sizeof(buf), fp)) > 0)
- rpmMD5Update(&ctx, buf, n);
+ while ((rc = fread(buf, sizeof(buf[0]), sizeof(buf), fp)) > 0)
+ rpmMD5Update(&ctx, buf, rc);
rpmMD5Final(bindigest, &ctx);
if (ferror(fp)) {
fclose(fp);
}
fclose(fp);
+ rc = 0;
+#else
+ FD_t fd = Fopen(fn, "r.ufdio");
+ unsigned char buf[BUFSIZ];
+ unsigned char * md5sum = NULL;
+ size_t md5len;
+
+ if (fd == NULL || Ferror(fd)) {
+ if (fd)
+ Fclose(fd);
+ return 1;
+ }
+
+ /* Preserve legacy "brokenEndian" behavior. */
+ fdInitMD5(fd, (brokenEndian ? RPMDIGEST_NATIVE : 0) );
+
+ while ((rc = Fread(buf, sizeof(buf[0]), sizeof(buf), fd)) > 0)
+ ;
+ fdFiniMD5(fd, (void **)&md5sum, &md5len, 1);
+
+ if (Ferror(fd))
+ rc = 1;
+ Fclose(fd);
+
+ if (!rc)
+ memcpy(digest, md5sum, md5len);
+ if (md5sum)
+ free(md5sum);
+#endif
- return 0;
+ return rc;
}
int mdbinfile(const char *fn, unsigned char *bindigest) {
/*@notreached@*/ break;
}
+ if (headerIsEntry(h, tag))
+ return rpmHeaderGetEntry(h, tag, type, p, c);
+
if (sigs == NULL) {
if (c) *c = 0;
return 0;
}
return headerGetEntry(sigs, sigtag, type, p, c);
-
}
/*
/*@access Header@*/ /* XXX compared with NULL */
+void headerMergeLegacySigs(Header h, const Header sig)
+{
+ HeaderIterator hi;
+ int_32 tag, type, count;
+ const void * ptr;
+
+ for (hi = headerInitIterator(sig);
+ headerNextIterator(hi, &tag, &type, &ptr, &count);
+ ptr = headerFreeData(ptr, type))
+ {
+ if (tag < RPMSIGTAG_SIZE)
+ continue;
+ switch (tag) {
+ case RPMSIGTAG_SIZE: tag = RPMTAG_SIGSIZE; break;
+ case RPMSIGTAG_LEMD5_1: tag = RPMTAG_SIGLEMD5_1;break;
+ case RPMSIGTAG_PGP: tag = RPMTAG_SIGPGP; break;
+ case RPMSIGTAG_LEMD5_2: tag = RPMTAG_SIGLEMD5_2;break;
+ case RPMSIGTAG_MD5: tag = RPMTAG_SIGMD5; break;
+ case RPMSIGTAG_GPG: tag = RPMTAG_SIGGPG; break;
+ case RPMSIGTAG_PGP5: tag = RPMTAG_SIGPGP5; break;
+ default: break;
+ }
+ if (!headerIsEntry(h, tag))
+ headerAddEntry(h, tag, type, ptr, count);
+ }
+ headerFreeIterator(hi);
+}
+
/**
* Retrieve package components from file handle.
* @param fd file handle
only saves memory (nice), but gives fingerprinting a nice, fat
speed boost (very nice). Go ahead and convert old headers to
the new style (this is a noop for new headers) */
- if (lead->major < 4) {
+ if (lead->major < 4)
compressFilelist(*hdr);
- }
/* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
if (lead->type == RPMLEAD_SOURCE) {
/*@notreached@*/ break;
}
- if (hdrPtr == NULL) {
+ if (hdrPtr == NULL)
headerFree(*hdr);
- }
return 0;
}
-int rpmReadPackageInfo(FD_t fd, Header * signatures, Header * hdr)
+int rpmReadPackageInfo(FD_t fd, Header * sigp, Header * hdrp)
{
- return readPackageHeaders(fd, NULL, signatures, hdr);
+ int rc = readPackageHeaders(fd, NULL, sigp, hdrp);
+ if (hdrp && *hdrp && sigp && *sigp)
+ headerMergeLegacySigs(*hdrp, *sigp);
+ return rc;
}
-int rpmReadPackageHeader(FD_t fd, Header * hdr, int * isSource, int * major,
+int rpmReadPackageHeader(FD_t fd, Header * hdrp, int * isSource, int * major,
int * minor)
{
- int rc;
struct rpmlead lead;
+ Header sig = NULL;
+ int rc = readPackageHeaders(fd, &lead, &sig, hdrp);
+
+ if (rc)
+ goto exit;
- rc = readPackageHeaders(fd, &lead, NULL, hdr);
- if (rc) return rc;
+ if (hdrp && *hdrp && sig) {
+ headerMergeLegacySigs(*hdrp, sig);
+ headerFree(sig);
+ }
if (isSource) *isSource = lead.type == RPMLEAD_SOURCE;
if (major) *major = lead.major;
if (minor) *minor = lead.minor;
- return 0;
+exit:
+ return rc;
}
return rc;
}
+/*
+ * XXX gcc-2.96-60 on alpha (at least) needs ALPHA_LOSSAGE defined.
+ *
+ * Otherwise, the (mis-compilation?!) symptom is the inability to pass sig_type- * correctly to rpmReadSignature(FD_t *fd, Header *header, short sig_type)
+ * (Note: the short in both struct rpmlead and in the prototype).
+ */
+#define ALPHA_LOSSAGE
+
int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
{
FD_t fd = NULL;
FD_t ofd = NULL;
- struct rpmlead lead;
- unsigned short sigtype;
+ struct rpmlead lead, *l = &lead;
+ int sigtype;
const char *rpm, *trpm;
const char *sigtarget = NULL;
char tmprpm[1024+1];
Header sig = NULL;
int rc = EXIT_FAILURE;
+#ifdef ALPHA_LOSSAGE
+l = malloc(sizeof(*l));
+#endif
tmprpm[0] = '\0';
while ((rpm = *argv++) != NULL) {
if (manageFile(&fd, &rpm, O_RDONLY, 0))
goto exit;
- if (readLead(fd, &lead)) {
+ if (readLead(fd, l)) {
fprintf(stderr, _("%s: readLead failed\n"), rpm);
goto exit;
}
- switch (lead.major) {
+ switch (l->major) {
case 1:
fprintf(stderr, _("%s: Can't sign v1.0 RPM\n"), rpm);
goto exit;
break;
}
- if (rpmReadSignature(fd, &sig, lead.signature_type)) {
+ if (rpmReadSignature(fd, &sig, l->signature_type)) {
fprintf(stderr, _("%s: rpmReadSignature failed\n"), rpm);
goto exit;
}
if (manageFile(&ofd, &trpm, O_WRONLY|O_CREAT|O_TRUNC, 0))
goto exit;
- lead.signature_type = RPMSIG_HEADERSIG;
- if (writeLead(ofd, &lead)) {
+ l->signature_type = RPMSIG_HEADERSIG;
+ if (writeLead(ofd, l)) {
fprintf(stderr, _("%s: writeLead failed: %s\n"), trpm,
Fstrerror(ofd));
goto exit;
rc = 0;
exit:
+if (l != &lead) free(l);
if (fd) manageFile(&fd, NULL, 0, rc);
if (ofd) manageFile(&ofd, NULL, 0, rc);
FD_t fd = NULL;
FD_t ofd = NULL;
int res2, res3;
- struct rpmlead lead;
+ struct rpmlead lead, *l = &lead;
const char *rpm = NULL;
char result[1024];
const char * sigtarget = NULL;
const void * ptr;
int res = 0;
+#ifdef ALPHA_LOSSAGE
+l = malloc(sizeof(*l));
+#endif
while ((rpm = *argv++) != NULL) {
if (manageFile(&fd, &rpm, O_RDONLY, 0)) {
res++;
goto bottom;
}
- switch (lead.major) {
+ switch (l->major) {
case 1:
fprintf(stderr, _("%s: No signature available (v1.0 RPM)\n"), rpm);
res++;
default:
break;
}
- if (rpmReadSignature(fd, &sig, lead.signature_type)) {
+ if (rpmReadSignature(fd, &sig, l->signature_type)) {
fprintf(stderr, _("%s: rpmReadSignature failed\n"), rpm);
res++;
goto bottom;
xfree(sigtarget); sigtarget = NULL;
}
}
+if (l != &lead) free(l);
return res;
}
if (dbiTagToDbix(rpmtag) >= 0)
continue;
- dbiTags = xrealloc(dbiTags, (dbiTagsMax + 1) * sizeof(*dbiTags));
+ dbiTags = xrealloc(dbiTags, (dbiTagsMax + 1) * sizeof(*dbiTags)); /* XXX memory leak */
dbiTags[dbiTagsMax++] = rpmtag;
}
rc = openDatabase(prefix, NULL, _dbapi, &rpmdb, (O_CREAT | O_RDWR), perms, RPMDB_FLAG_JUSTCHECK);
if (rpmdb) {
+ rpmdbOpenAll(rpmdb);
rpmdbClose(rpmdb);
rpmdb = NULL;
}
}
headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
- (void **) &baseNames, NULL);
- headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
- (void **) &dirIndexes, NULL);
+ (const void **) &baseNames, NULL);
headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
- (void **) &dirNames, NULL);
+ (const void **) &dirNames, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
+ (const void **) &dirIndexes, NULL);
do {
fingerPrint fp2;
num = end - start;
/* Compute fingerprints for this header's matches */
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
- (void **) &dirNames, NULL);
headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
- (void **) &fullBaseNames, NULL);
+ (const void **) &fullBaseNames, NULL);
+ headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
+ (const void **) &dirNames, NULL);
headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
- (void **) &fullDirIndexes, NULL);
+ (const void **) &fullDirIndexes, NULL);
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
}
+char * db1basename (int rpmtag) {
+ char * base = NULL;
+ switch (rpmtag) {
+ case RPMDBI_PACKAGES: base = "packages.rpm"; break;
+ case RPMTAG_NAME: base = "nameindex.rpm"; break;
+ case RPMTAG_BASENAMES: base = "fileindex.rpm"; break;
+ case RPMTAG_GROUP: base = "groupindex.rpm"; break;
+ case RPMTAG_REQUIRENAME: base = "requiredby.rpm"; break;
+ case RPMTAG_PROVIDENAME: base = "providesindex.rpm"; break;
+ case RPMTAG_CONFLICTNAME: base = "conflictsindex.rpm"; break;
+ case RPMTAG_TRIGGERNAME: base = "triggerindex.rpm"; break;
+ default:
+ { const char * tn = tagName(rpmtag);
+ base = alloca( strlen(tn) + sizeof(".idx") + 1 );
+ (void) stpcpy( stpcpy(base, tn), ".idx");
+ } break;
+ }
+ return xstrdup(base);
+}
+
static int rpmdbRemoveDatabase(const char * rootdir,
const char * dbpath, int _dbapi)
{
/*@out@*/ int * minor)
/*@modifies fd, *hdr, *isSource, *major, *minor @*/;
-/**
+/** \ingroup header
* Return name, version, release strings from header.
* @param h header
* @retval np address of name pointer (or NULL)
int headerNVR(Header h, /*@out@*/ const char **np, /*@out@*/ const char **vp,
/*@out@*/ const char **rp) /*@modifies *np, *vp, *rp @*/;
+/** \ingroup header
+ * Translate and merge legacy signature tags into header.
+ * @param h header
+ * @param sig signature header
+ */
+void headerMergeLegacySigs(Header h, const Header sig)
+ /*@modifies h @*/;
+
/**
* Retrieve file names from header.
* The representation of file names in package headers changed in rpm-4.0.
*/
extern const struct headerSprintfExtension rpmHeaderFormats[];
-/* these pseudo-tags are used by the dbi iterator interface */
-#define RPMDBI_PACKAGES 0
-#define RPMDBI_DEPENDS 1
-#define RPMDBI_LABEL 2 /* XXX remove rpmdbFindByLabel from API */
-#define RPMDBI_ADDED 3
-#define RPMDBI_REMOVED 4
-#define RPMDBI_AVAILABLE 5
-
+/**
+ * Pseudo-tags used by the rpmdb iterator API.
+ */
+#define RPMDBI_PACKAGES 0 /*!< Installed package headers. */
+#define RPMDBI_DEPENDS 1 /*!< Dependency resolution cache. */
+#define RPMDBI_LABEL 2 /*!< Fingerprint search marker. */
+#define RPMDBI_ADDED 3 /*!< Added package headers. */
+#define RPMDBI_REMOVED 4 /*!< Removed package headers. */
+#define RPMDBI_AVAILABLE 5 /*!< Available package headers. */
/**
* Tags identify data in package headers.
/* Retrofit (and uniqify) signature tags for use by tagName() and rpmQuery. */
/* the md5 sum was broken *twice* on big endian machines */
/* XXX 2nd underscore prevents tagTable generation */
- RPMTAG_SIG_BASE = 256,
+ RPMTAG_SIG_BASE = HEADER_SIGBASE,
RPMTAG_SIGSIZE = RPMTAG_SIG_BASE+1,
RPMTAG_SIGLEMD5_1 = RPMTAG_SIG_BASE+2,
RPMTAG_SIGPGP = RPMTAG_SIG_BASE+3,
#define RPMVAR_NUM 55 /* number of RPMVAR entries */
/** \ingroup rpmrc
- * Return value of rpmrc variable.
+ * Return value of an rpmrc variable.
* @deprecated Use rpmExpand() with appropriate macro expression.
* @todo Eliminate from API.
*/
const char * rpmGetVar(int var);
/** \ingroup rpmrc
- * Set value of rpmrc variable.
+ * Set value of an rpmrc variable.
* @deprecated Use rpmDefineMacro() to change appropriate macro instead.
* @todo Eliminate from API.
*/
void rpmSetVar(int var, const char *val);
/** \ingroup rpmrc
- * List of macro files to read for configuring rpm.
+ * List of macro files to read when configuring rpm.
+ * This is a colon separated list of files. URI's are permitted as well,
+ * identified by the token '://', so file paths must not begin with '//'.
*/
const char * macrofiles;
* @todo Eliminate from API.
*/
enum rpm_machtable_e {
- RPM_MACHTABLE_INSTARCH = 0,
- RPM_MACHTABLE_INSTOS = 1,
- RPM_MACHTABLE_BUILDARCH = 2,
- RPM_MACHTABLE_BUILDOS = 3
+ RPM_MACHTABLE_INSTARCH = 0, /*!< Install platform architecture. */
+ RPM_MACHTABLE_INSTOS = 1, /*!< Install platform operating system. */
+ RPM_MACHTABLE_BUILDARCH = 2, /*!< Build platform architecture. */
+ RPM_MACHTABLE_BUILDOS = 3 /*!< Build platform operating system. */
};
-#define RPM_MACHTABLE_COUNT 4 /* number of arch/os tables */
+#define RPM_MACHTABLE_COUNT 4 /*!< No. of arch/os tables. */
/** \ingroup rpmrc
* Read macro configuration file(s) for a target.
/** \ingroup rpmrc
* Return arch/os score of a name.
- * An arch score measures the nearness of an arch name to the currently
- * running (or defined) platform arch. For example, the score of "i586"
- * on an i686 platform is (usually) 1. The arch score is used to select
- * one of several otherwise identical packages based on the arch/os hints
- * in the header of the intended platform.
+ * An arch/os score measures the "nearness" of a name to the currently
+ * running (or defined) platform arch/os. For example, the score of arch
+ * "i586" on an i686 platform is (usually) 2. The arch/os score is used
+ * to select one of several otherwise identical packages using the arch/os
+ * tags from the header as hints of the intended platform for the package.
* @todo Rewrite to use RE's against config.guess target platform output.
*
* @param type any of the RPM_MACHTABLE_* constants
* @param name name
- * @return arch score
+ * @return arch score (0 is no match, lower is preferred)
*/
int rpmMachineScore(int type, const char * name);
int rpmVerifyFile(const char * root, Header h, int filenum,
/*@out@*/ int * result, int omitMask);
+/**
+ * Return exit code from running verify script in header.
+ * @todo kpackage prevents static, should be using VERIFY_SCRIPT flag.
+ * @param rootDir path to top of install tree
+ * @param rpmdb rpm database
+ * @param h header
+ * @param scriptFd file handle to use for stderr
+ * @return 0 on success
+ */
+int rpmVerifyScript(const char * rootDir, rpmdb rpmdb, Header h, FD_t scriptFd);
+
/** \ingroup rpmcli
* The command line argument will be used to retrieve header(s) ...
*/
if (h == NULL)
break;
sigSize = headerSizeof(h, HEADER_MAGIC_YES);
+
+ /* XXX Legacy headers have a HEADER_IMAGE tag added. */
+ if (headerIsEntry(h, RPMTAG_HEADERIMAGE))
+ sigSize -= (16 + 16);
+
pad = (8 - (sigSize % 8)) % 8; /* 8-byte pad */
rpmMessage(RPMMESS_DEBUG, _("Signature size: %d\n"), sigSize);
rpmMessage(RPMMESS_DEBUG, _("Signature pad : %d\n"), pad);
int rpmWriteSignature(FD_t fd, Header header)
{
int sigSize, pad;
- byte buf[8];
+ static byte buf[8] = "\000\000\000\000\000\000\000\000";
int rc = 0;
rc = headerWrite(fd, header, HEADER_MAGIC_YES);
if (pad) {
rpmMessage(RPMMESS_DEBUG, _("Signature size: %d\n"), sigSize);
rpmMessage(RPMMESS_DEBUG, _("Signature pad : %d\n"), pad);
- memset(buf, 0, pad);
if (Fwrite(buf, sizeof(buf[0]), pad, fd) != pad)
rc = 1;
}
if (fi->bnl) {
free(fi->bnl); fi->bnl = NULL;
free(fi->dnl); fi->dnl = NULL;
-#ifdef DOUBLE_FREE
- xfree(fi->dil); fi->dil = NULL;
-#endif
}
if (fi->flinks) {
free(fi->flinks); fi->flinks = NULL;
if (fi->fstates) {
free(fi->fstates); fi->fstates = NULL;
}
+ if (fi->dil) {
+ xfree(fi->dil); fi->dil = NULL;
+ }
break;
case TR_ADDED:
break;
}
headerGetEntryMinMemory(h, RPMTAG_FILEMD5S, NULL,
- (void **) &otherMd5s, NULL);
+ (const void **) &otherMd5s, NULL);
headerGetEntryMinMemory(h, RPMTAG_FILELINKTOS, NULL,
- (void **) &otherLinks, NULL);
+ (const void **) &otherLinks, NULL);
headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL,
- (void **) &otherStates, NULL);
+ (const void **) &otherStates, NULL);
headerGetEntryMinMemory(h, RPMTAG_FILEMODES, NULL,
- (void **) &otherModes, NULL);
+ (const void **) &otherModes, NULL);
headerGetEntryMinMemory(h, RPMTAG_FILEFLAGS, NULL,
- (void **) &otherFlags, NULL);
+ (const void **) &otherFlags, NULL);
headerGetEntryMinMemory(h, RPMTAG_FILESIZES, NULL,
- (void **) &otherSizes, NULL);
+ (const void **) &otherSizes, NULL);
fi->replaced = xmalloc(sizeof(*fi->replaced) * sharedCount);
}
headerGetEntryMinMemory(h, RPMTAG_FILESTATES, NULL,
- (void **) &otherStates, NULL);
+ (const void **) &otherStates, NULL);
for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum;
break;
case TR_ADDED:
headerGetEntryMinMemory(fi->h, RPMTAG_FILEMD5S, NULL,
- (void **) &fi->fmd5s, NULL);
+ (const void **) &fi->fmd5s, NULL);
headerGetEntryMinMemory(fi->h, RPMTAG_FILELINKTOS, NULL,
- (void **) &fi->flinks, NULL);
+ (const void **) &fi->flinks, NULL);
/* 0 makes for noops */
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
continue;
free(fi->bnl); fi->bnl = NULL;
free(fi->dnl); fi->dnl = NULL;
-#ifdef DOUBLE_FREE
- xfree(fi->dil); fi->dil = NULL;
-#endif
switch (fi->type) {
case TR_ADDED:
free(fi->fmd5s); fi->fmd5s = NULL;
free(fi->fps); fi->fps = NULL;
break;
case TR_REMOVED:
+ xfree(fi->dil); fi->dil = NULL;
free(fi->fps); fi->fps = NULL;
break;
}
/**
* Return exit code from running verify script in header.
- * @param rootDir path to top of install tree
- * @param rpmdb rpm database
- * @param h header
- * @param scriptFd file handle to use for stderr
- * @return 0 on success
+ * @todo kpackage prevents static, should be using VERIFY_SCRIPT flag.
+ * @param rootDir path to top of install tree
+ * @param rpmdb rpm database
+ * @param h header
+ * @param scriptFd file handle to use for stderr
+ * @return 0 on success
*/
-static int rpmVerifyScript(const char * rootDir, rpmdb rpmdb, Header h, FD_t scriptFd)
+int rpmVerifyScript(const char * rootDir, rpmdb rpmdb, Header h, FD_t scriptFd)
{
rpmTransactionSet ts = rpmtransCreateSet(rpmdb, rootDir);
int rc;
CTAGS = @CTAGS@
DATADIRNAME = @DATADIRNAME@
DBLIBOBJS = @DBLIBOBJS@
+DBLIBSRCS = @DBLIBSRCS@
DLLTOOL = @DLLTOOL@
FINDPROVIDES = @FINDPROVIDES@
FINDREQUIRES = @FINDREQUIRES@
SYSCONFIGDIR = @SYSCONFIGDIR@
TOP_SOURCEDIR = @TOP_SOURCEDIR@
U = @U@
+UNZIPBIN = @UNZIPBIN@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2000-11-08 11:51-0500\n"
+"POT-Creation-Date: 2000-12-02 16:47-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n"
-#: build.c:25 lib/rpminstall.c:532
+#: build.c:25
#, c-format
-msgid "cannot open %s/packages.rpm\n"
+msgid "cannot open rpm database in %s\n"
msgstr ""
#: build.c:35
msgid "Unable to open spec file %s: %s\n"
msgstr ""
-#: build.c:126 build.c:138
+#: build.c:130 build.c:142
#, c-format
msgid "Failed to open tar pipe: %m"
msgstr ""
#. Give up
-#: build.c:145
+#: build.c:149
#, c-format
msgid "Failed to read spec file from %s"
msgstr ""
-#: build.c:172
+#: build.c:176
#, c-format
msgid "Failed to rename %s to %s: %m"
msgstr ""
-#: build.c:211
+#: build.c:215
#, c-format
msgid "failed to stat %s: %m"
msgstr ""
-#: build.c:216
+#: build.c:220
#, c-format
msgid "File %s is not a regular file."
msgstr ""
-#: build.c:224
+#: build.c:228
#, c-format
msgid "File %s does not appear to be a specfile."
msgstr ""
#. parse up the build operators
-#: build.c:285
+#: build.c:289
#, c-format
msgid "Building target platforms: %s\n"
msgstr ""
-#: build.c:300
+#: build.c:304
#, c-format
msgid "Building for target %s\n"
msgstr ""
msgid "no tar files given for build"
msgstr ""
-#: build/build.c:111 build/pack.c:362
+#: build/build.c:111 build/pack.c:356
msgid "Unable to open temp file."
msgstr ""
msgstr ""
#: build/expression.c:400 build/expression.c:445 build/expression.c:500
-#: build/expression.c:587
+#: build/expression.c:589
msgid "types must match"
msgstr ""
msgid "- not suported for strings"
msgstr ""
-#: build/expression.c:600
+#: build/expression.c:602
msgid "&& and || not suported for strings"
msgstr ""
-#: build/expression.c:634 build/expression.c:682
+#: build/expression.c:636 build/expression.c:684
msgid "syntax error in expression"
msgstr ""
msgid "line: %s"
msgstr ""
-#: build/files.c:1571
+#: build/files.c:1567
#, c-format
msgid "Bad file: %s: %s"
msgstr ""
-#: build/files.c:1583 build/parsePrep.c:40
+#: build/files.c:1579 build/parsePrep.c:40
#, c-format
msgid "Bad owner/group: %s"
msgstr ""
#. XXX this error message is probably not seen.
-#: build/files.c:1638
+#: build/files.c:1634
#, c-format
msgid "Couldn't exec %s: %s"
msgstr ""
-#: build/files.c:1643
+#: build/files.c:1639
#, c-format
msgid "Couldn't fork %s: %s"
msgstr ""
-#: build/files.c:1725
+#: build/files.c:1721
#, c-format
msgid "%s failed"
msgstr ""
-#: build/files.c:1729
+#: build/files.c:1725
#, c-format
msgid "failed to write all data to %s"
msgstr ""
-#: build/files.c:1825
+#: build/files.c:1846
#, c-format
msgid "Finding %s: (using %s)...\n"
msgstr ""
-#: build/files.c:1853 build/files.c:1863
+#: build/files.c:1874 build/files.c:1888
#, c-format
msgid "Failed to find %s:"
msgstr ""
-#: build/files.c:1973
+#: build/files.c:1997
#, c-format
msgid "Processing files: %s-%s-%s\n"
msgstr ""
msgid "cpio_copy read failed: %s"
msgstr ""
-#: build/pack.c:156
+#: build/pack.c:152
#, c-format
msgid "Could not open PreIn file: %s"
msgstr ""
-#: build/pack.c:163
+#: build/pack.c:159
#, c-format
msgid "Could not open PreUn file: %s"
msgstr ""
-#: build/pack.c:170
+#: build/pack.c:166
#, c-format
msgid "Could not open PostIn file: %s"
msgstr ""
-#: build/pack.c:177
+#: build/pack.c:173
#, c-format
msgid "Could not open PostUn file: %s"
msgstr ""
-#: build/pack.c:185
+#: build/pack.c:181
#, c-format
msgid "Could not open VerifyScript file: %s"
msgstr ""
-#: build/pack.c:200
+#: build/pack.c:196
#, c-format
msgid "Could not open Trigger script file: %s"
msgstr ""
-#: build/pack.c:226
+#: build/pack.c:222
#, c-format
msgid "readRPM: open %s: %s\n"
msgstr ""
-#: build/pack.c:236
+#: build/pack.c:232
#, c-format
msgid "readRPM: read %s: %s\n"
msgstr ""
-#: build/pack.c:257
+#: build/pack.c:253
#, c-format
msgid "readRPM: %s is not an RPM package\n"
msgstr ""
-#: build/pack.c:263
+#: build/pack.c:259
#, c-format
msgid "readRPM: reading header from %s\n"
msgstr ""
-#: build/pack.c:374
+#: build/pack.c:368
msgid "Bad CSA data"
msgstr ""
-#: build/pack.c:412
+#: build/pack.c:409
#, c-format
-msgid "Could not open %s: %s\n"
+msgid "Generating signature: %d\n"
msgstr ""
-#: build/pack.c:445
+#: build/pack.c:419
#, c-format
-msgid "Unable to write package: %s"
+msgid "Could not open %s: %s\n"
msgstr ""
-#: build/pack.c:457
+#: build/pack.c:455
#, c-format
-msgid "Generating signature: %d\n"
+msgid "Unable to write package: %s"
msgstr ""
#: build/pack.c:470
msgid "Unable to open sigtarget %s: %s"
msgstr ""
-#: build/pack.c:477
+#: build/pack.c:480
+#, c-format
+msgid "Unable to read header from %s: %s"
+msgstr ""
+
+#: build/pack.c:494
#, c-format
-msgid "Unable to read sigtarget %s: %s"
+msgid "Unable to write header to %s: %s"
msgstr ""
-#: build/pack.c:483
+#: build/pack.c:504
#, c-format
-msgid "Unable to write package %s: %s"
+msgid "Unable to read payload from %s: %s"
msgstr ""
-#: build/pack.c:506
+#: build/pack.c:510
+#, c-format
+msgid "Unable to write payload to %s: %s"
+msgstr ""
+
+#: build/pack.c:537
#, c-format
msgid "Wrote: %s\n"
msgstr ""
-#: build/pack.c:572
+#: build/pack.c:602
#, c-format
msgid "Could not generate output filename for package %s: %s\n"
msgstr ""
-#: build/pack.c:589
+#: build/pack.c:619
#, c-format
msgid "cannot create %s: %s\n"
msgstr ""
-#: build/parseBuildInstallClean.c:31
+#: build/parseBuildInstallClean.c:27
#, c-format
msgid "line %d: second %s"
msgstr ""
msgid "line %d: Error parsing %%description: %s"
msgstr ""
-#: build/parseDescription.c:52 build/parseFiles.c:46 build/parseScript.c:173
+#: build/parseDescription.c:52 build/parseFiles.c:46 build/parseScript.c:181
#, c-format
msgid "line %d: Bad option %s: %s"
msgstr ""
-#: build/parseDescription.c:65 build/parseFiles.c:58 build/parseScript.c:186
+#: build/parseDescription.c:65 build/parseFiles.c:58 build/parseScript.c:193
#, c-format
msgid "line %d: Too many names: %s"
msgstr ""
-#: build/parseDescription.c:75 build/parseFiles.c:67 build/parseScript.c:196
+#: build/parseDescription.c:75 build/parseFiles.c:67 build/parseScript.c:202
#, c-format
msgid "line %d: Package does not exist: %s"
msgstr ""
msgid "line %d: Second %%files list"
msgstr ""
-#: build/parsePreamble.c:149
+#: build/parsePreamble.c:202
#, c-format
msgid "Architecture is excluded: %s"
msgstr ""
-#: build/parsePreamble.c:154
+#: build/parsePreamble.c:207
#, c-format
msgid "Architecture is not included: %s"
msgstr ""
-#: build/parsePreamble.c:159
+#: build/parsePreamble.c:212
#, c-format
msgid "OS is excluded: %s"
msgstr ""
-#: build/parsePreamble.c:164
+#: build/parsePreamble.c:217
#, c-format
msgid "OS is not included: %s"
msgstr ""
-#: build/parsePreamble.c:178
+#: build/parsePreamble.c:231
#, c-format
msgid "%s field must be present in package: %s"
msgstr ""
-#: build/parsePreamble.c:203
+#: build/parsePreamble.c:256
#, c-format
msgid "Duplicate %s entries in package: %s"
msgstr ""
-#: build/parsePreamble.c:251
+#: build/parsePreamble.c:304
#, c-format
msgid "Unable to open icon %s: %s"
msgstr ""
-#: build/parsePreamble.c:269
+#: build/parsePreamble.c:322
#, c-format
msgid "Unable to read icon %s: %s"
msgstr ""
-#: build/parsePreamble.c:282
+#: build/parsePreamble.c:335
#, c-format
msgid "Unknown icon type: %s"
msgstr ""
-#: build/parsePreamble.c:345
+#: build/parsePreamble.c:401
#, c-format
msgid "line %d: Malformed tag: %s"
msgstr ""
#. Empty field
-#: build/parsePreamble.c:353
+#: build/parsePreamble.c:409
#, c-format
msgid "line %d: Empty tag: %s"
msgstr ""
-#: build/parsePreamble.c:375 build/parsePreamble.c:382
+#: build/parsePreamble.c:431 build/parsePreamble.c:438
#, c-format
msgid "line %d: Illegal char '-' in %s: %s"
msgstr ""
-#: build/parsePreamble.c:439 build/parseSpec.c:388
+#: build/parsePreamble.c:495 build/parseSpec.c:378
#, c-format
msgid "BuildRoot can not be \"/\": %s"
msgstr ""
-#: build/parsePreamble.c:452
+#: build/parsePreamble.c:508
#, c-format
msgid "line %d: Prefixes must not end with \"/\": %s"
msgstr ""
-#: build/parsePreamble.c:464
+#: build/parsePreamble.c:520
#, c-format
msgid "line %d: Docdir must begin with '/': %s"
msgstr ""
-#: build/parsePreamble.c:476
+#: build/parsePreamble.c:532
#, c-format
msgid "line %d: Epoch/Serial field must be a number: %s"
msgstr ""
-#: build/parsePreamble.c:534
+#: build/parsePreamble.c:572 build/parsePreamble.c:583
+#, c-format
+msgid "line %d: Bad %s: qualifiers: %s"
+msgstr ""
+
+#: build/parsePreamble.c:609
#, c-format
msgid "line %d: Bad BuildArchitecture format: %s"
msgstr ""
-#: build/parsePreamble.c:543
+#: build/parsePreamble.c:618
#, c-format
msgid "Internal error: Bogus tag %d"
msgstr ""
-#: build/parsePreamble.c:681
+#: build/parsePreamble.c:756
#, c-format
msgid "Bad package specification: %s"
msgstr ""
-#: build/parsePreamble.c:687
+#: build/parsePreamble.c:762
#, c-format
msgid "Package already exists: %s"
msgstr ""
-#: build/parsePreamble.c:714
+#: build/parsePreamble.c:787
#, c-format
msgid "line %d: Unknown tag: %s"
msgstr ""
-#: build/parsePreamble.c:739
+#: build/parsePreamble.c:809
msgid "Spec file can't use BuildRoot"
msgstr ""
msgid "line %d: Version required: %s"
msgstr ""
-#: build/parseScript.c:141
+#: build/parseScript.c:150
#, c-format
msgid "line %d: triggers must have --: %s"
msgstr ""
-#: build/parseScript.c:151 build/parseScript.c:214
+#: build/parseScript.c:160 build/parseScript.c:218
#, c-format
msgid "line %d: Error parsing %s: %s"
msgstr ""
-#: build/parseScript.c:161
+#: build/parseScript.c:170
#, c-format
msgid "line %d: script program must begin with '/': %s"
msgstr ""
-#: build/parseScript.c:205
+#: build/parseScript.c:210
#, c-format
msgid "line %d: Second %s"
msgstr ""
-#: build/parseSpec.c:138
+#: build/parseSpec.c:132
#, c-format
msgid "line %d: %s"
msgstr ""
#. XXX Fstrerror
-#: build/parseSpec.c:190
+#: build/parseSpec.c:180
#, c-format
msgid "Unable to open %s: %s\n"
msgstr ""
-#: build/parseSpec.c:202
+#: build/parseSpec.c:192
msgid "Unclosed %%if"
msgstr ""
-#: build/parseSpec.c:273
+#: build/parseSpec.c:263
#, c-format
msgid "%s:%d: parseExpressionBoolean returns %d"
msgstr ""
#. Got an else with no %if !
-#: build/parseSpec.c:281
+#: build/parseSpec.c:271
msgid "%s:%d: Got a %%else with no if"
msgstr ""
#. Got an end with no %if !
-#: build/parseSpec.c:292
+#: build/parseSpec.c:282
msgid "%s:%d: Got a %%endif with no if"
msgstr ""
-#: build/parseSpec.c:306 build/parseSpec.c:315
+#: build/parseSpec.c:296 build/parseSpec.c:305
msgid "malformed %%include statement"
msgstr ""
-#: build/parseSpec.c:491
+#: build/parseSpec.c:484
msgid "No buildable architectures"
msgstr ""
-#: build/parseSpec.c:546
+#: build/parseSpec.c:539
msgid "Package has no %%description: %s"
msgstr ""
msgid "line %d: Bad %s number: %s\n"
msgstr ""
-#: lib/cpio.c:444
+#: lib/cpio.c:445
#, c-format
msgid "can't rename %s to %s: %s\n"
msgstr ""
-#: lib/cpio.c:450
+#: lib/cpio.c:451
#, c-format
msgid "can't unlink %s: %s\n"
msgstr ""
-#: lib/cpio.c:756
+#: lib/cpio.c:758
#, c-format
msgid "getNextHeader: %s\n"
msgstr ""
-#: lib/cpio.c:1242
+#: lib/cpio.c:1244
#, c-format
msgid "(error 0x%x)"
msgstr ""
-#: lib/cpio.c:1245
+#: lib/cpio.c:1247
msgid "Bad magic"
msgstr ""
-#: lib/cpio.c:1246
+#: lib/cpio.c:1248
msgid "Bad/unreadable header"
msgstr ""
-#: lib/cpio.c:1264
+#: lib/cpio.c:1266
msgid "Header size too big"
msgstr ""
-#: lib/cpio.c:1265
+#: lib/cpio.c:1267
msgid "Unknown file type"
msgstr ""
-#: lib/cpio.c:1266
+#: lib/cpio.c:1268
msgid "Missing hard link"
msgstr ""
-#: lib/cpio.c:1267
+#: lib/cpio.c:1269
msgid "MD5 sum mismatch"
msgstr ""
-#: lib/cpio.c:1268
+#: lib/cpio.c:1270
msgid "Internal error"
msgstr ""
-#: lib/cpio.c:1277
+#: lib/cpio.c:1279
msgid " failed - "
msgstr ""
#. XXX legacy epoch-less requires/conflicts compatibility
-#: lib/depends.c:553
+#: lib/depends.c:554
#, c-format
msgid ""
"the \"B\" dependency needs an epoch (assuming same as \"A\")\n"
"\tA %s\tB %s\n"
msgstr ""
-#: lib/depends.c:582
+#: lib/depends.c:583
#, c-format
msgid " %s A %s\tB %s\n"
msgstr ""
-#: lib/depends.c:936
+#: lib/depends.c:937
#, c-format
msgid "%s: %-45s YES (added files)\n"
msgstr ""
-#: lib/depends.c:995
+#: lib/depends.c:996
#, c-format
msgid "%s: %-45s YES (added provide)\n"
msgstr ""
-#: lib/depends.c:1047
+#: lib/depends.c:1048
#, c-format
msgid "%s: %-45s %-3s (cached)\n"
msgstr ""
-#: lib/depends.c:1066
+#: lib/depends.c:1067
#, c-format
msgid "%s: %-45s YES (rpmrc provides)\n"
msgstr ""
-#: lib/depends.c:1083
+#: lib/depends.c:1084
#, c-format
msgid "%s: %-45s YES (rpmlib provides)\n"
msgstr ""
-#: lib/depends.c:1105
+#: lib/depends.c:1106
#, c-format
msgid "%s: %-45s YES (db files)\n"
msgstr ""
-#: lib/depends.c:1118
+#: lib/depends.c:1119
#, c-format
msgid "%s: %-45s YES (db provides)\n"
msgstr ""
-#: lib/depends.c:1132
+#: lib/depends.c:1133
#, c-format
msgid "%s: %-45s NO\n"
msgstr ""
-#: lib/depends.c:1153
+#: lib/depends.c:1154
#, c-format
msgid "%s: (%s, %s) added to Depends cache.\n"
msgstr ""
#. requirements are not satisfied.
-#: lib/depends.c:1211
+#: lib/depends.c:1212
#, c-format
msgid "package %s-%s-%s require not satisfied: %s\n"
msgstr ""
#. conflicts exist.
-#: lib/depends.c:1278
+#: lib/depends.c:1279
#, c-format
msgid "package %s conflicts: %s\n"
msgstr ""
-#: lib/depends.c:1464
+#: lib/depends.c:1505
#, c-format
msgid "removing %s-%s-%s \"%s\" from tsort relations.\n"
msgstr ""
#. Record all relations.
-#: lib/depends.c:1517
+#: lib/depends.c:1609
msgid "========== recording tsort relations\n"
msgstr ""
#. T4. Scan for zeroes.
-#: lib/depends.c:1574
+#: lib/depends.c:1659
msgid "========== tsorting packages\n"
msgstr ""
-#: lib/depends.c:1677
+#: lib/depends.c:1762
msgid "LOOP:\n"
msgstr ""
-#: lib/depends.c:1708
+#: lib/depends.c:1793
msgid "========== continuing tsort ...\n"
msgstr ""
-#: lib/db1.c:102 lib/db3.c:449
+#: lib/db1.c:88 lib/db3.c:449
#, c-format
msgid "db%d error(%d)"
msgstr ""
-#: lib/db1.c:104 lib/db3.c:451
+#: lib/db1.c:90 lib/db3.c:451
#, c-format
msgid " performing %s"
msgstr ""
-#: lib/db1.c:396
+#: lib/db1.c:382
#, c-format
msgid "closed db file %s\n"
msgstr ""
-#: lib/db1.c:399
+#: lib/db1.c:385
#, c-format
msgid "removed db file %s\n"
msgstr ""
-#: lib/db1.c:430
+#: lib/db1.c:416
#, c-format
msgid "bad db file %s"
msgstr ""
-#: lib/db1.c:435
+#: lib/db1.c:421
#, c-format
msgid "opening db file %s mode 0x%x\n"
msgstr ""
#. XXX check errno validity
-#: lib/db1.c:458
+#: lib/db1.c:444
#, c-format
msgid "cannot get %s lock on database"
msgstr ""
-#: lib/db1.c:459 lib/db3.c:1112
+#: lib/db1.c:445 lib/db3.c:1112
msgid "exclusive"
msgstr ""
-#: lib/db1.c:459 lib/db3.c:1112
+#: lib/db1.c:445 lib/db3.c:1112
msgid "shared"
msgstr ""
msgstr ""
#: lib/formats.c:86 lib/formats.c:112 lib/formats.c:141 lib/formats.c:182
-#: lib/header.c:2382 lib/header.c:2399 lib/header.c:2419
+#: lib/header.c:2397 lib/header.c:2414 lib/header.c:2434
msgid "(not a number)"
msgstr ""
-#: lib/fs.c:67
+#: lib/fs.c:69
#, c-format
msgid "mntctl() failed to return fugger size: %s"
msgstr ""
-#: lib/fs.c:102 lib/fs.c:285
+#: lib/fs.c:104 lib/fs.c:287
#, c-format
msgid "failed to stat %s: %s"
msgstr ""
-#: lib/fs.c:145
+#: lib/fs.c:147
msgid "getting list of mounted filesystems\n"
msgstr ""
-#: lib/fs.c:150
+#: lib/fs.c:152
#, c-format
msgid "failed to open %s: %s"
msgstr ""
-#: lib/fs.c:307
+#: lib/fs.c:309
#, c-format
msgid "file %s is on an unknown device"
msgstr ""
#. This should not be allowed
-#: lib/header.c:267
-msgid "grabData() RPM_STRING_TYPE count must be 1.\n"
+#: lib/header.c:215
+msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
msgstr ""
-#: lib/header.c:298 lib/header.c:897 lib/install.c:380
+#: lib/header.c:250 lib/header.c:885 lib/install.c:380
#, c-format
msgid "Data type %d not supported\n"
msgstr ""
-#: lib/header.c:1295
+#: lib/header.c:1308
#, c-format
msgid "Bad count for headerAddEntry(): %d\n"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1735
+#: lib/header.c:1750
#, c-format
msgid "missing { after %"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1765
+#: lib/header.c:1780
msgid "missing } after %{"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1779
+#: lib/header.c:1794
msgid "empty tag format"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1791
+#: lib/header.c:1806
msgid "empty tag name"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1808
+#: lib/header.c:1823
msgid "unknown tag"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1835
+#: lib/header.c:1850
msgid "] expected at end of array"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1853
+#: lib/header.c:1868
msgid "unexpected ]"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1857
+#: lib/header.c:1872
msgid "unexpected }"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1917
+#: lib/header.c:1932
msgid "? expected in expression"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1926
+#: lib/header.c:1941
msgid "{ expected after ? in expression"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1939 lib/header.c:1980
+#: lib/header.c:1954 lib/header.c:1995
msgid "} expected in expression"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1949
+#: lib/header.c:1964
msgid ": expected following ? subexpression"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1965
+#: lib/header.c:1980
msgid "{ expected after : in expression"
msgstr ""
#. @-observertrans@
-#: lib/header.c:1990
+#: lib/header.c:2005
msgid "| expected at end of expression"
msgstr ""
-#: lib/header.c:2161
+#: lib/header.c:2176
msgid "(unknown type)"
msgstr ""
msgid "group %s does not exist - using root"
msgstr ""
-#: lib/install.c:255
+#: lib/install.c:256
msgid "%%instchangelog value in macro file should be a number, but isn't"
msgstr ""
#. this would probably be a good place to check if disk space
#. was used up - if so, we should return a different error
#. XXX FIXME: Fclose with libio destroys errno
-#: lib/install.c:657
+#: lib/install.c:665
#, c-format
msgid "unpacking of archive failed%s%s: %s"
msgstr ""
-#: lib/install.c:658
+#: lib/install.c:666
msgid " on file "
msgstr ""
-#: lib/install.c:707
+#: lib/install.c:715
msgid "installing a source package\n"
msgstr ""
-#: lib/install.c:727
+#: lib/install.c:735
#, c-format
msgid "cannot create sourcedir %s"
msgstr ""
-#: lib/install.c:733 lib/install.c:763
+#: lib/install.c:741 lib/install.c:771
#, c-format
msgid "cannot write to %s"
msgstr ""
-#: lib/install.c:737
+#: lib/install.c:745
#, c-format
msgid "sources in: %s\n"
msgstr ""
-#: lib/install.c:757
+#: lib/install.c:765
#, c-format
msgid "cannot create specdir %s"
msgstr ""
-#: lib/install.c:767
+#: lib/install.c:775
#, c-format
msgid "spec file in: %s\n"
msgstr ""
-#: lib/install.c:799 lib/install.c:827
+#: lib/install.c:807 lib/install.c:835
msgid "source package contains no .spec file"
msgstr ""
-#: lib/install.c:845
+#: lib/install.c:853
#, c-format
msgid "renaming %s to %s\n"
msgstr ""
-#: lib/install.c:847 lib/install.c:1119 lib/uninstall.c:42
+#: lib/install.c:855 lib/install.c:1127 lib/uninstall.c:42
#, c-format
msgid "rename of %s to %s failed: %s"
msgstr ""
-#: lib/install.c:937
+#: lib/install.c:945
msgid "source package expected, binary found"
msgstr ""
-#: lib/install.c:982
+#: lib/install.c:990
#, c-format
msgid "package: %s-%s-%s files test = %d\n"
msgstr ""
-#: lib/install.c:1042
+#: lib/install.c:1050
msgid "stopping install as we're running --test\n"
msgstr ""
-#: lib/install.c:1047
+#: lib/install.c:1055
msgid "running preinstall script (if any)\n"
msgstr ""
-#: lib/install.c:1079
+#: lib/install.c:1087
#, c-format
msgid "warning: %s created as %s"
msgstr ""
-#: lib/install.c:1115
+#: lib/install.c:1123
#, c-format
msgid "warning: %s saved as %s"
msgstr ""
-#: lib/install.c:1204
+#: lib/install.c:1214
msgid "running postinstall scripts (if any)\n"
msgstr ""
msgid "error creating temporary file %s"
msgstr ""
-#: lib/package.c:61
+#: lib/package.c:89
msgid "packaging version 1 is not supported by this version of RPM"
msgstr ""
-#: lib/package.c:119
+#: lib/package.c:146
msgid ""
"only packaging with major numbers <= 4 is supported by this version of RPM"
msgstr ""
msgid "%s: Fread failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:119 lib/rpmchecksig.c:249
+#: lib/rpmchecksig.c:130 lib/rpmchecksig.c:264
#, c-format
msgid "%s: readLead failed\n"
msgstr ""
-#: lib/rpmchecksig.c:124
+#: lib/rpmchecksig.c:135
#, c-format
msgid "%s: Can't sign v1.0 RPM\n"
msgstr ""
-#: lib/rpmchecksig.c:128
+#: lib/rpmchecksig.c:139
#, c-format
msgid "%s: Can't re-sign v2.0 RPM\n"
msgstr ""
-#: lib/rpmchecksig.c:136 lib/rpmchecksig.c:263
+#: lib/rpmchecksig.c:147 lib/rpmchecksig.c:278
#, c-format
msgid "%s: rpmReadSignature failed\n"
msgstr ""
-#: lib/rpmchecksig.c:140 lib/rpmchecksig.c:268
+#: lib/rpmchecksig.c:151 lib/rpmchecksig.c:283
#, c-format
msgid "%s: No signature available\n"
msgstr ""
-#: lib/rpmchecksig.c:173
+#: lib/rpmchecksig.c:184
#, c-format
msgid "%s: writeLead failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:179
+#: lib/rpmchecksig.c:190
#, c-format
msgid "%s: rpmWriteSignature failed: %s\n"
msgstr ""
-#: lib/rpmchecksig.c:255
+#: lib/rpmchecksig.c:270
#, c-format
msgid "%s: No signature available (v1.0 RPM)\n"
msgstr ""
-#: lib/rpmchecksig.c:418
+#: lib/rpmchecksig.c:433
msgid "NOT OK"
msgstr ""
-#: lib/rpmchecksig.c:419 lib/rpmchecksig.c:433
+#: lib/rpmchecksig.c:434 lib/rpmchecksig.c:448
msgid " (MISSING KEYS:"
msgstr ""
-#: lib/rpmchecksig.c:421 lib/rpmchecksig.c:435
+#: lib/rpmchecksig.c:436 lib/rpmchecksig.c:450
msgid ") "
msgstr ""
-#: lib/rpmchecksig.c:422 lib/rpmchecksig.c:436
+#: lib/rpmchecksig.c:437 lib/rpmchecksig.c:451
msgid " (UNTRUSTED KEYS:"
msgstr ""
-#: lib/rpmchecksig.c:424 lib/rpmchecksig.c:438
+#: lib/rpmchecksig.c:439 lib/rpmchecksig.c:453
msgid ")"
msgstr ""
-#: lib/rpmchecksig.c:432
+#: lib/rpmchecksig.c:447
msgid "OK"
msgstr ""
msgid "error(%d) removing record %s from %s"
msgstr ""
-#: lib/rpmdb.c:772 lib/rpmdb.c:2305
+#: lib/rpmdb.c:772 lib/rpmdb.c:2341
msgid "no dbpath has been set"
msgstr ""
msgstr ""
#. error
-#: lib/rpmdb.c:1082
+#: lib/rpmdb.c:1083
#, c-format
msgid "error(%d) counting packages"
msgstr ""
-#: lib/rpmdb.c:1141 lib/rpmdb.c:1675
+#: lib/rpmdb.c:1142 lib/rpmdb.c:1676
#, c-format
msgid "%s: cannot read header at 0x%x"
msgstr ""
-#: lib/rpmdb.c:1728
+#: lib/rpmdb.c:1729
#, c-format
msgid "removing 0 %s entries.\n"
msgstr ""
-#: lib/rpmdb.c:1739
+#: lib/rpmdb.c:1740
#, c-format
msgid "removing \"%s\" from %s index.\n"
msgstr ""
-#: lib/rpmdb.c:1748
+#: lib/rpmdb.c:1749
#, c-format
msgid "removing %d entries from %s index.\n"
msgstr ""
-#: lib/rpmdb.c:1890
+#: lib/rpmdb.c:1891
#, c-format
msgid "error(%d) allocating new package instance"
msgstr ""
-#: lib/rpmdb.c:1947
+#: lib/rpmdb.c:1954
#, c-format
msgid "adding 0 %s entries.\n"
msgstr ""
-#: lib/rpmdb.c:1963
+#: lib/rpmdb.c:1970
#, c-format
msgid "adding \"%s\" to %s index.\n"
msgstr ""
-#: lib/rpmdb.c:1972
+#: lib/rpmdb.c:1979
#, c-format
msgid "adding %d entries to %s index.\n"
msgstr ""
-#: lib/rpmdb.c:2330
+#: lib/rpmdb.c:2366
#, c-format
msgid "rebuilding database %s into %s\n"
msgstr ""
-#: lib/rpmdb.c:2334
+#: lib/rpmdb.c:2370
#, c-format
msgid "temporary database %s already exists"
msgstr ""
-#: lib/rpmdb.c:2340
+#: lib/rpmdb.c:2376
#, c-format
msgid "creating directory %s\n"
msgstr ""
-#: lib/rpmdb.c:2342
+#: lib/rpmdb.c:2378
#, c-format
msgid "error creating directory %s: %s"
msgstr ""
-#: lib/rpmdb.c:2349
+#: lib/rpmdb.c:2385
#, c-format
msgid "opening old database with dbapi %d\n"
msgstr ""
-#: lib/rpmdb.c:2360
+#: lib/rpmdb.c:2396
#, c-format
msgid "opening new database with dbapi %d\n"
msgstr ""
-#: lib/rpmdb.c:2383
+#: lib/rpmdb.c:2419
#, c-format
msgid "record number %d in database is bad -- skipping."
msgstr ""
-#: lib/rpmdb.c:2415
+#: lib/rpmdb.c:2451
#, c-format
msgid "cannot add record originally at %d"
msgstr ""
-#: lib/rpmdb.c:2433
+#: lib/rpmdb.c:2469
msgid "failed to rebuild database: original database remains in place\n"
msgstr ""
-#: lib/rpmdb.c:2441
+#: lib/rpmdb.c:2477
msgid "failed to replace old database with new database!\n"
msgstr ""
-#: lib/rpmdb.c:2443
+#: lib/rpmdb.c:2479
#, c-format
msgid "replace files in %s with files from %s to recover"
msgstr ""
-#: lib/rpmdb.c:2453
+#: lib/rpmdb.c:2489
#, c-format
msgid "removing directory %s\n"
msgstr ""
-#: lib/rpmdb.c:2455
+#: lib/rpmdb.c:2491
#, c-format
msgid "failed to remove directory %s: %s\n"
msgstr ""
msgid "installing binary packages\n"
msgstr ""
+#: lib/rpminstall.c:532
+#, c-format
+msgid "cannot open %s/packages.rpm\n"
+msgstr ""
+
#: lib/rpminstall.c:548
#, c-format
msgid "\"%s\" specifies multiple packages\n"
msgid "Please contact rpm-list@redhat.com\n"
msgstr ""
-#: lib/signature.c:114
+#: lib/signature.c:116
#, c-format
msgid "sigsize : %d\n"
msgstr ""
-#: lib/signature.c:115
+#: lib/signature.c:117
#, c-format
msgid "Header + Archive: %d\n"
msgstr ""
-#: lib/signature.c:116
+#: lib/signature.c:118
#, c-format
msgid "expected size : %d\n"
msgstr ""
-#: lib/signature.c:120
+#: lib/signature.c:122
msgid "file is not regular -- skipping size check\n"
msgstr ""
-#: lib/signature.c:139
+#: lib/signature.c:141
msgid "No signature\n"
msgstr ""
-#: lib/signature.c:143
+#: lib/signature.c:145
msgid "Old PGP signature\n"
msgstr ""
-#: lib/signature.c:154
+#: lib/signature.c:156
msgid "Old (internal-only) signature! How did you get that!?"
msgstr ""
-#: lib/signature.c:157
+#: lib/signature.c:159
msgid "New Header signature\n"
msgstr ""
#. 8-byte pad
-#: lib/signature.c:164 lib/signature.c:201
+#: lib/signature.c:171 lib/signature.c:208
#, c-format
msgid "Signature size: %d\n"
msgstr ""
-#: lib/signature.c:165 lib/signature.c:202
+#: lib/signature.c:172 lib/signature.c:209
#, c-format
msgid "Signature pad : %d\n"
msgstr ""
-#: lib/signature.c:265
+#: lib/signature.c:271
#, c-format
msgid "Couldn't exec pgp (%s)"
msgstr ""
-#: lib/signature.c:276
+#: lib/signature.c:282
msgid "pgp failed"
msgstr ""
#. PGP failed to write signature
#. Just in case
-#: lib/signature.c:283
+#: lib/signature.c:289
msgid "pgp failed to write signature"
msgstr ""
-#: lib/signature.c:288
+#: lib/signature.c:294
#, c-format
msgid "PGP sig size: %d\n"
msgstr ""
-#: lib/signature.c:299 lib/signature.c:376
+#: lib/signature.c:305 lib/signature.c:382
msgid "unable to read the signature"
msgstr ""
-#: lib/signature.c:304
+#: lib/signature.c:310
#, c-format
msgid "Got %d bytes of PGP sig\n"
msgstr ""
-#: lib/signature.c:342 lib/signature.c:687
+#: lib/signature.c:348 lib/signature.c:693
msgid "Couldn't exec gpg"
msgstr ""
-#: lib/signature.c:353
+#: lib/signature.c:359
msgid "gpg failed"
msgstr ""
#. GPG failed to write signature
#. Just in case
-#: lib/signature.c:360
+#: lib/signature.c:366
msgid "gpg failed to write signature"
msgstr ""
-#: lib/signature.c:365
+#: lib/signature.c:371
#, c-format
msgid "GPG sig size: %d\n"
msgstr ""
-#: lib/signature.c:381
+#: lib/signature.c:387
#, c-format
msgid "Got %d bytes of GPG sig\n"
msgstr ""
-#: lib/signature.c:408
+#: lib/signature.c:414
msgid "Generating signature using PGP.\n"
msgstr ""
-#: lib/signature.c:414
+#: lib/signature.c:420
msgid "Generating signature using GPG.\n"
msgstr ""
-#: lib/signature.c:493 lib/signature.c:555
+#: lib/signature.c:499 lib/signature.c:561
msgid "Could not run pgp. Use --nopgp to skip PGP checks."
msgstr ""
-#: lib/signature.c:553 lib/signature.c:626
+#: lib/signature.c:559 lib/signature.c:632
msgid "exec failed!\n"
msgstr ""
-#: lib/signature.c:628
+#: lib/signature.c:634
msgid "Could not run gpg. Use --nogpg to skip GPG checks."
msgstr ""
-#: lib/signature.c:716
+#: lib/signature.c:722
msgid "Couldn't exec pgp"
msgstr ""
#. @notreached@
#. This case should have been screened out long ago.
-#: lib/signature.c:720 lib/signature.c:773
+#: lib/signature.c:726 lib/signature.c:779
msgid "Invalid %%_signature spec in macro file"
msgstr ""
-#: lib/signature.c:753
+#: lib/signature.c:759
msgid "You must set \"%%_gpg_name\" in your macro file"
msgstr ""
-#: lib/signature.c:765
+#: lib/signature.c:771
msgid "You must set \"%%_pgp_name\" in your macro file"
msgstr ""
msgid "package lacks both group name and id lists (this should never happen)"
msgstr ""
-#: lib/verify.c:285
+#: lib/verify.c:286
#, c-format
msgid "missing %s\n"
msgstr ""
-#: lib/verify.c:347
+#: lib/verify.c:348
#, c-format
msgid "Unsatisfied dependencies for %s-%s-%s: "
msgstr ""
#: rpmio/macro.c:1503
#, c-format
-msgid "File %s is smaller than %d bytes"
+msgid "File %s is smaller than %u bytes"
msgstr ""
#: rpmio/rpmlog.c:25
CTAGS = @CTAGS@
DATADIRNAME = @DATADIRNAME@
DBLIBOBJS = @DBLIBOBJS@
+DBLIBSRCS = @DBLIBSRCS@
DLLTOOL = @DLLTOOL@
FINDPROVIDES = @FINDPROVIDES@
FINDREQUIRES = @FINDREQUIRES@
SYSCONFIGDIR = @SYSCONFIGDIR@
TOP_SOURCEDIR = @TOP_SOURCEDIR@
U = @U@
+UNZIPBIN = @UNZIPBIN@
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
USE_NLS = @USE_NLS@
VERSION = @VERSION@
Version: %{version}
Release: 0.1
Group: System Environment/Base
-Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-3.0.x/rpm-%{version}.tar.gz
+Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{version}.tar.gz
Copyright: GPL
Conflicts: patch < 2.5
%ifos linux
%package -n popt
Summary: A C library for parsing command line parameters.
Group: Development/Libraries
-Version: 1.6
+Version: 1.7
%description -n popt
Popt is a C library for parsing command line parameters. Popt was
}
gzdi = Fdopen(fdi, rpmio_flags); /* XXX gzdi == fdi */
- if (gzdi == NULL || Ferror(gzdi)) {
+ if (gzdi == NULL) {
fprintf(stderr, _("cannot re-open payload: %s\n"), Fstrerror(gzdi));
exit(EXIT_FAILURE);
}
-I$(top_srcdir)/popt @INCPATH@
pkgincdir = $(pkgincludedir)
-pkginc_HEADERS = rpmio.h rpmurl.h rpmmacro.h rpmlog.h rpmmessages.h rpmerr.h
-noinst_HEADERS = base64.h rpmio_internal.h ugid.h
+pkginc_HEADERS = \
+ rpmio.h rpmurl.h rpmmacro.h rpmlog.h rpmmessages.h rpmerr.h \
+ ugid.h
+noinst_HEADERS = base64.h rpmio_internal.h
lib_LTLIBRARIES = librpmio.la
librpmio_la_SOURCES = rpmrpc.c rpmio.c rpmio_api.c url.c macro.c \
rpmError(RPMERR_BADSPEC, _("File %s: %s"), file, Fstrerror(fd));
rc = 1;
} else if (nb < sizeof(magic)) {
- rpmError(RPMERR_BADSPEC, _("File %s is smaller than %d bytes"),
- file, sizeof(magic));
+ rpmError(RPMERR_BADSPEC, _("File %s is smaller than %u bytes"),
+ file, (unsigned)sizeof(magic));
rc = 0;
}
Fclose(fd);
/** \ingroup rpmio
*/
-/*@unused@*/ static inline void fdInitMD5(FD_t fd) {
- fd->digest = rpmDigestInit(RPMDIGEST_MD5);
+/*@unused@*/ static inline void fdInitMD5(FD_t fd, int flags) {
+ if (flags) flags = RPMDIGEST_NATIVE;
+ flags |= RPMDIGEST_MD5;
+ fd->digest = rpmDigestInit(flags);
}
/** \ingroup rpmio
-# $Id: rpmrc.in,v 2.31 2000/10/22 07:51:45 notting Exp $
+# $Id: rpmrc.in,v 2.32 2000/12/02 21:53:44 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
arch_compat: s390: i370
arch_compat: i370: noarch
-arch_compat: ia64: i686
-arch_compat: ia64: noarch
+arch_compat: ia64: i686 noarch
os_compat: IRIX64: IRIX
os_compat: solaris2.7: solaris2.3 solaris2.4 solaris2.5 solaris2.6
*) b=$f;;
esac
- $COMPRESS $b 2>/dev/null || {
+ $COMPRESS $b </dev/null 2>/dev/null || {
inode=`ls -i $b | awk '{ print $1 }'`
others=`find $d -type f -inum $inode`
if [ -n "$others" ]; then
injmode_t lastmode = INJ_UNKNOWN;
#if HAVE_MCHECK_H && HAVE_MTRACE
- mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
+ mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
#endif
setprogname(argv[0]); /* Retrofit glibc __progname */