diff options
Diffstat (limited to 'Master/tlpkg/bin/tlpsrc2tlpobj')
-rwxr-xr-x | Master/tlpkg/bin/tlpsrc2tlpobj | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/Master/tlpkg/bin/tlpsrc2tlpobj b/Master/tlpkg/bin/tlpsrc2tlpobj index 3425055997f..73c7aaadaec 100755 --- a/Master/tlpkg/bin/tlpsrc2tlpobj +++ b/Master/tlpkg/bin/tlpsrc2tlpobj @@ -8,7 +8,7 @@ BEGIN { $^W = 1; - chomp ($mydir = `dirname $0`); + chomp ($mydir = `dirname $0`); unshift (@INC, "$mydir/.."); } @@ -22,53 +22,52 @@ use Getopt::Long; use Pod::Usage; use File::Path; - -my $opt_master = "/src/TeX/texlive-svn/Master"; -my $opt_outputdir = "./tlpobj"; -my $help = 0; my $opt_catalogue = ""; +chomp (my $opt_master = `cd $::mydir/../.. && pwd`); +my $opt_outputdir = "./tlpobj"; +my $opt_help = 0; TeXLive::TLUtils::process_logging_options(); - GetOptions( - "master=s" => \$opt_master, # location of the tree "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue + "master=s" => \$opt_master, # location of the tree "outputdir=s" => \$opt_outputdir, - "help|?" => \$help) or pod2usage(1); - -pod2usage(-exitstatus => 0, -verbose => 2) if $help; + "help|?" => \$opt_help) or pod2usage(1); +pod2usage ('-exitstatus' => 0, '-verbose' => 2) if $opt_help; -if (! -d "$opt_master") { - die "Master $opt_master does not exists!"; +die "Master $opt_master not a directory" if ! -d $opt_master; +if (! -d $opt_outputdir) { + mkpath ($opt_outputdir); + die "mkdir($opt_outputdir) failed: $!" if ! -d $opt_outputdir; } -if (! -d "$opt_outputdir") { - mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; -} - -my $tlc; +my $tlc = undef; if (! -d "$opt_catalogue") { - info("$0: -d /Cat/a/logue not given, continuing without it.\n"); + info ("$0: -d /Cat/a/logue not given, continuing without it.\n"); } else { require TeXLive::TeXCatalogue; # not at compile time, for now anyway. - $tlc = TeXLive::TeXCatalogue->new( 'location' => "$opt_catalogue" ); + $tlc = TeXLive::TeXCatalogue->new ('location' => $opt_catalogue); } -my $tltree = TeXLive::TLTREE->new( 'svnroot' => "$opt_master" ); +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); - my $tlcname = defined($tlp->catalogue) ? $tlp->catalogue : $tlp->name; - if ($tlc) { - $tlp->update_from_catalogue($tlc); - } - my $name = $tlp->name; - open(FOO,">$opt_outputdir/$name.tlpobj") or die "Cannot create $opt_outputdir/$name.tlpobj!"; - $tlp->writeout(\*FOO); - close(FOO); + my $tlsrc = new TeXLive::TLPSRC; + $tlsrc->from_file ($f); + + my $tlp = $tlsrc->make_tlpobj ($tltree); + if ($tlc) { + $tlp->update_from_catalogue ($tlc); + } + + my $name = $tlp->name; + + my $OUT; + $OUT = ">$opt_outputdir/$name.tlpobj"; + open (OUT, $OUT) || die "create($OUT) failed: $!"; + $tlp->writeout (\*OUT); + close (OUT) || warn "close($OUT) failed: $!"; } __END__ @@ -86,26 +85,32 @@ tlpsrc2tlpobj [OPTION]... [TLPSRC]... =over 8 =item B<-catalogue> I<Catalogue_dir> + The location given by B<-catalogue> must point to a valid TeX Catalogue. No default value. If given, the generated tlpobj files will contain information gathered from the TeX Catalogue. =item B<-master> I<Master_dir> + The location given by B<-master> must point to a valid svn repository of TeX Live's Master direcory. Defaults to C<../..> of C<$0>. =item B<-outputdir> I<output_dir> -Specifies the location where tlp files are created. Defaults to C<./tlp>. + +Specifies the location where tlpobj files are created; default C<./tlpobj>. =back -The standard options C<-help> and C<-debug> are also accepted. -See the tlpfiles documentation for details. +The standard options C<-help> and The standard options B<-q>, B<-v>, and +B<-logfile>=I<file> are also accepted; see the +C<process_logging_options> function in L<TeXLive::TLUtils> for details. =head1 DESCRIPTION B<tlpsrc2tlpobj> converts TeX Live Package Source files (tlpsrc) into -TeX Live Package Object files (tlpobj). +TeX Live Package Object files (tlpobj). The process and the file +formats are described in various separate documents in the C<tlpkg/doc> +directory. =head1 AUTHORS AND COPYRIGHT |