summaryrefslogtreecommitdiff
path: root/Master/tlpkg/etc
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2008-10-18 15:35:26 +0000
committerNorbert Preining <preining@logic.at>2008-10-18 15:35:26 +0000
commita0e30e2ca600f66034c28c3d232bd5a3feb6f022 (patch)
tree2cffb0cf7f73c37f57c831c0a19e961510f2023d /Master/tlpkg/etc
parent2e04581aa63834b0b92499f35f21cf63ebf846d6 (diff)
start work on supporting local copies of remote database
git-svn-id: svn://tug.org/texlive/trunk@11009 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/etc')
-rw-r--r--Master/tlpkg/etc/tlmgr-use-saved-remote-tlpdb.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/tlmgr-use-saved-remote-tlpdb.patch b/Master/tlpkg/etc/tlmgr-use-saved-remote-tlpdb.patch
new file mode 100644
index 00000000000..4f52da053d5
--- /dev/null
+++ b/Master/tlpkg/etc/tlmgr-use-saved-remote-tlpdb.patch
@@ -0,0 +1,66 @@
+Index: tlmgr.pl
+===================================================================
+--- tlmgr.pl (revision 11008)
++++ tlmgr.pl (working copy)
+@@ -79,6 +79,7 @@
+ use Cwd qw/abs_path/;
+ use Pod::Usage;
+ use Getopt::Long qw(:config no_autoabbrev require_order);
++use Digest::MD5 qw(md5_hex);
+ use strict;
+
+ # used variables
+@@ -1864,14 +1865,52 @@
+ # uses the global $location.
+ #
+ sub init_tlmedia {
++ # compute the md5 digest for the location
++ my $locmdv = md5_hey($location);
+ if (($location =~ m/$TeXLiveServerURL/) ||
+ ($location =~ m/^ctan$/i)) {
+ $location = give_ctan_mirror();
+ }
+ info("tlmgr: installation location $location\n");
++ if ($location =~ m/^(http|ftp):/i) {
++ # try to download the md5hash from the location
++ my $root = $localtlpdb->root;
++ my $temp = "$root/temp";
++ my $remotefilemdvfile = "$temp/md5.$locmdv";
++ my $remote_tlpdb_copy = "$root/$InfraLocation/texlive.tlpdb.$locmdv";
++ my $ret = TeXLive::TLUtils::download_file("$location/$InfraLocation/${DatabaseName}.md5", "$remotefilemdvfile");
++ if ($ret && (-r "$lzmafile")) {
++ # we found a md5 hash
++ # we have to check the md5hash against the md5 hash of the local file
++ my $local_digest = TeXLive::TLUtils::tlmd5("$remote_tlpdb_copy");
++ if (open (FOO, "<$remotefilemdvfile")) {
++ my $remote_digest = <FOO>;
++ close(FOO);
++ if ($remote_digest eq $local_digest) {
++ # that is fine, we have the same database, don't re-download it
++ $tlmediasrc = TeXLive::TLMedia->new($location, $remote_tlpdb_copy, "good");
++ die ("NOT KNOW WHY") unless defined($tlmediasrc);
++ }
++ } else {
++ debug("Cannot read md5 sum from downloaded file $remotefilemdvfile\n");
++ # we will read it again
++ }
++ } else {
++ tlwarn("We seem to be off line.\n");
++ if (-r "$remote_tlpdb_copy") {
++ tlwarn("Using local copy of remote database, installation may not succeed.\n");
++ $tlmediasrc = TeXLive::TLMedia->new($location, $remote_tlpdb_copy, "maybe_good");
++ die ("NOT KNOW WHY") unless defined($tlmediasrc);
++ } else {
++ # do nothing, we will try below to download the tlpdb ...
++ }
++ }
++ }
+ # $tlmediasrc is a global variable
+- $tlmediasrc = TeXLive::TLMedia->new($location);
++ $tlmediasrc = TeXLive::TLMedia->new($location) unless defined($tlmediasrc);
+ die($loadmediasrcerror . $location) unless defined($tlmediasrc);
++ # save the md5hash of
++ tlwarn("TODO TODO TODO ....");
+ }
+
+ #