Use headerNVR throughout.
More const's. CVS patchset: 3216 CVS date: 1999/08/06 22:52:49
This commit is contained in:
parent
0343b15e55
commit
64c9a2d1cf
44
build/pack.c
44
build/pack.c
|
@ -16,24 +16,17 @@ static int addFileToArrayTag(Spec spec, char *file, Header h, int tag);
|
||||||
static int cpio_gzip(FD_t fdo, CSA_t *csa);
|
static int cpio_gzip(FD_t fdo, CSA_t *csa);
|
||||||
static int cpio_copy(FD_t fdo, CSA_t *csa);
|
static int cpio_copy(FD_t fdo, CSA_t *csa);
|
||||||
|
|
||||||
static int genSourceRpmName(Spec spec)
|
static inline int genSourceRpmName(Spec spec)
|
||||||
{
|
{
|
||||||
char *name, *version, *release;
|
if (spec->sourceRpmName == NULL) {
|
||||||
char fileName[BUFSIZ];
|
const char *name, *version, *release;
|
||||||
|
char fileName[BUFSIZ];
|
||||||
|
|
||||||
if (spec->sourceRpmName) {
|
headerNVR(spec->packages->header, &name, &version, &release);
|
||||||
return 0;
|
sprintf(fileName, "%s-%s-%s.%ssrc.rpm", name, version, release,
|
||||||
}
|
|
||||||
|
|
||||||
headerGetEntry(spec->packages->header, RPMTAG_NAME,
|
|
||||||
NULL, (void **)&name, NULL);
|
|
||||||
headerGetEntry(spec->packages->header, RPMTAG_VERSION,
|
|
||||||
NULL, (void **)&version, NULL);
|
|
||||||
headerGetEntry(spec->packages->header, RPMTAG_RELEASE,
|
|
||||||
NULL, (void **)&release, NULL);
|
|
||||||
sprintf(fileName, "%s-%s-%s.%ssrc.rpm", name, version, release,
|
|
||||||
spec->noSource ? "no" : "");
|
spec->noSource ? "no" : "");
|
||||||
spec->sourceRpmName = strdup(fileName);
|
spec->sourceRpmName = strdup(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -217,14 +210,13 @@ int readRPM(const char *fileName, Spec *specp, struct rpmlead *lead, Header *sig
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int writeRPM(Header header, const char *fileName, int type,
|
int writeRPM(Header h, const char *fileName, int type,
|
||||||
CSA_t *csa, char *passPhrase, char **cookie)
|
CSA_t *csa, char *passPhrase, char **cookie)
|
||||||
{
|
{
|
||||||
FD_t fd, ifd;
|
FD_t fd, ifd;
|
||||||
int rc, count, sigtype;
|
int rc, count, sigtype;
|
||||||
int archnum, osnum;
|
int archnum, osnum;
|
||||||
const char *sigtarget;
|
const char *sigtarget;
|
||||||
char *name, *version, *release;
|
|
||||||
char buf[BUFSIZ];
|
char buf[BUFSIZ];
|
||||||
Header sig;
|
Header sig;
|
||||||
struct rpmlead lead;
|
struct rpmlead lead;
|
||||||
|
@ -232,7 +224,7 @@ int writeRPM(Header header, const char *fileName, int type,
|
||||||
if (fdFileno(csa->cpioFdIn) < 0) {
|
if (fdFileno(csa->cpioFdIn) < 0) {
|
||||||
csa->cpioArchiveSize = 0;
|
csa->cpioArchiveSize = 0;
|
||||||
/* Add a bogus archive size to the Header */
|
/* Add a bogus archive size to the Header */
|
||||||
headerAddEntry(header, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
|
headerAddEntry(h, RPMTAG_ARCHIVESIZE, RPM_INT32_TYPE,
|
||||||
&csa->cpioArchiveSize, 1);
|
&csa->cpioArchiveSize, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +232,7 @@ int writeRPM(Header header, const char *fileName, int type,
|
||||||
if (cookie) {
|
if (cookie) {
|
||||||
sprintf(buf, "%s %d", buildHost(), (int) time(NULL));
|
sprintf(buf, "%s %d", buildHost(), (int) time(NULL));
|
||||||
*cookie = strdup(buf);
|
*cookie = strdup(buf);
|
||||||
headerAddEntry(header, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
|
headerAddEntry(h, RPMTAG_COOKIE, RPM_STRING_TYPE, *cookie, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write the header */
|
/* Write the header */
|
||||||
|
@ -248,7 +240,7 @@ int writeRPM(Header header, const char *fileName, int type,
|
||||||
rpmError(RPMERR_CREATE, _("Unable to open temp file"));
|
rpmError(RPMERR_CREATE, _("Unable to open temp file"));
|
||||||
return RPMERR_CREATE;
|
return RPMERR_CREATE;
|
||||||
}
|
}
|
||||||
headerWrite(fd, header, HEADER_MAGIC_YES);
|
headerWrite(fd, h, HEADER_MAGIC_YES);
|
||||||
|
|
||||||
/* Write the archive and get the size */
|
/* Write the archive and get the size */
|
||||||
if (csa->cpioList != NULL) {
|
if (csa->cpioList != NULL) {
|
||||||
|
@ -268,11 +260,11 @@ int writeRPM(Header header, const char *fileName, int type,
|
||||||
|
|
||||||
/* Now set the real archive size in the Header */
|
/* Now set the real archive size in the Header */
|
||||||
if (fdFileno(csa->cpioFdIn) < 0) {
|
if (fdFileno(csa->cpioFdIn) < 0) {
|
||||||
headerModifyEntry(header, RPMTAG_ARCHIVESIZE,
|
headerModifyEntry(h, RPMTAG_ARCHIVESIZE,
|
||||||
RPM_INT32_TYPE, &csa->cpioArchiveSize, 1);
|
RPM_INT32_TYPE, &csa->cpioArchiveSize, 1);
|
||||||
}
|
}
|
||||||
(void)fdLseek(fd, 0, SEEK_SET);
|
(void)fdLseek(fd, 0, SEEK_SET);
|
||||||
headerWrite(fd, header, HEADER_MAGIC_YES);
|
headerWrite(fd, h, HEADER_MAGIC_YES);
|
||||||
|
|
||||||
fdClose(fd);
|
fdClose(fd);
|
||||||
|
|
||||||
|
@ -286,10 +278,10 @@ int writeRPM(Header header, const char *fileName, int type,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now write the lead */
|
/* Now write the lead */
|
||||||
headerGetEntry(header, RPMTAG_NAME, NULL, (void **)&name, NULL);
|
{ const char *name, *version, *release;
|
||||||
headerGetEntry(header, RPMTAG_VERSION, NULL, (void **)&version, NULL);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(header, RPMTAG_RELEASE, NULL, (void **)&release, NULL);
|
sprintf(buf, "%s-%s-%s", name, version, release);
|
||||||
sprintf(buf, "%s-%s-%s", name, version, release);
|
}
|
||||||
|
|
||||||
if (fdFileno(csa->cpioFdIn) < 0) {
|
if (fdFileno(csa->cpioFdIn) < 0) {
|
||||||
rpmGetArchInfo(NULL, &archnum);
|
rpmGetArchInfo(NULL, &archnum);
|
||||||
|
|
|
@ -5,12 +5,15 @@
|
||||||
#include "depends.h"
|
#include "depends.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
static int headerNVR(Header h, const char **np, const char **vp, const char **rp)
|
int headerNVR(Header h, const char **np, const char **vp, const char **rp)
|
||||||
{
|
{
|
||||||
int type, count;
|
int type, count;
|
||||||
headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count);
|
if (np && !headerGetEntry(h, RPMTAG_NAME, &type, (void **) np, &count))
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count);
|
*np = NULL;
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count);
|
if (vp && !headerGetEntry(h, RPMTAG_VERSION, &type, (void **) vp, &count))
|
||||||
|
*vp = NULL;
|
||||||
|
if (rp && !headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) rp, &count))
|
||||||
|
*rp = NULL;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +57,8 @@ static void alFree(struct availableList * al)
|
||||||
if (al->list[i].relocs) {
|
if (al->list[i].relocs) {
|
||||||
r = al->list[i].relocs;
|
r = al->list[i].relocs;
|
||||||
while (r->oldPath || r->newPath) {
|
while (r->oldPath || r->newPath) {
|
||||||
if (r->oldPath) free(r->oldPath);
|
if (r->oldPath) xfree(r->oldPath);
|
||||||
if (r->newPath) free(r->newPath);
|
if (r->newPath) xfree(r->newPath);
|
||||||
r++;
|
r++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,8 +514,7 @@ int headerMatchesDepFlags(Header h, const char *reqName, const char * reqInfo, i
|
||||||
sprintf(buf, "%d", *epochval);
|
sprintf(buf, "%d", *epochval);
|
||||||
epoch = buf;
|
epoch = buf;
|
||||||
}
|
}
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **)&version, &count);
|
headerNVR(h, NULL, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **)&release, &count);
|
|
||||||
|
|
||||||
/* Parse requires version into components */
|
/* Parse requires version into components */
|
||||||
Revr = strdup(reqInfo);
|
Revr = strdup(reqInfo);
|
||||||
|
|
|
@ -636,7 +636,7 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h,
|
||||||
struct sharedFileInfo * sharedList, FD_t scriptFd)
|
struct sharedFileInfo * sharedList, FD_t scriptFd)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
int fileCount, type, count;
|
int fileCount, type, count;
|
||||||
struct fileInfo * files;
|
struct fileInfo * files;
|
||||||
int_32 installTime;
|
int_32 installTime;
|
||||||
|
@ -657,9 +657,7 @@ int installBinaryPackage(const char * rootdir, rpmdb db, FD_t fd, Header h,
|
||||||
if (flags & RPMTRANS_FLAG_JUSTDB)
|
if (flags & RPMTRANS_FLAG_JUSTDB)
|
||||||
flags |= RPMTRANS_FLAG_NOSCRIPTS;
|
flags |= RPMTRANS_FLAG_NOSCRIPTS;
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, &fileCount);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) &version, &fileCount);
|
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &fileCount);
|
|
||||||
|
|
||||||
rpmMessage(RPMMESS_DEBUG, _("package: %s-%s-%s files test = %d\n"),
|
rpmMessage(RPMMESS_DEBUG, _("package: %s-%s-%s files test = %d\n"),
|
||||||
name, version, release, flags & RPMTRANS_FLAG_TEST);
|
name, version, release, flags & RPMTRANS_FLAG_TEST);
|
||||||
|
|
56
lib/lookup.c
56
lib/lookup.c
|
@ -13,8 +13,7 @@ int findMatches(rpmdb db, const char * name, const char * version,
|
||||||
int gotMatches;
|
int gotMatches;
|
||||||
int rc;
|
int rc;
|
||||||
int i;
|
int i;
|
||||||
char * pkgRelease, * pkgVersion;
|
const char * pkgRelease, * pkgVersion;
|
||||||
int count, type;
|
|
||||||
int goodRelease, goodVersion;
|
int goodRelease, goodVersion;
|
||||||
Header h;
|
Header h;
|
||||||
|
|
||||||
|
@ -28,33 +27,30 @@ int findMatches(rpmdb db, const char * name, const char * version,
|
||||||
|
|
||||||
/* make sure the version and releases match */
|
/* make sure the version and releases match */
|
||||||
for (i = 0; i < matches->count; i++) {
|
for (i = 0; i < matches->count; i++) {
|
||||||
if (matches->recs[i].recOffset) {
|
if (matches->recs[i].recOffset == 0)
|
||||||
h = rpmdbGetRecord(db, matches->recs[i].recOffset);
|
continue;
|
||||||
if (h == NULL) {
|
|
||||||
rpmError(RPMERR_DBCORRUPT,
|
|
||||||
_("cannot read header at %d for lookup"),
|
|
||||||
matches->recs[i].recOffset);
|
|
||||||
dbiFreeIndexRecord(*matches);
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) &pkgVersion,
|
h = rpmdbGetRecord(db, matches->recs[i].recOffset);
|
||||||
&count);
|
if (h == NULL) {
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) &pkgRelease,
|
rpmError(RPMERR_DBCORRUPT,_("cannot read header at %d for lookup"),
|
||||||
&count);
|
matches->recs[i].recOffset);
|
||||||
|
dbiFreeIndexRecord(*matches);
|
||||||
goodRelease = goodVersion = 1;
|
return 2;
|
||||||
|
|
||||||
if (release && strcmp(release, pkgRelease)) goodRelease = 0;
|
|
||||||
if (version && strcmp(version, pkgVersion)) goodVersion = 0;
|
|
||||||
|
|
||||||
if (goodRelease && goodVersion)
|
|
||||||
gotMatches = 1;
|
|
||||||
else
|
|
||||||
matches->recs[i].recOffset = 0;
|
|
||||||
|
|
||||||
headerFree(h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
headerNVR(h, NULL, &pkgVersion, &pkgRelease);
|
||||||
|
|
||||||
|
goodRelease = goodVersion = 1;
|
||||||
|
|
||||||
|
if (release && strcmp(release, pkgRelease)) goodRelease = 0;
|
||||||
|
if (version && strcmp(version, pkgVersion)) goodVersion = 0;
|
||||||
|
|
||||||
|
if (goodRelease && goodVersion)
|
||||||
|
gotMatches = 1;
|
||||||
|
else
|
||||||
|
matches->recs[i].recOffset = 0;
|
||||||
|
|
||||||
|
headerFree(h);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gotMatches) {
|
if (!gotMatches) {
|
||||||
|
@ -70,11 +66,9 @@ int findMatches(rpmdb db, const char * name, const char * version,
|
||||||
/* 2 error */
|
/* 2 error */
|
||||||
int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches)
|
int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches)
|
||||||
{
|
{
|
||||||
char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_NAME, NULL, (void **) &name, NULL);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_VERSION, NULL, (void **) &version, NULL);
|
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, NULL, (void **) &release, NULL);
|
|
||||||
|
|
||||||
return findMatches(db, name, version, release, matches);
|
return findMatches(db, name, version, release, matches);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,21 +47,14 @@ void printDepProblems(FILE * fp, struct rpmDependencyConflict * conflicts,
|
||||||
|
|
||||||
char * rpmProblemString(rpmProblem prob)
|
char * rpmProblemString(rpmProblem prob)
|
||||||
{
|
{
|
||||||
char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
|
const char * altName, * altVersion, * altRelease;
|
||||||
char * buf;
|
char * buf;
|
||||||
char * altName, * altVersion, * altRelease;
|
|
||||||
|
|
||||||
headerGetEntry(prob.h, RPMTAG_NAME, NULL, (void **) &name, NULL);
|
headerNVR(prob.h, &name, &version, &release);
|
||||||
headerGetEntry(prob.h, RPMTAG_VERSION, NULL, (void **) &version, NULL);
|
|
||||||
headerGetEntry(prob.h, RPMTAG_RELEASE, NULL, (void **) &release, NULL);
|
|
||||||
|
|
||||||
if (prob.altH) {
|
if (prob.altH)
|
||||||
headerGetEntry(prob.altH, RPMTAG_NAME, NULL, (void **) &altName, NULL);
|
headerNVR(prob.altH, &altName, &altVersion, &altRelease);
|
||||||
headerGetEntry(prob.altH, RPMTAG_VERSION, NULL, (void **) &altVersion,
|
|
||||||
NULL);
|
|
||||||
headerGetEntry(prob.altH, RPMTAG_RELEASE, NULL, (void **) &altRelease,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = malloc(strlen(name) + strlen(version) + strlen(release) + 400);
|
buf = malloc(strlen(name) + strlen(version) + strlen(release) + 400);
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h)
|
||||||
int queryFlags = qva->qva_flags;
|
int queryFlags = qva->qva_flags;
|
||||||
const char *queryFormat = qva->qva_queryFormat;
|
const char *queryFormat = qva->qva_queryFormat;
|
||||||
|
|
||||||
char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
int_32 count, type;
|
int_32 count, type;
|
||||||
char * prefix = NULL;
|
char * prefix = NULL;
|
||||||
char ** fileList, ** fileMD5List;
|
char ** fileList, ** fileMD5List;
|
||||||
|
@ -165,9 +165,7 @@ int showQueryPackage(QVA_t *qva, rpmdb db, Header h)
|
||||||
uint_16 * fileRdevList;
|
uint_16 * fileRdevList;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, &count);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) &version, &count);
|
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &count);
|
|
||||||
|
|
||||||
if (!queryFormat && !queryFlags) {
|
if (!queryFormat && !queryFlags) {
|
||||||
fprintf(fp, "%s-%s-%s\n", name, version, release);
|
fprintf(fp, "%s-%s-%s\n", name, version, release);
|
||||||
|
|
|
@ -262,7 +262,7 @@ int rpmInstall(const char * rootdir, const char ** argv, int transFlags,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defaultReloc) {
|
if (defaultReloc) {
|
||||||
free(defaultReloc->oldPath);
|
xfree(defaultReloc->oldPath);
|
||||||
defaultReloc->oldPath = NULL;
|
defaultReloc->oldPath = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,9 @@ extern "C" {
|
||||||
int rpmReadPackageInfo(FD_t fd, Header * signatures, Header * hdr);
|
int rpmReadPackageInfo(FD_t fd, Header * signatures, Header * hdr);
|
||||||
int rpmReadPackageHeader(FD_t fd, Header * hdr, int * isSource, int * major,
|
int rpmReadPackageHeader(FD_t fd, Header * hdr, int * isSource, int * major,
|
||||||
int * minor);
|
int * minor);
|
||||||
|
|
||||||
|
int headerNVR(Header h, const char **np, const char **vp, const char **rp);
|
||||||
|
|
||||||
/* 0 = success */
|
/* 0 = success */
|
||||||
/* 1 = bad magic */
|
/* 1 = bad magic */
|
||||||
/* 2 = error */
|
/* 2 = error */
|
||||||
|
@ -321,9 +324,9 @@ int rpmdbFindByHeader(rpmdb db, Header h, dbiIndexSet * matches);
|
||||||
|
|
||||||
/* we pass these around as an array with a sentinel */
|
/* we pass these around as an array with a sentinel */
|
||||||
typedef struct rpmRelocation_s {
|
typedef struct rpmRelocation_s {
|
||||||
char * oldPath; /* NULL here evals to RPMTAG_DEFAULTPREFIX, this */
|
const char * oldPath; /* NULL here evals to RPMTAG_DEFAULTPREFIX, */
|
||||||
/* odd behavior is only for backwards compatibility */
|
/* XXX for backwards compatibility */
|
||||||
char * newPath; /* NULL means to omit the file completely! */
|
const char * newPath; /* NULL means to omit the file completely! */
|
||||||
} rpmRelocation;
|
} rpmRelocation;
|
||||||
|
|
||||||
int rpmInstallSourcePackage(const char * root, FD_t fd, const char ** specFile,
|
int rpmInstallSourcePackage(const char * root, FD_t fd, const char ** specFile,
|
||||||
|
|
|
@ -227,13 +227,12 @@ static Header relocateFileList(struct availablePackage * alp,
|
||||||
int allowBadRelocate)
|
int allowBadRelocate)
|
||||||
{
|
{
|
||||||
int numValid, numRelocations;
|
int numValid, numRelocations;
|
||||||
int i, j, madeSwap, rc;
|
int i, j, rc;
|
||||||
rpmRelocation * nextReloc, * relocations = NULL;
|
rpmRelocation * nextReloc, * relocations = NULL;
|
||||||
rpmRelocation * rawRelocations = alp->relocs;
|
rpmRelocation * rawRelocations = alp->relocs;
|
||||||
rpmRelocation tmpReloc;
|
const char ** validRelocations;
|
||||||
char ** validRelocations, ** actualRelocations;
|
const char ** names;
|
||||||
char ** names;
|
const char ** origNames;
|
||||||
char ** origNames;
|
|
||||||
int len = 0;
|
int len = 0;
|
||||||
char * newName;
|
char * newName;
|
||||||
int_32 fileCount;
|
int_32 fileCount;
|
||||||
|
@ -261,16 +260,19 @@ static Header relocateFileList(struct availablePackage * alp,
|
||||||
/* FIXME: default relocations (oldPath == NULL) need to be handled
|
/* FIXME: default relocations (oldPath == NULL) need to be handled
|
||||||
in the UI, not rpmlib */
|
in the UI, not rpmlib */
|
||||||
|
|
||||||
relocations[i].oldPath =
|
{ const char *s = rawRelocations[i].oldPath;
|
||||||
alloca(strlen(rawRelocations[i].oldPath) + 1);
|
char *t = alloca(strlen(s) + 1);
|
||||||
strcpy(relocations[i].oldPath, rawRelocations[i].oldPath);
|
strcpy(t, s);
|
||||||
stripTrailingSlashes(relocations[i].oldPath);
|
stripTrailingSlashes(t);
|
||||||
|
relocations[i].oldPath = t;
|
||||||
|
}
|
||||||
|
|
||||||
if (rawRelocations[i].newPath) {
|
if (rawRelocations[i].newPath) {
|
||||||
relocations[i].newPath =
|
const char *s = rawRelocations[i].newPath;
|
||||||
alloca(strlen(rawRelocations[i].newPath) + 1);
|
char *t = alloca(strlen(s) + 1);
|
||||||
strcpy(relocations[i].newPath, rawRelocations[i].newPath);
|
strcpy(t, s);
|
||||||
stripTrailingSlashes(relocations[i].newPath);
|
stripTrailingSlashes(t);
|
||||||
|
relocations[i].newPath = t;
|
||||||
} else {
|
} else {
|
||||||
relocations[i].newPath = NULL;
|
relocations[i].newPath = NULL;
|
||||||
}
|
}
|
||||||
|
@ -287,8 +289,10 @@ static Header relocateFileList(struct availablePackage * alp,
|
||||||
|
|
||||||
/* stupid bubble sort, but it's probably faster here */
|
/* stupid bubble sort, but it's probably faster here */
|
||||||
for (i = 0; i < numRelocations; i++) {
|
for (i = 0; i < numRelocations; i++) {
|
||||||
|
int madeSwap;
|
||||||
madeSwap = 0;
|
madeSwap = 0;
|
||||||
for (j = 1; j < numRelocations; j++) {
|
for (j = 1; j < numRelocations; j++) {
|
||||||
|
rpmRelocation tmpReloc;
|
||||||
if (strcmp(relocations[j - 1].oldPath,
|
if (strcmp(relocations[j - 1].oldPath,
|
||||||
relocations[j].oldPath) > 0) {
|
relocations[j].oldPath) > 0) {
|
||||||
tmpReloc = relocations[j - 1];
|
tmpReloc = relocations[j - 1];
|
||||||
|
@ -301,6 +305,7 @@ static Header relocateFileList(struct availablePackage * alp,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numValid) {
|
if (numValid) {
|
||||||
|
const char ** actualRelocations;
|
||||||
actualRelocations = malloc(sizeof(*actualRelocations) * numValid);
|
actualRelocations = malloc(sizeof(*actualRelocations) * numValid);
|
||||||
for (i = 0; i < numValid; i++) {
|
for (i = 0; i < numValid; i++) {
|
||||||
for (j = 0; j < numRelocations; j++) {
|
for (j = 0; j < numRelocations; j++) {
|
||||||
|
@ -317,8 +322,8 @@ static Header relocateFileList(struct availablePackage * alp,
|
||||||
headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
|
headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
|
||||||
(void **) actualRelocations, numValid);
|
(void **) actualRelocations, numValid);
|
||||||
|
|
||||||
free(actualRelocations);
|
xfree(actualRelocations);
|
||||||
free(validRelocations);
|
xfree(validRelocations);
|
||||||
}
|
}
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &names,
|
headerGetEntry(h, RPMTAG_FILENAMES, NULL, (void **) &names,
|
||||||
|
|
|
@ -70,13 +70,13 @@ int removeBinaryPackage(char * prefix, rpmdb db, unsigned int offset,
|
||||||
Header h;
|
Header h;
|
||||||
int i;
|
int i;
|
||||||
int fileCount;
|
int fileCount;
|
||||||
char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
char * fnbuffer = NULL;
|
char * fnbuffer = NULL;
|
||||||
dbiIndexSet matches;
|
dbiIndexSet matches;
|
||||||
int fnbuffersize = 0;
|
int fnbuffersize = 0;
|
||||||
int prefixLength = strlen(prefix);
|
int prefixLength = strlen(prefix);
|
||||||
char ** fileList, ** fileMd5List;
|
char ** fileList, ** fileMd5List;
|
||||||
int type, count;
|
int type;
|
||||||
uint_32 * fileFlagsList;
|
uint_32 * fileFlagsList;
|
||||||
int_16 * fileModesList;
|
int_16 * fileModesList;
|
||||||
int scriptArg;
|
int scriptArg;
|
||||||
|
@ -91,9 +91,8 @@ int removeBinaryPackage(char * prefix, rpmdb db, unsigned int offset,
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, &count);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) &version, &count);
|
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &count);
|
|
||||||
/* when we run scripts, we pass an argument which is the number of
|
/* when we run scripts, we pass an argument which is the number of
|
||||||
versions of this package that will be installed when we are finished */
|
versions of this package that will be installed when we are finished */
|
||||||
if (rpmdbFindPackage(db, name, &matches)) {
|
if (rpmdbFindPackage(db, name, &matches)) {
|
||||||
|
|
|
@ -306,7 +306,7 @@ static int verifyDependencies(rpmdb db, Header h) {
|
||||||
struct rpmDependencyConflict * conflicts;
|
struct rpmDependencyConflict * conflicts;
|
||||||
int numConflicts;
|
int numConflicts;
|
||||||
const char * name, * version, * release;
|
const char * name, * version, * release;
|
||||||
int type, count, i;
|
int i;
|
||||||
|
|
||||||
rpmdep = rpmtransCreateSet(db, NULL);
|
rpmdep = rpmtransCreateSet(db, NULL);
|
||||||
rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
|
rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
|
||||||
|
@ -315,9 +315,7 @@ static int verifyDependencies(rpmdb db, Header h) {
|
||||||
rpmtransFree(rpmdep);
|
rpmtransFree(rpmdep);
|
||||||
|
|
||||||
if (numConflicts) {
|
if (numConflicts) {
|
||||||
headerGetEntry(h, RPMTAG_NAME, &type, (void **) &name, &count);
|
headerNVR(h, &name, &version, &release);
|
||||||
headerGetEntry(h, RPMTAG_VERSION, &type, (void **) &version, &count);
|
|
||||||
headerGetEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &count);
|
|
||||||
fprintf(stdout, _("Unsatisfied dependencies for %s-%s-%s: "),
|
fprintf(stdout, _("Unsatisfied dependencies for %s-%s-%s: "),
|
||||||
name, version, release);
|
name, version, release);
|
||||||
for (i = 0; i < numConflicts; i++) {
|
for (i = 0; i < numConflicts; i++) {
|
||||||
|
|
710
po/rpm.pot
710
po/rpm.pot
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue