]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
example solvers: bugfixing & refactoring
authorMichael Schroeder <mls@suse.de>
Wed, 26 Aug 2015 15:35:40 +0000 (17:35 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 26 Aug 2015 15:35:40 +0000 (17:35 +0200)
examples/p5solv
examples/pysolv
examples/rbsolv
examples/tclsolv

index 6759bab9b6e9a1104c4d37ba16ff97ef76152227..4cc5455cfd0789257c76fd7457d987aaf02958b6 100755 (executable)
@@ -145,7 +145,7 @@ sub usecachedrepo {
 }
 
 sub writecachedrepo {
-  my ($self, $ext, $info) = @_;
+  my ($self, $ext, $repodata) = @_;
   return if $self->{incomplete};
   mkdir("/var/cache/solv", 0755) unless -d "/var/cache/solv";
   my ($f, $tmpname);
@@ -155,10 +155,10 @@ sub writecachedrepo {
   return unless $f;
   chmod 0444, $f;
   my $ff = solv::xfopen_fd(undef, fileno($f));
-  if (!$info) {
+  if (!$repodata) {
     $self->{handle}->write($ff);
   } elsif ($ext) {
-    $info->write($ff);
+    $repodata->write($ff);
   } else {
      $self->{handle}->write_first_repodata($ff);
   }
@@ -174,12 +174,12 @@ sub writecachedrepo {
     if ($f) {
       if (!$ext) {
        $self->{handle}->empty();
-       die("internal error, cannot reload solv file\n") unless $self->{handle}->add_solv($f, $solv::Repo::SOLV_ADD_NO_STUBS);
+       die("internal error, cannot reload solv file\n") unless $self->{handle}->add_solv($f, $repodata ? 0 : $solv::Repo::SOLV_ADD_NO_STUBS);
       } else {
-       $info->extend_to_repo();
+       $repodata->extend_to_repo();
        my $flags = $solv::Repo::REPO_EXTEND_SOLVABLES;
        $flags |= $solv::Repo::REPO_LOCALPOOL if $ext ne 'DL';
-       $info->add_solv($f, $flags);
+       $repodata->add_solv($f, $flags);
       }
     }
   }
@@ -191,6 +191,34 @@ sub packagespath {
   return '';
 }
 
+my %langtags = (
+  $solv::SOLVABLE_SUMMARY     => $solv::REPOKEY_TYPE_STR,
+  $solv::SOLVABLE_DESCRIPTION => $solv::REPOKEY_TYPE_STR,
+  $solv::SOLVABLE_EULA        => $solv::REPOKEY_TYPE_STR,
+  $solv::SOLVABLE_MESSAGEINS  => $solv::REPOKEY_TYPE_STR,
+  $solv::SOLVABLE_MESSAGEDEL  => $solv::REPOKEY_TYPE_STR,
+  $solv::SOLVABLE_CATEGORY    => $solv::REPOKEY_TYPE_ID,
+);
+
+sub add_ext_keys {
+  my ($self, $ext, $repodata, $handle) = @_;
+  if ($ext eq 'DL') {
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOSITORY_DELTAINFO);
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_FLEXARRAY);
+  } elsif ($ext eq 'DU') {
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::SOLVABLE_DISKUSAGE);
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_DIRNUMNUMARRAY);
+  } elsif ($ext eq 'FL') {
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::SOLVABLE_FILELIST);
+    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_DIRSTRARRAY);
+  } else {
+    for my $langid (sort { $a <=> $b } keys %langtags) {
+      $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $self->{handle}->{pool}->id2langid($langid, $ext, 1));
+      $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $langtags{$langid});
+    }
+  }
+}
+
 package Repo::rpmmd;
 
 our @ISA = ('Repo::generic');
@@ -222,13 +250,7 @@ sub add_ext {
   $repodata->set_poolstr($handle, $solv::REPOSITORY_REPOMD_TYPE, $what);
   $repodata->set_str($handle, $solv::REPOSITORY_REPOMD_LOCATION, $filename);
   $repodata->set_checksum($handle, $solv::REPOSITORY_REPOMD_CHECKSUM, $chksum);
-  if ($ext eq 'DL') {
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOSITORY_DELTAINFO);
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_FLEXARRAY);
-  } elsif ($ext eq 'FL') {
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::SOLVABLE_FILELIST);
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_DIRSTRARRAY);
-  }
+  $self->add_ext_keys($ext, $repodata, $handle);
   $repodata->add_flexarray($solv::SOLVID_META, $solv::REPOSITORY_EXTERNAL, $handle);
 }
 
