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

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