tools/rpminject.c File Reference

#include "system.h"
#include "rpmbuild.h"
#include "buildio.h"
#include "header.h"
#include "rpmlead.h"
#include "signature.h"
#include <err.h>
#include "debug.h"

Go to the source code of this file.

Data Structures

struct  cmd_s
struct  headerTypeTableEntry

Defines

#define MAXCMDS   40
#define MYBUFSIZ   (2*BUFSIZ)

Typedefs

typedef enum injmode_e injmode_t
typedef cmd_s cmd_t

Enumerations

enum  injmode_e { INJ_UNKNOWN, INJ_ADD, INJ_DELETE, INJ_MODIFY }
enum  cvtaction { CA_OLD, CA_NEW, CA_OMIT, CA_ERR }

Functions

static const char * pr_injmode (injmode_t injmode)
static const char * getTagString (int tval)
static int getTagVal (const char *tname)
static char * getTypeString (int tval)
static enum cvtaction convertAMD (enum cvtaction ca, int_32 type, void **nvalsp, int_32 *ncountp, cmd_t *newc)
static enum cvtaction convertExistingAMD (int_32 tag, int_32 type, void **valsp, int_32 *countp, void **nvalsp, int_32 *ncountp, cmd_t *cmds[], int ncmds)
static Header headerCopyWithConvert (Header h, cmd_t *cmds[], int ncmds)
static char * genChangelog (cmd_t *cmds[], int ncmds)
static int headerInject (Header *hdrp, cmd_t *cmds[], int ncmds)
static int rewriteRPM (const char *fni, const char *fno, cmd_t *cmds[], int ncmds)
static int do_inject (cmd_t *cmds[], int ncmds, const char *argv[])
int main (int argc, char *argv[])

Variables

const char * program_name
injmode_t injmode = INJ_UNKNOWN
cmd_tcmds [40]
int ncmds = 0
static const char * hdri18ntbl = "HEADER_I18NTABLE"
static struct headerTypeTableEntry rpmTypeTable []
static struct poptOption optionsTable []


Define Documentation

#define MAXCMDS   40

Definition at line 28 of file rpminject.c.

#define MYBUFSIZ   (2*BUFSIZ)

Referenced by genChangelog().


Typedef Documentation

typedef struct cmd_s cmd_t

typedef enum injmode_e injmode_t


Enumeration Type Documentation

enum cvtaction

Enumerator:
CA_OLD 
CA_NEW 
CA_OMIT 
CA_ERR 

Definition at line 114 of file rpminject.c.

enum injmode_e

Enumerator:
INJ_UNKNOWN 
INJ_ADD 
INJ_DELETE 
INJ_MODIFY 

Definition at line 14 of file rpminject.c.


Function Documentation

static enum cvtaction convertAMD ( enum cvtaction  ca,
int_32  type,
void **  nvalsp,
int_32 ncountp,
cmd_t newc 
) [static]

Definition at line 116 of file rpminject.c.

References CA_ERR, CA_NEW, CA_OLD, CA_OMIT, cmd_s::done, cmd_s::nvals, RPM_BIN_TYPE, RPM_CHAR_TYPE, RPM_I18NSTRING_TYPE, RPM_INT16_TYPE, RPM_INT32_TYPE, RPM_INT8_TYPE, RPM_NULL_TYPE, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, cmd_s::vals, xmalloc(), and xstrdup().

Referenced by headerInject().

static enum cvtaction convertExistingAMD ( int_32  tag,
int_32  type,
void **  valsp,
int_32 countp,
void **  nvalsp,
int_32 ncountp,
cmd_t cmds[],
int  ncmds 
) [static]

Definition at line 193 of file rpminject.c.

References CA_NEW, CA_OLD, CA_OMIT, cmds, cmd_s::done, INJ_ADD, INJ_DELETE, INJ_MODIFY, INJ_UNKNOWN, RPMTAG_EXTERNAL_TAG, RPMTAG_FIRSTFREE_TAG, and RPMTAG_NAME.

Referenced by headerCopyWithConvert().

static int do_inject ( cmd_t cmds[],
int  ncmds,
const char *  argv[] 
) [static]

Definition at line 480 of file rpminject.c.

References _, cmds, rewriteRPM(), and xmalloc().

Referenced by main().

static char* genChangelog ( cmd_t cmds[],
int  ncmds 
) [static]

Definition at line 315 of file rpminject.c.

References cmds, MYBUFSIZ, pr_injmode(), and xmalloc().

Referenced by headerInject().

static const char* getTagString ( int  tval  )  [static]

Definition at line 46 of file rpminject.c.

References hdri18ntbl, HEADER_I18NTABLE, headerTagTableEntry_s::name, rpmTagTable, and headerTagTableEntry_s::val.

Referenced by headerInject().

static int getTagVal ( const char *  tname  )  [static]

Definition at line 59 of file rpminject.c.