@@ -328,14 +350,6 @@ sub find {
   return (undef, undef);
 }
 
-my %langtags = (
-  $solv::SOLVABLE_SUMMARY     => $solv::REPOKEY_TYPE_STR,
-  $solv::SOLVABLE_DESCRIPTION => $solv::REPOKEY_TYPE_STR,
-  $solv::SOLVABLE_EULA        => $solv::REPOKEY_TYPE_STR,
-  $solv::SOLVABLE_MESSAGEINS  => $solv::REPOKEY_TYPE_STR,
-  $solv::SOLVABLE_MESSAGEDEL  => $solv::REPOKEY_TYPE_STR,
-  $solv::SOLVABLE_CATEGORY    => $solv::REPOKEY_TYPE_ID,
-);
 
 sub add_ext {
   my ($self, $repodata, $what, $ext) = @_;
@@ -344,21 +358,7 @@ sub add_ext {
   my $handle = $repodata->new_handle();
   $repodata->set_str($handle, $solv::SUSETAGS_FILE_NAME, $filename);
   $repodata->set_checksum($handle, $solv::SUSETAGS_FILE_CHECKSUM, $chksum);
-  if ($ext eq 'DL') {
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOSITORY_DELTAINFO);
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_FLEXARRAY);
-  } elsif ($ext eq 'DU') {
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::SOLVABLE_DISKUSAGE);
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_DIRNUMNUMARRAY);
-  } elsif ($ext eq 'FL') {
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::SOLVABLE_FILELIST);
-    $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $solv::REPOKEY_TYPE_DIRSTRARRAY);
-  } else {
-    for my $langid (sort { $a <=> $b } keys %langtags) {
-      $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $self->{handle}->{pool}->id2langid($langid, $ext, 1));
-      $repodata->add_idarray($handle, $solv::REPOSITORY_KEYS, $langtags{$langid});
-    }
-  }
+  $self->add_ext_keys($ext, $repodata, $handle);
   $repodata->add_flexarray($solv::SOLVID_META, $solv::REPOSITORY_EXTERNAL, $handle);
 }
 
index b30cd4f0dc983e1b202079304336f9c4d06d7e16..bdc568a45eebdb650df6d5140103ad6140fc02e3 100755 (executable)
@@ -76,7 +76,7 @@ class repo_generic(dict):
         else:
             # compatibility to c code
             if ord(extcookie[0]) == 0:
-                extcookie[0] = chr(1)
+                extcookie = chr(1) + extcookie[1:]
         return extcookie
 
     def cachepath(self, ext = None):
@@ -237,7 +237,7 @@ class repo_generic(dict):
             return False
         return True
 
-    def writecachedrepo(self, ext, info=None):
+    def writecachedrepo(self, ext, repodata=None):
         if 'incomplete' in self:
             return
         tmpname = None
@@ -248,21 +248,21 @@ class repo_generic(dict):
             os.fchmod(fd, 0o444)
             f = os.fdopen(fd, 'wb+')
             f = solv.xfopen_fd(None, f.fileno())
-            if not info:
+            if not repodata:
                 self.handle.write(f)
             elif ext:
-                info.write(f)
-            else:       # rewrite_repos case
+                repodata.write(f)
+            else:       # rewrite_repos case, do not write stubs
                 self.handle.write_first_repodata(f)
             f.flush()
             if self.type != 'system' and not ext:
                 if 'extcookie' not in self:
                     self['extcookie'] = self.calc_cookie_ext(f, self['cookie'])
-                os.write(f.fileno(), self['extcookie'])
+                f.write(self['extcookie'])
             if not ext:
-                os.write(f.fileno(), self['cookie'])
+                f.write(self['cookie'])
             else:
-                os.write(f.fileno(), self['extcookie'])
+                f.write(self['extcookie'])
             f.close
             if self.handle.iscontiguous():
                 # switch to saved repo to activate paging and save memory
@@ -270,17 +270,20 @@ class repo_generic(dict):
                 if not ext:
                     # main repo
                     self.handle.empty()
-                    if not self.handle.add_solv(nf, solv.Repo.SOLV_ADD_NO_STUBS):
+                    flags = solv.Repo.SOLV_ADD_NO_STUBS
+                    if repodata:
+                        flags = 0       # rewrite repos case, recreate stubs
+                    if not self.handle.add_solv(nf, flags):
                         sys.exit("internal error, cannot reload solv file")
                 else:
                     # extension repodata
                     # need to extend to repo boundaries, as this is how
