From 395b98a9ece78fb75fe68b8182a4992f83cabef4 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 28 Oct 2008 23:50:25 +0000 Subject: move some scripts to tlpkg/archive git-svn-id: svn://tug.org/texlive/trunk@11096 c570f23f-e606-0410-a88d-b1316a301751 --- Master/tlpkg/archive/create-tlsrc-from-tpm.pl | 326 ++++++++++++++++++++++++++ Master/tlpkg/archive/create_tlp_simple.pl | 30 +++ Master/tlpkg/archive/read-tpm-dump-tpl.pl | 314 +++++++++++++++++++++++++ Master/tlpkg/archive/tlpdb2container | 160 +++++++++++++ Master/tlpkg/archive/tlpdb2list | 86 +++++++ Master/tlpkg/archive/tlpsrc2container | 176 ++++++++++++++ Master/tlpkg/archive/tlpsrc2tlpobj | 128 ++++++++++ 7 files changed, 1220 insertions(+) create mode 100755 Master/tlpkg/archive/create-tlsrc-from-tpm.pl create mode 100755 Master/tlpkg/archive/create_tlp_simple.pl create mode 100755 Master/tlpkg/archive/read-tpm-dump-tpl.pl create mode 100755 Master/tlpkg/archive/tlpdb2container create mode 100755 Master/tlpkg/archive/tlpdb2list create mode 100755 Master/tlpkg/archive/tlpsrc2container create mode 100755 Master/tlpkg/archive/tlpsrc2tlpobj (limited to 'Master/tlpkg/archive') diff --git a/Master/tlpkg/archive/create-tlsrc-from-tpm.pl b/Master/tlpkg/archive/create-tlsrc-from-tpm.pl new file mode 100755 index 00000000000..08d8fb8bc3c --- /dev/null +++ b/Master/tlpkg/archive/create-tlsrc-from-tpm.pl @@ -0,0 +1,326 @@ +#!/usr/bin/env perl +# +# tpm2deb-source.pl +# machinery to create debian packages from TeX Live depot +# (c) 2005, 2006 Norbert Preining +# +# $Id: tpm2deb-source.pl 2691 2007-04-16 09:42:22Z frank $ +# +# configuration is done via the file tpm2deb.cfg +# + +use strict; +no strict 'refs'; +# use warnings; +# no warnings 'uninitialized'; + +my $_tmp; + +my $opt_master; +our $opt_nosrcpkg; +our $opt_noremove; +my $globalreclevel; +my $oldsrcdir; +my $datadump ; + +BEGIN { + my $upstream_modules = "/usr/share/tex-common/"; + unshift (@INC, "./all/debian"); + unshift (@INC, $upstream_modules); +} + +my ($mydir,$mmydir); +($mydir = $0) =~ s,/[^/]*$,,; +if ($mydir eq $0) { $mydir = `pwd` ; chomp($mydir); } +if (!($mydir =~ m,/.*,,)) { $mmydir = `pwd`; chomp($mmydir); $mydir = "$mmydir/$mydir" ; } + + +# $opt_master = "./LocalTPM"; +my $opt_debug = 0; +$opt_nosrcpkg = 0; +$opt_noremove = 0; +$globalreclevel = 1; +$oldsrcdir = "./src"; +$datadump = "tpm.data"; + +use Getopt::Long; +# use Data::Dumper; + +#use Strict; +use File::Basename; +use File::Copy; +use File::Path; +use File::Temp qw/ tempfile tempdir /; +use Storable; +## not needed, atm we are calling eperl binary use Parse::ePerl; +#use XML::DOM; +use Cwd; +#use FileUtils qw(canon_dir cleandir make_link newpath member +# normalize substitute_var_val dirname diff_list remove_list +# rec_rmdir sync_dir walk_dir start_redirection stop_redirection); +#use Tpm; +# +# Configuration for destination of files +# DONT USER DOUBLE QUOTES; THESE VARIABLES HAVE TO GET REEVALUATED +# AFTER $tmpdir IS SET!! +# +my $changelog = ""; +my $changelogversion = ""; +my $changelogextraversion = ""; +my $changelogrevision = ""; +my $changelogdistribution = ""; +my $allowed_dists = "(unstable|UNRELEASED|sarge-backports|etch-backports|stable-security|experimental)"; + + +our $Master; + +$Master = `pwd`; +chomp($Master); +my $TpmGlobalPath = $Master; +my $DataGlobalPath = $Master; + +unshift (@INC, "$Master/../Build/tools"); +File::Basename::fileparse_set_fstype('unix'); + + +use Getopt::Long; +use File::Basename; +use File::Copy; +use File::Path; +use File::Temp qw/ tempfile tempdir /; +use Storable; +use Cwd; +use Tpm; + +our (%TeXLive); +our (%Config,%TpmData); +our %TexmfTreeOfType = ( "TLCore" => "texmf", + "Documentation" => "texmf-doc", + "Package" => "texmf-dist"); +our @TpmCategories = keys %TexmfTreeOfType; +our %TypeOfTexmfTree = reverse %TexmfTreeOfType; + +# pre set $opt_master to ./LocalTPM which contains also the Tools dir +# this is set in the main script, and changed with commandline option. +# should it maybe be deleted here? + +my $opt_onlyscripts; + +sub populate_TpmData_from_dump { + my $datafile = $_[0]; + my $tpmdataref = retrieve($datafile); + %TpmData = %{$tpmdataref}; +} + +sub load_collection_tpm_data { + # local functions + sub trim { + my ($str) = @_; + $str =~ s/^[\n\s]+//; + $str =~ s/[\n\s]+$//; + return $str; + } + sub get_requires { + my ($tpm,$type) = @_; + my %requires = $tpm->getHash("Requires"); + my @keylist = keys %requires; + my @tlcorereqlist = (); + my @packagereqlist = (); + if ($type eq '') { + $type = "all"; + } + foreach my $k (keys %requires) { + foreach my $e (@{$requires{$k}}) { + # manually exclude Windows-only packages + if ($e eq "bin-bzip2") {} + elsif ($e eq "bin-xpdf") {} + elsif ($e eq "bin-chktex") {} + elsif ($e eq "bin-ghostscript") {} + elsif ($e eq "bin-gzip") {} + elsif ($e eq "bin-jpeg2ps") {} + elsif ($e eq "bin-perl") {} + elsif ($e eq "bin-windvi") {} + elsif ($e eq "lib-freetype2") {} + elsif ($e eq "lib-gd") {} + elsif ($e eq "lib-geturl") {} + elsif ($e eq "lib-gnu") {} + elsif ($e eq "lib-gs") {} + elsif ($e eq "lib-jpeg") {} + elsif ($e eq "lib-md5") {} + elsif ($e eq "lib-png") {} + elsif ($e eq "lib-regex") {} + elsif ($e eq "lib-texmfmp") {} + elsif ($e eq "lib-tiff") {} + elsif ($e eq "lib-ttf") {} + elsif ($e eq "lib-xpdf") {} + elsif ($e eq "lib-xpm") {} + elsif ($e eq "lib-zlib") {} + elsif ($e =~ /^bin-(.*)$/) { + push @packagereqlist, "$k/$e"; + } + elsif ($e =~ /^hyphen-(.*)$/){ + push @packagereqlist, "$k/$e"; + } + elsif ($k eq "TLCore") { + push @tlcorereqlist, "$k/$e"; + } else { + push @packagereqlist, "$k/$e"; + } + } + } + if ($type eq '' || $type eq 'all') { + my %foo; + $foo{'TLCore'} = \@tlcorereqlist; + $foo{'Package'} = \@packagereqlist; + #my @foo=(@tlcorereqlist,@packagereqlist); + #return(@foo); + return(\%foo); + } elsif ($type eq 'TLCore') { + return(@tlcorereqlist); + } elsif ($type eq 'Package') { + return(@packagereqlist); + } else { + die("Don't know this type: $type!\n"); + } + } + # start of real function + print "Start loading tpm data ... \n"; + foreach my $t ('TLCore', 'Documentation', 'Package') { + my $subtree = ${TexmfTreeOfType}{$t}; + foreach my $f (<$Master/$subtree/tpm/*.tpm>) { + print "Working on $f\n"; + my $shortn = basename($f); + $shortn =~ s,\.tpm$,,; + if ($shortn !~ m/^scheme-/) { next ; } + my $tpm = Tpm->new("$subtree/tpm/$shortn.tpm"); + $TpmData{$t}{$shortn}{'BinPatterns'} = [ $tpm->getList("BinPatterns") ]; + $TpmData{$t}{$shortn}{'DocPatterns'} = [ $tpm->getList("DocPatterns") ]; + $TpmData{$t}{$shortn}{'RunPatterns'} = [ $tpm->getList("RunPatterns") ]; + $TpmData{$t}{$shortn}{'SourcePatterns'} = [ $tpm->getList("SourcePatterns") ]; + $TpmData{$t}{$shortn}{'BinFiles'} = [ $tpm->getFileList("BinFiles") ]; + $TpmData{$t}{$shortn}{'DocFiles'} = [ $tpm->getFileList("DocFiles") ]; + $TpmData{$t}{$shortn}{'RunFiles'} = [ $tpm->getFileList("RunFiles") ]; + $TpmData{$t}{$shortn}{'SourceFiles'} = [ $tpm->getFileList("SourceFiles") ]; + $TpmData{$t}{$shortn}{'RemoteFiles'} = [ $tpm->getFileList("RemoteFiles") ]; + $TpmData{$t}{$shortn}{'Title'} = trim($tpm->getAttribute("Title")); + # print "got title $TpmData{$t}{$shortn}{'Title'}\n"; + $TpmData{$t}{$shortn}{'Description'} = trim($tpm->getAttribute("Description")); + $TpmData{$t}{$shortn}{'License'} = trim($tpm->getAttribute("License")); + my @foo = $tpm->getList("Installation"); + $TpmData{$t}{$shortn}{'Installation'} = \@foo ; + my $alldeps = get_requires($tpm,'all'); + my @incs = @{$alldeps->{'Package'}}; + my @deps = @{$alldeps->{'TLCore'}}; + $TpmData{$t}{$shortn}{'Package'} = \@incs; + $TpmData{$t}{$shortn}{'TLCore'} = \@deps; + } + } + print " ... done\n"; +} + +sub create_tlsrc_files { + print "Creating tlsrc files TpmData\n\n"; + #foreach my $t ('TLCore', 'Documentation', 'Package') { + foreach my $t ('TLCore', 'Documentation') { + print "Creating tlsrc for $t:\n"; + my %foo = %{$TpmData{$t}}; + foreach my $p (keys %foo) { + open (FOO,">tlsrc/$p.tlsrc") || die("Cannot open tlsrc/$p.tlsrc!"); + print FOO "name $p\n"; + print FOO "category $t\n"; + if ($TpmData{$t}{$p}{'Title'} !~ /^[[:space:]]*$/) { + print FOO "shortdesc $TpmData{$t}{$p}{'Title'}\n"; + } + $_tmp = "$TpmData{$t}{$p}{'Description'}"; + if (defined($_tmp) && ($_tmp !~ /^[[:space:]]*$/)) { + $_tmp = "longdesc $_tmp"; + write FOO; + } + #print FOO "longdesc $TpmData{$t}{$p}{'Description'}\n"; + foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { + print FOO "depend $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { + print FOO "depend $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'SourcePatterns'}}) { + print FOO "SourcePatterns f $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'BinPatterns'}}) { + print FOO "binpatterns f $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'DocPatterns'}}) { + print FOO "docpatterns f $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'RunPatterns'}}) { + next if ($foo =~ /\.tpm$/); + print FOO "runpatterns f $foo\n"; + } + foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { + my %foo = %{$ex}; + print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; + } + close(FOO); + } + } + return (0); + foreach my $t ('Package') { + print "Creating tlsrc for $t:\n"; + my %foo = %{$TpmData{$t}}; + foreach my $p (keys %foo) { + open (FOO,">tlsrc/$p.tlsrc") || die("Cannot open tlsrc/$p.tlsrc!"); + print FOO "name $p\n"; + foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { + print FOO "depend $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { + print FOO "depend $foo\n"; + } + foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { + my %foo = %{$ex}; + print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; + } + close(FOO); + } + } +} + + +&main(@ARGV); + +1; + +# variables needed outside of main +my $version; +my $revision; +my $extraversion; +my $date; +my $arch; +my $shortl; + +sub main { + ${Tpm::MasterDir} = $TeXLive{'all'}{'tpm_global_path'}; + $arch = "all"; + ${Tpm::CurrentArch} = "i386-linux"; + ${Tpm::MasterDir} = $Master; + load_collection_tpm_data(); + create_tlsrc_files(); +} + +##################################### +# +# Formats +# +format FOO = +^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$_tmp + ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< +$_tmp +. + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # diff --git a/Master/tlpkg/archive/create_tlp_simple.pl b/Master/tlpkg/archive/create_tlp_simple.pl new file mode 100755 index 00000000000..79b2f10e690 --- /dev/null +++ b/Master/tlpkg/archive/create_tlp_simple.pl @@ -0,0 +1,30 @@ +#!/usr/bin/env perl + +$^W = 1 +use strict; + +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/archive/read-tpm-dump-tpl.pl b/Master/tlpkg/archive/read-tpm-dump-tpl.pl new file mode 100755 index 00000000000..a35072c0da8 --- /dev/null +++ b/Master/tlpkg/archive/read-tpm-dump-tpl.pl @@ -0,0 +1,314 @@ +#!/usr/bin/env perl +# +# tpm2deb-source.pl +# machinery to create debian packages from TeX Live depot +# (c) 2005, 2006 Norbert Preining +# +# $Id: tpm2deb-source.pl 2691 2007-04-16 09:42:22Z frank $ +# +# configuration is done via the file tpm2deb.cfg +# + +use strict; +no strict 'refs'; +# use warnings; +# no warnings 'uninitialized'; + +my $opt_master; +our $opt_debug; +our $opt_nosrcpkg; +our $opt_noremove; +my $globalreclevel; +my $oldsrcdir; +my $datadump ; + +BEGIN { + my $upstream_modules = "/usr/share/tex-common/"; + unshift (@INC, "./all/debian"); + unshift (@INC, $upstream_modules); +} + +my ($mydir,$mmydir); +($mydir = $0) =~ s,/[^/]*$,,; +if ($mydir eq $0) { $mydir = `pwd` ; chomp($mydir); } +if (!($mydir =~ m,/.*,,)) { $mmydir = `pwd`; chomp($mmydir); $mydir = "$mmydir/$mydir" ; } + + +# $opt_master = "./LocalTPM"; +$opt_debug = 0; +$opt_nosrcpkg = 0; +$opt_noremove = 0; +$globalreclevel = 1; +$oldsrcdir = "./src"; +$datadump = "tpm.data"; + +use Getopt::Long; +# use Data::Dumper; + +#use Strict; +use File::Basename; +use File::Copy; +use File::Path; +use File::Temp qw/ tempfile tempdir /; +use Storable; +## not needed, atm we are calling eperl binary use Parse::ePerl; +#use XML::DOM; +use Cwd; +#use FileUtils qw(canon_dir cleandir make_link newpath member +# normalize substitute_var_val dirname diff_list remove_list +# rec_rmdir sync_dir walk_dir start_redirection stop_redirection); +#use Tpm; +# +# Configuration for destination of files +# DONT USER DOUBLE QUOTES; THESE VARIABLES HAVE TO GET REEVALUATED +# AFTER $tmpdir IS SET!! +# +my $changelog = ""; +my $changelogversion = ""; +my $changelogextraversion = ""; +my $changelogrevision = ""; +my $changelogdistribution = ""; +my $allowed_dists = "(unstable|UNRELEASED|sarge-backports|etch-backports|stable-security|experimental)"; + + +our $Master; +our %TpmData; + +$Master = `pwd`; +chomp($Master); +my $TpmGlobalPath = $Master; +my $DataGlobalPath = $Master; + +unshift (@INC, "$Master/../Build/tools"); +File::Basename::fileparse_set_fstype('unix'); + + +use Getopt::Long; +use File::Basename; +use File::Copy; +use File::Path; +use File::Temp qw/ tempfile tempdir /; +use Storable; +use Cwd; +use Tpm; + +our (%TeXLive); +our (%Config,%TpmData); +our %TexmfTreeOfType = ( "TLCore" => "texmf", + "Documentation" => "texmf-doc", + "Package" => "texmf-dist"); +our @TpmCategories = keys %TexmfTreeOfType; +our %TypeOfTexmfTree = reverse %TexmfTreeOfType; + +# pre set $opt_master to ./LocalTPM which contains also the Tools dir +# this is set in the main script, and changed with commandline option. +# should it maybe be deleted here? + +my $opt_debug; +my $opt_onlyscripts; + +sub populate_TpmData_from_dump { + my $datafile = $_[0]; + my $tpmdataref = retrieve($datafile); + %TpmData = %{$tpmdataref}; +} + +sub load_collection_tpm_data { + # local functions + sub trim { + my ($str) = @_; + $str =~ s/^[\n\s]+//; + $str =~ s/[\n\s]+$//; + return $str; + } + sub get_requires { + my ($tpm,$type) = @_; + my %requires = $tpm->getHash("Requires"); + my @keylist = keys %requires; + my @tlcorereqlist = (); + my @packagereqlist = (); + if ($type eq '') { + $type = "all"; + } + foreach my $k (keys %requires) { + foreach my $e (@{$requires{$k}}) { + # manually exclude Windows-only packages + if ($e eq "bin-bzip2") {} + elsif ($e eq "bin-xpdf") {} + elsif ($e eq "bin-chktex") {} + elsif ($e eq "bin-ghostscript") {} + elsif ($e eq "bin-gzip") {} + elsif ($e eq "bin-jpeg2ps") {} + elsif ($e eq "bin-perl") {} + elsif ($e eq "bin-windvi") {} + elsif ($e eq "lib-freetype2") {} + elsif ($e eq "lib-gd") {} + elsif ($e eq "lib-geturl") {} + elsif ($e eq "lib-gnu") {} + elsif ($e eq "lib-gs") {} + elsif ($e eq "lib-jpeg") {} + elsif ($e eq "lib-md5") {} + elsif ($e eq "lib-png") {} + elsif ($e eq "lib-regex") {} + elsif ($e eq "lib-texmfmp") {} + elsif ($e eq "lib-tiff") {} + elsif ($e eq "lib-ttf") {} + elsif ($e eq "lib-xpdf") {} + elsif ($e eq "lib-xpm") {} + elsif ($e eq "lib-zlib") {} + elsif ($e =~ /^bin-(.*)$/) { + push @packagereqlist, "$k/$e"; + } + elsif ($e =~ /^hyphen-(.*)$/){ + push @packagereqlist, "$k/$e"; + } + elsif ($k eq "TLCore") { + push @tlcorereqlist, "$k/$e"; + } else { + push @packagereqlist, "$k/$e"; + } + } + } + if ($type eq '' || $type eq 'all') { + my %foo; + $foo{'TLCore'} = \@tlcorereqlist; + $foo{'Package'} = \@packagereqlist; + #my @foo=(@tlcorereqlist,@packagereqlist); + #return(@foo); + return(\%foo); + } elsif ($type eq 'TLCore') { + return(@tlcorereqlist); + } elsif ($type eq 'Package') { + return(@packagereqlist); + } else { + die("Don't know this type: $type!\n"); + } + } + # start of real function + print "Start loading tpm data ... \n"; + foreach my $t ('TLCore', 'Documentation', 'Package') { + my $subtree = ${TexmfTreeOfType}{$t}; + foreach my $f (<$Master/$subtree/tpm/*.tpm>) { + print "Working on $f\n"; + my $shortn = basename($f); + $shortn =~ s,\.tpm$,,; + if (($t eq 'TLCore') && ($shortn =~ m/^scheme-/)) { next ; } + my $tpm = Tpm->new("$subtree/tpm/$shortn.tpm"); + foreach my $a (@Tpm::ArchList) { + ${Tpm::CurrentArch} = $a; + $TpmData{$t}{$shortn}{'BinFiles'}{$a} = [ $tpm->getFileList("BinFiles") ]; + } + #$TpmData{$t}{$shortn}{'BinFiles'} = [ $tpm->getFileList("BinFiles") ]; + $TpmData{$t}{$shortn}{'DocFiles'} = [ $tpm->getFileList("DocFiles") ]; + $TpmData{$t}{$shortn}{'RunFiles'} = [ $tpm->getFileList("RunFiles") ]; + $TpmData{$t}{$shortn}{'SourceFiles'} = [ $tpm->getFileList("SourceFiles") ]; + $TpmData{$t}{$shortn}{'RemoteFiles'} = [ $tpm->getFileList("RemoteFiles") ]; + $TpmData{$t}{$shortn}{'Title'} = trim($tpm->getAttribute("Title")); + # print "got title $TpmData{$t}{$shortn}{'Title'}\n"; + $TpmData{$t}{$shortn}{'Description'} = trim($tpm->getAttribute("Description")); + $TpmData{$t}{$shortn}{'License'} = trim($tpm->getAttribute("License")); + my @foo = $tpm->getList("Installation"); + $TpmData{$t}{$shortn}{'Installation'} = \@foo ; + my $alldeps = get_requires($tpm,'all'); + my @incs = @{$alldeps->{'Package'}}; + my @deps = @{$alldeps->{'TLCore'}}; + $TpmData{$t}{$shortn}{'Package'} = \@incs; + $TpmData{$t}{$shortn}{'TLCore'} = \@deps; + } + } + print " ... done\n"; +} + +sub dump_tpm_data { + print "Dumping TpmData\n\n"; + foreach my $t ('TLCore', 'Documentation', 'Package') { + #foreach my $t ('Package') { + print "Dumping $t:\n"; + my %foo = %{$TpmData{$t}}; + foreach my $p (keys %foo) { + open (FOO,">tlptpm/$p.tlp") || die("Cannot open tlptpm/$p.tpmtlp!"); + print FOO "name $p\n"; + print FOO "category $t\n"; + foreach my $foo (@{$TpmData{$t}{$p}{'Package'}}) { + print FOO "depend $foo\n"; + } + foreach my $foo (@{$TpmData{$t}{$p}{'TLCore'}}) { + print FOO "depend $foo\n"; + } + foreach my $ex (@{$TpmData{$t}{$p}{'Installation'}}) { + my %foo = %{$ex}; + print FOO "execute $foo{'function'} $foo{'mode'} $foo{'parameter'}\n"; + } + my @foo; + @foo = @{$TpmData{$t}{$p}{'DocFiles'}}; + if ($#foo >= 0) { + print FOO "docfiles\n"; + foreach my $foo (sort @foo) { + print FOO " $foo\n"; + } + } + @foo = @{$TpmData{$t}{$p}{'SourceFiles'}}; + if ($#foo >= 0) { + print FOO "srcfiles\n"; + foreach my $foo (sort @foo) { + print FOO " $foo\n"; + } + } + @foo = @{$TpmData{$t}{$p}{'RunFiles'}}; + if ($#foo >= 1) { + print FOO "runfiles\n"; + foreach my $foo (sort @foo) { + next if ($foo =~ /\.tpm$/); + print FOO " $foo\n"; + } + } + @foo = @{$TpmData{$t}{$p}{'RemoteFiles'}}; + if ($#foo >= 0) { + print FOO "remotefiles\n"; + foreach my $foo (sort @foo) { + print FOO " $foo\n"; + } + } + foreach my $a (sort @Tpm::ArchList) { + @foo = @{$TpmData{$t}{$p}{'BinFiles'}{$a}}; + if ($#foo >= 0) { + print FOO "binfiles arch=$a\n"; + foreach my $foo (sort @foo) { + print FOO " $foo\n"; + } + } + } + close(FOO); + } + } +} + + +&main(@ARGV); + +1; + +# variables needed outside of main +my $version; +my $revision; +my $extraversion; +my $date; +my $arch; +my $shortl; + +sub main { + ${Tpm::MasterDir} = $TeXLive{'all'}{'tpm_global_path'}; + $arch = "all"; + ${Tpm::CurrentArch} = "i386-linux"; + ${Tpm::MasterDir} = $Master; + load_collection_tpm_data(); + dump_tpm_data(); +} + + +### Local Variables: +### perl-indent-level: 4 +### tab-width: 4 +### indent-tabs-mode: t +### End: +# vim:set tabstop=4: # diff --git a/Master/tlpkg/archive/tlpdb2container b/Master/tlpkg/archive/tlpdb2container new file mode 100755 index 00000000000..e40473b68d4 --- /dev/null +++ b/Master/tlpkg/archive/tlpdb2container @@ -0,0 +1,160 @@ +#!/usr/bin/env perl +# $Id: tlpdb2container 5188 2007-10-14 20:32:44Z karl $ +# Copyright 2007 Norbert Preining +# 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 + +BEGIN { + $^W = 1; + ($mydir = $0) =~ s,/[^/]*$,,; + unshift (@INC, "$mydir/.."); +} + +use strict; + +use TeXLive::TLConfig; +use TeXLive::TLPOBJ; +use TeXLive::TLPDB; +use TeXLive::TLUtils; +use Getopt::Long; +use Pod::Usage; +use File::Path; + +my $opt_all = 0; +our $mydir; +my $opt_outputdir = "./archive"; +my $opt_relative = 0; +my $help = 0; + +TeXLive::TLUtils::process_logging_options(); + +GetOptions("o|outputdir=s" => \$opt_outputdir, + "a|all!" => \$opt_all, + "r|relative!" => \$opt_relative, + "h|help|?" => \$help) or pod2usage(1); + +pod2usage(-exitstatus => 0, -verbose => 2) if $help; + +my $srcsplit = 0; +my $docsplit = 0; +my $type = "lzma"; + +exit (&main ()); + +sub main +{ + # get the db. + chomp (my $Master = `cd $mydir/../.. && pwd`); # xx TLPDB should default + my $tlpdb = TeXLive::TLPDB->new ("root" => "$Master"); + die("Cannot find tlpdb in $Master!\n") unless defined($tlpdb); + my @packs; + if ($opt_all) { + @packs = $tlpdb->list_packages; + } else { + @packs = @ARGV; + } + # get configuration of package splitting + $srcsplit = $tlpdb->config_src_container; + $docsplit = $tlpdb->config_doc_container; + my $format = $tlpdb->config_container_format; + if (($format eq "lzma") || ($format eq "zip")) { + $type = $format; + } else { + info("unknown container format specified in 00texlive.config: $format\nIgnoring and continuing with $type!\n"); + } + # get list of packages. + my $last = ""; + my $src_count = 0; + for my $pkg (sort @packs) { + next if ($pkg eq "00texlive.config"); + next if ($pkg eq "00texlive.installer"); + if ($opt_all) { + my $first = lc (substr ($pkg, 0, 1)); + if ($first ne $last) { + print STDERR "$first "; + $last = $first; + } + } + my $obj = $tlpdb->get_package ($pkg); + die "$0: no TeX Live package named $pkg in $Master.\n" if ! $obj; + if ($srcsplit) { + my $objsrc = $obj->srcfiles_package; + if ($objsrc) { + $objsrc->make_container($type,$Master,$opt_outputdir,"$pkg.source",$opt_relative); + $src_count++; + } + } + if ($docsplit) { + my $objdoc = $obj->docfiles_package; + if ($objdoc) { + $objdoc->make_container($type,$Master,$opt_outputdir,"$pkg.doc",$opt_relative); + $src_count++; + } + } + $obj->make_container($type,$Master,$opt_outputdir,$pkg,$opt_relative); + $src_count++; + } +} + + + +__END__ + +=head1 NAME + +tlpdb2container - generate container files (zip,tar.lzma) of a package + +=head1 SYNOPSIS + +tlpdb2container [OPTION]... + +=head1 OPTIONS + +=over 4 + +=item B<-all> +build container file for all packages present in the tlpdb. + +=item B<-outputdir> I +The location where created container files are placed, defaults to ./zip. + +=item B<-relative> +Create a relative package, see TeXLive::TLPOBJ.1 for details. + +=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. + + +=head1 DESCRIPTION + +To distribute packages over the network and on installation media the +packages are wrapped into container files. These container are either +simple zip files or tar.lzma file containing all the files of the package. + +B generates container files from a TeX Live Database and the +respective installation. + +=head1 AUTHORS AND COPYRIGHT + +This script and its documentation were written for the TeX Live +distribution (L) and both are licensed under the +GNU General Public License Version 2 or later. + +=cut + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2 expandtab: # diff --git a/Master/tlpkg/archive/tlpdb2list b/Master/tlpkg/archive/tlpdb2list new file mode 100755 index 00000000000..c3ab78bc550 --- /dev/null +++ b/Master/tlpkg/archive/tlpdb2list @@ -0,0 +1,86 @@ +#!/usr/bin/env perl +# $Id$ +# Copyright 2007, 2008 Norbert Preining +# This file is licensed under the GNU General Public License version 2 +# or any later version. +# +# Create list files from tlpdb. + +BEGIN { + $^W = 1; + ($mydir = $0) =~ s,/[^/]*$,,; + unshift (@INC, "$mydir/.."); +} + +use strict; + +use TeXLive::TLPOBJ; +use TeXLive::TLPDB; +use Getopt::Long; +use Pod::Usage; +use TeXLive::TLUtils; +use File::Path; + +my $opt_outputdir = "new-list"; +my $help = 0; + +TeXLive::TLUtils::process_logging_options(); + +GetOptions("outputdir=s" => \$opt_outputdir, + "help|?" => \$help) or pod2usage(1); + +pod2usage(-exitstatus => 0, -verbose => 2) if $help; +pod2usage(1) if ($#ARGV<0); + +if (! -d $opt_outputdir) { + mkpath ($opt_outputdir) or die "cannot mkdir $opt_outputdir: $!"; +} + +die "cannot read tlpdb $ARGV[0]." if (! -r "$ARGV[0]"); + +my $tlpdb = new TeXLive::TLPDB (root => $ARGV[0]); +$tlpdb->generate_listfiles ($opt_outputdir); + +__END__ + +=head1 NAME + +tlpdb2list - generates list files from a TeX Live Package Database + +=head1 SYNOPSIS + +tlpdb2list [OPTION]... /path/to/installation/root/ + +=head1 OPTIONS + +=over 4 + +=item B<-outputdir> I +Specifies the location where list files are created. Defaults to +C<./new-list>. + +=back + +The standard options C<-help>, C<-q>, and C<-v> are also accepted. +See the tlpfiles documentation for details. + +=head1 DESCRIPTION + +B generates list files necessary for the installer from the +TeX Live Package Database found in the installation given on the +command line. + +=head1 AUTHORS AND COPYRIGHT + +This script and its documentation were written for the TeX Live +distribution (L) and both are licensed under the +GNU General Public License Version 2 or later. + +=cut + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2: # diff --git a/Master/tlpkg/archive/tlpsrc2container b/Master/tlpkg/archive/tlpsrc2container new file mode 100755 index 00000000000..d79e365840c --- /dev/null +++ b/Master/tlpkg/archive/tlpsrc2container @@ -0,0 +1,176 @@ +#!/usr/bin/env perl +# $Id$ +# create container file(s) for all tlpsrc arguments +# +# Copyright 2007, 2008 Norbert Preining +# This file is licensed under the GNU General Public License version 2 +# or any later version. + +BEGIN { + $^W = 1; + chomp ($mydir = `dirname $0`); + unshift (@INC, "$mydir/.."); +} + +use strict; + +use TeXLive::TLPSRC; +use TeXLive::TLPOBJ; +use TeXLive::TLTREE; +use TeXLive::TLUtils; +use Cwd; +use Getopt::Long; +use Pod::Usage; +use File::Path; + + +my $opt_all = 0; +chomp (my $opt_master = `cd $::mydir/../.. && pwd`); +my $opt_catalogue = ""; +my $opt_type = "zip"; +my $opt_outputdir = "./zip"; +my $help = 0; + +TeXLive::TLUtils::process_logging_options(); + +GetOptions( + "all!" => \$opt_all, + "master=s" => \$opt_master, # location of the tree + "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue + "outputdir=s" => \$opt_outputdir, + "type=s" => \$opt_type, + "help|?" => \$help) or pod2usage(1); + +pod2usage(-exitstatus => 0, -verbose => 2) if $help; + +exit(&main ()); + +sub main +{ + if (! -d "$opt_master") { + die "$0: Master $opt_master not a directory, goodbye.\n"; + } + + if (! -d "$opt_outputdir") { + mkpath("$opt_outputdir") or die "Cannot mkdir $opt_outputdir!"; + } + # we have an relative zipdir, so we have to make it absolute + my $cwd = &getcwd; + if ("$opt_outputdir" !~ m@^/@) { + $opt_outputdir = "$cwd/$opt_outputdir"; + } + + my $tlc = undef; + if (! -d $opt_catalogue) { + info("$0: -c /Cat/a/logue not given, continuing without it.\n"); + } else { + require TeXLive::TeXCatalogue; # not at compile time, for now anyway. + info("$0: reading TeX Catalogue tree $opt_catalogue ...\n"); + $tlc = TeXLive::TeXCatalogue->new( "location" => $opt_catalogue ); + } + + # if we're regenerating the whole thing, get all our tlpsrc files. + if ($opt_all) { + my $tlpsrc_dir = "$opt_master/tlpkg/tlpsrc"; + chdir ($tlpsrc_dir) || die "chdir($tlpsrc_dir) failed: $!"; + @ARGV = glob ("*.tlpsrc"); + } + + info("$0: reading Master tree $opt_master ...\n"); + my $tltree = TeXLive::TLTREE->new( "svnroot" => $opt_master ); + $tltree->init_from_svn; + + my $last = ""; + my $src_count = 0; + foreach my $f (@ARGV) { + if ($opt_all) { # progress report + my $first = lc (substr ($f, 0, 1)); + if ($first ne $last) { + print STDERR "$first "; + $last = $first; + } + $src_count++; + } + my $tlsrc = new TeXLive::TLPSRC; + $tlsrc->from_file($f); + my $tlp = $tlsrc->make_tlpobj($tltree); + + if ($tlc) { + # merge TeX Catalogue information + $tlp->update_from_catalogue ($tlc); + } + + $tlp->make_container($opt_type,$opt_master,$opt_outputdir); + } + warn "\n"; + + return 0; +} + +__END__ + +=head1 NAME + +tlpsrc2container - create container file(s) from tlpsrc files + +=head1 SYNOPSIS + +tlpsrc2container [OPTION]... [TLPSRC]... + +=head1 OPTIONS + +=over 4 + +=item B<-all> +Generate container files for all .tlpsrc files in C. + +=item B<-outputdir> I +The location where created container files are placed, defaults to ./zip. + +=item B<-master> I +The location given by B<-master> must point to a valid svn repository +of TeX Live Master direcory. Defaults to C<../..> of C<$0>. + +=item B<-catalogue> I +The location given by B<-catalogue> must point to a valid TeX Catalogue. +No default value. If given, the included tlpobj files will contain information +gathered from the TeX Catalogue. + +=item B<-type> I +Specifies the type of container to be used. C generates zip files, +while C generates .tar.lzma files. + +=back + +The standard options C<-help> and C<-debug> are also accepted. +See the tlpfiles documentation for details. + + +=head1 DESCRIPTION + +To distribute packages over the network and on installation media the +packages are wrapped into container files. These container are either +simple zip files or tar.lzma file containing all the files of the package. + +B converts TeX Live Package Source files (tlpsrc) into +container files containing all the files in the package. + +If a TeX Catalogue hierarchy is specified, additional information from +the catalogue are merged into the database (see L for +the list of included information from the TeX Catalogue). + + +=head1 AUTHORS AND COPYRIGHT + +This script and its documentation were written for the TeX Live +distribution (L) and both are licensed under the +GNU General Public License Version 2 or later. + +=cut + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2 expandtab: # diff --git a/Master/tlpkg/archive/tlpsrc2tlpobj b/Master/tlpkg/archive/tlpsrc2tlpobj new file mode 100755 index 00000000000..3135dafd243 --- /dev/null +++ b/Master/tlpkg/archive/tlpsrc2tlpobj @@ -0,0 +1,128 @@ +#!/usr/bin/env perl +# $Id$ +# tlpsrc2tlpobj - convert tlpsrc files (given as arguments) to tlpobj +# +# Copyright 2007, 2008 Norbert Preining +# This file is licensed under the GNU General Public License version 2 +# or any later version. + +BEGIN { + $^W = 1; + chomp ($mydir = `dirname $0`); + unshift (@INC, "$mydir/.."); +} + +use strict; + +use TeXLive::TLPSRC; +use TeXLive::TLPOBJ; +use TeXLive::TLTREE; +use TeXLive::TLUtils; +use Getopt::Long; +use Pod::Usage; +use File::Path; + +my $opt_catalogue = ""; +chomp (my $opt_master = `cd $::mydir/../.. && pwd`); +my $opt_outputdir = "./tlpobj"; +my $opt_help = 0; + +TeXLive::TLUtils::process_logging_options(); +GetOptions( + "catalogue=s" => \$opt_catalogue, # location of the TeX Catalogue + "master=s" => \$opt_master, # location of the tree + "outputdir=s" => \$opt_outputdir, + "help|?" => \$opt_help) or pod2usage(1); +pod2usage ('-exitstatus' => 0, '-verbose' => 2) if $opt_help; + +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; +} + +my $tlc = undef; +if (! -d "$opt_catalogue") { + 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); +} + +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); + 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__ + +=head1 NAME + +tlpsrc2tlpobj - convert tlpsrc files into tlpobj files + +=head1 SYNOPSIS + +tlpsrc2tlpobj [OPTION]... [TLPSRC]... + +=head1 OPTIONS + +=over 4 + +=item B<-catalogue> I + +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 + +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 + +Specifies the location where tlpobj files are created; default C<./tlpobj>. + +=back + +The standard options B<-q>, B<-v>, and B<-logfile>=I are also +accepted; see the C function in +L for details. + +=head1 DESCRIPTION + +B converts TeX Live Package Source files (tlpsrc) into +TeX Live Package Object files (tlpobj). The process and the file +formats are described elsewhere. See L and +L. + +=head1 AUTHORS AND COPYRIGHT + +This script and its documentation were written for the TeX Live +distribution (L) and both are licensed under the +GNU General Public License Version 2 or later. + +=cut + +### Local Variables: +### perl-indent-level: 2 +### tab-width: 2 +### indent-tabs-mode: nil +### End: +# vim:set tabstop=2: # -- cgit v1.2.3