References alloca(), hdri18ntbl, HEADER_I18NTABLE, headerTagTableEntry_s::name, rpmTagTable, headerTagTableEntry_s::val, xstrcasecmp(), and xstrncasecmp().

Referenced by main().

static char* getTypeString ( int  tval  )  [static]

Definition at line 99 of file rpminject.c.

References headerTypeTableEntry::name, rpmTypeTable, and headerTypeTableEntry::val.

static Header headerCopyWithConvert ( Header  h,
cmd_t cmds[],
int  ncmds 
) [static]

Definition at line 265 of file rpminject.c.

References CA_ERR, CA_NEW, CA_OLD, CA_OMIT, cmds, convertExistingAMD(), headerAddEntry(), headerFreeIterator(), headerInitIterator(), headerNew(), headerNextIterator(), RPM_I18NSTRING_TYPE, RPM_STRING_ARRAY_TYPE, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, and RPMTAG_CHANGELOGTIME.

Referenced by headerInject().

static int headerInject ( Header hdrp,
cmd_t cmds[],
int  ncmds 
) [static]

Definition at line 352 of file rpminject.c.

References _, addChangelogEntry(), buildHost(), CA_NEW, cmds, convertAMD(), genChangelog(), getBuildTime(), getTagString(), getUname(), headerAddEntry(), headerCopyTags(), headerCopyWithConvert(), headerFree(), headerIsEntry(), headerSort(), INJ_ADD, INJ_DELETE, INJ_MODIFY, INJ_UNKNOWN, RPM_STRING_ARRAY_TYPE, RPM_STRING_TYPE, RPMTAG_CHANGELOGNAME, RPMTAG_CHANGELOGTEXT, and RPMTAG_CHANGELOGTIME.

Referenced by rewriteRPM().

int main ( int  argc,
char *  argv[] 
)

Definition at line 525 of file rpminject.c.

References _, addMacro(), bindtextdomain, cmds, do_inject(), EXIT_FAILURE, getTagVal(), INJ_ADD, INJ_DELETE, INJ_MODIFY, INJ_UNKNOWN, cmd_s::injmode, injmode, LOCALEDIR, ncmds, cmd_s::nvals, PACKAGE, RMIL_DEFAULT, rpmDisplayQueryTags(), RPMTAG_EXTERNAL_TAG, RPMTAG_FIRSTFREE_TAG, RPMTAG_NAME, setlocale, setprogname, cmd_s::tag, cmd_s::tagval, textdomain, cmd_s::vals, xcalloc(), xrealloc(), and xstrdup().

static const char* pr_injmode ( injmode_t  injmode  )  [static]

Definition at line 32 of file rpminject.c.

References INJ_ADD, INJ_DELETE, INJ_MODIFY, and INJ_UNKNOWN.

Referenced by genChangelog().

static int rewriteRPM ( const char *  fni,
const char *  fno,
cmd_t cmds[],
int  ncmds 
) [static]

Definition at line 440 of file rpminject.c.

References cmds, Spec_s::cookie, cpioSourceArchive_s::cpioArchiveSize, cpioSourceArchive_s::cpioFdIn, cpioSourceArchive_s::cpioList, Fclose(), fdNew, Package_s::header, headerInject(), cpioSourceArchive_s::lead, Spec_s::packages, Spec_s::passPhrase, readRPM(), RPMLEAD_SOURCE, rpmlead::type, and writeRPM().

Referenced by do_inject().


Variable Documentation

cmd_t* cmds[40]

Definition at line 29 of file rpminject.c.

Referenced by convertExistingAMD(), do_inject(), genChangelog(), headerCopyWithConvert(), headerInject(), main(), and rewriteRPM().

const char* hdri18ntbl = "HEADER_I18NTABLE" [static]

Definition at line 44 of file rpminject.c.

Referenced by getTagString(), and getTagVal().

injmode_t injmode = INJ_UNKNOWN

Definition at line 16 of file rpminject.c.

Referenced by main().

int ncmds = 0

Definition at line 30 of file rpminject.c.

Referenced by main().

struct poptOption optionsTable[] [static]

Initial value:

 {
 { "add",       'a', 0, 0, 'a',                 NULL, NULL },
 { "del",       'd', 0, 0, 'd',                 NULL, NULL },
 { "injtags",   'i', 0, 0, 'i',                 NULL, NULL },
 { "modify",    'm', 0, 0, 'm',                 NULL, NULL },
 { "tag",       't', POPT_ARG_STRING, 0, 't',   NULL, NULL },
 { "value",     'v', POPT_ARG_STRING, 0, 'v',   NULL, NULL },
 { NULL,        0, 0, 0, 0,                     NULL, NULL }
}

Definition at line 514 of file rpminject.c.

const char* program_name

Definition at line 2 of file rpminject.c.

struct headerTypeTableEntry rpmTypeTable[] [static]

Referenced by getTypeString().


Generated on Fri Oct 12 08:44:56 2007 for rpm by  doxygen 1.5.2