diff options
author | Norbert Preining <preining@logic.at> | 2007-05-24 13:09:10 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2007-05-24 13:09:10 +0000 |
commit | 365425b1630d4fe1c84ec068d1edef85f4d90f76 (patch) | |
tree | 4499a63be1c88f0583ca70ed72dd48bca10b992c | |
parent | a1922d7344badedf13d17c382d6f206fca8b4380 (diff) |
work on the TLDB, the updater, and update the API
git-svn-id: svn://tug.org/texlive/trunk@4364 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | new-infra/Perl-API.txt | 8 | ||||
-rw-r--r-- | new-infra/TLDB.pm | 28 | ||||
-rw-r--r-- | new-infra/updater.pl | 34 |
3 files changed, 63 insertions, 7 deletions
diff --git a/new-infra/Perl-API.txt b/new-infra/Perl-API.txt index 85c5afbee9b..31f8c490305 100644 --- a/new-infra/Perl-API.txt +++ b/new-infra/Perl-API.txt @@ -133,6 +133,11 @@ Module TLDB Constructore TLDB->new; + TLDB->new ( location => "path/to/tldb/file" ); + +Read/Write functions (with argument set, without arg read) + + $tldb->location Input/Output @@ -143,6 +148,9 @@ Input/Output without arg to stdout with arg to filehandle + $tldb->save + saves to $self->location; + $tldb->generate_packagelist outputs list of "package revision" for web delivery without arg to stdout diff --git a/new-infra/TLDB.pm b/new-infra/TLDB.pm index b87bd516b11..5d220b8c04d 100644 --- a/new-infra/TLDB.pm +++ b/new-infra/TLDB.pm @@ -12,7 +12,13 @@ use TLP; sub new { my $class = shift; - my $self = {}; + my %params = @_; + my $self = { + location => $params{'location'}; + }; + if (defined($self->{'location'})) { + $self->from_file($self->{'location'}); + } bless $self, $class; return $self; } @@ -27,6 +33,12 @@ sub from_file { if (@_ != 1) { die("Need a filename for initialization!"); } + if (defined($self->{'location'})) { + if ($self->location ne $_[0]) { + printf STDERR "Initialisation from different location as originally given.\nHope you are sure!\n"; + } + } + $self->location($_[0]); open(TMP,"<$_[0]") || die("Cannot open tldb file: $_[0]"); my $found = 0; do { @@ -47,6 +59,13 @@ sub writeout { } } +sub save { + my $self = shift; + open(FOO,">$self->{'location'}") || die("Cannot open $self->{'location'} for writing: $!"); + $self->writeout(\*FOO); + close(FOO); +} + sub get_package { my ($self,$pkg) = @_; if (defined($self->{$pkg})) { @@ -73,6 +92,13 @@ sub generate_packagelist { } } +sub location { + my $self = shift; + if (@_) { $self->{'location'} = shift } + return $self->{'location'}; +} + + 1; ### Local Variables: diff --git a/new-infra/updater.pl b/new-infra/updater.pl index aa5790456d3..1f161ec619b 100644 --- a/new-infra/updater.pl +++ b/new-infra/updater.pl @@ -12,15 +12,16 @@ use strict; use TLP; use TLDB; -my $TLRoot = "."; -my $tldblocation = "$TLRoot/local.tldb"; +my $TEXLIVEROOT = "."; +my $tldblocation = "$TEXLIVEROOT/local.tldb"; -my $tldb = TLDB->new; -$tldb->from_file($tldblocation); +# 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 +# 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 (<>) { @@ -47,6 +48,27 @@ foreach (keys %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 } |