summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-12-23 14:47:19 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-12-23 14:47:19 +0900
commit5f5ff9576322b449fca131df791f4748e412df5f (patch)
treefc7068d472fa2fb11cb5ee4d4cf08d48d289c56a /ext
parent4ddbcf346d1185bacbe63dba6e9317424b5206b9 (diff)
downloadlibsolv-5f5ff9576322b449fca131df791f4748e412df5f.tar.gz
libsolv-5f5ff9576322b449fca131df791f4748e412df5f.tar.bz2
libsolv-5f5ff9576322b449fca131df791f4748e412df5f.zip
Imported Upstream version 0.7.20upstream/0.7.20
Diffstat (limited to 'ext')
-rw-r--r--ext/repo_comps.c33
-rw-r--r--ext/repo_testcase.c9
-rw-r--r--ext/solv_xmlparser.c44
-rw-r--r--ext/solv_xmlparser.h1
-rw-r--r--ext/testcase.c1
5 files changed, 86 insertions, 2 deletions
diff --git a/ext/repo_comps.c b/ext/repo_comps.c
index 014f89a..633fbaa 100644
--- a/ext/repo_comps.c
+++ b/ext/repo_comps.c
@@ -54,6 +54,8 @@ enum state {
STATE_CDISPLAY_ORDER,
STATE_GROUPLIST,
STATE_GROUPID,
+ STATE_ENVIRONMENT,
+ STATE_OPTIONLIST,
NUMSTATES
};
@@ -61,6 +63,7 @@ static struct solv_xmlparser_element stateswitches[] = {
{ STATE_START, "comps", STATE_COMPS, 0 },
{ STATE_COMPS, "group", STATE_GROUP, 0 },
{ STATE_COMPS, "category", STATE_CATEGORY, 0 },
+ { STATE_COMPS, "environment", STATE_ENVIRONMENT, 0 },
{ STATE_GROUP, "id", STATE_ID, 1 },
{ STATE_GROUP, "name", STATE_NAME, 1 },
{ STATE_GROUP, "description", STATE_DESCRIPTION, 1 },
@@ -77,6 +80,13 @@ static struct solv_xmlparser_element stateswitches[] = {
{ STATE_CATEGORY , "grouplist", STATE_GROUPLIST, 0 },
{ STATE_CATEGORY , "display_order", STATE_DISPLAY_ORDER, 1 },
{ STATE_GROUPLIST, "groupid", STATE_GROUPID, 1 },
+ { STATE_ENVIRONMENT, "id", STATE_ID, 1 },
+ { STATE_ENVIRONMENT, "name", STATE_NAME, 1 },
+ { STATE_ENVIRONMENT, "description", STATE_DESCRIPTION, 1 },
+ { STATE_ENVIRONMENT, "grouplist", STATE_GROUPLIST, 0 },
+ { STATE_ENVIRONMENT, "optionlist", STATE_OPTIONLIST, 0 },
+ { STATE_ENVIRONMENT, "display_order", STATE_DISPLAY_ORDER, 1 },
+ { STATE_OPTIONLIST, "groupid", STATE_GROUPID, 1 },
{ NUMSTATES }
};
@@ -128,9 +138,15 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
{
case STATE_GROUP:
case STATE_CATEGORY:
+ case STATE_ENVIRONMENT:
s = pd->solvable = pool_id2solvable(pool, repo_add_solvable(pd->repo));
pd->handle = s - pool->solvables;
- pd->kind = state == STATE_GROUP ? "group" : "category";
+ if (state == STATE_GROUP)
+ pd->kind = "group";
+ else if (state == STATE_CATEGORY)
+ pd->kind = "category";
+ else
+ pd->kind = "environment";
pd->isvisible = COMPS_DEFAULT_ISVISIBLE;
pd->isdefault = COMPS_DEFAULT_ISDEFAULT;
break;
@@ -160,6 +176,18 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
break;
}
+ case STATE_GROUPLIST:
+ {
+ pd->reqtype = SOLVABLE_REQUIRES;
+ break;
+ }
+
+ case STATE_OPTIONLIST:
+ {
+ pd->reqtype = SOLVABLE_SUGGESTS;
+ break;
+ }
+
default:
break;
}
@@ -177,6 +205,7 @@ endElement(struct solv_xmlparser *xmlp, int state, char *content)
{
case STATE_GROUP:
case STATE_CATEGORY:
+ case STATE_ENVIRONMENT:
if (!s->arch)
s->arch = ARCH_NOARCH;
if (!s->evr)
@@ -211,7 +240,7 @@ endElement(struct solv_xmlparser *xmlp, int state, char *content)
case STATE_GROUPID:
id = pool_str2id(pd->pool, join2(&pd->jd, "group", ":", content), 1);
- s->requires = repo_addid_dep(pd->repo, s->requires, id, 0);
+ repo_add_idarray(pd->repo, pd->handle, pd->reqtype, id);
break;
case STATE_USERVISIBLE:
diff --git a/ext/repo_testcase.c b/ext/repo_testcase.c
index 5cc0327..00f7b54 100644
--- a/ext/repo_testcase.c
+++ b/ext/repo_testcase.c
@@ -480,6 +480,12 @@ testcase_write_testtags(Repo *repo, FILE *fp)
tmp = solvable_lookup_str(s, SOLVABLE_BUILDVERSION);
if (tmp)
fprintf(fp, "=Bvr: %s\n", tmp);
+ if (solvable_lookup_idarray(s, SOLVABLE_TRACK_FEATURES, &q))
+ {
+ int i;
+ for (i = 0; i < q.count; i++)
+ fprintf(fp, "=Trf: %s\n", pool_id2str(pool, q.elements[i]));
+ }
ti = solvable_lookup_num(s, SOLVABLE_BUILDTIME, 0);
if (ti)
fprintf(fp, "=Tim: %u\n", ti);
@@ -707,6 +713,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags)
case 'B' << 16 | 'v' << 8 | 'r':
repodata_set_str(data, s - pool->solvables, SOLVABLE_BUILDVERSION, line + 6);
break;
+ case 'T' << 16 | 'r' << 8 | 'f':
+ repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_TRACK_FEATURES, line + 6);
+ break;
default:
break;
}
diff --git a/ext/solv_xmlparser.c b/ext/solv_xmlparser.c
index 6292663..87bd096 100644
--- a/ext/solv_xmlparser.c
+++ b/ext/solv_xmlparser.c
@@ -54,6 +54,47 @@ character_data(void *userData, const XML_Char *s, int len)
}
#ifdef WITH_LIBXML2
+static void fixup_att_inplace(char *at)
+{
+ while ((at = strchr(at, '&')) != 0)
+ {
+ at++;
+ if (!memcmp(at, "#38;", 4))
+ memmove(at, at + 4, strlen(at + 4) + 1);
+ }
+}
+
+static const xmlChar **fixup_atts(struct solv_xmlparser *xmlp, const xmlChar **atts)
+{
+ size_t needsize = 0;
+ size_t natts;
+ char **at;
+
+ for (natts = 0; atts[natts]; natts++)
+ if (strchr((char *)atts[natts], '&'))
+ needsize += strlen((const char *)atts[natts]) + 1;
+ if (!needsize)
+ return atts;
+ at = xmlp->attsdata = solv_realloc(xmlp->attsdata, (natts + 1) * sizeof(xmlChar *) + needsize);
+ needsize = (natts + 1) * sizeof(xmlChar *);
+ for (natts = 0; atts[natts]; natts++)
+ {
+ at[natts] = (char *)atts[natts];
+ if (strchr(at[natts], '&'))
+ {
+ size_t l = strlen(at[natts]) + 1;
+ memcpy((char *)at + needsize, at[natts], l);
+ at[natts] = (char *)at + needsize;
+ needsize += l;
+ fixup_att_inplace(at[natts]);
+ }
+ }
+ at[natts] = 0;
+ return (const xmlChar **)at;
+}
+#endif
+
+#ifdef WITH_LIBXML2
static void
start_element(void *userData, const xmlChar *name, const xmlChar **atts)
#else
@@ -97,6 +138,8 @@ start_element(void *userData, const char *name, const char **atts)
static const char *nullattr;
atts = (const xmlChar **)&nullattr;
}
+ else if (xmlp->state != oldstate)
+ atts = fixup_atts(xmlp, atts);
#endif
if (xmlp->state != oldstate)
xmlp->startelement(xmlp, xmlp->state, el->element, (const char **)atts);
@@ -177,6 +220,7 @@ solv_xmlparser_free(struct solv_xmlparser *xmlp)
queue_free(&xmlp->elementq);
xmlp->content = solv_free(xmlp->content);
xmlp->errstr = solv_free(xmlp->errstr);
+ xmlp->attsdata = solv_free(xmlp->attsdata);
}
static void
diff --git a/ext/solv_xmlparser.h b/ext/solv_xmlparser.h
index ced0571..717983f 100644
--- a/ext/solv_xmlparser.h
+++ b/ext/solv_xmlparser.h
@@ -30,6 +30,7 @@ struct solv_xmlparser {
Id *elementhelper;
void *parser;
+ void *attsdata;
};
#define SOLV_XMLPARSER_OK 0
diff --git a/ext/testcase.c b/ext/testcase.c
index 20b0c48..055452f 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -60,6 +60,7 @@ static struct job2str {
{ SOLVER_FAVOR, "favor" },
{ SOLVER_DISFAVOR, "disfavor" },
{ SOLVER_BLACKLIST, "blacklist" },
+ { SOLVER_EXCLUDEFROMWEAK, "excludefromweak" },
{ 0, 0 }
};