-                    # info.write() has written the data
-                    info.extend_to_repo()
+                    # repodata.write() has written the data
+                    repodata.extend_to_repo()
                     flags = solv.Repo.REPO_EXTEND_SOLVABLES
                     if ext != 'DL':
                         flags |= solv.Repo.REPO_LOCALPOOL
-                    info.add_solv(nf, flags)
+                    repodata.add_solv(nf, flags)
             os.rename(tmpname, self.cachepath(ext))
         except (OSError, IOError):
             if tmpname:
@@ -307,6 +310,26 @@ class repo_generic(dict):
     def packagespath(self):
         return ''
 
+    def add_ext_keys(self, ext, repodata, handle):
+        if ext == 'DU':
+            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.SOLVABLE_DISKUSAGE)
+            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_DIRNUMNUMARRAY)
+        elif ext == 'FL':
+            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.SOLVABLE_FILELIST)
+            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_DIRSTRARRAY)
+        else:
+            for langtag, langtagtype in [
+                (solv.SOLVABLE_SUMMARY, solv.REPOKEY_TYPE_STR),
+                (solv.SOLVABLE_DESCRIPTION, solv.REPOKEY_TYPE_STR),
+                (solv.SOLVABLE_EULA, solv.REPOKEY_TYPE_STR),
+                (solv.SOLVABLE_MESSAGEINS, solv.REPOKEY_TYPE_STR),
+                (solv.SOLVABLE_MESSAGEDEL, solv.REPOKEY_TYPE_STR),
+                (solv.SOLVABLE_CATEGORY, solv.REPOKEY_TYPE_ID)
+            ]:
+                repodata.add_idarray(handle, solv.REPOSITORY_KEYS, self.handle.pool.id2langid(langtag, ext, 1))
+                repodata.add_idarray(handle, solv.REPOSITORY_KEYS, langtagtype)
+        
+
 class repo_repomd(repo_generic):
     def load(self, pool):
         if super(repo_repomd, self).load(pool):
@@ -368,12 +391,7 @@ class repo_repomd(repo_generic):
         repodata.set_poolstr(handle, solv.REPOSITORY_REPOMD_TYPE, what)
         repodata.set_str(handle, solv.REPOSITORY_REPOMD_LOCATION, filename)
         repodata.set_checksum(handle, solv.REPOSITORY_REPOMD_CHECKSUM, chksum)
-        if ext == 'DL':
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOSITORY_DELTAINFO)
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_FLEXARRAY)
-        elif ext == 'FL':
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.SOLVABLE_FILELIST)
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_DIRSTRARRAY)
+        self.add_ext_keys(ext, repodata, handle)
         repodata.add_flexarray(solv.SOLVID_META, solv.REPOSITORY_EXTERNAL, handle)
 
     def add_exts(self):
@@ -469,23 +487,7 @@ class repo_susetags(repo_generic):
         repodata.set_str(handle, solv.SUSETAGS_FILE_NAME, filename)
         if chksum:
             repodata.set_checksum(handle, solv.SUSETAGS_FILE_CHECKSUM, chksum)
-        if ext == 'DU':
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.SOLVABLE_DISKUSAGE)
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_DIRNUMNUMARRAY)
-        elif ext == 'FL':
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.SOLVABLE_FILELIST)
-            repodata.add_idarray(handle, solv.REPOSITORY_KEYS, solv.REPOKEY_TYPE_DIRSTRARRAY)
-        else:
-            for langtag, langtagtype in [
-                (solv.SOLVABLE_SUMMARY, solv.REPOKEY_TYPE_STR),
-                (solv.SOLVABLE_DESCRIPTION, solv.REPOKEY_TYPE_STR),
-                (solv.SOLVABLE_EULA, solv.REPOKEY_TYPE_STR),
-                (solv.SOLVABLE_MESSAGEINS, solv.REPOKEY_TYPE_STR),
-                (solv.SOLVABLE_MESSAGEDEL, solv.REPOKEY_TYPE_STR),
-                (solv.SOLVABLE_CATEGORY, solv.REPOKEY_TYPE_ID)
-            ]:
-                repodata.add_idarray(handle, solv.REPOSITORY_KEYS, self.handle.pool.id2langid(langtag, ext, 1))
-                repodata.add_idarray(handle, solv.REPOSITORY_KEYS, langtagtype)
+        self.add_ext_keys(ext, repodata, handle)
         repodata.add_flexarray(solv.SOLVID_META, solv.REPOSITORY_EXTERNAL, handle)
         
     def add_exts(self):
