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

Last change on this file since 1767 was 1767, checked in by Bruno Cornec, 11 years ago
  • generate debian 6 template, latest being debian 7
File size: 40.3 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 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf";
785 print CONF << "EOF";
786#
787# \$Id\$
788#
789# Filter for debian build
790#
791# PBDEBSTD is replaced by the Debian standard version
792filter PBDEBSTD = 3.8.0
793
794# PBDEBCOMP is replaced by the Debian Compatibility value
795filter PBDEBCOMP = 7
796
797EOF
798 close(CONF);
799 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf";
800 print CONF << "EOF";
801#
802# \$Id\$
803#
804# Filter for debian build
805#
806# PBDEBSTD is replaced by the Debian standard version
807filter PBDEBSTD = 3.9.4
808
809# PBDEBCOMP is replaced by the Debian Compatibility value
810filter PBDEBCOMP = 9
811
812EOF
813 close(CONF);
814 # 6?
815 foreach my $ubv ("debian.pbf") {
816 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
817 print CONF << "EOF";
818#
819# \$Id\$
820#
821# Filter for debian build
822#
823# PBDEBSTD is replaced by the Debian standard version
824filter PBDEBSTD = 3.8.0
825
826# PBDEBCOMP is replaced by the Debian Compatibility value
827filter PBDEBCOMP = 7
828
829EOF
830 close(CONF);
831 }
832 foreach my $ubv ("ubuntu-6.06.pbf","ubuntu-7.04.pbf","ubuntu-7.10.pbf") {
833 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
834 print CONF << "EOF";
835#
836# \$Id\$
837#
838# Filter for ubuntu build
839#
840# PBDEBSTD is replaced by the Debian standard version
841filter PBDEBSTD = 3.6.2
842
843# PBDEBCOMP is replaced by the Debian Compatibility value
844filter PBDEBCOMP = 4
845
846EOF
847 close(CONF);
848 }
849 foreach my $ubv ("ubuntu-8.04.pbf","ubuntu-8.10.pbf") {
850 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
851 print CONF << "EOF";
852#
853# \$Id\$
854#
855# Filter for ubuntu build
856#
857# PBDEBSTD is replaced by the Debian standard version
858filter PBDEBSTD = 3.7.3
859
860# PBDEBCOMP is replaced by the Debian Compatibility value
861filter PBDEBCOMP = 4
862
863EOF
864 close(CONF);
865 }
866 foreach my $ubv ("ubuntu-9.04.pbf") {
867 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
868 print CONF << "EOF";
869#
870# \$Id\$
871#
872# Filter for ubuntu build
873#
874# PBDEBSTD is replaced by the Debian standard version
875filter PBDEBSTD = 3.8.0
876
877# PBDEBCOMP is replaced by the Debian Compatibility value
878filter PBDEBCOMP = 4
879
880EOF
881 close(CONF);
882 }
883 # 9.10, 10.04, 10.10
884 foreach my $ubv ("ubuntu.pbf") {
885 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
886 print CONF << "EOF";
887#
888# \$Id\$
889#
890# Filter for ubuntu build
891#
892# PBDEBSTD is replaced by the Debian standard version
893filter PBDEBSTD = 3.8.3
894
895# PBDEBCOMP is replaced by the Debian Compatibility value
896filter PBDEBCOMP = 7
897
898EOF
899 close(CONF);
900 }
901 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
902 print CONF << "EOF";
903# Specific group for Mandriva for $ENV{'PBPROJ'}
904# Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
905#filter PBGRP = Archiving/Backup
906
907# PBLIC is replaced by the license of the application
908# Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
909#filter PBLIC = GPL
910
911EOF
912 close(CONF);
913 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
914 print CONF << "EOF";
915# Specific group for SuSE for $ENV{'PBPROJ'}
916# Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
917#filter PBGRP = Productivity/Archiving/Backup
918
919# PBLIC is replaced by the license of the application
920# Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
921#filter PBLIC = GPL
922
923EOF
924 close(CONF);
925 foreach my $pp (@pkgs) {
926 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb");
927 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
928 print CONF << "EOF";
929Source: PBPKG
930# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
931Section: PBGRP
932Priority: optional
933Maintainer: PBPACKAGER
934Build-Depends: debhelper (>= 4.2.20), PBBDEP
935Standards-Version: PBDEBSTD
936Vcs-Svn: svn://svn.PBPROJ.org/svn/PBVER/PBPKG
937Vcs-Browser: http://trac.PBPROJ.org/browser/PBVER/PBPKG
938Homepage: PBURL
939
940Package: PBPKG
941Architecture: amd64 i386 ia64
942# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
943Section: PBGRP
944Priority: optional
945Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
946Recommends: PBREC
947Suggests: PBSUG
948Description: PBSUMMARY
949 PBDESC
950 .
951
952EOF
953 close(CONF);
954 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
955 print CONF << "EOF";
956This package is debianized by PBPACKAGER
957`date`
958
959The current upstream source was downloaded from
960PBREPO.
961
962Upstream Authors: Put their name here
963
964Copyright:
965
966 This package is free software; you can redistribute it and/or modify
967 it under the terms of the GNU General Public License as published by
968 the Free Software Foundation; version 2 dated June, 1991.
969
970 This package is distributed in the hope that it will be useful,
971 but WITHOUT ANY WARRANTY; without even the implied warranty of
972 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
973 GNU General Public License for more details.
974
975 You should have received a copy of the GNU General Public License
976 along with this package; if not, write to the Free Software
977 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
978 MA 02110-1301, USA.
979
980On Debian systems, the complete text of the GNU General
981Public License can be found in /usr/share/common-licenses/GPL.
982
983EOF
984 close(CONF);
985 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
986 print CONF << "EOF";
987PBLOG
988EOF
989 close(CONF);
990 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
991 print CONF << "EOF";
992PBDEBCOMP
993EOF
994 close(CONF);
995 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
996 print CONF << "EOF";
997EOF
998 close(CONF);
999 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
1000 print CONF << "EOF";
1001INSTALL
1002COPYING
1003AUTHORS
1004NEWS
1005README
1006EOF
1007 close(CONF);
1008 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
1009 print CONF << 'EOF';
1010#!/usr/bin/make -f
1011# -*- makefile -*-
1012# Sample debian/rules that uses debhelper.
1013# GNU copyright 1997 to 1999 by Joey Hess.
1014#
1015# $Id$
1016#
1017
1018# Uncomment this to turn on verbose mode.
1019#export DH_VERBOSE=1
1020
1021# Define package name variable for a one-stop change.
1022PACKAGE_NAME = PBPKG
1023
1024# These are used for cross-compiling and for saving the configure script
1025# from having to guess our platform (since we know it already)
1026DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
1027DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
1028
1029CFLAGS = -Wall -g
1030
1031ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
1032 CFLAGS += -O0
1033else
1034 CFLAGS += -O2
1035endif
1036ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
1037 INSTALL_PROGRAM += -s
1038endif
1039
1040config.status: configure
1041 dh_testdir
1042
1043 # Configure the package.
1044 CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man
1045
1046# Build both architecture dependent and independent
1047build: build-arch build-indep
1048
1049# Build architecture dependent
1050build-arch: build-arch-stamp
1051
1052build-arch-stamp: config.status
1053 dh_testdir
1054
1055 # Compile the package.
1056 $(MAKE)
1057
1058 touch build-stamp
1059
1060# Build architecture independent
1061build-indep: build-indep-stamp
1062
1063build-indep-stamp: config.status
1064 # Nothing to do, the only indep item is the manual which is available as html in original source
1065 touch build-indep-stamp
1066
1067# Clean up
1068clean:
1069 dh_testdir
1070 dh_testroot
1071 rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
1072 # Clean temporary document directory
1073 rm -rf debian/doc-temp
1074 # Clean up.
1075 -$(MAKE) distclean
1076 rm -f config.log
1077ifneq "$(wildcard /usr/share/misc/config.sub)" ""
1078 cp -f /usr/share/misc/config.sub config.sub
1079endif
1080ifneq "$(wildcard /usr/share/misc/config.guess)" ""
1081 cp -f /usr/share/misc/config.guess config.guess
1082endif
1083
1084 dh_clean
1085
1086# Install architecture dependent and independent
1087install: install-arch install-indep
1088
1089# Install architecture dependent
1090install-arch: build-arch
1091 dh_testdir
1092 dh_testroot
1093 dh_clean -k -s
1094 dh_installdirs -s
1095
1096 # Install the package files into build directory:
1097 # - start with upstream make install
1098 $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man
1099 # - copy html manual to temporary location for renaming
1100 mkdir -p debian/doc-temp
1101 dh_install -s
1102
1103# Install architecture independent
1104install-indep: build-indep
1105 dh_testdir
1106 dh_testroot
1107 dh_clean -k -i
1108 dh_installdirs -i
1109 dh_install -i
1110
1111# Must not depend on anything. This is to be called by
1112# binary-arch/binary-indep
1113# in another 'make' thread.
1114binary-common:
1115 dh_testdir
1116 dh_testroot
1117 dh_installchangelogs ChangeLog
1118 dh_installdocs
1119 dh_installman
1120 dh_link
1121 dh_strip
1122 dh_compress
1123 dh_fixperms
1124 dh_installdeb
1125 dh_shlibdeps
1126 dh_gencontrol
1127 dh_md5sums
1128 dh_builddeb
1129
1130# Build architecture independant packages using the common target.
1131binary-indep: build-indep install-indep
1132 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
1133
1134# Build architecture dependant packages using the common target.
1135binary-arch: build-arch install-arch
1136 $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
1137
1138# Build architecture depdendent and independent packages
1139binary: binary-arch binary-indep
1140.PHONY: clean binary
1141
1142EOF
1143 close(CONF);
1144 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm");
1145 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
1146 print CONF << 'EOF';
1147#
1148# $Id$
1149#
1150# Used if virtual name != real name (perl, ...) - replace hash by percent in the below line
1151#define srcname PBPKG
1152
1153Summary: PBSUMMARY
1154Summary(fr): french bla-bla
1155
1156Name: PBREALPKG
1157Version: PBVER
1158Release: PBTAGPBSUF
1159License: PBLIC
1160Group: PBGRP
1161Url: PBURL
1162Source: PBREPO/PBSRC
1163#PBPATCHSRC
1164BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
1165#Requires: PBDEP
1166#BuildRequires: PBBDEP
1167
1168%description
1169PBDESC
1170
1171%description -l fr
1172french desc
1173
1174%prep
1175%setup -q
1176# Used if virtual name != real name (perl, ...)
1177#%setup -q -n %{srcname}-%{version}
1178#PBPATCHCMD
1179
1180%build
1181%configure
1182make %{?_smp_mflags}
1183
1184%install
1185%{__rm} -rf $RPM_BUILD_ROOT
1186make DESTDIR=$RPM_BUILD_ROOT install
1187
1188%clean
1189%{__rm} -rf $RPM_BUILD_ROOT
1190
1191%files
1192%defattr(-,root,root)
1193%doc ChangeLog
1194%doc INSTALL COPYING README AUTHORS NEWS
1195
1196%changelog
1197PBLOG
1198
1199EOF
1200 close(CONF);
1201 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf";
1202 print CONF << "EOF";
1203#
1204# \$Id\$
1205#
1206# Filter for pkg build
1207#
1208# Solaris package name (VENDOR : 4 letters in uppercase, SOFT : 8 letters in lowercase)
1209filter PBSOLPKG = SUNWsoftware
1210
1211EOF
1212 close(CONF);
1213 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter");
1214 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pkg");
1215 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo";
1216 print CONF << 'EOF';
1217#
1218# $Id$
1219#
1220PKG="PBSOLPKG"
1221NAME="PBREALPKG"
1222VERSION="PBVER"
1223# all or i386
1224ARCH="all"
1225CATEGORY="application"
1226DESC="PBSUMMARY"
1227EMAIL="PBPACKAGER"
1228VENDOR="PBPACKAGER"
1229HOTLINE="PBURL"
1230EOF
1231 close(CONF);
1232 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild";
1233 print CONF << 'EOF';
1234#
1235# $Id$
1236#
1237#perl Makefile.PL INSTALLDIRS=vendor
1238./configure --prefix=/usr
1239make
1240make install DESTDIR=\$1
1241EOF
1242 close(CONF);
1243 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/depend") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/depend";
1244 print CONF << 'EOF';
1245#
1246# $Id$
1247#
1248#P SUNWperl584core Perl 5.8.4 (core)
1249EOF
1250 close(CONF);
1251
1252 }
1253 pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
1254 pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
1255 } else {
1256 pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
1257 pb_log(0," Please use -r release in order to be able to initialize your environment correctly\n");
1258 die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
1259 }
1260 }
1261 umask 0022;
1262 return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
1263} elsif ($action =~ /^(newv|setupv)/) {
1264 # No PBDESTDIR yet so doing nothing
1265 return;
1266} else {
1267 # Setup the variables from what has been stored at the end of cms2build
1268 my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
1269 $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
1270
1271 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
1272 $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
1273
1274 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
1275 $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
1276
1277 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
1278 $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
1279
1280 return;
1281}
1282}
1283
1284=head1 WEB SITES
1285
1286The 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/>.
1287
1288=head1 USER MAILING LIST
1289
1290None exists for the moment.
1291
1292=head1 AUTHORS
1293
1294The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
1295
1296=head1 COPYRIGHT
1297
1298Project-Builder.org is distributed under the GPL v2.0 license
1299described in the file C<COPYING> included with the distribution.
1300
1301=cut
1302
13031;
Note: See TracBrowser for help on using the repository browser.