Runtime fixes after rpm 4 migration
This commit is contained in:
parent
2bca22fae3
commit
b14c9271cf
@ -44,7 +44,7 @@ target_link_libraries(distromatic
|
|||||||
${LIBIBERTY}
|
${LIBIBERTY}
|
||||||
)
|
)
|
||||||
target_include_directories(distromatic PUBLIC ${RPM_INCLUDE_DIRS})
|
target_include_directories(distromatic PUBLIC ${RPM_INCLUDE_DIRS})
|
||||||
target_compile_options(distromatic PUBLIC ${RPM_CFLAGS_OTHER})
|
target_compile_options(distromatic PUBLIC -g -Wall -std=gnu11 -pedantic ${RPM_CFLAGS_OTHER})
|
||||||
|
|
||||||
add_executable(distroquery
|
add_executable(distroquery
|
||||||
distroquery.c
|
distroquery.c
|
||||||
|
@ -28,12 +28,10 @@
|
|||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BUILDTOOLS_H
|
#include <linux/limits.h>
|
||||||
# include "buildtools.h"
|
|
||||||
#endif
|
#include "distromatic.h"
|
||||||
#ifndef DISTROMATIC_H
|
#include "buildtools.h"
|
||||||
# include "distromatic.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
generateBuildInfo(struct configTag *configtag, int arch)
|
generateBuildInfo(struct configTag *configtag, int arch)
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "distromatic.h"
|
#include "distromatic.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "changelog.h"
|
#include "changelog.h"
|
||||||
@ -137,6 +139,7 @@ getPackageChangelog(Header h, struct headerSourceList* headersource)
|
|||||||
if (oldchangelog) {
|
if (oldchangelog) {
|
||||||
oldchangelog->next = newchangelog;
|
oldchangelog->next = newchangelog;
|
||||||
}
|
}
|
||||||
|
|
||||||
newchangelog->time = changelogtime[i];
|
newchangelog->time = changelogtime[i];
|
||||||
|
|
||||||
strncpy(changelogname, changelogrelease[i], 255);
|
strncpy(changelogname, changelogrelease[i], 255);
|
||||||
|
@ -405,7 +405,7 @@ void logmsg(int level, const char *msg, ...) {
|
|||||||
for (i = 0; i < 20; i++) {
|
for (i = 0; i < 20; i++) {
|
||||||
/* only log the same message once */
|
/* only log the same message once */
|
||||||
if (!strncmp(newmsg,(char*)&(oldmsg[i]),256)) return;
|
if (!strncmp(newmsg,(char*)&(oldmsg[i]),256)) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LOG_MARK:
|
case LOG_MARK:
|
||||||
|
@ -216,29 +216,28 @@ getPackageInfoIntoHeaderSourceList(Header h, struct headerSourceList *hl)
|
|||||||
hl->arch = headerGetStringEntry(h, RPMTAG_ARCH);
|
hl->arch = headerGetStringEntry(h, RPMTAG_ARCH);
|
||||||
hl->buildarchs = headerGetStringEntry(h, RPMTAG_BUILDARCHS);
|
hl->buildarchs = headerGetStringEntry(h, RPMTAG_BUILDARCHS);
|
||||||
hl->excludearch = headerGetStringEntry(h, RPMTAG_EXCLUDEARCH);
|
hl->excludearch = headerGetStringEntry(h, RPMTAG_EXCLUDEARCH);
|
||||||
if (hl->buildarchs) printf("buildarchs: %s %s\n",hl->name,hl->buildarchs);
|
|
||||||
if (hl->excludearch) printf("excludearch: %s %s\n",hl->name,hl->excludearch);
|
|
||||||
hl->description = headerGetStringEntry(h, RPMTAG_DESCRIPTION);
|
hl->description = headerGetStringEntry(h, RPMTAG_DESCRIPTION);
|
||||||
packager = headerGetStringEntry(h, RPMTAG_PACKAGER);
|
packager = headerGetStringEntry(h, RPMTAG_PACKAGER);
|
||||||
if (!packager) {
|
if (!packager) {
|
||||||
logmsg(LOG_WARNING,"missing packager definition in package %s.",hl->name);
|
logmsg(LOG_WARNING,"missing packager definition in package %s.",hl->name);
|
||||||
hl->packager = NULL;
|
hl->packager = NULL;
|
||||||
} else {
|
} else {
|
||||||
hl->packager = getPackagerByName(packager,1);
|
hl->packager = getPackagerByName(packager,1);
|
||||||
if (!hl->packager) {
|
if (!hl->packager) {
|
||||||
logmsg(LOG_WARNING,"cannot create '%s' packager for package %s.",packager,hl->name);
|
logmsg(LOG_WARNING,"cannot create '%s' packager for package %s.",packager,hl->name);
|
||||||
|
free(packager);
|
||||||
}
|
}
|
||||||
/* if (! (hl->packager->role && PACKAGER_ROLE_MAINTAINER)) {
|
/* if (! (hl->packager->role && PACKAGER_ROLE_MAINTAINER)) {
|
||||||
logmsg(LOG_WARNING,"%s is an unmaintained package.",hl->name,hl->packager->name,hl->packager->role);
|
logmsg(LOG_WARNING,"%s is an unmaintained package.",hl->name,hl->packager->name,hl->packager->role);
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
free(packager);
|
|
||||||
hl->group = headerGetStringEntry(h, RPMTAG_GROUP);
|
hl->group = headerGetStringEntry(h, RPMTAG_GROUP);
|
||||||
hl->license = headerGetStringEntry(h, RPMTAG_LICENSE);
|
hl->license = headerGetStringEntry(h, RPMTAG_LICENSE);
|
||||||
hl->url = headerGetStringEntry(h, RPMTAG_URL);
|
hl->url = headerGetStringEntry(h, RPMTAG_URL);
|
||||||
if (!hl->url)
|
if (!hl->url)
|
||||||
logmsg(LOG_WARNING,"missing URL definition for package %s.",hl->name);
|
logmsg(LOG_WARNING,"missing URL definition for package %s.",hl->name);
|
||||||
hl->buildtime = headerGetUIntEntry(h, RPMTAG_BUILDTIME);
|
hl->buildtime = headerGetUIntEntry(h, RPMTAG_BUILDTIME);
|
||||||
|
|
||||||
hl->source = headerGetStringArrayEntry(h, RPMTAG_SOURCE, &count);
|
hl->source = headerGetStringArrayEntry(h, RPMTAG_SOURCE, &count);
|
||||||
hl->patch = headerGetStringArrayEntry(h, RPMTAG_PATCH, &count);
|
hl->patch = headerGetStringArrayEntry(h, RPMTAG_PATCH, &count);
|
||||||
hl->size = headerGetUIntEntry(h, RPMTAG_SIZE);
|
hl->size = headerGetUIntEntry(h, RPMTAG_SIZE);
|
||||||
@ -621,19 +620,15 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
struct changeLog *changelog;
|
struct changeLog *changelog;
|
||||||
Header h;
|
Header h;
|
||||||
char filepath[bufsize + 1];
|
char filepath[bufsize + 1];
|
||||||
int n, j, arch, *dirindexes, filenamescount, dirnamescount;
|
int n, j, arch, filenamescount, dirnamescount;
|
||||||
int_16 *fileflags;
|
int_16 *fileflags;
|
||||||
char **basenames, **dirnames, **usernames, **groupnames;
|
char **basenames, **dirnames, **usernames, **groupnames;
|
||||||
const char* errstr;
|
const char* errstr;
|
||||||
int requirecount;
|
int requirecount;
|
||||||
char **requireversion, **requirename;
|
char **requireversion, **requirename;
|
||||||
uint_32 *requireflags;
|
uint_32 *requireflags, *dirindexes;
|
||||||
char warning[PATH_MAX];
|
char warning[PATH_MAX];
|
||||||
#if RPM_VERSION >= 0x050000
|
|
||||||
rpmts ts = rpmtsCreate();
|
rpmts ts = rpmtsCreate();
|
||||||
#else
|
|
||||||
rpmts ts = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (altrepository == ct->repository_level) {
|
if (altrepository == ct->repository_level) {
|
||||||
scanpath = ct->repository_source_dir;
|
scanpath = ct->repository_source_dir;
|
||||||
@ -666,12 +661,12 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
strcpy(&filepath[strlen(scanpath)], namelist[cnt]->d_name);
|
strcpy(&filepath[strlen(scanpath)], namelist[cnt]->d_name);
|
||||||
|
|
||||||
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
||||||
if (getHeader(&ts, filepath, &h)) {
|
|
||||||
|
if (getHeader(&ts, filepath, &h)) {
|
||||||
errstr = strerror(errno);
|
errstr = strerror(errno);
|
||||||
logmsg(LOG_WARNING,
|
logmsg(LOG_WARNING,
|
||||||
"%s: unable to read header (%s); skipping.",namelist[cnt]->d_name, errstr);
|
"%s: unable to read header (%s); skipping.",namelist[cnt]->d_name, errstr);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
getPackageFiles(h, &dirindexes, &dirnames, &dirnamescount,
|
getPackageFiles(h, &dirindexes, &dirnames, &dirnamescount,
|
||||||
&basenames, &filenamescount,
|
&basenames, &filenamescount,
|
||||||
&usernames, &groupnames, &fileflags);
|
&usernames, &groupnames, &fileflags);
|
||||||
@ -692,6 +687,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
newheadersourcelist->firstrebuild = NULL;
|
newheadersourcelist->firstrebuild = NULL;
|
||||||
newheadersourcelist->old = NULL;
|
newheadersourcelist->old = NULL;
|
||||||
newheadersourcelist->id = ++sourceid;
|
newheadersourcelist->id = ++sourceid;
|
||||||
|
|
||||||
getPackageInfoIntoHeaderSourceList(h, newheadersourcelist);
|
getPackageInfoIntoHeaderSourceList(h, newheadersourcelist);
|
||||||
|
|
||||||
|
|
||||||
@ -813,9 +809,7 @@ addToSourceHeaderList(struct headerSourceList **headersourcelist, struct configT
|
|||||||
} // for
|
} // for
|
||||||
|
|
||||||
free(namelist);
|
free(namelist);
|
||||||
#if RPM_VERSION >= 0x050000
|
|
||||||
rpmtsFree(ts);
|
rpmtsFree(ts);
|
||||||
#endif
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,8 +865,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
char *filename=NULL;
|
char *filename=NULL;
|
||||||
long i ,j , k, n, altn[ALT_REPS_MAX];
|
long i ,j , k, n, altn[ALT_REPS_MAX];
|
||||||
int altrepository=0, obsoletecount, providecount, requirecount,
|
int altrepository=0, obsoletecount, providecount, requirecount,
|
||||||
filenamecount, dirnamecount,
|
filenamecount, dirnamecount;
|
||||||
*dirindex;
|
|
||||||
int_16 *fileflags;
|
int_16 *fileflags;
|
||||||
char **obsoletename, **obsoleteversion,
|
char **obsoletename, **obsoleteversion,
|
||||||
**providename, **provideversion,
|
**providename, **provideversion,
|
||||||
@ -880,7 +873,7 @@ addToHeaderList(struct configTag *ct,
|
|||||||
**basename, **dirname, **newversion,
|
**basename, **dirname, **newversion,
|
||||||
**fileusername, **filegroupname;
|
**fileusername, **filegroupname;
|
||||||
const char* errstr;
|
const char* errstr;
|
||||||
uint_32 *requireflags, *obsoleteflags, *provideflags;
|
uint_32 *dirindex, *requireflags, *obsoleteflags, *provideflags;
|
||||||
#if RPM_VERSION >= 0x050000
|
#if RPM_VERSION >= 0x050000
|
||||||
rpmts ts = rpmtsCreate();
|
rpmts ts = rpmtsCreate();
|
||||||
#else
|
#else
|
||||||
@ -978,7 +971,8 @@ addToHeaderList(struct configTag *ct,
|
|||||||
/* process package */
|
/* process package */
|
||||||
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
logmsg(LOG_DEBUG, "getting header for %s", filepath);
|
||||||
|
|
||||||
sem_t rpm_mutex;
|
sem_t rpm_mutex = getRPMMutex();
|
||||||
|
|
||||||
sem_wait(&rpm_mutex);
|
sem_wait(&rpm_mutex);
|
||||||
if (getHeader(&ts, filepath, &h)) {
|
if (getHeader(&ts, filepath, &h)) {
|
||||||
sem_post(&rpm_mutex);
|
sem_post(&rpm_mutex);
|
||||||
|
@ -48,7 +48,7 @@ char **headerGetStringArrayEntry(Header h, const int tag, int* count);
|
|||||||
|
|
||||||
long long headerGetUIntEntry(Header h, const int tag);
|
long long headerGetUIntEntry(Header h, const int tag);
|
||||||
|
|
||||||
void *headerGetUIntArrayEntry(Header h, const int tag, int *count);
|
uint_32 *headerGetUIntArrayEntry(Header h, const int tag, int *count);
|
||||||
|
|
||||||
int getHeader(rpmts *ts, char *headerFile, Header * h);
|
int getHeader(rpmts *ts, char *headerFile, Header * h);
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ int getPackageObsoletes(
|
|||||||
char ***obsoleteversion, int *obsoletecount);
|
char ***obsoleteversion, int *obsoletecount);
|
||||||
|
|
||||||
int
|
int
|
||||||
getPackageFiles(Header h, int **dirindexes,
|
getPackageFiles(Header h, uint_32 **dirindexes,
|
||||||
char ***dirnames, int *dirnamescount,
|
char ***dirnames, int *dirnamescount,
|
||||||
char ***basenames, int *filenamescount,
|
char ***basenames, int *filenamescount,
|
||||||
char ***usernames, char ***groupnames,
|
char ***usernames, char ***groupnames,
|
||||||
@ -77,4 +77,6 @@ int scanrpmnamecmp(const struct dirent **f1, const struct dirent **f2);
|
|||||||
|
|
||||||
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release);
|
char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *release);
|
||||||
|
|
||||||
|
sem_t getRPMMutex();
|
||||||
|
|
||||||
#endif // RPMFUNCTIONS_H
|
#endif // RPMFUNCTIONS_H
|
||||||
|
@ -29,14 +29,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
#include <libiberty/libiberty.h>
|
#include <libiberty/libiberty.h>
|
||||||
#include "functions.h"
|
|
||||||
|
|
||||||
#ifndef RPMFUNCTIONS_H
|
#include "functions.h"
|
||||||
# include "rpmfunctions.h"
|
#include "rpmfunctions.h"
|
||||||
#endif
|
|
||||||
|
sem_t rpm_mutex;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* static int getPackageInfo(
|
* static int getPackageInfo(
|
||||||
@ -104,7 +103,6 @@ getHeader(rpmts* ts, char *headerFile, Header * h)
|
|||||||
if (fd == NULL || Ferror(fd)) {
|
if (fd == NULL || Ferror(fd)) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x040100
|
||||||
@ -116,7 +114,6 @@ getHeader(rpmts* ts, char *headerFile, Header * h)
|
|||||||
#endif
|
#endif
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x040100
|
||||||
if (rc != RPMRC_OK && rc != RPMRC_NOTTRUSTED && rc != RPMRC_NOKEY) {
|
if (rc != RPMRC_OK && rc != RPMRC_NOTTRUSTED && rc != RPMRC_NOKEY) {
|
||||||
// fprintf(stderr, "Error: Failed reading file %s\n", headerFile);
|
|
||||||
#else
|
#else
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
#endif
|
#endif
|
||||||
@ -130,21 +127,19 @@ getHeader(rpmts* ts, char *headerFile, Header * h)
|
|||||||
char *
|
char *
|
||||||
headerGetStringEntry(Header h, const int tag)
|
headerGetStringEntry(Header h, const int tag)
|
||||||
{
|
{
|
||||||
const char *st = NULL;
|
char *st = NULL;
|
||||||
|
|
||||||
#if RPM_VERSION_MAJOR >= 0x050000
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
|
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
if (headerGet(h, he, 0) && he->t == RPM_STRING_TYPE && he->c == 1)
|
if (headerGet(h, he, 0) && he->t == RPM_STRING_TYPE && he->c == 1)
|
||||||
st = xstrdup(he->p.str);
|
st = strdup(he->p.str);
|
||||||
else
|
else
|
||||||
st = NULL;
|
st = NULL;
|
||||||
|
|
||||||
//printf(" headerGetStringEntry tag:%d st:%s\n", he->tag, st);
|
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
#else
|
#else
|
||||||
st = headerGetString(h, tag);
|
st = headerGetAsString(h, tag);
|
||||||
#endif
|
#endif
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
@ -165,15 +160,26 @@ headerGetStringArrayEntry(Header h, const int tag, int* count)
|
|||||||
*count = 0;
|
*count = 0;
|
||||||
st = NULL;
|
st = NULL;
|
||||||
}
|
}
|
||||||
//unsigned int i;
|
|
||||||
//for (i=0; i < he->c; i++) {
|
|
||||||
//fprintf(stderr," headerGetStringArrayEntry tag:%d string %d/%d:%s\n", he->tag, i+1, he->c, st[i]);
|
|
||||||
//}
|
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
#else
|
#else
|
||||||
st = headerGetString(h, tag);
|
rpmtd td = rpmtdNew();
|
||||||
|
int i = 0;
|
||||||
|
*count = 0;
|
||||||
|
if (headerGet(h, tag, td, HEADERGET_MINMEM) && rpmtdType(td) == RPM_STRING_ARRAY_TYPE && rpmtdCount(td) >= 1) {
|
||||||
|
*count = rpmtdCount(td);
|
||||||
|
if (*count > 0) {
|
||||||
|
st = malloc(sizeof(char*) * *count);
|
||||||
|
const char* str;
|
||||||
|
rpmtdInit(td);
|
||||||
|
while ((str = rpmtdNextString(td))) {
|
||||||
|
st[i] = strdup(str);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
rpmtdFree(td);
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return st;
|
return st;
|
||||||
}
|
}
|
||||||
|
|
||||||
long long headerGetUIntEntry(Header h, const int tag) {
|
long long headerGetUIntEntry(Header h, const int tag) {
|
||||||
@ -203,9 +209,6 @@ long long headerGetUIntEntry(Header h, const int tag) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//fprintf(stderr," headerGetUIntEntry tag:%d uint %lld\n", he->tag, ret);
|
|
||||||
|
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
#else
|
#else
|
||||||
ret = headerGetNumber(h, tag);
|
ret = headerGetNumber(h, tag);
|
||||||
@ -213,16 +216,15 @@ long long headerGetUIntEntry(Header h, const int tag) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
uint_32 *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
||||||
|
uint_32 *ret = NULL;
|
||||||
void *ret = NULL;
|
|
||||||
|
|
||||||
#if RPM_VERSION_MAJOR >= 0x050000
|
#if RPM_VERSION_MAJOR >= 0x050000
|
||||||
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
HE_t he = memset(alloca(sizeof(*he)), 0, sizeof(*he));
|
||||||
he->tag = tag;
|
he->tag = tag;
|
||||||
if (headerGet(h, he, 0) && he->c >= 1) {
|
if (headerGet(h, he, 0) && he->c >= 1) {
|
||||||
*count = he->c;
|
*count = he->c;
|
||||||
switch (he->t) {
|
switch (he->t) {
|
||||||
case RPM_UINT8_TYPE:
|
case RPM_UINT8_TYPE:
|
||||||
ret = memndup(he->p.ui8p, *count);
|
ret = memndup(he->p.ui8p, *count);
|
||||||
break;
|
break;
|
||||||
@ -231,10 +233,6 @@ void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
|||||||
break;
|
break;
|
||||||
case RPM_UINT32_TYPE:
|
case RPM_UINT32_TYPE:
|
||||||
ret = memndup(he->p.ui32p, *count * 4);
|
ret = memndup(he->p.ui32p, *count * 4);
|
||||||
//int i;
|
|
||||||
//for (i=0; i<he->c; i++) {
|
|
||||||
// printf("%d ",((int_32 *)ret)[i]);
|
|
||||||
//}
|
|
||||||
break;
|
break;
|
||||||
case RPM_UINT64_TYPE:
|
case RPM_UINT64_TYPE:
|
||||||
ret = memndup(he->p.ui64p, *count * 8);
|
ret = memndup(he->p.ui64p, *count * 8);
|
||||||
@ -244,14 +242,38 @@ void *headerGetUIntArrayEntry(Header h, const int tag, int *count) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*unsigned int i;
|
|
||||||
for (i=0; i < he->c; i++) {
|
|
||||||
fprintf(stderr," headerGetUIntArrayEntry tag:%d value:%ld\n", he->tag, ((rpmuint32_t*)ret)[i]);
|
|
||||||
}*/
|
|
||||||
he->p.ptr = _free(he->p.ptr);
|
he->p.ptr = _free(he->p.ptr);
|
||||||
#else
|
#else
|
||||||
ret = headerGetNumber(h, tag);
|
rpmtd td = rpmtdNew();
|
||||||
|
int i = 0;
|
||||||
|
if (headerGet(h, tag, td, HEADERGET_MINMEM)) {
|
||||||
|
*count = rpmtdCount(td);
|
||||||
|
ret = malloc(sizeof(uint_32) * *count);
|
||||||
|
rpmtdInit(td);
|
||||||
|
while (rpmtdNext(td) >= 0) {
|
||||||
|
switch (td->type) {
|
||||||
|
case RPM_INT8_TYPE:
|
||||||
|
ret[i] = (uint_32)*rpmtdGetChar(td);
|
||||||
|
break;
|
||||||
|
case RPM_INT16_TYPE:
|
||||||
|
ret[i] = (uint_32)*rpmtdGetUint16(td);
|
||||||
|
break;
|
||||||
|
case RPM_INT32_TYPE:
|
||||||
|
ret[i] = (uint_32)*rpmtdGetUint32(td);
|
||||||
|
break;
|
||||||
|
case RPM_INT64_TYPE:
|
||||||
|
fprintf(stderr,"headerGetUIntArrayEntry: uint_64 type converted to uint_32");
|
||||||
|
ret[i] = (uint_32)*rpmtdGetUint64(td);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
rpmtdFree(td);
|
||||||
|
} else {
|
||||||
|
*count = 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -290,7 +312,7 @@ getPackageObsoletes(Header h, char ***obsoletename, uint_32 **obsoleteflags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
getPackageFiles(Header h, int **dirindexes,
|
getPackageFiles(Header h, uint_32 **dirindexes,
|
||||||
char ***dirnames, int *dirnamescount,
|
char ***dirnames, int *dirnamescount,
|
||||||
char ***basenames, int *filenamescount,
|
char ***basenames, int *filenamescount,
|
||||||
char ***usernames, char ***groupnames,
|
char ***usernames, char ***groupnames,
|
||||||
@ -373,12 +395,15 @@ char* printrpmversion(char *s, int bufsize, long epoch, char *version, char *rel
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sem_t getRPMMutex() {
|
||||||
|
return rpm_mutex;
|
||||||
|
}
|
||||||
|
|
||||||
void rpminit() {
|
void rpminit() {
|
||||||
#if RPM_VERSION >= 0x040100
|
#if RPM_VERSION >= 0x040100
|
||||||
rpmReadConfigFiles(NULL, NULL);
|
rpmReadConfigFiles(NULL, NULL);
|
||||||
// ts = rpmtsCreate();
|
// ts = rpmtsCreate();
|
||||||
// rpmtsSetVSFlags(ts, (rpmVSFlags_e)-1);
|
// rpmtsSetVSFlags(ts, (rpmVSFlags_e)-1);
|
||||||
#endif
|
#endif
|
||||||
sem_t rpm_mutex;
|
|
||||||
sem_init(&rpm_mutex, 0, 1);
|
sem_init(&rpm_mutex, 0, 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user