From: Michael Schroeder Date: Tue, 30 May 2017 12:45:17 +0000 (+0200) Subject: Add extend_to_repo calls in examples X-Git-Tag: 0.6.28~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35381634f2b6185267daa0a608d9770717de15b0;p=thirdparty%2Flibsolv.git Add extend_to_repo calls in examples Those are needed if the repo is not written to disk. Otherwise, the repodata does not contain any solvable and thus the configured extensions do not work. --- diff --git a/examples/p5solv b/examples/p5solv index 0a1dbb0b..45debb1b 100755 --- a/examples/p5solv +++ b/examples/p5solv @@ -256,6 +256,7 @@ sub add_ext { sub add_exts { my ($self) = @_; my $repodata = $self->{handle}->add_repodata(0); + $repodata->extend_to_repo(); $self->add_ext($repodata, 'deltainfo', 'DL'); $self->add_ext($repodata, 'filelists', 'FL'); $repodata->internalize(); diff --git a/examples/pysolv b/examples/pysolv index 3d6ca071..891c2371 100755 --- a/examples/pysolv +++ b/examples/pysolv @@ -391,6 +391,7 @@ class repo_repomd(repo_generic): def add_exts(self): repodata = self.handle.add_repodata(0) + repodata.extend_to_repo() self.add_ext(repodata, 'deltainfo', 'DL') self.add_ext(repodata, 'filelists', 'FL') repodata.internalize() diff --git a/examples/rbsolv b/examples/rbsolv index be633f3c..87f0d160 100755 --- a/examples/rbsolv +++ b/examples/rbsolv @@ -317,6 +317,7 @@ class Repo_rpmmd < Repo_generic def add_exts repodata = @handle.add_repodata(0) + repodata.extend_to_repo() add_ext(repodata, 'deltainfo', 'DL') add_ext(repodata, 'filelists', 'FL') repodata.internalize() diff --git a/examples/solv/repoinfo_type_mdk.c b/examples/solv/repoinfo_type_mdk.c index 96b005f6..69287b3e 100644 --- a/examples/solv/repoinfo_type_mdk.c +++ b/examples/solv/repoinfo_type_mdk.c @@ -103,6 +103,18 @@ mdk_load_ext(Repo *repo, Repodata *data) return 1; } +static void +mdk_add_ext(Repo *repo, Repodata *data, const char *what, const char *ext, const char *filename, Id chksumtype, const unsigned char *chksum) +{ + Id handle = repodata_new_handle(data); + /* we mis-use the repomd ids here... need something generic in the future */ + repodata_set_poolstr(data, handle, REPOSITORY_REPOMD_TYPE, what); + repodata_set_str(data, handle, REPOSITORY_REPOMD_LOCATION, filename); + repodata_set_bin_checksum(data, handle, REPOSITORY_REPOMD_CHECKSUM, chksumtype, chksum); + add_ext_keys(data, handle, ext); + repodata_add_flexarray(data, SOLVID_META, REPOSITORY_EXTERNAL, handle); +} + int mdk_load(struct repoinfo *cinfo, Pool **sigpoolp) { @@ -195,13 +207,8 @@ mdk_load(struct repoinfo *cinfo, Pool **sigpoolp) /* setup on-demand loading of filelist data */ if (mdk_find(md5sums, "files.xml.lzma", md5)) { - Id handle = repodata_new_handle(data); - /* we mis-use the repomd ids here... need something generic in the future */ - repodata_set_poolstr(data, handle, REPOSITORY_REPOMD_TYPE, "filelists"); - repodata_set_str(data, handle, REPOSITORY_REPOMD_LOCATION, "media_info/files.xml.lzma"); - repodata_set_bin_checksum(data, handle, REPOSITORY_REPOMD_CHECKSUM, REPOKEY_TYPE_MD5, md5); - add_ext_keys(data, handle, "FL"); - repodata_add_flexarray(data, SOLVID_META, REPOSITORY_EXTERNAL, handle); + repodata_extend_block(data, repo->start, repo->end - repo->start); + mdk_add_ext(repo, data, "filelists", "FL", "media_info/files.xml.lzma", REPOKEY_TYPE_MD5, md5); } solv_free(md5sums); repodata_internalize(data); diff --git a/examples/solv/repoinfo_type_rpmmd.c b/examples/solv/repoinfo_type_rpmmd.c index 98c5d367..2a5cd7fc 100644 --- a/examples/solv/repoinfo_type_rpmmd.c +++ b/examples/solv/repoinfo_type_rpmmd.c @@ -196,6 +196,7 @@ repomd_load(struct repoinfo *cinfo, Pool **sigpoolp) } #endif data = repo_add_repodata(repo, 0); + repodata_extend_block(data, repo->start, repo->end - repo->start); repomd_add_ext(repo, data, "deltainfo", "DL"); repomd_add_ext(repo, data, "filelists", "FL"); repodata_internalize(data); diff --git a/examples/solv/repoinfo_type_susetags.c b/examples/solv/repoinfo_type_susetags.c index 596171cc..c22c736d 100644 --- a/examples/solv/repoinfo_type_susetags.c +++ b/examples/solv/repoinfo_type_susetags.c @@ -47,7 +47,7 @@ susetags_find(Repo *repo, const char *what, const unsigned char **chksump, Id *c return filename; } -void +static void susetags_add_ext(Repo *repo, Repodata *data) { Pool *pool = repo->pool; @@ -264,6 +264,7 @@ susetags_load(struct repoinfo *cinfo, Pool **sigpoolp) #endif repo_internalize(repo); data = repo_add_repodata(repo, 0); + repodata_extend_block(data, repo->start, repo->end - repo->start); susetags_add_ext(repo, data); repodata_internalize(data); writecachedrepo(cinfo, 0, 0); diff --git a/examples/tclsolv b/examples/tclsolv index 0fc4e2ab..8d855be7 100755 --- a/examples/tclsolv +++ b/examples/tclsolv @@ -260,6 +260,7 @@ proc repo_repomd_add_ext {selfName repodata what ext} { proc repo_repomd_add_exts {selfName} { upvar $selfName self set repodata [$self(handle) add_repodata 0] + $repodata extend_to_repo repo_repomd_add_ext self $repodata "filelists" "FL" $repodata internalize } @@ -383,6 +384,7 @@ proc repo_susetags_add_ext {selfName repodata what ext} { proc repo_susetags_add_exts {selfName} { upvar $selfName self set repodata [$self(handle) add_repodata 0] + $repodata extend_to_repo repo_susetags_add_ext self $repodata "packages.FL" "FL" repo_susetags_add_ext self $repodata "packages.FL.gz" "FL" $repodata internalize