2 # WARNING: for perl iterator/array support you need to run
3 # sed -i -e 's/SvTYPE(tsv) == SVt_PVHV/SvTYPE(tsv) == SVt_PVHV || SvTYPE(tsv) == SVt_PVAV/'
4 # on the generated c code
9 # %rename("to_s") string();
11 ##if defined(SWIGPYTHON)
12 # %rename("__str__") string();
19 %markfunc Pool "mark_Pool";
22 #if defined(SWIGPYTHON)
24 /* Check if is a list */
26 if (PyList_Check($input)) {
27 int size = PyList_Size($input);
29 for (i = 0; i < size; i++) {
30 PyObject *o = PyList_GetItem($input,i);
32 int e = SWIG_AsVal_int(o, &v);
34 SWIG_exception_fail(SWIG_ArgError(e), "list must contain only integers");
41 PyErr_SetString(PyExc_TypeError,"not a list");
48 PyObject *o = PyList_New($1.count);
49 for (i = 0; i < $1.count; i++)
50 PyList_SetItem(o, i, SWIG_From_int($1.elements[i]));
55 %define Queue2Array(type, step, con) %{
57 int cnt = $1.count / step;
58 Id *idp = $1.elements;
59 PyObject *o = PyList_New(cnt);
60 for (i = 0; i < cnt; i++, idp += step)
63 #define result resultx
66 PyList_SetItem(o, i, $result);
83 if (!SvROK($input) || SvTYPE(SvRV($input)) != SVt_PVAV)
84 SWIG_croak("Argument $argnum is not an array reference.");
85 av = (AV*)SvRV($input);
87 for (i = 0; i <= size; i++) {
88 SV **sv = av_fetch(av, i, 0);
90 int e = SWIG_AsVal_int(*sv, &v);
92 SWIG_croak("list must contain only integers");
98 # av_push(o, SvREFCNT_inc(SWIG_From_int($1.elements[i])));
99 # $result = newRV_noinc((SV*)o); argvi++;
101 %typemap(out) Queue {
103 if (argvi + $1.count + 1>= items) {
104 EXTEND(sp, items - (argvi + $1.count + 1) + 1);
106 for (i = 0; i < $1.count; i++)
107 ST(argvi++) = SvREFCNT_inc(SWIG_From_int($1.elements[i]));
111 %define Queue2Array(type, step, con) %{
113 int cnt = $1.count / step;
114 Id *idp = $1.elements;
115 if (argvi + cnt + 1 >= items) {
116 EXTEND(sp, items - (argvi + cnt + 1) + 1);
118 for (i = 0; i < cnt; i++, idp += step)
121 #define result resultx
124 SvREFCNT_inc(ST(argvi - 1));
134 %typemap(arginit) Queue {
137 %typemap(freearg) Queue {
141 #if defined(SWIGRUBY)
146 size = RARRAY($input)->len;
148 o = RARRAY($input)->ptr;
149 for (i = 0; i < size; i++, o++) {
151 int e = SWIG_AsVal_int(*o, &v);
154 SWIG_Error(SWIG_RuntimeError, "list must contain only integers");
160 %typemap(out) Queue {
162 VALUE o = rb_ary_new2($1.count);
163 for (i = 0; i < $1.count; i++)
164 rb_ary_store(o, i, SWIG_From_int($1.elements[i]));
168 %typemap(arginit) Queue {
171 %typemap(freearg) Queue {
174 %define Queue2Array(type, step, con) %{
176 int cnt = $1.count / step;
177 Id *idp = $1.elements;
178 VALUE o = rb_ary_new2(cnt);
179 for (i = 0; i < cnt; i++, idp += step)
182 #define result resultx
185 rb_ary_store(o, i, $result);
197 #if defined(SWIGPERL)
199 # work around a swig bug
203 # define SWIG_CALLXS(_name) TOPMARK=MARK-PL_stack_base;_name(cv,pPerl)
205 # ifndef MULTIPLICITY
206 # define SWIG_CALLXS(_name) TOPMARK=MARK-PL_stack_base;_name(cv)
208 # define SWIG_CALLXS(_name) TOPMARK=MARK-PL_stack_base;_name(PERL_GET_THX, cv)
214 %define perliter(class)
217 my $i = ${##class##::ITERATORS}{$_[0]};
219 $_[1] == $i->[0] - 1 ? $i->[1] : undef;
221 $_[0]->__getitem__($_[1]);
224 sub class##::FETCHSIZE {
225 my $i = ${##class##::ITERATORS}{$_[0]};
227 ($i->[1] = $_[0]->__next__()) ? ++$i->[0] : 0;
237 #define SWIG_PERL_ITERATOR 0x80
239 SWIGRUNTIMEINLINE SV *
240 SWIG_Perl_NewArrayObj(SWIG_MAYBE_PERL_OBJECT void *ptr, swig_type_info *t, int flags) {
241 SV *result = sv_newmortal();
242 if (ptr && (flags & (SWIG_SHADOW | SWIG_POINTER_OWN))) {
247 sv_setref_pv(obj, (char *) SWIG_Perl_TypeProxyName(t), ptr);
248 stash=SvSTASH(SvRV(obj));
249 if (flags & SWIG_POINTER_OWN) {
251 GV *gv=*(GV**)hv_fetch(stash, "OWNER", 5, TRUE);
253 gv_init(gv, stash, "OWNER", 5, FALSE);
255 hv_store_ent(hv, obj, newSViv(1), 0);
257 if (flags & SWIG_PERL_ITERATOR) {
259 GV *gv=*(GV**)hv_fetch(stash, "ITERATORS", 9, TRUE);
262 gv_init(gv, stash, "ITERATORS", 9, FALSE);
264 hv_store_ent(hv, obj, newRV_inc((SV *)av), 0);
266 sv_magic((SV *)array, (SV *)obj, 'P', Nullch, 0);
268 self=newRV_noinc((SV *)array);
269 sv_setsv(result, self);
270 SvREFCNT_dec((SV *)self);
271 sv_bless(result, stash);
273 sv_setref_pv(result, (char *) SWIG_Perl_TypeProxyName(t), ptr);
280 %typemap(out) Perlarray {
281 ST(argvi) = SWIG_Perl_NewArrayObj(SWIG_PERL_OBJECT_CALL SWIG_as_voidptr(result), $1_descriptor, $owner | $shadow); argvi++;
283 %typemap(out) Perliterator {
284 ST(argvi) = SWIG_Perl_NewArrayObj(SWIG_PERL_OBJECT_CALL SWIG_as_voidptr(result), $1_descriptor, $owner | $shadow | SWIG_PERL_ITERATOR); argvi++;
287 %typemap(out) Pool_solvable_iterator * = Perlarray;
288 %typemap(out) Pool_solvable_iterator * solvables_iter = Perliterator;
289 %typemap(out) Pool_repo_iterator * = Perlarray;
290 %typemap(out) Pool_repo_iterator * repos_iter = Perliterator;
291 %typemap(out) Repo_solvable_iterator * = Perlarray;
292 %typemap(out) Repo_solvable_iterator * solvables_iter = Perliterator;
293 %typemap(out) Dataiterator * = Perliterator;
299 #if defined(SWIGPYTHON)
300 typedef PyObject *AppObjectPtr;
301 %typemap(out) AppObjectPtr {
306 #if defined(SWIGPERL)
307 typedef SV *AppObjectPtr;
308 %typemap(in) AppObjectPtr {
309 $1 = SvROK($input) ? SvRV($input) : 0;
311 %typemap(out) AppObjectPtr {
312 $result = $1 ? newRV_inc($1) : newSV(0);
316 #if defined(SWIGRUBY)
317 typedef VALUE AppObjectPtr;
318 %typemap(in) AppObjectPtr {
321 %typemap(out) AppObjectPtr {
331 %include "typemaps.i"
335 #include <sys/stat.h>
336 #include <sys/types.h>
340 #include "poolarch.h"
343 #include "solverdebug.h"
344 #include "repo_solv.h"
347 #include "repo_write.h"
349 #include "repo_rpmdb.h"
352 #include "repo_deb.h"
355 #include "repo_rpmmd.h"
356 #include "repo_updateinfoxml.h"
357 #include "repo_deltainfoxml.h"
358 #include "repo_repomdxml.h"
360 #ifdef ENABLE_SUSEREPO
361 #include "repo_products.h"
362 #include "repo_susetags.h"
363 #include "repo_content.h"
365 #include "solv_xfopen.h"
370 #define SOLVER_SOLUTION_ERASE -100
371 #define SOLVER_SOLUTION_REPLACE -101
372 #define SOLVER_SOLUTION_REPLACE_DOWNGRADE -102
373 #define SOLVER_SOLUTION_REPLACE_ARCHCHANGE -103
374 #define SOLVER_SOLUTION_REPLACE_VENDORCHANGE -104
376 typedef struct chksum Chksum;
378 typedef void *AppObjectPtr;
403 } Pool_solvable_iterator;
408 } Pool_repo_iterator;
413 } Repo_solvable_iterator;
453 Transaction *transaction;
461 typedef Dataiterator Datamatch;
466 %mixin Dataiterator "Enumerable";
467 %mixin Pool_solvable_iterator "Enumerable";
468 %mixin Pool_repo_iterator "Enumerable";
469 %mixin Repo_solvable_iterator "Enumerable";
477 %constant Id SOLVID_META;
478 %constant Id SOLVID_POS;
480 %constant int REL_EQ;
481 %constant int REL_GT;
482 %constant int REL_LT;
483 %constant int REL_ARCH;
511 # put before pool/repo so we can access the constructor
512 %nodefaultdtor Dataiterator;
513 typedef struct {} Dataiterator;
514 typedef struct {} Pool_solvable_iterator;
515 typedef struct {} Pool_repo_iterator;
516 typedef struct {} Repo_solvable_iterator;
518 %nodefaultctor Datamatch;
519 %nodefaultdtor Datamatch;
526 %nodefaultctor Datapos;
540 AppObjectPtr appdata;
545 typedef struct _Repo {
547 const char * const name;
550 int const nsolvables;
551 AppObjectPtr appdata;
554 %nodefaultctor Solver;
555 %nodefaultdtor Solver;
560 typedef struct chksum {
563 %rename(xfopen) solv_xfopen;
564 %rename(xfopen_fd) solv_xfopen_fd;
565 %rename(xfopen_dup) solv_xfopen_dup;
566 %rename(xfclose) solv_xfclose;
567 %rename(xfileno) solv_xfileno;
569 FILE *solv_xfopen(const char *fn, const char *mode = 0);
570 FILE *solv_xfopen_fd(const char *fn, int fd, const char *mode = 0);
571 FILE *solv_xfopen_dup(const char *fn, int fd, const char *mode = 0);
572 int solv_xfclose(FILE *fp);
573 int solv_xfileno(FILE *fp);
576 SWIGINTERN int solv_xfclose(FILE *fp) {
579 SWIGINTERN int solv_xfileno(FILE *fp) {
582 SWIGINTERN FILE *solv_xfopen_dup(const char *fn, int fd, const char *mode) {
584 return fd == -1 ? 0 : solv_xfopen_fd(fn, fd, mode);
607 %nodefaultctor Transaction;
608 %nodefaultdtor Transaction;
614 Transaction * const transaction;
623 static const Id SOLVER_SOLVABLE = SOLVER_SOLVABLE;
624 static const Id SOLVER_SOLVABLE_NAME = SOLVER_SOLVABLE_NAME;
625 static const Id SOLVER_SOLVABLE_PROVIDES = SOLVER_SOLVABLE_PROVIDES;
626 static const Id SOLVER_SOLVABLE_ONE_OF = SOLVER_SOLVABLE_ONE_OF;
627 static const Id SOLVER_SOLVABLE_REPO = SOLVER_SOLVABLE_REPO;
628 static const Id SOLVER_SOLVABLE_ALL = SOLVER_SOLVABLE_ALL;
629 static const Id SOLVER_SELECTMASK = SOLVER_SELECTMASK;
630 static const Id SOLVER_NOOP = SOLVER_NOOP;
631 static const Id SOLVER_INSTALL = SOLVER_INSTALL;
632 static const Id SOLVER_ERASE = SOLVER_ERASE;
633 static const Id SOLVER_UPDATE = SOLVER_UPDATE;
634 static const Id SOLVER_WEAKENDEPS = SOLVER_WEAKENDEPS;
635 static const Id SOLVER_NOOBSOLETES = SOLVER_NOOBSOLETES;
636 static const Id SOLVER_LOCK = SOLVER_LOCK;
637 static const Id SOLVER_DISTUPGRADE = SOLVER_DISTUPGRADE;
638 static const Id SOLVER_VERIFY = SOLVER_VERIFY;
639 static const Id SOLVER_DROP_ORPHANED = SOLVER_DROP_ORPHANED;
640 static const Id SOLVER_USERINSTALLED = SOLVER_USERINSTALLED;
641 static const Id SOLVER_JOBMASK = SOLVER_JOBMASK;
642 static const Id SOLVER_WEAK = SOLVER_WEAK;
643 static const Id SOLVER_ESSENTIAL = SOLVER_ESSENTIAL;
644 static const Id SOLVER_CLEANDEPS = SOLVER_CLEANDEPS;
645 static const Id SOLVER_SETEV = SOLVER_SETEV;
646 static const Id SOLVER_SETEVR = SOLVER_SETEVR;
647 static const Id SOLVER_SETARCH = SOLVER_SETARCH;
648 static const Id SOLVER_SETVENDOR = SOLVER_SETVENDOR;
649 static const Id SOLVER_SETREPO = SOLVER_SETREPO;
650 static const Id SOLVER_NOAUTOSET = SOLVER_NOAUTOSET;
651 static const Id SOLVER_SETMASK = SOLVER_SETMASK;
653 Job(Pool *pool, int how, Id what) {
654 Job *job = solv_calloc(1, sizeof(*job));
661 %typemap(out) Queue solvables Queue2Array(XSolvable *, 1, new_XSolvable(arg1->pool, id));
662 %newobject solvables;
664 Pool *pool = $self->pool;
668 how = $self->how & SOLVER_SELECTMASK;
669 FOR_JOB_SELECT(p, pp, how, $self->what)
674 bool __eq__(Job *j) {
675 return $self->pool == j->pool && $self->how == j->how && $self->what == j->what;
677 bool __ne__(Job *j) {
678 return !Job___eq__($self, j);
680 #if defined(SWIGPERL)
681 %rename("str") __str__;
683 const char *__str__() {
684 return pool_job2str($self->pool, $self->how, $self->what, 0);
686 const char *__repr__() {
687 const char *str = pool_job2str($self->pool, $self->how, $self->what, ~0);
688 return pool_tmpjoin($self->pool, "<Job ", str, ">");
694 return (Chksum *)solv_chksum_create(type);
696 Chksum(Id type, const char *hex) {
697 unsigned char buf[64];
698 int l = solv_chksum_len(type);
701 if (solv_hex2bin(&hex, buf, sizeof(buf)) != l || hex[0])
703 return (Chksum *)solv_chksum_create_from_bin(type, buf);
706 solv_chksum_free($self, 0);
710 SWIGINTERN Id Chksum_type_get(Chksum *chksum) {
711 return solv_chksum_get_type(chksum);
714 void add(const char *str) {
715 solv_chksum_add($self, str, strlen((char *)str));
717 void add_fp(FILE *fp) {
720 while ((l = fread(buf, 1, sizeof(buf), fp)) > 0)
721 solv_chksum_add($self, buf, l);
722 rewind(fp); /* convenience */
724 void add_fd(int fd) {
727 while ((l = read(fd, buf, sizeof(buf))) > 0)
728 solv_chksum_add($self, buf, l);
729 lseek(fd, 0, 0); /* convenience */
731 void add_stat(const char *filename) {
733 if (stat(filename, &stb))
734 memset(&stb, 0, sizeof(stb));
735 solv_chksum_add($self, &stb.st_dev, sizeof(stb.st_dev));
736 solv_chksum_add($self, &stb.st_ino, sizeof(stb.st_ino));
737 solv_chksum_add($self, &stb.st_size, sizeof(stb.st_size));
738 solv_chksum_add($self, &stb.st_mtime, sizeof(stb.st_mtime));
742 const unsigned char *b;
743 b = solv_chksum_get($self, &l);
744 return cdata_void((void *)b, l);
749 const unsigned char *b;
752 b = solv_chksum_get($self, &l);
753 ret = solv_malloc(2 * l + 1);
754 solv_bin2hex(b, l, ret);
758 bool __eq__(Chksum *chk) {
760 const unsigned char *b, *bo;
763 if (solv_chksum_get_type($self) != solv_chksum_get_type(chk))
765 b = solv_chksum_get($self, &l);
766 bo = solv_chksum_get(chk, 0);
767 return memcmp(b, bo, l) == 0;
769 bool __ne__(Chksum *chk) {
770 return !Chksum___eq__($self, chk);
772 #if defined(SWIGRUBY)
773 %rename("to_s") __str__;
774 %rename("inspect") __repr__;
776 #if defined(SWIGPERL)
777 %rename("str") __str__;
780 const char *__str__() {
783 if (solv_chksum_isfinished($self))
784 h = Chksum_hex($self);
785 str = solv_dupjoin(solv_chksum_type2str(solv_chksum_get_type($self)), ":", h ? h : "unfinished");
786 solv_free((void *)h);
790 const char *__repr__() {
791 const char *h = Chksum___str__($self);
792 const char *str = solv_dupjoin("<Chksum ", h, ">");
793 solv_free((void *)h);
800 Pool *pool = pool_create();
805 void set_debuglevel(int level) {
806 pool_setdebuglevel($self, level);
808 int set_flag(int flag, int value) {
809 return pool_set_flag($self, flag, value);
811 int get_flag(int flag) {
812 return pool_get_flag($self, flag);
814 #if defined(SWIGPYTHON)
816 SWIGINTERN int loadcallback(Pool *pool, Repodata *data, void *d) {
817 XRepodata *xd = new_XRepodata(data->repo, data->repodataid);
818 PyObject *args = Py_BuildValue("(O)", SWIG_NewPointerObj(SWIG_as_voidptr(xd), SWIGTYPE_p_XRepodata, SWIG_POINTER_OWN | 0));
819 PyObject *result = PyEval_CallObject((PyObject *)d, args);
824 return 0; /* exception */
825 ecode = SWIG_AsVal_int(result, &vresult);
827 return SWIG_IsOK(ecode) ? vresult : 0;
830 void set_loadcallback(PyObject *callable) {
831 if ($self->loadcallback == loadcallback) {
832 Py_DECREF($self->loadcallbackdata);
837 pool_setloadcallback($self, callable ? loadcallback : 0, callable);
840 #if defined(SWIGPERL)
842 SWIGINTERN int loadcallback(Pool *pool, Repodata *data, void *d) {
846 XRepodata *xd = new_XRepodata(data->repo, data->repodataid);
851 XPUSHs(SWIG_NewPointerObj(SWIG_as_voidptr(xd), SWIGTYPE_p_XRepodata, SWIG_OWNER | SWIG_SHADOW));
853 count = perl_call_sv((SV *)d, G_EVAL|G_SCALAR);
863 void set_loadcallback(SV *callable) {
864 if ($self->loadcallback == loadcallback)
865 SvREFCNT_dec($self->loadcallbackdata);
867 SvREFCNT_inc(callable);
868 pool_setloadcallback($self, callable ? loadcallback : 0, callable);
872 #if defined(SWIGRUBY)
874 SWIGINTERN int loadcallback(Pool *pool, Repodata *data, void *d) {
875 XRepodata *xd = new_XRepodata(data->repo, data->repodataid);
876 VALUE callable = (VALUE)d;
877 VALUE rd = SWIG_NewPointerObj(SWIG_as_voidptr(xd), SWIGTYPE_p_XRepodata, SWIG_POINTER_OWN | 0);
878 VALUE res = rb_funcall(callable, rb_intern("call"), 1, rd);
881 SWIGINTERN void mark_Pool(void *ptr) {
883 if (pool->loadcallback == loadcallback && pool->loadcallbackdata) {
884 VALUE callable = (VALUE)pool->loadcallbackdata;
885 rb_gc_mark(callable);
889 %typemap(in, numinputs=0) VALUE callable {
890 $1 = rb_block_given_p() ? rb_block_proc() : 0;
892 void set_loadcallback(VALUE callable) {
893 pool_setloadcallback($self, callable ? loadcallback : 0, (void *)callable);
898 Pool_set_loadcallback($self, 0);
901 Id str2id(const char *str, bool create=1) {
902 return pool_str2id($self, str, create);
904 Dep *Dep(const char *str, bool create=1) {
905 Id id = pool_str2id($self, str, create);
906 return new_Dep($self, id);
908 const char *id2str(Id id) {
909 return pool_id2str($self, id);
911 const char *dep2str(Id id) {
912 return pool_dep2str($self, id);
914 Id rel2id(Id name, Id evr, int flags, bool create=1) {
915 return pool_rel2id($self, name, evr, flags, create);
917 Id id2langid(Id id, const char *lang, bool create=1) {
918 return pool_id2langid($self, id, lang, create);
920 void setarch(const char *arch) {
921 pool_setarch($self, arch);
923 Repo *add_repo(const char *name) {
924 return repo_create($self, name);
926 const char *lookup_str(Id entry, Id keyname) {
927 return pool_lookup_str($self, entry, keyname);
929 Id lookup_id(Id entry, Id keyname) {
930 return pool_lookup_id($self, entry, keyname);
932 unsigned int lookup_num(Id entry, Id keyname, unsigned int notfound = 0) {
933 return pool_lookup_num($self, entry, keyname, notfound);
935 bool lookup_void(Id entry, Id keyname) {
936 return pool_lookup_void($self, entry, keyname);
938 %newobject lookup_checksum;
939 Chksum *lookup_checksum(Id entry, Id keyname) {
941 const unsigned char *b = pool_lookup_bin_checksum($self, entry, keyname, &type);
942 return solv_chksum_create_from_bin(type, b);
945 %newobject Dataiterator;
946 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags) {
947 return new_Dataiterator($self, 0, p, key, match, flags);
949 const char *solvid2str(Id solvid) {
950 return pool_solvid2str($self, solvid);
952 void addfileprovides() {
953 pool_addfileprovides($self);
955 Queue addfileprovides_queue() {
958 pool_addfileprovides_queue($self, &r);
961 void createwhatprovides() {
962 pool_createwhatprovides($self);
965 XSolvable *id2solvable(Id id) {
966 return new_XSolvable($self, id);
968 %newobject solvables;
969 Pool_solvable_iterator * const solvables;
971 SWIGINTERN Pool_solvable_iterator * Pool_solvables_get(Pool *pool) {
972 return new_Pool_solvable_iterator(pool);
975 %newobject solvables_iter;
976 Pool_solvable_iterator * solvables_iter() {
977 return new_Pool_solvable_iterator($self);
980 Repo *id2repo(Id id) {
981 if (id < 1 || id >= $self->nrepos)
983 return pool_id2repo($self, id);
986 Pool_repo_iterator * const repos;
988 SWIGINTERN Pool_repo_iterator * Pool_repos_get(Pool *pool) {
989 return new_Pool_repo_iterator(pool);
992 %newobject repos_iter;
993 Pool_repo_iterator * repos_iter() {
994 return new_Pool_repo_iterator($self);
999 SWIGINTERN void Pool_installed_set(Pool *pool, Repo *installed) {
1000 pool_set_installed(pool, installed);
1002 Repo *Pool_installed_get(Pool *pool) {
1003 return pool->installed;
1007 Queue matchprovidingids(const char *match, int flags) {
1013 for (id = 1; id < pool->ss.nstrings; id++)
1014 if (pool->whatprovides[id])
1018 if (!datamatcher_init(&ma, match, flags)) {
1019 for (id = 1; id < pool->ss.nstrings; id++)
1020 if (pool->whatprovides[id] && datamatcher_match(&ma, pool_id2str(pool, id)))
1022 datamatcher_free(&ma);
1028 Job *Job(int how, Id what) {
1029 return new_Job($self, how, what);
1032 %typemap(out) Queue whatprovides Queue2Array(XSolvable *, 1, new_XSolvable(arg1, id));
1033 %newobject whatprovides;
1034 Queue whatprovides(Id dep) {
1039 FOR_PROVIDES(p, pp, dep)
1044 Id towhatprovides(Queue q) {
1045 return pool_queuetowhatprovides($self, &q);
1049 %rename("isknownarch?") isknownarch;
1051 bool isknownarch(Id id) {
1053 if (!id || id == ID_EMPTY)
1055 if (id == ARCH_SRC || id == ARCH_NOSRC || id == ARCH_NOARCH)
1057 if (pool->id2arch && (id > pool->lastarch || !pool->id2arch[id]))
1064 return solver_create($self);
1069 static const int REPO_REUSE_REPODATA = REPO_REUSE_REPODATA;
1070 static const int REPO_NO_INTERNALIZE = REPO_NO_INTERNALIZE;
1071 static const int REPO_LOCALPOOL = REPO_LOCALPOOL;
1072 static const int REPO_USE_LOADING = REPO_USE_LOADING;
1073 static const int REPO_EXTEND_SOLVABLES = REPO_EXTEND_SOLVABLES;
1074 static const int SOLV_ADD_NO_STUBS = SOLV_ADD_NO_STUBS; /* repo_solv */
1075 #ifdef ENABLE_SUSETAGS
1076 static const int SUSETAGS_RECORD_SHARES = SUSETAGS_RECORD_SHARES; /* repo_susetags */
1079 void free(bool reuseids = 0) {
1080 repo_free($self, reuseids);
1082 void empty(bool reuseids = 0) {
1083 repo_empty($self, reuseids);
1086 %rename("isempty?") isempty;
1089 return !$self->nsolvables;
1091 bool add_solv(const char *name, int flags = 0) {
1092 FILE *fp = fopen(name, "r");
1096 r = repo_add_solv($self, fp, flags);
1100 bool add_solv(FILE *fp, int flags = 0) {
1101 return repo_add_solv($self, fp, flags) == 0;
1104 XSolvable *add_solvable() {
1105 Id solvid = repo_add_solvable($self);
1106 return new_XSolvable($self->pool, solvid);
1110 bool add_rpmdb(Repo *ref, int flags = 0) {
1111 repo_add_rpmdb($self, ref, 0, flags);
1114 Id add_rpm(const char *name, int flags = 0) {
1115 return repo_add_rpm($self, name, flags);
1119 bool add_rpmmd(FILE *fp, const char *language, int flags = 0) {
1120 repo_add_rpmmd($self, fp, language, flags);
1123 bool add_repomdxml(FILE *fp, int flags = 0) {
1124 repo_add_repomdxml($self, fp, flags);
1127 bool add_updateinfoxml(FILE *fp, int flags = 0) {
1128 repo_add_updateinfoxml($self, fp, flags);
1131 bool add_deltainfoxml(FILE *fp, int flags = 0) {
1132 repo_add_deltainfoxml($self, fp, flags);
1136 #ifdef ENABLE_DEBIAN
1137 bool add_debdb(int flags = 0) {
1138 repo_add_debdb($self, 0, flags);
1141 Id add_deb(const char *name, int flags = 0) {
1142 return repo_add_deb($self, name, flags);
1145 #ifdef ENABLE_SUSEREPO
1146 bool add_susetags(FILE *fp, Id defvendor, const char *language, int flags = 0) {
1147 repo_add_susetags($self, fp, defvendor, language, flags);
1150 bool add_content(FILE *fp, int flags = 0) {
1151 repo_add_content($self, fp, flags);
1154 bool add_products(const char *proddir, int flags = 0) {
1155 repo_add_products($self, proddir, 0, flags);
1159 void internalize() {
1160 repo_internalize($self);
1162 const char *lookup_str(Id entry, Id keyname) {
1163 return repo_lookup_str($self, entry, keyname);
1165 Id lookup_id(Id entry, Id keyname) {
1166 return repo_lookup_id($self, entry, keyname);
1168 unsigned int lookup_num(Id entry, Id keyname, unsigned int notfound = 0) {
1169 return repo_lookup_num($self, entry, keyname, notfound);
1171 void write(FILE *fp) {
1172 repo_write($self, fp);
1174 # HACK, remove if no longer needed!
1175 bool write_first_repodata(FILE *fp) {
1176 int oldnrepodata = $self->nrepodata;
1177 $self->nrepodata = oldnrepodata > 2 ? 2 : oldnrepodata;
1178 repo_write($self, fp);
1179 $self->nrepodata = oldnrepodata;
1183 %newobject Dataiterator;
1184 Dataiterator *Dataiterator(Id p, Id key, const char *match, int flags) {
1185 return new_Dataiterator($self->pool, $self, p, key, match, flags);
1190 SWIGINTERN Id Repo_id_get(Repo *repo) {
1191 return repo->repoid;
1194 Repo_solvable_iterator * const solvables;
1196 SWIGINTERN Repo_solvable_iterator * Repo_solvables_get(Repo *repo) {
1197 return new_Repo_solvable_iterator(repo);
1200 %newobject solvables_iter;
1201 Repo_solvable_iterator *solvables_iter() {
1202 return new_Repo_solvable_iterator($self);
1205 XRepodata *add_repodata(int flags = 0) {
1206 Repodata *rd = repo_add_repodata($self, flags);
1207 return new_XRepodata($self, rd->repodataid);
1210 void create_stubs() {
1212 if (!$self->nrepodata)
1214 data = repo_id2repodata($self, $self->nrepodata - 1);
1215 if (data->state != REPODATA_STUB)
1216 repodata_create_stubs(data);
1219 %rename("iscontiguous?") iscontiguous;
1221 bool iscontiguous() {
1223 for (i = $self->start; i < $self->end; i++)
1224 if ($self->pool->solvables[i].repo != $self)
1228 XRepodata *first_repodata() {
1231 if ($self->nrepodata < 2)
1233 /* make sure all repodatas but the first are extensions */
1234 data = repo_id2repodata($self, 1);
1235 if (data->loadcallback)
1237 for (i = 2; i < $self->nrepodata; i++)
1239 data = repo_id2repodata($self, i);
1240 if (!data->loadcallback)
1241 return 0; /* oops, not an extension */
1243 return new_XRepodata($self, 1);
1246 bool __eq__(Repo *repo) {
1247 return $self == repo;
1249 bool __ne__(Repo *repo) {
1250 return $self != repo;
1252 #if defined(SWIGPERL)
1253 %rename("str") __str__;
1256 const char *__str__() {
1259 return solv_strdup($self->name);
1260 sprintf(buf, "Repo#%d", $self->repoid);
1261 return solv_strdup(buf);
1263 %newobject __repr__;
1264 const char *__repr__() {
1268 sprintf(buf, "<Repo #%d ", $self->repoid);
1269 return solv_dupjoin(buf, $self->name, ">");
1271 sprintf(buf, "<Repo #%d>", $self->repoid);
1272 return solv_strdup(buf);
1276 %extend Dataiterator {
1277 static const int SEARCH_STRING = SEARCH_STRING;
1278 static const int SEARCH_SUBSTRING = SEARCH_SUBSTRING;
1279 static const int SEARCH_GLOB = SEARCH_GLOB;
1280 static const int SEARCH_REGEX = SEARCH_REGEX;
1281 static const int SEARCH_NOCASE = SEARCH_NOCASE;
1282 static const int SEARCH_FILES = SEARCH_FILES;
1283 static const int SEARCH_COMPLETE_FILELIST = SEARCH_COMPLETE_FILELIST;
1285 Dataiterator(Pool *pool, Repo *repo, Id p, Id key, const char *match, int flags) {
1286 Dataiterator *di = solv_calloc(1, sizeof(*di));
1287 dataiterator_init(di, pool, repo, p, key, match, flags);
1291 dataiterator_free($self);
1294 #if defined(SWIGPYTHON)
1295 %newobject __iter__;
1296 Dataiterator *__iter__() {
1298 ndi = solv_calloc(1, sizeof(*ndi));
1299 dataiterator_init_clone(ndi, $self);
1302 %rename("next") __next__();
1303 %exception __next__ {
1306 PyErr_SetString(PyExc_StopIteration,"no more matches");
1313 perliter(solv::Dataiterator)
1316 %newobject __next__;
1317 Datamatch *__next__() {
1319 if (!dataiterator_step($self)) {
1322 ndi = solv_calloc(1, sizeof(*ndi));
1323 dataiterator_init_clone(ndi, $self);
1329 while ((d = Dataiterator___next__($self)) != 0) {
1330 rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(d), SWIGTYPE_p_Datamatch, SWIG_POINTER_OWN | 0));
1334 void prepend_keyname(Id key) {
1335 dataiterator_prepend_keyname($self, key);
1337 void skip_solvable() {
1338 dataiterator_skip_solvable($self);
1343 Id lookup_id(Id keyname) {
1344 Pool *pool = $self->repo->pool;
1345 Datapos oldpos = pool->pos;
1348 r = pool_lookup_id(pool, SOLVID_POS, keyname);
1352 const char *lookup_str(Id keyname) {
1353 Pool *pool = $self->repo->pool;
1354 Datapos oldpos = pool->pos;
1357 r = pool_lookup_str(pool, SOLVID_POS, keyname);
1361 %newobject lookup_checksum;
1362 Chksum *lookup_checksum(Id keyname) {
1363 Pool *pool = $self->repo->pool;
1364 Datapos oldpos = pool->pos;
1366 const unsigned char *b;
1368 b = pool_lookup_bin_checksum(pool, SOLVID_POS, keyname, &type);
1370 return solv_chksum_create_from_bin(type, b);
1376 dataiterator_free($self);
1379 %newobject solvable;
1380 XSolvable * const solvable;
1382 SWIGINTERN XSolvable *Datamatch_solvable_get(Dataiterator *di) {
1383 return new_XSolvable(di->pool, di->solvid);
1387 return $self->key->name;
1389 const char *key_idstr() {
1390 return pool_id2str($self->pool, $self->key->name);
1393 return $self->key->type;
1395 const char *type_idstr() {
1396 return pool_id2str($self->pool, $self->key->type);
1399 return $self->kv.id;
1401 const char *idstr() {
1402 return pool_id2str($self->pool, $self->kv.id);
1405 return $self->kv.str;
1408 return $self->kv.num;
1411 return $self->kv.num2;
1415 Pool *pool = $self->pool;
1416 Datapos *pos, oldpos = pool->pos;
1417 dataiterator_setpos($self);
1418 pos = solv_calloc(1, sizeof(*pos));
1423 %newobject parentpos;
1424 Datapos *parentpos() {
1425 Pool *pool = $self->pool;
1426 Datapos *pos, oldpos = pool->pos;
1427 dataiterator_setpos_parent($self);
1428 pos = solv_calloc(1, sizeof(*pos));
1434 dataiterator_setpos($self);
1436 void setpos_parent() {
1437 dataiterator_setpos_parent($self);
1441 %extend Pool_solvable_iterator {
1442 Pool_solvable_iterator(Pool *pool) {
1443 Pool_solvable_iterator *s;
1444 s = solv_calloc(1, sizeof(*s));
1448 #if defined(SWIGPYTHON)
1449 %newobject __iter__;
1450 Pool_solvable_iterator *__iter__() {
1451 Pool_solvable_iterator *s;
1452 s = solv_calloc(1, sizeof(*s));
1456 %rename("next") __next__();
1457 %exception __next__ {
1460 PyErr_SetString(PyExc_StopIteration,"no more matches");
1467 perliter(solv::Pool_solvable_iterator)
1469 %newobject __next__;
1470 XSolvable *__next__() {
1471 Pool *pool = $self->pool;
1472 if ($self->id >= pool->nsolvables)
1474 while (++$self->id < pool->nsolvables)
1475 if (pool->solvables[$self->id].repo)
1476 return new_XSolvable(pool, $self->id);
1482 while ((n = Pool_solvable_iterator___next__($self)) != 0) {
1483 rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(n), SWIGTYPE_p_XSolvable, SWIG_POINTER_OWN | 0));
1487 %newobject __getitem__;
1488 XSolvable *__getitem__(Id key) {
1489 Pool *pool = $self->pool;
1490 if (key > 0 && key < pool->nsolvables && pool->solvables[key].repo)
1491 return new_XSolvable(pool, key);
1495 return $self->pool->nsolvables;
1499 %extend Pool_repo_iterator {
1500 Pool_repo_iterator(Pool *pool) {
1501 Pool_repo_iterator *s;
1502 s = solv_calloc(1, sizeof(*s));
1506 #if defined(SWIGPYTHON)
1507 %newobject __iter__;
1508 Pool_repo_iterator *__iter__() {
1509 Pool_repo_iterator *s;
1510 s = solv_calloc(1, sizeof(*s));
1514 %rename("next") __next__();
1515 %exception __next__ {
1518 PyErr_SetString(PyExc_StopIteration,"no more matches");
1523 %newobject __next__;
1525 Pool *pool = $self->pool;
1526 if ($self->id >= pool->nrepos)
1528 while (++$self->id < pool->nrepos) {
1529 Repo *r = pool_id2repo(pool, $self->id);
1538 while ((n = Pool_repo_iterator___next__($self)) != 0) {
1539 rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(n), SWIGTYPE_p__Repo, SWIG_POINTER_OWN | 0));
1543 Repo *__getitem__(Id key) {
1544 Pool *pool = $self->pool;
1545 if (key > 0 && key < pool->nrepos)
1546 return pool_id2repo(pool, key);
1550 return $self->pool->nrepos;
1554 %extend Repo_solvable_iterator {
1555 Repo_solvable_iterator(Repo *repo) {
1556 Repo_solvable_iterator *s;
1557 s = solv_calloc(1, sizeof(*s));
1561 #if defined(SWIGPYTHON)
1562 %newobject __iter__;
1563 Repo_solvable_iterator *__iter__() {
1564 Repo_solvable_iterator *s;
1565 s = solv_calloc(1, sizeof(*s));
1569 %rename("next") __next__();
1570 %exception __next__ {
1573 PyErr_SetString(PyExc_StopIteration,"no more matches");
1578 %newobject __next__;
1579 XSolvable *__next__() {
1580 Repo *repo = $self->repo;
1581 Pool *pool = repo->pool;
1582 if (repo->start > 0 && $self->id < repo->start)
1583 $self->id = repo->start - 1;
1584 if ($self->id >= repo->end)
1586 while (++$self->id < repo->end)
1587 if (pool->solvables[$self->id].repo == repo)
1588 return new_XSolvable(pool, $self->id);
1594 while ((n = Repo_solvable_iterator___next__($self)) != 0) {
1595 rb_yield(SWIG_NewPointerObj(SWIG_as_voidptr(n), SWIGTYPE_p_XSolvable, SWIG_POINTER_OWN | 0));
1599 %newobject __getitem__;
1600 XSolvable *__getitem__(Id key) {
1601 Repo *repo = $self->repo;
1602 Pool *pool = repo->pool;
1603 if (key > 0 && key < pool->nsolvables && pool->solvables[key].repo == repo)
1604 return new_XSolvable(pool, key);
1608 return $self->repo->pool->nsolvables;
1613 Dep(Pool *pool, Id id) {
1617 s = solv_calloc(1, sizeof(*s));
1623 return pool_dep2str($self->pool, $self->id);
1625 bool __eq__(Dep *s) {
1626 return $self->pool == s->pool && $self->id == s->id;
1628 bool __ne__(Dep *s) {
1629 return !Dep___eq__($self, s);
1631 #if defined(SWIGPERL)
1632 %rename("str") __str__;
1634 const char *__str__() {
1635 return pool_dep2str($self->pool, $self->id);
1637 %newobject __repr__;
1638 const char *__repr__() {
1640 sprintf(buf, "<Id #%d ", $self->id);
1641 return solv_dupjoin(buf, pool_dep2str($self->pool, $self->id), ">");
1646 XSolvable(Pool *pool, Id id) {
1648 if (!id || id >= pool->nsolvables)
1650 s = solv_calloc(1, sizeof(*s));
1656 return pool_solvid2str($self->pool, $self->id);
1658 const char *lookup_str(Id keyname) {
1659 return pool_lookup_str($self->pool, $self->id, keyname);
1661 Id lookup_id(Id keyname) {
1662 return pool_lookup_id($self->pool, $self->id, keyname);
1664 unsigned int lookup_num(Id keyname, unsigned int notfound = 0) {
1665 return pool_lookup_num($self->pool, $self->id, keyname, notfound);
1667 bool lookup_void(Id keyname) {
1668 return pool_lookup_void($self->pool, $self->id, keyname);
1670 %newobject lookup_checksum;
1671 Chksum *lookup_checksum(Id keyname) {
1673 const unsigned char *b = pool_lookup_bin_checksum($self->pool, $self->id, keyname, &type);
1674 return solv_chksum_create_from_bin(type, b);
1676 Queue lookup_idarray(Id keyname, Id marker = 1) {
1677 Solvable *s = $self->pool->solvables + $self->id;
1681 if (keyname == SOLVABLE_PROVIDES)
1682 marker = -SOLVABLE_FILEMARKER;
1683 else if (keyname == SOLVABLE_REQUIRES)
1684 marker = -SOLVABLE_PREREQMARKER;
1688 solvable_lookup_deparray(s, keyname, &r, marker);
1691 %typemap(out) Queue lookup_deparray Queue2Array(Dep *, 1, new_Dep(arg1->pool, id));
1692 %newobject lookup_deparray;
1693 Queue lookup_deparray(Id keyname, Id marker = 1) {
1694 Solvable *s = $self->pool->solvables + $self->id;
1698 if (keyname == SOLVABLE_PROVIDES)
1699 marker = -SOLVABLE_FILEMARKER;
1700 else if (keyname == SOLVABLE_REQUIRES)
1701 marker = -SOLVABLE_PREREQMARKER;
1705 solvable_lookup_deparray(s, keyname, &r, marker);
1708 const char *lookup_location(unsigned int *OUTPUT) {
1709 return solvable_get_location($self->pool->solvables + $self->id, OUTPUT);
1712 %rename("installable?") installable;
1714 bool installable() {
1715 return pool_installable($self->pool, pool_id2solvable($self->pool, $self->id));
1718 %rename("isinstalled?") isinstalled;
1720 bool isinstalled() {
1721 Pool *pool = $self->pool;
1722 return pool->installed && pool_id2solvable(pool, $self->id)->repo == pool->installed;
1727 SWIGINTERN void XSolvable_name_set(XSolvable *xs, const char *name) {
1728 Pool *pool = xs->pool;
1729 pool->solvables[xs->id].name = pool_str2id(pool, name, 1);
1731 SWIGINTERN const char *XSolvable_name_get(XSolvable *xs) {
1732 Pool *pool = xs->pool;
1733 return pool_id2str(pool, pool->solvables[xs->id].name);
1738 SWIGINTERN void XSolvable_nameid_set(XSolvable *xs, Id nameid) {
1739 xs->pool->solvables[xs->id].name = nameid;
1741 SWIGINTERN Id XSolvable_nameid_get(XSolvable *xs) {
1742 return xs->pool->solvables[xs->id].name;
1747 SWIGINTERN void XSolvable_evr_set(XSolvable *xs, const char *evr) {
1748 Pool *pool = xs->pool;
1749 pool->solvables[xs->id].evr = pool_str2id(pool, evr, 1);
1751 SWIGINTERN const char *XSolvable_evr_get(XSolvable *xs) {
1752 Pool *pool = xs->pool;
1753 return pool_id2str(pool, pool->solvables[xs->id].evr);
1758 SWIGINTERN void XSolvable_evrid_set(XSolvable *xs, Id evrid) {
1759 xs->pool->solvables[xs->id].evr = evrid;
1761 SWIGINTERN Id XSolvable_evrid_get(XSolvable *xs) {
1762 return xs->pool->solvables[xs->id].evr;
1767 SWIGINTERN void XSolvable_arch_set(XSolvable *xs, const char *arch) {
1768 Pool *pool = xs->pool;
1769 pool->solvables[xs->id].arch = pool_str2id(pool, arch, 1);
1771 SWIGINTERN const char *XSolvable_arch_get(XSolvable *xs) {
1772 Pool *pool = xs->pool;
1773 return pool_id2str(pool, pool->solvables[xs->id].arch);
1778 SWIGINTERN void XSolvable_archid_set(XSolvable *xs, Id archid) {
1779 xs->pool->solvables[xs->id].arch = archid;
1781 SWIGINTERN Id XSolvable_archid_get(XSolvable *xs) {
1782 return xs->pool->solvables[xs->id].arch;
1787 SWIGINTERN void XSolvable_vendor_set(XSolvable *xs, const char *vendor) {
1788 Pool *pool = xs->pool;
1789 pool->solvables[xs->id].vendor = pool_str2id(pool, vendor, 1);
1791 SWIGINTERN const char *XSolvable_vendor_get(XSolvable *xs) {
1792 Pool *pool = xs->pool;
1793 return pool_id2str(pool, pool->solvables[xs->id].vendor);
1798 SWIGINTERN void XSolvable_vendorid_set(XSolvable *xs, Id vendorid) {
1799 xs->pool->solvables[xs->id].vendor = vendorid;
1801 SWIGINTERN Id XSolvable_vendorid_get(XSolvable *xs) {
1802 return xs->pool->solvables[xs->id].vendor;
1807 SWIGINTERN Repo *XSolvable_repo_get(XSolvable *xs) {
1808 return xs->pool->solvables[xs->id].repo;
1812 void add_provides(Dep *dep, Id marker = -SOLVABLE_FILEMARKER) {
1813 Solvable *s = $self->pool->solvables + $self->id;
1814 s->provides = repo_addid_dep(s->repo, s->provides, dep->id, marker);
1816 void add_providesid(Id id, Id marker = -SOLVABLE_FILEMARKER) {
1817 Solvable *s = $self->pool->solvables + $self->id;
1818 s->provides = repo_addid_dep(s->repo, s->provides, id, marker);
1820 void add_obsoletes(Dep *dep) {
1821 Solvable *s = $self->pool->solvables + $self->id;
1822 s->obsoletes = repo_addid_dep(s->repo, s->obsoletes, dep->id, 0);
1824 void add_obsoletesid(Id id) {
1825 Solvable *s = $self->pool->solvables + $self->id;
1826 s->obsoletes = repo_addid_dep(s->repo, s->obsoletes, id, 0);
1828 void add_conflicts(Dep *dep) {
1829 Solvable *s = $self->pool->solvables + $self->id;
1830 s->conflicts = repo_addid_dep(s->repo, s->conflicts, dep->id, 0);
1832 void add_conflictsid(Id id) {
1833 Solvable *s = $self->pool->solvables + $self->id;
1834 s->conflicts = repo_addid_dep(s->repo, s->conflicts, id, 0);
1836 void add_requires(Dep *dep, Id marker = -SOLVABLE_PREREQMARKER) {
1837 Solvable *s = $self->pool->solvables + $self->id;
1838 s->requires = repo_addid_dep(s->repo, s->requires, dep->id, marker);
1840 void add_requiresid(Id id, Id marker = -SOLVABLE_PREREQMARKER) {
1841 Solvable *s = $self->pool->solvables + $self->id;
1842 s->requires = repo_addid_dep(s->repo, s->requires, id, marker);
1844 void add_recommends(Dep *dep) {
1845 Solvable *s = $self->pool->solvables + $self->id;
1846 s->recommends = repo_addid_dep(s->repo, s->recommends, dep->id, 0);
1848 void add_recommendsid(Id id) {
1849 Solvable *s = $self->pool->solvables + $self->id;
1850 s->recommends = repo_addid_dep(s->repo, s->recommends, id, 0);
1852 void add_suggests(Dep *dep) {
1853 Solvable *s = $self->pool->solvables + $self->id;
1854 s->suggests = repo_addid_dep(s->repo, s->suggests, dep->id, 0);
1856 void add_suggestsid(Id id) {
1857 Solvable *s = $self->pool->solvables + $self->id;
1858 s->suggests = repo_addid_dep(s->repo, s->suggests, id, 0);
1860 void add_supplements(Dep *dep) {
1861 Solvable *s = $self->pool->solvables + $self->id;
1862 s->supplements = repo_addid_dep(s->repo, s->supplements, dep->id, 0);
1864 void add_supplementsid(Id id) {
1865 Solvable *s = $self->pool->solvables + $self->id;
1866 s->supplements = repo_addid_dep(s->repo, s->supplements, id, 0);
1868 void add_enhances(Dep *dep) {
1869 Solvable *s = $self->pool->solvables + $self->id;
1870 s->enhances = repo_addid_dep(s->repo, s->enhances, dep->id, 0);
1872 void add_enhancesid(Id id) {
1873 Solvable *s = $self->pool->solvables + $self->id;
1874 s->enhances = repo_addid_dep(s->repo, s->enhances, id, 0);
1877 bool __eq__(XSolvable *s) {
1878 return $self->pool == s->pool && $self->id == s->id;
1880 bool __ne__(XSolvable *s) {
1881 return !XSolvable___eq__($self, s);
1883 #if defined(SWIGPERL)
1884 %rename("str") __str__;
1886 const char *__str__() {
1887 return pool_solvid2str($self->pool, $self->id);
1889 %newobject __repr__;
1890 const char *__repr__() {
1892 sprintf(buf, "<Solvable #%d ", $self->id);
1893 return solv_dupjoin(buf, pool_solvid2str($self->pool, $self->id), ">");
1898 Problem(Solver *solv, Id id) {
1900 p = solv_calloc(1, sizeof(*p));
1905 %newobject findproblemrule;
1906 XRule *findproblemrule() {
1907 Id r = solver_findproblemrule($self->solv, $self->id);
1908 return new_XRule($self->solv, r);
1910 %newobject findallproblemrules;
1911 %typemap(out) Queue findallproblemrules Queue2Array(XRule *, 1, new_XRule(arg1->solv, id));
1912 Queue findallproblemrules(int unfiltered=0) {
1913 Solver *solv = $self->solv;
1918 solver_findallproblemrules(solv, $self->id, &q);
1921 for (i = j = 0; i < q.count; i++)
1923 SolverRuleinfo rclass;
1924 probr = q.elements[i];
1925 rclass = solver_ruleclass(solv, probr);
1926 if (rclass == SOLVER_RULE_UPDATE || rclass == SOLVER_RULE_JOB)
1928 q.elements[j++] = probr;
1931 queue_truncate(&q, j);
1935 int solution_count() {
1936 return solver_solution_count($self->solv, $self->id);
1938 %newobject solutions;
1939 %typemap(out) Queue solutions Queue2Array(Solution *, 1, new_Solution(arg1, id));
1944 cnt = solver_solution_count($self->solv, $self->id);
1945 for (i = 1; i <= cnt; i++)
1952 Solution(Problem *p, Id id) {
1954 s = solv_calloc(1, sizeof(*s));
1956 s->problemid = p->id;
1960 int element_count() {
1961 return solver_solutionelement_count($self->solv, $self->problemid, $self->id);
1964 %newobject elements;
1965 %typemap(out) Queue elements Queue2Array(Solutionelement *, 4, new_Solutionelement(arg1->solv, arg1->problemid, arg1->id, id, idp[1], idp[2], idp[3]));
1966 Queue elements(bool expandreplaces=0) {
1970 cnt = solver_solutionelement_count($self->solv, $self->problemid, $self->id);
1971 for (i = 1; i <= cnt; i++)
1974 solver_next_solutionelement($self->solv, $self->problemid, $self->id, i - 1, &p, &rp);
1976 type = rp ? SOLVER_SOLUTION_REPLACE : SOLVER_SOLUTION_ERASE;
1982 if (type == SOLVER_SOLUTION_REPLACE && expandreplaces) {
1983 int illegal = policy_is_illegal(self->solv, self->solv->pool->solvables + p, self->solv->pool->solvables + rp, 0);
1985 if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0) {
1986 queue_push2(&q, i, SOLVER_SOLUTION_REPLACE_DOWNGRADE);
1987 queue_push2(&q, p, rp);
1989 if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0) {
1990 queue_push2(&q, i, SOLVER_SOLUTION_REPLACE_ARCHCHANGE);
1991 queue_push2(&q, p, rp);
1993 if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0) {
1994 queue_push2(&q, i, SOLVER_SOLUTION_REPLACE_VENDORCHANGE);
1995 queue_push2(&q, p, rp);
2000 queue_push2(&q, i, type);
2001 queue_push2(&q, p, rp);
2007 %extend Solutionelement {
2008 Solutionelement(Solver *solv, Id problemid, Id solutionid, Id id, Id type, Id p, Id rp) {
2010 e = solv_calloc(1, sizeof(*e));
2012 e->problemid = problemid;
2023 if (p == SOLVER_SOLUTION_ERASE)
2028 else if (p == SOLVER_SOLUTION_REPLACE)
2033 else if (p == SOLVER_SOLUTION_REPLACE_DOWNGRADE)
2034 return pool_tmpjoin($self->solv->pool, "allow ", policy_illegal2str($self->solv, POLICY_ILLEGAL_DOWNGRADE, $self->solv->pool->solvables + $self->p, $self->solv->pool->solvables + $self->rp), 0);
2035 else if (p == SOLVER_SOLUTION_REPLACE_ARCHCHANGE)
2036 return pool_tmpjoin($self->solv->pool, "allow ", policy_illegal2str($self->solv, POLICY_ILLEGAL_ARCHCHANGE, $self->solv->pool->solvables + $self->p, $self->solv->pool->solvables + $self->rp), 0);
2037 else if (p == SOLVER_SOLUTION_REPLACE_VENDORCHANGE)
2038 return pool_tmpjoin($self->solv->pool, "allow ", policy_illegal2str($self->solv, POLICY_ILLEGAL_VENDORCHANGE, $self->solv->pool->solvables + $self->p, $self->solv->pool->solvables + $self->rp), 0);
2039 return solver_solutionelement2str($self->solv, p, rp);
2041 %newobject replaceelements;
2042 %typemap(out) Queue replaceelements Queue2Array(Solutionelement *, 1, new_Solutionelement(arg1->solv, arg1->problemid, arg1->solutionid, arg1->id, id, arg1->p, arg1->rp));
2043 Queue replaceelements() {
2048 if ($self->type != SOLVER_SOLUTION_REPLACE || $self->p <= 0 || $self->rp <= 0)
2051 illegal = policy_is_illegal($self->solv, $self->solv->pool->solvables + $self->p, $self->solv->pool->solvables + $self->rp, 0);
2052 if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0)
2053 queue_push(&q, SOLVER_SOLUTION_REPLACE_DOWNGRADE);
2054 if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0)
2055 queue_push(&q, SOLVER_SOLUTION_REPLACE_ARCHCHANGE);
2056 if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0)
2057 queue_push(&q, SOLVER_SOLUTION_REPLACE_VENDORCHANGE);
2059 queue_push(&q, $self->type);
2062 int illegalreplace() {
2063 if ($self->type != SOLVER_SOLUTION_REPLACE || $self->p <= 0 || $self->rp <= 0)
2065 return policy_is_illegal($self->solv, $self->solv->pool->solvables + $self->p, $self->solv->pool->solvables + $self->rp, 0);
2067 %newobject solvable;
2068 XSolvable * const solvable;
2069 %newobject replacement;
2070 XSolvable * const replacement;
2073 SWIGINTERN XSolvable *Solutionelement_solvable_get(Solutionelement *e) {
2074 return new_XSolvable(e->solv->pool, e->p);
2076 SWIGINTERN XSolvable *Solutionelement_replacement_get(Solutionelement *e) {
2077 return new_XSolvable(e->solv->pool, e->rp);
2079 SWIGINTERN int Solutionelement_jobidx_get(Solutionelement *e) {
2080 if (e->type != SOLVER_SOLUTION_JOB)
2082 return (e->p - 1) / 2;
2087 if ($self->type == SOLVER_SOLUTION_JOB)
2088 return new_Job($self->solv->pool, SOLVER_NOOP, 0);
2089 if ($self->type == SOLVER_SOLUTION_INFARCH || $self->type == SOLVER_SOLUTION_DISTUPGRADE)
2090 return new_Job($self->solv->pool, SOLVER_INSTALL|SOLVER_SOLVABLE, $self->p);
2091 if ($self->type == SOLVER_SOLUTION_REPLACE || $self->type == SOLVER_SOLUTION_REPLACE_DOWNGRADE || $self->type == SOLVER_SOLUTION_REPLACE_ARCHCHANGE || $self->type == SOLVER_SOLUTION_REPLACE_VENDORCHANGE)
2092 return new_Job($self->solv->pool, SOLVER_INSTALL|SOLVER_SOLVABLE, $self->rp);
2093 if ($self->type == SOLVER_SOLUTION_ERASE)
2094 return new_Job($self->solv->pool, SOLVER_ERASE|SOLVER_SOLVABLE, $self->p);
2100 static const int SOLVER_RULE_UNKNOWN = SOLVER_RULE_UNKNOWN;
2101 static const int SOLVER_RULE_RPM = SOLVER_RULE_RPM;
2102 static const int SOLVER_RULE_RPM_NOT_INSTALLABLE = SOLVER_RULE_RPM_NOT_INSTALLABLE;
2103 static const int SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP = SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP;
2104 static const int SOLVER_RULE_RPM_PACKAGE_REQUIRES = SOLVER_RULE_RPM_PACKAGE_REQUIRES;
2105 static const int SOLVER_RULE_RPM_SELF_CONFLICT = SOLVER_RULE_RPM_SELF_CONFLICT;
2106 static const int SOLVER_RULE_RPM_PACKAGE_CONFLICT = SOLVER_RULE_RPM_PACKAGE_CONFLICT;
2107 static const int SOLVER_RULE_RPM_SAME_NAME = SOLVER_RULE_RPM_SAME_NAME;
2108 static const int SOLVER_RULE_RPM_PACKAGE_OBSOLETES = SOLVER_RULE_RPM_PACKAGE_OBSOLETES;
2109 static const int SOLVER_RULE_RPM_IMPLICIT_OBSOLETES = SOLVER_RULE_RPM_IMPLICIT_OBSOLETES;
2110 static const int SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES = SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES;
2111 static const int SOLVER_RULE_UPDATE = SOLVER_RULE_UPDATE;
2112 static const int SOLVER_RULE_FEATURE = SOLVER_RULE_FEATURE;
2113 static const int SOLVER_RULE_JOB = SOLVER_RULE_JOB;
2114 static const int SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP = SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP;
2115 static const int SOLVER_RULE_DISTUPGRADE = SOLVER_RULE_DISTUPGRADE;
2116 static const int SOLVER_RULE_INFARCH = SOLVER_RULE_INFARCH;
2117 static const int SOLVER_RULE_CHOICE = SOLVER_RULE_CHOICE;
2118 static const int SOLVER_RULE_LEARNT = SOLVER_RULE_LEARNT;
2120 static const int SOLVER_SOLUTION_JOB = SOLVER_SOLUTION_JOB;
2121 static const int SOLVER_SOLUTION_INFARCH = SOLVER_SOLUTION_INFARCH;
2122 static const int SOLVER_SOLUTION_DISTUPGRADE = SOLVER_SOLUTION_DISTUPGRADE;
2123 static const int SOLVER_SOLUTION_ERASE = SOLVER_SOLUTION_ERASE;
2124 static const int SOLVER_SOLUTION_REPLACE = SOLVER_SOLUTION_REPLACE;
2125 static const int SOLVER_SOLUTION_REPLACE_DOWNGRADE = SOLVER_SOLUTION_REPLACE_DOWNGRADE;
2126 static const int SOLVER_SOLUTION_REPLACE_ARCHCHANGE = SOLVER_SOLUTION_REPLACE_ARCHCHANGE;
2127 static const int SOLVER_SOLUTION_REPLACE_VENDORCHANGE = SOLVER_SOLUTION_REPLACE_VENDORCHANGE;
2129 static const int POLICY_ILLEGAL_DOWNGRADE = POLICY_ILLEGAL_DOWNGRADE;
2130 static const int POLICY_ILLEGAL_ARCHCHANGE = POLICY_ILLEGAL_ARCHCHANGE;
2131 static const int POLICY_ILLEGAL_VENDORCHANGE = POLICY_ILLEGAL_VENDORCHANGE;
2133 static const int SOLVER_FLAG_ALLOW_DOWNGRADE = SOLVER_FLAG_ALLOW_DOWNGRADE;
2134 static const int SOLVER_FLAG_ALLOW_ARCHCHANGE = SOLVER_FLAG_ALLOW_ARCHCHANGE;
2135 static const int SOLVER_FLAG_ALLOW_VENDORCHANGE = SOLVER_FLAG_ALLOW_VENDORCHANGE;
2136 static const int SOLVER_FLAG_ALLOW_UNINSTALL = SOLVER_FLAG_ALLOW_UNINSTALL;
2137 static const int SOLVER_FLAG_NO_UPDATEPROVIDE = SOLVER_FLAG_NO_UPDATEPROVIDE;
2138 static const int SOLVER_FLAG_SPLITPROVIDES = SOLVER_FLAG_SPLITPROVIDES;
2139 static const int SOLVER_FLAG_IGNORE_RECOMMENDED = SOLVER_FLAG_IGNORE_RECOMMENDED;
2140 static const int SOLVER_FLAG_ADD_ALREADY_RECOMMENDED = SOLVER_FLAG_ADD_ALREADY_RECOMMENDED;
2141 static const int SOLVER_FLAG_NO_INFARCHCHECK = SOLVER_FLAG_NO_INFARCHCHECK;
2147 int set_flag(int flag, int value) {
2148 return solver_set_flag($self, flag, value);
2150 int get_flag(int flag) {
2151 return solver_get_flag($self, flag);
2153 #if defined(SWIGPYTHON)
2155 def solve(self, jobs):
2157 for job in jobs: j += [job.how, job.what]
2158 return self.solve_helper(j)
2161 #if defined(SWIGPERL)
2163 sub solv::Solver::solve {
2164 my ($self, $jobs) = @_;
2165 my @j = map {($_->{'how'}, $_->{'what'})} @$jobs;
2166 return $self->solve_helper(\@j);
2170 #if defined(SWIGRUBY)
2173 "class Solv::Solver\n"
2174 " def solve(jobs)\n"
2176 " jobs.each do |j| ; jl << j.how << j.what ; end\n"
2177 " solve_helper(jl)\n"
2183 %typemap(out) Queue solve_helper Queue2Array(Problem *, 1, new_Problem(arg1, id));
2184 %newobject solve_helper;
2185 Queue solve_helper(Queue jobs) {
2189 solver_solve($self, &jobs);
2190 cnt = solver_problem_count($self);
2191 for (i = 1; i <= cnt; i++)
2195 %newobject transaction;
2196 Transaction *transaction() {
2197 return solver_create_transaction($self);
2201 %extend Transaction {
2202 static const int SOLVER_TRANSACTION_IGNORE = SOLVER_TRANSACTION_IGNORE;
2203 static const int SOLVER_TRANSACTION_ERASE = SOLVER_TRANSACTION_ERASE;
2204 static const int SOLVER_TRANSACTION_REINSTALLED = SOLVER_TRANSACTION_REINSTALLED;
2205 static const int SOLVER_TRANSACTION_DOWNGRADED = SOLVER_TRANSACTION_DOWNGRADED;
2206 static const int SOLVER_TRANSACTION_CHANGED = SOLVER_TRANSACTION_CHANGED;
2207 static const int SOLVER_TRANSACTION_UPGRADED = SOLVER_TRANSACTION_UPGRADED;
2208 static const int SOLVER_TRANSACTION_OBSOLETED = SOLVER_TRANSACTION_OBSOLETED;
2209 static const int SOLVER_TRANSACTION_INSTALL = SOLVER_TRANSACTION_INSTALL;
2210 static const int SOLVER_TRANSACTION_REINSTALL = SOLVER_TRANSACTION_REINSTALL;
2211 static const int SOLVER_TRANSACTION_DOWNGRADE = SOLVER_TRANSACTION_DOWNGRADE;
2212 static const int SOLVER_TRANSACTION_CHANGE = SOLVER_TRANSACTION_CHANGE;
2213 static const int SOLVER_TRANSACTION_UPGRADE = SOLVER_TRANSACTION_UPGRADE;
2214 static const int SOLVER_TRANSACTION_OBSOLETES = SOLVER_TRANSACTION_OBSOLETES;
2215 static const int SOLVER_TRANSACTION_MULTIINSTALL = SOLVER_TRANSACTION_MULTIINSTALL;
2216 static const int SOLVER_TRANSACTION_MULTIREINSTALL = SOLVER_TRANSACTION_MULTIREINSTALL;
2217 static const int SOLVER_TRANSACTION_MAXTYPE = SOLVER_TRANSACTION_MAXTYPE;
2218 static const int SOLVER_TRANSACTION_SHOW_ACTIVE = SOLVER_TRANSACTION_SHOW_ACTIVE;
2219 static const int SOLVER_TRANSACTION_SHOW_ALL = SOLVER_TRANSACTION_SHOW_ALL;
2220 static const int SOLVER_TRANSACTION_SHOW_OBSOLETES = SOLVER_TRANSACTION_SHOW_OBSOLETES;
2221 static const int SOLVER_TRANSACTION_SHOW_MULTIINSTALL = SOLVER_TRANSACTION_SHOW_MULTIINSTALL;
2222 static const int SOLVER_TRANSACTION_CHANGE_IS_REINSTALL = SOLVER_TRANSACTION_CHANGE_IS_REINSTALL;
2223 static const int SOLVER_TRANSACTION_MERGE_VENDORCHANGES = SOLVER_TRANSACTION_MERGE_VENDORCHANGES;
2224 static const int SOLVER_TRANSACTION_MERGE_ARCHCHANGES = SOLVER_TRANSACTION_MERGE_ARCHCHANGES;
2225 static const int SOLVER_TRANSACTION_RPM_ONLY = SOLVER_TRANSACTION_RPM_ONLY;
2226 static const int SOLVER_TRANSACTION_ARCHCHANGE = SOLVER_TRANSACTION_ARCHCHANGE;
2227 static const int SOLVER_TRANSACTION_VENDORCHANGE = SOLVER_TRANSACTION_VENDORCHANGE;
2228 static const int SOLVER_TRANSACTION_KEEP_ORDERDATA = SOLVER_TRANSACTION_KEEP_ORDERDATA;
2230 transaction_free($self);
2233 %rename("isempty?") isempty;
2236 return $self->steps.count == 0;
2239 %newobject othersolvable;
2240 XSolvable *othersolvable(XSolvable *s) {
2241 Id op = transaction_obs_pkg($self, s->id);
2242 return new_XSolvable($self->pool, op);
2245 %newobject allothersolvables;
2246 %typemap(out) Queue allothersolvables Queue2Array(XSolvable *, 1, new_XSolvable(arg1->pool, id));
2247 Queue allothersolvables(XSolvable *s) {
2250 transaction_all_obs_pkgs($self, s->id, &q);
2254 %typemap(out) Queue classify Queue2Array(TransactionClass *, 4, new_TransactionClass(arg1, arg2, id, idp[1], idp[2], idp[3]));
2255 %newobject classify;
2256 Queue classify(int mode = 0) {
2259 transaction_classify($self, mode, &q);
2263 %typemap(out) Queue newpackages Queue2Array(XSolvable *, 1, new_XSolvable(arg1->pool, id));
2264 %newobject newpackages;
2265 Queue newpackages() {
2269 cut = transaction_installedresult(self, &q);
2270 queue_truncate(&q, cut);
2274 %typemap(out) Queue keptpackages Queue2Array(XSolvable *, 1, new_XSolvable(arg1->pool, id));
2275 %newobject keptpackages;
2276 Queue keptpackages() {
2280 cut = transaction_installedresult(self, &q);
2282 queue_deleten(&q, 0, cut);
2286 %typemap(out) Queue steps Queue2Array(XSolvable *, 1, new_XSolvable(arg1->pool, id));
2290 queue_init_clone(&q, &$self->steps);
2294 int steptype(XSolvable *s, int mode) {
2295 return transaction_type($self, s->id, mode);
2297 int calc_installsizechange() {
2298 return transaction_calc_installsizechange($self);
2300 void order(int flags) {
2301 transaction_order($self, flags);
2305 %extend TransactionClass {
2306 TransactionClass(Transaction *trans, int mode, Id type, int count, Id fromid, Id toid) {
2307 TransactionClass *cl = solv_calloc(1, sizeof(*cl));
2308 cl->transaction = trans;
2312 cl->fromid = fromid;
2316 %newobject solvables;
2317 %typemap(out) Queue solvables Queue2Array(XSolvable *, 1, new_XSolvable(arg1->transaction->pool, id));
2321 transaction_classify_pkgs($self->transaction, $self->mode, $self->type, $self->fromid, $self->toid, &q);
2327 XRule(Solver *solv, Id id) {
2330 XRule *xr = solv_calloc(1, sizeof(*xr));
2336 Id type, source, target, dep;
2337 type = solver_ruleinfo($self->solv, $self->id, &source, &target, &dep);
2338 return new_Ruleinfo($self, type, source, target, dep);
2340 %typemap(out) Queue allinfos Queue2Array(Ruleinfo *, 4, new_Ruleinfo(arg1, id, idp[1], idp[2], idp[3]));
2341 %newobject allinfos;
2345 solver_allruleinfos($self->solv, $self->id, &q);
2349 bool __eq__(XRule *xr) {
2350 return $self->solv == xr->solv && $self->id == xr->id;
2352 bool __ne__(XRule *xr) {
2353 return !XRule___eq__($self, xr);
2355 %newobject __repr__;
2356 const char *__repr__() {
2358 sprintf(buf, "<Rule #%d>", $self->id);
2359 return solv_strdup(buf);
2364 Ruleinfo(XRule *r, Id type, Id source, Id target, Id dep) {
2365 Ruleinfo *ri = solv_calloc(1, sizeof(*ri));
2369 ri->source = source;
2370 ri->target = target;
2374 XSolvable * const solvable;
2375 XSolvable * const othersolvable;
2377 SWIGINTERN XSolvable *Ruleinfo_solvable_get(Ruleinfo *ri) {
2378 return new_XSolvable(ri->solv->pool, ri->source);
2380 SWIGINTERN XSolvable *Ruleinfo_othersolvable_get(Ruleinfo *ri) {
2381 return new_XSolvable(ri->solv->pool, ri->target);
2384 const char *problemstr() {
2385 return solver_problemruleinfo2str($self->solv, $self->type, $self->source, $self->target, $self->dep);
2390 XRepodata(Repo *repo, Id id) {
2391 XRepodata *xr = solv_calloc(1, sizeof(*xr));
2397 return repodata_new_handle(repo_id2repodata($self->repo, $self->id));
2399 void set_id(Id solvid, Id keyname, Id id) {
2400 repodata_set_id(repo_id2repodata($self->repo, $self->id), solvid, keyname, id);
2402 void set_str(Id solvid, Id keyname, const char *str) {
2403 repodata_set_str(repo_id2repodata($self->repo, $self->id), solvid, keyname, str);
2405 void set_poolstr(Id solvid, Id keyname, const char *str) {
2406 repodata_set_poolstr(repo_id2repodata($self->repo, $self->id), solvid, keyname, str);
2408 void add_idarray(Id solvid, Id keyname, Id id) {
2409 repodata_add_idarray(repo_id2repodata($self->repo, $self->id), solvid, keyname, id);
2411 void add_flexarray(Id solvid, Id keyname, Id handle) {
2412 repodata_add_flexarray(repo_id2repodata($self->repo, $self->id), solvid, keyname, handle);
2414 void set_checksum(Id solvid, Id keyname, Chksum *chksum) {
2415 const unsigned char *buf = solv_chksum_get(chksum, 0);
2417 repodata_set_bin_checksum(repo_id2repodata($self->repo, $self->id), solvid, keyname, solv_chksum_get_type(chksum), buf);
2419 const char *lookup_str(Id solvid, Id keyname) {
2420 return repodata_lookup_str(repo_id2repodata($self->repo, $self->id), solvid, keyname);
2422 Queue lookup_idarray(Id solvid, Id keyname) {
2425 repodata_lookup_idarray(repo_id2repodata($self->repo, $self->id), solvid, keyname, &r);
2428 %newobject lookup_checksum;
2429 Chksum *lookup_checksum(Id solvid, Id keyname) {
2431 const unsigned char *b = repodata_lookup_bin_checksum(repo_id2repodata($self->repo, $self->id), solvid, keyname, &type);
2432 return solv_chksum_create_from_bin(type, b);
2434 void internalize() {
2435 repodata_internalize(repo_id2repodata($self->repo, $self->id));
2437 void create_stubs() {
2438 repodata_create_stubs(repo_id2repodata($self->repo, $self->id));
2440 void write(FILE *fp) {
2441 repodata_write(repo_id2repodata($self->repo, $self->id), fp);
2443 bool add_solv(FILE *fp, int flags = 0) {
2444 Repodata *data = repo_id2repodata($self->repo, $self->id);
2445 int r, oldstate = data->state;
2446 data->state = REPODATA_LOADING;
2447 r = repo_add_solv(data->repo, fp, flags | REPO_USE_LOADING);
2448 if (r || data->state == REPODATA_LOADING)
2449 data->state = oldstate;
2452 void extend_to_repo() {
2453 Repodata *data = repo_id2repodata($self->repo, $self->id);
2454 repodata_extend_block(data, data->repo->start, data->repo->end - data->repo->start);
2456 bool __eq__(XRepodata *xr) {
2457 return $self->repo == xr->repo && $self->id == xr->id;
2459 bool __ne__(XRepodata *xr) {
2460 return !XRepodata___eq__($self, xr);
2462 %newobject __repr__;
2463 const char *__repr__() {
2465 sprintf(buf, "<Repodata #%d>", $self->id);
2466 return solv_strdup(buf);