index fb41bc48f255ed53a8ed20575fa9f3af13339fbd..a01ad4819f306a6cf4a0d553b76398fa9a2a0e99 100755 (executable)
@@ -152,17 +152,17 @@ class Repo_generic
     return true
   end
 
-  def writecachedrepo(ext, info = nil)
+  def writecachedrepo(ext, repodata = nil)
     return if @incomplete
     begin
       Dir::mkdir("/var/cache/solv", 0755) unless FileTest.directory?("/var/cache/solv")
       f =  Tempfile.new('.newsolv-', '/var/cache/solv')
       f.chmod(0444)
       sf = Solv::xfopen_fd('', f.fileno)
-      if !info
+      if !repodata
        @handle.write(sf)
       elsif ext
-       info.write(sf)
+       repodata.write(sf)
       else
        @handle.write_first_repodata(sf)
       end
@@ -179,12 +179,12 @@ class Repo_generic
        if sf
          if !ext
            @handle.empty()
-           abort("internal error, cannot reload solv file") unless @handle.add_solv(sf, Solv::Repo::SOLV_ADD_NO_STUBS)
+           abort("internal error, cannot reload solv file") unless @handle.add_solv(sf, repodata ? 0 : Solv::Repo::SOLV_ADD_NO_STUBS)
          else
-           info.extend_to_repo()
+           repodata.extend_to_repo()
            flags = Solv::Repo::REPO_EXTEND_SOLVABLES
            flags |= Solv::Repo::REPO_LOCALPOOL if ext != 'DL'
-           info.add_solv(sf, flags)
+           repodata.add_solv(sf, flags)
          end
          sf.close
        end
@@ -214,6 +214,33 @@ class Repo_generic
   def packagespath()
     return ''
   end
+
+  @@langtags = {
+    Solv::SOLVABLE_SUMMARY     => Solv::REPOKEY_TYPE_STR,
+    Solv::SOLVABLE_DESCRIPTION => Solv::REPOKEY_TYPE_STR,
+    Solv::SOLVABLE_EULA        => Solv::REPOKEY_TYPE_STR,
+    Solv::SOLVABLE_MESSAGEINS  => Solv::REPOKEY_TYPE_STR,
+    Solv::SOLVABLE_MESSAGEDEL  => Solv::REPOKEY_TYPE_STR,
+    Solv::SOLVABLE_CATEGORY    => Solv::REPOKEY_TYPE_ID,
+  }
+
+  def add_ext_keys(ext, repodata, h)
+    if ext == 'DL'
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOSITORY_DELTAINFO)
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_FLEXARRAY)
+    elsif ext == 'DU'
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::SOLVABLE_DISKUSAGE)
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_DIRNUMNUMARRAY)
+    elsif ext == 'FL'
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::SOLVABLE_FILELIST)
+      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_DIRSTRARRAY)
+    else
+      @@langtags.sort.each do |langid, langtype|
+       repodata.add_idarray(h, Solv::REPOSITORY_KEYS, @handle.pool.id2langid(langid, ext, true))
+       repodata.add_idarray(h, Solv::REPOSITORY_KEYS, langtype)
+      end
+    end
+  end
 end
 
 class Repo_rpmmd < Repo_generic
@@ -285,13 +312,7 @@ class Repo_rpmmd < Repo_generic
     repodata.set_poolstr(h, Solv::REPOSITORY_REPOMD_TYPE, what)
     repodata.set_str(h, Solv::REPOSITORY_REPOMD_LOCATION, filename)
     repodata.set_checksum(h, Solv::REPOSITORY_REPOMD_CHECKSUM, filechksum)
-    if ext == 'DL'
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOSITORY_DELTAINFO)
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_FLEXARRAY)
-    elsif ext == 'FL'
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::SOLVABLE_FILELIST)
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_DIRSTRARRAY)
-    end
+    add_ext_keys(ext, repodata, h)
     repodata.add_flexarray(Solv::SOLVID_META, Solv::REPOSITORY_EXTERNAL, h)
   end
 
@@ -394,35 +415,12 @@ class Repo_susetags < Repo_generic
     return true
   end
 
