summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-11-05 12:01:30 +0100
committerMichael Schroeder <mls@suse.de>2012-11-05 12:01:30 +0100
commit2aa24b2f3bda114f68e693da0bbe9581c34118f6 (patch)
treef0fafa4d8e0830715b97040c8299f92ed90eb01b
parent60db387f9f9843f57d79566df4033a480b6f71bb (diff)
downloadlibsolv-2aa24b2f3bda114f68e693da0bbe9581c34118f6.tar.gz
libsolv-2aa24b2f3bda114f68e693da0bbe9581c34118f6.tar.bz2
libsolv-2aa24b2f3bda114f68e693da0bbe9581c34118f6.zip
Add Solvable.Dataiterator constructor, add missing SEARCH_ definitions, add Datamatch.__str__ method
Also autostringfy if SEARCH_FILES is used and there is no matcher.
-rw-r--r--bindings/solv.i21
-rw-r--r--src/repodata.c5
2 files changed, 23 insertions, 3 deletions
diff --git a/bindings/solv.i b/bindings/solv.i
index 04bb30a..c4202b2 100644
--- a/bindings/solv.i
+++ b/bindings/solv.i
@@ -522,6 +522,10 @@ typedef struct {
Id const id;
} Dep;
+# put before pool/repo so we can access the constructor
+%nodefaultdtor Dataiterator;
+typedef struct {} Dataiterator;
+
typedef struct {
Pool* const pool;
Id const id;
@@ -543,9 +547,6 @@ typedef struct {
Id const id;
} XRepodata;
-# put before pool/repo so we can access the constructor
-%nodefaultdtor Dataiterator;
-typedef struct {} Dataiterator;
typedef struct {} Pool_solvable_iterator;
typedef struct {} Pool_repo_iterator;
typedef struct {} Repo_solvable_iterator;
@@ -1446,6 +1447,8 @@ typedef struct {
%extend Dataiterator {
static const int SEARCH_STRING = SEARCH_STRING;
+ static const int SEARCH_STRINGSTART = SEARCH_STRINGSTART;
+ static const int SEARCH_STRINGEND = SEARCH_STRINGEND;
static const int SEARCH_SUBSTRING = SEARCH_SUBSTRING;
static const int SEARCH_GLOB = SEARCH_GLOB;
static const int SEARCH_REGEX = SEARCH_REGEX;
@@ -1629,6 +1632,14 @@ typedef struct {
void setpos_parent() {
dataiterator_setpos_parent($self);
}
+#if defined(SWIGPERL)
+ %rename("str") __str__;
+#endif
+ const char *__str__() {
+ if (!repodata_stringify($self->pool, $self->data, $self->key, &$self->kv, $self->flags))
+ return "";
+ return $self->kv.str;
+ }
}
%extend Pool_solvable_iterator {
@@ -1901,6 +1912,10 @@ typedef struct {
const char *lookup_location(unsigned int *OUTPUT) {
return solvable_lookup_location($self->pool->solvables + $self->id, OUTPUT);
}
+ %newobject Dataiterator;
+ Dataiterator *Dataiterator(Id key, const char *match, int flags) {
+ return new_Dataiterator($self->pool, 0, $self->id, key, match, flags);
+ }
#ifdef SWIGRUBY
%rename("installable?") installable;
#endif
diff --git a/src/repodata.c b/src/repodata.c
index d64a00b..520984c 100644
--- a/src/repodata.c
+++ b/src/repodata.c
@@ -1593,6 +1593,11 @@ dataiterator_step(Dataiterator *di)
if (!datamatcher_match(&di->matcher, di->kv.str))
continue;
}
+ else
+ {
+ if (di->keyname == SOLVABLE_FILELIST && di->key->type == REPOKEY_TYPE_DIRSTRARRAY && (di->flags & SEARCH_FILES) != 0)
+ repodata_stringify(di->pool, di->data, di->key, &di->kv, di->flags);
+ }
/* found something! */
return 1;
}