summaryrefslogtreecommitdiffstats
path: root/perl-install/crypto.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/crypto.pm')
-rw-r--r--perl-install/crypto.pm40
1 files changed, 35 insertions, 5 deletions
diff --git a/perl-install/crypto.pm b/perl-install/crypto.pm
index b9c7046dd..780539cc9 100644
--- a/perl-install/crypto.pm
+++ b/perl-install/crypto.pm
@@ -1,4 +1,4 @@
-package crypto;
+package crypto; # $Id$
use diagnostics;
use strict;
@@ -8,13 +8,16 @@ use log;
use ftp;
my %mirrors = (
+ "ftp.ucr.ac.cr" => [ "Costa Rica", "/pub/Unix/linux/mandrake/Mandrake" ],
"ftp.nectec.or.th" => [ "Thailand", "/pub/mirrors/Mandrake-crypto" ],
"ftp.tvd.be" => [ "Belgium", "/packages/mandrake-crypto" ],
"sunsite.mff.cuni.cz" => [ "Czech Republic", "/OS/Linux/Dist/Mandrake-crypto" ],
"ftp.uni-kl.de" => [ "Germany", "/pub/linux/mandrake/Mandrake-crypto" ],
+ "ftp.duth.gr" => [ "Grece", "/pub/mandrake-crypto" ],
"ftp.leo.org" => [ "Germany", "/pub/comp/os/unix/linux/Mandrake/Mandrake-crypto" ],
"sunsite.uio.no" => [ "Norway", "/pub/unix/Linux/Mandrake-crypto" ],
"ftp.sunet.se" => [ "Sweden", "/pub/Linux/distributions/mandrake-crypto" ],
+#- "ackbar" => [ "Ackbar", "/crypto", "a", "a" ],
);
my %deps = (
@@ -25,11 +28,38 @@ my %deps = (
sub require2package { $deps{$_[0]} || $_[0] }
sub mirror2text($) { $mirrors{$_[0]} && "$mirrors{$_[0]}[0] ($_[0])" }
-sub mirrorstext() { map { mirror2text($_) } keys %mirrors }
-sub text2mirror($) { first($_[0] =~ /\((.*)\)$/) }
-sub ftp($) { ftp::new($_[0], "$mirrors{$_[0]}[1]/RPMS") }
+sub mirrors() { keys %mirrors }
+sub dir { $mirrors{$_[0]}[1] . '/' . (arch() !~ /i.86/ && ((arch() =~ /sparc/ ? "sparc" : arch()). '/')) . $::VERSION }
+sub ftp($) { ftp::new($_[0], dir($_[0])) }
-sub packages($) { ftp($_[0])->ls }
+sub getFile($$) {
+ my ($file, $host) = @_;
+ $host ||= $crypto::host;
+ log::l("getting crypto file $file on directory " . dir($host) . " with login $mirrors{$host}[2]");
+ my ($ftp, $retr) = ftp::new($host, dir($host),
+ $mirrors{$host}[2] ? $mirrors{$host}[2] : (),
+ $mirrors{$host}[3] ? $mirrors{$host}[3] : ()
+ );
+ $$retr->close if $$retr;
+ $$retr = $ftp->retr($file) or ftp::rewindGetFile();
+ $$retr ||= $ftp->retr($file);
+}
+
+sub getDepslist { getFile("depslist-crypto", $_[0]) or die "unable to get depslist-crypto" }
+
+sub getPackages {
+ my ($prefix, $packages, $mirror) = @_;
+
+ $crypto::host = $mirror;
+
+ #- extract hdlist of crypto, then depslist.
+ require pkgs;
+ pkgs::psUsingHdlist($prefix, '', $packages, "hdlist-crypto.cz2", "crypto.cz2", "Crypto", "Cryptographic site", 1, getFile("hdlist-crypto.cz2", $mirror)) and
+ pkgs::getOtherDeps($packages, getDepslist($mirror));
+
+ #- produce an output suitable for visualization.
+ map { pkgs::packageName($_) } pkgs::packagesOfMedium($packages, "Crypto");
+}
sub get {
my ($mirror, $dir, @files) = @_;