-  @@langtags = {
-    Solv::SOLVABLE_SUMMARY     => Solv::REPOKEY_TYPE_STR,
-    Solv::SOLVABLE_DESCRIPTION => Solv::REPOKEY_TYPE_STR,
-    Solv::SOLVABLE_EULA        => Solv::REPOKEY_TYPE_STR,
-    Solv::SOLVABLE_MESSAGEINS  => Solv::REPOKEY_TYPE_STR,
-    Solv::SOLVABLE_MESSAGEDEL  => Solv::REPOKEY_TYPE_STR,
-    Solv::SOLVABLE_CATEGORY    => Solv::REPOKEY_TYPE_ID,
-  }
-
   def add_ext(repodata, what, ext)
     (filename, filechksum) = find(what)
     h = repodata.new_handle()
     repodata.set_str(h, Solv::SUSETAGS_FILE_NAME, filename)
     repodata.set_checksum(h, Solv::SUSETAGS_FILE_CHECKSUM, filechksum)
-    if ext == 'DL'
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOSITORY_DELTAINFO)
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_FLEXARRAY)
-    elsif ext == 'DU'
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::SOLVABLE_DISKUSAGE)
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_DIRNUMNUMARRAY)
-    elsif ext == 'FL'
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::SOLVABLE_FILELIST)
-      repodata.add_idarray(h, Solv::REPOSITORY_KEYS, Solv::REPOKEY_TYPE_DIRSTRARRAY)
-    else
-      @@langtags.sort.each do |langid, langtype|
-       repodata.add_idarray(h, Solv::REPOSITORY_KEYS, @handle.pool.id2langid(langid, ext, true))
-       repodata.add_idarray(h, Solv::REPOSITORY_KEYS, langtype)
-      end
-    end
+    add_ext_keys(ext, repodata, h)
     repodata.add_flexarray(Solv::SOLVID_META, Solv::REPOSITORY_EXTERNAL, h)
   end
 
@@ -494,7 +492,7 @@ class Repo_system < Repo_generic
     end
     f = Solv::xfopen(cachepath())
     @handle.add_rpmdb_reffp(f, Solv::Repo::REPO_REUSE_REPODATA)
-    f.close
+    f.close if f
     writecachedrepo(nil)
     return true
   end
index 3f222ee51e2e67a1c2c2dc91afcb07298a13da8c..342d61191c25303c2a90e98cc30afe91e4673c3f 100755 (executable)
@@ -204,7 +204,7 @@ proc repo_download {selfName file uncompress chksum {markincomplete 0}} {
   return $ff
 }
 
-proc repo_generic_add_ext_key {selfName repodata h ext} {
+proc repo_generic_add_ext_keys {selfName ext repodata h} {
   upvar $selfName self
   if {$ext eq "DL"} {
     $repodata add_idarray $h $solv::REPOSITORY_KEYS $solv::REPOSITORY_DELTAINFO
@@ -247,7 +247,7 @@ proc repo_repomd_add_ext {selfName repodata what ext} {
   $repodata set_poolstr $h $solv::REPOSITORY_REPOMD_TYPE $what
   $repodata set_str $h $solv::REPOSITORY_REPOMD_LOCATION [lindex $where 0]
   $repodata set_checksum $h $solv::REPOSITORY_REPOMD_CHECKSUM [lindex $where 1]
-  repo_generic_add_ext_key self $repodata $h $ext
+  repo_generic_add_ext_keys self $ext $repodata $h
   $repodata add_flexarray $solv::SOLVID_META $solv::REPOSITORY_EXTERNAL $h
 }
 
@@ -288,7 +288,7 @@ proc repo_repomd_load {selfName pool} {
     return 0
   }
   set self(cookie) [repo_calc_cookie_fp self $f]
-  if [repo_usecachedrepo self] {
+  if [repo_usecachedrepo self "-" 1] {
     puts "cached"
     return 1
   }
@@ -370,7 +370,7 @@ proc repo_susetags_add_ext {selfName repodata what ext} {
   set h [$repodata new_handle]
   $repodata set_str $h $solv::SUSETAGS_FILE_NAME [lindex $where 0]
   $repodata set_checksum $h $solv::SUSETAGS_FILE_CHECKSUM [lindex $where 1]
-  repo_generic_add_ext_key self $repodata $h $ext
+  repo_generic_add_ext_keys self $ext $repodata $h
   $repodata add_flexarray $solv::SOLVID_META $solv::REPOSITORY_EXTERNAL $h
 }
 
@@ -407,7 +407,7 @@ proc repo_susetags_load {selfName pool} {
     return 0
   }
   set self(cookie) [repo_calc_cookie_fp self $f]
-  if [repo_usecachedrepo self] {
+  if [repo_usecachedrepo self "-" 1] {
     puts "cached"
     return 1
   }