aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--URPM.xs3
-rw-r--r--URPM/Build.pm24
-rw-r--r--perl-URPM.spec5
3 files changed, 21 insertions, 11 deletions
diff --git a/URPM.xs b/URPM.xs
index eb60871..f0a6654 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1187,6 +1187,7 @@ Db_open(prefix="/")
old_cb = rpmErrorSetCallback(callback_empty);
rpmSetVerbosity(RPMMESS_FATALERROR);
RETVAL = rpmdbOpen(prefix, &db, O_RDONLY, 0644) == 0 ? db : NULL;
+ fprintf(stderr, "opening read only rpm db %p\n", db);
rpmErrorSetCallback(old_cb);
rpmSetVerbosity(RPMMESS_NORMAL);
OUTPUT:
@@ -1203,6 +1204,7 @@ Db_open_rw(prefix="/")
old_cb = rpmErrorSetCallback(callback_empty);
rpmSetVerbosity(RPMMESS_FATALERROR);
RETVAL = rpmdbOpen(prefix, &db, O_RDWR | O_CREAT, 0644) == 0 ? db : NULL;
+ fprintf(stderr, "opening read-write rpm db %p\n", db);
rpmErrorSetCallback(old_cb);
rpmSetVerbosity(RPMMESS_NORMAL);
OUTPUT:
@@ -1212,6 +1214,7 @@ void
Db_DESTROY(db)
URPM::DB db
CODE:
+ fprintf(stderr, "closing rpm db %p\n", db);
rpmdbClose(db);
int
diff --git a/URPM/Build.pm b/URPM/Build.pm
index c5af5fc..39e8481 100644
--- a/URPM/Build.pm
+++ b/URPM/Build.pm
@@ -117,8 +117,10 @@ sub parse_headers {
#- compute dependencies, result in stored in info values of urpm.
#- operations are incremental, it is possible to read just one hdlist, compute
#- dependencies and read another hdlist, and again.
+#- parameters are :
+#- callback : callback to relocate reference to package id.
sub compute_deps {
- my ($urpm) = @_;
+ my ($urpm, %options) = @_;
#- avoid recomputing already present infos, take care not to modify
#- existing entries, as the array here is used instead of values of infos.
@@ -142,7 +144,7 @@ sub compute_deps {
while (my $req = shift @requires) {
$req =~ /^basesystem/ and next; #- never need to requires basesystem directly as always required! what a speed up!
- $req = ($req =~ /^[0-9]+$/ && [ $req ] ||
+ $req = ($req =~ /^\d+$/ && [ $req ] ||
$urpm->{provides}{$req} && [ keys %{$urpm->{provides}{$req}} ] ||
[ ($req !~ /NOTFOUND_/ && "NOTFOUND_") . $req ]);
if (@$req > 1) {
@@ -152,7 +154,7 @@ sub compute_deps {
#- this could be nothing if the provides is a file not found.
#- and this has been fixed above.
foreach (@$req) {
- my $pkg_ = /^[0-9]+$/ && $urpm->{depslist}[$_];
+ my $pkg_ = /^\d+$/ && $urpm->{depslist}[$_];
exists $required_packages{$_} and next;
$required_packages{$_} = undef; $pkg_ or next;
foreach ($pkg_->requires_nosense) {
@@ -181,12 +183,12 @@ sub compute_deps {
my @requires = ($_);
my ($dep, %requires);
while (defined ($dep = shift @requires)) {
- exists $requires{$dep} || /^[^0-9\|]*$/ and next;
+ exists $requires{$dep} || /^[^\d\|]*$/ and next;
foreach ($dep, split ' ', (defined $urpm->{deps}[$dep] ? $urpm->{deps}[$dep] : $urpm->{requires}[$dep])) {
if (/\|/) {
push @requires, split /\|/, $_;
} else {
- /^[0-9]+$/ and $requires{$_} = undef;
+ /^\d+$/ and $requires{$_} = undef;
}
}
}
@@ -202,7 +204,7 @@ sub compute_deps {
my $fixed_weight = 10000;
foreach (qw(basesystem msec * locales filesystem setup glibc sash bash libtermcap2 termcap readline ldconfig)) {
foreach (keys %{$urpm->{provides}{$_} || {}}) {
- /^[0-9]+$/ and $ordered{$_} = $fixed_weight;
+ /^\d+$/ and $ordered{$_} = $fixed_weight;
}
$fixed_weight += 10000;
}
@@ -218,7 +220,7 @@ sub compute_deps {
foreach (qw(basesystem glibc kernel)) {
foreach (keys %{$urpm->{provides}{$_} || {}}) {
foreach ($_, split ' ', (defined $urpm->{deps}[$_] ? $urpm->{deps}[$_] : $urpm->{requires}[$_])) {
- /^[0-9]+$/ and $urpm->{depslist}[$_] and $urpm->{depslist}[$_]->set_flag_base(1);
+ /^\d+$/ and $urpm->{depslist}[$_] and $urpm->{depslist}[$_]->set_flag_base(1);
}
}
}
@@ -270,7 +272,7 @@ sub compute_deps {
$requires_id{$choices_key} = undef;
next;
}
- } elsif (/^[0-9]+$/) {
+ } elsif (/^\d+$/) {
($id, $base) = (exists $remap_ids{$_} ? $remap_ids{$_} : $_, $urpm->{depslist}[$_]->flag_base);
} else {
$not_founds{$_} = undef;
@@ -283,11 +285,13 @@ sub compute_deps {
}
#- be smart with memory usage.
delete $urpm->{requires}[$_];
- $urpm->{deps}[$remap_ids{$_}] = join(' ', (sort { ($a =~ /^([0-9]+)/)[0] <=> ($b =~ /^([0-9]+)/)[0] } keys %requires_id), keys %not_founds);
+ $urpm->{deps}[$remap_ids{$_}] = join ' ', ((sort { ($a =~ /^(\d+)/)[0] <=> ($b =~ /^(\d+)/)[0] } keys %requires_id),
+ keys %not_founds);
$depslist[$remap_ids{$_}-$start] = $pkg;
}
#- remap all provides ids for new package position and update depslist.
+ delete $urpm->{requires};
@{$urpm->{depslist}}[$start .. $end] = @depslist;
foreach my $h (values %{$urpm->{provides}}) {
my %provided;
@@ -296,7 +300,7 @@ sub compute_deps {
}
$h = \%provided;
}
- delete $urpm->{requires};
+ $options{callback} and $options{callback}->($urpm, \%remap_ids, %options);
($start, $end);
}
diff --git a/perl-URPM.spec b/perl-URPM.spec
index 5c4e827..a3c9668 100644
--- a/perl-URPM.spec
+++ b/perl-URPM.spec
@@ -1,6 +1,6 @@
%define name perl-URPM
%define real_name URPM
-%define release 1mdk
+%define release 2mdk
%{expand:%%define version %(perl -ne '/VERSION\s+=[^0-9\.]*([0-9\.]+)/ and print "$1\n"' URPM.pm)}
@@ -47,6 +47,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Wed Jun 5 2002 François Pons <fpons@mandrakesoft.com> 0.02-2mdk
+- added log on opening/closing rpmdb.
+
* Mon Jun 3 2002 François Pons <fpons@mandrakesoft.com> 0.02-1mdk
- new version with extended parameters list for URPM::Build.
- fixed code to be -w clean.