I promised this to Jano; skipping kinds in matcher when a flag is specified.
authorMichael Matz <matz@suse.de>
Sun, 27 Apr 2008 18:32:40 +0000 (18:32 +0000)
committerMichael Matz <matz@suse.de>
Sun, 27 Apr 2008 18:32:40 +0000 (18:32 +0000)
src/repo.h
src/repodata.c

index 5eebed5..f56d7ad 100644 (file)
@@ -157,6 +157,7 @@ typedef struct _KeyValue {
 #define        SEARCH_NO_STORAGE_SOLVABLE      (1<<9)
 #define SEARCH_EXTRA                   (1<<10)
 #define SEARCH_ALL_REPOS               (1<<11)
+#define SEARCH_SKIP_KIND               (1<<12)
 
 /* Internal */
 #define __SEARCH_ONESOLVABLE           (1 << 31)
index 803154c..910bfe8 100644 (file)
@@ -770,6 +770,15 @@ dataiterator_match_int_real(Dataiterator *di, int flags, const void *vmatch)
        default:
          return 0;
        }
+      /* Maybe skip the kind specifier.  Do this only for SOLVABLE attributes,
+         for the others we can't know if a colon separates a kind or not.  */
+      if ((flags & SEARCH_SKIP_KIND)
+         && di->key->storage == KEY_STORAGE_SOLVABLE)
+       {
+         const char *s = strchr(kv->str, ':');
+         if (s)
+           kv->str = s + 1;
+       }
       switch ((flags & SEARCH_STRINGMASK))
        {
          case SEARCH_SUBSTRING: