- preliminary abstraction to support per-header methods.

CVS patchset: 4878
CVS date: 2001/06/19 11:38:51
This commit is contained in:
jbj 2001-06-19 11:38:51 +00:00
parent 29ea1567e7
commit c6bd3de937
23 changed files with 3575 additions and 2598 deletions

View File

@ -118,6 +118,7 @@
- fix: fsm reads/writes now return error on partial I/O. - fix: fsm reads/writes now return error on partial I/O.
- fix: Ferror returned spurious error for gzdio/bzdio. - fix: Ferror returned spurious error for gzdio/bzdio.
- check for API/ABI creep, diddle up some compatibility. - check for API/ABI creep, diddle up some compatibility.
- preliminary abstraction to support per-header methods.
4.0 -> 4.0.[12] 4.0 -> 4.0.[12]
- add doxygen and lclint annotations most everywhere. - add doxygen and lclint annotations most everywhere.

View File

@ -359,6 +359,9 @@ INPUT = \
@top_srcdir@/lib/fs.c \ @top_srcdir@/lib/fs.c \
@top_srcdir@/lib/fsm.c \ @top_srcdir@/lib/fsm.c \
@top_srcdir@/lib/fsm.h \ @top_srcdir@/lib/fsm.h \
@top_srcdir@/lib/hdrinline.c \
@top_srcdir@/lib/hdrinline.h \
@top_srcdir@/lib/hdrproto.h \
@top_srcdir@/lib/header.c \ @top_srcdir@/lib/header.c \
@top_srcdir@/lib/header.h \ @top_srcdir@/lib/header.h \
@top_srcdir@/lib/header_internal.c \ @top_srcdir@/lib/header_internal.c \

View File

