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

Last change on this file since 1556 was 1556, checked in by Bruno Cornec, 12 years ago

pb: Use new pbgpgcheck option to control whether we enable gpgcheck in the repo script. Problem is that signing failure is tolerated, so the rpms can be unsigned, but gpgcheck is on by default. Preserve those semantics by default, but allow for control. (Eric Anderson)

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