summaryrefslogtreecommitdiff
path: root/new-infra/Perl-API.txt
blob: de9febafe110fb26655d136c5923c5c1ea43927b (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
API for Perl Modules for new infra
==================================

Module TLSRC
------------

Constructor:
	TLSRC->new;
	TLSRC->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->shortdesc
	$tlsrc->longdesc
	$tlsrc->catalogue
	$tlsrc->srcpatterns
	$tlsrc->docpatterns
	$tlsrc->runpatterns
	$tlsrc->binpatterns
	$tlsrc->depends
	$tlsrc->executes

Generation function
	$tlp = $tlsrc->make_tlp($tltree);
		generates a TLP object from itself (a TLSRC obj) and
		a TLTREE object (see below)


Module TLP
----------

Constructur:
	TLP->new;
	TLP->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->make_zip($ziploc)
		creates a zip file of the tlp in $ziploc
			zip $ziploc files ...
		NOT IMPLEMENTED

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

	$tlp->name
	$tlp->revision
	$tlp->shortdesc
	$tlp->longdesc
	$tlp->catalogue
	$tlp->srcfiles
	$tlp->docfiles
	$tlp->runfiles
	$tlp->binfiles
	$tlp->depends
	$tlp->executes

	$tlp->add_srcfiles(@files)
		adds @files to the list of srcfiles
	$tlp->add_docfiles(@files)
		adds @files to the list of docfiles
	$tlp->add_runfiles(@files)
		adds @files to the list of runfiles

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


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

Constructor

	TLTREE->new;
	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

Input/Ouput

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

Pattern matching functions
	
	$tltree->get_files_matching_regexp_pattern($type,$pattern)
		returns a list of files matching $pattern 
		(see specification)
	
	$tltree->get_files_matching_dir_pattern($type,@patwords)
		returns a list of files matching a t pattern with words
		(see specification)

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


Module TLDB
-----------

Constructore

	TLDB->new;
	TLDB->new ( location => "path/to/tldb/file" );

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

	$tldb->location

Input/Output

	$tldb->from_file($filename);
		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

TLP interface

	$tldb->add_tlp($tlp)
		adds a TLP to the TLDB

	$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"