summaryrefslogtreecommitdiff
path: root/Master/setuptl/TLPM/constants.pm
blob: 532f81ca13eb8b7bf5f75abbb9c26caf8889af1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# This file belongs to TLPM v2.14, TeX Live Package Manager
# Public Domain, P.Jackowski@gust.org.pl

# widely used constants

$true = 1;
$false = 0;

# general files handling

$reg_file   = qr/([^\/\\]+)\z/o;
$reg_dirsep = qr/[\/\\]/o; # not /(\/|\\)/
# TLPM was originally windowish and is tested mostly on windows so
unless(defined $tlpm_os){$tlpm_os = 'win32'} # if in distribution, always defined in BEGIN block
if($tlpm_os eq 'win32'){$win32 = $true}

if($win32)
{
      $chr_dirsep = "\\";           # directory separator
      $reg_abs = qr/\A[a-z]:/io;    # absolute path
      $reg_envvar = qr/\%(\w+)\%/o; # environment variable
      $curr_dir    = `cd`;          # current directory
}
else # assuming the rest of the world
{
      $chr_dirsep = "/";
      $reg_abs = qr/\A$chr_dirsep/io;
      $reg_envvar = qr/\$(\w+)/o;
      $curr_dir    = `pwd`;
}

&norm_path($curr_dir);
$parent_dir = &rel2abs('..',$curr_dir);

# tlpm related constants

$tlpm_prompt = "tlpm>";

$tlpm_log = $chr_dirsep . "tlpm.log";   # log file
$tlpm_dbg = $chr_dirsep . "tlpm.debug"; # debug file

# relative paths to lists and tpms

$tl_texmf = $chr_dirsep . "texmf";
$tl_lists = $tl_texmf . $chr_dirsep . "lists";
@tl_tpms  = ($chr_dirsep . "texmf"      . $chr_dirsep . "tpm",
             $chr_dirsep . "texmf-dist" . $chr_dirsep . "tpm",
             $chr_dirsep . "texmf-doc"  . $chr_dirsep . "tpm");

# paths to source TL directory (relative to mounting point / drive)

@tl_roots = ('',
             $chr_dirsep . "texlive",
             $chr_dirsep . "texlive2004");

# ZIP archive

$tl_archive = $chr_dirsep . "archive";

# unzipper is always available in ./support directory

if($win32)
{
      $tl_unzip = sub {return $tl_source . $chr_dirsep . "support" . $chr_dirsep . "unzip.exe"};
      $tl_xcopy = "xcopy"; # wrrrr
      $sys_redir = '>nul';
}
else
{
      $tl_unzip   = sub {return "unzip"}; # assuming in system
      $tl_xcopy = "cp";
      $sys_redir = '>/dev/null';
}

# handling package names heuristic do NOT match TL2003 and older!

$reg_binary  = qr/\Abin-[^.]+(.*)/io; # on TL2004 there is ie. bin-<pkg>.sparc-solaris2.7.zip
$reg_library = qr/\Alib-[^.]+(.*)/io;
$reg_scheme  = qr/\Ascheme-/io;
# no longer used
#$reg_win32   = qr/\.win32/io; # also 'win32-static'
#$reg_collec  = qr/\Acollection-/io;

# handling package list files
$reg_require = qr/\A[+-]/o;
$reg_action  = qr/\A!/o;
$reg_about   = qr/\A\*/o;
$reg_empty   = qr/\A\s*\z/o;

$, = "\n";
$| = 1;

# formatting

$row_length = 80;
$row_skip   = 42;
$wrd_skip   = 12;
$row_fmt    = "%-${row_skip}s";
$wrd_fmt    = "%-${wrd_skip}s";

1;