summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2001-05-22 13:36:54 +0000
committerFrancois Pons <fpons@mandriva.com>2001-05-22 13:36:54 +0000
commita7f6c001df90ecebb288ae6cebf8e968db0aac2b (patch)
tree215e4f74431c2cd777f7d212e0df6e73c793a8f9
parent41091a12d7a58d80b445a2f2e523cf9c0b8575a5 (diff)
downloadurpmi-a7f6c001df90ecebb288ae6cebf8e968db0aac2b.tar
urpmi-a7f6c001df90ecebb288ae6cebf8e968db0aac2b.tar.gz
urpmi-a7f6c001df90ecebb288ae6cebf8e968db0aac2b.tar.bz2
urpmi-a7f6c001df90ecebb288ae6cebf8e968db0aac2b.tar.xz
urpmi-a7f6c001df90ecebb288ae6cebf8e968db0aac2b.zip
added arch support, added filtering when reading synthesis file.
-rw-r--r--urpm.pm68
-rw-r--r--urpmi.spec8
2 files changed, 57 insertions, 19 deletions
diff --git a/urpm.pm b/urpm.pm
index f26ad019..384bbf2c 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1042,12 +1042,38 @@ sub filter_minimal_packages_to_upgrade {
local *F;
open F, "gzip -dc '$_' |";
local $_;
+ my %info;
+ my $update_info = sub {
+ my $found;
+ #- check with provides that version and release are matching else ignore safely.
+ $info{name} or return;
+ foreach (@{$info{provides} || []}) {
+ if (/(\S*)\s*==\s*\d*:?([^-]*)-([^-]*)/ && $info{name} eq $1) {
+ $found = $urpm->{params}{info}{$info{name}};
+ if ($found->{version} eq $2 && $found->{release} eq $3) {
+ foreach (keys %info) {
+ $urpm->{params}{info}{$info{name}}{$_} ||= $info{$_};
+ }
+ return 1; #- we have found the right info.
+ }
+ }
+ }
+ $found and return 0; #- we are sure having found a package but with wrong version or release.
+ #- at this level, nothing in params has been found, this could be an error so
+ #- at least print an error message.
+ $urpm->{error}("unknown data associated with $info{name}");
+ return;
+ };
while (<F>) {
chomp;
my ($name, $tag, @data) = split '@';
- $urpm->{params}{info}{$name} or die "unknown data associated with $name";
- $urpm->{params}{info}{$name}{$tag} = \@data;
+ if ($name ne $info{name}) {
+ $update_info->();
+ %info = ( name => $name );
+ }
+ $info{$tag} = \@data;
}
+ $update_info->();
close F;
}
}
@@ -1248,26 +1274,31 @@ sub deselect_unwanted_packages {
#- have a null list.
sub get_source_packages {
my ($urpm, $packages) = @_;
- my ($error, @local_to_removes, @local_sources, @list, %select);
+ my ($arch, $error, @local_to_removes, @local_sources, @list, %select);
local (*D, *F, $_);
+ #- check architecture of packages listed, ignore all package that are not allowed.
+ $arch = `uname -m`; chomp $arch;
+
#- examine the local repository, which is trusted.
opendir D, "$urpm->{cachedir}/rpms";
while (defined($_ = readdir D)) {
if (/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/) {
my $pkg = $urpm->{params}{info}{$1};
- #- check version, release and id selected.
- #- TODO arch is not checked at this point.
- unless ($pkg->{version} eq $2 && $pkg->{release} eq $3 && exists $packages->{$pkg->{id}}) {
+ #- check version, release, arch and id selected.
+ exists $select{$pkg->{id}} && ! defined $select{$pkg->{id}} and next; #- package has already been selected.
+ $select{$pkg->{id}} = undef; #- try to select, clean error flag, else it will fail.
+ exists $packages->{$pkg->{id}} or $select{$pkg->{id}} = ""; #- no special warning here, but need define.
+ $pkg->{version} eq $2 or $select{$pkg->{id}} .= ", mismatch version $2";
+ $pkg->{release} eq $3 or $select{$pkg->{id}} .= ", mismatch release $3";
+ rpmtools::compat_arch($4) or $select{$pkg->{id}} .= ", incompatible arch $4";
+ if (defined $select{$pkg->{id}}) {
#- keep in mind these have to be deleted or space will be tight soon...
push @local_to_removes, "$urpm->{cachedir}/rpms/$1-$2-$3.$4.rpm";
next;
}
- #- make sure only the first matching is taken...
- exists $select{$pkg->{id}} and next; $select{$pkg->{id}} = undef;
-
#- we have found one source for id.
push @local_sources, "$urpm->{cachedir}/rpms/$1-$2-$3.$4.rpm";
} else {
@@ -1287,13 +1318,15 @@ sub get_source_packages {
if (/(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/) {
my $pkg = $urpm->{params}{info}{$2};
- #- check version, release and id selected.
+ #- check version, release, arch and id selected.
#- TODO arch is not checked at this point.
- $pkg->{version} eq $3 && $pkg->{release} eq $4 or next;
- exists $packages->{$pkg->{id}} or next;
-
- #- make sure only the first matching is taken...
- exists $select{$pkg->{id}} and next; $select{$pkg->{id}} = undef;
+ exists $select{$pkg->{id}} && ! defined $select{$pkg->{id}} and next; #- package has already been selected.
+ $select{$pkg->{id}} = undef; #- try to select, clean error flag, else it will fail.
+ exists $packages->{$pkg->{id}} or $select{$pkg->{id}} = ""; #- no special warning here, but need define.
+ $pkg->{version} eq $3 or $select{$pkg->{id}} .= ", mismatch version $3";
+ $pkg->{release} eq $4 or $select{$pkg->{id}} .= ", mismatch release $4";
+ rpmtools::compat_arch($5) or $select{$pkg->{id}} .= ", incompatible arch $5";
+ defined $select{$pkg->{id}} and next; #- an error occured, only the last one is available.
#- we have found one source for id.
push @sources, "$1/$2-$3-$4.$5.rpm";
@@ -1310,7 +1343,7 @@ sub get_source_packages {
#- examine package list to see if a package has not been found.
foreach (keys %$packages) {
- exists $select{$_} and next;
+ exists $select{$_} && ! defined $select{$_} and next;
#- try to find which one.
my $pkg = $urpm->{params}{depslist}[$_];
@@ -1319,7 +1352,8 @@ sub get_source_packages {
push @local_sources, $pkg->{source};
} else {
$error = 1;
- $urpm->{error}("package $pkg->{name}-$pkg->{version}-$pkg->{release} is not found, ids=($_,$pkg->{id})");
+ $urpm->{error}("package $pkg->{name}-$pkg->{version}-$pkg->{release} is not found$select{$_}.");
+ $urpm->{error}("maybe the package has only been updated for another incompatible arch?");
}
} else {
$error = 1;
diff --git a/urpmi.spec b/urpmi.spec
index 59b258ac..25ad5592 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,12 +2,12 @@
Name: urpmi
Version: 1.5
-Release: 34mdk
+Release: 35mdk
License: GPL
Source0: %{name}.tar.bz2
Summary: User mode rpm install
Requires: /usr/bin/suidperl, eject, wget
-PreReq: perl-gettext, rpmtools >= 2.3-7mdk
+PreReq: perl-gettext, rpmtools >= 2.3-22mdk
BuildRoot: %{_tmppath}/%{name}-buildroot
Group: %{group}
@@ -114,6 +114,10 @@ autoirpm.uninstall
%changelog
+* Tue May 22 2001 François Pons <fpons@mandrakesoft.com> 1.5-35mdk
+- added synthesis file filtering.
+- added arch chekc support.
+
* Tue Apr 17 2001 François Pons <fpons@mandrakesoft.com> 1.5-34mdk
- fixed sorting of list file.