add identical and evrcmp methods for solvables
authorMichael Schroeder <mls@suse.de>
Thu, 9 Jan 2014 12:29:48 +0000 (13:29 +0100)
committerMichael Schroeder <mls@suse.de>
Thu, 9 Jan 2014 12:29:48 +0000 (13:29 +0100)
bindings/solv.i
doc/libsolv-bindings.3
doc/libsolv-bindings.txt

index 67212a2..21613a2 100644 (file)
@@ -448,6 +448,7 @@ typedef int bool;
 
 #include "pool.h"
 #include "poolarch.h"
+#include "evr.h"
 #include "solver.h"
 #include "policy.h"
 #include "solverdebug.h"
@@ -2411,6 +2412,16 @@ rb_eval_string(
     return sel;
   }
 
+#ifdef SWIGRUBY
+  %rename("identical?") identical;
+#endif
+  bool identical(XSolvable *s2) {
+    return solvable_identical($self->pool->solvables + $self->id, s2->pool->solvables + s2->id);
+  }
+  int evrcmp(XSolvable *s2) {
+    return pool_evrcmp($self->pool, $self->pool->solvables[$self->id].evr, s2->pool->solvables[s2->id].evr, EVRCMP_COMPARE);
+  }
+
   bool __eq__(XSolvable *s) {
     return $self->pool == s->pool && $self->id == s->id;
   }
index 6edf92b..a248f85 100644 (file)
@@ -2,12 +2,12 @@
 .\"     Title: Libsolv-Bindings
 .\"    Author: [see the "Author" section]
 .\" Generator: DocBook XSL Stylesheets v1.78.0 <http://docbook.sf.net/>
-.\"      Date: 09/24/2013
+.\"      Date: 01/09/2014
 .\"    Manual: LIBSOLV
 .\"    Source: libsolv
 .\"  Language: English
 .\"
-.TH "LIBSOLV\-BINDINGS" "3" "09/24/2013" "libsolv" "LIBSOLV"
+.TH "LIBSOLV\-BINDINGS" "3" "01/09/2014" "libsolv" "LIBSOLV"
 .\" -----------------------------------------------------------------
 .\" * Define some portability stuff
 .\" -----------------------------------------------------------------
@@ -2336,6 +2336,36 @@ Return true if the solvable is installed on the system\&.
 .RS 4
 .\}
 .nf
+\fBbool identical(Solvable *\fR\fIother\fR\fB)\fR
+\fI$solvable\fR\fB\->identical(\fR\fI$other\fR\fB)\fR
+\fI$solvable\fR\fB\&.identical(\fR\fIother\fR\fB)\fR
+\fI$solvable\fR\fB\&.identical?(\fR\fIother\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Return true if the two solvables are identical\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+\fBint evrcmp(Solvable *\fR\fIother\fR\fB)\fR
+\fI$solvable\fR\fB\->evrcmp(\fR\fIother\fR\fB)\fR
+\fI$solvable\fR\fB\&.evrcmp(\fR\fIother\fR\fB)\fR
+\fI$solvable\fR\fB\&.evrcmp(\fR\fIother\fR\fB)\fR
+.fi
+.if n \{\
+.RE
+.\}
+.sp
+Returns \-1 if the epoch/version/release of the solvable is less then the one from the other solvable, 1 if it is greater, and 0 if they are equal\&. Note that "equal" does not mean that the evr is identical\&.
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
 \fBSelection Selection(int\fR \fIsetflags\fR \fB= 0)\fR
 my \fI$sel\fR \fB=\fR \fI$solvable\fR\fB\->Selection()\fR;
 \fIsel\fR \fB=\fR \fIsolvable\fR\fB\&.Selection()\fR
index a5fde9d..1dcfc3f 100644 (file)
@@ -1306,6 +1306,22 @@ are not installable if the system does not support their architecture.
 
 Return true if the solvable is installed on the system.
 
+       bool identical(Solvable *other)
+       $solvable->identical($other)
+       $solvable.identical(other)
+       $solvable.identical?(other)
+
+Return true if the two solvables are identical.
+
+       int evrcmp(Solvable *other)
+       $solvable->evrcmp(other)
+       $solvable.evrcmp(other)
+       $solvable.evrcmp(other)
+
+Returns -1 if the epoch/version/release of the solvable is less then the
+one from the other solvable, 1 if it is greater, and 0 if they are equal.
+Note that "equal" does not mean that the evr is identical.
+
        Selection Selection(int setflags = 0)
        my $sel = $solvable->Selection();
        sel = solvable.Selection()