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

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

r4735@localhost: bruno | 2012-05-07 03:46:39 +0200

  • Conf.pm largely rewritten to cache all conf files into a local $h hash in which conf files are added in reverse order.

The new pb_conf_hash stores a configuration file into a hash structure passed in parameter.
pb_conf_add now triggers the computation of the hash structure with pb_conf_cache and adds it to the main $h hash.
pb_conf_read_if now just uses the content in the $h hash to return its table.
pb_conf_get_in_hash_if function added to do the same as pb_conf_read_if on the cached $h hash instead of a configuration file.
pb_conf_get_if now uses pb_conf_get_in_hash_if and the $h hash without re-reading conf files
pb_conf_add_last_in_hash adds the content of a hash behind the content of the $h main hash (was done in pb_conf_get before)
pb_env_init now calls pb_conf_init to have PBPROJ defined when needed.
pb seems to work with this new version (builds itself)

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