summaryrefslogtreecommitdiff
path: root/Master/tlpkg/doc/historic/Perl-API.txt
blob: 2b3200c2e7439531e68d6e3494d5ba60ce697a50 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
API for Perl Modules for new infra
==================================

NOTE: THE DEFINITIVE DOCUMENTATION IS IN THE PM FILES AS POD DOCUMENTATION!!

Module TeXLive::TLPSRC
----------------------

PLEASE SEE THE MANPAGE OF TeXLive::TLPSRC which is MORE UP 2 DATE!!!!

Constructor:
	TeXLive::TLPSRC->new;
	TeXLive::TLPSRC->new( name => "foobar", shortdesc => "The foobar package", ...);

Input/Output
	$tlsrc->from_file("package.tlsrc");
	$tlsrc->writeout
		without arg to stdout
		with arg to filehandle

Read/Write functions (with argument set, without arg read)

	$tlsrc->name
	$tlsrc->category
	$tlsrc->shortdesc
	$tlsrc->longdesc
	$tlsrc->catalogue
	$tlsrc->srcpatterns
	$tlsrc->docpatterns
	$tlsrc->runpatterns
	$tlsrc->binpatterns
	$tlsrc->depends
	$tlsrc->executes

Generation function
	$tlp = $tlsrc->make_tlpobj($tltree);
		generates a TeXLive::TLPOBJ object from itself and
		a TeXLive::TLTREE object (see below)


Module TeXLive::TLPOBJ
----------------------

PLEASE SEE THE MANPAGE OF TeXLive::TLPOBJ which is MORE UP 2 DATE!!!!

Package variables:
	&TeXLive::TLPOBJ->zipdir
		set/returns the default location for created zip files

Constructur:
	TeXLive::TLPOBJ->new;
	TeXLive::TLPOBJ->new( name => "foobar", ...);

Input/Output
	$tlp->from_file("package.tlp");
		reads from file, only one tlp allowed in file
	$tlp->from_fh($filehandle [, $multi] );
		reads from $filehandle
		if $multi is undefined (ie not given) then multiple tlp
		in the same file are treated as errors 
		if $multi is defined then returns after reading one
		tlp
		returns 1 if it found a tlp, otherwise 0
	$tlp->writeout
		without arg to stdout
		with arg to filehandle
	$tlp->writeout_simple
		for comparison with tpm/tlps, will go away

	$tlp->make_zip($tltree[,$destdir[,$zipname]]);
		creates a zip file of the arch INDEPENDENT files in tlp 
		in $destdir (if not defined then TLP->zipdir is used).
		The file name of the created zipfile is $zipname (if not
		present $tlp->name.zip)

		If the package contains "binfiles"; then zip files for 
		all archs containing ONLY the binfiles are created, and 
		the zipfile name is
			$zipname.$arch.zip

		All the arch independent zip files ALSO contain the 
		respective TLPOBJ file in 
			.tlpobj/$name.tlpobj
		SO $zipname.zip does contain this tlpobj file, while
		$zipname.$arch.zip does NOT.

		(Compatibility with the scheme used before)
	
	$tlp->update_from_catalogue($texcatalogue);
		merges some information from the TeX Catalogue into 
		the TLPOBJ

Utilities:
	$tlp->recompute_sizes($tltree)
		recomputes all the *size fields, see below
	$tlp->recompute_revision($tltree)
		recomputes the revision of the package
	$tlp->is_arch_dependent
		true if it contains bin files, otherwise false
	$tlp->total_size
		if no arguments given this is 
			srcsize + docsize + runsize
		if args are given then this is
			srcsize + docsize + runsize +
				+ sum_{i in args} binsize{$i}

