summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2007-12-03 12:57:34 +0000
committerNorbert Preining <preining@logic.at>2007-12-03 12:57:34 +0000
commit9edb5feefe19dfb1ba540bbcca521a1904136609 (patch)
treea7719b27f161de8fc38c2aadf1bdf6daf53eee27 /Master
parente09c1aed2cf9bc6ee41fb50eaecab031f4cdcc99 (diff)
implement TLPDB->fmtutil_cnf_lines, updmap_cfg_lines, language_dat_lines
and use them in the installer git-svn-id: svn://tug.org/texlive/trunk@5696 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-xMaster/install-tl.pl124
-rw-r--r--Master/tlpkg/TeXLive/TLPDB.pm148
2 files changed, 199 insertions, 73 deletions
diff --git a/Master/install-tl.pl b/Master/install-tl.pl
index e371d1b6cd5..35eb18cf89a 100755
--- a/Master/install-tl.pl
+++ b/Master/install-tl.pl
@@ -169,7 +169,9 @@ if ($opt_profile eq "") {
calc_depends();
prepare_installation();
do_install_packages();
-parse_executes_and_create_files();
+create_fmtutil();
+create_updmap();
+create_language();
do_postinst_stuff();
dump_vars('./vars');
# if we installed from a profile we don't need to write it out
@@ -489,6 +491,7 @@ sub prepare_installation {
$localtlpdb=new TeXLive::TLPDB;
$localtlpdb->location("$localtlpdbfile");
+ $localtlpdb->root("$vars{'TEXDIR'}");
}
sub do_install_packages {
@@ -536,83 +539,62 @@ sub do_install_packages {
$localtlpdb->save;
}
-sub parse_executes_and_create_files {
- my %maps;
- my %fmtcnffiles;
- my %hypcnffiles;
- foreach my $p ($localtlpdb->list_packages) {
- my $obj = $tlpdb->get_package ($p);
- die "No TeX Live package named $p, strange.\n" if ! $obj;
- foreach my $e ($obj->executes) {
- if ($e =~ m/addMap (.*)$/) {
- $maps{$1} = 1;
- } elsif ($e =~ m/addMixedMap (.*)$/) {
- $maps{$1} = 2;
- } elsif ($e =~ m/BuildFormat (.*)$/) {
- $fmtcnffiles{$1} = 1;
- } elsif ($e =~ m/BuildLanguageDat (.*)$/) {
- $hypcnffiles{$1} = 1;
- } else {
-# die "Unknown execute for package $p: $e\n";
- }
- }
- }
- # updmap.cfg -> TEXMFSYSVAR/web2c
- my $updmapcfgpath = "$vars{'TEXMFSYSVAR'}/web2c/updmap.cfg";
- open(UPDHDR,"<$vars{'TEXDIR'}/texmf/web2c/updmap-hdr.cfg")
- or die("Cannot find $vars{'TEXDIR'}/texmf/web2c/updmap-hdr.cfg!\n");
- open(UPDMAPCFG,">$updmapcfgpath")
- or die("Cannot open $updmapcfgpath for writing!\n");
- foreach (<UPDHDR>) { print UPDMAPCFG ; }
- close(UPDHDR);
- foreach (sort keys %maps) {
- print UPDMAPCFG "Mixed" if ($maps{$_} == 2);
- print UPDMAPCFG "Map $_\n";
- }
- close(UPDMAPCFG);
- #
- # fmtutil.cnf -> TEXMFSYSVAR/web2c
- my @formatlines;
- open(INFILE,"<$vars{'TEXDIR'}/texmf/fmtutil/fmtutil-hdr.cnf")
- or die("Cannot open $vars{'TEXDIR'}/texmf/fmtutil/fmtutil-hdr.cnf\n");
- my @tmp = <INFILE>;
- close (INFILE);
- push @formatlines, @tmp;
- foreach my $f (keys %fmtcnffiles) {
- open(INFILE,"<$vars{'TEXDIR'}/texmf/fmtutil/format.$f.cnf")
- or die("Cannot open $vars{'TEXDIR'}/texmf/fmtutil/format.$f.cnf");
- @tmp = <INFILE>;
- close(INFILE);
- push @formatlines, @tmp;
+sub create_fmtutil {
+ my @lines = $localtlpdb->fmtutil_cnf_lines;
+ if (-r "$vars{'TEXMFLOCAL'}/web2c/fmtutil-local.cnf") {
+ #
+ # this should be done more intelligently, but for now only add those
+ # lines without any duplication check ...
+ open FOO, "<$vars{'TEXMFLOCAL'}/web2c/fmtutil-local.cnf"
+ or die "strange -r but cannot open?\n";
+ my @tmp = <FOO>;
+ push @lines, @tmp;
}
- if ($#formatlines >= 0) {
+ if ($#lines >= 0) {
my $fmtutilpath = "$vars{'TEXMFSYSVAR'}/web2c/fmtutil.cnf";
open(OUTFILE,">$fmtutilpath")
or die("Cannot open $fmtutilpath for writing!\n");
- foreach (@formatlines) { print OUTFILE; }
+ foreach (@lines) { print OUTFILE; }
close(OUTFILE);
}
- # hyphenation patterns
- my @languagelines = ();
- # we first have to add language.us
- open(INFILE,"<$vars{'TEXDIR'}/texmf/tex/generic/config/language.us")
- or die("Cannot open $vars{'TEXDIR'}/texmf/tex/generic/config/language.us");
- @tmp = <INFILE>;
- close(INFILE);
- push @languagelines, @tmp;
- # now do the other languages
- foreach my $f (keys %hypcnffiles) {
- open(INFILE,"<$vars{'TEXDIR'}/texmf/tex/generic/config/language.$f.dat")
- or die("Cannot open $vars{'TEXDIR'}/texmf/tex/generic/config/language.$f.dat");
- my @tmp = <INFILE>;
- close(INFILE);
- push @languagelines, @tmp;
+}
+
+sub create_updmap {
+ my @lines = $localtlpdb->updmap_cfg_lines;
+ if (-r "$vars{'TEXMFLOCAL'}/web2c/updmap-local.cfg") {
+ #
+ # this should be done more intelligently, but for now only add those
+ # lines without any duplication check ...
+ open FOO, "<$vars{'TEXMFLOCAL'}/web2c/updmap-local.cfg"
+ or die "strange -r but cannot open?\n";
+ my @tmp = <FOO>;
+ push @lines, @tmp;
+ }
+ if ($#lines >= 0) {
+ my $updmapcfgpath = "$vars{'TEXMFSYSVAR'}/web2c/updmap.cfg";
+ open(OUTFILE,">$updmapcfgpath")
+ or die("Cannot open $updmapcfgpath for writing!\n");
+ foreach (@lines) { print OUTFILE; }
+ close(OUTFILE);
+ }
+}
+
+sub create_language {
+ my @lines = $localtlpdb->language_dat_lines;
+ if (-r "$vars{'TEXMFLOCAL'}/tex/generic/config/language-local.dat") {
+ #
+ # this should be done more intelligently, but for now only add those
+ # lines without any duplication check ...
+ open FOO, "<$vars{'TEXMFLOCAL'}/tex/generic/config/language-local.dat"
+ or die "strange -r but cannot open?\n";
+ my @tmp = <FOO>;
+ push @lines, @tmp;
}
- if ($#languagelines >= 0) {
- `mkdir -p $vars{'TEXMFSYSVAR'}/tex/generic/config`;
- open(OUTFILE, ">$vars{'TEXMFSYSVAR'}/tex/generic/config/language.dat")
- or die("Cannot open $vars{'TEXMFSYSVAR'}/tex/generic/config/language.dat for writing");
- foreach (@languagelines) { print OUTFILE; }
+ if ($#lines >= 0) {
+ my $lanpath = "$vars{'TEXMFSYSVAR'}/tex/generic/config/language.dat";
+ open(OUTFILE,">$lanpath")
+ or die("Cannot open $lanpath for writing!\n");
+ foreach (@lines) { print OUTFILE; }
close(OUTFILE);
}
}
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm
index e415ae6b5b8..e79d9df2fa3 100644
--- a/Master/tlpkg/TeXLive/TLPDB.pm
+++ b/Master/tlpkg/TeXLive/TLPDB.pm
@@ -21,6 +21,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
TeXLive::TLPDB->new (location => "/path/to/texlive.tlpdb");
$tlpdb->location("/path/to/texlive.tlpdb");
+ $tlpdb->root("/path/to/root/of/texlive/installation");
$tlpdb->from_file($filename);
$tlpdb->writeout;
$tlpdb->writeout(FILEHANDLE);
@@ -30,6 +31,9 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
$tlpdb->add_tlpobj($tlpobj);
$tlpdb->get_package("packagename");
$tlpdb->list_packages;
+ $tlpdb->updmap_cfg_lines;
+ $tlpdb->fmtutil_cnf_lines;
+ $tlpdb->language_dat_lines;
$tlpdb->package_revision("packagename");
TeXLive::TLPDB->listdir([$dir]);
@@ -40,7 +44,7 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
=cut
use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory);
-use TeXLive::TLUtils;
+use TeXLive::TLUtils qw(basename);
use TeXLive::TLPOBJ;
my $_listdir;
@@ -66,13 +70,26 @@ sub new {
my %params = @_;
my $self = {
location => $params{'location'},
+ root => $params{'root'},
tlps => $params{'tlps'}
};
$_listdir = $params{'listdir'} if defined($params{'listdir'});
bless $self, $class;
+ if (defined($self->{'location'}) && defined($self->{'root'})) {
+ my $chk = basename(basename($self->{'root'}));
+ if ($self->{'root'} ne $chk) {
+ warn "root $self->{'root'} and location $self->{'location'} does not really fit, are you sure?!\n";
+ }
+ }
if (defined($self->{'location'})) {
+ if (not(defined($self->{'root'}))) {
+ $self->{'root'} = basename(basename($self->{'location'}));
+ }
$self->from_file($self->{'location'});
}
+ if (defined($self->{'root'}) && not(defined($self->{'location'}))) {
+ $self->{'location'} = $self->{'root'} . "/" . $TeXLive::TLConfig::InfraLocation . "/texlive.tlpdb";
+ }
return $self;
}
@@ -460,6 +477,21 @@ sub _generate_listfile {
=pod
+=item C<< $tlpdb->root([ "/path/to/installation" ]) >>
+
+The function C<root> allows to read and set the root of the
+installation. Note that root and location is somehow linked!
+
+=cut
+
+sub root {
+ my $self = shift;
+ if (@_) { $self->{'root'} = shift }
+ return $self->{'root'};
+}
+
+=pod
+
=item C<< $tlpdb->location("/path/to/texlive.tlpdb") >>
The function C<location> allows to read and set the location of the
@@ -482,14 +514,126 @@ specifiying where generated list files are created.
=cut
sub listdir {
- my @self = shift;
+ my $self = shift;
if (@_) { $_listdir = $_[0] }
return $_listdir;
}
=back
+
+=item C<< $tlpdb->fmtutil_cnf_lines >>
+
+The function C<fmtutil_cnf_lines> returns the list of a fmtutil.cnf file
+containing only those formats present in the installation.
+
+=cut
+sub fmtutil_cnf_lines {
+ my $self = shift;
+ my %fmtcnffiles;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "No TeX Live package named $p, strange.\n" if ! $obj;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/BuildFormat (.*)$/) {
+ $fmtcnffiles{$1} = 1;
+ }
+ # others are ignored here
+ }
+ }
+ my @formatlines;
+ open(INFILE,"<$self->{'root'}/texmf/fmtutil/fmtutil-hdr.cnf")
+ or die("Cannot open $self->{'root'}/texmf/fmtutil/fmtutil-hdr.cnf\n");
+ my @tmp = <INFILE>;
+ close (INFILE);
+ push @formatlines, @tmp;
+ foreach my $f (keys %fmtcnffiles) {
+ open(INFILE,"<$self->{'root'}/texmf/fmtutil/format.$f.cnf")
+ or die("Cannot open $self->{'root'}/texmf/fmtutil/format.$f.cnf");
+ @tmp = <INFILE>;
+ close(INFILE);
+ push @formatlines, @tmp;
+ }
+ return(@formatlines);
+}
+
+=item C<< $tlpdb->updmap_cfg_lines >>
+
+The function C<updmap_cfg_lines> returns the list of a updmap.cfg file
+containing only those maps present in the installation.
+
+=cut
+sub updmap_cfg_lines {
+ my $self = shift;
+ my %maps;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "No TeX Live package named $p, strange.\n" if ! $obj;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/addMap (.*)$/) {
+ $maps{$1} = 1;
+ } elsif ($e =~ m/addMixedMap (.*)$/) {
+ $maps{$1} = 2;
+ }
+ # others are ignored here
+ }
+ }
+ my @updmaplines;
+ open(UPDHDR,"<$self->{'root'}/texmf/web2c/updmap-hdr.cfg")
+ or die("Cannot find $self->{'root'}/texmf/web2c/updmap-hdr.cfg!\n");
+ my @tmp = <UPDHDR>;
+ close(UPDHDR);
+ push @updmaplines, @tmp;
+ foreach (sort keys %maps) {
+ if ($maps{$_} == 2) {
+ push @updmaplines, "MixedMap $_\n";
+ } else {
+ push @updmaplines, "Map $_\n";
+ }
+ }
+ return(@updmaplines);
+}
+
+=item C<< $tlpdb->language_dat_lines >>
+
+The function C<language_dat_lines> returns the list of a language.dat file
+containing only those hyphenation patterns present in the installation.
+
+=cut
+sub language_dat_lines {
+ my $self = shift;
+ my %langfiles;
+ foreach my $p ($self->list_packages) {
+ my $obj = $self->get_package ($p);
+ die "No TeX Live package named $p, strange.\n" if ! $obj;
+ foreach my $e ($obj->executes) {
+ if ($e =~ m/BuildLanguageDat (.*)$/) {
+ $langfiles{$1} = 1;
+ }
+ # others are ignored here
+ }
+ }
+ my @langlines;
+ open(LANHDR,"<$self->{'root'}/texmf/tex/generic/config/language.us")
+ or die("Cannot find $self{'root'}/texmf/tex/generic/config/language.us!\n");
+ my @tmp = <LANHDR>;
+ close(LANHDR);
+ push @langlines, @tmp;
+ foreach my $f (keys %langfiles) {
+ open(INFILE,"<$self->{'root'}/texmf/tex/generic/config/language.$f.dat")
+ or die("Cannot open $self->{'root'}/texmf/tex/generic/config/language.$f.cnf");
+ @tmp = <INFILE>;
+ close(INFILE);
+ push @langlines, @tmp;
+ }
+ return(@langlines);
+}
+
+
+=back
+
=pod
+
=head1 SEE ALSO
The modules L<TeXLive::TLPSRC>, L<TeXLive::TLPOBJ>,