aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.pm2
-rw-r--r--URPM.xs34
-rw-r--r--URPM/Resolve.pm40
-rw-r--r--perl-URPM.spec12
4 files changed, 79 insertions, 9 deletions
diff --git a/URPM.pm b/URPM.pm
index a724dda..f186fe0 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -4,7 +4,7 @@ use strict;
use DynaLoader;
our @ISA = qw(DynaLoader);
-our $VERSION = '0.81';
+our $VERSION = '0.82';
URPM->bootstrap($VERSION);
diff --git a/URPM.xs b/URPM.xs
index 51a0c5d..3e56ecc 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -56,8 +56,9 @@ typedef rpmdb URPM__DB;
typedef struct s_Transaction* URPM__Transaction;
typedef struct s_Package* URPM__Package;
-#define FLAG_ID 0x001fffffU
-#define FLAG_RATE 0x00e00000U
+#define FLAG_ID 0x000fffffU
+#define FLAG_RATE 0x00700000U
+#define FLAG_SKIP 0x00800000U
#define FLAG_BASE 0x01000000U
#define FLAG_FORCE 0x02000000U
#define FLAG_INSTALLED 0x04000000U
@@ -67,10 +68,10 @@ typedef struct s_Package* URPM__Package;
#define FLAG_OBSOLETE 0x40000000U
#define FLAG_NO_HEADER_FREE 0x80000000U
-#define FLAG_ID_MAX 0x001ffffe
-#define FLAG_ID_INVALID 0x001fffff
+#define FLAG_ID_MAX 0x000ffffe
+#define FLAG_ID_INVALID 0x000fffff
-#define FLAG_RATE_POS 21
+#define FLAG_RATE_POS 20
#define FLAG_RATE_MAX 5
#define FLAG_RATE_INVALID 0
@@ -118,7 +119,7 @@ get_name(Header header, int_32 tag) {
char *name;
headerGetEntry(header, tag, &type, (void **) &name, &count);
- return name;
+ return name ? name : "";
}
static int
@@ -1519,6 +1520,25 @@ Pkg_build_header(pkg, fileno)
} else croak("no header available for package");
int
+Pkg_flag_skip(pkg)
+ URPM::Package pkg
+ CODE:
+ RETVAL = pkg->flag & FLAG_SKIP;
+ OUTPUT:
+ RETVAL
+
+int
+Pkg_set_flag_skip(pkg, value=1)
+ URPM::Package pkg
+ int value
+ CODE:
+ RETVAL = pkg->flag & FLAG_SKIP;
+ if (value) pkg->flag |= FLAG_SKIP;
+ else pkg->flag &= ~FLAG_SKIP;
+ OUTPUT:
+ RETVAL
+
+int
Pkg_flag_base(pkg)
URPM::Package pkg
CODE:
@@ -2061,6 +2081,8 @@ Trans_run(trans, data, ...)
if (len == 4 && !memcmp(s, "test", 4)) {
if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_TEST;
+ } else if (len == 11 && !memcmp(s, "excludedocs", 11)) {
+ if (SvIV(ST(i+1))) transFlags |= RPMTRANS_FLAG_NODOCS;
} else if (len == 5) {
if (!memcmp(s, "force", 5)) {
if (SvIV(ST(i+1))) probFilter |= (RPMPROB_FILTER_REPLACEPKG |
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index dc424fb..f67612c 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -11,12 +11,14 @@ sub find_candidate_packages {
foreach (split '\|', $dep) {
if (/^\d+$/) {
my $pkg = $urpm->{depslist}[$_];
+ $pkg->flag_skip and next;
$pkg->arch eq 'src' || $pkg->is_arch_compat or next;
$avoided && exists $avoided->{$pkg->fullname} and next;
push @{$packages{$pkg->name}}, $pkg;
} elsif (my ($property, $name) = /^(([^\s\[]*).*)/) {
foreach (keys %{$urpm->{provides}{$name} || {}}) {
my $pkg = $urpm->{depslist}[$_];
+ $pkg->flag_skip and next;
$pkg->is_arch_compat or next;
$avoided && exists $avoided->{$pkg->fullname} and next;
#- check if at least one provide of the package overlap the property.
@@ -641,6 +643,44 @@ sub compute_installed_flags {
\%sizes;
}
+#- compute skip flag according to hash describing package to remove
+#- $skip is a hash reference described as follow :
+#- key is package name or regular expression on fullname if /.../
+#- value is reference to hash indicating sense information ({ '' => undef } if none).
+#- options hash :
+#- callback : sub to be called for each package with skip flag activated,
+sub compute_skip_flags {
+ my ($urpm, $skip, %options) = @_;
+
+ #- avoid losing our time.
+ %$skip or return;
+
+ foreach my $pkg (@{$urpm->{depslist}[$_]}) {
+ #- check if fullname is matching a regexp.
+ if (grep { exists($skip->{$_}{''}) && /^\/(.*)\/$/ && $pkg->fullname =~ /$1/ } keys %$skip) {
+ #- a single selection on fullname using a regular expression.
+ unless ($pkg->flag_skip) {
+ $pkg->set_flag_skip;
+ $options{callback} and $options{callback}->($urpm, $pkg, %options);
+ }
+ } else {
+ #- check if a provides match at least one package.
+ foreach ($pkg->provides) {
+ if (my ($n, $s) = /^([^\s\[]*)(?:\[\*\])?\[?([^\s\]]*\s*[^\s\]]*)/) {
+ foreach my $sn ($n, grep { /^\/(.*)\/$/ && $n =~ /$1/ } keys %$skip) {
+ foreach (keys %{$skip->{$sn} || {}}) {
+ if (URPM::ranges_overlap($_, $s) && !$pkg->flag_skip) {
+ $pkg->set_flag_skip;
+ $options{callback} and $options{callback}->($urpm, $pkg, %options);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
#- select packages to upgrade, according to package already registered.
#- by default, only takes best package and its obsoleted and compute
#- all installed or upgrade flag.
diff --git a/perl-URPM.spec b/perl-URPM.spec
index d0c0c48..d4cda8e 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,7 +1,7 @@
%define name perl-URPM
%define real_name URPM
-%define version 0.81
-%define release 13mdk
+%define version 0.82
+%define release 1mdk
%{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)}
@@ -49,6 +49,14 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Fri Apr 11 2003 François Pons <fpons@mandrakesoft.com> 0.82-1mdk
+- added flag skip for each package, added URPM::Package::flag_skip
+ and URPM::Package::set_flag_skip as well as compute_skip_flags.
+- added excludedocs parameter for transaction.
+- reduced maximal number of packages supported to a little more
+ than 1 million (instead of 2 millions previously).
+- fixed possible core dumps when string rpm tag are not present.
+
* Wed Mar 12 2003 François Pons <fpons@mandrakesoft.com> 0.81-13mdk
- fixed bug 3207 (consolidated avoided hash with removed and
conflicting packages).