version 1.19, 1998/01/10 03:52:20
|
version 1.20, 1998/01/30 05:19:53
|
Line 47 static int getTagNumber(char *tag) {
|
Line 47 static int getTagNumber(char *tag) {
|
* rpmAnalyze : analyze an RPM record, read and parse the header and |
* rpmAnalyze : analyze an RPM record, read and parse the header and |
* fill the informations in the database. |
* fill the informations in the database. |
*/ |
*/ |
int rpmAnalyze(char *nameRpm, Header h, rpmDirPtr dir) { |
int rpmAnalyze(char *nameRpm, Header h, rpmDirPtr dir, time_t stamp) { |
int installed = dir->installbase; |
int installed = dir->installbase; |
char * name = NULL, * version = NULL, * release = NULL; |
char * name = NULL, * version = NULL, * release = NULL; |
int_32 count, type; |
int_32 count, type; |
Line 71 int rpmAnalyze(char *nameRpm, Header h,
|
Line 71 int rpmAnalyze(char *nameRpm, Header h,
|
return(-1); |
return(-1); |
} |
} |
rpm->dir = dir; |
rpm->dir = dir; |
|
rpm->stamp = stamp; |
rpm->name = strdup(name); |
rpm->name = strdup(name); |
rpm->version = strdup(version); |
rpm->version = strdup(version); |
rpm->release = strdup(release); |
rpm->release = strdup(release); |
Line 262 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
Line 263 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
Header h = NULL; |
Header h = NULL; |
int isSource; |
int isSource; |
char buffer[500]; |
char buffer[500]; |
|
struct stat buf; |
|
|
/* open the file for reading */ |
/* open the file for reading */ |
sprintf(buffer, "%s/%s", dir->rpmdir, nameRpm); |
sprintf(buffer, "%s/%s", dir->rpmdir, nameRpm); |
Line 271 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
Line 273 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
return(-1); |
return(-1); |
} |
} |
|
|
|
stat(buffer, &buf); |
|
|
/* read the RPM header */ |
/* read the RPM header */ |
rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL); |
rc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL); |
switch (rc) { |
switch (rc) { |
Line 294 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
Line 298 int rpmOpen(char *nameRpm, rpmDirPtr dir
|
return(-1); |
return(-1); |
} |
} |
|
|
n = rpmAnalyze(nameRpm, h, dir); |
n = rpmAnalyze(nameRpm, h, dir, buf.st_mtime); |
|
|
/* free the header and close the descriptor */ |
/* free the header and close the descriptor */ |
headerFree(h); |
headerFree(h); |
Line 349 static int rpmBaseScan(rpmDirPtr dir) {
|
Line 353 static int rpmBaseScan(rpmDirPtr dir) {
|
fprintf(stderr, "could not read database record!\n"); |
fprintf(stderr, "could not read database record!\n"); |
return(n); |
return(n); |
} |
} |
rpmAnalyze(NULL, h, dir); |
rpmAnalyze(NULL, h, dir, 0); |
headerFree(h); |
headerFree(h); |
offset = rpmdbNextRecNum(db, offset); |
offset = rpmdbNextRecNum(db, offset); |
} |
} |