@ -112,9 +112,9 @@ const char *getGnameS(const char *gname)
} }
/*@=nullderef@*/ /*@=nullderef@*/
time_t *const getBuildTime(void) int_32 *const getBuildTime(void)
{ {
static time_t buildTime[1]; static int_32 buildTime[1];
if (buildTime[0] == 0) if (buildTime[0] == 0)
buildTime[0] = time(NULL); buildTime[0] = time(NULL);

View File

@ -253,7 +253,7 @@ static int checkForValidArchitectures(Spec spec)
* @return 0 if OK * @return 0 if OK
*/ */
static int checkForRequired(Header h, const char * NVR) static int checkForRequired(Header h, const char * NVR)
/*@*/ /* LCL: parse error here with modifies */
{ {
int res = 0; int res = 0;
rpmTag * p; rpmTag * p;

View File

@ -126,7 +126,7 @@ void freeNames(void)
* Return build time stamp. * Return build time stamp.
* @return build time stamp * @return build time stamp
*/ */
/*@observer@*/ time_t * const getBuildTime(void) /*@*/; /*@observer@*/ int_32 * const getBuildTime(void) /*@*/;
/** \ingroup rpmbuild /** \ingroup rpmbuild
* Read next line from spec file. * Read next line from spec file.

View File

@ -1014,7 +1014,7 @@ mint) RPMCANONARCH=m68kmint ;;
esac esac
RPMCANONVENDOR="$build_vendor" RPMCANONVENDOR="$build_vendor"
case "${build_vendor}" in case "${build_vendor}" in
unknown|pc|redhat|pld|mandrake|conectiva) unknown|pc|ibm|redhat|pld|mandrake|conectiva)
test -f /etc/redhat-release && RPMCANONVENDOR=redhat test -f /etc/redhat-release && RPMCANONVENDOR=redhat
test -f /etc/pld-release && RPMCANONVENDOR=pld test -f /etc/pld-release && RPMCANONVENDOR=pld
test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake test -f /etc/mandrake-release && RPMCANONVENDOR=mandrake

245
doc/rpmbuild.8 Normal file
View File

@ -0,0 +1,245 @@
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "RPMBUILD" "8" "06 June 2001" "Red Hat, Inc." "Red Hat Linux"
.SH NAME
rpmbuild \- Build RPM Package(s)
.SH SYNOPSIS
.SS "BUILDING PACKAGES:"
.PP
\fBrpmbuild\fR {\fB-ba|-bb|-bp|-bc|-bi|-bl|-bs\fR} [\fBrpmbuild-options\fR] \fB\fISPECFILE\fB\fR\fI ...\fR
\fBrpmbuild\fR {\fB-ta|-tb|-tp|-tc|-ti|-tl|-ts\fR} [\fBrpmbuild-options\fR] \fB\fITARBALL\fB\fR\fI ...\fR
\fBrpmbuild\fR {\fB--rebuild|--recompile\fR} \fB\fISOURCEPKG\fB\fR\fI ...\fR
\fBrpmbuild\fR \fB--tarbuild\fR \fB\fITARBALL\fB\fR\fI ...\fR
.SS "MISCELLANEOUS:"
.PP
\fBrpmbuild\fR {\fB--showrc\fR}
.SS "RPMBUILD-OPTIONS"
.PP
\fB[--buildroot \fIDIRECTORY\fB] [--clean] [--nobuild] [--rmsource] [--rmspec]
[--short-circuit] [--sign] [--target \fIPLATFORM\fB]\fR
.SH "DESCRIPTION"
.PP
\fBrpmbuild\fR is used to build both binary and source software packages.
A \fBpackage\fR consists of an archive of files and
meta-data used to install and erase the archive files. The meta-data
includes helper scripts, file attributes, and descriptive information
about the package.
\fBPackages\fR come in two varieties: binary packages,
used to encapsulate software to be installed, and source packages,
containing the source code and recipe necessary to produce binary
packages.
.PP
One of the following basic modes must be selected:
\fBBuild Package\fR,
\fBBuild Package from Tarball\fR,
\fBRecompile Package\fR,
\fBShow Configuration\fR.
.SS "GENERAL OPTIONS"
.PP
These options can be used in all the different modes.
.TP
\fB-?, --help\fR
Print a longer usage message then normal.
.TP
\fB--version\fR
Print a single line containing the version number of \fBrpm\fR
being used.
.TP
\fB--quiet\fR
Print as little as possible - normally only error messages will
be displayed.
.TP
\fB-v\fR
Print verbose information - normally routine progress messages will be
displayed.
.TP
\fB-vv\fR
Print lots of ugly debugging information.
.TP
\fB--rcfile \fIFILELIST\fB\fR
Each of the files in the colon separated
\fIFILELIST\fR
is read sequentially by \fBrpm\fR for configuration
information.
Only the first file in the list must exist, and tildes will be
expanded to the value of \fB$HOME\fR.
The default \fIFILELIST\fR is
\fI/usr/lib/rpm/rpmrc\fR:\fI/etc/rpmrc\fR:\fI~/.rpmrc\fR.
.TP
\fB--pipe \fICMD\fB\fR
Pipes the output of \fBrpm\fR to the command \fICMD\fR.
.TP
\fB--dbpath \fIDIRECTORY\fB\fR
Use the database in \fIDIRECTORY\fR rathen
than the default path \fI/var/lib/rpm\fR
.TP
\fB--root \fIDIRECTORY\fB\fR
Use the system rooted at \fIDIRECTORY\fR for all operations.
Note that this means the database will be read or modified under
\fIDIRECTORY\fR and any
\fB%pre\fR or
\fB%post\fR
scriptlet(s) are run after a chroot(2) to
\fIDIRECTORY\fR.
.SS "BUILD OPTIONS"
.PP
The general form of an rpm build command is
.PP
\fBrpmbuild\fR {\fB-b\fISTAGE\fB|-t\fISTAGE\fB\fR} [\fBrpmbuild-options\fR] \fB\fIFILE\fB\fR\fI ...\fR
.PP
The argument used is \fB-b\fR if a spec file is being
used to build the package and \fB-t\fR if \fBrpmbuild\fR
should look inside of a (possibly compressed) tar file for
the spec file to use. After the first argument, the next
character (\fISTAGE\fR) specifies the stages
of building and packaging to be done and is one of:
.TP
\fB-ba\fR
Build binary and source packages (after doing the %prep, %build, and
%install stages).
.TP
\fB-bb\fR
Build a binary package (after doing the %prep, %build, and %install
stages).
.TP
\fB-bp\fR
Executes the "%prep" stage from the spec file. Normally this
involves unpacking the sources and applying any patches.
.TP
\fB-bc\fR
Do the "%build" stage from the spec file (after doing the %prep stage).
This generally involves the equivalent of a "make".
.TP
\fB-bi\fR
Do the "%install" stage from the spec file (after doing the %prep and
%build stages). This generally involves the equivalent of a
"make install".
.TP
\fB-bl\fR
Do a "list check". The "%files" section from the spec file is
macro expanded, and checks are made to verify that each file
exists.
.TP
\fB-bs\fR
Build just the source package.
.PP
The following options may also be used:
.TP
\fB--buildroot \fIDIRECTORY\fB\fR
When building a package, override the BuildRoot tag with directory
\fIDIRECTORY\fR.
.TP
\fB--clean\fR
Remove the build tree after the packages are made.
.TP
\fB--nobuild\fR
Do not execute any build stages. Useful for testing out spec files.
.TP
\fB--rmsource\fR
Remove the sources after the build (may also be
used standalone, e.g. "\fBrpmbuild\fR \fB--rmsource foo.spec\fR").
.TP
\fB--rmspec\fR
Remove the spec file after the build (may also be
used standalone, eg. "\fBrpmbuild\fR \fB--rmspec foo.spec\fR").
.TP
\fB--short-circuit\fR
Skip straight to specified stage (i.e., skip all stages leading
up to the specified stage). Only valid with \fB-bc\fR
and \fB-bi\fR.
.TP
\fB--sign\fR
Embed a GPG signature in the package. This signature can be used
to verify the integrity and the origin of the package. See the
section on GPG SIGNATURES for configuration details.
.TP
\fB--target \fIPLATFORM\fB\fR
When building the package, interpret \fIPLATFORM\fR
as \fBarch-vendor-os\fR and set the macros
\fB%_target\fR,
\fB%_target_arch\fR, and
\fB%_target_os\fR
accordingly.
.SS "REBUILD AND RECOMPILE OPTIONS"
.PP
There are two other ways to invoke building with rpm:
.PP
\fBrpmbuild\fR {\fB--rebuild|--recompile\fR} \fB\fISOURCEPKG\fB\fR\fI ...\fR
.PP
When invoked this way, \fBrpmbuild\fR installs the named source
package, and does a prep, compile and install. In addition,
\fB--rebuild\fR builds a new binary package. When the build
has completed, the build directory is removed (as in
\fB--clean\fR) and the the sources and spec file for
the package are removed.
.SS "SHOWRC"
.PP
The command
.PP
\fBrpmbuild\fR \fB--showrc\fR
.PP
shows the values \fBrpmbuild\fR will use for all of the
options are currently set in
\fIrpmrc\fR and
\fImacros\fR
configuration file(s).
.SH "FILES"
.PP
\fI/usr/lib/rpm/rpmrc\fR
\fI/etc/rpmrc\fR
\fI~/.rpmrc\fR
\fI/usr/lib/rpm/macros\fR
\fI/etc/rpm/macros\fR
\fI~/.rpmmacros\fR
\fI/var/lib/rpm/Conflictname\fR
\fI/var/lib/rpm/Basenames\fR
\fI/var/lib/rpm/Group\fR
\fI/var/lib/rpm/Name\fR
\fI/var/lib/rpm/Packages\fR
\fI/var/lib/rpm/Providename\fR
\fI/var/lib/rpm/Requirename\fR
\fI/var/lib/rpm/Triggername\fR
\fI/var/tmp/rpm*\fR
.SH "SEE ALSO"
\fBpopt\fR(3),
\fBrpm2cpio\fR(8),
\fBgendiff\fR(1),
\fBrpm\fR(8),
\fB http://www.rpm.org/ <URL:http://www.rpm.org/>
\fR
.SH "AUTHORS"
Marc Ewing <marc@redhat.com>
Jeff Johnson <jbj@redhat.com>
Erik Troan <ewt@redhat.com>

View File

@ -14,7 +14,8 @@ EXTRA_DIST = getdate.y
pkgincdir = $(pkgincludedir) pkgincdir = $(pkgincludedir)
pkginc_HEADERS = \ pkginc_HEADERS = \
header.h misc.h rpmcli.h rpmlib.h stringbuf.h header.h hdrinline.h hdrproto.h \
misc.h rpmcli.h rpmlib.h stringbuf.h
noinst_HEADERS = \ noinst_HEADERS = \
cpio.h depends.h fsm.h header_internal.h \ cpio.h depends.h fsm.h header_internal.h \
manifest.h md5.h psm.h \ manifest.h md5.h psm.h \
@ -32,7 +33,8 @@ LIBS =
lib_LTLIBRARIES = librpm.la lib_LTLIBRARIES = librpm.la
librpm_la_SOURCES = \ librpm_la_SOURCES = \
cpio.c depends.c formats.c fs.c fsm.c getdate.c \ cpio.c depends.c formats.c fs.c fsm.c getdate.c \
header.c header_internal.c manifest.c md5.c md5sum.c misc.c package.c \ header.c hdrinline.c header_internal.c \
manifest.c md5.c md5sum.c misc.c package.c \
problems.c poptBT.c poptI.c poptK.c poptQV.c psm.c query.c \ problems.c poptBT.c poptI.c poptK.c poptQV.c psm.c query.c \
rpmchecksig.c rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c rpmvercmp.c \ rpmchecksig.c rpminstall.c rpmlead.c rpmlibprov.c rpmrc.c rpmvercmp.c \
signature.c stringbuf.c tagName.c tagtable.c transaction.c \ signature.c stringbuf.c tagName.c tagtable.c transaction.c \

383
lib/hdrinline.c Normal file
View File

@ -0,0 +1,383 @@
/** \ingroup header
* \file lib/hdrinline.c
*/
#include "system.h"
#include <header_internal.h>
#include "debug.h"
int _hdrinline_debug = 0;
/*@access Header @*/
/*@access entryInfo @*/
/*@access indexEntry @*/
/*@access extensionCache @*/
/*@access sprintfTag @*/
/*@access sprintfToken @*/
/**
* Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
* @param p memory to free
* @return NULL always
*/
/*@unused@*/ static inline /*@null@*/ void *
_free(/*@only@*/ /*@null@*/ const void * p) /*@modifies *p @*/
{
if (p != NULL) free((void *)p);
return NULL;
}
Header headerNew()
{
Header h = xcalloc(1, sizeof(*h));
/*@-assignexpose@*/
h->hv = hv; /* structure assignment */
/*@=assignexpose@*/
h->indexAlloced = INDEX_MALLOC_SIZE;
h->indexUsed = 0;
h->region_allocated = 0;
h->sorted = 1;
h->legacy = 0;
h->nrefs = 1;
h->index = (h->indexAlloced
? xcalloc(h->indexAlloced, sizeof(*h->index))
: NULL);
/*@-globstate@*/
return h;
/*@=globstate@*/
}
Header headerLoad(void * uh)
{
int_32 * ei = (int_32 *) uh;
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;
void * pv = uh;
Header h = xcalloc(1, sizeof(*h));
entryInfo pe;
char * dataStart;
indexEntry entry;
int rdlen;
int i;
ei = (int_32 *) pv;
/*@-castexpose@*/
pe = (entryInfo) &ei[2];
/*@=castexpose@*/
dataStart = (char *) (pe + il);
/*@-assignexpose@*/
h->hv = hv; /* structure assignment */
/*@=assignexpose@*/
h->indexAlloced = il + 1;
h->indexUsed = il;
h->index = xcalloc(h->indexAlloced, sizeof(*h->index));
h->sorted = 1;
h->region_allocated = 0;
h->nrefs = 1;
/*
* XXX XFree86-libs, ash, and pdksh from Red Hat 5.2 have bogus
* %verifyscript tag that needs to be diddled.
*/
if (ntohl(pe->tag) == 15 &&
ntohl(pe->type) == RPM_STRING_TYPE &&
ntohl(pe->count) == 1)
{
pe->tag = htonl(1079);
}
entry = h->index;
i = 0;
if (!(htonl(pe->tag) < HEADER_I18NTABLE)) {
h->legacy = 1;
entry->info.type = REGION_TAG_TYPE;
entry->info.tag = HEADER_IMAGE;
entry->info.count = REGION_TAG_COUNT;
entry->info.offset = ((char *)pe - dataStart); /* negative offset */
/*@-assignexpose@*/
entry->data = pe;
/*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, il, 0, pe, dataStart, entry->info.offset);
if (rdlen != dl) goto errxit;
entry->rdlen = rdlen;
entry++;
h->indexUsed++;
} else {
int nb = ntohl(pe->count);
int_32 rdl;
int_32 ril;
h->legacy = 0;
entry->info.type = htonl(pe->type);
if (entry->info.type < RPM_MIN_TYPE || entry->info.type > RPM_MAX_TYPE)
goto errxit;
entry->info.count = htonl(pe->count);
{ int off = ntohl(pe->offset);
if (off) {
int_32 * stei = memcpy(alloca(nb), dataStart + off, nb);
rdl = -ntohl(stei[2]); /* negative offset */
ril = rdl/sizeof(*pe);
entry->info.tag = htonl(pe->tag);
} else {
ril = il;
rdl = (ril * sizeof(struct entryInfo));
entry->info.tag = HEADER_IMAGE;
}
}
entry->info.offset = -rdl; /* negative offset */
/*@-assignexpose@*/
entry->data = pe;
/*@=assignexpose@*/
entry->length = pvlen - sizeof(il) - sizeof(dl);
rdlen = regionSwab(entry+1, ril-1, 0, pe+1, dataStart, entry->info.offset);
if (rdlen < 0) goto errxit;
entry->rdlen = rdlen;
if (ril < h->indexUsed) {
indexEntry newEntry = entry + ril;
int ne = (h->indexUsed - ril);
int rid = entry->info.offset+1;
int rc;
/* Load dribble entries from region. */
rc = regionSwab(newEntry, ne, 0, pe+ril, dataStart, rid);
if (rc < 0) goto errxit;
rdlen += rc;
{ indexEntry firstEntry = newEntry;
int save = h->indexUsed;
int j;
/* Dribble entries replace duplicate region entries. */
h->indexUsed -= ne;
for (j = 0; j < ne; j++, newEntry++) {
(void) headerRemoveEntry(h, newEntry->info.tag);
if (newEntry->info.tag == HEADER_BASENAMES)
(void) headerRemoveEntry(h, HEADER_OLDFILENAMES);
}
/* If any duplicate entries were replaced, move new entries down. */
if (h->indexUsed < (save - ne)) {
memmove(h->index + h->indexUsed, firstEntry,
(ne * sizeof(*entry)));
}
h->indexUsed += ne;
}
}
}
h->sorted = 0;
headerSort(h);
/*@-globstate@*/
return h;
/*@=globstate@*/
errxit:
/*@-usereleased@*/
if (h) {
h->index = _free(h->index);
/*@-refcounttrans@*/
h = _free(h);
/*@=refcounttrans@*/
}
/*@=usereleased@*/
/*@-refcounttrans -globstate@*/
return h;
/*@=refcounttrans =globstate@*/
}
int headerWrite(FD_t fd, Header h, enum hMagic magicp)
{
ssize_t nb;
int length;
const void * uh;
if (h == NULL)
return 1;
uh = doHeaderUnload(h, &length);
if (uh == NULL)
return 1;
switch (magicp) {
case HEADER_MAGIC_YES:
nb = Fwrite(header_magic, sizeof(char), sizeof(header_magic), fd);
if (nb != sizeof(header_magic))
goto exit;
break;
case HEADER_MAGIC_NO:
break;
}
nb = Fwrite(uh, sizeof(char), length, fd);
exit:
uh = _free(uh);
return (nb == length ? 0 : 1);
}
Header headerCopyLoad(void * uh)
{
int_32 * ei = (int_32 *) uh;
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;
void * nuh = memcpy(xmalloc(pvlen), uh, pvlen);
Header h;
h = headerLoad(nuh);
if (h == NULL) {
nuh = _free(nuh);
return h;
}
h->region_allocated = 1;
return h;
}
Header headerRead(FD_t fd, enum hMagic magicp)
{
int_32 block[4];
int_32 reserved;
int_32 * ei = NULL;
int_32 il;
int_32 dl;
int_32 magic;
Header h = NULL;
int len;
int i;
memset(block, 0, sizeof(block));
i = 2;
if (magicp == HEADER_MAGIC_YES)
i += 2;
if (timedRead(fd, (char *)block, i*sizeof(*block)) != (i * sizeof(*block)))
goto exit;
i = 0;
if (magicp == HEADER_MAGIC_YES) {
magic = block[i++];
if (memcmp(&magic, header_magic, sizeof(magic)))
goto exit;
reserved = block[i++];
}
il = ntohl(block[i++]);
dl = ntohl(block[i++]);
len = sizeof(il) + sizeof(dl) + (il * sizeof(struct entryInfo)) + dl;
/*
* XXX Limit total size of header to 32Mb (~16 times largest known size).
*/
if (len > (32*1024*1024))
goto exit;
ei = xmalloc(len);
ei[0] = htonl(il);
ei[1] = htonl(dl);
len -= sizeof(il) + sizeof(dl);
if (timedRead(fd, (char *)&ei[2], len) != len)
goto exit;
h = headerLoad(ei);
exit:
if (h) {
if (h->region_allocated)
ei = _free(ei);
h->region_allocated = 1;
} else if (ei)
ei = _free(ei);
return h;
}
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
{
int * p;
if (headerFrom == headerTo)
return;
for (p = tagstocopy; *p != 0; p++) {
char *s;
int_32 type;
int_32 count;
if (headerIsEntry(headerTo, *p))
continue;
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
(hPTR_t *) &s, &count))
continue;
(void) headerAddEntry(headerTo, *p, type, s, count);
s = headerFreeData(s, type);
}
}
/**
* Header tag iterator data structure.
*/
struct headerIteratorS {
/*@unused@*/ Header h; /*!< Header being iterated. */
/*@unused@*/ int next_index; /*!< Next tag index. */
};
void headerFreeIterator(HeaderIterator hi)
{
hi->h = headerFree(hi->h);
hi = _free(hi);
}
HeaderIterator headerInitIterator(Header h)
{
HeaderIterator hi = xmalloc(sizeof(struct headerIteratorS));
headerSort(h);
hi->h = headerLink(h);
hi->next_index = 0;
return hi;
}
int headerNextIterator(HeaderIterator hi,
hTAG_t tag, hTYP_t type, hPTR_t * p, hCNT_t c)
{
Header h = hi->h;
int slot = hi->next_index;
indexEntry entry = NULL;
int rc;
for (slot = hi->next_index; slot < h->indexUsed; slot++) {
entry = h->index + slot;
if (!ENTRY_IS_REGION(entry))
break;
}
hi->next_index = slot;
if (entry == NULL || slot >= h->indexUsed)
return 0;
/*@-noeffect@*/ /* LCL: no clue */
hi->next_index++;
/*@=noeffect@*/
if (tag)
*tag = entry->info.tag;
rc = copyEntry(entry, type, p, c, 0);
/* XXX 1 on success */
return ((rc == 1) ? 1 : 0);
}

