pack.c File Reference
RPMBUILD.

Assemble components of an RPM package. More...

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmcb.h>`
`#include <argv.h>`
`#include <rpmtypes.h>`
`#include <rpmtag.h>`
`#include <pkgio.h>`
`#include "signature.h"`
`#include <rpmbuild.h>`
`#include "rpmfi.h"`
`#include "fsm.h"`
`#include <rpmversion.h>`
`#include "buildio.h"`
`#include "debug.h"`
Include dependency graph for pack.c:

Go to the source code of this file.

## Macros

#define | _RPMFI_INTERNAL /* XXX fi->fsm */
#define | _RPMEVR_INTERNAL /* XXX RPMSENSE_ANY */
#define | _RPMTAG_INTERNAL

## Functions

static rpmRC | cpio_doio (FD_t fdo, Header h, CSA_t csa, const char *payload_format, const char *fmodeMacro)
static rpmRC | cpio_copy (FD_t fdo, CSA_t csa)
static rpmiob | addFileToTagAux (Spec spec, const char *file, rpmiob iob)
static int | addFileToTag (Spec spec, const char *file, Header h, rpmTag tag)
static int | addFileToArrayTag (Spec spec, const char *file, Header h, rpmTag tag)
rpmRC | processScriptFiles (Spec spec, Package pkg)
| Append files (if any) to scriptlet tags. More...
void | providePackageNVR (Header h)
| Retrofit an explicit Provides: N = E:V-R dependency into package headers. More...
rpmRC | writeRPM (Header *hdrp, unsigned char **pkgidp, const char *fileName, CSA_t csa, char *passPhrase, const char **cookie)
| Write rpm package to file. More...
static int | rpmlibMarkers (Header h)
rpmRC | packageBinaries (Spec spec)
| Generate binary package(s). More...
rpmRC | packageSources (Spec spec)
| Generate source package. More...

## Variables

static rpmTag | 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 19 of file pack.c.

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

Definition at line 18 of file pack.c.

#define _RPMTAG_INTERNAL

Definition at line 20 of file pack.c.

## Function Documentation

static int addFileToArrayTag | ( | Spec | spec,
|  | const char * | file,
|  | Header | h,
|  | rpmTag | tag
| ) |  |

static

Definition at line 186 of file pack.c.

