source: ProjectBuilder/devel/pb-modules/lib/ProjectBuilder/Env.pm@ 1731

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