diff options
author | Karl Berry <karl@freefriends.org> | 2012-05-26 18:07:36 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-05-26 18:07:36 +0000 |
commit | 053051acf0c2867c7f420a12fbf16c0179091462 (patch) | |
tree | 6438a30728cd2bfd7b61dce408060fd2e075f3cf /Master | |
parent | 1a403278034ef69ced347d4a046bc4aaf48008af (diff) |
back to parsing catalogue xml directly, no perl dump
git-svn-id: svn://tug.org/texlive/trunk@26663 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/tlpkg/TeXLive/TLUtils.pm | 54 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-auto | 33 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tl-update-tlpdb | 24 |
3 files changed, 54 insertions, 57 deletions
diff --git a/Master/tlpkg/TeXLive/TLUtils.pm b/Master/tlpkg/TeXLive/TLUtils.pm index 51f2cba92b0..70425ff26ed 100644 --- a/Master/tlpkg/TeXLive/TLUtils.pm +++ b/Master/tlpkg/TeXLive/TLUtils.pm @@ -357,9 +357,8 @@ currently based on the value of Perl's C<$^O> variable. =cut -sub win32 -{ - if ($^O=~/^MSWin(32|64)$/i) { +sub win32 { + if ($^O =~ /^MSWin/i) { return 1; } else { return 0; @@ -478,8 +477,7 @@ C<chdir($dir)> or die. =cut -sub xchdir -{ +sub xchdir { my ($dir) = @_; chdir($dir) || die "$0: chdir($dir) failed: $!"; ddebug("xchdir($dir) ok\n"); @@ -492,8 +490,7 @@ Run C<system(@args)> and die if unsuccessful. =cut -sub xsystem -{ +sub xsystem { my (@args) = @_; ddebug("running system(@args)\n"); my $retval = system(@args); @@ -880,8 +877,7 @@ that is a fatal error. =cut -sub copy -{ +sub copy { my $infile = shift; my $filemode = 0; if ($infile eq "-f") { # second argument is a file @@ -1001,8 +997,7 @@ C</absolute/path/to/dir1>. =cut -sub collapse_dirs -{ +sub collapse_dirs { my (@files) = @_; my @ret = (); my %by_dir; @@ -1071,8 +1066,7 @@ returns all the directories from which all content will be removed # case put that directory into the removal list # - return this removal list # -sub removed_dirs -{ +sub removed_dirs { my (@files) = @_; my %removed_dirs; my %by_dir; @@ -2224,8 +2218,7 @@ Returns 1 if different, 0 if the same. =cut -sub tlcmp -{ +sub tlcmp { my ($filea, $fileb) = @_; if (!defined($fileb)) { die <<END_USAGE; @@ -2241,11 +2234,14 @@ END_USAGE } -# Return contents of FNAME as a string, converting all of CR, LF, and -# CRLF to just LF. -# -sub read_file_ignore_cr -{ +=item C<read_file_ignore_cr($file)> + +Return contents of FILE as a string, converting all of CR, LF, and +CRLF to just LF. + +=cut + +sub read_file_ignore_cr { my ($fname) = @_; my $ret = ""; @@ -2501,8 +2497,7 @@ sub download_file { return($ret); } -sub _download_file -{ +sub _download_file { my ($url, $dest, $wgetdefault) = @_; if (win32()) { $dest =~ s!/!\\!g; @@ -3189,8 +3184,7 @@ If HASH is a reference, it is followed. =cut -sub debug_hash -{ +sub debug_hash { my ($label) = shift; my (%hash) = (ref $_[0] && $_[0] =~ /.*HASH.*/) ? %{$_[0]} : @_; @@ -3385,8 +3379,7 @@ and the program has to be C<wget> since we parse the output. =cut -sub query_ctan_mirror -{ +sub query_ctan_mirror { my $wget = $::progs{'wget'}; if (!defined ($wget)) { tlwarn("query_ctan_mirror: Programs not set up, trying wget\n"); @@ -3441,8 +3434,7 @@ Check if MIRROR is functional. =cut -sub check_on_working_mirror -{ +sub check_on_working_mirror { my $mirror = shift; my $wget = $::progs{'wget'}; @@ -3479,8 +3471,7 @@ sub check_on_working_mirror =cut -sub give_ctan_mirror_base -{ +sub give_ctan_mirror_base { my @backbone = qw!http://www.ctan.org/tex-archive http://www.tex.ac.uk/tex-archive http://dante.ctan.org/tex-archive!; @@ -3523,8 +3514,7 @@ sub give_ctan_mirror_base } -sub give_ctan_mirror -{ +sub give_ctan_mirror { return (give_ctan_mirror_base(@_) . "/$TeXLiveServerPath"); } diff --git a/Master/tlpkg/bin/tl-update-auto b/Master/tlpkg/bin/tl-update-auto index a664da9dcf1..44a2e834750 100755 --- a/Master/tlpkg/bin/tl-update-auto +++ b/Master/tlpkg/bin/tl-update-auto @@ -249,23 +249,22 @@ fi fi # !config_scripts_only -# texcatalogue.data -# -if $config_scripts_only; then :; else -$mydir/tl-dump-texcatalogue /home/httpd/html/catalogue >$temp.tcdata.new -# -tcdatafile=texmf/scripts/texlive/var/texcatalogue.data -# -if test ! -s $temp.tcdata.new; then - $verbose " $temp.tcdata.new empty, skipping." -elif $diff $tcdatafile $temp.tcdata.new >$temp.tcdata.diff; then - $verbose " $tcdatafile ok." -else - $chicken $cp $temp.tcdata.new $tcdatafile - update_list="$update_list $tcdatafile" -fi -fi # !config_scripts_only - +# # texcatalogue.data (commented out since no longer dumping) +# # +# if $config_scripts_only; then :; else +# $mydir/tl-dump-texcatalogue /home/httpd/html/catalogue >$temp.tcdata.new +# # +# tcdatafile=texmf/scripts/texlive/var/texcatalogue.data +# # +# if test ! -s $temp.tcdata.new; then +# $verbose " $temp.tcdata.new empty, skipping." +# elif $diff $tcdatafile $temp.tcdata.new >$temp.tcdata.diff; then +# $verbose " $tcdatafile ok." +# else +# $chicken $cp $temp.tcdata.new $tcdatafile +# update_list="$update_list $tcdatafile" +# fi +# fi # !config_scripts_only # ctan mirror list from ctan. diff --git a/Master/tlpkg/bin/tl-update-tlpdb b/Master/tlpkg/bin/tl-update-tlpdb index 760da94639d..ac8e26aefa0 100755 --- a/Master/tlpkg/bin/tl-update-tlpdb +++ b/Master/tlpkg/bin/tl-update-tlpdb @@ -70,7 +70,10 @@ sub main { die "$progname: Master $opt_master not a directory, goodbye.\n"; } - $opt_catalogue = "$opt_master/texmf/scripts/texlive/var/texcatalogue.data" + + $opt_catalogue = "/home/httpd/html/catalogue" + # non-working dump method: + #$opt_catalogue = "$opt_master/texmf/scripts/texlive/var/texcatalogue.data" if ! $opt_catalogue; if ($opt_dry_run) { @@ -82,12 +85,19 @@ sub main { our $tlc = undef; if (-r $opt_catalogue) { info ("$progname: reading TeX Catalogue $opt_catalogue ...\n"); - require ($opt_catalogue); + $tlc = TeXLive::TeXCatalogue->new ("location" => $opt_catalogue); + #my $cat_str = TeXLive::TLUtils::read_file_ignore_cr ($opt_catalogue); + #no strict "refs"; # else eval fails + #eval $cat_str; + #warn "$progname: tlceval: $@" if $@; + #use strict "refs"; } else { tlwarn("$progname: reusing Catalogue data, since file not readable: " . "$opt_catalogue\n"); } - my ($newtlpdb, $pkgcount) = create_tlpdb($tlc); + + # Create our working tlpdb with Catalogue data. + my ($newtlpdb,$pkgcount) = create_tlpdb($tlc); my $oldtlpdb = undef; my $OLDTLPDB = "$opt_master/$TeXLive::TLConfig::InfraLocation/texlive.tlpdb"; @@ -301,15 +311,13 @@ sub create_tlpdb { if (@ARGV) { # if we have cmd line arguments act as if --tlpsrc-from-cmdline was given. if (!$opt_tlpsrc_from_cmdline) { - debug ("$progname: generating tlpdb in /tmp/tlut for @ARGV,\n"); + debug ("$progname: generating tlpdb in /tmp/tlut for @ARGV.\n"); $opt_tlpsrc_from_cmdline = 1; } } if (!$opt_tlpsrc_from_cmdline) { - # if not otherwise given use all tlpsrc files - - # if regenerating the whole thing, push all tlpsrc files onto @ARGV. - chdir ($tlpsrc_dir) || die "chdir($tlpsrc_dir) failed: $!"; + # if not otherwise given, use all tlpsrc files. + chdir ($tlpsrc_dir) || die "$progname: chdir($tlpsrc_dir) failed: $!"; @ARGV = glob ("*.tlpsrc"); } |