diff options
Diffstat (limited to 'Master/tlpkg/etc/updater.pl')
-rwxr-xr-x | Master/tlpkg/etc/updater.pl | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Master/tlpkg/etc/updater.pl b/Master/tlpkg/etc/updater.pl new file mode 100755 index 00000000000..305e035a725 --- /dev/null +++ b/Master/tlpkg/etc/updater.pl @@ -0,0 +1,81 @@ +#!/usr/bin/env perl +# +# updater.pl +# test implementation of an update program +# Copyright 2007 Norbert Preining +# +# This file is licensed under the GNU General Public Licence version 2 +# or any later version + +$^W = 1; +use strict; + +use TLP; +use TLDB; + +my $TEXLIVEROOT = "."; +my $tldblocation = "$TEXLIVEROOT/local.tldb"; + +# setting the location at new time also initializes the tldb! +my $tldb = TLDB->new ( location => $tldblocation ); + +# read package/revision list from stdin +# format: package revision +# later on this should be read from the tug.org server to get the +# information which packages/revisions are available on the net. + +my %netavailable; +while (<>) { + chomp; + next if m/^\s*#/; + if (m/^(\w+)\s+(\d+)$/) { + $netavailable{$1} = $2; + } else { + die "Wrong format of package list: $_!"; + } +} + +foreach (keys %netavailable) { + my $localrev = $tldb->package_revision($_); + if ($localrev) { + # the package is installed + if ($localrev < $netavailable{$_}) { + update_one_package($_,$localrev,$netavailable{$_}); + } + } +} + + +sub update_one_package { + my ($pkgname,$localrev,$netrev) = @_; + print "update local/$localrev -> net/$netrev\n"; + return 1; + # ideas on implementation + # - make temporary directory + # - cd there + # - get package to be updated + # - unpack it there + # - check the included tlp/$package.tlp for NOT satisfied dependencies + my $newtlp = TLP->new; + $newtlp->from_file("tlp/$pkgname.tlp"); + my @deps = $newtlp->depends; + # - if there are unsatisfied deps + # . for each unsatisfied dep do + # update_one_package (in the same dir should work) + # - collect all actions to be carried out from the tlps + # - cp -a * TEXLIVEROOT (this installs all updated packages) + # - update mktexlsr + # - call actions + # - update tldb + $tldb->add_tlp($newtlp); + $tldb->save; + # - remove temporary directory +} + + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # |