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

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