Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : - add susetags:defaultvendor support
  • From: Michael Schroeder <mls@xxxxxxx>
  • Date: Wed, 24 Jun 2009 13:36:46 +0200
  • Message-id: <E1MJQmi-0000kp-EA@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 33f2eb8e08d204980e5d686e9e7ee13d270265d2
Author: Michael Schroeder <mls@xxxxxxx>
Date: Wed Jun 24 13:36:46 2009 +0200

- add susetags:defaultvendor support
---
ext/repo_content.c | 32 +++++++++++++++++++++++++++-----
src/knownid.h | 1 +
2 files changed, 28 insertions(+), 5 deletions(-)

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"),
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages