diff options
author | Norbert Preining <preining@logic.at> | 2007-11-06 07:17:45 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-11-06 07:17:45 +0000 |
commit | 856c302ab0fcc0b0fe092323ed182e2e49e2c034 (patch) | |
tree | 27a260ab1c80718342ef0e4310bdec2b1dbd8142 | |
parent | 880ce57583e2765a9c7735b3a1516722a5959ff3 (diff) |
fixes to tlpsrc2zip, but should be rewritten as tlpdb2zip ...
git-svn-id: svn://tug.org/texlive/trunk@5364 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2zip | 83 |
1 files changed, 67 insertions, 16 deletions
diff --git a/Master/tlpkg/bin/tlpsrc2zip b/Master/tlpkg/bin/tlpsrc2zip index a3616eefbff..13e28ea9628 100755 --- a/Master/tlpkg/bin/tlpsrc2zip +++ b/Master/tlpkg/bin/tlpsrc2zip @@ -22,12 +22,15 @@ use Pod::Usage; use File::Path; -my $opt_master = "/src/TeX/texlive-svn/Master"; +my $opt_all = 0; +chomp (my $opt_master = `cd $::mydir/../.. && pwd`); +my $opt_catalogue = ""; my $opt_outputdir = "./zip"; our $opt_debug = 0; my $help = 0; GetOptions( + "all!" => \$opt_all, "master=s" => \$opt_master, # location of the tree "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue "outputdir=s" => \$opt_outputdir, @@ -35,22 +38,63 @@ GetOptions( pod2usage(-exitstatus => 0, -verbose => 2) if $help; -if (! -d "$opt_master") { - die "Master $opt_master does not exists!"; -} - -if (! -d "$opt_outputdir") { - mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; -} +exit(&main ()); + +sub main +{ + if (! -d "$opt_master") { + die "$0: Master $opt_master not a directory, goodbye.\n"; + } + + if (! -d "$opt_outputdir") { + mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; + } + + my $tlc = undef; + if (! -d $opt_catalogue) { + warn "$0: -c /Cat/a/logue not given, continuing without it.\n"; + } else { + require TeXLive::TeXCatalogue; # not at compile time, for now anyway. + warn "$0: reading TeX Catalogue tree $opt_catalogue ...\n"; + $tlc = TeXLive::TeXCatalogue->new( "location" => $opt_catalogue ); + } -my $tltree = TeXLive::TLTREE->new( 'svnroot' => "$opt_master" ); -$tltree->init_from_svn; - -foreach my $f (@ARGV) { - my $tlsrc = new TeXLive::TLPSRC; - $tlsrc->from_file($f); - my $tlp = $tlsrc->make_tlpobj($tltree); - $tlp->make_zip($tltree,$opt_outputdir); + # if we're regenerating the whole thing, get all our tlpsrc files. + if ($opt_all) { + my $tlpsrc_dir = "$opt_master/tlpkg/tlpsrc"; + chdir ($tlpsrc_dir) || die "chdir($tlpsrc_dir) failed: $!"; + @ARGV = glob ("*.tlpsrc"); + } + + warn "$0: reading Master tree $opt_master ...\n"; + my $tltree = TeXLive::TLTREE->new( "svnroot" => $opt_master ); + $tltree->init_from_svn; + + my $last = ""; + my $src_count = 0; + foreach my $f (@ARGV) { + if ($opt_all) { # progress report + my $first = lc (substr ($f, 0, 1)); + if ($first ne $last) { + print STDERR "$first "; + $last = $first; + } + $src_count++; + } + my $tlsrc = new TeXLive::TLPSRC; + $tlsrc->from_file($f); + my $tlp = $tlsrc->make_tlpobj($tltree); + + if ($tlc) { + # merge TeX Catalogue information + $tlp->update_from_catalogue ($tlc); + } + + $tlp->make_zip($tltree,$opt_outputdir); + } + warn "\n"; + + return 0; } __END__ @@ -67,6 +111,9 @@ tlpsrc2zip [OPTION]... [TLPSRC]... =over 8 +=item B<-all> +Generate zip files for all .tlpsrc files in C<Master/tlpkg/tlpsrc/*.tlpsrc>. + =item B<-master> I<Master_dir> The location given by B<-master> must point to a valid svn repository of TeX Live Master direcory. Defaults to C<../..> of C<$0>. @@ -84,6 +131,10 @@ See the tlpfiles documentation for details. B<tlpsrc2zip> converts TeX Live Package Source files (tlpsrc) into zip files containing all the files in the package. +If a TeX Catalogue hierarchy is specified, additional information from +the catalogue are merged into the database (see L<TeXLive::TLPOBJ> for +the list of included information from the TeX Catalogue). + Note that a copy of the created TeX Live Package Object file (.tlpobj) is always included in the zip file in .tlpobj/NAME.tlpobj. |