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

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