From: Michael Schroeder Date: Wed, 24 Jun 2009 10:24:58 +0000 (+0200) Subject: - convert META/HASH/KEY data from content file X-Git-Tag: BASE-SuSE-Code-12_1-Branch~217 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb47739b9b3c67f2b0caac6bd7c74e94ac2c8cd1;p=thirdparty%2Flibsolv.git - convert META/HASH/KEY data from content file --- diff --git a/ext/repo_content.c b/ext/repo_content.c index b3982972..561e1512 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 62be3ceb..0dd42be6 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"),