- remove support for v1 src rpm's.
- reposition callbacks with ts/fi in cpio payload layer. CVS patchset: 4498 CVS date: 2001/01/25 20:26:35
This commit is contained in:
parent
5ae2e10e9e
commit
dd94329f0c
2
CHANGES
2
CHANGES
|
@ -1,6 +1,8 @@
|
|||
4.0.2 -> 4.0.3
|
||||
- cpio mappings carry dirname/basename, not absolute path.
|
||||
- fix: check waitpid return code.
|
||||
- remove support for v1 src rpm's
|
||||
- reposition callbacks with ts/fi in cpio payload layer.
|
||||
|
||||
4.0 -> 4.0.[12]
|
||||
- add doxygen and lclint annotations most everywhere.
|
||||
|
|
|
@ -34,9 +34,13 @@ static inline int genSourceRpmName(Spec spec)
|
|||
}
|
||||
|
||||
/**
|
||||
* @todo Create transaction set *much* earlier.
|
||||
*/
|
||||
static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro)
|
||||
{
|
||||
const char * rootDir = "/";
|
||||
rpmdb rpmdb = NULL;
|
||||
rpmTransactionSet ts = rpmtransCreateSet(rpmdb, rootDir);
|
||||
const char *fmode = rpmExpand(fmodeMacro, NULL);
|
||||
const char *failedFile = NULL;
|
||||
FD_t cfd;
|
||||
|
@ -46,7 +50,7 @@ static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro)
|
|||
fmode = xstrdup("w9.gzdio");
|
||||
(void) Fflush(fdo);
|
||||
cfd = Fdopen(fdDup(Fileno(fdo)), fmode);
|
||||
rc = cpioBuildArchive(cfd, csa->cpioList, NULL, NULL,
|
||||
rc = cpioBuildArchive(ts, csa->cpioList, cfd,
|
||||
&csa->cpioArchiveSize, &failedFile);
|
||||
if (rc) {
|
||||
rpmError(RPMERR_CPIO, _("create archive failed on file %s: %s\n"),
|
||||
|
@ -58,6 +62,7 @@ static int cpio_doio(FD_t fdo, Header h, CSA_t * csa, const char * fmodeMacro)
|
|||
if (failedFile)
|
||||
free((void *)failedFile);
|
||||
free((void *)fmode);
|
||||
rpmtransFree(ts);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
278
lib/cpio.c
278
lib/cpio.c
|
@ -83,7 +83,9 @@ struct cpioCrcPhysicalHeader {
|
|||
* File name and stat information.
|
||||
*/
|
||||
struct cpioHeader {
|
||||
/*@owned@*/ const char * path;
|
||||
/*@owned@*/ const char * path;
|
||||
FD_t cfd;
|
||||
void * mapi;
|
||||
struct stat sb;
|
||||
};
|
||||
|
||||
|
@ -149,6 +151,7 @@ static const char * mapMd5sum(const void * this) {
|
|||
/**
|
||||
*/
|
||||
struct mapi {
|
||||
rpmTransactionSet ts;
|
||||
TFI_t fi;
|
||||
int i;
|
||||
struct cpioFileMapping map;
|
||||
|
@ -171,21 +174,48 @@ static void mapFree(const void * this) {
|
|||
|
||||
/**
|
||||
*/
|
||||
static void mapFreeIterator(/*@only@*/ const void * this) {
|
||||
if (this)
|
||||
free((void *)this);
|
||||
static void mapFreeIterator(/*@only@*/ const void * this)
|
||||
{
|
||||
struct mapi * mapi;
|
||||
rpmTransactionSet ts;
|
||||
TFI_t fi;
|
||||
|
||||
if (this == NULL)
|
||||
return;
|
||||
|
||||
mapi = (void *)this;
|
||||
ts = mapi->ts;
|
||||
fi = mapi->fi;
|
||||
|
||||
if (ts && ts->notify) {
|
||||
unsigned int archiveSize = (fi->archiveSize ? fi->archiveSize : 100);
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
|
||||
archiveSize, archiveSize,
|
||||
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
|
||||
}
|
||||
free((void *)this);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static void * mapInitIterator(const void * this) {
|
||||
static void * mapInitIterator(const void * this, const void * that)
|
||||
{
|
||||
struct mapi * mapi;
|
||||
rpmTransactionSet ts = (void *)this;
|
||||
TFI_t fi = (void *)that;
|
||||
|
||||
if (this == NULL)
|
||||
if (fi == NULL)
|
||||
return NULL;
|
||||
mapi = xcalloc(sizeof(*mapi), 1);
|
||||
mapi->fi = (void *)this;
|
||||
mapi->ts = ts;
|
||||
mapi->fi = fi;
|
||||
mapi->i = 0;
|
||||
|
||||
if (ts && ts->notify) {
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, fi->archiveSize,
|
||||
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
|
||||
}
|
||||
|
||||
return mapi;
|
||||
}
|
||||
|
||||
|
@ -247,6 +277,25 @@ static const void * mapFind(void * this, const char * hdrPath) {
|
|||
return mapNextIterator(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static void hdrCallback(const struct cpioHeader * hdr)
|
||||
{
|
||||
struct mapi * mapi = hdr->mapi;
|
||||
rpmTransactionSet ts;
|
||||
TFI_t fi;
|
||||
|
||||
if (mapi == NULL)
|
||||
return;
|
||||
ts = mapi->ts;
|
||||
fi = mapi->fi;
|
||||
|
||||
if (ts && ts->notify)
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
|
||||
fdGetCpioPos(hdr->cfd), fi->archiveSize,
|
||||
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data from payload.
|
||||
* @param cfd payload file handle
|
||||
|
@ -391,12 +440,11 @@ static int strntoul(const char *str, /*@out@*/char **endptr, int base, int num)
|
|||
|
||||
/**
|
||||
* Process next cpio heasder.
|
||||
* @param cfd payload file handle
|
||||
* @retval hdr file name and stat info
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int getNextHeader(FD_t cfd, struct cpioHeader * hdr)
|
||||
/*@modifies cfd, hdr->path, hdr->sb @*/
|
||||
static int getNextHeader(struct cpioHeader * hdr)
|
||||
/*@modifies hdr->cfd, hdr->path, hdr->sb @*/
|
||||
{
|
||||
struct cpioCrcPhysicalHeader physHeader;
|
||||
struct stat * st = &hdr->sb;
|
||||
|
@ -404,7 +452,7 @@ static int getNextHeader(FD_t cfd, struct cpioHeader * hdr)
|
|||
char * end;
|
||||
int major, minor;
|
||||
|
||||
if (ourread(cfd, &physHeader, PHYS_HDR_SIZE) != PHYS_HDR_SIZE)
|
||||
if (ourread(hdr->cfd, &physHeader, PHYS_HDR_SIZE) != PHYS_HDR_SIZE)
|
||||
return CPIOERR_READ_FAILED;
|
||||
|
||||
if (strncmp(CPIO_CRC_MAGIC, physHeader.magic, sizeof(CPIO_CRC_MAGIC)-1) &&
|
||||
|
@ -430,7 +478,7 @@ static int getNextHeader(FD_t cfd, struct cpioHeader * hdr)
|
|||
GET_NUM_FIELD(physHeader.namesize, nameSize);
|
||||
|
||||
{ char * t = xmalloc(nameSize + 1);
|
||||
if (ourread(cfd, t, nameSize) != nameSize) {
|
||||
if (ourread(hdr->cfd, t, nameSize) != nameSize) {
|
||||
free(t);
|
||||
hdr->path = NULL;
|
||||
return CPIOERR_BAD_HEADER;
|
||||
|
@ -440,7 +488,7 @@ static int getNextHeader(FD_t cfd, struct cpioHeader * hdr)
|
|||
|
||||
/* this is unecessary hdr->path[nameSize] = '\0'; */
|
||||
|
||||
padinfd(cfd, 4);
|
||||
padinfd(hdr->cfd, 4);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -476,7 +524,7 @@ static int createDirectory(const char * path, mode_t perms)
|
|||
if (mkdir(path, 000))
|
||||
return CPIOERR_MKDIR_FAILED;
|
||||
|
||||
if (chmod(path, perms))
|
||||
if (perms != 000 && chmod(path, perms))
|
||||
return CPIOERR_CHMOD_FAILED;
|
||||
|
||||
return 0;
|
||||
|
@ -487,12 +535,12 @@ static int createDirectory(const char * path, mode_t perms)
|
|||
* @param hdr file name and stat info
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int setInfo(struct cpioHeader * hdr)
|
||||
static int setInfo(const struct cpioHeader * hdr)
|
||||
/*@modifies fileSystem @*/
|
||||
{
|
||||
int rc = 0;
|
||||
struct utimbuf stamp;
|
||||
struct stat * st = &hdr->sb;
|
||||
const struct stat * st = &hdr->sb;
|
||||
|
||||
stamp.actime = st->st_mtime;
|
||||
stamp.modtime = st->st_mtime;
|
||||
|
@ -570,13 +618,10 @@ static int inline checkDirectory(const char * filename) /*@*/
|
|||
* @param cfd payload file handle
|
||||
* @param hdr file name and stat info
|
||||
* @param filemd5 file md5 sum
|
||||
* @param cb callback function
|
||||
* @param cbData callback private data
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int expandRegular(FD_t cfd, const struct cpioHeader * hdr,
|
||||
const char * filemd5, cpioCallback cb, void * cbData)
|
||||
/*@modifies fileSystem, cfd @*/
|
||||
static int expandRegular(const struct cpioHeader * hdr, const char * filemd5)
|
||||
/*@modifies fileSystem, hdr->cfd @*/
|
||||
{
|
||||
FD_t ofd;
|
||||
char buf[BUFSIZ];
|
||||
|
@ -584,7 +629,6 @@ static int expandRegular(FD_t cfd, const struct cpioHeader * hdr,
|
|||
const struct stat * st = &hdr->sb;
|
||||
int left = st->st_size;
|
||||
int rc = 0;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct stat sb;
|
||||
|
||||
/* Rename the old file before attempting unlink to avoid EBUSY errors */
|
||||
|
@ -614,11 +658,8 @@ static int expandRegular(FD_t cfd, const struct cpioHeader * hdr,
|
|||
if (filemd5)
|
||||
fdInitMD5(ofd, 0);
|
||||
|
||||
cbInfo.file = hdr->path;
|
||||
cbInfo.fileSize = st->st_size;
|
||||
|
||||
while (left) {
|
||||
bytesRead = ourread(cfd, buf, left < sizeof(buf) ? left : sizeof(buf));
|
||||
bytesRead = ourread(hdr->cfd, buf, left < sizeof(buf) ? left : sizeof(buf));
|
||||
if (bytesRead <= 0) {
|
||||
rc = CPIOERR_READ_FAILED;
|
||||
break;
|
||||
|
@ -632,11 +673,8 @@ static int expandRegular(FD_t cfd, const struct cpioHeader * hdr,
|
|||
left -= bytesRead;
|
||||
|
||||
/* don't call this with fileSize == fileComplete */
|
||||
if (!rc && cb && left) {
|
||||
cbInfo.fileComplete = st->st_size - left;
|
||||
cbInfo.bytesProcessed = fdGetCpioPos(cfd);
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
if (!rc && left)
|
||||
hdrCallback(hdr);
|
||||
}
|
||||
|
||||
if (filemd5) {
|
||||
|
@ -661,12 +699,11 @@ static int expandRegular(FD_t cfd, const struct cpioHeader * hdr,
|
|||
|
||||
/**
|
||||
* Create symlink from payload stream.
|
||||
* @param cfd payload file handle
|
||||
* @param hdr file name and stat info
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int expandSymlink(FD_t cfd, const struct cpioHeader * hdr)
|
||||
/*@modifies fileSystem, cfd @*/
|
||||
static int expandSymlink(const struct cpioHeader * hdr)
|
||||
/*@modifies fileSystem, hdr->cfd @*/
|
||||
{
|
||||
char buf[2048], buf2[2048];
|
||||
struct stat sb;
|
||||
|
@ -676,7 +713,7 @@ static int expandSymlink(FD_t cfd, const struct cpioHeader * hdr)
|
|||
if ((st->st_size + 1)> sizeof(buf))
|
||||
return CPIOERR_HDR_SIZE;
|
||||
|
||||
if (ourread(cfd, buf, st->st_size) != st->st_size)
|
||||
if (ourread(hdr->cfd, buf, st->st_size) != st->st_size)
|
||||
return CPIOERR_READ_FAILED;
|
||||
|
||||
buf[st->st_size] = '\0';
|
||||
|
@ -706,7 +743,7 @@ static int expandSymlink(FD_t cfd, const struct cpioHeader * hdr)
|
|||
* @param hdr file name and stat info
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int expandFifo( /*@unused@*/ FD_t cfd, const struct cpioHeader * hdr)
|
||||
static int expandFifo(const struct cpioHeader * hdr)
|
||||
/*@modifies fileSystem @*/
|
||||
{
|
||||
struct stat sb;
|
||||
|
@ -730,7 +767,7 @@ static int expandFifo( /*@unused@*/ FD_t cfd, const struct cpioHeader * hdr)
|
|||
* @param hdr file name and stat info
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int expandDevice( /*@unused@*/ FD_t cfd, const struct cpioHeader * hdr)
|
||||
static int expandDevice(const struct cpioHeader * hdr)
|
||||
/*@modifies fileSystem @*/
|
||||
{
|
||||
const struct stat * st = &hdr->sb;
|
||||
|
@ -872,13 +909,11 @@ static int eatBytes(FD_t cfd, int amount)
|
|||
}
|
||||
|
||||
/** @todo Verify payload MD5 sum. */
|
||||
int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
||||
const char ** failedFile)
|
||||
int cpioInstallArchive(const rpmTransactionSet ts, const TFI_t fi, FD_t cfd,
|
||||
const char ** failedFile)
|
||||
{
|
||||
struct cpioHeader ch, *hdr = &ch;
|
||||
void * mapi = mapInitIterator(fi);
|
||||
const void * map = NULL;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct hardLink * links = NULL;
|
||||
struct hardLink * li = NULL;
|
||||
int rc = 0;
|
||||
|
@ -889,12 +924,14 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
fdInitMD5(cfd, 0);
|
||||
#endif
|
||||
|
||||
fdSetCpioPos(cfd, 0);
|
||||
memset(hdr, 0, sizeof(*hdr));
|
||||
hdr->path = NULL;
|
||||
hdr->mapi = mapInitIterator(ts, fi);
|
||||
hdr->cfd = fdLink(cfd, "persist (cpioInstallArchive");
|
||||
fdSetCpioPos(hdr->cfd, 0);
|
||||
if (failedFile)
|
||||
*failedFile = NULL;
|
||||
|
||||
memset(hdr, 0, sizeof(*hdr));
|
||||
hdr->path = NULL;
|
||||
do {
|
||||
struct stat * st;
|
||||
|
||||
|
@ -902,7 +939,7 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
free((void *)hdr->path);
|
||||
hdr->path = NULL;
|
||||
}
|
||||
if ((rc = getNextHeader(cfd, hdr))) {
|
||||
if ((rc = getNextHeader(hdr))) {
|
||||
#if 0 /* XXX this is the failure point for an unreadable rpm */
|
||||
rpmError(RPMERR_BADPACKAGE, _("getNextHeader: %s\n"),
|
||||
cpioStrerror(rc));
|
||||
|
@ -914,11 +951,11 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
if (!strcmp(hdr->path, TRAILER))
|
||||
break;
|
||||
|
||||
if (mapi)
|
||||
map = mapFind(mapi, hdr->path);
|
||||
if (hdr->mapi)
|
||||
map = mapFind(hdr->mapi, hdr->path);
|
||||
|
||||
if (mapi && map == NULL) {
|
||||
eatBytes(cfd, st->st_size);
|
||||
if (hdr->mapi && map == NULL) {
|
||||
eatBytes(hdr->cfd, st->st_size);
|
||||
} else {
|
||||
if (map) {
|
||||
if (mapFlags(map, CPIO_MAP_PATH)) {
|
||||
|
@ -934,9 +971,10 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
st->st_gid = mapFinalGid(map);
|
||||
}
|
||||
|
||||
/* This won't get hard linked symlinks right, but I can't seem
|
||||
to create those anyway */
|
||||
|
||||
/*
|
||||
* This won't get hard linked symlinks right, but I can't seem
|
||||
* to create those anyway.
|
||||
*/
|
||||
if (S_ISREG(st->st_mode) && st->st_nlink > 1) {
|
||||
for (li = links; li; li = li->next) {
|
||||
if (li->inode == st->st_ino && li->dev == st->st_dev) break;
|
||||
|
@ -949,39 +987,38 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
}
|
||||
|
||||
li->files[li->linksLeft++] = xstrdup(hdr->path);
|
||||
}
|
||||
|
||||
if ((st->st_nlink > 1) && S_ISREG(st->st_mode) && !st->st_size &&
|
||||
li->createdPath == -1) {
|
||||
/* defer file creation */
|
||||
} else if ((st->st_nlink > 1) && S_ISREG(st->st_mode) &&
|
||||
(li->createdPath != -1)) {
|
||||
createLinks(li, failedFile);
|
||||
/* XXX FIXME 0 length hard linked files are broke. */
|
||||
if (st->st_size && li->createdPath == -1) {
|
||||
createLinks(li, failedFile);
|
||||
|
||||
/*
|
||||
* This only happens for cpio archives which contain
|
||||
* hardlinks w/ the contents of each hardlink being
|
||||
* listed (intead of the data being given just once. This
|
||||
* shouldn't happen, but I've made it happen w/ buggy
|
||||
* code, so what the heck? GNU cpio handles this well fwiw.
|
||||
*/
|
||||
eatBytes(hdr->cfd, st->st_size);
|
||||
}
|
||||
|
||||
/* this only happens for cpio archives which contain
|
||||
hardlinks w/ the contents of each hardlink being
|
||||
listed (intead of the data being given just once. This
|
||||
shouldn't happen, but I've made it happen w/ buggy
|
||||
code, so what the heck? GNU cpio handles this well fwiw */
|
||||
if (st->st_size) eatBytes(cfd, st->st_size);
|
||||
} else {
|
||||
rc = checkDirectory(hdr->path);
|
||||
|
||||
if (!rc) {
|
||||
if (S_ISREG(st->st_mode))
|
||||
rc = expandRegular(cfd, hdr, mapMd5sum(map),
|
||||
cb, cbData);
|
||||
rc = expandRegular(hdr, mapMd5sum(map));
|
||||
else if (S_ISDIR(st->st_mode))
|
||||
rc = createDirectory(hdr->path, 000);
|
||||
else if (S_ISLNK(st->st_mode))
|
||||
rc = expandSymlink(cfd, hdr);
|
||||
rc = expandSymlink(hdr);
|
||||
else if (S_ISFIFO(st->st_mode))
|
||||
rc = expandFifo(cfd, hdr);
|
||||
rc = expandFifo(hdr);
|
||||
else if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode))
|
||||
rc = expandDevice(cfd, hdr);
|
||||
rc = expandDevice(hdr);
|
||||
else if (S_ISSOCK(st->st_mode)) {
|
||||
/* this mimicks cpio but probably isnt' right */
|
||||
rc = expandFifo(cfd, hdr);
|
||||
/* this mimics cpio but probably isnt' right */
|
||||
rc = expandFifo(hdr);
|
||||
} else {
|
||||
rc = CPIOERR_UNKNOWN_FILETYPE;
|
||||
}
|
||||
|
@ -1006,15 +1043,10 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
}
|
||||
}
|
||||
|
||||
padinfd(cfd, 4);
|
||||
padinfd(hdr->cfd, 4);
|
||||
|
||||
if (!rc && cb) {
|
||||
cbInfo.file = hdr->path;
|
||||
cbInfo.fileSize = st->st_size;
|
||||
cbInfo.fileComplete = st->st_size;
|
||||
cbInfo.bytesProcessed = fdGetCpioPos(cfd);
|
||||
cb(&cbInfo, cbData);
|
||||
}
|
||||
if (!rc)
|
||||
hdrCallback(hdr);
|
||||
|
||||
} while (rc == 0);
|
||||
|
||||
|
@ -1039,7 +1071,7 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
}
|
||||
|
||||
#ifdef NOTYET
|
||||
fdFiniMD5(cfd, (void **)&md5sum, NULL, 1);
|
||||
fdFiniMD5(hdr->cfd, (void **)&md5sum, NULL, 1);
|
||||
|
||||
if (md5sum)
|
||||
free(md5sum);
|
||||
|
@ -1047,13 +1079,17 @@ int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
rc = 0;
|
||||
|
||||
exit:
|
||||
if (mapi)
|
||||
mapFreeIterator(mapi);
|
||||
fdFree(hdr->cfd, "persist (cpioInstallArchive");
|
||||
hdr->cfd = NULL;
|
||||
if (hdr->mapi)
|
||||
mapFreeIterator(hdr->mapi);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write next item to payload stream.
|
||||
* @param ts transaction set
|
||||
* @param fi transaction element file info
|
||||
* @param cfd payload file handle
|
||||
* @param st stat info for item
|
||||
* @param map mapping name and flags for item
|
||||
|
@ -1061,8 +1097,8 @@ exit:
|
|||
* @param writeData should data be written?
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int writeFile(FD_t cfd, const struct stat * st,
|
||||
const void * map, /*@out@*/ size_t * sizep,
|
||||
static int writeFile(const rpmTransactionSet ts, TFI_t fi, FD_t cfd,
|
||||
const struct stat * st, const void * map, /*@out@*/ size_t * sizep,
|
||||
int writeData)
|
||||
/*@modifies cfd, *sizep @*/
|
||||
{
|
||||
|
@ -1205,6 +1241,12 @@ static int writeFile(FD_t cfd, const struct stat * st,
|
|||
|
||||
if (sizep)
|
||||
*sizep = size;
|
||||
|
||||
if (ts && fi && ts->notify) {
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, size, size,
|
||||
(fi->ap ? fi->ap->key : NULL), ts->notifyData);
|
||||
}
|
||||
|
||||
rc = 0;
|
||||
|
||||
exit:
|
||||
|
@ -1214,21 +1256,19 @@ exit:
|
|||
|
||||
/**
|
||||
* Write set of linked files to payload stream.
|
||||
* @param ts transaction set
|
||||
* @param fi transaction element file info
|
||||
* @param cfd payload file handle
|
||||
* @param hlink set of linked files
|
||||
* @param cb callback function
|
||||
* @param cbData callback private data
|
||||
* @retval sizep address of no. bytes written
|
||||
* @retval failedFile on error, file name that failed
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int writeLinkedFile(FD_t cfd, const struct hardLink * hlink,
|
||||
cpioCallback cb, void * cbData,
|
||||
/*@out@*/size_t * sizep,
|
||||
/*@out@*/const char ** failedFile)
|
||||
static int writeLinkedFile(const rpmTransactionSet ts, TFI_t fi, FD_t cfd,
|
||||
const struct hardLink * hlink, /*@out@*/size_t * sizep,
|
||||
/*@out@*/const char ** failedFile)
|
||||
/*@modifies cfd, *sizep, *failedFile @*/
|
||||
{
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
const void * map = NULL;
|
||||
size_t total = 0;
|
||||
size_t size;
|
||||
|
@ -1237,7 +1277,7 @@ static int writeLinkedFile(FD_t cfd, const struct hardLink * hlink,
|
|||
|
||||
for (i = hlink->nlink - 1; i > hlink->linksLeft; i--) {
|
||||
map = hlink->fileMaps[i];
|
||||
if ((rc = writeFile(cfd, &hlink->sb, map, &size, 0)) != 0) {
|
||||
if ((rc = writeFile(ts, fi, cfd, &hlink->sb, map, &size, 0)) != 0) {
|
||||
if (failedFile)
|
||||
*failedFile = mapFsPath(map);
|
||||
goto exit;
|
||||
|
@ -1245,17 +1285,12 @@ static int writeLinkedFile(FD_t cfd, const struct hardLink * hlink,
|
|||
|
||||
total += size;
|
||||
|
||||
if (cb) {
|
||||
cbInfo.file = mapArchivePath(map);
|
||||
cb(&cbInfo, cbData);
|
||||
free((void *)cbInfo.file);
|
||||
}
|
||||
mapFree(map); map = NULL;
|
||||
}
|
||||
|
||||
i = hlink->linksLeft;
|
||||
map = hlink->fileMaps[i];
|
||||
if ((rc = writeFile(cfd, &hlink->sb, map, &size, 1))) {
|
||||
if ((rc = writeFile(ts, fi, cfd, &hlink->sb, map, &size, 1))) {
|
||||
if (sizep)
|
||||
*sizep = total;
|
||||
if (failedFile)
|
||||
|
@ -1267,11 +1302,6 @@ static int writeLinkedFile(FD_t cfd, const struct hardLink * hlink,
|
|||
if (sizep)
|
||||
*sizep = total;
|
||||
|
||||
if (cb) {
|
||||
cbInfo.file = mapArchivePath(map);
|
||||
cb(&cbInfo, cbData);
|
||||
free((void *)cbInfo.file);
|
||||
}
|
||||
rc = 0;
|
||||
|
||||
exit:
|
||||
|
@ -1280,13 +1310,11 @@ exit:
|
|||
return rc;
|
||||
}
|
||||
|
||||
int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
||||
unsigned int * archiveSize, const char ** failedFile)
|
||||
int cpioBuildArchive(const rpmTransactionSet ts, const TFI_t fi, FD_t cfd,
|
||||
unsigned int * archiveSize, const char ** failedFile)
|
||||
{
|
||||
void * mapi = mapInitIterator(fi);
|
||||
void * mapi = mapInitIterator(ts, fi);
|
||||
const void * map;
|
||||
struct cpioCallbackInfo cbInfo = { NULL, 0, 0, 0 };
|
||||
struct cpioCrcPhysicalHeader hdr;
|
||||
/*@-fullinitblock@*/
|
||||
struct hardLink hlinkList = { NULL };
|
||||
/*@=fullinitblock@*/
|
||||
|
@ -1329,7 +1357,7 @@ int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
|
||||
if (hlink->linksLeft == 0) {
|
||||
struct hardLink * prev;
|
||||
rc = writeLinkedFile(cfd, hlink, cb, cbData, &size, failedFile);
|
||||
rc = writeLinkedFile(ts, fi, cfd, hlink, &size, failedFile);
|
||||
if (rc) {
|
||||
free((void *)fsPath);
|
||||
return rc;
|
||||
|
@ -1349,18 +1377,12 @@ int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
} while ((prev = prev->next) != NULL);
|
||||
}
|
||||
} else {
|
||||
if ((rc = writeFile(cfd, st, map, &size, 1))) {
|
||||
if ((rc = writeFile(ts, fi, cfd, st, map, &size, 1))) {
|
||||
if (failedFile)
|
||||
*failedFile = fsPath;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (cb) {
|
||||
cbInfo.file = mapArchivePath(map);
|
||||
cb(&cbInfo, cbData);
|
||||
free((void *)cbInfo.file);
|
||||
}
|
||||
|
||||
totalsize += size;
|
||||
}
|
||||
free((void *)fsPath);
|
||||
|
@ -1374,7 +1396,7 @@ int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
hlink->next = NULL;
|
||||
|
||||
if (rc == 0) {
|
||||
rc = writeLinkedFile(cfd, hlink, cb, cbData, &size, failedFile);
|
||||
rc = writeLinkedFile(ts, fi, cfd, hlink, &size, failedFile);
|
||||
totalsize += size;
|
||||
}
|
||||
freeHardLink(hlink);
|
||||
|
@ -1382,15 +1404,17 @@ int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
|||
if (rc)
|
||||
return rc;
|
||||
|
||||
memset(&hdr, '0', PHYS_HDR_SIZE);
|
||||
memcpy(hdr.magic, CPIO_NEWC_MAGIC, sizeof(hdr.magic));
|
||||
memcpy(hdr.nlink, "00000001", 8);
|
||||
memcpy(hdr.namesize, "0000000b", 8);
|
||||
if ((rc = safewrite(cfd, &hdr, PHYS_HDR_SIZE)) != PHYS_HDR_SIZE)
|
||||
return rc;
|
||||
if ((rc = safewrite(cfd, "TRAILER!!!", 11)) != 11)
|
||||
return rc;
|
||||
totalsize += PHYS_HDR_SIZE + 11;
|
||||
{ struct cpioCrcPhysicalHeader hdr;
|
||||
memset(&hdr, '0', PHYS_HDR_SIZE);
|
||||
memcpy(hdr.magic, CPIO_NEWC_MAGIC, sizeof(hdr.magic));
|
||||
memcpy(hdr.nlink, "00000001", 8);
|
||||
memcpy(hdr.namesize, "0000000b", 8);
|
||||
if ((rc = safewrite(cfd, &hdr, PHYS_HDR_SIZE)) != PHYS_HDR_SIZE)
|
||||
return rc;
|
||||
if ((rc = safewrite(cfd, "TRAILER!!!", 11)) != 11)
|
||||
return rc;
|
||||
totalsize += PHYS_HDR_SIZE + 11;
|
||||
}
|
||||
|
||||
/* GNU cpio pads to 512 bytes here, but we don't. I'm not sure if
|
||||
it matters or not */
|
||||
|
|
39
lib/cpio.h
39
lib/cpio.h
|
@ -67,10 +67,10 @@ typedef enum cpioMapFlags_e {
|
|||
* @note When building the cpio payload, only "file" is filled in.
|
||||
*/
|
||||
struct cpioCallbackInfo {
|
||||
/*@dependent@*/ const char * file; /*!< File name being installed. */
|
||||
long fileSize; /*!< Total file size. */
|
||||
long fileComplete; /*!< Amount of file unpacked. */
|
||||
long bytesProcessed; /*!< No. bytes in archive read. */
|
||||
/*@owned@*/ const char * file; /*!< File name being installed. */
|
||||
long fileSize; /*!< Total file size. */
|
||||
long fileComplete; /*!< Amount of file unpacked. */
|
||||
long bytesProcessed; /*!< No. bytes in archive read. */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -85,36 +85,33 @@ typedef void (*cpioCallback) (struct cpioCallbackInfo * filespec, void * data);
|
|||
* The RPM internal equivalent of the command line "cpio -i".
|
||||
*
|
||||
* If no mappings are passed, this installs everything! If one is passed
|
||||
* it should be sorted according to cpioFileMapCmp() and only files included
|
||||
* in the map are installed. Files are installed relative to the current
|
||||
* directory unless a mapping is given which specifies an absolute
|
||||
* directory. The mode mapping is only used for the permission bits, not
|
||||
* for the file type. The owner/group mappings are ignored for the nonroot
|
||||
* user.
|
||||
* it should be sorted, and only files included in the map are installed.
|
||||
* Files are installed relative to the current directory unless a mapping
|
||||
* is given which specifies an absolute directory. The mode mapping is only
|
||||
* used for the permission bits, not for the file type. The owner/group
|
||||
* mappings are ignored for the non-root user.
|
||||
*
|
||||
* @param cfd file handle
|
||||
* @param ts transaction set
|
||||
* @param fi transaction element file info
|
||||
* @param cb progress callback
|
||||
* @param cbData progress callback data
|
||||
* @retval failedFile file name (malloc'ed) that caused failure (if any)
|
||||
* @param cfd file handle
|
||||
* @retval failedFile (malloc'd) file name that caused failure (if any)
|
||||
* @return 0 on success
|
||||
*/
|
||||
int cpioInstallArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
||||
int cpioInstallArchive(const rpmTransactionSet ts, const TFI_t fi, FD_t cfd,
|
||||
/*@out@*/const char ** failedFile)
|
||||
/*@modifies fileSystem, cfd, *failedFile @*/;
|
||||
|
||||
/** \ingroup payload
|
||||
* The RPM internal equivalent of the command line "cpio -o".
|
||||
*
|
||||
* @param cfd file handle
|
||||
* @param ts transaction set
|
||||
* @param fi transaction element file info
|
||||
* @param cb progress callback
|
||||
* @param cbData progress callback data
|
||||
* @retval failedFile file name (malloc'ed) that caused failure (if any)
|
||||
* @param cfd file handle
|
||||
* @retval failedFile (malloc'd) file name that caused failure (if any)
|
||||
* @return 0 on success
|
||||
*/
|
||||
int cpioBuildArchive(FD_t cfd, const TFI_t fi, cpioCallback cb, void * cbData,
|
||||
unsigned int * archiveSize, /*@out@*/const char ** failedFile)
|
||||
int cpioBuildArchive(const rpmTransactionSet ts, const TFI_t fi, FD_t cfd,
|
||||
unsigned int * archiveSize, /*@out@*/ const char ** failedFile)
|
||||
/*@modifies fileSystem, cfd, *archiveSize, *failedFile @*/;
|
||||
|
||||
/** \ingroup payload
|
||||
|
|
186
lib/install.c
186
lib/install.c
|
@ -14,21 +14,9 @@
|
|||
|
||||
/*@access Header@*/ /* XXX compared with NULL */
|
||||
|
||||
/**
|
||||
* Private data for cpio callback.
|
||||
*/
|
||||
typedef struct callbackInfo_s {
|
||||
unsigned long archiveSize;
|
||||
rpmCallbackFunction notify;
|
||||
const char ** specFilePtr;
|
||||
Header h;
|
||||
rpmCallbackData notifyData;
|
||||
const void * pkgKey;
|
||||
} * cbInfo;
|
||||
|
||||
/* XXX add more tags */
|
||||
/**
|
||||
* Macros to be defined from per-header tag values.
|
||||
* @todo Should other macros be added from header when installing a package?
|
||||
*/
|
||||
static struct tagMacro {
|
||||
const char * macroname; /*!< Macro name to define. */
|
||||
|
@ -400,24 +388,6 @@ static int markReplacedFiles(const rpmTransactionSet ts, const TFI_t fi)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
static void callback(struct cpioCallbackInfo * cpioInfo, void * data)
|
||||
{
|
||||
cbInfo cbi = data;
|
||||
|
||||
if (cbi->notify)
|
||||
(void)cbi->notify(cbi->h, RPMCALLBACK_INST_PROGRESS,
|
||||
cpioInfo->bytesProcessed,
|
||||
cbi->archiveSize, cbi->pkgKey, cbi->notifyData);
|
||||
|
||||
if (cbi->specFilePtr) {
|
||||
const char * t = cpioInfo->file + strlen(cpioInfo->file) - 5;
|
||||
if (!strcmp(t, ".spec"))
|
||||
*cbi->specFilePtr = xstrdup(cpioInfo->file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup payload map and install payload archive.
|
||||
*
|
||||
|
@ -425,18 +395,13 @@ static void callback(struct cpioCallbackInfo * cpioInfo, void * data)
|
|||
*
|
||||
* @param ts transaction set
|
||||
* @param fi transaction element file info (NULL means all files)
|
||||
* @retval specFile address of spec file name
|
||||
* @param archiveSize @todo Document.
|
||||
* @param allFiles install all files?
|
||||
* @return 0 on success
|
||||
*/
|
||||
static int installArchive(const rpmTransactionSet ts, TFI_t fi,
|
||||
/*@out@*/ const char ** specFile, int archiveSize,
|
||||
int allFiles)
|
||||
static int installArchive(const rpmTransactionSet ts, TFI_t fi, int allFiles)
|
||||
{
|
||||
struct availablePackage * alp = fi->ap;
|
||||
const char * failedFile = NULL;
|
||||
cbInfo cbi = alloca(sizeof(*cbi));
|
||||
char * rpmio_flags;
|
||||
int saveerrno;
|
||||
int rc;
|
||||
|
@ -448,18 +413,11 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
|
|||
return 0;
|
||||
}
|
||||
|
||||
cbi->archiveSize = archiveSize; /* arg9 */
|
||||
cbi->notify = ts->notify; /* arg4 */
|
||||
cbi->notifyData = ts->notifyData; /* arg5 */
|
||||
cbi->specFilePtr = specFile; /* arg8 */
|
||||
cbi->h = headerLink(fi->h); /* arg7 */
|
||||
cbi->pkgKey = alp->key; /* arg6 */
|
||||
|
||||
if (specFile) *specFile = NULL;
|
||||
|
||||
if (ts->notify)
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS, 0, archiveSize,
|
||||
alp->key, ts->notifyData);
|
||||
{ uint_32 * asp;
|
||||
rc = headerGetEntry(fi->h, RPMTAG_ARCHIVESIZE, NULL,
|
||||
(void **) &asp, NULL);
|
||||
fi->archiveSize = (rc ? *asp : 0);
|
||||
}
|
||||
|
||||
/* Retrieve type of payload compression. */
|
||||
{ const char * payload_compressor = NULL;
|
||||
|
@ -479,13 +437,10 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
|
|||
{ FD_t cfd;
|
||||
(void) Fflush(alp->fd);
|
||||
cfd = Fdopen(fdDup(Fileno(alp->fd)), rpmio_flags);
|
||||
rc = cpioInstallArchive(cfd, fi,
|
||||
((ts->notify && archiveSize) || specFile) ? callback : NULL,
|
||||
cbi, &failedFile);
|
||||
rc = cpioInstallArchive(ts, fi, cfd, &failedFile);
|
||||
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
|
||||
Fclose(cfd);
|
||||
}
|
||||
headerFree(cbi->h);
|
||||
|
||||
if (rc) {
|
||||
/*
|
||||
|
@ -498,12 +453,6 @@ static int installArchive(const rpmTransactionSet ts, TFI_t fi,
|
|||
(failedFile != NULL ? failedFile : ""),
|
||||
cpioStrerror(rc));
|
||||
rc = 1;
|
||||
} else if (ts->notify) {
|
||||
if (archiveSize == 0)
|
||||
archiveSize = 100;
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_PROGRESS,
|
||||
archiveSize, archiveSize, alp->key, ts->notifyData);
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
if (failedFile)
|
||||
|
@ -558,8 +507,6 @@ static int installSources(const rpmTransactionSet ts, TFI_t fi,
|
|||
const char * _sourcedir = rpmGenPath(ts->rootDir, "%{_sourcedir}", "");
|
||||
const char * _specdir = rpmGenPath(ts->rootDir, "%{_specdir}", "");
|
||||
const char * specFile = NULL;
|
||||
int specFileIndex = -1;
|
||||
uint_32 * archiveSizePtr = NULL;
|
||||
int rc = 0;
|
||||
int i;
|
||||
|
||||
|
@ -591,90 +538,47 @@ static int installSources(const rpmTransactionSet ts, TFI_t fi,
|
|||
}
|
||||
}
|
||||
|
||||
/* Build dnl/dil with {_sourcedir, _specdir} as values. */
|
||||
if (i < fi->fc) {
|
||||
char *t = xmalloc(strlen(_specdir) + strlen(fi->apath[i]) + 5);
|
||||
(void)stpcpy(stpcpy(t, _specdir), "/");
|
||||
fi->dnl[fi->dil[i]] = t;
|
||||
fi->bnl[i] = xstrdup(fi->apath[i]);
|
||||
specFileIndex = i;
|
||||
int speclen = strlen(_specdir) + 2;
|
||||
int sourcelen = strlen(_sourcedir) + 2;
|
||||
char * t;
|
||||
|
||||
if (fi->dnl) {
|
||||
free((void *)fi->dnl); fi->dnl = NULL;
|
||||
}
|
||||
|
||||
fi->dc = 2;
|
||||
fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl) + fi->fc * sizeof(*fi->dil) +
|
||||
speclen + sourcelen);
|
||||
fi->dil = (int *)(fi->dnl + fi->dc);
|
||||
memset(fi->dil, 0, fi->fc * sizeof(*fi->dil));
|
||||
fi->dil[i] = 1;
|
||||
fi->dnl[0] = t = (char *)(fi->dil + fi->fc);
|
||||
fi->dnl[1] = t = stpcpy( stpcpy(t, _sourcedir), "/") + 1;
|
||||
(void) stpcpy( stpcpy(t, _specdir), "/");
|
||||
|
||||
t = xmalloc(speclen + strlen(fi->bnl[i]) + 1);
|
||||
(void) stpcpy( stpcpy( stpcpy(t, _specdir), "/"), fi->bnl[i]);
|
||||
specFile = t;
|
||||
} else {
|
||||
rpmError(RPMERR_NOSPEC, _("source package contains no .spec file\n"));
|
||||
rc = 2;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (ts->notify)
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, 0,
|
||||
NULL, ts->notifyData);
|
||||
rc = installArchive(ts, fi, 1);
|
||||
|
||||
if (!headerGetEntry(fi->h, RPMTAG_ARCHIVESIZE, NULL,
|
||||
(void **) &archiveSizePtr, NULL))
|
||||
archiveSizePtr = NULL;
|
||||
|
||||
{ const char * currDir = currentDirectory();
|
||||
Chdir(_sourcedir);
|
||||
rc = installArchive(ts, fi,
|
||||
specFileIndex >= 0 ? NULL : &specFile,
|
||||
archiveSizePtr ? *archiveSizePtr : 0,
|
||||
1);
|
||||
|
||||
Chdir(currDir);
|
||||
free((void *)currDir);
|
||||
if (rc) {
|
||||
rc = 2;
|
||||
goto exit;
|
||||
}
|
||||
if (rc) {
|
||||
rc = 2;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (specFileIndex == -1) {
|
||||
char * cSpecFile;
|
||||
char * iSpecFile;
|
||||
|
||||
if (specFile == NULL) {
|
||||
rpmError(RPMERR_NOSPEC,
|
||||
_("source package contains no .spec file\n"));
|
||||
rc = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/*
|
||||
* This logic doesn't work if _specdir and _sourcedir are on
|
||||
* different filesystems, but we only do this on v1 source packages
|
||||
* so I don't really care much.
|
||||
*/
|
||||
iSpecFile = alloca(strlen(_sourcedir) + strlen(specFile) + 2);
|
||||
(void)stpcpy(stpcpy(stpcpy(iSpecFile, _sourcedir), "/"), specFile);
|
||||
|
||||
cSpecFile = alloca(strlen(_specdir) + strlen(specFile) + 2);
|
||||
(void)stpcpy(stpcpy(stpcpy(cSpecFile, _specdir), "/"), specFile);
|
||||
|
||||
free((void *)specFile);
|
||||
|
||||
if (strcmp(iSpecFile, cSpecFile)) {
|
||||
rpmMessage(RPMMESS_DEBUG,
|
||||
_("renaming %s to %s\n"), iSpecFile, cSpecFile);
|
||||
if ((rc = Rename(iSpecFile, cSpecFile))) {
|
||||
rpmError(RPMERR_RENAME, _("rename of %s to %s failed: %s\n"),
|
||||
iSpecFile, cSpecFile, strerror(errno));
|
||||
rc = 2;
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
if (specFilePtr)
|
||||
*specFilePtr = xstrdup(cSpecFile);
|
||||
} else {
|
||||
if (specFilePtr) {
|
||||
const char * dn = fi->dnl[fi->dil[specFileIndex]];
|
||||
const char * bn = fi->bnl[specFileIndex];
|
||||
char * t = xmalloc(strlen(dn) + strlen(bn) + 1);
|
||||
(void)stpcpy( stpcpy(t, dn), bn);
|
||||
*specFilePtr = t;
|
||||
}
|
||||
}
|
||||
rc = 0;
|
||||
|
||||
exit:
|
||||
if (rc == 0 && specFile && specFilePtr)
|
||||
*specFilePtr = specFile;
|
||||
else
|
||||
free((void *)specFile);
|
||||
if (_specdir) free((void *)_specdir);
|
||||
if (_sourcedir) free((void *)_sourcedir);
|
||||
return rc;
|
||||
|
@ -904,7 +808,6 @@ static int installActions(const rpmTransactionSet ts, TFI_t fi)
|
|||
int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi)
|
||||
{
|
||||
static char * stepName = "install";
|
||||
struct availablePackage * alp = fi->ap;
|
||||
Header oldH = NULL;
|
||||
int otherOffset = 0;
|
||||
int ec = 2; /* assume error return */
|
||||
|
@ -1007,9 +910,7 @@ int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi)
|
|||
ts->chrootDone = 1;
|
||||
}
|
||||
|
||||
|
||||
if (fi->fc > 0 && !(ts->transFlags & RPMTRANS_FLAG_JUSTDB)) {
|
||||
uint_32 archiveSize, * asp;
|
||||
|
||||
setFileOwners(fi);
|
||||
|
||||
|
@ -1017,17 +918,8 @@ int installBinaryPackage(const rpmTransactionSet ts, TFI_t fi)
|
|||
if (rc)
|
||||
goto exit;
|
||||
|
||||
rc = headerGetEntry(fi->h, RPMTAG_ARCHIVESIZE, NULL,
|
||||
(void **) &asp, NULL);
|
||||
archiveSize = (rc ? *asp : 0);
|
||||
rc = installArchive(ts, fi, 0);
|
||||
|
||||
if (ts->notify)
|
||||
(void)ts->notify(fi->h, RPMCALLBACK_INST_START, 0, 0,
|
||||
alp->key, ts->notifyData);
|
||||
|
||||
rc = installArchive(ts, fi, NULL, archiveSize, 0);
|
||||
|
||||
/* XXX WTFO? RPMCALLBACK_INST_STOP event? */
|
||||
if (rc)
|
||||
goto exit;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ enum fileTypes {
|
|||
SOCK = 12, /*!< socket */
|
||||
};
|
||||
|
||||
/*@abstract@*/ typedef struct transactionFileInfo_s * TFI_t;
|
||||
typedef /*@abstract@*/ struct transactionFileInfo_s * TFI_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -55,6 +55,7 @@ struct transactionFileInfo_s {
|
|||
uid_t * fuids;
|
||||
gid_t * fgids;
|
||||
int * fmapflags;
|
||||
unsigned int archiveSize;
|
||||
int magic;
|
||||
#define TFIMAGIC 0x09697923
|
||||
/* these are for TR_ADDED packages */
|
||||
|
|
|
@ -692,7 +692,8 @@ Header XrpmdbNextIterator(rpmdbMatchIterator mi, const char * f, unsigned int l)
|
|||
* @param h header
|
||||
* @return 0 on success
|
||||
*/
|
||||
int rpmdbAdd(rpmdb rpmdb, int iid, Header h); /*@modifies h @*/
|
||||
int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
|
||||
/*@modifies h @*/;
|
||||
|
||||
/** \ingroup rpmdb
|
||||
* Remove package header from rpm database and indices.
|
||||
|
|
161
po/rpm.pot
161
po/rpm.pot
|
@ -6,7 +6,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2001-01-24 22:29-0500\n"
|
||||
"POT-Creation-Date: 2001-01-25 15:24-0500\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -1472,7 +1472,7 @@ msgstr ""
|
|||
msgid "no tar files given for build"
|
||||
msgstr ""
|
||||
|
||||
#: build/build.c:114 build/pack.c:372
|
||||
#: build/build.c:114 build/pack.c:377
|
||||
msgid "Unable to open temp file.\n"
|
||||
msgstr ""
|
||||
|
||||
|
@ -1662,7 +1662,7 @@ msgstr ""
|
|||
msgid "Could not open %%files file %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/files.c:1461 build/pack.c:108
|
||||
#: build/files.c:1461 build/pack.c:113
|
||||
#, c-format
|
||||
msgid "line: %s\n"
|
||||
msgstr ""
|
||||
|
@ -1729,126 +1729,126 @@ msgstr ""
|
|||
msgid "Could not canonicalize hostname: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:52
|
||||
#: build/pack.c:56
|
||||
#, c-format
|
||||
msgid "create archive failed on file %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:74
|
||||
#: build/pack.c:79
|
||||
#, c-format
|
||||
msgid "cpio_copy write failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:81
|
||||
#: build/pack.c:86
|
||||
#, c-format
|
||||
msgid "cpio_copy read failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:165
|
||||
#: build/pack.c:170
|
||||
#, c-format
|
||||
msgid "Could not open PreIn file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:172
|
||||
#: build/pack.c:177
|
||||
#, c-format
|
||||
msgid "Could not open PreUn file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:179
|
||||
#: build/pack.c:184
|
||||
#, c-format
|
||||
msgid "Could not open PostIn file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:186
|
||||
#: build/pack.c:191
|
||||
#, c-format
|
||||
msgid "Could not open PostUn file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:194
|
||||
#: build/pack.c:199
|
||||
#, c-format
|
||||
msgid "Could not open VerifyScript file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:209
|
||||
#: build/pack.c:214
|
||||
#, c-format
|
||||
msgid "Could not open Trigger script file: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:235
|
||||
#: build/pack.c:240
|
||||
#, c-format
|
||||
msgid "readRPM: open %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:245
|
||||
#: build/pack.c:250
|
||||
#, c-format
|
||||
msgid "readRPM: read %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:266
|
||||
#: build/pack.c:271
|
||||
#, c-format
|
||||
msgid "readRPM: %s is not an RPM package\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:272
|
||||
#: build/pack.c:277
|
||||
#, c-format
|
||||
msgid "readRPM: reading header from %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:384
|
||||
#: build/pack.c:389
|
||||
msgid "Bad CSA data\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:425
|
||||
#: build/pack.c:430
|
||||
#, c-format
|
||||
msgid "Generating signature: %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:435
|
||||
#: build/pack.c:440
|
||||
#, c-format
|
||||
msgid "Could not open %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:472
|
||||
#: build/pack.c:477
|
||||
#, c-format
|
||||
msgid "Unable to write package: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:487
|
||||
#: build/pack.c:492
|
||||
#, c-format
|
||||
msgid "Unable to open sigtarget %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:497
|
||||
#: build/pack.c:502
|
||||
#, c-format
|
||||
msgid "Unable to read header from %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:511
|
||||
#: build/pack.c:516
|
||||
#, c-format
|
||||
msgid "Unable to write header to %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:521
|
||||
#: build/pack.c:526
|
||||
#, c-format
|
||||
msgid "Unable to read payload from %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:527
|
||||
#: build/pack.c:532
|
||||
#, c-format
|
||||
msgid "Unable to write payload to %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:554
|
||||
#: build/pack.c:559
|
||||
#, c-format
|
||||
msgid "Wrote: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:619
|
||||
#: build/pack.c:624
|
||||
#, c-format
|
||||
msgid "Could not generate output filename for package %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: build/pack.c:636
|
||||
#: build/pack.c:641
|
||||
#, c-format
|
||||
msgid "cannot create %s: %s\n"
|
||||
msgstr ""
|
||||
|
@ -2185,55 +2185,55 @@ msgstr ""
|
|||
msgid "line %d: Bad %s number: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:595
|
||||
#: lib/cpio.c:639
|
||||
#, c-format
|
||||
msgid "can't rename %s to %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:601
|
||||
#: lib/cpio.c:645
|
||||
#, c-format
|
||||
msgid "can't unlink %s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:907
|
||||
#: lib/cpio.c:944
|
||||
#, c-format
|
||||
msgid "getNextHeader: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1416
|
||||
#: lib/cpio.c:1440
|
||||
#, c-format
|
||||
msgid "(error 0x%x)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1419
|
||||
#: lib/cpio.c:1443
|
||||
msgid "Bad magic"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1420
|
||||
#: lib/cpio.c:1444
|
||||
msgid "Bad/unreadable header"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1438
|
||||
#: lib/cpio.c:1462
|
||||
msgid "Header size too big"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1439
|
||||
#: lib/cpio.c:1463
|
||||
msgid "Unknown file type"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1440
|
||||
#: lib/cpio.c:1464
|
||||
msgid "Missing hard link"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1441
|
||||
#: lib/cpio.c:1465
|
||||
msgid "MD5 sum mismatch"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1442
|
||||
#: lib/cpio.c:1466
|
||||
msgid "Internal error"
|
||||
msgstr ""
|
||||
|
||||
#: lib/cpio.c:1451
|
||||
#: lib/cpio.c:1475
|
||||
msgid " failed - "
|
||||
msgstr ""
|
||||
|
||||
|
@ -2250,92 +2250,92 @@ msgstr ""
|
|||
msgid " %s A %s\tB %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:956
|
||||
#: lib/depends.c:951
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (added files)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1015
|
||||
#: lib/depends.c:1010
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (added provide)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1067
|
||||
#: lib/depends.c:1062
|
||||
#, c-format
|
||||
msgid "%s: %-45s %-3s (cached)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1086
|
||||
#: lib/depends.c:1081
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (rpmrc provides)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1103
|
||||
#: lib/depends.c:1098
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (rpmlib provides)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1125
|
||||
#: lib/depends.c:1120
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (db files)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1138
|
||||
#: lib/depends.c:1133
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (db provides)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1152
|
||||
#: lib/depends.c:1147
|
||||
#, c-format
|
||||
msgid "%s: %-45s YES (db package)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1168
|
||||
#: lib/depends.c:1163
|
||||
#, c-format
|
||||
msgid "%s: %-45s NO\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1189
|
||||
#: lib/depends.c:1184
|
||||
#, c-format
|
||||
msgid "%s: (%s, %s) added to Depends cache.\n"
|
||||
msgstr ""
|
||||
|
||||
#. requirements are not satisfied.
|
||||
#: lib/depends.c:1247
|
||||
#: lib/depends.c:1242
|
||||
#, c-format
|
||||
msgid "package %s-%s-%s require not satisfied: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#. conflicts exist.
|
||||
#: lib/depends.c:1314
|
||||
#: lib/depends.c:1309
|
||||
#, c-format
|
||||
msgid "package %s conflicts: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1530
|
||||
#: lib/depends.c:1525
|
||||
#, c-format
|
||||
msgid "removing %s-%s-%s \"%s\" from tsort relations.\n"
|
||||
msgstr ""
|
||||
|
||||
#. Record all relations.
|
||||
#: lib/depends.c:1669
|
||||
#: lib/depends.c:1664
|
||||
msgid "========== recording tsort relations\n"
|
||||
msgstr ""
|
||||
|
||||
#. T4. Scan for zeroes.
|
||||
#: lib/depends.c:1716
|
||||
#: lib/depends.c:1711
|
||||
msgid "========== tsorting packages\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1761
|
||||
#: lib/depends.c:1756
|
||||
msgid "========== successors only (presentation order)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1810
|
||||
#: lib/depends.c:1805
|
||||
msgid "LOOP:\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/depends.c:1841
|
||||
#: lib/depends.c:1836
|
||||
msgid "========== continuing tsort ...\n"
|
||||
msgstr ""
|
||||
|
||||
|
@ -2512,7 +2512,7 @@ msgstr ""
|
|||
msgid "dataLength() RPM_STRING_TYPE count must be 1.\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/header.c:207 lib/header.c:1015 lib/install.c:239
|
||||
#: lib/header.c:207 lib/header.c:1015 lib/install.c:227
|
||||
#, c-format
|
||||
msgid "Data type %d not supported\n"
|
||||
msgstr ""
|
||||
|
@ -2597,12 +2597,12 @@ msgstr ""
|
|||
msgid "(unknown type)"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:90
|
||||
#: lib/install.c:78
|
||||
#, c-format
|
||||
msgid "user %s does not exist - using root\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:98
|
||||
#: lib/install.c:86
|
||||
#, c-format
|
||||
msgid "group %s does not exist - using root\n"
|
||||
msgstr ""
|
||||
|
@ -2612,79 +2612,68 @@ msgstr ""
|
|||
#. * was used up - if so, we should return a different error.
|
||||
#.
|
||||
#. XXX FIXME: Fclose with libio destroys errno
|
||||
#: lib/install.c:496
|
||||
#: lib/install.c:451
|
||||
#, c-format
|
||||
msgid "unpacking of archive failed%s%s: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:497
|
||||
#: lib/install.c:452
|
||||
msgid " on file "
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:537
|
||||
#: lib/install.c:486
|
||||
#, c-format
|
||||
msgid "cannot create %s %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:543
|
||||
#: lib/install.c:492
|
||||
#, c-format
|
||||
msgid "cannot write to %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:566
|
||||
#: lib/install.c:513
|
||||
msgid "installing a source package\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:601 lib/install.c:635
|
||||
#: lib/install.c:565
|
||||
msgid "source package contains no .spec file\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:655
|
||||
#, c-format
|
||||
msgid "renaming %s to %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:657
|
||||
#, c-format
|
||||
msgid "rename of %s to %s failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:759
|
||||
#: lib/install.c:663
|
||||
msgid "source package expected, binary found\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:837
|
||||
#: lib/install.c:741
|
||||
#, c-format
|
||||
msgid " file: %s%s action: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:866
|
||||
#: lib/install.c:770
|
||||
#, c-format
|
||||
msgid "%s%s created as %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:887 lib/uninstall.c:71
|
||||
#: lib/install.c:791 lib/uninstall.c:71
|
||||
#, c-format
|
||||
msgid "%s saved as %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:892 lib/uninstall.c:74
|
||||
#: lib/install.c:796 lib/uninstall.c:74
|
||||
#, c-format
|
||||
msgid "%s rename of %s to %s failed: %s\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:913 lib/uninstall.c:125
|
||||
#: lib/install.c:816 lib/uninstall.c:125
|
||||
#, c-format
|
||||
msgid "%s: %s-%s-%s has %d files, test = %d\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:980 lib/install.c:1079 lib/uninstall.c:163
|
||||
#: lib/uninstall.c:184
|
||||
#: lib/install.c:883 lib/install.c:971 lib/uninstall.c:163 lib/uninstall.c:184
|
||||
#, c-format
|
||||
msgid "%s: running %s script(s) (if any)\n"
|
||||
msgstr ""
|
||||
|
||||
#: lib/install.c:987
|
||||
#: lib/install.c:890
|
||||
msgid "skipping %s-%s-%s install, %%pre scriptlet failed rc %d\n"
|
||||
msgstr ""
|
||||
|
||||
|
|
Loading…
Reference in New Issue