353
lib/hdrinline.h Normal file
View File

@ -0,0 +1,353 @@
#ifndef H_HDRINLINE
#define H_HDRINLINE
/** \ingroup header
* \file lib/hdrinline.h
*/
/*@-exportlocal@*/
extern int _hdrinline_debug;
/*@=exportlocal@*/
#ifdef __cplusplus
extern "C" {
#endif
/*@+voidabstract -nullpass -abstract -mustmod -compdef -shadow -predboolothers @*/
#define HV(_h) ((HV_t *)(_h))
/** \ingroup header
* Dereference a header instance.
* @param h header
* @return NULL always
*/
/*@unused@*/ static inline
/*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h)
/*@modifies h @*/
{
if (h == NULL) return NULL;
return (HV(h)->free) (h);
}
/** \ingroup header
* Reference a header instance.
* @param h header
* @return referenced header instance
*/
/*@unused@*/ static inline
Header headerLink(Header h)
/*@modifies h @*/
{
return (HV(h)->link) (h);
}
/*@-exportlocal@*/
/** \ingroup header
* Sort tags in header.
* @param h header
*/
/*@unused@*/ static inline
void headerSort(Header h)
/*@modifies h @*/
{
return (HV(h)->sort) (h);
}
/** \ingroup header
* Restore tags in header to original ordering.
* @param h header
*/
/*@unused@*/ static inline
void headerUnsort(Header h)
/*@modifies h @*/
{
return (HV(h)->unsort) (h);
}
/*@=exportlocal@*/
/** \ingroup header
* Return size of on-disk header representation in bytes.
* @param h header
* @param magicp include size of 8 bytes for (magic, 0)?
* @return size of on-disk header
*/
/*@unused@*/ static inline
unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
/*@modifies h @*/
{
if (h == NULL) return 0;
return (HV(h)->size) (h, magicp);
}
/** \ingroup header
* Convert header to on-disk representation.
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
/*@unused@*/ static inline
/*@only@*/ /*@null@*/ void * headerUnload(Header h)
/*@modifies h @*/
{
return (HV(h)->unload) (h);
}
/** \ingroup header
* 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)
*/
/*@unused@*/ static inline
/*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
/*@modifies h @*/
{
return (HV(h)->reload) (h, tag);
}
/** \ingroup header
* Duplicate a header.
* @param h header
* @return new header instance
*/
/*@unused@*/ static inline
/*@null@*/ Header headerCopy(Header h)
/*@modifies h @*/
{
return (HV(h)->copy) (h);
}
/** \ingroup header
* Check if tag is in header.
* @param h header
* @param tag tag
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerIsEntry(/*@null@*/Header h, int_32 tag)
/*@modifies h @*/
{
if (h == NULL) return 0;
return (HV(h)->isentry) (h, tag);
}
/** \ingroup header
* Retrieve tag value.
* Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
* RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
* entry is present).
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
{
return (HV(h)->get) (h, tag, type, p, c);
}
/** \ingroup header
* Retrieve tag value using header internal array.
* Get an entry using as little extra RAM as possible to return the tag value.
* This is only an issue for RPM_STRING_ARRAY_TYPE.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerGetEntryMinMemory(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
{
return (HV(h)->getmin) (h, tag, type, p, c);
}
/** \ingroup header
* Retrieve tag value with type match.
* If *type is RPM_NULL_TYPE any type will match, otherwise only *type will
* match.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
/*@-exportlocal@*/
/*@unused@*/ static inline
int headerGetRawEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/
{
return (HV(h)->getraw) (h, tag, type, p, c);
}
/*@=exportlocal@*/
/** \ingroup header
* Add tag to header.
* Duplicate tags are okay, but only defined for iteration (with the
* exceptions noted below). While you are allowed to add i18n string
* arrays through this function, you probably don't mean to. See
* headerAddI18NString() instead.
*
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
/*@mayexit@*/
/*@unused@*/ static inline
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/
{
return (HV(h)->add) (h, tag, type, p, c);
}
/** \ingroup header
* Append element to tag array in header.
* Appends item p to entry w/ tag and type as passed. Won't work on
* RPM_STRING_TYPE. Any pointers into header memory returned from
* headerGetEntryMinMemory() for this entry are invalid after this
* call has been made!
*
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/
{
return (HV(h)->append) (h, tag, type, p, c);
}
/** \ingroup header
* Add or append element to tag array in header.
* @todo Arg "p" should have const.
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/
{
return (HV(h)->addorappend) (h, tag, type, p, c);
}
/** \ingroup header
* Add locale specific tag to header.
* A NULL lang is interpreted as the C locale. Here are the rules:
* \verbatim
* - If the tag isn't in the header, it's added with the passed string
* as new value.
* - If the tag occurs multiple times in entry, which tag is affected
* by the operation is undefined.
* - If the tag is in the header w/ this language, the entry is
* *replaced* (like headerModifyEntry()).
* \endverbatim
* This function is intended to just "do the right thing". If you need
* more fine grained control use headerAddEntry() and headerModifyEntry().
*
* @param h header
* @param tag tag
* @param string tag value
* @param lang locale
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
/*@modifies h @*/
{
return (HV(h)->addi18n) (h, tag, string, lang);
}
/** \ingroup header
* Modify tag in header.
* If there are multiple entries with this tag, the first one gets replaced.
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
/*@unused@*/ static inline
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/
{
return (HV(h)->modify) (h, tag, type, p, c);
}
/** \ingroup header
* Delete tag in header.
* Removes all entries of type tag from the header, returns 1 if none were
* found.
*
* @param h header
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
/*@unused@*/ static inline
int headerRemoveEntry(Header h, int_32 tag)
/*@modifies h @*/
{
return (HV(h)->remove) (h, tag);
}
/** \ingroup header
* Return formatted output string from header tags.
* The returned string must be free()d.
*
* @param h header
* @param fmt format to use
* @param tags array of tag name/value pairs
* @param extensions chained table of formatting extensions.
* @retval errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
/*@unused@*/ static inline
/*@only@*/ char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
/*@null@*/ /*@out@*/ errmsg_t * errmsg)
/*@modifies *errmsg @*/
{
return (HV(h)->sprintf) (h, fmt, tags, extensions, errmsg);
}
/*@=voidabstract =nullpass =abstract =mustmod =compdef =shadow =predboolothers @*/
#ifdef __cplusplus
}
#endif
#endif /* H_HDRINLINE */

266
lib/hdrproto.h Normal file
View File

@ -0,0 +1,266 @@
#ifndef H_HDRPROTO
#define H_HDRPROTO
/** \ingroup header
* \file lib/hdrproto.h
*/
#ifdef __cplusplus
extern "C" {
#endif
/** \ingroup header
* Dereference a header instance.
* @param h header
* @return NULL always
*/
/*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h)
/*@modifies h @*/;
/** \ingroup header
* Reference a header instance.
* @param h header
* @return referenced header instance
*/
Header headerLink(Header h)
/*@modifies h @*/;
/*@-exportlocal@*/
/** \ingroup header
* Sort tags in header.
* @param h header
*/
void headerSort(Header h)
/*@modifies h @*/;
/** \ingroup header
* Restore tags in header to original ordering.
* @param h header
*/
void headerUnsort(Header h)
/*@modifies h @*/;
/*@=exportlocal@*/
/** \ingroup header
* Return size of on-disk header representation in bytes.
* @param h header
* @param magicp include size of 8 bytes for (magic, 0)?
* @return size of on-disk header
*/
unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
/*@modifies h @*/;
/** \ingroup header
* Convert header to on-disk representation.
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
/*@only@*/ /*@null@*/ void * headerUnload(Header h)
/*@modifies h @*/;
/** \ingroup header
* 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)
*/
/*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
/*@modifies h @*/;
/** \ingroup header
* Duplicate a header.
* @param h header
* @return new header instance
*/
/*@null@*/ Header headerCopy(Header h)
/*@modifies h @*/;
/** \ingroup header
* Check if tag is in header.
* @param h header
* @param tag tag
* @return 1 on success, 0 on failure
*/
int headerIsEntry(/*@null@*/Header h, int_32 tag)
/*@*/;
/** \ingroup header
* Retrieve tag value.
* Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
* RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
* entry is present).
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value using header internal array.
* Get an entry using as little extra RAM as possible to return the tag value.
* This is only an issue for RPM_STRING_ARRAY_TYPE.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
int headerGetEntryMinMemory(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value with type match.
* If *type is RPM_NULL_TYPE any type will match, otherwise only *type will
* match.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
/*@-exportlocal@*/
int headerGetRawEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
/*@=exportlocal@*/
/** \ingroup header
* Add tag to header.
* Duplicate tags are okay, but only defined for iteration (with the
* exceptions noted below). While you are allowed to add i18n string
* arrays through this function, you probably don't mean to. See
* headerAddI18NString() instead.
*
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
/*@mayexit@*/
int headerAddEntry(Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Append element to tag array in header.
* Appends item p to entry w/ tag and type as passed. Won't work on
* RPM_STRING_TYPE. Any pointers into header memory returned from
* headerGetEntryMinMemory() for this entry are invalid after this
* call has been made!
*
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Add or append element to tag array in header.
* @todo Arg "p" should have const.
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Add locale specific tag to header.
* A NULL lang is interpreted as the C locale. Here are the rules:
* \verbatim
* - If the tag isn't in the header, it's added with the passed string
* as new value.
* - If the tag occurs multiple times in entry, which tag is affected
* by the operation is undefined.
* - If the tag is in the header w/ this language, the entry is
* *replaced* (like headerModifyEntry()).
* \endverbatim
* This function is intended to just "do the right thing". If you need
* more fine grained control use headerAddEntry() and headerModifyEntry().
*
* @param h header
* @param tag tag
* @param string tag value
* @param lang locale
* @return 1 on success, 0 on failure
*/
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
/*@modifies h @*/;
/** \ingroup header
* Modify tag in header.
* If there are multiple entries with this tag, the first one gets replaced.
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Delete tag in header.
* Removes all entries of type tag from the header, returns 1 if none were
* found.
*
* @param h header
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
int headerRemoveEntry(Header h, int_32 tag)
/*@modifies h @*/;
/** \ingroup header
* Return formatted output string from header tags.
* The returned string must be free()d.
*
* @param h header
* @param fmt format to use
* @param tags array of tag name/value pairs
* @param extensions chained table of formatting extensions.
* @retval errmsg error message (if any)
* @return formatted output string (malloc'ed)
*/
/*@only@*/ char * headerSprintf(Header h, const char * fmt,
const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions,
/*@null@*/ /*@out@*/ errmsg_t * errmsg)
/*@modifies *errmsg @*/;
#ifdef __cplusplus
}
#endif
#endif /* H_HDRPROTO */

File diff suppressed because it is too large Load Diff

View File

@ -17,16 +17,16 @@
* - Support for version 1 headers was removed in rpm-4.0. * - Support for version 1 headers was removed in rpm-4.0.
* *
* - version 2 * - version 2
* - (Before my time, sorry.) * - @todo Document version2 headers.
* *
* - version 3 (added in rpm-3.0) * - version 3 (added in rpm-3.0)
* - added RPM_I18NSTRING_TYPE as an associative array reference * - Added RPM_I18NSTRING_TYPE as an associative array reference
* for i18n locale dependent single element tags (i.e Group). * for i18n locale dependent single element tags (i.e Group).
* - added an 8 byte magic string to headers in packages on-disk. The * - Added an 8 byte magic string to headers in packages on-disk. The
* magic string was not added to headers in the database. * magic string was not added to headers in the database.
* *
* - version 4 (added in rpm-4.0) * - version 4 (added in rpm-4.0)
* - represent file names as a (dirname/basename/dirindex) triple * - Represent file names as a (dirname/basename/dirindex) triple
* rather than as an absolute path name. Legacy package headers are * rather than as an absolute path name. Legacy package headers are
* converted when the header is read. Legacy database headers are * converted when the header is read. Legacy database headers are
* converted when the database is rebuilt. * converted when the database is rebuilt.
@ -35,7 +35,17 @@
* on package provides. Legacy package headers are converted * on package provides. Legacy package headers are converted
* when the header is read. Legacy database headers are * when the header is read. Legacy database headers are
* converted when the database is rebuilt. * converted when the database is rebuilt.
* * - (rpm-4.0.2) The original package header (and all original
* metadata) is preserved in what's called an "immutable header region".
* The original header can be retrieved as an RPM_BIN_TYPE, just
* like any other tag, and the original header reconstituted using
* headerLoad().
* - (rpm-4.0.2) The signature tags are added (and renumbered to avoid
* tag value collisions) to the package header during package
* installation.
* - (rpm-4.0.3) A SHA1 digest of the original header is appended
* (i.e. detached digest) to the immutable header region to verify
* changes to the original header.
* . * .
* *
* \par Development Issues * \par Development Issues
@ -43,27 +53,26 @@
* Here's a brief description of future features/incompatibilities that * Here's a brief description of future features/incompatibilities that
* will be added to headers. * will be added to headers.
* *
* - Signature tags * - Private header methods.
* - Signatures are stored in A header, but not THE header * - Private methods (e.g. headerLoad(), headerUnload(), etc.) to
* of a package. That means that signatures are discarded * permit header data to be manipulated opaquely. Initially
* when a package is installed, preventing verification * the transaction element file info TFI_t will be used as
* of header contents after install. All signature tags * proof-of-concept, binary XML will probably be implemented
* will be added to THE package header so that they are * soon thereafter.
* saved in the rpm database for later retrieval and verification. * - DSA signature for header metadata.
* Adding signatures to THE header will also permit signatures to * - The manner in which rpm packages are signed is going to change.
* be accessed by Red Hat Network, i.e. retrieval by existing * The SHA1 digest in the header will be signed, equivalent to a DSA
* Python bindings. * digital signature on the original header metadata. As the original
* - Signature tag values collide with existing rpm tags, and will * header will contain "trusted" (i.e. because the header is signed
* have to be renumbered. Part of this renumbering was accomplished * with DSA) file MD5 digests, there will be little or no reason
* in rpm-4.0, but more remains to be done. * to sign the payload, but that may happen as well. Note that cpio
* - Signatures, because they involve MD5 and other 1-way hashes on * headers in the payload are not used to install package metadata,
* immutable data, will cause the header to be reconstituted as a * only the name field in the cpio header is used to associate an
* immutable section and a mutable section. * archive file member with the corresponding entry for the file
* in header metadata.
*/ */
/* RPM - Copyright (C) 1995-2000 Red Hat Software */ /* RPM - Copyright (C) 1995-2001 Red Hat Software */
/* WARNING: 1 means success, 0 means failure (yes, this is backwards) */
#include <stdio.h> #include <stdio.h>
#include <rpmio.h> #include <rpmio.h>
@ -94,6 +103,18 @@ typedef unsigned int uint_32;
typedef unsigned short uint_16; typedef unsigned short uint_16;
#endif #endif
/*@-redef@*/ /* LCL: no clue */
/** \ingroup header
*/
typedef const char * errmsg_t;
/** \ingroup header
*/
typedef int_32 * hTAG_t;
typedef int_32 * hTYP_t;
typedef const void * hPTR_t;
typedef int_32 * hCNT_t;
/** \ingroup header /** \ingroup header
*/ */
typedef /*@abstract@*/ /*@refcounted@*/ struct headerToken * Header; typedef /*@abstract@*/ /*@refcounted@*/ struct headerToken * Header;
@ -105,6 +126,7 @@ typedef /*@abstract@*/ struct headerIteratorS *HeaderIterator;
/** \ingroup header /** \ingroup header
* Associate tag names with numeric values. * Associate tag names with numeric values.
*/ */
typedef /*@abstract@*/ struct headerTagTableEntry * headerTagTableEntry;
struct headerTagTableEntry { struct headerTagTableEntry {
/*@observer@*/ /*@null@*/ const char * name; /*!< Tag name. */ /*@observer@*/ /*@null@*/ const char * name; /*!< Tag name. */
int val; /*!< Tag numeric value. */ int val; /*!< Tag numeric value. */
@ -146,14 +168,15 @@ typedef /*only@*/ char * (*headerTagFormatFunction)(int_32 type,
* @return 0 on success * @return 0 on success
*/ */
typedef int (*headerTagTagFunction) (Header h, typedef int (*headerTagTagFunction) (Header h,
/*@null@*/ /*@out@*/ int_32 * type, /*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ const void ** data, /*@null@*/ /*@out@*/ hPTR_t * data,
/*@null@*/ /*@out@*/ int_32 * count, /*@null@*/ /*@out@*/ hCNT_t count,
/*@null@*/ /*@out@*/ int * freeData); /*@null@*/ /*@out@*/ int * freeData);
/** \ingroup header /** \ingroup header
* Define header tag output formats. * Define header tag output formats.
*/ */
typedef /*@abstract@*/ struct headerSprintfExtension * headerSprintfExtension;
struct headerSprintfExtension { struct headerSprintfExtension {
enum headerSprintfExtenstionType type; /*!< Type of extension. */ enum headerSprintfExtenstionType type; /*!< Type of extension. */
/*@observer@*/ /*@null@*/ const char * name; /*!< Name of extension. */ /*@observer@*/ /*@null@*/ const char * name; /*!< Name of extension. */
@ -180,341 +203,145 @@ enum hMagic {
HEADER_MAGIC_YES = 1 HEADER_MAGIC_YES = 1
}; };
/** \ingroup header /**
* Read (and load) header from file handle.
* @param fd file handle
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/ */
/*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp) /*@-typeuse -fielduse@*/
/*@modifies fd, fileSystem @*/; typedef union hRET_s {
const void * ptr;
const char ** argv;
const char * str;
uint_32 * ui32p;
uint_16 * ui16p;
int_32 * i32p;
int_16 * i16p;
int_8 * i8p;
} * hRET_t;
/*@=typeuse =fielduse@*/
/** \ingroup header /**
* Write (with unload) header to file handle.
* @param fd file handle
* @param h header
* @param magicp prefix write with 8 bytes of (magic, 0)?
* @return 0 on success, 1 on error
*/ */
int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp) /*@-typeuse -fielduse@*/
/*@modifies fd, h, fileSystem @*/; typedef struct HE_s {
int_32 tag;
/*@null@*/ hTYP_t typ;
union {
/*@null@*/ hPTR_t * ptr;
/*@null@*/ hRET_t * ret;
} u;
/*@null@*/ hCNT_t cnt;
} * HE_t;
/*@=typeuse =fielduse@*/
/** \ingroup header typedef
* Return size of on-disk header representation in bytes. /*@null@*/ Header (*HVfree) (/*@null@*/ /*@killref@*/ Header h)
* @param h header
* @param magicp include size of 8 bytes for (magic, 0)?
* @return size of on-disk header
*/
unsigned int headerSizeof(/*@null@*/ Header h, enum hMagic magicp)
/*@modifies h @*/; /*@modifies h @*/;
/** \ingroup header typedef
* Convert header to in-memory representation. Header (*HVlink) (Header h)
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@-exportlocal@*/
/*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
/*@modifies uh @*/;
/*@=exportlocal@*/
/** \ingroup header
* Make a copy and convert header to in-memory representation.
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@null@*/ Header headerCopyLoad(void * uh)
/*@modifies uh @*/;
/** \ingroup header
* Convert header to on-disk representation.
* @param h header (with pointers)
* @return on-disk header blob (i.e. with offsets)
*/
/*@only@*/ /*@null@*/ void * headerUnload(Header h)
/*@modifies h @*/; /*@modifies h @*/;
/** \ingroup header typedef
* Convert header to on-disk representation, and then reload. void (*HVsort) (Header h)
* 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)
*/
/*@null@*/ Header headerReload(/*@only@*/ Header h, int tag)
/*@modifies h @*/; /*@modifies h @*/;
/** \ingroup header typedef
* Create new (empty) header instance. void (*HVunsort) (Header h)
* @return header
*/
Header headerNew(void) /*@*/;
/** \ingroup header
* Reference a header instance.
* @param h header
* @return referenced header instance
*/
Header headerLink(Header h)
/*@modifies h @*/; /*@modifies h @*/;
/** \ingroup header typedef
* Dereference a header instance. unsigned int (*HVsize) (/*@null@*/ Header h, enum hMagic magicp)
* @param h header
* @return NULL always
*/
/*@null@*/ Header headerFree( /*@null@*/ /*@killref@*/ Header h)
/*@modifies h @*/; /*@modifies h @*/;
/*@-redef@*/ /* LCL: no clue */ typedef
typedef const char * errmsg_t; /*@only@*/ /*@null@*/ void * (*HVunload) (Header h)
/*@=redef@*/ /*@modifies h @*/;
/** \ingroup header typedef
* Return formatted output string from header tags. /*@null@*/ Header (*HVreload) (/*@only@*/ Header h, int tag)
* The returned string must be free()d. /*@modifies h @*/;
*
* @param h header typedef
* @param fmt format to use Header (*HVcopy) (Header h)
* @param tags array of tag name/value pairs /*@modifies h @*/;
* @param extensions chained table of formatting extensions.
* @retval errmsg error message (if any) typedef
* @return formatted output string (malloc'ed) int (*HVisentry) (/*@null@*/Header h, int_32 tag)
*/ /*@*/;
/*@only@*/ char * headerSprintf(Header h, const char * fmt,
typedef
int (*HVget) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
typedef
int (*HVgetmin) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
typedef
int (*HVgetraw) (Header h, int_32 tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies *type, *p, *c @*/;
typedef
int (*HVadd) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/;
typedef
int (*HVappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/;
typedef
int (*HVaddorappend) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/;
typedef
int (*HVaddi18n) (Header h, int_32 tag, const char * string,
const char * lang)
/*@modifies h @*/;
typedef
int (*HVmodify) (Header h, int_32 tag, int_32 type, const void * p, int_32 c)
/*@modifies h @*/;
typedef
int (*HVremove) (Header h, int_32 tag)
/*@modifies h @*/;
typedef
/*@only@*/ char * (*HVsprintf) (Header h, const char * fmt,
const struct headerTagTableEntry * tags, const struct headerTagTableEntry * tags,
const struct headerSprintfExtension * extensions, const struct headerSprintfExtension * extensions,
/*@null@*/ /*@out@*/ errmsg_t * errmsg) /*@null@*/ /*@out@*/ errmsg_t * errmsg)
/*@modifies *errmsg @*/; /*@modifies *errmsg @*/;
/** \ingroup header typedef struct HV_s {
* Add tag to header. HVfree free;
* Duplicate tags are okay, but only defined for iteration (with the HVlink link;
* exceptions noted below). While you are allowed to add i18n string HVsort sort;
* arrays through this function, you probably don't mean to. See HVunsort unsort;
* headerAddI18NString() instead. HVsize size;
* HVunload unload;
* @param h header HVreload reload;
* @param tag tag HVcopy copy;
* @param type tag value data type HVisentry isentry;
* @param p pointer to tag value(s) HVget get;
* @param c number of values HVgetmin getmin;
* @return 1 on success, 0 on failure HVgetraw getraw;
*/ HVadd add;
/*@mayexit@*/ HVappend append;
int headerAddEntry(Header h, int_32 tag, int_32 type, const void *p, int_32 c) HVaddorappend addorappend;
/*@modifies h @*/; HVaddi18n addi18n;
HVmodify modify;
/** \ingroup header HVremove remove;
* Modify tag in header. HVsprintf sprintf;
* If there are multiple entries with this tag, the first one gets replaced. } HV_t;
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerModifyEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Add locale specific tag to header.
* A NULL lang is interpreted as the C locale. Here are the rules:
* \verbatim
* - If the tag isn't in the header, it's added with the passed string
* as new value.
* - If the tag occurs multiple times in entry, which tag is affected
* by the operation is undefined.
* - If the tag is in the header w/ this language, the entry is
* *replaced* (like headerModifyEntry()).
* \endverbatim
* This function is intended to just "do the right thing". If you need
* more fine grained control use headerAddEntry() and headerModifyEntry().
*
* @param h header
* @param tag tag
* @param string tag value
* @param lang locale
* @return 1 on success, 0 on failure
*/
int headerAddI18NString(Header h, int_32 tag, const char * string,
const char * lang)
/*@modifies h @*/;
/** \ingroup header
* Append element to tag array in header.
* Appends item p to entry w/ tag and type as passed. Won't work on
* RPM_STRING_TYPE. Any pointers into header memory returned from
* headerGetEntryMinMemory() for this entry are invalid after this
* call has been made!
*
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Add or append element to tag array in header.
* @todo Arg "p" should have const.
* @param h header
* @param tag tag
* @param type tag value data type
* @param p pointer to tag value(s)
* @param c number of values
* @return 1 on success, 0 on failure
*/
int headerAddOrAppendEntry(Header h, int_32 tag, int_32 type,
const void * p, int_32 c)
/*@modifies h @*/;
/** \ingroup header
* Retrieve tag value.
* Will never return RPM_I18NSTRING_TYPE! RPM_STRING_TYPE elements with
* RPM_I18NSTRING_TYPE equivalent entries are translated (if HEADER_I18NTABLE
* entry is present).
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
int headerGetEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ void ** p,
/*@null@*/ /*@out@*/int_32 *c)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value using header internal array.
* Get an entry using as little extra RAM as possible to return the tag value.
* This is only an issue for RPM_STRING_ARRAY_TYPE.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
int headerGetEntryMinMemory(Header h, int_32 tag,
/*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p,
/*@null@*/ /*@out@*/ int_32 * c)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
* Retrieve tag value with type match.
* If *type is RPM_NULL_TYPE any type will match, otherwise only *type will
* match.
*
* @param h header
* @param tag tag
* @retval type address of tag value data type (or NULL)
* @retval p address of pointer to tag value(s) (or NULL)
* @retval c address of number of values (or NULL)
* @return 1 on success, 0 on failure
*/
/*@-exportlocal@*/
int headerGetRawEntry(Header h, int_32 tag,
/*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p,
/*@null@*/ /*@out@*/ int_32 * c)
/*@modifies *type, *p, *c @*/;
/*@=exportlocal@*/
/** \ingroup header
* Check if tag is in header.
* @param h header
* @param tag tag
* @return 1 on success, 0 on failure
*/
int headerIsEntry(/*@null@*/Header h, int_32 tag) /*@*/;
/** \ingroup header
* Delete tag in header.
* Removes all entries of type tag from the header, returns 1 if none were
* found.
*
* @param h header
* @param tag tag
* @return 0 on success, 1 on failure (INCONSISTENT)
*/
int headerRemoveEntry(Header h, int_32 tag)
/*@modifies h @*/;
/** \ingroup header
* Create header tag iterator.
* @param h header
* @return header tag iterator
*/
HeaderIterator headerInitIterator(Header h)
/*@modifies h */;
/** \ingroup header
* Return next tag from header.
* @param hi header tag iterator
* @retval tag address of tag
* @retval type address of tag value data type
* @retval p address of pointer to tag value(s)
* @retval c address of number of values
* @return 1 on success, 0 on failure
*/
int headerNextIterator(HeaderIterator hi,
/*@null@*/ /*@out@*/ int_32 * tag,
/*@null@*/ /*@out@*/ int_32 * type,
/*@null@*/ /*@out@*/ const void ** p,
/*@null@*/ /*@out@*/ int_32 * c)
/*@modifies hi, *tag, *type, *p, *c @*/;
/** \ingroup header
* Destroy header tag iterator.
* @param hi header tag iterator
*/
void headerFreeIterator(/*@only@*/ HeaderIterator hi)
/*@modifies hi @*/;
/** \ingroup header
* Duplicate a header.
* @param h header
* @return new header instance
*/
/*@null@*/ Header headerCopy(Header h)
/*@modifies h @*/;
/** \ingroup header
* Sort tags in header.
* @param h header
*/
/*@-exportlocal@*/
void headerSort(Header h)
/*@modifies h @*/;
/** \ingroup header
* Restore tags in header to original ordering.
* @param h header
*/
void headerUnsort(Header h)
/*@modifies h @*/;
/*@=exportlocal@*/
/** \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
*/
void headerCopyTags(Header headerFrom, Header headerTo, int_32 * tagstocopy)
/*@modifies headerFrom, headerTo @*/;
/** \ingroup header /** \ingroup header
* The basic types of data in tags from headers. * The basic types of data in tags from headers.
@ -534,28 +361,6 @@ typedef enum rpmTagType_e {
#define RPM_MAX_TYPE 9 #define RPM_MAX_TYPE 9
} rpmTagType; } rpmTagType;
/** \ingroup header
* Free data allocated when retrieved from header.
* @param data address of data (or NULL)
* @param type type of data (or -1 to force free)
* @return NULL always
*/
/*@unused@*/ static inline /*@null@*/
void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
/*@modifies data @*/
{
if (data) {
/*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
free((void *)data);
/*@=branchstate@*/
}
return NULL;
}
/** \ingroup header /** \ingroup header
* New rpm data types under consideration/development. * New rpm data types under consideration/development.
* These data types may (or may not) be added to rpm at some point. In order * These data types may (or may not) be added to rpm at some point. In order
@ -588,6 +393,117 @@ typedef enum rpmSubTagType_e {
#define HEADER_SIGBASE 256 #define HEADER_SIGBASE 256
#define HEADER_TAGBASE 1000 #define HEADER_TAGBASE 1000
/** \ingroup header
* Free data allocated when retrieved from header.
* @param data address of data (or NULL)
* @param type type of data (or -1 to force free)
* @return NULL always
*/
/*@unused@*/ static inline /*@null@*/
void * headerFreeData( /*@only@*/ /*@null@*/ const void * data, rpmTagType type)
/*@modifies data @*/
{
if (data) {
/*@-branchstate@*/
if (type == -1 ||
type == RPM_STRING_ARRAY_TYPE ||
type == RPM_I18NSTRING_TYPE ||
type == RPM_BIN_TYPE)
free((void *)data);
/*@=branchstate@*/
}
return NULL;
}
/** \ingroup header
* Create new (empty) header instance.
* @return header
*/
Header headerNew(void) /*@*/;
/** \ingroup header
* Convert header to in-memory representation.
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@-exportlocal@*/
/*@null@*/ Header headerLoad(/*@kept@*/ void * uh)
/*@modifies uh @*/;
/*@=exportlocal@*/
/** \ingroup header
* Write (with unload) header to file handle.
* @param fd file handle
* @param h header
* @param magicp prefix write with 8 bytes of (magic, 0)?
* @return 0 on success, 1 on error
*/
int headerWrite(FD_t fd, /*@null@*/ Header h, enum hMagic magicp)
/*@modifies fd, h, fileSystem @*/;
/** \ingroup header
* Make a copy and convert header to in-memory representation.
* @param uh on-disk header blob (i.e. with offsets)
* @return header
*/
/*@null@*/ Header headerCopyLoad(void * uh)
/*@modifies uh @*/;
/** \ingroup header
* Read (and load) header from file handle.
* @param fd file handle
* @param magicp read (and verify) 8 bytes of (magic, 0)?
* @return header (or NULL on error)
*/
/*@null@*/ Header headerRead(FD_t fd, enum hMagic magicp)
/*@modifies fd, fileSystem @*/;
/** \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
*/
void headerCopyTags(Header headerFrom, Header headerTo, hTAG_t tagstocopy)
/*@modifies headerFrom, headerTo @*/;
/** \ingroup header
* Destroy header tag iterator.
* @param hi header tag iterator
*/
void headerFreeIterator(/*@only@*/ HeaderIterator hi)
/*@modifies hi @*/;
/** \ingroup header
* Create header tag iterator.
* @param h header
* @return header tag iterator
*/
HeaderIterator headerInitIterator(Header h)
/*@modifies h */;
/** \ingroup header
* Return next tag from header.
* @param hi header tag iterator
* @retval tag address of tag
* @retval type address of tag value data type
* @retval p address of pointer to tag value(s)
* @retval c address of number of values
* @return 1 on success, 0 on failure
*/
int headerNextIterator(HeaderIterator hi,
/*@null@*/ /*@out@*/ hTAG_t tag,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c)
/*@modifies hi, *tag, *type, *p, *c @*/;
#if defined(__HEADER_PROTOTYPES__)
#include <hdrproto.h>
#else
#include <hdrinline.h>
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -8,11 +8,30 @@
#include "debug.h" #include "debug.h"
char ** headerGetLangs(Header h)
{
char **s, *e, **table;
int i, type, count;
if (!headerGetRawEntry(h, HEADER_I18NTABLE, &type, (const void **)&s, &count))
return NULL;
/* XXX xcalloc never returns NULL. */
if ((table = (char **)xcalloc((count+1), sizeof(char *))) == NULL)
return NULL;
for (i = 0, e = *s; i < count > 0; i++, e += strlen(e)+1)
table[i] = e;
table[count] = NULL;
/*@-nullret@*/ return table; /*@=nullret@*/ /* LCL: double indirection? */
}
void headerDump(Header h, FILE *f, int flags, void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry * tags) const struct headerTagTableEntry * tags)
{ {
int i; int i;
struct indexEntry *p; indexEntry p;
const struct headerTagTableEntry * tage; const struct headerTagTableEntry * tage;
const char * tag; const char * tag;
char * type; char * type;

View File

@ -11,10 +11,18 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif /* __LCLINT__ */ #endif /* __LCLINT__ */
#define INDEX_MALLOC_SIZE 8
/** /*
* Teach header.c about legacy tags.
*/
#define HEADER_OLDFILENAMES 1027
#define HEADER_BASENAMES 1117
/** \ingroup header
* Description of tag data. * Description of tag data.
*/ */
typedef /*@abstract@*/ struct entryInfo * entryInfo;
struct entryInfo { struct entryInfo {
int_32 tag; /*!< Tag identifier. */ int_32 tag; /*!< Tag identifier. */
int_32 type; /*!< Tag data type. */ int_32 type; /*!< Tag data type. */
@ -28,9 +36,10 @@ struct entryInfo {
#define ENTRY_IS_REGION(_e) ((_e)->info.tag < HEADER_I18NTABLE) #define ENTRY_IS_REGION(_e) ((_e)->info.tag < HEADER_I18NTABLE)
#define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0) #define ENTRY_IN_REGION(_e) ((_e)->info.offset < 0)
/** /** \ingroup header
* A single tag from a Header. * A single tag from a Header.
*/ */
typedef /*@abstract@*/ struct indexEntry * indexEntry;
struct indexEntry { struct indexEntry {
struct entryInfo info; /*!< Description of tag data. */ struct entryInfo info; /*!< Description of tag data. */
/*@owned@*/ void * data; /*!< Location of tag data. */ /*@owned@*/ void * data; /*!< Location of tag data. */
@ -38,11 +47,12 @@ struct indexEntry {
int rdlen; /*!< No. bytes of data in region. */ int rdlen; /*!< No. bytes of data in region. */
}; };
/** /** \ingroup header
* The Header data structure. * The Header data structure.
*/ */
struct headerToken { struct headerToken {
/*@owned@*/ struct indexEntry * index; /*!< Array of tags. */ /*@unused@*/ HV_t hv; /*!< Header public methods. */
/*@owned@*/ indexEntry index; /*!< Array of tags. */
int indexUsed; /*!< Current size of tag array. */ int indexUsed; /*!< Current size of tag array. */
int indexAlloced; /*!< Allocated size of tag array. */ int indexAlloced; /*!< Allocated size of tag array. */
int region_allocated; /*!< Is 1st header region allocated? */ int region_allocated; /*!< Is 1st header region allocated? */
@ -51,8 +61,9 @@ struct headerToken {
/*@refs@*/ int nrefs; /*!< Reference count. */ /*@refs@*/ int nrefs; /*!< Reference count. */
}; };
/** /** \ingroup header
*/ */
typedef /*@abstract@*/ struct sprintfTag * sprintfTag;
struct sprintfTag { struct sprintfTag {
/*@null@*/ headerTagTagFunction ext; /*!< if NULL tag element is invalid */ /*@null@*/ headerTagTagFunction ext; /*!< if NULL tag element is invalid */
int extNum; int extNum;
@ -64,8 +75,9 @@ struct sprintfTag {
int pad; int pad;
}; };
/** /** \ingroup header
*/ */
typedef /*@abstract@*/ struct extensionCache * extensionCache;
struct extensionCache { struct extensionCache {
int_32 type; int_32 type;
int_32 count; int_32 count;
@ -74,8 +86,10 @@ struct extensionCache {
/*@owned@*/ const void * data; /*@owned@*/ const void * data;
}; };
/** /** \ingroup header
*/ */
/*@-fielduse@*/
typedef /*@abstract@*/ struct sprintfToken * sprintfToken;
struct sprintfToken { struct sprintfToken {
enum { enum {
PTOK_NONE = 0, PTOK_NONE = 0,
@ -86,7 +100,7 @@ struct sprintfToken {
} type; } type;
union { union {
struct { struct {
/*@only@*/ struct sprintfToken * format; /*@only@*/ sprintfToken format;
int numTokens; int numTokens;
} array; } array;
struct sprintfTag tag; struct sprintfTag tag;
@ -95,19 +109,97 @@ struct sprintfToken {
int len; int len;
} string; } string;
struct { struct {
/*@only@*/ /*@null@*/ struct sprintfToken * ifFormat; /*@only@*/ /*@null@*/ sprintfToken ifFormat;
int numIfTokens; int numIfTokens;
/*@only@*/ /*@null@*/ struct sprintfToken * elseFormat; /*@only@*/ /*@null@*/ sprintfToken elseFormat;
int numElseTokens; int numElseTokens;
struct sprintfTag tag; struct sprintfTag tag;
} cond; } cond;
} u; } u;
}; };
/*@=fielduse@*/
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/** \ingroup header
*/
extern unsigned char header_magic[8];
/** \ingroup header
*/
extern HV_t hv;
/** \ingroup header
* Swap int_32 and int_16 arrays within header region.
*
* This code is way more twisty than I would like.
*
* A bug with RPM_I18NSTRING_TYPE in rpm-2.5.x (fixed in August 1998)
* causes the offset and length of elements in a header region to disagree
* regarding the total length of the region data.
*
* The "fix" is to compute the size using both offset and length and
* return the larger of the two numbers as the size of the region.
* Kinda like computing left and right Riemann sums of the data elements
* to determine the size of a data structure, go figger :-).
*
* There's one other twist if a header region tag is in the set to be swabbed,
* as the data for a header region is located after all other tag data.
*
* @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 regionid region offset
* @return no. bytes of data in region, -1 on error
*/
int regionSwab(/*@null@*/ indexEntry entry, int il, int dl,
entryInfo pe, char * dataStart, int regionid)
/*@modifies entry, *dataStart @*/;
/** \ingroup header
*/
/*@only@*/ /*@null@*/ void * doHeaderUnload(Header h, /*@out@*/ int * lengthPtr)
/*@modifies h, *lengthPtr @*/;
/** \ingroup header
* Retrieve data from header entry.
* @todo Permit retrieval of regions other than HEADER_IMUTABLE.
* @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?
* @return 1 on success, otherwise error.
*/
int copyEntry(const indexEntry entry,
/*@null@*/ /*@out@*/ hTYP_t type,
/*@null@*/ /*@out@*/ hPTR_t * p,
/*@null@*/ /*@out@*/ hCNT_t c,
int minMem)
/*@modifies *type, *p, *c @*/;
/** \ingroup header
* Return array of locales found in header.
* The array is terminated with a NULL sentinel.
* @param h header
* @return array of locales (or NULL on error)
*/
/*@unused@*/
/*@only@*/ /*@null@*/ char ** headerGetLangs(Header h)
/*@*/;
/** \ingroup header
* Return header reference count.
* @param h header
* @return no. of references
*/
/*@unused@*/ static inline int headerUsageCount(Header h) /*@*/ {
return h->nrefs;
}
/** \ingroup header /** \ingroup header
* Dump a header in human readable format (for debugging). * Dump a header in human readable format (for debugging).
@ -117,7 +209,8 @@ extern "C" {
*/ */
/*@unused@*/ /*@unused@*/
void headerDump(Header h, FILE *f, int flags, void headerDump(Header h, FILE *f, int flags,
const struct headerTagTableEntry * tags); const struct headerTagTableEntry * tags)
/*@modifies f, fileSystem @*/;
#define HEADER_DUMP_INLINE 1 #define HEADER_DUMP_INLINE 1
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -154,7 +154,7 @@ int rpmHeaderGetEntry(Header h, int_32 tag, /*@out@*/ int_32 *type,
/*@unused@*/ /*@unused@*/
int rpmPackageGetEntry(void *leadp, Header sigs, Header h, int rpmPackageGetEntry(void *leadp, Header sigs, Header h,
int_32 tag, int_32 *type, void **p, int_32 *c) int_32 tag, int_32 *type, void **p, int_32 *c)
/*@modifies *type, *p, *c @*/; /*@modifies h, *type, *p, *c @*/;
/** /**
* Automatically generated table of tag name/value pairs. * Automatically generated table of tag name/value pairs.

View File

@ -4,7 +4,7 @@
#include "system.h" #include "system.h"
#include <rpmio.h> #include <rpmlib.h>
#include "debug.h" #include "debug.h"

View File

@ -29,6 +29,7 @@ lib/depends.c
lib/formats.c lib/formats.c
lib/fs.c lib/fs.c
lib/fsm.c lib/fsm.c
lib/hdrinline.c
lib/header.c lib/header.c
lib/header_internal.c lib/header_internal.c
lib/manifest.c lib/manifest.c

2596
po/rpm.pot

File diff suppressed because it is too large Load Diff

View File

@ -6,99 +6,111 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2001-02-22 17:41-0500\n" "POT-Creation-Date: 2001-06-19 07:33-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: ENCODING\n" "Content-Transfer-Encoding: 8bit\n"
#: popt.c:29 #: popt.c:29
msgid "unknown errno" msgid "unknown errno"
msgstr "" msgstr ""
#: popt.c:758 #: popt.c:888
#, c-format #, c-format
msgid "option type (%d) not implemented in popt\n" msgid "option type (%d) not implemented in popt\n"
msgstr "" msgstr ""
#: popt.c:893 #: popt.c:1053
msgid "missing argument" msgid "missing argument"
msgstr "" msgstr ""
#: popt.c:895 #: popt.c:1055
msgid "unknown option" msgid "unknown option"
msgstr "" msgstr ""
#: popt.c:897 #: popt.c:1057
msgid "mutually exclusive logical operations requested" msgid "mutually exclusive logical operations requested"
msgstr "" msgstr ""
#: popt.c:899 #: popt.c:1059
msgid "opt->arg should not be NULL"
msgstr ""
#: popt.c:1061
msgid "aliases nested too deeply" msgid "aliases nested too deeply"
msgstr "" msgstr ""
#: popt.c:901 #: popt.c:1063
msgid "error in parameter quoting" msgid "error in parameter quoting"
msgstr "" msgstr ""
#: popt.c:903 #: popt.c:1065
msgid "invalid numeric value" msgid "invalid numeric value"
msgstr "" msgstr ""
#: popt.c:905 #: popt.c:1067
msgid "number too large or too small" msgid "number too large or too small"
msgstr "" msgstr ""
#: popt.c:909 #: popt.c:1069
msgid "memory allocation failed"
msgstr ""
#: popt.c:1073
msgid "unknown error" msgid "unknown error"
msgstr "" msgstr ""
#: popthelp.c:28 #: popthelp.c:32
msgid "Show this help message" msgid "Show this help message"
msgstr "" msgstr ""
#: popthelp.c:29 #: popthelp.c:33
msgid "Display brief usage message" msgid "Display brief usage message"
msgstr "" msgstr ""
#: popthelp.c:60 #: popthelp.c:36
msgid "Display option defaults in message"
msgstr ""
#: popthelp.c:71
msgid "NONE" msgid "NONE"
msgstr "" msgstr ""
#: popthelp.c:61 #: popthelp.c:72
msgid "VAL" msgid "VAL"
msgstr "" msgstr ""
#: popthelp.c:62 #: popthelp.c:73
msgid "INT" msgid "INT"
msgstr "" msgstr ""
#: popthelp.c:63 #: popthelp.c:74
msgid "LONG" msgid "LONG"
msgstr "" msgstr ""
#: popthelp.c:64 #: popthelp.c:75
msgid "STRING" msgid "STRING"
msgstr "" msgstr ""
#: popthelp.c:65 #: popthelp.c:76
msgid "FLOAT" msgid "FLOAT"
msgstr "" msgstr ""
#: popthelp.c:66 #: popthelp.c:77
msgid "DOUBLE" msgid "DOUBLE"
msgstr "" msgstr ""
#: popthelp.c:67 #: popthelp.c:78
msgid "ARG" msgid "ARG"
msgstr "" msgstr ""
#: popthelp.c:241 #: popthelp.c:354
msgid "Usage:" msgid "Usage:"
msgstr "" msgstr ""
#: popthelp.c:260 #: popthelp.c:376
msgid "[OPTION...]" msgid "[OPTION...]"
msgstr "" msgstr ""

191
rpm.spec
View File

@ -31,8 +31,6 @@ BuildRequires: db3-devel
# XXX linked binaries like /bin/rpm. # XXX linked binaries like /bin/rpm.
%ifnarch ia64 %ifnarch ia64
Requires: glibc >= 2.1.92 Requires: glibc >= 2.1.92
# XXX needed to avoid libdb.so.2 satisfied by compat/libc5 provides.
Requires: db1 = 1.85
%endif %endif
%endif %endif
@ -131,11 +129,30 @@ rm -rf $RPM_BUILD_ROOT
make DESTDIR="$RPM_BUILD_ROOT" install make DESTDIR="$RPM_BUILD_ROOT" install
%ifos linux
# Save list of packages through cron
mkdir -p ${RPM_BUILD_ROOT}/etc/cron.daily
install -m 755 scripts/rpm.daily ${RPM_BUILD_ROOT}/etc/cron.daily/rpm
mkdir -p ${RPM_BUILD_ROOT}/etc/logrotate.d
install -m 755 scripts/rpm.log ${RPM_BUILD_ROOT}/etc/logrotate.d/rpm
mkdir -p $RPM_BUILD_ROOT/etc/rpm mkdir -p $RPM_BUILD_ROOT/etc/rpm
cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1 cat << E_O_F > $RPM_BUILD_ROOT/etc/rpm/macros.db1
%%_dbapi 1 %%_dbapi 1
E_O_F E_O_F
mkdir -p $RPM_BUILD_ROOT/var/lib/rpm
for dbi in \
Basenames Conflictname Dirnames Group Installtid Name Providename \
Provideversion Removetid Requirename Requireversion Triggername
do
touch $RPM_BUILD_ROOT/var/lib/rpm/$dbi
done
%endif
%if %{with_apidocs} %if %{with_apidocs}
gzip -9n apidocs/man/man*/* || : gzip -9n apidocs/man/man*/* || :
%endif %endif
@ -151,34 +168,46 @@ gzip -9n apidocs/man/man*/* || :
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%pre %pre
%ifos linux
if [ -f /var/lib/rpm/Packages -a -f /var/lib/rpm/packages.rpm ]; then if [ -f /var/lib/rpm/Packages -a -f /var/lib/rpm/packages.rpm ]; then
# echo " echo "
#You have both You have both
# /var/lib/rpm/packages.rpm db1 format installed package headers /var/lib/rpm/packages.rpm db1 format installed package headers
# /var/lib/rpm/Packages db3 format installed package headers /var/lib/rpm/Packages db3 format installed package headers
#Please remove (or at least rename) one of those files, and re-install. Please remove (or at least rename) one of those files, and re-install.
#" "
exit 1 exit 1
fi fi
/usr/sbin/groupadd -g 37 rpm > /dev/null 2>&1
/usr/sbin/useradd -d /var/lib/rpm -u 37 -g 37 rpm > /dev/null 2>&1
%endif
exit 0 exit 0
%post %post
%ifos linux %ifos linux
/sbin/ldconfig /sbin/ldconfig
%endif
if [ -f /var/lib/rpm/packages.rpm ]; then if [ -f /var/lib/rpm/packages.rpm ]; then
: # do nothing /bin/chown rpm.rpm /var/lib/rpm/*.rpm
elif [ -f /var/lib/rpm/Packages ]; then elif [ -f /var/lib/rpm/Packages ]; then
# undo db1 configuration # undo db1 configuration
rm -f /etc/rpm/macros.db1 rm -f /etc/rpm/macros.db1
/bin/chown rpm.rpm /var/lib/rpm/[A-Z]*
else else
# initialize db3 database # initialize db3 database
rm -f /etc/rpm/macros.db1 rm -f /etc/rpm/macros.db1
/bin/rpm --initdb /bin/rpm --initdb
fi fi
%endif
exit 0
%ifos linux %ifos linux
%postun -p /sbin/ldconfig %postun
/sbin/ldconfig
if [ $1 == 0 ]; then
/usr/sbin/userdel rpm
/usr/sbin/groupdel rpm
fi
%post devel -p /sbin/ldconfig %post devel -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig %postun devel -p /sbin/ldconfig
@ -192,50 +221,79 @@ fi
%postun python -p /sbin/ldconfig %postun python -p /sbin/ldconfig
%endif %endif
%define rpmattr %attr(0755, rpm, rpm)
%define rpmdbattr %rpmattr %verify(not md5 size mtime) %ghost
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]* %doc RPM-PGP-KEY RPM-GPG-KEY CHANGES GROUPS doc/manual/[a-z]*
/bin/rpm %attr(0755, rpm, rpm) /bin/rpm
%ifos linux
%config(noreplace,missingok) /etc/cron.daily/rpm
%config(noreplace,missingok) /etc/logrotate.d/rpm
%dir /etc/rpm %dir /etc/rpm
%config(missingok) /etc/rpm/macros.db1 %config(noreplace,missingok) /etc/rpm/macros.db1
%{__prefix}/bin/rpm2cpio %attr(0755, rpm, rpm) %dir /var/lib/rpm
%{__prefix}/bin/gendiff %rpmdbattr /var/lib/rpm/Basenames
%{__prefix}/bin/rpmdb %rpmdbattr /var/lib/rpm/Conflictname
%{__prefix}/bin/rpm[eiukqv] #%rpmdbattr /var/lib/rpm/__db.001
%{__prefix}/bin/rpmsign %rpmdbattr /var/lib/rpm/Dirnames
%{__prefix}/bin/rpmquery %rpmdbattr /var/lib/rpm/Group
%{__prefix}/bin/rpmverify %rpmdbattr /var/lib/rpm/Installtid
%rpmdbattr /var/lib/rpm/Name
#%rpmdbattr /var/lib/rpm/Packages
%rpmdbattr /var/lib/rpm/Providename
%rpmdbattr /var/lib/rpm/Provideversion
%rpmdbattr /var/lib/rpm/Removetid
%rpmdbattr /var/lib/rpm/Requirename
%rpmdbattr /var/lib/rpm/Requireversion
%rpmdbattr /var/lib/rpm/Triggername
%endif
%rpmattr %{__prefix}/bin/rpm2cpio
%rpmattr %{__prefix}/bin/gendiff
%rpmattr %{__prefix}/bin/rpmdb
%rpmattr %{__prefix}/bin/rpm[eiukqv]
%rpmattr %{__prefix}/bin/rpmsign
%rpmattr %{__prefix}/bin/rpmquery
%rpmattr %{__prefix}/bin/rpmverify
%{__prefix}/lib/librpm.so.* %{__prefix}/lib/librpm.so.*
%{__prefix}/lib/librpmdb.so.*
%{__prefix}/lib/librpmio.so.* %{__prefix}/lib/librpmio.so.*
%{__prefix}/lib/librpmbuild.so.* %{__prefix}/lib/librpmbuild.so.*
%{__prefix}/lib/rpm/config.guess %rpmattr %{__prefix}/lib/rpm/config.guess
%{__prefix}/lib/rpm/config.sub %rpmattr %{__prefix}/lib/rpm/config.sub
%{__prefix}/lib/rpm/convertrpmrc.sh %rpmattr %{__prefix}/lib/rpm/convertrpmrc.sh
%{__prefix}/lib/rpm/macros %attr(0644, rpm, rpm) %{__prefix}/lib/rpm/macros
%{__prefix}/lib/rpm/mkinstalldirs %rpmattr %{__prefix}/lib/rpm/mkinstalldirs
%{__prefix}/lib/rpm/rpmdb %rpmattr %{__prefix}/lib/rpm/rpm.*
%{__prefix}/lib/rpm/rpm[eiukqv] %rpmattr %{__prefix}/lib/rpm/rpm[deiukqv]
%{__prefix}/lib/rpm/rpmpopt* %attr(0644, rpm, rpm) %{__prefix}/lib/rpm/rpmpopt*
%{__prefix}/lib/rpm/rpmrc %attr(0644, rpm, rpm) %{__prefix}/lib/rpm/rpmrc
%ifarch i386 i486 i586 i686 %ifarch i386 i486 i586 i686 athlon
%{__prefix}/lib/rpm/i[3456]86* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/i[3456]86*
%endif %endif
%ifarch alpha %ifarch alpha
%{__prefix}/lib/rpm/alpha* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/alpha*
%endif %endif
%ifarch sparc sparc64 %ifarch sparc sparc64
%{__prefix}/lib/rpm/sparc* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/sparc*
%endif %endif
%ifarch ia64 %ifarch ia64
%{__prefix}/lib/rpm/ia64* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/ia64*
%endif %endif
%ifarch powerpc ppc %ifarch powerpc ppc
%{__prefix}/lib/rpm/ppc* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/ppc*
%endif
%ifarch s390 s390x
%attr(-, rpm, rpm) %{__prefix}/lib/rpm/s390*
%endif %endif
%ifarch armv3l armv4l %ifarch armv3l armv4l
%{__prefix}/lib/rpm/armv[34][lb]* %attr(-, rpm, rpm) %{__prefix}/lib/rpm/armv[34][lb]*
%endif %endif
%lang(cs) %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo %lang(cs) %{__prefix}/*/locale/cs/LC_MESSAGES/rpm.mo
@ -257,7 +315,9 @@ fi
%lang(sv) %{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo %lang(sv) %{__prefix}/*/locale/sv/LC_MESSAGES/rpm.mo
%lang(tr) %{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo %lang(tr) %{__prefix}/*/locale/tr/LC_MESSAGES/rpm.mo
%{__prefix}%{__share}/man/man[18]/*.[18]* %{__prefix}%{__share}/man/man1/gendiff.1*
%{__prefix}%{__share}/man/man8/rpm.8*
%{__prefix}%{__share}/man/man8/rpm2cpio.8*
%lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]* %lang(pl) %{__prefix}%{__share}/man/pl/man[18]/*.[18]*
%lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]* %lang(ru) %{__prefix}%{__share}/man/ru/man[18]/*.[18]*
%lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]* %lang(sk) %{__prefix}%{__share}/man/sk/man[18]/*.[18]*
@ -271,31 +331,35 @@ fi
%dir %{__prefix}/src/redhat/SRPMS %dir %{__prefix}/src/redhat/SRPMS
%dir %{__prefix}/src/redhat/RPMS %dir %{__prefix}/src/redhat/RPMS
%{__prefix}/src/redhat/RPMS/* %{__prefix}/src/redhat/RPMS/*
%{__prefix}/bin/rpmbuild %rpmattr %{__prefix}/bin/rpmbuild
%{__prefix}/lib/rpm/brp-* %rpmattr %{__prefix}/lib/rpm/brp-*
%{__prefix}/lib/rpm/check-prereqs %rpmattr %{__prefix}/lib/rpm/check-prereqs
%{__prefix}/lib/rpm/cpanflute %rpmattr %{__prefix}/lib/rpm/config.site
%{__prefix}/lib/rpm/find-lang.sh %rpmattr %{__prefix}/lib/rpm/cpanflute
%{__prefix}/lib/rpm/find-prov.pl %rpmattr %{__prefix}/lib/rpm/cross-build
%{__prefix}/lib/rpm/find-provides %rpmattr %{__prefix}/lib/rpm/find-lang.sh
%{__prefix}/lib/rpm/find-provides.perl %rpmattr %{__prefix}/lib/rpm/find-prov.pl
%{__prefix}/lib/rpm/find-req.pl %rpmattr %{__prefix}/lib/rpm/find-provides
%{__prefix}/lib/rpm/find-requires %rpmattr %{__prefix}/lib/rpm/find-provides.perl
%{__prefix}/lib/rpm/find-requires.perl %rpmattr %{__prefix}/lib/rpm/find-req.pl
%{__prefix}/lib/rpm/get_magic.pl %rpmattr %{__prefix}/lib/rpm/find-requires
%{__prefix}/lib/rpm/getpo.sh %rpmattr %{__prefix}/lib/rpm/find-requires.perl
%{__prefix}/lib/rpm/http.req %rpmattr %{__prefix}/lib/rpm/get_magic.pl
%{__prefix}/lib/rpm/javadeps %rpmattr %{__prefix}/lib/rpm/getpo.sh
%{__prefix}/lib/rpm/magic.prov %rpmattr %{__prefix}/lib/rpm/http.req
%{__prefix}/lib/rpm/magic.req %rpmattr %{__prefix}/lib/rpm/javadeps
%{__prefix}/lib/rpm/perl.prov %rpmattr %{__prefix}/lib/rpm/magic.prov
%{__prefix}/lib/rpm/perl.req %rpmattr %{__prefix}/lib/rpm/magic.req
%{__prefix}/lib/rpm/rpm[bt] %rpmattr %{__prefix}/lib/rpm/perl.prov
%{__prefix}/lib/rpm/rpmdiff %rpmattr %{__prefix}/lib/rpm/perl.req
%{__prefix}/lib/rpm/rpmdiff.cgi %rpmattr %{__prefix}/lib/rpm/rpm[bt]
%{__prefix}/lib/rpm/u_pkg.sh %rpmattr %{__prefix}/lib/rpm/rpmdiff
%{__prefix}/lib/rpm/vpkg-provides.sh %rpmattr %{__prefix}/lib/rpm/rpmdiff.cgi
%{__prefix}/lib/rpm/vpkg-provides2.sh %rpmattr %{__prefix}/lib/rpm/u_pkg.sh
%rpmattr %{__prefix}/lib/rpm/vpkg-provides.sh
%rpmattr %{__prefix}/lib/rpm/vpkg-provides2.sh
%{__prefix}%{__share}/man/man8/rpmbuild.8*
%if %{with_python_subpackage} %if %{with_python_subpackage}
%files python %files python
@ -312,6 +376,9 @@ fi
%{__prefix}/lib/librpm.a %{__prefix}/lib/librpm.a
%{__prefix}/lib/librpm.la %{__prefix}/lib/librpm.la
%{__prefix}/lib/librpm.so %{__prefix}/lib/librpm.so
%{__prefix}/lib/librpmdb.a
%{__prefix}/lib/librpmdb.la
%{__prefix}/lib/librpmdb.so
%{__prefix}/lib/librpmio.a %{__prefix}/lib/librpmio.a
%{__prefix}/lib/librpmio.la %{__prefix}/lib/librpmio.la
%{__prefix}/lib/librpmio.so %{__prefix}/lib/librpmio.so

View File

@ -388,7 +388,7 @@ static int fadSanity(FD_t fd, int offset, const struct faHeader * fh, int printi
int rc = 0; int rc = 0;
/* Check size range and alignment. */ /* Check size range and alignment. */
if (!(fh->size > 0 || fh->size <= 0x00200000 && (fh->size & 0x3f) == 0)) if (!(fh->size > 0 && fh->size <= 0x00200000 && (fh->size & 0x3f) == 0))
rc |= 0x1; rc |= 0x1;
/* Check forward link range, alignment and offset. */ /* Check forward link range, alignment and offset. */

View File

@ -1,7 +1,7 @@
#/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc #/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc
# \verbatim # \verbatim
# #
# $Id: rpmrc.in,v 2.37 2001/05/16 19:19:15 jbj Exp $ # $Id: rpmrc.in,v 2.38 2001/06/19 11:38:51 jbj Exp $
# #
# This is a global RPM configuration file. All changes made here will # This is a global RPM configuration file. All changes made here will
# be lost when the rpm package is upgraded. Any per-system configuration # be lost when the rpm package is upgraded. Any per-system configuration
@ -50,6 +50,8 @@ optflags: falcon -O2 -fomit-frame-pointer
optflags: atariclone -O2 -fomit-frame-pointer optflags: atariclone -O2 -fomit-frame-pointer
optflags: milan -O2 -fomit-frame-pointer optflags: milan -O2 -fomit-frame-pointer
optflags: hades -O2 -fomit-frame-pointer optflags: hades -O2 -fomit-frame-pointer
optflags: s390 -O2
optflags: s390x -O2
############################################################# #############################################################
# Canonical arch names and numbers # Canonical arch names and numbers
@ -97,6 +99,7 @@ arch_canon: milan: m68kmint 13
arch_canon: hades: m68kmint 13 arch_canon: hades: m68kmint 13
arch_canon: s390: s390 14 arch_canon: s390: s390 14
arch_canon: i370: i370 14 arch_canon: i370: i370 14
arch_canon: s390x: s390x 15
############################################################# #############################################################
# Canonical OS names and numbers # Canonical OS names and numbers
@ -168,6 +171,9 @@ buildarchtranslate: atariclone: m68kmint
buildarchtranslate: milan: m68kmint buildarchtranslate: milan: m68kmint
buildarchtranslate: hades: m68kmint buildarchtranslate: hades: m68kmint
buildarchtranslate: s390: s390
buildarchtranslate: s390x: s390x
############################################################# #############################################################
# Architecture compatibility # Architecture compatibility
@ -224,8 +230,9 @@ arch_compat: atariclone: m68kmint noarch
arch_compat: milan: m68kmint noarch arch_compat: milan: m68kmint noarch
arch_compat: hades: m68kmint noarch arch_compat: hades: m68kmint noarch
arch_compat: s390: i370
arch_compat: i370: noarch arch_compat: i370: noarch
arch_compat: s390: noarch
arch_compat: s390x: noarch
arch_compat: ia64: i686 noarch arch_compat: ia64: i686 noarch
@ -299,7 +306,9 @@ buildarch_compat: milan: m68kmint noarch
buildarch_compat: hades: m68kmint noarch buildarch_compat: hades: m68kmint noarch
buildarch_compat: ia64: noarch buildarch_compat: ia64: noarch
buildarch_compat: s390: noarch buildarch_compat: s390: noarch
buildarch_compat: s390x: noarch
macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.db1:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros macrofiles: @RPMCONFIGDIR@/macros:@RPMCONFIGDIR@/%{_target}/macros:@SYSCONFIGDIR@/macros.specspo:@SYSCONFIGDIR@/macros.db1:@SYSCONFIGDIR@/macros:@SYSCONFIGDIR@/%{_target}/macros:~/.rpmmacros