summaryrefslogtreecommitdiff
path: root/Build/source/utils/biber
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-10-04 18:29:11 +0000
committerKarl Berry <karl@freefriends.org>2011-10-04 18:29:11 +0000
commitfee12533281613d6c84ae9bbd720dc24e5a54928 (patch)
treeb734f5009b576fe699aab5e959fcfdeab709180b /Build/source/utils/biber
parentcfdf5d163458644f3d6783534c560ec6753c8fba (diff)
sync
git-svn-id: svn://tug.org/texlive/trunk@24191 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/biber')
-rw-r--r--Build/source/utils/biber/TeXLive/TLConfig.pm295
-rw-r--r--Build/source/utils/biber/TeXLive/TLUtils.pm140
2 files changed, 425 insertions, 10 deletions
diff --git a/Build/source/utils/biber/TeXLive/TLConfig.pm b/Build/source/utils/biber/TeXLive/TLConfig.pm
index 57f2181738f..8825b33e800 100644
--- a/Build/source/utils/biber/TeXLive/TLConfig.pm
+++ b/Build/source/utils/biber/TeXLive/TLConfig.pm
@@ -1,2 +1,297 @@
+# $Id: TLConfig.pm 23084 2011-06-22 03:07:01Z preining $
+# TeXLive::TLConfig.pm - module exporting configuration values
+# Copyright 2007, 2008, 2009, 2010, 2011 Norbert Preining
+# This file is licensed under the GNU General Public License version 2
+# or any later version.
+
package TeXLive::TLConfig;
+
+my $svnrev = '$Revision: 23084 $';
+my $_modulerevision;
+if ($svnrev =~ m/: ([0-9]+) /) {
+ $_modulerevision = $1;
+} else {
+ $_modulerevision = "unknown";
+}
+sub module_revision {
+ return $_modulerevision;
+}
+
+BEGIN {
+ use Exporter ();
+ use vars qw( @ISA @EXPORT_OK @EXPORT );
+ @ISA = qw(Exporter);
+ @EXPORT_OK = qw(
+ $ReleaseYear
+ @MetaCategories
+ @NormalCategories
+ @Categories
+ $MetaCategoriesRegexp
+ $CategoriesRegexp
+ $DefaultCategory
+ $DefaultContainerFormat
+ $DefaultContainerExtension
+ $InfraLocation
+ $DatabaseName
+ $PackageBackupDir
+ $BlockSize
+ $Archive
+ $TeXLiveServerURL
+ $TeXLiveServerPath
+ $TeXLiveURL
+ @CriticalPackagesList
+ $CriticalPackagesRegexp
+ $WindowsMainMenuName
+ $RelocPrefix
+ $RelocTree
+ %TLPDBOptions
+ %TLPDBSettings
+ %TLPDBConfigs
+ $NetworkTimeout
+ );
+ @EXPORT = @EXPORT_OK;
+}
+
+# the year of our release, will be used in the location of the
+# network packages, and in menu names, and other places.
+$ReleaseYear = 2011;
+
+# users can upgrade from this year to the current year; maybe a spread
+# of more than one year will be useful at some point, but not now.
+$MinRelease = $ReleaseYear - 1;
+
+# Meta Categories do not ship files, but only call for other packages.
+our @MetaCategories = qw/Collection Scheme/;
+our $MetaCategoriesRegexp = '(Collection|Scheme)';
+#
+# Normal Categories contain actial files and do not depend on other things.
+our @NormalCategories = qw/Package TLCore ConTeXt/;
+#
+# list of all Categories
+our @Categories = (@MetaCategories, @NormalCategories);
+
+# repeat, as a regexp.
+our $CategoriesRegexp = '(Collection|Scheme|Package|TLCore|ConTeXt)';
+
+our $DefaultCategory = "Package";
+
+# location of various infra files (texlive.tlpdb, .tlpobj etc)
+# relative to a root (e.g., the Master/, or the installation path)
+our $InfraLocation = "tlpkg";
+our $DatabaseName = "texlive.tlpdb";
+
+# location of backups in default autobackup setting (under tlpkg)
+our $PackageBackupDir = "$InfraLocation/backups";
+
+our $BlockSize = 4096;
+
+our $Archive = "archive";
+our $TeXLiveServerURL = "http://mirror.ctan.org";
+# from 2009 on we try to put them all into tlnet directly without any
+# release year since we hope that we can switch over to 2010 on the fly
+# 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");
+ $CriticalPackagesRegexp = '^(texlive\.infra|tlperl\.win32$)';
+}
+
+# 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,
+ "minrelease" => $MinRelease,
+ "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: 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"
+
+# $TLPDBOptions{"option"}->[0] --> type
+# ->[1] --> default value
+# ->[2] --> tlmgr name
+# ->[3] --> tlmgr description
+# the "option" is the value in the TLPDB
+
+our %TLPDBOptions = (
+ "autobackup" =>
+ [ "n:-1..", 1, "autobackup",
+ "Number of backups to keep" ],
+ "backupdir" =>
+ [ "p", $PackageBackupDir, "backupdir",
+ "Directory for backups" ],
+ "create_formats" =>
+ [ "b", 1, "formats",
+ "Create formats on installation" ],
+ "desktop_integration" =>
+ [ "b", 1, "desktop_integration",
+ "Create Start menu shortcuts (w32)" ],
+ "file_assocs" =>
+ [ "n:0..2", 1, "fileassocs",
+ "Change file associations (w32)" ],
+ "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",
+ "Run postinst code blobs" ],
+ "sys_bin" =>
+ [ "p", "/usr/local/bin", "sys_bin",
+ "Destination for symlinks for binaries" ],
+ "sys_info" =>
+ [ "p", "/usr/local/info", "sys_info",
+ "Destination for symlinks for info docs" ],
+ "sys_man" =>
+ [ "p", "/usr/local/man", "sys_man",
+ "Destination for symlinks for man pages" ],
+ "w32_multi_user" =>
+ [ "b", 0, "multiuser",
+ "Install for all users (w32)" ],
+ "generate_updmap" =>
+ [ "b", 0, "generate_updmap",
+ "Run tlmgr generate updmap after maps have changed" ],
+);
+
+
+our %TLPDBSettings = (
+ "platform" => [ "s", "Main platform for this computer" ],
+ "available_architectures" => [ "l", "All available/installed architectures" ]
+);
+
+our $WindowsMainMenuName = "TeX Live $ReleaseYear";
+
+#
+# timeout for network connections (wget, LWP) in seconds
+our $NetworkTimeout = 30;
+
1;
+
+
+=head1 NAME
+
+C<TeXLive::TLConfig> -- TeX Live Configurations
+
+=head1 SYNOPSIS
+
+ use TeXLive::TLConfig;
+
+=head1 DESCRIPTION
+
+The L<TeXLive::TLConfig> module contains definitions of variables
+configuring all of TeX Live.
+
+=over 4
+
+=head1 EXPORTED VARIABLES
+
+All of the following variables are pulled into the callers namespace,
+i.e., are declared with C<EXPORT> (and C<EXPORT_OK>).
+
+=item C<@TeXLive::TLConfig::MetaCategories>
+
+The list of meta categories, i.e., those categories whose packages only
+depend on other packages, but don't ship any files. Currently
+C<Collection> and <Scheme>.
+
+=item C<@TeXLive::TLConfig::NormalCategories>
+
+The list of normal categories, i.e., those categories whose packages do
+ship files. Currently C<TLCore>, C<Package>, C<ConTeXt>.
+
+=item C<@TeXLive::TLConfig::Categories>
+
+The list of all categories, i.e., the union of the above.
+
+=item C<$TeXLive::TLConfig::CategoriesRegexp>
+
+A regexp matching any category.
+
+=item C<$TeXLive::TLConfig::DefaultCategory>
+
+The default category used when creating new packages.
+
+=item C<$TeXLive::TLConfig::InfraLocation>
+
+The subdirectory with various infrastructure files (C<texlive.tlpdb>,
+tlpobj files, ...) relative to the root of the installation; currently
+C<tlpkg>.
+
+=item C<$TeXLive::TLConfig::BlockSize>
+
+The assumed block size, currently 4k.
+
+=item C<$TeXLive::TLConfig::Archive>
+=item C<$TeXLive::TLConfig::TeXLiveURL>
+
+These values specify where to find packages.
+
+=item C<$TeXLive::TLConfig::TeXLiveServerURL>
+=item C<$TeXLive::TLConfig::TeXLiveServerPath>
+
+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/>.
+
+=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 texlive.infra and (for Windows) tlperl.win32.
+
+=item C<$TeXLive::TLConfig::RelocTree>
+
+The texmf-tree name that can be relocated, defaults to C<texmf-dist>.
+
+=item C<$TeXLive::TLConfig::RelocPrefix>
+
+The string that replaces the C<RelocTree> in the tlpdb if a package is
+relocated, defaults to C<RELOC>".
+
+=back
+
+=head1 SEE ALSO
+
+The modules L<TeXLive::TLUtils>, L<TeXLive::TLPSRC>,
+L<TeXLive::TLPDB>, L<TeXLive::TLTREE>, L<TeXLive::TeXCatalogue>.
+
+=head1 AUTHORS AND COPYRIGHT
+
+This script and its documentation were written for the TeX Live
+distribution (L<http://tug.org/texlive>) 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/Build/source/utils/biber/TeXLive/TLUtils.pm b/Build/source/utils/biber/TeXLive/TLUtils.pm
index d9234e2ddff..ea26a1ed41d 100644
--- a/Build/source/utils/biber/TeXLive/TLUtils.pm
+++ b/Build/source/utils/biber/TeXLive/TLUtils.pm
@@ -1,4 +1,4 @@
-# $Id: TLUtils.pm 23155 2011-06-28 00:43:01Z karl $
+# $Id: TLUtils.pm 23990 2011-09-17 07:40:33Z preining $
# TeXLive::TLUtils.pm - the inevitable utilities for TeX Live.
# Copyright 2007, 2008, 2009, 2010, 2011 Norbert Preining, Reinhard Kotucha
# This file is licensed under the GNU General Public License version 2
@@ -6,7 +6,7 @@
package TeXLive::TLUtils;
-my $svnrev = '$Revision: 23155 $';
+my $svnrev = '$Revision: 23990 $';
my $_modulerevision;
if ($svnrev =~ m/: ([0-9]+) /) {
$_modulerevision = $1;
@@ -62,6 +62,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
TeXLive::TLUtils::setup_programs($bindir, $platform);
TeXLive::TLUtils::tlcmp($file, $file);
TeXLive::TLUtils::nulldev();
+ TeXLive::TLUtils::get_full_line($fh);
=head2 Installer Functions
@@ -90,6 +91,7 @@ C<TeXLive::TLUtils> -- utilities used in the TeX Live infrastructure
TeXLive::TLUtils::member($item, @list);
TeXLive::TLUtils::merge_into(\%to, \%from);
TeXLive::TLUtils::texdir_check($texdir);
+ TeXLive::TLUtils::quotify_path_with_spaces($path);
TeXLive::TLUtils::conv_to_w32_path($path);
TeXLive::TLUtils::native_slashify($internal_path);
TeXLive::TLUtils::forward_slashify($path_from_user);
@@ -156,6 +158,7 @@ BEGIN {
&texdir_check
&member
&quotewords
+ &quotify_path_with_spaces
&conv_to_w32_path
&native_slashify
&forward_slashify
@@ -164,6 +167,8 @@ BEGIN {
&merge_into
&give_ctan_mirror
&give_ctan_mirror_base
+ &create_mirror_list
+ &extract_mirror_entry
&tlmd5
&xsystem
&run_cmd
@@ -180,6 +185,7 @@ BEGIN {
&setup_persistent_downloads
&mktexupd
&nulldev
+ &get_full_line
);
@EXPORT = qw(setup_programs download_file process_logging_options
tldie tlwarn info log debug ddebug dddebug debug_hash
@@ -262,6 +268,7 @@ sub platform_name {
($CPU = $guessed_platform) =~ s/(.*?)-.*/$1/;
$CPU =~ s/^alpha(.*)/alpha/; # alphaev56 or whatever
$CPU =~ s/powerpc64/powerpc/; # we don't distinguish ppc64
+ $CPU =~ s/mips64el/mipsel/; # we don't distinguish mips64 and 32 el
my @OSs = qw(aix cygwin darwin freebsd hpux irix
kfreebsd linux netbsd openbsd solaris);
@@ -1369,7 +1376,7 @@ sub install_package {
# we assume that $::progs has been set up!
my $wget = $::progs{'wget'};
- my $xzdec = "\"$::progs{'xzdec'}\"";
+ my $xzdec = quotify_path_with_spaces($::progs{'xzdec'});
if (!defined($wget) || !defined($xzdec)) {
tlwarn("install_package: wget/xzdec programs not set up properly.\n");
return 0;
@@ -1823,7 +1830,7 @@ after all packages have been unpacked.
=cut
sub announce_execute_actions {
- my ($type, $tlp) = @_;
+ my ($type, $tlp, $what) = @_;
# do simply return immediately if execute actions are suppressed
return if $::no_execute_actions;
@@ -1835,6 +1842,14 @@ sub announce_execute_actions {
$::files_changed = 1;
return;
}
+ if (defined($type) && ($type eq "latex-updated")) {
+ $::latex_updated = 1;
+ return;
+ }
+ if (defined($type) && ($type eq "tex-updated")) {
+ $::tex_updated = 1;
+ return;
+ }
if (!defined($type) || (($type ne "enable") && ($type ne "disable"))) {
die "announce_execute_actions: enable or disable, not type $type";
}
@@ -1842,22 +1857,28 @@ sub announce_execute_actions {
if ($tlp->runfiles || $tlp->srcfiles || $tlp->docfiles) {
$::files_changed = 1;
}
+ $what = "map format hyphen" if (!defined($what));
foreach my $e ($tlp->executes) {
if ($e =~ m/^add((Mixed)?Map)\s+([^\s]+)\s*$/) {
- $::execute_actions{$type}{'maps'}{$3} = "$1";
+ # save the refs as we have another =~ grep in the following lines
+ my $a = $1;
+ my $b = $3;
+ $::execute_actions{$type}{'maps'}{$b} = $a if ($what =~ m/map/);
} elsif ($e =~ m/^AddFormat\s+(.*)\s*$/) {
my %r = TeXLive::TLUtils::parse_AddFormat_line("$1");
if (defined($r{"error"})) {
tlwarn ("$r{'error'} in parsing $e for return hash\n");
} else {
- $::execute_actions{$type}{'formats'}{$r{'name'}} = \%r;
+ $::execute_actions{$type}{'formats'}{$r{'name'}} = \%r
+ if ($what =~ m/format/);
}
} elsif ($e =~ m/^AddHyphen\s+(.*)\s*$/) {
my %r = TeXLive::TLUtils::parse_AddHyphen_line("$1");
if (defined($r{"error"})) {
tlwarn ("$r{'error'} in parsing $e for return hash\n");
} else {
- $::execute_actions{$type}{'hyphens'}{$r{'name'}} = \%r;
+ $::execute_actions{$type}{'hyphens'}{$r{'name'}} = \%r
+ if ($what =~ m/hyphen/);
}
} else {
tlwarn("Unknown execute $e in ", $tlp->name, "\n");
@@ -2076,7 +2097,9 @@ sub untar {
my $cwd = cwd();
chdir($targetdir) || die "chdir($targetdir) failed: $!";
- if (system($tar, "xf", $tarfile) != 0) {
+ # on w32 don't extract file modified time, because AV soft can open
+ # files in the mean time causing time stamp modification to fail
+ if (system($tar, win32() ? "xmf" : "xf", $tarfile) != 0) {
tlwarn("untar: untarring $tarfile failed (in $targetdir)\n");
$ret = 0;
} else {
@@ -2417,6 +2440,31 @@ sub nulldev {
return (&win32)? 'nul' : '/dev/null';
}
+=item C<get_full_line ($fh)>
+
+returns the next line from the file handle $fh, taking
+continuation lines into account (last character of a line is \, and
+no quoting is parsed).
+
+=cut
+
+# open my $f, '<', $file_name or die;
+# while (my $l = get_full_line($f)) { ... }
+# close $f or die;
+sub get_full_line {
+ my ($fh) = @_;
+ my $line = <$fh>;
+ return undef unless defined $line;
+ return $line unless $line =~ s/\\\r?\n$//;
+ my $cont = get_full_line($fh);
+ if (!defined($cont)) {
+ tlwarn('Continuation disallowed at end of file');
+ $cont = "";
+ }
+ $cont =~ s/^\s*//;
+ return $line . $cont;
+}
+
=back
@@ -3176,6 +3224,25 @@ sub process_logging_options {
}
}
+=pod
+
+This function takes a single argument I<path> and returns it with
+C<"> chars surrounding it on Unix. On Windows, the C<"> chars are only
+added if I<path> a few special characters, since unconditional quoting
+leads to errors there. In all cases, any C<"> chars in I<path> itself
+are (erroneously) eradicated.
+
+=cut
+
+sub quotify_path_with_spaces {
+ my $p = shift;
+ my $m = win32() ? '[+=^&();,!%\s]' : '.';
+ if ( $p =~ m/$m/ ) {
+ $p =~ s/"//g; # remove any existing double quotes
+ $p = "\"$p\"";
+ }
+ return($p);
+}
=pod
@@ -3202,7 +3269,7 @@ sub conv_to_w32_path {
chomp($cwd);
$p = "$cwd\\$p";
}
- if ($p =~ m/ /) { $p = "\"$p\""; }
+ $p = quotify_path_with_spaces($p);
return($p);
}
@@ -3327,7 +3394,7 @@ sub check_on_working_mirror
tlwarn ("check_on_working_mirror: Programs not set up, trying wget\n");
$wget = "wget";
}
- $wget = "\"wget\"";
+ $wget = quotify_path_with_spaces($wget);
#
# the test is currently not completely correct, because we do not
# use the LWP if it is set up for it, but I am currently too lazy
@@ -3405,6 +3472,59 @@ sub give_ctan_mirror
return (give_ctan_mirror_base(@_) . "/$TeXLiveServerPath");
}
+=item C<create_mirror_list()>
+
+=item C<extract_mirror_entry($listentry)>
+
+C<create_mirror_list> returns the lists of viable mirrors according to
+ctan-mirrors.pl, in a list which also contains continents, and country headers.
+
+C<extract_mirror_entry> extracts the actual repository data from one
+of these entries.
+
+# KEEP THESE TWO FUNCTIONS IN SYNC!!!
+
+=cut
+
+sub create_mirror_list {
+ our $mirrors;
+ my @ret = ();
+ require("installer/ctan-mirrors.pl");
+ my @continents = sort keys %$mirrors;
+ for my $continent (@continents) {
+ # first push the name of the continent
+ push @ret, uc($continent);
+ my @countries = sort keys %{$mirrors->{$continent}};
+ for my $country (@countries) {
+ my @mirrors = sort keys %{$mirrors->{$continent}{$country}};
+ my $first = 1;
+ for my $mirror (@mirrors) {
+ my $mfull = $mirror;
+ $mfull =~ s!/$!!;
+ # do not append the server path part here, but add
+ # it down there in the extract mirror entry
+ #$mfull .= "/" . $TeXLive::TLConfig::TeXLiveServerPath;
+ #if ($first) {
+ my $country_str = sprintf "%-12s", $country;
+ push @ret, " $country_str $mfull";
+ # $first = 0;
+ #} else {
+ # push @ret, " $mfull";
+ #}
+ }
+ }
+ }
+ return @ret;
+}
+
+# extract_mirror_entry is not very intelligent, it assumes that
+# the last "word" is the URL
+sub extract_mirror_entry {
+ my $ent = shift;
+ my @foo = split ' ', $ent;
+ return $foo[$#foo] . "/" . $TeXLive::TLConfig::TeXLiveServerPath;
+}
+
sub tlmd5 {
my ($file) = @_;
if (-r $file) {