Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <sat-solver> master : - convert META/HASH/KEY data from content file
  • From: Michael Schroeder <mls@xxxxxxx>
  • Date: Wed, 24 Jun 2009 12:24:58 +0200
  • Message-id: <E1MJPfN-0008A5-O2@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 3fd3653b62c8832aff1e237b03c14dbb2af2ca16
Author: Michael Schroeder <mls@xxxxxxx>
Date: Wed Jun 24 12:24:58 2009 +0200

- convert META/HASH/KEY data from content file
---
ext/repo_content.c | 42 +++++++++++++++++++++++++++++++++++-------
src/knownid.h | 4 ++++
2 files changed, 39 insertions(+), 7 deletions(-)

diff --git a/ext/repo_content.c b/ext/repo_content.c
index b398297..561e151 100644
--- a/ext/repo_content.c
+++ b/ext/repo_content.c
@@ -303,13 +303,41 @@ repo_add_content(Repo *repo, FILE *fp, int flags)
continue;
}

- /* XXX: add those to SOLVID_META, too */
- if (istag ("META"))
- continue;
- if (istag ("HASH"))
- continue;
- if (istag ("KEY"))
- continue;
+ if (istag ("META") || istag ("HASH") || istag ("KEY"))
+ {
+ char *checksumtype, *checksum;
+ Id fh, type;
+ int l;
+
+ if ((checksumtype = splitword(&value)) == 0)
+ continue;
+ if ((checksum = splitword(&value)) == 0)
+ continue;
+ if (!*value)
+ continue;
+ if (!strcasecmp(checksumtype, "sha") || !strcasecmp(checksumtype,
"sha1"))
+ l = SIZEOF_SHA1 * 2, type = REPOKEY_TYPE_SHA1;
+ else if (!strcasecmp(checksumtype, "sha256"))
+ l = SIZEOF_SHA256 * 2, type = REPOKEY_TYPE_SHA256;
+ else if (!strcasecmp(checksumtype, "md5"))
+ l = SIZEOF_MD5 * 2, type = REPOKEY_TYPE_MD5;
+ else
+ {
+ fprintf(stderr, "Unknown checksum type: %s: %s\n", value,
checksumtype);
+ exit(1);
+ }
+ if (strlen(checksum) != l)
+ {
+ fprintf(stderr, "Invalid checksum length: %s: for %s\n",
value, checksum);
+ exit(1);
+ }
+ fh = repodata_new_handle(data);
+ repodata_set_poolstr(data, fh, SUSETAGS_FILE_TYPE, key);
+ repodata_set_str(data, fh, SUSETAGS_FILE_NAME, value);
+ repodata_set_checksum(data, fh, SUSETAGS_FILE_CHECKSUM, type,
checksum);
+ repodata_add_flexarray(data, SOLVID_META, SUSETAGS_FILE, fh);
+ continue;
+ }

if ((code10 && istag ("PRODUCT"))
|| (code11 && istag ("NAME")))
diff --git a/src/knownid.h b/src/knownid.h
index 62be3ce..0dd42be 100644
--- a/src/knownid.h
+++ b/src/knownid.h
@@ -173,6 +173,10 @@ KNOWNID(PRODUCT_REGISTER_RELEASE, "product:regrelease"),
/* argh */
KNOWNID(SUSETAGS_DATADIR, "susetags:datadir"),
KNOWNID(SUSETAGS_DESCRDIR, "susetags:descrdir"),
+KNOWNID(SUSETAGS_FILE, "susetags:file"),
+KNOWNID(SUSETAGS_FILE_NAME, "susetags:file:name"),
+KNOWNID(SUSETAGS_FILE_TYPE, "susetags:file:type"),
+KNOWNID(SUSETAGS_FILE_CHECKSUM, "susetags:file:checksum"),

/* timestamp then the repository was generated */
KNOWNID(REPOSITORY_TIMESTAMP, "repository:timestamp"),
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages