]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Add extend_to_repo calls in examples
authorMichael Schroeder <mls@suse.de>
Tue, 30 May 2017 12:45:17 +0000 (14:45 +0200)
committerMichael Schroeder <mls@suse.de>
Tue, 30 May 2017 12:45:17 +0000 (14:45 +0200)
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.

examples/p5solv
examples/pysolv
examples/rbsolv
examples/solv/repoinfo_type_mdk.c
examples/solv/repoinfo_type_rpmmd.c
examples/solv/repoinfo_type_susetags.c
examples/tclsolv

index 0a1dbb0baf40dff2235f351b168a70bd49b97b9b..45debb1ba17588e43e955856696c54313682c0a7 100755 (executable)
@@ -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();
index 3d6ca0714da98e514f6cfc1bb844ff3cdc908d97..891c23713b648e073ec06436a0e2c998ac638d46 100755 (executable)
@@ -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()
index be633f3caf42ef14468b157bf7e1874bf27d0ba4..87f0d16089afa4c05c523e127a05cdf27a620e7d 100755 (executable)
@@ -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()
index 96b005f60ab65c53a4b7119d2feffce066b094ac..69287b3e01d1fcffebb78b6aa6bc523d81ef794f 100644 (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);
index 98c5d36716579cbe3809bc6f58236bc21902961c..2a5cd7fc6622137761716805d5db48e3be840851 100644 (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);
index 596171cc1fb7f64b9f6c2f69221bf38454476e96..c22c736d30dc4f0a21410225bb8bda21326bc9eb 100644 (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);
index 0fc4e2ab399f3acd39c05825d5f372517112cf90..8d855be790e6175686f6155172fc8b5a190c995b 100755 (executable)
@@ -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