diff options
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/tlpkg/bin/tl-update-containers | 79 | ||||
-rwxr-xr-x | Master/tlpkg/bin/tlpdb2pkgver | 7 |
2 files changed, 46 insertions, 40 deletions
diff --git a/Master/tlpkg/bin/tl-update-containers b/Master/tlpkg/bin/tl-update-containers index 7a5a3307808..0d59537d916 100755 --- a/Master/tlpkg/bin/tl-update-containers +++ b/Master/tlpkg/bin/tl-update-containers @@ -4,8 +4,8 @@ # This file is licensed under the GNU General Public License version 2 # or any later version. # -# Generate a zip file for the packages specified on the cmdline, or -# for -all +# Generate an archive file for the packages specified on the cmdline, or +# all if none specified. BEGIN { $^W = 1; @@ -23,16 +23,16 @@ use Getopt::Long; use Pod::Usage; use File::Path; -my $opt_all = 0; our $mydir; my $opt_debug = 0; my $opt_containerdir = "./archive"; my $opt_relative = 0; my $help = 0; -GetOptions("containerdir=s" => \$opt_containerdir, - "debug!" => \$opt_debug, - "help|?" => \$help) or pod2usage(1); +GetOptions( + "containerdir=s" => \$opt_containerdir, + "debug!" => \$opt_debug, + "help|?" => \$help) or pod2usage(1); pod2usage(-exitstatus => 0, -verbose => 2) if $help; @@ -51,7 +51,7 @@ sub main { # get the db. chomp (my $Master = `cd $mydir/../.. && pwd`); # xx TLPDB should default - my $tlpdb = TeXLive::TLPDB->new ("root" => "$Master"); + my $tlpdb = TeXLive::TLPDB->new ("root" => $Master); die("Cannot find tlpdb in $Master!\n") unless defined($tlpdb); my @packs; @packs = $tlpdb->list_packages; @@ -62,21 +62,20 @@ sub main if (($format eq "lzma") || ($format eq "zip")) { $type = $format; } else { - warn "unknown container format specified in 00texlive.config: $format\nIgnoring and continuing with $type!\n"; + warn "$0: unknown container format specified in 00texlive.config: $format" + . "; ignoring and continuing with $type"; } + # read in the old texlive.pkgver and save the revisions my %archiverevs; - if (-r "$opt_containerdir/texlive.pkgver") { - open(TMP,"<$opt_containerdir/texlive.pkgver") or - die "Cannot open $opt_containerdir/texlive.pkgver for reading: $!\nPlease use tlpdb2container first!\n"; - while (<TMP>) { - my ($pkg,$rev) = split; - $archiverevs{$pkg} = $rev; - } - close(TMP); - } else { - die "No $opt_containerdir/texlive.pkgver, please use tlpdb2container first!\n"; + open(TMP,"<$opt_containerdir/texlive.pkgver") + or die "open($opt_containerdir/texlive.pkgver) failed: $!"; + while (<TMP>) { + my ($pkg,$rev) = split; + $archiverevs{$pkg} = $rev; } + close(TMP); + # collect packages to be updated: my @todopacks; for my $pkg (@packs) { @@ -84,55 +83,63 @@ sub main if (defined($archiverevs{$pkg})) { $oldrev = $archiverevs{$pkg}; } else { - tllog($::LOG_DEBUG, "found a new package without container: $pkg\n"); + tllog($::LOG_DEBUG, "$pkg is new, found no container\n"); } + my $tlp = $tlpdb->get_package($pkg); my $newrev = 0; if (defined($tlp)) { $newrev = $tlp->revision; } else { - tllog($::LOG_NORMAL, "It looks like $pkg has disappeared, removing its containers!\n"); + tllog($::LOG_NORMAL, "$pkg has disappeared, removing its containers\n"); `rm $opt_containerdir/$pkg.*`; } + if ($oldrev == $newrev) { tllog($::LOG_DEBUG, "$pkg up to date\n"); } elsif ($oldrev < $newrev) { push @todopacks, $pkg; } else { - # huhh, the new rev is SMALLER then the oldrev?!?! - die "This shouldn't happen, the revision of $pkg in texlive.tlpdb is OLDER than the one in $opt_containerdir/texlive.pkgver.\nAre you sure???\n"; + die "This shouldn't happen! The revision of $pkg in texlive.tlpdb" + . "($newrev) is OLDER than the one in" + . "$opt_containerdir/texlive.pkgver ($oldrev), goodbye"; } } + # get list of packages. for my $pkg (sort @todopacks) { next if ($pkg eq "00texlive.config"); next if ($pkg eq "00texlive.installer"); my $obj = $tlpdb->get_package ($pkg); - die "$0: no TeX Live package named $pkg in $Master.\n" if ! $obj; - printf STDERR "updating $pkg containers ...\n"; + die "$0: no TeX Live package named $pkg in $Master" if ! $obj; + print "$0: updating $pkg containers ...\n"; if ($srcsplit) { my $objsrc = $obj->split_src_package; if ($objsrc) { - $objsrc->make_container($type,$Master,$opt_containerdir,"$pkg.source",$opt_relative); + $objsrc->make_container($type,$Master,$opt_containerdir,"$pkg.source", + $opt_relative); } } if ($docsplit) { my $objdoc = $obj->split_doc_package; if ($objdoc) { - $objdoc->make_container($type,$Master,$opt_containerdir,"$pkg.doc",$opt_relative); + $objdoc->make_container($type,$Master,$opt_containerdir,"$pkg.doc", + $opt_relative); } } $obj->make_container($type,$Master,$opt_containerdir,$pkg,$opt_relative); } + if (@todopacks) { - # we did update something - printf STDERR "updating $opt_containerdir/texlive.pkgver ...\n"; - open(TMP,">$opt_containerdir/texlive.pkgver") or die "Cannot create $opt_containerdir/texlive.pkgver"; + # we updated something + print "$0: updating $opt_containerdir/texlive.pkgver ...\n"; + open(TMP,">$opt_containerdir/texlive.pkgver") + or die "open(>$opt_containerdir/texlive.pkgver) failed: $!"; $tlpdb->generate_packagelist(\*TMP); close(TMP); - print "all done.\n"; + print "$0: all done.\n"; } else { - printf STDERR "Nothing to be done.\n"; + print "$0: nothing to be done.\n"; } } @@ -154,17 +161,16 @@ tl-update-containers [OPTION]... =item B<-containerdir> I<containerdir> The location where the previously generated containers are to be found, -defaults to ./zip. +defaults to C<./archive>. =back The standard options C<-help> and C<-debug> are also accepted. See the tlpfiles documentation for details. -Note that the format of the containers and the splitting off of source -and documentation files are controlled by the TLPDB options saved in the -pseudo package C<00texlive.config>. Please see the documentation for TLPDB -for details. +The format of the containers and the splitting off of source and +documentation files are controlled by the TLPDB options in the +pseudo-package C<00texlive.config>. See the documentation for TLPDB. =head1 DESCRIPTION @@ -174,6 +180,7 @@ as found in the C<containerdir> with the revisions of the packages in the C<texlive.tlpdb>. In case the latter is more recent (i.e., a higher number) the containers are updated. + =head1 AUTHORS AND COPYRIGHT This script and its documentation were written for the TeX Live diff --git a/Master/tlpkg/bin/tlpdb2pkgver b/Master/tlpkg/bin/tlpdb2pkgver index 504fc454c3a..b52ad9097d4 100755 --- a/Master/tlpkg/bin/tlpdb2pkgver +++ b/Master/tlpkg/bin/tlpdb2pkgver @@ -1,7 +1,6 @@ #!/usr/bin/env perl # $Id$ -# create-package-list -# Create the minimal package list (tlpver) of the current installation. +# Find the minimal package list (tlpver) of the current installation. # Copyright 2007, 2008 Norbert Preining # # This file is licensed under the GNU General Public License version 2 @@ -64,9 +63,9 @@ See the tlpfiles documentation for details. =head1 DESCRIPTION -B<tlpdb2pkgver> generates the minimal list of packages with revisions +B<tlpdb2pkgver> generates the short list of package names with revisions (C<tlpdb.pkgver>) from the TeX Live installation present at the location -specified at the command line. +specified on the command line. Output is to stdout. =head1 AUTHORS AND COPYRIGHT |