summaryrefslogtreecommitdiff
path: root/Master/tlpkg/bin
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-06-16 16:40:35 +0000
committerNorbert Preining <preining@logic.at>2007-06-16 16:40:35 +0000
commit743cca7613b9a0948fa316f703a5861b4ba4e516 (patch)
treedcf1336c07536754972ef8214e96f7d04d205f6a /Master/tlpkg/bin
parent8e0118f7fbebfae6bab089e5d7b16fb86d3a5deb (diff)
reshuffle and clean up
git-svn-id: svn://tug.org/texlive/trunk@4442 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/bin')
-rw-r--r--Master/tlpkg/bin/create-package-list.pl23
-rw-r--r--Master/tlpkg/bin/create_tlp_simple.pl30
-rw-r--r--Master/tlpkg/bin/tlp2tldb.pl82
-rw-r--r--Master/tlpkg/bin/tlsrc2tlp.pl114
-rw-r--r--Master/tlpkg/bin/updater.pl80
5 files changed, 329 insertions, 0 deletions
diff --git a/Master/tlpkg/bin/create-package-list.pl b/Master/tlpkg/bin/create-package-list.pl
new file mode 100644
index 00000000000..1f2b4906b39
--- /dev/null
+++ b/Master/tlpkg/bin/create-package-list.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl -w
+#
+# create-package-list.pl
+# Create thepackage list of the current installation
+# Copyright 2007 Norbert Preining
+#
+# This file is licensed under the GNU General Public Licence version 2
+# or any later version
+
+use strict;
+
+use TLDB;
+use Data::Dumper;
+
+my $TLRoot = ".";
+my $tldblocation = "$TLRoot/local.tldb";
+
+my $tldb = TLDB->new;
+$tldb->from_file($tldblocation);
+
+$tldb->generate_packagelist;
+
+
diff --git a/Master/tlpkg/bin/create_tlp_simple.pl b/Master/tlpkg/bin/create_tlp_simple.pl
new file mode 100644
index 00000000000..e8911e190ae
--- /dev/null
+++ b/Master/tlpkg/bin/create_tlp_simple.pl
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl -w
+
+use strict;
+use lib '../new-infra';
+
+use TLSRC;
+use TLP;
+use TLTREE;
+use Data::Dumper;
+
+#our $opt_debug=1;
+
+my $tltree = TLTREE->new( 'svnroot' => "/src/TeX/texlive-svn/Master" );
+print "Initializing tltree start: ", `date`;
+$tltree->init_from_statusfile("/src/TeX/texlive-svn/Master/svn.status");
+print "Initializing tltree stop: ", `date`;
+
+foreach my $f (@ARGV) {
+ my $tlsrc = new TLSRC;
+ $tlsrc->from_file($f);
+ print "WORKING ON $f\n";
+ my $tlp = $tlsrc->make_tlp($tltree);
+ my $name = $tlp->name;
+ open(FOO,">tlp/$name.tlp");
+ $tlp->writeout_simple(\*FOO);
+ close(FOO);
+}
+
+
+print "End of operation: ", `date`;
diff --git a/Master/tlpkg/bin/tlp2tldb.pl b/Master/tlpkg/bin/tlp2tldb.pl
new file mode 100644
index 00000000000..0d70aff7423
--- /dev/null
+++ b/Master/tlpkg/bin/tlp2tldb.pl
@@ -0,0 +1,82 @@
+#!/usr/bin/env perl -w
+#
+# tlp2tldb.pl
+# convert a set of tlp files (given as arguments) into a tldb
+# Copyright 2007 Norbert Preining
+#
+# This file is licensed under the GNU General Public Licence version 2
+# or any later version
+#
+
+BEGIN {
+ ($mydir = $0) =~ s,/[^/]*$,,;
+ unshift (@INC, $mydir);
+}
+
+use strict;
+
+use TLP;
+use TLDB;
+use Getopt::Long;
+use Pod::Usage;
+use File::Path;
+
+our $opt_debug = 0;
+my $man = 0;
+my $help = 0;
+
+GetOptions("debug!", 'help|?' => \$help, man => \$man) or pod2usage(2);
+
+pod2usage(1) if $help;
+pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+
+my $tldb = TLDB->new;
+foreach my $f (@ARGV) {
+ my $tlp = new TLP;
+ $tlp->from_file($f);
+ $tldb->add_tlp($tlp);
+}
+$tldb->writeout;
+
+
+__END__
+
+=head1 NAME
+
+tlp2tldb - Converting tlp files into a tldb file
+
+=head1 SYNOPSIS
+
+tlp2tldb [options] [tlsrcfiles ...]
+
+ Options:
+ -help brief help message
+ -man full documentation
+ -debug get debug messages from TL* modules
+
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-help>
+
+Print a brief help message and exits.
+
+=item B<-man>
+
+Prints the manual page and exits.
+
+=item B<-debug>
+
+Give debug messages from the TeX Live modules
+
+=back
+
+=head1 DESCRIPTION
+
+B<tlp2tldb> converts TeX Live Package (tlp) files into TeX Live Database
+(tldb).
+
+=cut
+
diff --git a/Master/tlpkg/bin/tlsrc2tlp.pl b/Master/tlpkg/bin/tlsrc2tlp.pl
new file mode 100644
index 00000000000..2c888af4e68
--- /dev/null
+++ b/Master/tlpkg/bin/tlsrc2tlp.pl
@@ -0,0 +1,114 @@
+#!/usr/bin/env perl -w
+#
+# tlsrc2tlp.pl
+# convert a set of tlsrc files (given as arguments) into tlp
+# Copyright 2007 Norbert Preining
+#
+# This file is licensed under the GNU General Public Licence version 2
+# or any later version
+#
+
+BEGIN {
+ ($mydir = $0) =~ s,/[^/]*$,,;
+ unshift (@INC, $mydir);
+}
+
+use strict;
+
+use TLSRC;
+use TLP;
+use TLTREE;
+use Getopt::Long;
+use Pod::Usage;
+use File::Path;
+
+
+my $opt_master = "/src/TeX/texlive-svn/Master";
+my $opt_outputdir = "./tlp";
+our $opt_debug = 0;
+my $man = 0;
+my $help = 0;
+
+GetOptions("debug!", # debug mode
+ "master=s" => \$opt_master, # location of the tree
+ "outputdir=s" => \$opt_outputdir,
+ 'help|?' => \$help, man => \$man
+ ) or pod2usage(2);
+
+pod2usage(1) if $help;
+pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+
+if (! -d "$opt_master") {
+ die "Master $opt_master does not exists!";
+}
+
+if (! -d "$opt_outputdir") {
+ mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!";
+}
+
+my $tltree = TLTREE->new( 'svnroot' => "$opt_master" );
+$tltree->init_from_svn;
+
+foreach my $f (@ARGV) {
+ my $tlsrc = new TLSRC;
+ $tlsrc->from_file($f);
+ my $tlp = $tlsrc->make_tlp($tltree);
+ my $name = $tlp->name;
+ open(FOO,">$opt_outputdir/$name.tlp") or die "Cannot create $opt_outputdir/$name.tlp!";
+ $tlp->writeout(\*FOO);
+ close(FOO);
+}
+
+
+__END__
+
+=head1 NAME
+
+tlsrc2tlp - Converting tlsrc files into tlp files
+
+=head1 SYNOPSIS
+
+tlsrc2tlp [options] [tlsrcfiles ...]
+
+ Options:
+ -help brief help message
+ -man full documentation
+ -master=s set Master of TeX Live tree
+ -outputdir=s specify the directory where tlp files are created
+ -debug get debug messages from TL* modules
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-help>
+
+Print a brief help message and exits.
+
+=item B<-man>
+
+Prints the manual page and exits.
+
+=item B<-master>
+
+The location given by B<-master> must point to a valid svn repository
+of TeX Live Master direcory. Defaults to /src/TeX/texlive-svn/Master
+
+=item B<-outputdir>
+
+Specifies the location where tlp files are created. Defaults to ./tlp
+
+=item B<-debug>
+
+Give debug messages from the TeX Live modules
+
+=back
+
+=head1 DESCRIPTION
+
+B<tlsrc2tlp> converts TeX Live Source (tlsrc) files into TeX Live Package
+files (tlp).
+
+=cut
+
+
diff --git a/Master/tlpkg/bin/updater.pl b/Master/tlpkg/bin/updater.pl
new file mode 100644
index 00000000000..1f161ec619b
--- /dev/null
+++ b/Master/tlpkg/bin/updater.pl
@@ -0,0 +1,80 @@
+#!/usr/bin/env perl -w
+#
+# 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
+
+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: #