rpm  4.5
Macros | Functions | Variables
pack.c File Reference

Assemble components of an RPM package. More...

#include "system.h"
#include <rpmio_internal.h>
#include <rpmbuild.h>
#include "rpmps.h"
#include "cpio.h"
#include "fsm.h"
#include "psm.h"
#include "rpmfi.h"
#include "rpmts.h"
#include "buildio.h"
#include "signature.h"
#include "rpmlead.h"
#include "debug.h"
Include dependency graph for pack.c:

Go to the source code of this file.

Macros

#define _RPMEVR_INTERNAL   /* XXX RPMSENSE_ANY */
 
#define _RPMFI_INTERNAL   /* XXX fi->fsm */
 
#define RPMPKGVERSION_MIN   30004
 
#define RPMPKGVERSION_MAX   40003
 

Functions

static int genSourceRpmName (Spec spec)
 
static int cpio_doio (FD_t fdo, Header h, CSA_t csa, const char *payload_format, const char *fmodeMacro)
 
static int cpio_copy (FD_t fdo, CSA_t csa)
 
static StringBuf addFileToTagAux (Spec spec, const char *file, StringBuf sb)
 
static int addFileToTag (Spec spec, const char *file, Header h, int tag)
 
static int addFileToArrayTag (Spec spec, const char *file, Header h, int tag)
 
int processScriptFiles (Spec spec, Package pkg)
 Append files (if any) to scriptlet tags.
 
int readRPM (const char *fileName, Spec *specp, struct rpmlead *lead, Header *sigs, CSA_t csa)
 Read rpm package components from file.
 
static int rpmLeadVersion (void)
 
void providePackageNVR (Header h)
 Retrofit an explicit Provides: N = E:V-R dependency into package headers.
 
int writeRPM (Header *hdrp, unsigned char **pkgidp, const char *fileName, int type, CSA_t csa, char *passPhrase, const char **cookie)
 Write rpm package to file.
 
int packageBinaries (Spec spec)
 Generate binary package(s).
 
int packageSources (Spec spec)
 Generate source package.
 

Variables

static int rpmpkg_version = -1
 
static int_32 copyTags []
 

Detailed Description

Assemble components of an RPM package.

Definition in file pack.c.

Macro Definition Documentation

#define _RPMEVR_INTERNAL   /* XXX RPMSENSE_ANY */

Definition at line 9 of file pack.c.

#define _RPMFI_INTERNAL   /* XXX fi->fsm */

Definition at line 18 of file pack.c.

#define RPMPKGVERSION_MAX   40003

Definition at line 392 of file pack.c.

Referenced by rpmLeadVersion().

#define RPMPKGVERSION_MIN   30004

Definition at line 391 of file pack.c.

Referenced by rpmLeadVersion().

Function Documentation

static int addFileToArrayTag ( Spec  spec,
const char *  file,
Header  h,
int  tag 
)
static
static int addFileToTag ( Spec  spec,
const char *  file,
Header  h,
int  tag 
)
static
static StringBuf addFileToTagAux ( Spec  spec,
const char *  file,
StringBuf  sb 
)
static
static int cpio_copy ( FD_t  fdo,
CSA_t  csa 
)
static
static int cpio_doio ( FD_t  fdo,
Header  h,
CSA_t  csa,
const char *  payload_format,
const char *  fmodeMacro 
)
static
static int genSourceRpmName ( Spec  spec)
inlinestatic
int processScriptFiles ( Spec  spec,
Package  pkg 
)
void providePackageNVR ( Header  h)

Retrofit an explicit Provides: N = E:V-R dependency into package headers.

Up to rpm 3.0.4, packages implicitly provided their own name-version-release.

Parameters
hheader

Definition at line 418 of file pack.c.

References alloca(), headerAddOrAppendEntry(), headerFreeData(), headerGetEntryMinMemory(), headerNVR(), name, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMSENSE_ANY, RPMSENSE_EQUAL, RPMTAG_EPOCH, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, and stpcpy().

Referenced by hdrLoad(), processBinaryFiles(), and rpmReadHeaders().

int readRPM ( const char *  fileName,
Spec specp,
struct rpmlead lead,
Header sigs,
CSA_t  csa 
)

Read rpm package components from file.

Parameters
fileNamefile name of package (or NULL to use stdin)
Return values
specpspec structure to carry package header (or NULL)
leadpackage lead
sigspackage signature
Parameters
csa
Returns
0 on success

Definition at line 294 of file pack.c.

References _, cpioSourceArchive_s::cpioFdIn, Fclose(), fdDup(), Ferror(), Fopen(), Fread(), freeSpec(), Fseek(), Fstrerror(), Package_s::header, headerFree(), newPackage(), newSpec(), Spec_s::packages, RPMERR_BADMAGIC, RPMERR_FSEEK, rpmError, RPMRC_FAIL, RPMRC_NOKEY, RPMRC_NOTFOUND, RPMRC_NOTTRUSTED, RPMRC_OK, rpmReadPackageFile(), rpmtsCreate(), rpmtsFree(), and SEEK_SET.

static int rpmLeadVersion ( void  )
static

Definition at line 396 of file pack.c.

References rpmExpandNumeric(), rpmpkg_version, RPMPKGVERSION_MAX, and RPMPKGVERSION_MIN.

Referenced by writeRPM().

int writeRPM ( Header hdrp,
unsigned char **  pkgidp,
const char *  fileName,
int  type,
CSA_t  csa,
char *  passPhrase,
const char **  cookie 
)

Write rpm package to file.

Warning
The first argument (header) is now passed by reference in order to return a reloaded contiguous header to the caller.
Return values
*hdrpheader to write (final header is returned).
*pkgidpheader+payload MD5 of package (NULL to disable).
Parameters
fileNamefile name of package
typeRPMLEAD_SOURCE/RPMLEAD_BINARY
csa
passPhrase
Return values
cookiegenerated cookie (i.e build host/time)
Returns
0 on success

Definition at line 500 of file pack.c.

References _, _free(), alloca(), rpmlead::archnum, buildHost(), cpio_copy(), cpio_doio(), cpioSourceArchive_s::cpioArchiveSize, cpioSourceArchive_s::cpioFdIn, cpioSourceArchive_s::cpioList, Fclose(), fdFiniDigest(), fdInitDigest(), Ferror(), Fflush(), Fileno(), Fopen(), Fread(), Fseek(), Fstrerror(), Fwrite(), getBuildTime(), HEADER_MAGIC_YES, headerAddEntry(), headerFree(), headerGetEntry(), headerGetEntryMinMemory(), headerLink(), headerMergeLegacySigs(), headerNVR(), headerRead(), headerReload(), headerSizeof(), headerUnload(), headerWrite(), cpioSourceArchive_s::lead, rpmlead::major, makeTempFile(), rpmlead::minor, name, rpmlead::name, rpmlead::osnum, PGPHASHALGO_SHA1, RPM_BIN_TYPE, RPM_INT32_TYPE, RPM_STRING_TYPE, rpmAddSignature(), RPMERR_BADARG, RPMERR_CREATE, RPMERR_FSEEK, RPMERR_NOSPACE, RPMERR_READ, RPMERR_RELOAD, rpmError, rpmExpand(), rpmFreeSignature(), RPMLEAD_BINARY, RPMLEAD_SOURCE, rpmLeadVersion(), rpmlibNeedsFeature(), RPMLOOKUPSIG_QUERY, rpmLookupSignatureType(), RPMMESS_NORMAL, rpmMessage, rpmNewSignature(), RPMRC_OK, RPMSIGTAG_MD5, RPMSIGTAG_PADDING, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMSIGTYPE_HEADERSIG, RPMTAG_ARCHIVESIZE, RPMTAG_COOKIE, RPMTAG_HEADERIMMUTABLE, RPMTAG_HEADERSIGNATURES, RPMTAG_PAYLOADCOMPRESSOR, RPMTAG_PAYLOADFLAGS, RPMTAG_PAYLOADFORMAT, rpmWriteSignature(), SEEK_SET, rpmlead::signature_type, tagType(), rpmlead::type, Unlink(), writeLead(), and xstrdup().

Referenced by packageBinaries(), and packageSources().

Variable Documentation

int_32 copyTags[]
static
Initial value:

Definition at line 862 of file pack.c.

Referenced by packageBinaries().

int rpmpkg_version = -1
static

Definition at line 394 of file pack.c.

Referenced by rpmLeadVersion().