Read/Write functions (with argument set, without arg read)

	$tlp->name
	$tlp->category
	$tlp->revision
	$tlp->shortdesc
	$tlp->longdesc
	$tlp->catalogue
		reads/returns scalar
	$tlp->srcfiles
	$tlp->srcsize
	$tlp->docfiles
	$tlp->docsize
	$tlp->runfiles
	$tlp->runsize
		*files reads/returns array of files
		*size reads/returns scalar
	$tlp->binfiles
	$tlp->binsize
		note that this gives/returns a HASH of architectures!!
	$tlp->depends
	$tlp->executes
		reads/returns array

	$tlp->add_srcfiles(@files)
	$tlp->remove_srcfiles(@files)
		adds @files to the list of srcfiles
	$tlp->add_docfiles(@files)
	$tlp->remove_docfiles(@files)
		adds @files to the list of docfiles
	$tlp->add_runfiles(@files)
	$tlp->remove_runfiles(@files)
		adds/removes @files to the list of runfiles

	$tlp->add_binfiles($arch,@files)
	$tlp->remove_binfiles($arch,@files)
		adds/removes @files to the list of binfiles for arch=$arch
	
	$tlp->add_files($type,@files)
	$tlp->remove_files($type,@files)
		adds/removes @files to the list of $type = (run|doc|src)files
		NOT FOR binfiles!


Module TeXLive::TLTREE
----------------------
(this one is still quite hacky)

Constructor

	TeXLive::TLTREE->new;
	TeXLive::TLTREE->new( svnroot => "path/to/svn/managed/dir" );

Init functions

	$tltree->init_from_svn
		changes to svnroot, calls svn status -v and builds
		up all the necessary information
	$tltree->init_from_statusfile($file)
		does the same as init_from_svn, but from a pre-made
		output of svn status -v
	$tltree->init_from_files
		inits from a find $svnroot command, all the revisions
		are set to 1

Input/Ouput

	$tltree->print
		to stdout, more or less for hacking only not usefull

Pattern matching functions
	
	$ref = $tltree->get_matching_files($type,$pattern)
		for $type = bin
			returns a ref to a hash of keys = architectures
		otherwise
			returns a ref to an array
		(see specification)

		Note that a pattern of the form
			bin/${ARCH}/foobar
		also matches for arch=win32 
			bin/${ARCH}/foobar.{exe,bat}


Other functions

	$tltree->file_svn_lastrevision($file)
		returns the revision of the last change of file
		as given by svn status -v
		undef if file is not contained in $tltree

	$tltree->size_of($file)
		returns the size of $file, or undef if not in tree

	&$tlsrc->architectures
		sets/reads the list of architectures,
		predefined to ....


Module TeXLive::TLPDB
------------------------
Package variables:
	&TeXLive::TLPDB->listdir
		sets/returns the default location for created list files

Constructor

	TeXLive::TLPDB->new;
	TeXLive::TLPDB->new ( location => "path/to/tldb/file" );
	TeXLive::TLPDB->new ( location => "http://path/to/tldb/file" );
	TeXLive::TLPDB->new ( location => "ftp://path/to/tldb/file" );

Read/Write functions (with argument set, without arg read)

	$tldb->location

Input/Output

	$tldb->from_file("path/to/tldb/file");
	$tldb->from_file("http://path/to/tldb/file");
	$tldb->from_file("ftp://path/to/tldb/file");
		reads a tldb file (tlp descriptions separated by newlines)
	
	$tldb->writeout
		without arg to stdout 
		with arg to filehandle

	$tldb->save
		saves to $self->location;

	$tldb->generate_packagelist
		outputs list of "package revision" for web delivery
		without arg to stdout
		with arg to filehandle

	$tldb->generate_listfiles([$destdir])
		create list file(s) in $destdir (if not given then it defaults
		to TLDB->listdir) (could be more than one for
		packages with binary files)
	
	$tldb->list_packages
		returns all packages installed

TLP interface

	$tldb->add_tlpobj($tlp)
		adds a TeXLive::TLPOBJ to the db (or replaces an already present)

	$tlp = $tldb->get_package("packagename");
		returns undef if not installed
	
	$rev = $tldb->package_revision("packagename");
		returns undef if not installed, otherwise the
		revision of "packagename"
	

Package TeXLive::TLUtils
------------------------

exported functions:
	 platform;
	 platform_desc($platform);
	 win32;
	 unix;
	 getenv($string);
	 which($string);
	 program_exists($program);
	 get_system_tmpdir;
	 dirname($path);
	 basename($path);
	 dirname_and_basename($path);
	 mkdirhier($path);
	 copy($file, $target_dir);
	 media;
	 initialze_installer;
	 binaries_available_from_disk;
	 binaries_available_from_net;
	 make_var_skeleton($path);
	 make_local_skeleton($path);
	 sort_uniq(@list);
	 push_uniq(\@list, @items);
	 member($item, @list);
	 debug($string);