Commit 37aa0496 authored by Robson R S Peixoto's avatar Robson R S Peixoto Committed by Rémy Oudompheng
Browse files
parent c064b33e
......@@ -3,9 +3,11 @@ use 5.010;
use warnings;
use strict;
my $TEXMFVAR = "/var/lib/texmf";
use lib ('tlpkg', "$TEXMFVAR/arch/tlpkg");
use lib ('tlpkg', "/var/lib/texmf/arch/tlpkg");
# XXX: Why the line below raise a bug???
#use lib ('tlpkg', "$TEXMFVAR/arch/tlpkg");
use TeXLive::Arch;
our $VERSION = "0.4.0";
our $VERSION = "0.4.2";
our $YEAR = "2010";
use Getopt::Long;
......
# $Id: TLConfig.pm 14553 2009-08-06 13:20:26Z preining $
# $Id: TLConfig.pm 18682 2010-06-01 22:17:30Z karl $
# TeXLive::TLConfig.pm - module exporting configuration stuff
# Copyright 2007, 2008, 2009 Norbert Preining
# Copyright 2007, 2008, 2009, 2010 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
package TeXLive::TLConfig;
my $svnrev = '$Revision: 14553 $';
my $svnrev = '$Revision: 18682 $';
my $_modulerevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$_modulerevision = $1;
......@@ -33,6 +33,7 @@ BEGIN {
$DefaultContainerExtension
$InfraLocation
$DatabaseName
$PackageBackupDir
$BlockSize
$Archive
$TeXLiveServerURL
......@@ -51,8 +52,8 @@ BEGIN {
}
# the year of our release, will be used in the location of the
# network packges, and in menu names, and probably many other places
$ReleaseYear = 2009;
# network packages, and in menu names, and probably many other places
$ReleaseYear = 2010;
# Meta Categories do not ship files, but call only for other packages
our @MetaCategories = qw/Collection Scheme/;
......@@ -74,11 +75,10 @@ our $DefaultCategory = "Package";
our $InfraLocation = "tlpkg";
our $DatabaseName = "texlive.tlpdb";
our $BlockSize = 4096;
# location of backups in default autobackup setting (under tlpkg)
our $PackageBackupDir = "$InfraLocation/backups";
# the way we package things on the web
our $DefaultContainerFormat = "xz";
our $DefaultContainerExtension = "tar.$DefaultContainerFormat";
our $BlockSize = 4096;
our $Archive = "archive";
our $TeXLiveServerURL = "http://mirror.ctan.org";
......@@ -87,98 +87,88 @@ our $TeXLiveServerURL = "http://mirror.ctan.org";
# our $TeXLiveServerPath = "systems/texlive/tlnet/$ReleaseYear";
our $TeXLiveServerPath = "systems/texlive/tlnet";
our $TeXLiveURL = "$TeXLiveServerURL/$TeXLiveServerPath";
# Relocatable packages.
our $RelocTree = "texmf-dist";
our $RelocPrefix = "RELOC";
our @CriticalPackagesList = qw/texlive.infra/;
our $CriticalPackagesRegexp = '^(texlive\.infra)';
if ($^O=~/^MSWin(32|64)$/i) {
push(@CriticalPackagesList, "tlperl.win32");
if ($^O =~ /^MSWin(32|64)$/i) {
push (@CriticalPackagesList, "tlperl.win32");
$CriticalPackagesRegexp = '^(texlive\.infra|tlperl\.win32$)';
}
#
# stuff formerly set in 00texlive.config
#
# the way we package things on the web
our $DefaultContainerFormat = "xz";
our $DefaultContainerExtension = "tar.$DefaultContainerFormat";
# archive (not user) settings.
our %TLPDBConfigs = (
"container_split_src_files" => 1,
"container_split_doc_files" => 1,
"container_format" => $DefaultContainerFormat,
"release" => $ReleaseYear );
"release" => $ReleaseYear,
);
#
# definition of the option strings and their value types
# possible types are:
# - u: url
# - b: boolean, saved as 0/1
# - p: path (local path)
# - n: naturnal number
# - n: natural number
# it allows n:[a]..[b]
# if a is empty start at -infty
# if b is empty end at +infty
# so "n:.." is equivalent to "n"
# WARNING: keep these in sync!
#
# $TLPDBOptions{"option"}->[0] --> type
# ->[1] --> default value
# ->[2] --> tlmgr name
# ->[3] --> tlmgr description
# the "option" is the value in the TLPDB
our %TLPDBOptions = (
"location" =>
[ "u", "__MASTER__",
"location",
"Default installation location" ],
"autobackup" =>
[ "n:-1..", 1, "autobackup",
"Number of backups to keep" ],
"backupdir" =>
[ "p", $PackageBackupDir, "backupdir",
"Directory for backups" ],
"create_formats" =>
[ "b", 1,
"formats",
[ "b", 1, "formats",
"Create formats on installation" ],
"desktop_integration" =>
[ "b", 1,
"desktop_integration",
[ "b", 1, "desktop_integration",
"Create shortcuts (menu and desktop) in postinst" ],
"file_assocs" =>
[ "n:0..2", 1,
"fileassocs",
[ "n:0..2", 1, "fileassocs",
"Change file associations in postinst" ],
"install_docfiles" =>
[ "b", 1, "docfiles",
"Install documentation files" ],
"install_srcfiles" =>
[ "b", 1, "srcfiles",
"Install source files" ],
"location" =>
[ "u", "__MASTER__", "repository",
"Default package repository" ],
"post_code" =>
[ "b", 1,
"postcode",
[ "b", 1, "postcode",
"Run postinst code blobs" ],
"sys_bin" =>
[ "p", "/usr/local/bin",
"sys_bin",
[ "p", "/usr/local/bin", "sys_bin",
"Destination for symlinks for binaries" ],
"sys_man" =>
[ "p", "/usr/local/man",
"sys_man",
"Destination for symlinks for man pages" ],
"sys_info" =>
[ "p", "/usr/local/info",
"sys_info",
[ "p", "/usr/local/info", "sys_info",
"Destination for symlinks for info docs" ],
"install_docfiles" =>
[ "b", 1,
"docfiles",
"Install documentation files" ],
"install_srcfiles" =>
[ "b", 1,
"srcfiles",
"Install source files" ],
"sys_man" =>
[ "p", "/usr/local/man", "sys_man",
"Destination for symlinks for man pages" ],
"w32_multi_user" =>
[ "b", 1,
"multiuser",
[ "b", 0, "multiuser",
"Install for shortcuts/menu items for all users (w32)" ],
"autobackup" =>
[ "n:-1..", 0,
"autobackup",
"Number of backups to keep" ],
"backupdir" =>
[ "p", "",
"backupdir",
"Directory for backups" ],
);
);
our %TLPDBSettings = (
......@@ -253,26 +243,24 @@ These values specify where to find packages.
=item C<$TeXLive::TLConfig::TeXLiveServerURL>
=item C<$TeXLive::TLConfig::TeXLiveServerPath>
C<TeXLiveURL> is concatencated from these values, with a string between.
C<TeXLiveURL> is concatenated from these values, with a string between.
The defaults are respectively, C<http://mirror.ctan.org> and
C<systems/texlive/tlnet/>I<rel>, where I<rel> specifies the TeX Live
release version, such as C<tldev> or C<2008>.
C<systems/texlive/tlnet/>.
=item C<@TeXLive::TLConfig::CriticalPackagesList>
=item C<@TeXLive::TLConfig::CriticalPackagesRegexp>
A list of all those packages which we do not update regularly
since they are too central, currently only texlive.infra (and tlperl.win32
for Windows).
A list of all those packages which we do not update regularly since they
are too central, currently texlive.infra and (for Windows) tlperl.win32.
=item C<$TeXLive::TLConfig::RelocTree>
the texmf-tree name that can be relocated, defaults to "texmf-dist"
The texmf-tree name that can be relocated, defaults to C<texmf-dist>.
=item C<$TeXLive::TLConfig::RelocPrefix>
The string that replaces the RelocTree in the tlpdb if a package is
reloaced, defaults to "RELOC".
The string that replaces the C<RelocTree> in the tlpdb if a package is
relocated, defaults to C<RELOC>".
=back
......
# $Id: TLPDB.pm 14553 2009-08-06 13:20:26Z preining $
# $Id: TLPDB.pm 18756 2010-06-05 16:31:31Z preining $
# TeXLive::TLPDB.pm - module for using tlpdb files
# Copyright 2007, 2008 Norbert Preining
#
# Copyright 2007, 2008, 2009, 2010 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
package TeXLive::TLPDB;
my $svnrev = '$Revision: 14553 $';
my $svnrev = '$Revision: 18756 $';
my $_modulerevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$_modulerevision = $1;
......@@ -53,12 +52,14 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages
$tlpdb->fmtutil_cnf_lines;
$tlpdb->language_dat_lines;
$tlpdb->language_def_lines;
$tlpdb->language_lua_lines;
$tlpdb->package_revision("packagename");
$tlpdb->location;
$tlpdb->config_src_container;
$tlpdb->config_doc_container;
$tlpdb->config_container_format;
$tlpdb->config_release;
$tlpdb->config_maxrelease;
$tlpdb->config_revision;
$tlpdb->options;
$tlpdb->option($key, [$value]);
......@@ -291,9 +292,14 @@ sub from_file {
$found++;
}
} until (!$ret);
tlwarn("unusable location $path, could not load any packages\n") if (!$found);
if (! $found) {
debug("$0: Could not load packages from\n");
debug(" $path\n");
}
# remove the un-xz-ed tlpdb file from temp dir
# THAT IS RACY!!! we should fix that in some better way with tempfile
close($retfh);
unlink($tlpdbfile) if $tlpdbfile;
return($found);
}
......@@ -332,9 +338,13 @@ sub save {
my $self = shift;
my $path = $self->location;
mkdirhier(dirname($path));
open(FOO, ">$path") || die "$0: open(>$path) failed: $!";
my $tmppath = "$path.tmp";
open(FOO, ">$tmppath") || die "$0: open(>$tmppath) failed: $!";
$self->writeout(\*FOO);
close(FOO);
# if we managed that one, we move it over
die ("rename $tmppath to $path failed: $!")
unless rename($tmppath, $path);
}
=pod
......@@ -473,8 +483,9 @@ mathematicians)
If the very first argument is "-only-arch" then it expands only dependencies
of the form .ARCH.
If the very first argument is "-no-collections" then dependencies of
collections onto collections are ignored.
If the very first argument is "-no-collections" then dependencies between
"same-level" packages (scheme onto scheme, collection onto collection,
package onto package) are ignored.
=cut
......@@ -515,10 +526,15 @@ sub expand_dependencies {
ddebug("checking $p_dep in $p\n");
my $tlpdd = $self->get_package($p_dep);
if (defined($tlpdd)) {
if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) {
# we are taking a look at a dependency which is a collection
# or scheme, and if the option "-no-collections" is given
# we skip that one
# before we ignored all deps of schemes and colls if -no-collections
# was given, but this prohibited auto-install of new collections
# even if the scheme is updated.
# Now we supress only "same-level dependencies", so scheme -> scheme
# and collections -> collections and package -> package
# hoping that this works out better
# if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) {
if ($tlpdd->category eq $pkg->category) {
# we ignore same-level dependencies if "-no-collections" is given
ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n");
next if $no_collections;
}
......@@ -910,6 +926,27 @@ sub config_release {
return "";
}
=pod
=item C<< $tlpdb->config_maxrelease >>
Returns the currently allowed maximal release. See Options below.
=cut
sub config_maxrelease {
my $self = shift;
if (defined($self->{'tlps'}{'00texlive.config'})) {
foreach my $d ($self->{'tlps'}{'00texlive.config'}->depends) {
if ($d =~ m!^maxrelease/(.*)$!) {
return "$1";
}
}
}
return;
}
=pod
=item C<< $tlpdb->config_revision >>
......@@ -1076,7 +1113,7 @@ sub option_pkg {
if (@_) { $self->_set_value_pkg($pkg, "opt_", $key, shift); }
my $ret = $self->_value_pkg($pkg, "opt_", $key);
# special case for location == __MASTER__
if ($ret eq "__MASTER__" && $key eq "location") {
if (defined($ret) && $ret eq "__MASTER__" && $key eq "location") {
return $self->root;
}
return $ret;
......@@ -1110,7 +1147,7 @@ sub setting_pkg {
if (defined $ret) {
@ret = split(" ", $ret);
} else {
tlwarn "TLPDB::setting: no $key, returning empty list ...\n";
tlwarn "TLPDB::setting_pkg: no $key, returning empty list ...\n";
@ret = ();
}
return @ret;
......@@ -1151,7 +1188,7 @@ sub reset_options {
sub add_default_options {
my $self = shift;
for my $k (keys %TeXLive::TLConfig::TLPDBOptions) {
for my $k (sort keys %TeXLive::TLConfig::TLPDBOptions) {
# if the option is not set already, do set it to defaults
if (! $self->option($k) ) {
$self->option($k, $TeXLive::TLConfig::TLPDBOptions{$k}->[1]);
......@@ -1202,7 +1239,6 @@ sub settings {
This function returns a list of references to hashes where each hash
represents a parsed AddFormat line.
=cut
sub format_definitions {
......@@ -1221,6 +1257,9 @@ sub format_definitions {
The function C<fmtutil_cnf_lines> returns the list of a fmtutil.cnf file
containing only those formats present in the installation.
Every format listed in the tlpdb but listed in the arguments
will not be included in the list of lines returned.
=cut
sub fmtutil_cnf_lines {
my $self = shift;
......@@ -1228,16 +1267,19 @@ sub fmtutil_cnf_lines {
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
push @lines, $obj->fmtutil_cnf_lines;
push @lines, $obj->fmtutil_cnf_lines(@_);
}
return(@lines);
}
=item C<< $tlpdb->updmap_cfg_lines >>
=item C<< $tlpdb->updmap_cfg_lines ( [@disabled_maps] ) >>
The function C<updmap_cfg_lines> returns the list of a updmap.cfg file
containing only those maps present in the installation.
A map file mentioned in the tlpdb but listed in the arguments will not
be included in the list of lines returned.
=cut
sub updmap_cfg_lines {
my $self = shift;
......@@ -1245,16 +1287,19 @@ sub updmap_cfg_lines {
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
push @lines, $obj->updmap_cfg_lines;
push @lines, $obj->updmap_cfg_lines(@_);
}
return(@lines);
}
=item C<< $tlpdb->language_dat_lines >>
=item C<< $tlpdb->language_dat_lines ( [@disabled_hyphen_names] ) >>
The function C<language_dat_lines> returns the list of all
lines for language.dat that can be generated from the tlpdb.
Every hyphenation pattern listed in the tlpdb but listed in the arguments
will not be included in the list of lines returned.
=cut
sub language_dat_lines {
......@@ -1263,16 +1308,19 @@ sub language_dat_lines {
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
push @lines, $obj->language_dat_lines;
push @lines, $obj->language_dat_lines(@_);
}
return(@lines);
}
=item C<< $tlpdb->language_def_lines >>
=item C<< $tlpdb->language_def_lines ( [@disabled_hyphen_names] ) >>
The function C<language_def_lines> returns the list of all
lines for language.def that can be generated from the tlpdb.
Every hyphenation pattern listed in the tlpdb but listed in the arguments
will not be included in the list of lines returned.
=cut
sub language_def_lines {
......@@ -1281,11 +1329,32 @@ sub language_def_lines {
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
push @lines, $obj->language_def_lines;
push @lines, $obj->language_def_lines(@_);
}
return(@lines);
}
=item C<< $tlpdb->language_lua_lines ( [@disabled_hyphen_names] ) >>
The function C<language_lua_lines> returns the list of all
lines for language.dat.lua that can be generated from the tlpdb.
Every hyphenation pattern listed in the tlpdb but listed in the arguments
will not be included in the list of lines returned.
=cut
sub language_lua_lines {
my $self = shift;
my @lines;
foreach my $p ($self->list_packages) {
my $obj = $self->get_package ($p);
die "$0: No TeX Live package named $p, strange" if ! $obj;
push @lines, $obj->language_lua_lines(@_);
}
return(@lines);
}
=back
=pod
......
# $Id: TLPOBJ.pm 14553 2009-08-06 13:20:26Z preining $
# $Id: TLPOBJ.pm 19893 2010-09-25 02:16:34Z preining $
# TeXLive::TLPOBJ.pm - module for using tlpobj files
# Copyright 2007, 2008, 2009 Norbert Preining
# Copyright 2007, 2008, 2009, 2010 Norbert Preining
# This file is licensed under the GNU General Public License version 2
# or any later version.
......@@ -15,7 +15,7 @@ use TeXLive::TLTREE;
our $_tmp;
my $_containerdir;
my $svnrev = '$Revision: 14553 $';
my $svnrev = '$Revision: 19893 $';
my $_modulerevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$_modulerevision = $1;
......@@ -57,7 +57,6 @@ sub new {
}
sub copy {
my $self = shift;
my $bla = {};
......@@ -114,6 +113,8 @@ sub from_fh {
die("Continuation of $lastcmd not allowed, please fix tlpobj: line = $line!\n");
}
}
# remove white space at the end of a line
$line =~ s/\s*$//;
if ($line =~ /^name\s*([-.\w]+)/o) {
$name = "$1";
$lastcmd = "name";
......@@ -145,7 +146,7 @@ sub from_fh {
}
}
next;
} elsif ($line =~ /^binfilescontinued\s+(.*)\s*/o) {
} elsif ($line =~ /^binfilescontinued\s+(.*)$/o) {
push @{$self->{'binfiles'}{$arch}}, "$1";
next;
} elsif ($line =~ /^binfiles\s+/o) {
......@@ -167,7 +168,15 @@ sub from_fh {
}
$lastcmd = "binfiles";
next;
} elsif ($line =~ /^longdesc\s+(.*)\s*/o) {
} elsif ($line eq "longdesc") {
if (defined($self->{'longdesc'})) {
$self->{'longdesc'} .= " ";
} else {
$self->{'longdesc'} = "";
}
$lastcmd = "longdesc";
next;
} elsif ($line =~ /^longdesc\s+(.*)$/o) {
if (defined($self->{'longdesc'})) {
$self->{'longdesc'} .= " $1";
} else {
......@@ -175,7 +184,7 @@ sub from_fh {
}
$lastcmd = "longdesc";
next;
} elsif ($line =~ /^category\s+(.*)\s*/o) {
} elsif ($line =~ /^category\s+(.*)$/o) {
$self->{'category'} = "$1";
$lastcmd = "category";
if ($self->{'category'} !~ /^$CategoriesRegexp/o) {
......@@ -183,39 +192,39 @@ sub from_fh {
. $self->name . " found.\nPlease update texlive.infra.\n");
}
next;
} elsif ($line =~ /^relocated\s+([01])\s*/o) {
} elsif ($line =~ /^relocated\s+([01])$/o) {
$self->relocated("$1");
$lastcmd = "relocated";
next;
} elsif ($line =~ /^revision\s+(.*)\s*/o) {
} elsif ($line =~ /^revision\s+(.*)$/o) {
$self->{'revision'} = "$1";
$lastcmd = "revision";
next;
} elsif ($line =~ /^containersize\s+([0-9]+)\s*/o) {
} elsif ($line =~ /^containersize\s+([0-9]+)$/o) {
$self->containersize("$1");
$lastcmd = "containersize";
next;
} elsif ($line =~ /^srccontainersize\s+([0-9]+)\s*/o) {
} elsif ($line =~ /^srccontainersize\s+([0-9]+)$/o) {
$self->srccontainersize("$1");
$lastcmd = "srccontainersize";
next;
} elsif ($line =~ /^doccontainersize\s+([0-9]+)\s*/o) {
} elsif ($line =~ /^doccontainersize\s+([0-9]+)$/o) {
$self->doccontainersize("$1");
$lastcmd = "doccontainersize";
next;
} elsif ($line =~ /^containermd5\s+([a-f0-9]+)\s*/o) {
} elsif ($line =~ /^containermd5\s+([a-f0-9]+)$/o) {
$self->containermd5("$1");
$lastcmd = "containermd5";
next;
} elsif ($line =~ /^srccontainermd5\s+([a-f0-9]+)\s*/o) {
} elsif ($line =~ /^srccontainermd5\s+([a-f0-9]+)$/o) {
$self->srccontainermd5("$1");
$lastcmd = "srccontainermd5";
next;
} elsif ($line =~ /^doccontainermd5\s+([a-f0-9]+)\s*/o) {
} elsif ($line =~ /^doccontainermd5\s+([a-f0-9]+)$/o) {
$self->doccontainermd5("$1");
$lastcmd = "doccontainermd5";
next;
} elsif ($line =~ /^catalogue\s+(.*)\s*/o) {
} elsif ($line =~ /^catalogue\s+(.*)$/o) {
$self->catalogue("$1");
$lastcmd = "catalogue";
next;
......@@ -236,23 +245,27 @@ sub from_fh {
$self->{"${type}size"} = $size;
}
next;
} elsif ($line =~ /^execute(continued)?\s*(.*)\s*/o) {
} elsif ($line =~ /^execute(continued)?\s*(.*)$/o) {
push @{$self->{'executes'}}, "$2" unless "$2" eq "";
$lastcmd = "execute";
next;
} elsif ($line =~ /^postaction(continued)?\s*(.*)\s*/o) {
} elsif ($line =~ /^postaction(continued)?\s*(.*)$/o) {
push @{$self->{'postactions'}}, "$2" unless "$2" eq "";
$lastcmd = "postaction";
next;
} elsif ($line =~ /^depend(continued)?\s*(.*)\s*/o) {
} elsif ($line =~ /^depend(continued)?\s*(.*)$/o) {
push @{$self->{'depends'}}, "$2" unless "$2" eq "";
$lastcmd = "depend";