From: Michael Schroeder Date: Wed, 24 Jun 2009 11:36:46 +0000 (+0200) Subject: - add susetags:defaultvendor support X-Git-Tag: BASE-SuSE-Code-12_1-Branch~215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be05df8021ddcb1098e89186184f1a17858bfb8c;p=platform%2Fupstream%2Flibsolv.git - add susetags:defaultvendor support --- diff --git a/ext/repo_content.c b/ext/repo_content.c index 561e151..0cbdf2c 100644 --- a/ext/repo_content.c +++ b/ext/repo_content.c @@ -205,6 +205,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) int contentstyle = 0; char *descrdir = 0; char *datadir = 0; + char *defvendor = 0; int i = 0; @@ -272,14 +273,21 @@ repo_add_content(Repo *repo, FILE *fp, int flags) #define code10 (contentstyle == 10) #define code11 (contentstyle == 11) + if (istag ("CONTENTSTYLE")) { + if (contentstyle) + pool_debug(pool, SAT_ERROR, "repo_content: 'CONTENTSTYLE' must be first line of 'content'\n"); contentstyle = atoi(value); continue; } if (!contentstyle) contentstyle = 10; + /* repository tags */ + /* we also replicate some of them into the product solvables + * to be backward compatible */ + if (istag ("DESCRDIR")) { if (descrdir) @@ -302,6 +310,17 @@ repo_add_content(Repo *repo, FILE *fp, int flags) datadir = strdup(value); continue; } + if (istag ("VENDOR")) + { + if (defvendor) + free(defvendor); + else + repo_set_poolstr(repo, SOLVID_META, SUSETAGS_DEFAULTVENDOR, value); + if (s) + s->vendor = str2id(pool, value, 1); + defvendor = strdup(value); + continue; + } if (istag ("META") || istag ("HASH") || istag ("KEY")) { @@ -339,6 +358,8 @@ repo_add_content(Repo *repo, FILE *fp, int flags) continue; } + /* product tags */ + if ((code10 && istag ("PRODUCT")) || (code11 && istag ("NAME"))) { @@ -368,6 +389,8 @@ repo_add_content(Repo *repo, FILE *fp, int flags) repo_set_str(repo, s - pool->solvables, SUSETAGS_DATADIR, datadir); if (descrdir) repo_set_str(repo, s - pool->solvables, SUSETAGS_DESCRDIR, descrdir); + if (defvendor) + s->vendor = str2id(pool, defvendor, 1); continue; } @@ -402,7 +425,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) repo_set_str(repo, s - pool->solvables, pool_id2langid(pool, SOLVABLE_SUMMARY, key + 6, 1), value); else if (istag ("FLAGS")) add_multiple_strings(data, handle, PRODUCT_FLAGS, value); - else if (istag ("VENDOR")) + else if (istag ("VENDOR")) /* actually already handled above */ s->vendor = str2id(pool, value, 1); else if (istag ("BASEARCHS")) { @@ -424,10 +447,7 @@ repo_add_content(Repo *repo, FILE *fp, int flags) * */ - else if (code10 && istag ("CONTENTSTYLE")) - /* CONTENTSTYLE must be first line */ - pool_debug(pool, SAT_ERROR, "repo_content: 'CONTENTSTYLE' must be first line of 'content'\n"); - else if (code10 && istag ("DISTPRODUCT")) + if (code10 && istag ("DISTPRODUCT")) /* DISTPRODUCT is for registration and Yast, not for the solver. */ repo_set_str(repo, s - pool->solvables, PRODUCT_DISTPRODUCT, value); else if (code10 && istag ("DISTVERSION")) @@ -473,6 +493,8 @@ repo_add_content(Repo *repo, FILE *fp, int flags) free(datadir); if (descrdir) free(descrdir); + if (defvendor) + free(defvendor); if (!s || !s->name) { diff --git a/src/knownid.h b/src/knownid.h index 0dd42be..38e37ff 100644 --- a/src/knownid.h +++ b/src/knownid.h @@ -173,6 +173,7 @@ KNOWNID(PRODUCT_REGISTER_RELEASE, "product:regrelease"), /* argh */ KNOWNID(SUSETAGS_DATADIR, "susetags:datadir"), KNOWNID(SUSETAGS_DESCRDIR, "susetags:descrdir"), +KNOWNID(SUSETAGS_DEFAULTVENDOR, "susetags:defaultvendor"), KNOWNID(SUSETAGS_FILE, "susetags:file"), KNOWNID(SUSETAGS_FILE_NAME, "susetags:file:name"), KNOWNID(SUSETAGS_FILE_TYPE, "susetags:file:type"),