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

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