headerlist.c: former pre-production changes not committed

This commit is contained in:
Silvan Calarco 2021-03-12 15:51:52 +01:00
parent fa6aab80e1
commit b94d504063

View File

@ -855,9 +855,11 @@ void getXMLPackageChangelog(xmlNode *parent,
int i = *count -1; int i = *count -1;
for (xmlNode *entry=parent->children; entry; entry=entry->next) { for (xmlNode *entry=parent->children; entry; entry=entry->next) {
if (entry->type == XML_ELEMENT_NODE && !strcmp((char*)entry->name, "changelog")) { if (entry->type == XML_ELEMENT_NODE && !strcmp((char*)entry->name, "changelog")) {
(*changelogtime)[i] = atoi((char*)findXMLAttributeByName(entry, "date")); char *tmp = (char*)findXMLAttributeByName(entry, "date");
(*changelogrelease)[i] = strdup((char*)findXMLAttributeByName(entry, "author")); (*changelogtime)[i] = atoi(tmp);
(*changelogtext)[i] = strdup((char*)entry->children->content); free(tmp);
(*changelogrelease)[i] = (char*)findXMLAttributeByName(entry, "author");
(*changelogtext)[i] = (char*)entry->children->content;
i--; i--;
} }
} }
@ -867,6 +869,7 @@ void getXMLPackageChangelog(xmlNode *parent,
void getXMLPackageNFV(xmlNode *parent, char ***name, void getXMLPackageNFV(xmlNode *parent, char ***name,
uint_32 **flags, char ***version, int *count) { uint_32 **flags, char ***version, int *count) {
char buf[PATH_MAX];
*count = xmlChildElementCount(parent); *count = xmlChildElementCount(parent);
if (*count == 0) { if (*count == 0) {
@ -887,15 +890,26 @@ void getXMLPackageNFV(xmlNode *parent, char ***name,
*count); *count);
return; return;
} }
(*name)[i] = strdup((char*)findXMLAttributeByName(entry, "name")); (*name)[i] = (char*)findXMLAttributeByName(entry, "name");
char *ver = (char*)findXMLAttributeByName(entry, "version");
if (ver) {
(*version)[i] = strdup(ver);
free(ver);
} else
(*version)[i] = strdup("");
(*flags)[i] = XMLFlagToInt( (*flags)[i] = XMLFlagToInt(
(char*)findXMLAttributeByName(entry, "flags")); (char*)findXMLAttributeByName(entry, "flags"));
buf[0] = '\0';
if ((*flags)[i] != RPMSENSE_ANY) {
char *epoch = (char*)findXMLAttributeByName(entry, "epoch");
char *ver = (char*)findXMLAttributeByName(entry, "ver");
char *rel = (char*)findXMLAttributeByName(entry, "rel");
if (epoch && ver && rel) {
snprintf(buf, PATH_MAX,"%s:%s-%s", epoch, ver, rel);
free(epoch);
free(ver);
free(rel);
} else if (epoch && ver) {
snprintf(buf, PATH_MAX,"%s:%s", epoch, ver);
free(epoch);
free(ver);
}
}
(*version)[i] = strdup(buf);
i++; i++;
} }
} }
@ -982,6 +996,7 @@ void addNewToSourceHeaderList(struct headerSourceList *newheadersourcelist,
int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) { int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) {
char *scanpath; char *scanpath;
char *tmp;
struct repoData* repodata = NULL; struct repoData* repodata = NULL;
struct headerSourceList *newheadersourcelist; struct headerSourceList *newheadersourcelist;
struct dirent **namelist; struct dirent **namelist;
@ -1051,9 +1066,11 @@ int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) {
newheadersourcelist->name = strdup((char*) newheadersourcelist->name = strdup((char*)
findXMLPropertyByName(package_node, "name")->children->content); findXMLPropertyByName(package_node, "name")->children->content);
xmlNode *version = findXMLPropertyByName(package_node, "version"); xmlNode *version = findXMLPropertyByName(package_node, "version");
newheadersourcelist->epoch = atoi((char*)findXMLAttributeByName(version, "epoch")); tmp = (char*)findXMLAttributeByName(version, "epoch");
newheadersourcelist->version = strdup((char*)findXMLAttributeByName(version, "ver")); newheadersourcelist->epoch = atoi(tmp);
newheadersourcelist->release = strdup((char*)findXMLAttributeByName(version, "rel")); free(tmp);
newheadersourcelist->version = (char*)findXMLAttributeByName(version, "ver");
newheadersourcelist->release = (char*)findXMLAttributeByName(version, "rel");
newheadersourcelist->summary = strdup((char*) newheadersourcelist->summary = strdup((char*)
findXMLPropertyByName(package_node, "summary")->children->content); findXMLPropertyByName(package_node, "summary")->children->content);
newheadersourcelist->arch = strdup((char*) newheadersourcelist->arch = strdup((char*)
@ -1090,11 +1107,13 @@ int addToSourceHeaderList(struct configTag *ct, int mode, int altrepository) {
logmsg(LOG_WARNING,"missing URL definition for package %s.", logmsg(LOG_WARNING,"missing URL definition for package %s.",
newheadersourcelist->name); newheadersourcelist->name);
xmlNode *ptime = findXMLPropertyByName(package_node, "time"); xmlNode *ptime = findXMLPropertyByName(package_node, "time");
newheadersourcelist->buildtime = atoi( tmp = (char*)findXMLAttributeByName(ptime, "build");
(char*)findXMLAttributeByName(ptime, "build")); newheadersourcelist->buildtime = atoi(tmp);
free(tmp);
xmlNode *psize = findXMLPropertyByName(package_node, "size"); xmlNode *psize = findXMLPropertyByName(package_node, "size");
newheadersourcelist->size = atoi( tmp = (char*)findXMLAttributeByName(psize, "package");
(char*)findXMLAttributeByName(psize, "package")); newheadersourcelist->size = atoi(tmp);
free(tmp);
// FIXME: information missing from repodata // FIXME: information missing from repodata
newheadersourcelist->buildarchs = NULL; newheadersourcelist->buildarchs = NULL;
newheadersourcelist->excludearch = NULL; newheadersourcelist->excludearch = NULL;
@ -1379,6 +1398,7 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) {
xmlNode *primary_node[ALT_REPS_MAX + 1], *filelists_node[ALT_REPS_MAX + 1]; xmlNode *primary_node[ALT_REPS_MAX + 1], *filelists_node[ALT_REPS_MAX + 1];
char *currnames[ALT_REPS_MAX + 1]; char *currnames[ALT_REPS_MAX + 1];
char nextname[bufsize + 1]; char nextname[bufsize + 1];
char *tmp;
char scanpath[bufsize + 1], *altscanpath[ALT_REPS_MAX]; char scanpath[bufsize + 1], *altscanpath[ALT_REPS_MAX];
char *scantag, *altscantag[ALT_REPS_MAX]; char *scantag, *altscantag[ALT_REPS_MAX];
@ -1534,9 +1554,11 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) {
newheaderlist->name = strdup((char*) newheaderlist->name = strdup((char*)
findXMLPropertyByName(primary_node[altidx], "name")->children->content); findXMLPropertyByName(primary_node[altidx], "name")->children->content);
xmlNode *version = findXMLPropertyByName(primary_node[altidx], "version"); xmlNode *version = findXMLPropertyByName(primary_node[altidx], "version");
newheaderlist->epoch = atoi((char*)findXMLAttributeByName(version, "epoch")); tmp = (char*)findXMLAttributeByName(version, "epoch");
newheaderlist->version = strdup((char*)findXMLAttributeByName(version, "ver")); newheaderlist->epoch = atoi(tmp);
newheaderlist->release = strdup((char*)findXMLAttributeByName(version, "rel")); free(tmp);
newheaderlist->version = (char*)findXMLAttributeByName(version, "ver");
newheaderlist->release = (char*)findXMLAttributeByName(version, "rel");
newheaderlist->summary = strdup((char*) newheaderlist->summary = strdup((char*)
findXMLPropertyByName(primary_node[altidx], "summary")->children->content); findXMLPropertyByName(primary_node[altidx], "summary")->children->content);
newheaderlist->arch = strdup((char*) newheaderlist->arch = strdup((char*)
@ -1555,8 +1577,9 @@ char* advanceXMLPackageNode(xmlNode **primary_node, xmlNode **filelists_node) {
newheaderlist->sourcename = strdup((char*) newheaderlist->sourcename = strdup((char*)
findXMLPropertyByName(format, "sourcerpm")->children->content); findXMLPropertyByName(format, "sourcerpm")->children->content);
xmlNode *psize = findXMLPropertyByName(primary_node[altidx], "size"); xmlNode *psize = findXMLPropertyByName(primary_node[altidx], "size");
newheaderlist->size = atoi( tmp = (char*)findXMLAttributeByName(psize, "package");
(char*)findXMLAttributeByName(psize, "package")); newheaderlist->size = atoi(tmp);
free(tmp);
int ret = addNewToHeaderList(&currheaderlist, newheaderlist, ct, int ret = addNewToHeaderList(&currheaderlist, newheaderlist, ct,
altidx, arch); altidx, arch);