Main Page Modules Data Structures File List Data Fields Globals Related Pages

# rpmdb/legacy.c File Reference

More...

`#include "system.h"`
`#include "rpmio_internal.h"`
`#include <rpmlib.h>`
`#include <rpmmacro.h>`
`#include "misc.h"`
`#include "legacy.h"`
`#include "debug.h"`

Go to the source code of this file.

## Defines
#define | alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
## Functions
int | open_dso (const char *path, pid_t *pidp, size_t *fsizep)
| Open a file descriptor to verify file MD5 and size. More...
int | domd5 (const char *fn, unsigned char *digest, int asAscii, size_t *fsizep)
| Return MD5 sum and size of a file. More...
int | dncmp (const void *a, const void *b)
void | compressFilelist (Header h)
| Convert absolute path tag to (dirname,basename,dirindex) tags. More...
void | doBuildFileList (Header h, const char ***fileListPtr, int *fileCountPtr, rpmTag baseNameTag, rpmTag dirNameTag, rpmTag dirIndexesTag)
void | expandFilelist (Header h)
| Convert (dirname,basename,dirindex) tags to absolute path tag. More...
void | rpmBuildFileList (Header h, const char ***fileListPtr, int *fileCountPtr)
void | buildOrigFileList (Header h, const char ***fileListPtr, int *fileCountPtr)
void | providePackageNVR (Header h)
| Retrofit a Provides: name = version-release dependency into legacy packages. More...
void | legacyRetrofit (Header h, const struct rpmlead *lead)
| Do all necessary retorfits for a package header. More...
## Variables
int | _noDirTokens = 0

## Detailed Description

Definition in file legacy.c.

## Define Documentation

#define alloca_strdup | ( | _s |  | ) | strcpy(alloca(strlen(_s)+1), (_s))

| Definition at line 30 of file legacy.c.

## Function Documentation

void buildOrigFileList | ( | Header | h,
|  | const char *** | fileListPtr,
|  | int * | fileCountPtr
| ) |

  | Parameters:
  h | header
  Return values:
  fileListPtr | list of files
  fileCountPtr | number of files
Definition at line 438 of file legacy.c. References doBuildFileList, RPMTAG_ORIGBASENAMES, RPMTAG_ORIGDIRINDEXES, and RPMTAG_ORIGDIRNAMES.

void compressFilelist | ( | Header | h | ) |

  | Convert absolute path tag to (dirname,basename,dirindex) tags. Parameters:
  h | header
Definition at line 259 of file legacy.c. References alloca, dncmp, HAE_t, headerIsEntry, HFD_t, HGE_t, HRE_t, int_32, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, RPMTAG_OLDFILENAMES, and rpmTagType.

int dncmp | ( | const void * | a,
|  | const void * | b
| ) | `[static]`

| Definition at line 249 of file legacy.c. Referenced by compressFilelist.

void doBuildFileList | ( | Header | h,
|  | const char *** | fileListPtr,
|  | int * | fileCountPtr,
|  | rpmTag | baseNameTag,
|  | rpmTag | dirNameTag,
|  | rpmTag | dirIndexesTag
| ) | `[static]`

| Definition at line 355 of file legacy.c. References _free, HFD_t, HGE_t, rpmTag, rpmTagType, stpcpy, and xmalloc. Referenced by buildOrigFileList, expandFilelist, and rpmBuildFileList.

int domd5 | ( | const char * | fn,
|  | unsigned char * | digest,
|  | int | asAscii,
|  | size_t * | fsizep
| ) |

  | Return MD5 sum and size of a file. Parameters:
  fn | file name
  Return values:
  digest | address of md5sum
  Parameters:
  asAscii | return md5sum as ascii string?
  Return values:
  fsizep | file size pointer (or NULL)
Returns: 0 on success, 1 on error Definition at line 148 of file legacy.c. References _free, Fclose, fdDup, fdFiniDigest, fdInitDigest, Ferror, Fopen, Fread, open_dso, PGPHASHALGO_MD5, RPMDIGEST_NONE, rpmDigestFinal, rpmDigestInit, rpmDigestUpdate, URL_IS_DASH, URL_IS_FTP, URL_IS_HTTP, URL_IS_PATH, URL_IS_UNKNOWN, urlPath, and urltype.

void expandFilelist | ( | Header | h | ) |

  | Convert (dirname,basename,dirindex) tags to absolute path tag. Parameters:
  h | header
Definition at line 406 of file legacy.c. References _free, doBuildFileList, HAE_t, headerIsEntry, HRE_t, RPM_STRING_ARRAY_TYPE, RPMTAG_BASENAMES, RPMTAG_DIRINDEXES, RPMTAG_DIRNAMES, and RPMTAG_OLDFILENAMES.

void legacyRetrofit | ( | Header | h,
|  | const struct rpmlead * | lead
| ) |

  | Do all necessary retorfits for a package header. Parameters:
  h | header
  lead |
Definition at line 529 of file legacy.c. References alloca_strdup, compressFilelist, headerAddEntry, headerGetEntry, headerIsEntry, headerRemoveEntry, int_32, providePackageNVR, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMLEAD_SOURCE, RPMTAG_DEFAULTPREFIX, RPMTAG_FILEGIDS, RPMTAG_FILEGROUPNAME, RPMTAG_FILEUIDS, RPMTAG_FILEUSERNAME, RPMTAG_PREFIXES, RPMTAG_SOURCEPACKAGE, and stripTrailingChar.

int open_dso | ( | const char * | path,
|  | pid_t * | pidp,
|  | size_t * | fsizep
| ) | `[static]`

  | Open a file descriptor to verify file MD5 and size. Parameters:
  path | file path
  Return values:
  pidp | prelink helper pid or 0
  fsizep | file size
Returns: -1 on error, otherwise, an open file descriptor Definition at line 39 of file legacy.c. References environ, poptParseArgvString, rpmExpand, and unsetenv. Referenced by domd5.

void providePackageNVR | ( | Header | h | ) |

  | Retrofit a Provides: name = version-release dependency into legacy packages. Parameters:
  h | header
Definition at line 448 of file legacy.c. References alloca, headerAddOrAppendEntry, headerNVR, HFD_t, HGE_t, int_32, RPM_INT32_TYPE, RPM_STRING_ARRAY_TYPE, RPMSENSE_ANY, RPMSENSE_EQUAL, RPMTAG_EPOCH, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEVERSION, rpmTagType, and stpcpy.

## Variable Documentation

int _noDirTokens = 0

| Definition at line 245 of file legacy.c.