summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-01-17 12:04:27 +0100
committerMichael Schroeder <mls@suse.de>2012-01-17 12:04:27 +0100
commit2b3c874e5f79881a8c5e97be38d67d18e998d0c9 (patch)
tree3890fe15b547f9caf71e35d05d58a7bcf0173ebc /src
parent370badc5cfbd583854222639170b5d0a743b172d (diff)
downloadlibsolv-2b3c874e5f79881a8c5e97be38d67d18e998d0c9.tar.gz
libsolv-2b3c874e5f79881a8c5e97be38d67d18e998d0c9.tar.bz2
libsolv-2b3c874e5f79881a8c5e97be38d67d18e998d0c9.zip
- add solvable_ setter functions, add solvable_lookup_type/solvable_lookup_deparray
Diffstat (limited to 'src')
-rw-r--r--src/pool.h14
-rw-r--r--src/solvable.c75
-rw-r--r--src/solvable.h39
3 files changed, 110 insertions, 18 deletions
diff --git a/src/pool.h b/src/pool.h
index bd60d9c..8b9997a 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -227,20 +227,6 @@ static inline const char *pool_solvid2str(Pool *pool, Id p)
void pool_set_languages(Pool *pool, const char **languages, int nlanguages);
Id pool_id2langid(Pool *pool, Id id, const char *lang, int create);
-Id solvable_lookup_id(Solvable *s, Id keyname);
-unsigned int solvable_lookup_num(Solvable *s, Id keyname, unsigned int notfound);
-const char *solvable_lookup_str(Solvable *s, Id keyname);
-const char *solvable_lookup_str_poollang(Solvable *s, Id keyname);
-const char *solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang, int usebase);
-int solvable_lookup_bool(Solvable *s, Id keyname);
-int solvable_lookup_void(Solvable *s, Id keyname);
-char * solvable_get_location(Solvable *s, unsigned int *medianrp);
-const unsigned char *solvable_lookup_bin_checksum(Solvable *s, Id keyname, Id *typep);
-const char *solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep);
-int solvable_lookup_idarray(Solvable *s, Id keyname, Queue *q);
-int solvable_identical(Solvable *s1, Solvable *s2);
-Id solvable_selfprovidedep(Solvable *s);
-
int solvable_trivial_installable_map(Solvable *s, Map *installedmap, Map *conflictsmap);
int solvable_trivial_installable_repo(Solvable *s, struct _Repo *installed);
int solvable_trivial_installable_queue(Solvable *s, Queue *installed);
diff --git a/src/solvable.c b/src/solvable.c
index 2747acc..a2d5389 100644
--- a/src/solvable.c
+++ b/src/solvable.c
@@ -36,6 +36,14 @@ pool_solvable2str(Pool *pool, Solvable *s)
}
Id
+solvable_lookup_type(Solvable *s, Id keyname)
+{
+ if (!s->repo)
+ return 0;
+ return repo_lookup_type(s->repo, s - s->repo->pool->solvables, keyname);
+}
+
+Id
solvable_lookup_id(Solvable *s, Id keyname)
{
if (!s->repo)
@@ -54,6 +62,17 @@ solvable_lookup_idarray(Solvable *s, Id keyname, Queue *q)
return repo_lookup_idarray(s->repo, s - s->repo->pool->solvables, keyname, q);
}
+int
+solvable_lookup_deparray(Solvable *s, Id keyname, Queue *q, Id marker)
+{
+ if (!s->repo)
+ {
+ queue_empty(q);
+ return 0;
+ }
+ return repo_lookup_deparray(s->repo, s - s->repo->pool->solvables, keyname, q, marker);
+}
+
const char *
solvable_lookup_str(Solvable *s, Id keyname)
{
@@ -562,3 +581,59 @@ solvable_selfprovidedep(Solvable *s)
}
return pool_rel2id(pool, s->name, s->evr, REL_EQ, 1);
}
+
+/* setter functions, simply call the repo variants */
+void
+solvable_set_id(Solvable *s, Id keyname, Id id)
+{
+ repo_set_num(s->repo, s - s->repo->pool->solvables, keyname, id);
+}
+
+void
+solvable_set_num(Solvable *s, Id keyname, unsigned int num)
+{
+ repo_set_num(s->repo, s - s->repo->pool->solvables, keyname, num);
+}
+
+void
+solvable_set_str(Solvable *s, Id keyname, const char *str)
+{
+ repo_set_str(s->repo, s - s->repo->pool->solvables, keyname, str);
+}
+
+void
+solvable_set_poolstr(Solvable *s, Id keyname, const char *str)
+{
+ repo_set_poolstr(s->repo, s - s->repo->pool->solvables, keyname, str);
+}
+
+void
+solvable_add_poolstr_array(Solvable *s, Id keyname, const char *str)
+{
+ repo_add_poolstr_array(s->repo, s - s->repo->pool->solvables, keyname, str);
+}
+
+void
+solvable_add_idarray(Solvable *s, Id keyname, Id id)
+{
+ repo_add_idarray(s->repo, s - s->repo->pool->solvables, keyname, id);
+}
+
+void
+solvable_add_deparray(Solvable *s, Id keyname, Id dep, Id marker)
+{
+ repo_add_deparray(s->repo, s - s->repo->pool->solvables, keyname, dep, marker);
+}
+
+void
+solvable_set_idarray(Solvable *s, Id keyname, Queue *q)
+{
+ repo_set_idarray(s->repo, s - s->repo->pool->solvables, keyname, q);
+}
+
+void
+solvable_set_deparray(Solvable *s, Id keyname, Queue *q, Id marker)
+{
+ repo_set_deparray(s->repo, s - s->repo->pool->solvables, keyname, q, marker);
+}
+
diff --git a/src/solvable.h b/src/solvable.h
index 583f345..7ecc6cf 100644
--- a/src/solvable.h
+++ b/src/solvable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Novell Inc.
+ * Copyright (c) 2007-2012, Novell Inc.
*
* This program is licensed under the BSD license, read LICENSE.BSD
* for further information
@@ -8,13 +8,15 @@
/*
* solvable.h
*
- * A solvable represents an object with name-epoch:version-release.arch and dependencies
+ * A solvable represents an object with name-epoch:version-release.arch
+ * and dependencies
*/
#ifndef LIBSOLV_SOLVABLE_H
#define LIBSOLV_SOLVABLE_H
#include "pooltypes.h"
+#include "queue.h"
struct _Repo;
@@ -26,8 +28,8 @@ typedef struct _Solvable {
struct _Repo *repo; /* repo we belong to */
- /* dependencies are offsets into idarray of repo */
- Offset provides; /* terminated with Id 0 */
+ /* dependencies are offsets into repo->idarraydata */
+ Offset provides; /* terminated with Id 0 */
Offset obsoletes;
Offset conflicts;
@@ -40,4 +42,33 @@ typedef struct _Solvable {
} Solvable;
+/* lookup functions */
+Id solvable_lookup_type(Solvable *s, Id keyname);
+Id solvable_lookup_id(Solvable *s, Id keyname);
+unsigned int solvable_lookup_num(Solvable *s, Id keyname, unsigned int notfound);
+const char *solvable_lookup_str(Solvable *s, Id keyname);
+const char *solvable_lookup_str_poollang(Solvable *s, Id keyname);
+const char *solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang, int usebase);
+int solvable_lookup_bool(Solvable *s, Id keyname);
+int solvable_lookup_void(Solvable *s, Id keyname);
+char *solvable_get_location(Solvable *s, unsigned int *medianrp);
+const unsigned char *solvable_lookup_bin_checksum(Solvable *s, Id keyname, Id *typep);
+const char *solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep);
+int solvable_lookup_idarray(Solvable *s, Id keyname, Queue *q);
+int solvable_lookup_deparray(Solvable *s, Id keyname, Queue *q, Id marker);
+
+/* setter functions */
+void solvable_set_id(Solvable *s, Id keyname, Id id);
+void solvable_set_num(Solvable *s, Id keyname, unsigned int num);
+void solvable_set_str(Solvable *s, Id keyname, const char *str);
+void solvable_set_poolstr(Solvable *s, Id keyname, const char *str);
+void solvable_add_poolstr_array(Solvable *s, Id keyname, const char *str);
+void solvable_add_idarray(Solvable *s, Id keyname, Id id);
+void solvable_add_deparray(Solvable *s, Id keyname, Id dep, Id marker);
+void solvable_set_idarray(Solvable *s, Id keyname, Queue *q);
+void solvable_set_deparray(Solvable *s, Id keyname, Queue *q, Id marker);
+
+int solvable_identical(Solvable *s1, Solvable *s2);
+Id solvable_selfprovidedep(Solvable *s);
+
#endif /* LIBSOLV_SOLVABLE_H */