References addFileToTagAux(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, headerPut(), _HE_s::p, RPM_STRING_ARRAY_TYPE, rpmiobFree(), rpmiobNew(), rpmiobStr(), _HE_s::t, and _HE_s::tag.

Referenced by processScriptFiles().

static int addFileToTag | ( | Spec | spec,
|  | const char * | file,
|  | Header | h,
|  | rpmTag | tag
| ) |  |

static

Definition at line 155 of file pack.c.

References _free(), addFileToTagAux(), alloca(), _HE_s::c, headerDel(), headerGet(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, rpmiobAppend(), rpmiobFree(), rpmiobNew(), rpmiobStr(), rpmDataType_u::str, _HE_s::t, and _HE_s::tag.

Referenced by processScriptFiles().

static rpmiob addFileToTagAux | ( | Spec | spec,
|  | const char * | file,
|  | rpmiob | iob
| ) |  |

static

Definition at line 118 of file pack.c.

References _, _free(), expandMacros(), Fclose(), fdGetFp(), Ferror(), Fopen(), Spec_s::macros, rpmGetPath(), rpmiobAppend(), rpmiobFree(), rpmlog(), and RPMLOG_ERR.

Referenced by addFileToArrayTag(), and addFileToTag().

static rpmRC cpio_copy | ( | FD_t | fdo,
|  | CSA_t | csa
| ) |  |

static

Definition at line 93 of file pack.c.

References _, cpioSourceArchive_s::cpioArchiveSize, cpioSourceArchive_s::cpioFdIn, Ferror(), Fread(), Fstrerror(), Fwrite(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, and RPMRC_OK.

Referenced by writeRPM().

static rpmRC cpio_doio | ( | FD_t | fdo,
|  | Header | h,
|  | CSA_t | csa,
|  | const char * | payload_format,
|  | const char * | fmodeMacro
| ) |  |

static

Todo:
  Create transaction set much earlier.

Definition at line 40 of file pack.c.

References _, _free(), cpioSourceArchive_s::cpioArchiveSize, cpioSourceArchive_s::cpioList, Fclose(), fdDup(), Fdopen(), Fflush(), Fileno(), fsmSetup(), fsmTeardown(), IOSM_PKGBUILD, iosmStrerror(), rpmExpand(), rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, rpmtsCreate(), rpmtsFree(), and xstrdup().

Referenced by writeRPM().

rpmRC processScriptFiles | ( | Spec | spec,
|  | Package | pkg
| ) |  |

Append files (if any) to scriptlet tags.

Parameters

  spec | spec file control structure
  pkg | package control structure

Returns
  RPMRC_OK on success

Definition at line 212 of file pack.c.

References _, addFileToArrayTag(), addFileToTag(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, TriggerFileEntry::fileName, Package_s::header, headerPut(), TriggerFileEntry::next, _HE_s::p, Package_s::postInFile, Package_s::postTransFile, Package_s::postUnFile, Package_s::preInFile, Package_s::preTransFile, Package_s::preUnFile, TriggerFileEntry::prog, RPM_STRING_ARRAY_TYPE, rpmlog(), RPMLOG_ERR, RPMRC_FAIL, RPMRC_OK, RPMTAG_POSTIN, RPMTAG_POSTTRANS, RPMTAG_POSTUN, RPMTAG_PREIN, RPMTAG_PRETRANS, RPMTAG_PREUN, RPMTAG_SANITYCHECK, RPMTAG_TRIGGERSCRIPTPROG, RPMTAG_TRIGGERSCRIPTS, RPMTAG_VERIFYSCRIPT, Package_s::sanityCheckFile, TriggerFileEntry::script, _HE_s::t, _HE_s::tag, Package_s::triggerFiles, and Package_s::verifyFile.

Referenced by processBinaryFiles().

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

  h | header

Definition at line 452 of file pack.c.

References _free(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, headerGet(), headerNEVRA(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_ARRAY_TYPE, RPM_UINT32_TYPE, RPMSENSE_EQUAL, RPMTAG_DISTEPOCH, RPMTAG_EPOCH, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, stpcpy(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by processBinaryFiles().

static int rpmlibMarkers | ( | Header | h | ) |

static

Definition at line 1006 of file pack.c.

References _free(), _rpmbuildFlags, alloca(), buildHost(), _HE_s::c, getBuildTime(), headerPut(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, RPM_UINT32_TYPE, rpmlibTimestamp(), rpmlibVendor(), rpmlibVersion(), RPMTAG_BUILDHOST, RPMTAG_BUILDTIME, RPMTAG_RPMLIBTIMESTAMP, RPMTAG_RPMLIBVENDOR, RPMTAG_RPMLIBVERSION, RPMTAG_RPMVERSION, rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, VERSION, and xstrdup().

Referenced by packageBinaries(), and packageSources().

rpmRC writeRPM | ( | Header * | hdrp,
|  | unsigned char ** | pkgidp,
|  | const char * | fileName,
|  | 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

  *hdrp | header to write (final header is returned).
  *pkgidp | header+payload MD5 of package (NULL to disable).

Parameters

  fileName | file name of package
  csa |
  passPhrase |

Return values

  cookie | generated cookie (i.e build host/time)

Returns
  RPMRC_OK on success

Definition at line 616 of file pack.c.

References _, _free(), alloca(), buildHost(), _HE_s::c, cpio_copy(), cpio_doio(), cpioSourceArchive_s::cpioArchiveSize, cpioSourceArchive_s::cpioFdIn, cpioSourceArchive_s::cpioList, Fclose(), fdFiniDigest(), fdInitDigest(), Ferror(), Fflush(), Fileno(), Fopen(), Fread(), Fstrerror(), Fwrite(), getBuildTime(), headerFree(), headerGet(), headerIsEntry(), headerLink(), headerMergeLegacySigs(), headerNEVRA(), headerNew(), headerPut(), headerReload(), headerUnload(), _HE_s::p, PGPHASHALGO_SHA1, rpmDataType_u::ptr, RPM_BIN_TYPE, RPM_STRING_TYPE, RPM_UINT32_TYPE, rpmAddSignature(), rpmExpand(), rpmlibNeedsFeature(), rpmlog(), RPMLOG_ERR, RPMLOG_NOTICE, rpmpkgRead(), rpmpkgSizeof(), rpmpkgWrite(), RPMRC_FAIL, RPMRC_OK, RPMSIGTAG_GPG, RPMSIGTAG_MD5, RPMSIGTAG_PADDING, RPMSIGTAG_PAYLOADSIZE, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMTAG_ARCH, RPMTAG_COOKIE, RPMTAG_HEADERIMMUTABLE, RPMTAG_HEADERSIGNATURES, RPMTAG_PAYLOADCOMPRESSOR, RPMTAG_PAYLOADFLAGS, RPMTAG_PAYLOADFORMAT, RPMTAG_SOURCERPM, rpmTempFile(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, rpmDataType_u::ui8p, Unlink(), and xstrdup().

Referenced by packageBinaries(), and packageSources().

## Variable Documentation

rpmTag copyTags[]

static

Initial value:
= {
RPMTAG_CHANGELOGTIME,
RPMTAG_CHANGELOGNAME,
RPMTAG_CHANGELOGTEXT,
0
}

Definition at line 1059 of file pack.c.