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

Revision 1348, 36.5 KB checked in by bruno, 19 months ago (diff)

r4374@localhost: bruno | 2011-10-25 12:10:59 +0200

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