Defines | Functions | Variables

# build/pack.c File Reference

Assemble components of an RPM package. More...

`#include "system.h"`
`#include <rpmio_internal.h>`
`#include <rpmbuild.h>`
`#include "signature.h"`
`#include "cpio.h"`
`#include "fsm.h"`
`#include "buildio.h"`
`#include <pkgio.h>`
`#include "debug.h"`
Include dependency graph for pack.c:

Go to the source code of this file.

## Defines
#define | _RPMFI_INTERNAL
#define | _RPMEVR_INTERNAL
#define | _RPMTAG_INTERNAL
## Functions
static int | genSourceRpmName (Spec spec)
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 StringBuf | addFileToTagAux (Spec spec, const char *file, StringBuf sb)
static int | addFileToTag (Spec spec, const char *file, Header h, rpmTag tag)
static int | addFileToArrayTag (Spec spec, const char *file, Header h, int tag)
rpmRC | processScriptFiles (Spec spec, Package pkg)
| Append files (if any) to scriptlet tags.
void | providePackageNVR (Header h)
| Retrofit an explicit Provides: N = E:V-R dependency into package headers.
rpmRC | writeRPM (Header *hdrp, unsigned char **pkgidp, const char *fileName, CSA_t csa, char *passPhrase, const char **cookie)
| Write rpm package to file.
static int | rpmlibMarkers (Header h)
rpmRC | packageBinaries (Spec spec)
| Generate binary package(s).
rpmRC | packageSources (Spec spec)
| Generate source package.
## Variables
static uint32_t | copyTags []

## Detailed Description

Assemble components of an RPM package.

Definition in file pack.c.

## Define Documentation

#define _RPMEVR_INTERNAL

Definition at line 10 of file pack.c.

#define _RPMFI_INTERNAL

Definition at line 9 of file pack.c.

#define _RPMTAG_INTERNAL

Definition at line 11 of file pack.c.

## Function Documentation

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

Definition at line 200 of file pack.c.

References addFileToTagAux(), alloca(), _HE_s::append, rpmDataType_u::argv, _HE_s::c, freeStringBuf(), getStringBuf(), headerPut(), newStringBuf(), _HE_s::p, RPM_STRING_ARRAY_TYPE, _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 169 of file pack.c.

References _free(), addFileToTagAux(), alloca(), appendLineStringBuf, _HE_s::c, freeStringBuf(), getStringBuf(), headerDel(), headerGet(), headerPut(), newStringBuf(), _HE_s::p, rpmDataType_u::ptr, RPM_STRING_TYPE, rpmDataType_u::str, _HE_s::t, and _HE_s::tag.

Referenced by processScriptFiles().

static StringBuf addFileToTagAux | ( | Spec | spec,
|  | const char * | file,
|  | StringBuf | sb
| ) |  | `[static]`

Definition at line 132 of file pack.c.

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

Referenced by addFileToArrayTag(), and addFileToTag().

static rpmRC cpio_copy | ( | FD_t | fdo,
|  | CSA_t | csa
| ) |  | `[static]`

Definition at line 107 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 56 of file pack.c.

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

Referenced by writeRPM().

static int genSourceRpmName | ( | Spec | spec ) | `[inline, static]`

Definition at line 33 of file pack.c.

References _free(), Package_s::header, headerNEVRA(), Spec_s::noSource, Spec_s::packages, snprintf(), Spec_s::sourceRpmName, and xstrdup().

Referenced by packageBinaries(), and packageSources().

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 226 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, 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 463 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, stpcpy(), _HE_s::t, _HE_s::tag, and rpmDataType_u::ui32p.

Referenced by processBinaryFiles().

static int rpmlibMarkers | ( | Header | h ) | `[static]`

Definition at line 943 of file pack.c.

References _rpmbuildFlags, alloca(), buildHost(), _HE_s::c, getBuildTime(), headerPut(), _HE_s::p, RPM_STRING_TYPE, RPM_UINT32_TYPE, rpmlibTimestamp(), rpmlibVendor(), rpmlibVersion(), rpmDataType_u::str, _HE_s::t, _HE_s::tag, rpmDataType_u::ui32p, and VERSION.

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 588 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(), _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_PAYLOADSIZE, RPMSIGTAG_SHA1, RPMSIGTAG_SIZE, RPMTAG_HEADERIMMUTABLE, RPMTAG_HEADERSIGNATURES, 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

uint32_t copyTags[]`[static]`

Initial value:

     {
        RPMTAG_CHANGELOGTIME,
        RPMTAG_CHANGELOGNAME,
        RPMTAG_CHANGELOGTEXT,
        0
    }

Definition at line 995 of file pack.c.