1
0
mirror of https://github.com/openSUSE/libsolv.git synced 2026-02-05 12:45:46 +01:00

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.
This commit is contained in:
Michael Schroeder
2017-05-30 14:45:17 +02:00
parent f9e6068f99
commit 35381634f2
7 changed files with 22 additions and 8 deletions

View File

@@ -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();

View File

@@ -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()

View File

@@ -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()

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);

View File

@@ -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