1 | #!/usr/bin/perl -w
|
---|
2 | #
|
---|
3 | # Project Builder Env module
|
---|
4 | # Env subroutines brought by the the Project-Builder project
|
---|
5 | # which can be easily used by pbinit scripts
|
---|
6 | #
|
---|
7 | # $Id$
|
---|
8 | #
|
---|
9 | # Copyright B. Cornec 2007
|
---|
10 | # Provided under the GPL v2
|
---|
11 |
|
---|
12 | package ProjectBuilder::Env;
|
---|
13 |
|
---|
14 | use strict 'vars';
|
---|
15 | use Data::Dumper;
|
---|
16 | use English;
|
---|
17 | use File::Basename;
|
---|
18 | use File::stat;
|
---|
19 | use POSIX qw(strftime);
|
---|
20 | use lib qw (lib);
|
---|
21 | use ProjectBuilder::Base;
|
---|
22 | use ProjectBuilder::Conf;
|
---|
23 | use ProjectBuilder::CMS;
|
---|
24 |
|
---|
25 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
26 |
|
---|
27 | use Exporter;
|
---|
28 |
|
---|
29 | # Export, by default, all the functions into the namespace of
|
---|
30 | # any code which uses this module.
|
---|
31 |
|
---|
32 | our @ISA = qw(Exporter);
|
---|
33 | our @EXPORT = qw(pb_env_init);
|
---|
34 |
|
---|
35 | =pod
|
---|
36 |
|
---|
37 | =head1 NAME
|
---|
38 |
|
---|
39 | ProjectBuilder::Env, part of the project-builder.org
|
---|
40 |
|
---|
41 | =head1 DESCRIPTION
|
---|
42 |
|
---|
43 | This modules provides environment functions suitable for pbinit calls.
|
---|
44 |
|
---|
45 | =head1 USAGE
|
---|
46 |
|
---|
47 | =over 4
|
---|
48 |
|
---|
49 | =item B<pb_env_init>
|
---|
50 |
|
---|
51 | This function setup the environment for project-builder.
|
---|
52 | The first parameter is the project if given on the command line.
|
---|
53 | The second parameter is a flag indicating whether we should setup up the pbconf environment or not.
|
---|
54 | The third parameter is the action passed to pb.
|
---|
55 | It sets up environement variables (PBETC, PBPROJ, PBDEFDIR, PBBUILDDIR, PBROOTDIR, PBDESTDIR, PBCONFDIR, PBPROJVER)
|
---|
56 |
|
---|
57 | =cut
|
---|
58 |
|
---|
59 | sub pb_env_init {
|
---|
60 |
|
---|
61 | my $proj=shift || undef;
|
---|
62 | my $pbinit=shift || undef;
|
---|
63 | my $action=shift;
|
---|
64 | my $ver;
|
---|
65 | my $tag;
|
---|
66 |
|
---|
67 | $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
|
---|
68 |
|
---|
69 | if (! -f $ENV{'PBETC'}) {
|
---|
70 | pb_log(0, "No existing $ENV{'PBETC'} found, creating one as template");
|
---|
71 | open(PBRC, "> $ENV{'PBETC'}") || die "Unable to create $ENV{'PBETC'}";
|
---|
72 | print PBRC << "EOF";
|
---|
73 | #
|
---|
74 | # Define for each project the URL of its pbconf repository
|
---|
75 | # No default option allowed here as they need to be all different
|
---|
76 | #
|
---|
77 | #pbconfurl example = svn+ssh://svn.example.org/svn/pb/projects/example/pbconf
|
---|
78 | #pbconfurl pb = svn+ssh://svn.project-builder.org/mondo/svn/pb/pbconf
|
---|
79 |
|
---|
80 | # Under that dir will take place everything related to pb
|
---|
81 | # If you want to use VMs/chroot/..., then use \$ENV{'HOME'} to make it portable
|
---|
82 | # to your VMs/chroot/...
|
---|
83 | # if not defined then /var/cache
|
---|
84 | #pbdefdir default = \$ENV{'HOME'}/pb/projects
|
---|
85 | #pbdefdir pb = \$ENV{'HOME'}
|
---|
86 |
|
---|
87 | # If not defined, pbconfdir is under pbdefdir/pbproj/pbconf
|
---|
88 | #pbconfdir pb = \$ENV{'HOME'}/pb/pbconf
|
---|
89 |
|
---|
90 | # If not defined, pbprojdir is under pbdefdir/pbproj
|
---|
91 | # Only defined if we have access to the dev of the project
|
---|
92 | #pbprojdir example = \$ENV{'HOME'}/example/svn
|
---|
93 |
|
---|
94 | # We have commit acces to these
|
---|
95 | #pburl example = cvs+ssh://user\@example.cvs.sourceforge.net:/cvsroot/example
|
---|
96 | #pburl pb = svn+ssh://svn.project-builder.org/mondo/svn/pb
|
---|
97 |
|
---|
98 | # I mask my real login on the ssh machines here
|
---|
99 | #sshlogin example = user
|
---|
100 |
|
---|
101 | # where to find Build System infos:
|
---|
102 | #vmpath default = /home/qemu
|
---|
103 | #vepath default = /home/rinse
|
---|
104 |
|
---|
105 | # Overwrite generic setup
|
---|
106 | #vmport pb = 2223
|
---|
107 | #vmport example = 2224
|
---|
108 | EOF
|
---|
109 | }
|
---|
110 |
|
---|
111 | # We only have one configuration file for now.
|
---|
112 | pb_conf_add("$ENV{'PBETC'}");
|
---|
113 |
|
---|
114 | #
|
---|
115 | # Check project name
|
---|
116 | # Could be with env var PBPROJ
|
---|
117 | # or option -p
|
---|
118 | # if not define take the first in conf file
|
---|
119 | #
|
---|
120 | if ((defined $ENV{'PBPROJ'}) &&
|
---|
121 | (not (defined $proj))) {
|
---|
122 | $proj = $ENV{'PBPROJ'};
|
---|
123 | }
|
---|
124 |
|
---|
125 | #
|
---|
126 | # We get the pbconf file for that project
|
---|
127 | # and use its content
|
---|
128 | #
|
---|
129 | my ($pbconf) = pb_conf_get("pbconfurl");
|
---|
130 | pb_log(2,"DEBUG pbconfurl: ".Dumper($pbconf)."\n");
|
---|
131 |
|
---|
132 | my %pbconf = %$pbconf;
|
---|
133 | if (not defined $proj) {
|
---|
134 | # Take the first as the default project
|
---|
135 | $proj = (keys %pbconf)[0];
|
---|
136 | if (defined $proj) {
|
---|
137 | pb_log(1,"WARNING: using $proj as default project as none has been specified\n");
|
---|
138 | pb_log(1," Please either create a pbconfurl reference for project $proj in $ENV{'PBETC'}\n");
|
---|
139 | pb_log(1," or call pb with the -p project option or use the env var PBPROJ\n");
|
---|
140 | pb_log(1," if you want to use another project\n");
|
---|
141 | }
|
---|
142 | }
|
---|
143 | die "No project defined - use env var PBPROJ or -p proj or a pbconfurl entry in $ENV{'PBETC'}" if (not (defined $proj));
|
---|
144 |
|
---|
145 | # That's always the environment variable that will be used
|
---|
146 | $ENV{'PBPROJ'} = $proj;
|
---|
147 | pb_log(2,"PBPROJ: $ENV{'PBPROJ'}\n");
|
---|
148 |
|
---|
149 | if (not defined ($pbconf{$ENV{'PBPROJ'}})) {
|
---|
150 | die "Please create a pbconfurl reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n";
|
---|
151 | }
|
---|
152 |
|
---|
153 | # Adds a potential conf file now as it's less
|
---|
154 | # important than the project conf file
|
---|
155 | my ($vmpath,$vepath) = pb_conf_get_if("vmpath","vepath");
|
---|
156 | pb_conf_add("$vmpath->{$ENV{'PBPROJ'}}/.pbrc") if ((defined $vmpath) && (-f "$vmpath->{$ENV{'PBPROJ'}}/.pbrc"));
|
---|
157 | pb_conf_add("$vepath->{$ENV{'PBPROJ'}}/.pbrc") if ((defined $vepath) && (-f "$vepath->{$ENV{'PBPROJ'}}/.pbrc"));
|
---|
158 |
|
---|
159 | #
|
---|
160 | # Detect the root dir for hosting all the content generated with pb
|
---|
161 | #
|
---|
162 | =over 4
|
---|
163 |
|
---|
164 | Tree will look like this:
|
---|
165 |
|
---|
166 | maint pbdefdir PBDEFDIR dev dir (optional)
|
---|
167 | | |
|
---|
168 | ------------------------ --------------------
|
---|
169 | | | | |
|
---|
170 | pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 PBPROJDIR
|
---|
171 | | |
|
---|
172 | --------------------------------------------- ----------
|
---|
173 | * * * | | | * *
|
---|
174 | tag dev pbconf ... build delivery PBCONFDIR dev tag
|
---|
175 | | | | PBDESTDIR |
|
---|
176 | --- ------ pbrc PBBUILDDIR -------
|
---|
177 | | | | | |
|
---|
178 | 1.1 dev tag 1.0 1.1 PBDIR
|
---|
179 | |
|
---|
180 | -------
|
---|
181 | | |
|
---|
182 | 1.0 1.1 PBROOTDIR
|
---|
183 | |
|
---|
184 | ----------------------------------
|
---|
185 | | | | |
|
---|
186 | pkg1 pbproj1.pb pbfilter pbcl
|
---|
187 | |
|
---|
188 | -----------------
|
---|
189 | | | |
|
---|
190 | rpm deb pbfilter
|
---|
191 |
|
---|
192 |
|
---|
193 | (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)
|
---|
194 | Names under a pbproj and the corresponding pbconf should be similar
|
---|
195 |
|
---|
196 | =cut
|
---|
197 |
|
---|
198 | my ($pbdefdir) = pb_conf_get_if("pbdefdir");
|
---|
199 |
|
---|
200 | if (not defined $ENV{'PBDEFDIR'}) {
|
---|
201 | if ((not defined $pbdefdir) || (not defined $pbdefdir->{$ENV{'PBPROJ'}})) {
|
---|
202 | pb_log(1,"WARNING: no pbdefdir defined, using /var/cache\n");
|
---|
203 | pb_log(1," Please create a pbdefdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
|
---|
204 | pb_log(1," if you want to use another directory\n");
|
---|
205 | $ENV{'PBDEFDIR'} = "/var/cache";
|
---|
206 | } else {
|
---|
207 | # That's always the environment variable that will be used
|
---|
208 | $ENV{'PBDEFDIR'} = $pbdefdir->{$ENV{'PBPROJ'}};
|
---|
209 | }
|
---|
210 | }
|
---|
211 | # Expand potential env variable in it
|
---|
212 | eval { $ENV{'PBDEFDIR'} =~ s/(\$ENV.+\})/$1/eeg };
|
---|
213 |
|
---|
214 | pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");
|
---|
215 |
|
---|
216 | # Need to do that earlier as it's used potentialy in pb_cms_add
|
---|
217 | pb_temp_init();
|
---|
218 | pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");
|
---|
219 |
|
---|
220 | # Put under CMS the PBPROJ dir
|
---|
221 | if ($action =~ /^newproj$/) {
|
---|
222 | if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
|
---|
223 | pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") || die "Unable to recursively create $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
|
---|
224 | }
|
---|
225 | pb_cms_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
|
---|
226 | }
|
---|
227 |
|
---|
228 | #
|
---|
229 | # Set delivery directory
|
---|
230 | #
|
---|
231 | $ENV{'PBDESTDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/delivery";
|
---|
232 |
|
---|
233 | pb_log(2,"PBDESTDIR: $ENV{'PBDESTDIR'}\n");
|
---|
234 | #
|
---|
235 | # Removes all directory existing below the delivery dir
|
---|
236 | # as they are temp dir only except when called from pbinit
|
---|
237 | # Files stay and have to be cleaned up manually if needed
|
---|
238 | # those files serves as communication channels between pb phases
|
---|
239 | # Removing them prevents a following phase to detect what has been done before
|
---|
240 | #
|
---|
241 | if ((-d $ENV{'PBDESTDIR'}) && ($action !~ /pbinit/)) {
|
---|
242 | opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";
|
---|
243 | foreach my $d (readdir(DIR)) {
|
---|
244 | next if ($d =~ /^\./);
|
---|
245 | next if (-f "$ENV{'PBDESTDIR'}/$d");
|
---|
246 | pb_rm_rf("$ENV{'PBDESTDIR'}/$d") if (-d "$ENV{'PBDESTDIR'}/$d");
|
---|
247 | }
|
---|
248 | closedir(DIR);
|
---|
249 | }
|
---|
250 | if (! -d "$ENV{'PBDESTDIR'}") {
|
---|
251 | pb_mkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";
|
---|
252 | }
|
---|
253 |
|
---|
254 | #
|
---|
255 | # Set build directory
|
---|
256 | #
|
---|
257 | $ENV{'PBBUILDDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/build";
|
---|
258 | if (! -d "$ENV{'PBBUILDDIR'}") {
|
---|
259 | pb_mkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";
|
---|
260 | }
|
---|
261 |
|
---|
262 | pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n");
|
---|
263 |
|
---|
264 | #
|
---|
265 | # The following part is only useful when in cms2something or newsomething
|
---|
266 | # In VMs/VEs we want to skip that by providing good env vars.
|
---|
267 | # return values in that case are useless
|
---|
268 | #
|
---|
269 | if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^web/)) {
|
---|
270 |
|
---|
271 | #
|
---|
272 | # Check pbconf cms compliance
|
---|
273 | #
|
---|
274 | pb_cms_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
|
---|
275 |
|
---|
276 | # Check where is our PBROOTDIR (release tag name can't be guessed the first time)
|
---|
277 | #
|
---|
278 | if (not defined $ENV{'PBROOTDIR'}) {
|
---|
279 | if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
|
---|
280 | $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}";
|
---|
281 | pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
|
---|
282 | pb_log(1," Please use -r release if you want to use another release\n");
|
---|
283 | die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
|
---|
284 | } else {
|
---|
285 | my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
|
---|
286 | # That's always the environment variable that will be used
|
---|
287 | die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
|
---|
288 | $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};
|
---|
289 | }
|
---|
290 | } else {
|
---|
291 | # transform in full path if relative
|
---|
292 | $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
|
---|
293 | pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
|
---|
294 | die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
|
---|
295 | }
|
---|
296 |
|
---|
297 | # Adds that conf file to the list to consider
|
---|
298 | pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb");
|
---|
299 |
|
---|
300 | return if ($action =~ /^newver$/);
|
---|
301 |
|
---|
302 | my %version = ();
|
---|
303 | my %defpkgdir = ();
|
---|
304 | my %extpkgdir = ();
|
---|
305 | my %filteredfiles = ();
|
---|
306 | my %supfiles = ();
|
---|
307 |
|
---|
308 | if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
|
---|
309 |
|
---|
310 | # List of pkg to build by default (mandatory)
|
---|
311 | my ($defpkgdir,$pbpackager, $pkgv, $pkgt) = pb_conf_get("defpkgdir","pbpackager","projver","projtag");
|
---|
312 | # List of additional pkg to build when all is called (optional)
|
---|
313 | # Valid version names (optional)
|
---|
314 | # List of files to filter (optional)
|
---|
315 | # Project version and tag (optional)
|
---|
316 | my ($extpkgdir, $version, $filteredfiles, $supfiles) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles");
|
---|
317 | pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
|
---|
318 | pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
|
---|
319 | pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
|
---|
320 | pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
|
---|
321 | pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
|
---|
322 | # Global
|
---|
323 | %defpkgdir = %$defpkgdir;
|
---|
324 | %extpkgdir = %$extpkgdir if (defined $extpkgdir);
|
---|
325 | %version = %$version if (defined $version);
|
---|
326 | %filteredfiles = %$filteredfiles if (defined $filteredfiles);
|
---|
327 | %supfiles = %$supfiles if (defined $supfiles);
|
---|
328 | #
|
---|
329 | # Get global Version/Tag
|
---|
330 | #
|
---|
331 | if (not defined $ENV{'PBPROJVER'}) {
|
---|
332 | if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
|
---|
333 | $ENV{'PBPROJVER'}=$pkgv->{$ENV{'PBPROJ'}};
|
---|
334 | } else {
|
---|
335 | die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
336 | }
|
---|
337 | }
|
---|
338 | die "Invalid version name $ENV{'PBPROJVER'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBPROJVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBPROJVER'} =~ /$version{$ENV{'PBPROJ'}}/));
|
---|
339 |
|
---|
340 | if (not defined $ENV{'PBPROJTAG'}) {
|
---|
341 | if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
|
---|
342 | $ENV{'PBPROJTAG'}=$pkgt->{$ENV{'PBPROJ'}};
|
---|
343 | } else {
|
---|
344 | die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
345 | }
|
---|
346 | }
|
---|
347 | die "Invalid tag name $ENV{'PBPROJTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBPROJTAG'} !~ /[0-9.]+/);
|
---|
348 |
|
---|
349 |
|
---|
350 | if (not defined $ENV{'PBPACKAGER'}) {
|
---|
351 | if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
|
---|
352 | $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
|
---|
353 | } else {
|
---|
354 | die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
355 | }
|
---|
356 | }
|
---|
357 | } else {
|
---|
358 | if (defined $pbinit) {
|
---|
359 | my @pkgs = @ARGV;
|
---|
360 | @pkgs = ("pkg1") if (not @pkgs);
|
---|
361 |
|
---|
362 | open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
363 | print CONF << "EOF";
|
---|
364 | #
|
---|
365 | # Project Builder configuration file
|
---|
366 | # For project $ENV{'PBPROJ'}
|
---|
367 | #
|
---|
368 | # \$Id\$
|
---|
369 | #
|
---|
370 |
|
---|
371 | #
|
---|
372 | # What is the project URL
|
---|
373 | #
|
---|
374 | #pburl $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
375 | #pburl $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
376 | #pburl $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
377 | #pburl $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
378 | #pburl $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
379 | #pburl $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
380 | #pburl $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel
|
---|
381 |
|
---|
382 | # Repository
|
---|
383 | #pbrepo $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org
|
---|
384 | #pbml $ENV{'PBPROJ'} = $ENV{'PBPROJ'}-announce\@lists.$ENV{'PBPROJ'}.org
|
---|
385 | #pbsmtp $ENV{'PBPROJ'} = localhost
|
---|
386 |
|
---|
387 | # Check whether project is well formed
|
---|
388 | # when downloading from ftp/http/...
|
---|
389 | # (containing already a directory with the project-version name)
|
---|
390 | #pbwf $ENV{'PBPROJ'} = 1
|
---|
391 |
|
---|
392 | #
|
---|
393 | # Packager label
|
---|
394 | #
|
---|
395 | #pbpackager $ENV{'PBPROJ'} = William Porte <bill\@$ENV{'PBPROJ'}.org>
|
---|
396 | #
|
---|
397 |
|
---|
398 | # For delivery to a machine by SSH (potentially the FTP server)
|
---|
399 | # Needs hostname, account and directory
|
---|
400 | #
|
---|
401 | #sshhost $ENV{'PBPROJ'} = www.$ENV{'PBPROJ'}.org
|
---|
402 | #sshlogin $ENV{'PBPROJ'} = bill
|
---|
403 | #sshdir $ENV{'PBPROJ'} = /$ENV{'PBPROJ'}/ftp
|
---|
404 | #sshport $ENV{'PBPROJ'} = 22
|
---|
405 |
|
---|
406 | #
|
---|
407 | # For Virtual machines management
|
---|
408 | # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
|
---|
409 | # followed by '-' and by release number
|
---|
410 | # followed by '-' and by architecture
|
---|
411 | # a .vmtype extension will be added to the resulting string
|
---|
412 | # a QEMU rhel-3-i286 here means that the VM will be named rhel-3-i386.qemu
|
---|
413 | #
|
---|
414 | #vmlist $ENV{'PBPROJ'} = mandrake-10.1-i386,mandrake-10.2-i386,mandriva-2006.0-i386,mandriva-2007.0-i386,mandriva-2007.1-i386,mandriva-2008.0-i386,redhat-7.3-i386,redhat-9-i386,fedora-4-i386,fedora-5-i386,fedora-6-i386,fedora-7-i386,fedora-8-i386,rhel-3-i386,rhel-4-i386,rhel-5-i386,suse-10.0-i386,suse-10.1-i386,suse-10.2-i386,suse-10.3-i386,sles-9-i386,sles-10-i386,gentoo-nover-i386,debian-3.1-i386,debian-4.0-i386,ubuntu-6.06-i386,ubuntu-7.04-i386,ubuntu-7.10-i386,mandriva-2007.0-x86_64,mandriva-2007.1-x86_64,mandriva-2008.0-x86_64,fedora-6-x86_64,fedora-7-x86_64,fedora-8-x86_64,rhel-4-x86_64,rhel-5-x86_64,suse-10.2-x86_64,suse-10.3-x86_64,sles-10-x86_64,gentoo-nover-x86_64,debian-4.0-x86_64,ubuntu-7.04-x86_64,ubuntu-7.10-x86_64,solaris-10-x86_64
|
---|
415 |
|
---|
416 | #
|
---|
417 | # Valid values for vmtype are
|
---|
418 | # qemu, (vmware, xen, ... TBD)
|
---|
419 | #vmtype $ENV{'PBPROJ'} = qemu
|
---|
420 |
|
---|
421 | # Hash for VM stuff on vmtype
|
---|
422 | #vmntp default = pool.ntp.org
|
---|
423 |
|
---|
424 | # We suppose we can commmunicate with the VM through SSH
|
---|
425 | #vmhost $ENV{'PBPROJ'} = localhost
|
---|
426 | #vmlogin $ENV{'PBPROJ'} = pb
|
---|
427 | #vmport $ENV{'PBPROJ'} = 2222
|
---|
428 |
|
---|
429 | # Timeout to wait when VM is launched/stopped
|
---|
430 | #vmtmout default = 120
|
---|
431 |
|
---|
432 | # per VMs needed paramaters
|
---|
433 | #vmopt $ENV{'PBPROJ'} = -m 384 -daemonize
|
---|
434 | #vmpath $ENV{'PBPROJ'} = /home/qemu
|
---|
435 | #vmsize $ENV{'PBPROJ'} = 5G
|
---|
436 |
|
---|
437 | #
|
---|
438 | # For Virtual environment management
|
---|
439 | # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
|
---|
440 | # followed by '-' and by release number
|
---|
441 | # followed by '-' and by architecture
|
---|
442 | # a .vetype extension will be added to the resulting string
|
---|
443 | # a chroot rhel-3-i286 here means that the VE will be named rhel-3-i386.chroot
|
---|
444 | #
|
---|
445 | #velist $ENV{'PBPROJ'} = fedora-7-i386
|
---|
446 |
|
---|
447 | # VE params
|
---|
448 | #vetype $ENV{'PBPROJ'} = chroot
|
---|
449 | #ventp default = pool.ntp.org
|
---|
450 | #velogin $ENV{'PBPROJ'} = pb
|
---|
451 | #vepath $ENV{'PBPROJ'} = /var/lib/mock
|
---|
452 | #veconf $ENV{'PBPROJ'} = /etc/mock
|
---|
453 | #verebuild $ENV{'PBPROJ'} = false
|
---|
454 |
|
---|
455 | #
|
---|
456 | # Global version/tag for the project
|
---|
457 | #
|
---|
458 | #projver $ENV{'PBPROJ'} = devel
|
---|
459 | #projtag $ENV{'PBPROJ'} = 1
|
---|
460 |
|
---|
461 | # Hash of valid version names
|
---|
462 |
|
---|
463 | # Additional repository to add at build time
|
---|
464 | # addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/test/centos/5/pb.repo
|
---|
465 | # addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/test/centos/5/pb.repo
|
---|
466 | #version $ENV{'PBPROJ'} = devel,stable
|
---|
467 |
|
---|
468 | # Is it a test version or a production version
|
---|
469 | testver $ENV{'PBPROJ'} = true
|
---|
470 |
|
---|
471 | # Additional repository to add at build time
|
---|
472 | # addrepo centos-5-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm,ftp://ftp.project-builder.org/test/centos/5/pb.repo
|
---|
473 | # addrepo centos-4-x86_64 = http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.x86_64.rpm,ftp://ftp.project-builder.org/test/centos/4/pb.repo
|
---|
474 |
|
---|
475 | # Adapt to your needs:
|
---|
476 | # Optional if you need to overwrite the global values above
|
---|
477 | #
|
---|
478 | EOF
|
---|
479 |
|
---|
480 | foreach my $pp (@pkgs) {
|
---|
481 | print CONF << "EOF";
|
---|
482 | #pkgver $pp = stable
|
---|
483 | #pkgtag $pp = 3
|
---|
484 | EOF
|
---|
485 | }
|
---|
486 | foreach my $pp (@pkgs) {
|
---|
487 | print CONF << "EOF";
|
---|
488 | # Hash of default package/package directory
|
---|
489 | #defpkgdir $pp = dir-$pp
|
---|
490 | EOF
|
---|
491 | }
|
---|
492 |
|
---|
493 | print CONF << "EOF";
|
---|
494 | # Hash of additional package/package directory
|
---|
495 | #extpkgdir minor-pkg = dir-minor-pkg
|
---|
496 |
|
---|
497 | # List of files per pkg on which to apply filters
|
---|
498 | # Files are mentioned relatively to pbroot/defpkgdir
|
---|
499 | EOF
|
---|
500 | foreach my $pp (@pkgs) {
|
---|
501 | print CONF << "EOF";
|
---|
502 | #filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.8
|
---|
503 | #supfiles $pp = $pp.init
|
---|
504 |
|
---|
505 | # For perl modules, names are different depending on distro
|
---|
506 | # Here perl-xxx for RPMs, libxxx-perl for debs, ...
|
---|
507 | # So the package name is indeed virtual
|
---|
508 | #namingtype $pp = perl
|
---|
509 | EOF
|
---|
510 | }
|
---|
511 | close(CONF);
|
---|
512 | pb_mkdir_p("$ENV{'PBROOTDIR'}/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter";
|
---|
513 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.pbf";
|
---|
514 | print CONF << "EOF";
|
---|
515 | #
|
---|
516 | # \$Id\$
|
---|
517 | #
|
---|
518 | # Filter for all files
|
---|
519 | #
|
---|
520 | #
|
---|
521 | # PBREPO is replaced by the root URL to access the repository
|
---|
522 | filter PBREPO = \$pb->{'repo'}
|
---|
523 |
|
---|
524 | # PBSRC is replaced by the source package location after the repo
|
---|
525 | #filter PBSRC = src/%{name}-%{version}.tar.gz
|
---|
526 | # Used if virtual name != real name (perl, ...)
|
---|
527 | #filter PBSRC = src/%{srcname}-%{version}.tar.gz
|
---|
528 |
|
---|
529 | # PBVER is replaced by the version (\$pb->{'ver'} in code)
|
---|
530 | filter PBVER = \$pb->{'ver'}
|
---|
531 |
|
---|
532 | # PBDATE is replaced by the date (\$pb->{'date'} in code)
|
---|
533 | filter PBDATE = \$pb->{'date'}
|
---|
534 |
|
---|
535 | # PBPATCHSRC is replaced by the patches names if value is yes
|
---|
536 | #filter PBPATCHSRC = yes
|
---|
537 |
|
---|
538 | # PBPATCHCMD is replaced by the patches commands if value is yes
|
---|
539 | #filter PBPATCHCMD = yes
|
---|
540 |
|
---|
541 | # PBTAG is replaced by the tag (\$pb->{'tag'} in code)
|
---|
542 | filter PBTAG = \$pb->{'tag'}
|
---|
543 |
|
---|
544 | # PBREV is replaced by the revision (\$pb->{'rev'} in code)
|
---|
545 | filter PBREV = \$pb->{'rev'}
|
---|
546 |
|
---|
547 | # PBREALPKG is replaced by the package name (\$pb->{'realpkg'} in code)
|
---|
548 | filter PBREALPKG = \$pb->{'realpkg'}
|
---|
549 |
|
---|
550 | # PBPKG is replaced by the package name (\$pb->{'pkg'} in code)
|
---|
551 | filter PBPKG = \$pb->{'pkg'}
|
---|
552 |
|
---|
553 | # PBPROJ is replaced by the project name (\$pb->{'proj'} in code)
|
---|
554 | filter PBPROJ = \$pb->{'proj'}
|
---|
555 |
|
---|
556 | # PBPACKAGER is replaced by the packager name (\$pb->{'packager'} in code)
|
---|
557 | filter PBPACKAGER = \$pb->{'packager'}
|
---|
558 |
|
---|
559 | # PBDESC contains the description of the package
|
---|
560 | #filter PBDESC = "Bla-Bla"
|
---|
561 |
|
---|
562 | # PBSUMMARY contains a short single line description of the package
|
---|
563 | #filter PBSUMMARY = "Bla"
|
---|
564 |
|
---|
565 | # PBURL contains the URL of the Web site of the project
|
---|
566 | #filter PBURL = http://www.$ENV{'PBPROJ'}.org
|
---|
567 |
|
---|
568 | # PBLOG is replaced by the changelog if value is yes
|
---|
569 | # and should be last as when used we need the %pb hash filled
|
---|
570 | #filter PBLOG = yes
|
---|
571 |
|
---|
572 | EOF
|
---|
573 | close(CONF);
|
---|
574 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";
|
---|
575 | print CONF << "EOF";
|
---|
576 | #
|
---|
577 | # \$Id\$
|
---|
578 | #
|
---|
579 | # Filter for rpm build
|
---|
580 | #
|
---|
581 |
|
---|
582 | # PBGRP is replaced by the RPM group of apps
|
---|
583 | #filter PBGRP = Applications/Archiving
|
---|
584 |
|
---|
585 | # PBLIC is replaced by the license of the application
|
---|
586 | #filter PBLIC = GPL
|
---|
587 |
|
---|
588 | # PBDEP is replaced by the list of dependencies
|
---|
589 | #filter PBDEP =
|
---|
590 |
|
---|
591 | # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
|
---|
592 | filter PBSUF = \$pb->{'suf'}
|
---|
593 |
|
---|
594 | # PBOBS is replaced by the Obsolete line
|
---|
595 | #filter PBOBS =
|
---|
596 |
|
---|
597 | EOF
|
---|
598 | close(CONF);
|
---|
599 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf";
|
---|
600 | print CONF << "EOF";
|
---|
601 | #
|
---|
602 | # \$Id\$
|
---|
603 | #
|
---|
604 | # Filter for rpm build
|
---|
605 | #
|
---|
606 |
|
---|
607 | # PBGRP is replaced by the RPM group of apps
|
---|
608 | # Cf: http://fedoraproject.org/wiki/RPMGroups
|
---|
609 | #filter PBGRP = Applications/Archiving
|
---|
610 |
|
---|
611 | # PBLIC is replaced by the license of the application
|
---|
612 | # Cf: http://fedoraproject.org/wiki/Licensing
|
---|
613 | #filter PBLIC = GPLv2+
|
---|
614 |
|
---|
615 | # PBDEP is replaced by the list of dependencies
|
---|
616 | #filter PBDEP =
|
---|
617 |
|
---|
618 | # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
|
---|
619 | filter PBSUF = %{dist}
|
---|
620 |
|
---|
621 | # PBOBS is replaced by the Obsolete line
|
---|
622 | #filter PBOBS =
|
---|
623 |
|
---|
624 | EOF
|
---|
625 | close(CONF);
|
---|
626 | foreach my $i (1..7) {
|
---|
627 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf";
|
---|
628 | print CONF << "EOF";
|
---|
629 | #
|
---|
630 | # \$Id\$
|
---|
631 | #
|
---|
632 | # Filter for old fedora build
|
---|
633 | #
|
---|
634 |
|
---|
635 | # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
|
---|
636 | filter PBSUF = \$pb->{'suf'}
|
---|
637 |
|
---|
638 | EOF
|
---|
639 | close(CONF);
|
---|
640 | }
|
---|
641 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
|
---|
642 | print CONF << "EOF";
|
---|
643 | #
|
---|
644 | # \$Id\$
|
---|
645 | #
|
---|
646 | # Filter for debian build
|
---|
647 | #
|
---|
648 | # PBGRP is replaced by the group of apps
|
---|
649 | filter PBGRP = utils
|
---|
650 |
|
---|
651 | # PBLIC is replaced by the license of the application
|
---|
652 | # Cf: http://www.debian.org/legal/licenses/
|
---|
653 | #filter PBLIC = GPL
|
---|
654 |
|
---|
655 | # PBDEP is replaced by the list of dependencies
|
---|
656 | #filter PBDEP =
|
---|
657 |
|
---|
658 | # PBSUG is replaced by the list of suggestions
|
---|
659 | #filter PBSUG =
|
---|
660 |
|
---|
661 | # PBREC is replaced by the list of recommandations
|
---|
662 | #filter PBREC =
|
---|
663 |
|
---|
664 | EOF
|
---|
665 | close(CONF);
|
---|
666 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf";
|
---|
667 | print CONF << "EOF";
|
---|
668 | #
|
---|
669 | # \$Id\$
|
---|
670 | #
|
---|
671 | # Filter for debian build
|
---|
672 | #
|
---|
673 | # PBDEBSTD is replaced by the Debian standard version
|
---|
674 | filter PBDEBSTD = 3.6.1
|
---|
675 |
|
---|
676 | # PBDEBCOMP is replaced by the Debian Compatibility value
|
---|
677 | filter PBDEBCOMP = 5
|
---|
678 |
|
---|
679 | EOF
|
---|
680 | close(CONF);
|
---|
681 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf";
|
---|
682 | print CONF << "EOF";
|
---|
683 | #
|
---|
684 | # \$Id\$
|
---|
685 | #
|
---|
686 | # Filter for debian build
|
---|
687 | #
|
---|
688 | # PBDEBSTD is replaced by the Debian standard version
|
---|
689 | filter PBDEBSTD = 3.8.0
|
---|
690 |
|
---|
691 | # PBDEBCOMP is replaced by the Debian Compatibility value
|
---|
692 | filter PBDEBCOMP = 7
|
---|
693 |
|
---|
694 | EOF
|
---|
695 | close(CONF);
|
---|
696 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
|
---|
697 | print CONF << "EOF";
|
---|
698 | # Specific group for Mandriva for $ENV{'PBPROJ'}
|
---|
699 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
|
---|
700 | #filter PBGRP = Archiving/Backup
|
---|
701 |
|
---|
702 | # PBLIC is replaced by the license of the application
|
---|
703 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
|
---|
704 | #filter PBLIC = GPL
|
---|
705 |
|
---|
706 | EOF
|
---|
707 | close(CONF);
|
---|
708 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
|
---|
709 | print CONF << "EOF";
|
---|
710 | # Specific group for SuSE for $ENV{'PBPROJ'}
|
---|
711 | # Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
|
---|
712 | #filter PBGRP = Productivity/Archiving/Backup
|
---|
713 |
|
---|
714 | # PBLIC is replaced by the license of the application
|
---|
715 | # Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
|
---|
716 | #filter PBLIC = GPL
|
---|
717 |
|
---|
718 | EOF
|
---|
719 | close(CONF);
|
---|
720 | foreach my $pp (@pkgs) {
|
---|
721 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb";
|
---|
722 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
|
---|
723 | print CONF << "EOF";
|
---|
724 | Source: PBPKG
|
---|
725 | # http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
|
---|
726 | Section: PBGRP
|
---|
727 | Priority: optional
|
---|
728 | Maintainer: PBPACKAGER
|
---|
729 | Build-Depends: debhelper (>= 4.2.20), PBDEP
|
---|
730 | Standards-Version: PBDEBSTD
|
---|
731 | Vcs-Svn: svn://svn.PBPROJ.org/svn/PBVER/PBPKG
|
---|
732 | Vcs-Browser: http://trac.PBPROJ.org/browser/PBVER/PBPKG
|
---|
733 | Homepage: PBURL
|
---|
734 |
|
---|
735 | Package: PBPKG
|
---|
736 | Architecture: amd64 i386 ia64
|
---|
737 | # http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
|
---|
738 | Section: PBGRP
|
---|
739 | Priority: optional
|
---|
740 | Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
|
---|
741 | Recommends: PBREC
|
---|
742 | Suggests: PBSUG
|
---|
743 | Description: PBSUMMARY
|
---|
744 | PBDESC
|
---|
745 | .
|
---|
746 |
|
---|
747 | EOF
|
---|
748 | close(CONF);
|
---|
749 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
|
---|
750 | print CONF << "EOF";
|
---|
751 | This package is debianized by PBPACKAGER
|
---|
752 | `date`
|
---|
753 |
|
---|
754 | The current upstream source was downloaded from
|
---|
755 | PBREPO.
|
---|
756 |
|
---|
757 | Upstream Authors: Put their name here
|
---|
758 |
|
---|
759 | Copyright:
|
---|
760 |
|
---|
761 | This package is free software; you can redistribute it and/or modify
|
---|
762 | it under the terms of the GNU General Public License as published by
|
---|
763 | the Free Software Foundation; version 2 dated June, 1991.
|
---|
764 |
|
---|
765 | This package is distributed in the hope that it will be useful,
|
---|
766 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
767 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
768 | GNU General Public License for more details.
|
---|
769 |
|
---|
770 | You should have received a copy of the GNU General Public License
|
---|
771 | along with this package; if not, write to the Free Software
|
---|
772 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
---|
773 | MA 02110-1301, USA.
|
---|
774 |
|
---|
775 | On Debian systems, the complete text of the GNU General
|
---|
776 | Public License can be found in /usr/share/common-licenses/GPL.
|
---|
777 |
|
---|
778 | EOF
|
---|
779 | close(CONF);
|
---|
780 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
|
---|
781 | print CONF << "EOF";
|
---|
782 | PBLOG
|
---|
783 | EOF
|
---|
784 | close(CONF);
|
---|
785 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
|
---|
786 | print CONF << "EOF";
|
---|
787 | DBDEBCOMP
|
---|
788 | EOF
|
---|
789 | close(CONF);
|
---|
790 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
|
---|
791 | print CONF << "EOF";
|
---|
792 | EOF
|
---|
793 | close(CONF);
|
---|
794 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
|
---|
795 | print CONF << "EOF";
|
---|
796 | INSTALL
|
---|
797 | COPYING
|
---|
798 | AUTHORS
|
---|
799 | NEWS
|
---|
800 | README
|
---|
801 | EOF
|
---|
802 | close(CONF);
|
---|
803 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
|
---|
804 | print CONF << 'EOF';
|
---|
805 | #!/usr/bin/make -f
|
---|
806 | # -*- makefile -*-
|
---|
807 | # Sample debian/rules that uses debhelper.
|
---|
808 | # GNU copyright 1997 to 1999 by Joey Hess.
|
---|
809 | #
|
---|
810 | # $Id$
|
---|
811 | #
|
---|
812 |
|
---|
813 | # Uncomment this to turn on verbose mode.
|
---|
814 | #export DH_VERBOSE=1
|
---|
815 |
|
---|
816 | # Define package name variable for a one-stop change.
|
---|
817 | PACKAGE_NAME = PBPKG
|
---|
818 |
|
---|
819 | # These are used for cross-compiling and for saving the configure script
|
---|
820 | # from having to guess our platform (since we know it already)
|
---|
821 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
---|
822 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
---|
823 |
|
---|
824 | CFLAGS = -Wall -g
|
---|
825 |
|
---|
826 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
---|
827 | CFLAGS += -O0
|
---|
828 | else
|
---|
829 | CFLAGS += -O2
|
---|
830 | endif
|
---|
831 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
---|
832 | INSTALL_PROGRAM += -s
|
---|
833 | endif
|
---|
834 | config.status: configure
|
---|
835 | dh_testdir
|
---|
836 |
|
---|
837 | # Configure the package.
|
---|
838 | CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr
|
---|
839 | --mandir=\$${prefix}/share/man
|
---|
840 |
|
---|
841 | # Build both architecture dependent and independent
|
---|
842 | build: build-arch build-indep
|
---|
843 |
|
---|
844 | # Build architecture dependent
|
---|
845 | build-arch: build-arch-stamp
|
---|
846 |
|
---|
847 | build-arch-stamp: config.status
|
---|
848 | dh_testdir
|
---|
849 |
|
---|
850 | # Compile the package.
|
---|
851 | $(MAKE)
|
---|
852 |
|
---|
853 | touch build-stamp
|
---|
854 |
|
---|
855 | # Build architecture independent
|
---|
856 | build-indep: build-indep-stamp
|
---|
857 |
|
---|
858 | build-indep-stamp: config.status
|
---|
859 | # Nothing to do, the only indep item is the manual which is available as html in original source
|
---|
860 | touch build-indep-stamp
|
---|
861 |
|
---|
862 | # Clean up
|
---|
863 | clean:
|
---|
864 | dh_testdir
|
---|
865 | dh_testroot
|
---|
866 | rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
|
---|
867 | # Clean temporary document directory
|
---|
868 | rm -rf debian/doc-temp
|
---|
869 | # Clean up.
|
---|
870 | -$(MAKE) distclean
|
---|
871 | rm -f config.log
|
---|
872 | ifneq "$(wildcard /usr/share/misc/config.sub)" ""
|
---|
873 | cp -f /usr/share/misc/config.sub config.sub
|
---|
874 | endif
|
---|
875 | ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
---|
876 | cp -f /usr/share/misc/config.guess config.guess
|
---|
877 | endif
|
---|
878 |
|
---|
879 | dh_clean
|
---|
880 |
|
---|
881 | # Install architecture dependent and independent
|
---|
882 | install: install-arch install-indep
|
---|
883 |
|
---|
884 | # Install architecture dependent
|
---|
885 | install-arch: build-arch
|
---|
886 | dh_testdir
|
---|
887 | dh_testroot
|
---|
888 | dh_clean -k -s
|
---|
889 | dh_installdirs -s
|
---|
890 |
|
---|
891 | # Install the package files into build directory:
|
---|
892 | # - start with upstream make install
|
---|
893 | $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/us
|
---|
894 | r/share/man
|
---|
895 | # - copy html manual to temporary location for renaming
|
---|
896 | mkdir -p debian/doc-temp
|
---|
897 | dh_install -s
|
---|
898 |
|
---|
899 | # Install architecture independent
|
---|
900 | install-indep: build-indep
|
---|
901 | dh_testdir
|
---|
902 | dh_testroot
|
---|
903 | dh_clean -k -i
|
---|
904 | dh_installdirs -i
|
---|
905 | dh_install -i
|
---|
906 |
|
---|
907 | # Must not depend on anything. This is to be called by
|
---|
908 | # binary-arch/binary-indep
|
---|
909 | # in another 'make' thread.
|
---|
910 | binary-common:
|
---|
911 | dh_testdir
|
---|
912 | dh_testroot
|
---|
913 | dh_installchangelogs ChangeLog
|
---|
914 | dh_installdocs
|
---|
915 | dh_installman
|
---|
916 | dh_link
|
---|
917 | dh_strip
|
---|
918 | dh_compress
|
---|
919 | dh_fixperms
|
---|
920 | dh_installdeb
|
---|
921 | dh_shlibdeps
|
---|
922 | dh_gencontrol
|
---|
923 | dh_md5sums
|
---|
924 | dh_builddeb
|
---|
925 |
|
---|
926 | # Build architecture independant packages using the common target.
|
---|
927 | binary-indep: build-indep install-indep
|
---|
928 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
|
---|
929 |
|
---|
930 | # Build architecture dependant packages using the common target.
|
---|
931 | binary-arch: build-arch install-arch
|
---|
932 | $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
|
---|
933 |
|
---|
934 | # Build architecture depdendent and independent packages
|
---|
935 | binary: binary-arch binary-indep
|
---|
936 | .PHONY: clean binary
|
---|
937 |
|
---|
938 | EOF
|
---|
939 | close(CONF);
|
---|
940 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm";
|
---|
941 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
|
---|
942 | print CONF << 'EOF';
|
---|
943 | #
|
---|
944 | # $Id$
|
---|
945 | #
|
---|
946 | # Used if virtual name != real name (perl, ...)
|
---|
947 | #%define srcname PBPKG
|
---|
948 |
|
---|
949 | Summary: PBSUMMARY
|
---|
950 | Summary(fr): french bla-bla
|
---|
951 |
|
---|
952 | Name: PBREALPKG
|
---|
953 | Version: PBVER
|
---|
954 | Release: PBTAGPBSUF
|
---|
955 | License: PBLIC
|
---|
956 | Group: PBGRP
|
---|
957 | Url: PBURL
|
---|
958 | Source: PBREPO/PBSRC
|
---|
959 | #PBPATCHSRC
|
---|
960 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
|
---|
961 | #Requires: PBDEP
|
---|
962 |
|
---|
963 | %description
|
---|
964 | PBDESC
|
---|
965 |
|
---|
966 | %description -l fr
|
---|
967 | french desc
|
---|
968 |
|
---|
969 | %prep
|
---|
970 | %setup -q
|
---|
971 | # Used if virtual name != real name (perl, ...)
|
---|
972 | #%setup -q -n %{srcname}-%{version}
|
---|
973 | #PBPATCHCMD
|
---|
974 |
|
---|
975 | %build
|
---|
976 | %configure
|
---|
977 | make %{?_smp_mflags}
|
---|
978 |
|
---|
979 | %install
|
---|
980 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
981 | make DESTDIR=$RPM_BUILD_ROOT install
|
---|
982 |
|
---|
983 | %clean
|
---|
984 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
985 |
|
---|
986 | %files
|
---|
987 | %defattr(-,root,root)
|
---|
988 | %doc ChangeLog
|
---|
989 | %doc INSTALL COPYING README AUTHORS NEWS
|
---|
990 |
|
---|
991 | %changelog
|
---|
992 | PBLOG
|
---|
993 |
|
---|
994 | EOF
|
---|
995 | close(CONF);
|
---|
996 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
|
---|
997 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pkg") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg";
|
---|
998 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo";
|
---|
999 | print CONF << 'EOF';
|
---|
1000 | #
|
---|
1001 | # $Id$
|
---|
1002 | #
|
---|
1003 | PKG="PBREALPKG"
|
---|
1004 | NAME="PBSUMMARY"
|
---|
1005 | VERSION="PBVER"
|
---|
1006 | # or i386
|
---|
1007 | ARCH="all"
|
---|
1008 | CATEGORY="application"
|
---|
1009 | DESC="PBDESC"
|
---|
1010 | EMAIL="PBPACKAGER"
|
---|
1011 | VENDOR="PBPACKAGER"
|
---|
1012 | HOTLINE="PBURL"
|
---|
1013 | EOF
|
---|
1014 | close(CONF);
|
---|
1015 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild";
|
---|
1016 | print CONF << 'EOF';
|
---|
1017 | #
|
---|
1018 | # $Id$
|
---|
1019 | #
|
---|
1020 | #perl Makefile.PL INSTALLDIRS=vendor
|
---|
1021 | ./configure --prefix=/usr
|
---|
1022 | make
|
---|
1023 | make install DESTDIR=\$1
|
---|
1024 | EOF
|
---|
1025 | close(CONF);
|
---|
1026 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/depend") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/depend";
|
---|
1027 | print CONF << 'EOF';
|
---|
1028 | #
|
---|
1029 | # $Id$
|
---|
1030 | #
|
---|
1031 | #P SUNWperl584core Perl 5.8.4 (core)
|
---|
1032 | EOF
|
---|
1033 | close(CONF);
|
---|
1034 |
|
---|
1035 | }
|
---|
1036 | pb_cms_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
|
---|
1037 | pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
|
---|
1038 | } else {
|
---|
1039 | pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
|
---|
1040 | pb_log(0," Please use -r release in order to be able to initialize your environment correctly\n");
|
---|
1041 | die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
1042 | }
|
---|
1043 | }
|
---|
1044 | umask 0022;
|
---|
1045 | return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
|
---|
1046 | } else {
|
---|
1047 | # Setup the variables from what has been stored at the end of cms2build
|
---|
1048 | my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
|
---|
1049 | $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
|
---|
1050 |
|
---|
1051 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
|
---|
1052 | $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
|
---|
1053 |
|
---|
1054 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
|
---|
1055 | $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
|
---|
1056 |
|
---|
1057 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
|
---|
1058 | $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
|
---|
1059 |
|
---|
1060 | return;
|
---|
1061 | }
|
---|
1062 | }
|
---|
1063 |
|
---|
1064 | =back
|
---|
1065 |
|
---|
1066 | =head1 WEB SITES
|
---|
1067 |
|
---|
1068 | The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>.
|
---|
1069 |
|
---|
1070 | =head1 USER MAILING LIST
|
---|
1071 |
|
---|
1072 | None exists for the moment.
|
---|
1073 |
|
---|
1074 | =head1 AUTHORS
|
---|
1075 |
|
---|
1076 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
|
---|
1077 |
|
---|
1078 | =head1 COPYRIGHT
|
---|
1079 |
|
---|
1080 | Project-Builder.org is distributed under the GPL v2.0 license
|
---|
1081 | described in the file C<COPYING> included with the distribution.
|
---|
1082 |
|
---|
1083 | =cut
|
---|
1084 |
|
---|
1085 | 1;
|
---|