summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2003-09-23 15:43:36 +0000
committerFrancois Pons <fpons@mandriva.com>2003-09-23 15:43:36 +0000
commitbcd29c6ae1a51c71b91cff0667d1db0830c2b7a3 (patch)
tree457be5316403d7cd4ce3b2a68cfe33a7f8260924
parentcaf94fb633619ef946f91b935c2b05b927728eb0 (diff)
downloadurpmi-bcd29c6ae1a51c71b91cff0667d1db0830c2b7a3.tar
urpmi-bcd29c6ae1a51c71b91cff0667d1db0830c2b7a3.tar.gz
urpmi-bcd29c6ae1a51c71b91cff0667d1db0830c2b7a3.tar.bz2
urpmi-bcd29c6ae1a51c71b91cff0667d1db0830c2b7a3.tar.xz
urpmi-bcd29c6ae1a51c71b91cff0667d1db0830c2b7a3.zip
fixed adding new sources for finding rpms.
-rw-r--r--urpm.pm234
1 files changed, 117 insertions, 117 deletions
diff --git a/urpm.pm b/urpm.pm
index 639d4ba7..4bed12ce 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -1302,13 +1302,13 @@ this could happen if you mounted manually the directory when creating the medium
#- this will only be done if $with_hdlist is not empty in order to use
#- an existing hdlist or synthesis file, and to check if download was good.
#- if no MD5SUM are available, do it as before...
- if ($medium->{with_hdlist}) {
- #- we can assume at this point a basename is existing, but it needs
- #- to be checked for being valid, nothing can be deduced if no MD5SUM
- #- file are present.
- my $basename = basename($with_hdlist_dir);
+ #- we can assume at this point a basename is existing, but it needs
+ #- to be checked for being valid, nothing can be deduced if no MD5SUM
+ #- file are present.
+ my $basename = basename($with_hdlist_dir);
- unless ($medium->{virtual}) {
+ unless ($medium->{virtual}) {
+ if ($medium->{with_hdlist}) {
if (!$options{nomd5sum} && -s reduce_pathname("$with_hdlist_dir/../MD5SUM") > 32) {
if ($options{force}) {
#- force downloading the file again, else why a force option has been defined ?
@@ -1342,43 +1342,43 @@ this could happen if you mounted manually the directory when creating the medium
#- download hdlist or synthesis file again.
foreach (@{$urpm->{media}}) {
if ($_->{md5sum} && $_->{md5sum} eq $retrieved_md5sum) {
- unlink "$urpm->{cachedir}/partial/$basename";
- #- the medium is now considered not modified.
- $medium->{modified} = 0;
- #- hdlist or synthesis file must be linked with the other same one.
- #- a link is better for reducing used size of /var/lib/urpmi.
- if ($_ ne $medium) {
- $medium->{md5sum} = $_->{md5sum};
- unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
- unlink "$urpm->{statedir}/$medium->{hdlist}";
- symlink "synthesis.$_->{hdlist}", "$urpm->{statedir}/synthesis.$medium->{hdlist}";
- symlink $_->{hdlist}, "$urpm->{statedir}/$medium->{hdlist}";
- }
- #- as previously done, just read synthesis file here, this is enough.
- $urpm->{log}(N("examining synthesis file [%s]",
- "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
+ unlink "$urpm->{cachedir}/partial/$basename";
+ #- the medium is now considered not modified.
+ $medium->{modified} = 0;
+ #- hdlist or synthesis file must be linked with the other same one.
+ #- a link is better for reducing used size of /var/lib/urpmi.
+ if ($_ ne $medium) {
+ $medium->{md5sum} = $_->{md5sum};
+ unlink "$urpm->{statedir}/synthesis.$medium->{hdlist}";
+ unlink "$urpm->{statedir}/$medium->{hdlist}";
+ symlink "synthesis.$_->{hdlist}", "$urpm->{statedir}/synthesis.$medium->{hdlist}";
+ symlink $_->{hdlist}, "$urpm->{statedir}/$medium->{hdlist}";
+ }
+ #- as previously done, just read synthesis file here, this is enough.
+ $urpm->{log}(N("examining synthesis file [%s]",
+ "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
+ eval { ($medium->{start}, $medium->{end}) =
+ $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
+ unless (defined $medium->{start} && defined $medium->{end}) {
+ $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
eval { ($medium->{start}, $medium->{end}) =
- $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
+ $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) };
unless (defined $medium->{start} && defined $medium->{end}) {
- $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
- eval { ($medium->{start}, $medium->{end}) =
- $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) };
- unless (defined $medium->{start} && defined $medium->{end}) {
- $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"",
- $medium->{name}));
- $medium->{ignore} = 1;
- }
+ $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"",
+ $medium->{name}));
+ $medium->{ignore} = 1;
}
- #- no need to continue examining other md5sum.
- last;
}
+ #- no need to continue examining other md5sum.
+ last;
+ }
}
$medium->{modified} or next;
}
}
#- if the source hdlist is present and we are not forcing using rpms file
- if ($options{force} < 2 && $medium->{with_hdlist} && -e $with_hdlist_dir) {
+ if ($options{force} < 2 && -e $with_hdlist_dir) {
unlink "$urpm->{cachedir}/partial/$medium->{hdlist}";
$urpm->{log}(N("copying source hdlist (or synthesis) of \"%s\"...", $medium->{name}));
$options{callback} && $options{callback}('copy', $medium->{name});
@@ -1391,101 +1391,101 @@ this could happen if you mounted manually the directory when creating the medium
$options{callback} && $options{callback}('done', $medium->{name});
$urpm->{log}(N("...copying done"));
}
+ }
- -s "$urpm->{cachedir}/partial/$medium->{hdlist}" > 32 or
- $error = 1, $urpm->{error}(N("copy of [%s] failed", $with_hdlist_dir));
+ -s "$urpm->{cachedir}/partial/$medium->{hdlist}" > 32 or
+ $error = 1, $urpm->{error}(N("copy of [%s] failed", $with_hdlist_dir));
- #- keep checking md5sum of file just copied ! (especially on nfs or removable device).
- if (!$error && $retrieved_md5sum) {
- $urpm->{log}(N("computing md5sum of copied source hdlist (or synthesis)"));
- (split ' ', `md5sum '$urpm->{cachedir}/partial/$medium->{hdlist}'`)[0] eq $retrieved_md5sum or
- $error = 1, $urpm->{error}(N("copy of [%s] failed", $with_hdlist_dir));
- }
+ #- keep checking md5sum of file just copied ! (especially on nfs or removable device).
+ if (!$error && $retrieved_md5sum) {
+ $urpm->{log}(N("computing md5sum of copied source hdlist (or synthesis)"));
+ (split ' ', `md5sum '$urpm->{cachedir}/partial/$medium->{hdlist}'`)[0] eq $retrieved_md5sum or
+ $error = 1, $urpm->{error}(N("copy of [%s] failed", $with_hdlist_dir));
+ }
- #- check if the file are equals... and no force copy...
- if (!$error && !$options{force} && -e "$urpm->{statedir}/synthesis.$medium->{hdlist}") {
- my @sstat = stat "$urpm->{cachedir}/partial/$medium->{hdlist}";
- my @lstat = stat "$urpm->{statedir}/$medium->{hdlist}";
- if ($sstat[7] == $lstat[7] && $sstat[9] == $lstat[9]) {
- #- the two files are considered equal here, the medium is so not modified.
- $medium->{modified} = 0;
- unlink "$urpm->{cachedir}/partial/$medium->{hdlist}";
- #- as previously done, just read synthesis file here, this is enough, but only
- #- if synthesis exists, else it need to be recomputed.
- $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
+ #- check if the file are equals... and no force copy...
+ if (!$error && !$options{force} && -e "$urpm->{statedir}/synthesis.$medium->{hdlist}") {
+ my @sstat = stat "$urpm->{cachedir}/partial/$medium->{hdlist}";
+ my @lstat = stat "$urpm->{statedir}/$medium->{hdlist}";
+ if ($sstat[7] == $lstat[7] && $sstat[9] == $lstat[9]) {
+ #- the two files are considered equal here, the medium is so not modified.
+ $medium->{modified} = 0;
+ unlink "$urpm->{cachedir}/partial/$medium->{hdlist}";
+ #- as previously done, just read synthesis file here, this is enough, but only
+ #- if synthesis exists, else it need to be recomputed.
+ $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
+ eval { ($medium->{start}, $medium->{end}) =
+ $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
+ unless (defined $medium->{start} && defined $medium->{end}) {
+ $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
eval { ($medium->{start}, $medium->{end}) =
- $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
+ $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) };
unless (defined $medium->{start} && defined $medium->{end}) {
- $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}"));
- eval { ($medium->{start}, $medium->{end}) =
- $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1) };
- unless (defined $medium->{start} && defined $medium->{end}) {
- $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name}));
- $medium->{ignore} = 1;
- }
+ $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name}));
+ $medium->{ignore} = 1;
}
- next;
}
+ next;
}
- } else {
- $options{force} < 2 and $options{force} = 2;
}
+ } else {
+ $options{force} < 2 and $options{force} = 2;
+ }
- #- if copying hdlist has failed, try to build it directly.
- if ($error) {
- $options{force} < 2 and $options{force} = 2;
- #- clean error state now.
- $error = undef;
- }
+ #- if copying hdlist has failed, try to build it directly.
+ if ($error) {
+ $options{force} < 2 and $options{force} = 2;
+ #- clean error state now.
+ $error = undef;
+ }
- if ($options{force} < 2) {
- #- examine if a local list file is available (always probed according to with_hdlist
- #- and check hdlist has not be named very strangely...
- if ($medium->{hdlist} ne 'list') {
- my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list';
- my $path_list = reduce_pathname("$with_hdlist_dir/../$local_list");
- -s $path_list or $path_list = "$dir/list";
- -s $path_list and system("cp", "--preserve=mode", "--preserve=timestamps", "-R",
- $path_list, "$urpm->{cachedir}/partial/list");
- }
+ if ($options{force} < 2) {
+ #- examine if a local list file is available (always probed according to with_hdlist
+ #- and check hdlist has not be named very strangely...
+ if ($medium->{hdlist} ne 'list') {
+ my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list';
+ my $path_list = reduce_pathname("$with_hdlist_dir/../$local_list");
+ -s $path_list or $path_list = "$dir/list";
+ -s $path_list and system("cp", "--preserve=mode", "--preserve=timestamps", "-R",
+ $path_list, "$urpm->{cachedir}/partial/list");
+ }
+ } else {
+ #- try to find rpm files, use recursive method, added additional
+ #- / after dir to make sure it will be taken into account if this
+ #- is a symlink to a directory.
+ #- make sure rpm filename format is correct and is not a source rpm
+ #- which are not well managed by urpmi.
+ @files = split "\n", `find '$dir/' -name "*.rpm" -print`;
+
+ #- check files contains something good!
+ if (@files > 0) {
+ #- we need to rebuild from rpm files the hdlist.
+ eval {
+ $urpm->{log}(N("reading rpm files from [%s]", $dir));
+ my @unresolved_before = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}};
+ $medium->{start} = @{$urpm->{depslist}};
+ $medium->{headers} = [ $urpm->parse_rpms_build_headers(dir => "$urpm->{cachedir}/headers",
+ rpms => \@files,
+ clean => $cleaned_cache,
+ ) ];
+ $medium->{end} = $#{$urpm->{depslist}};
+ if ($medium->{start} > $medium->{end}) {
+ #- an error occured (provided there are files in input.
+ delete $medium->{start};
+ delete $medium->{end};
+ die "no rpms read\n";
+ } else {
+ $cleaned_cache = 0; #- make sure the headers will not be removed for another media.
+ my @unresolved = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}};
+ @unresolved_before == @unresolved or $second_pass = 1;
+ }
+ };
+ $@ and $error = 1, $urpm->{error}(N("unable to read rpm files from [%s]: %s", $dir, $@));
+ $error and delete $medium->{headers}; #- do not propagate these.
+ $error or delete $medium->{synthesis}; #- when building hdlist by ourself, drop synthesis property.
} else {
- #- try to find rpm files, use recursive method, added additional
- #- / after dir to make sure it will be taken into account if this
- #- is a symlink to a directory.
- #- make sure rpm filename format is correct and is not a source rpm
- #- which are not well managed by urpmi.
- @files = split "\n", `find '$dir/' -name "*.rpm" -print`;
-
- #- check files contains something good!
- if (@files > 0) {
- #- we need to rebuild from rpm files the hdlist.
- eval {
- $urpm->{log}(N("reading rpm files from [%s]", $dir));
- my @unresolved_before = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}};
- $medium->{start} = @{$urpm->{depslist}};
- $medium->{headers} = [ $urpm->parse_rpms_build_headers(dir => "$urpm->{cachedir}/headers",
- rpms => \@files,
- clean => $cleaned_cache,
- ) ];
- $medium->{end} = $#{$urpm->{depslist}};
- if ($medium->{start} > $medium->{end}) {
- #- an error occured (provided there are files in input.
- delete $medium->{start};
- delete $medium->{end};
- die "no rpms read\n";
- } else {
- $cleaned_cache = 0; #- make sure the headers will not be removed for another media.
- my @unresolved = grep { ! defined $urpm->{provides}{$_} } keys %{$urpm->{provides} || {}};
- @unresolved_before == @unresolved or $second_pass = 1;
- }
- };
- $@ and $error = 1, $urpm->{error}(N("unable to read rpm files from [%s]: %s", $dir, $@));
- $error and delete $medium->{headers}; #- do not propagate these.
- $error or delete $medium->{synthesis}; #- when building hdlist by ourself, drop synthesis property.
- } else {
- $error = 1;
- $urpm->{error}(N("no rpm files found from [%s]", $dir));
- }
+ $error = 1;
+ $urpm->{error}(N("no rpm files found from [%s]", $dir));
}
}
}
@@ -1891,7 +1891,7 @@ this could happen if you mounted manually the directory when creating the medium
$medium->{list} and unlink "$urpm->{cachedir}/partial/$medium->{list}";
#- read default synthesis (we have to make sure nothing get out of depslist).
$urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}"));
- eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
+ eval { ($medium->{start}, $medium->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}") };
unless (defined $medium->{start} && defined $medium->{end}) {
$urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name}));
$medium->{ignore} = 1;