aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-12-03 14:43:16 +0000
committerFrancois Pons <fpons@mandriva.com>2002-12-03 14:43:16 +0000
commit5c39e4db9067094f865efd1b1ff62168e4cac1cf (patch)
tree9606cb3345eaca8cb38ca81a33277facd32b14f5
parent3b66cccbb743adac20e4512264a47f36eeec1f1a (diff)
downloadperl-URPM-5c39e4db9067094f865efd1b1ff62168e4cac1cf.tar
perl-URPM-5c39e4db9067094f865efd1b1ff62168e4cac1cf.tar.gz
perl-URPM-5c39e4db9067094f865efd1b1ff62168e4cac1cf.tar.bz2
perl-URPM-5c39e4db9067094f865efd1b1ff62168e4cac1cf.tar.xz
perl-URPM-5c39e4db9067094f865efd1b1ff62168e4cac1cf.zip
0.71-1mdk0.71
-rw-r--r--URPM.pm10
-rw-r--r--URPM.xs37
-rw-r--r--perl-URPM.spec8
3 files changed, 45 insertions, 10 deletions
diff --git a/URPM.pm b/URPM.pm
index bf45430..a8e69f4 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -6,7 +6,7 @@ use vars qw($VERSION @ISA);
require DynaLoader;
@ISA = qw(DynaLoader);
-$VERSION = '0.70';
+$VERSION = '0.71';
bootstrap URPM $VERSION;
@@ -35,7 +35,7 @@ sub search {
my $pkg = $urpm->{depslist}[$_];
my ($n, $v, $r, $a) = $pkg->fullname;
$options{src} && $a eq 'src' || $pkg->is_arch_compat or next;
- $n eq $1 or next;
+ "$n-$v-$r" eq $name or next;
!$best || $pkg->compare_pkg($best) > 0 and $best = $pkg;
}
$best and return $best;
@@ -43,9 +43,9 @@ sub search {
if ($name =~ /^(.*)-([^\-]*)$/) {
foreach (keys %{$urpm->{provides}{$1} || {}}) {
my $pkg = $urpm->{depslist}[$_];
- my ($n, $v, $r, $a) = $pkg->fullname;
+ my ($n, $v, undef, $a) = $pkg->fullname;
$options{src} && $a eq 'src' || $pkg->is_arch_compat or next;
- $n eq $1 or next;
+ "$n-$v" eq $name or next;
!$best || $pkg->compare_pkg($best) > 0 and $best = $pkg;
}
$best and return $best;
@@ -54,7 +54,7 @@ sub search {
foreach (keys %{$urpm->{provides}{$_} || {}}) {
my $pkg = $urpm->{depslist}[$_];
- my ($n, $v, $r, $a) = $pkg->fullname;
+ my ($n, undef, undef, $a) = $pkg->fullname;
$options{src} && $a eq 'src' || $pkg->is_arch_compat or next;
$n eq $name or next;
!$best || $pkg->compare_pkg($best) > 0 and $best = $pkg;
diff --git a/URPM.xs b/URPM.xs
index faeb4d2..68b6766 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1882,12 +1882,43 @@ Trans_set_script_fd(trans, fdno)
rpmtransSetScriptFd(trans->ts, trans->script_fd);
int
-Trans_add(trans, pkg, update)
+Trans_add(trans, pkg, ...)
URPM::Transaction trans
URPM::Package pkg
- int update
CODE:
- RETVAL = (pkg->flag & FLAG_ID) <= FLAG_ID_MAX && pkg->h != NULL && rpmtransAddPackage(trans->ts, pkg->h, NULL, (void *)(1+(pkg->flag & FLAG_ID)), update, NULL) == 0;
+ if ((pkg->flag & FLAG_ID) <= FLAG_ID_MAX && pkg->h != NULL) {
+ int update = 0;
+ rpmRelocation *relocations = NULL;
+ /* compability mode with older interface of add */
+ if (items == 3) {
+ update = SvIV(ST(2));
+ } else if (items > 3) {
+ int i;
+ for (i = 2; i < items-1; i+=2) {
+ STRLEN len;
+ char *s = SvPV(ST(i), len);
+
+ if (len == 6 && !memcmp(s, "update", 6)) {
+ update = SvIV(ST(i+1));
+ } else if (len == 11 && !memcmp(s, "excludepath", 11)) {
+ if (SvROK(ST(i+1)) && SvTYPE(SvRV(ST(i+1))) == SVt_PVAV) {
+ AV *excludepath = (AV*)SvRV(ST(i+1));
+ I32 j = 1 + av_len(excludepath);
+ relocations = calloc(2 + av_len(excludepath), sizeof(rpmRelocation));
+ while (--j >= 0) {
+ SV **e = av_fetch(excludepath, j, 0);
+ if (e != NULL && *e != NULL) {
+ relocations[j].oldPath = SvPV_nolen(*e);
+ }
+ }
+ }
+ }
+ }
+ }
+ RETVAL = rpmtransAddPackage(trans->ts, pkg->h, NULL, (void *)(1+(pkg->flag & FLAG_ID)), update, relocations) == 0;
+ /* free allocated memory, check rpm is copying it just above, at least in 4.0.4 */
+ free(relocations);
+ } else RETVAL = 0;
OUTPUT:
RETVAL
diff --git a/perl-URPM.spec b/perl-URPM.spec
index 5258b69..74fdc70 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,7 +1,7 @@
%define name perl-URPM
%define real_name URPM
-%define version 0.70
-%define release 10mdk
+%define version 0.71
+%define release 1mdk
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -49,6 +49,10 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Tue Dec 3 2002 François Pons <fpons@mandrakesoft.com> 0.71-1mdk
+- added options to URPM::Transaction::add to handle excludepath
+ option of rpm.
+
* Tue Sep 17 2002 François Pons <fpons@mandrakesoft.com> 0.70-10mdk
- fixed some packages which may not be upgraded on call to
request_packages_to_upgrade according to packages in depslist.