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

Last change on this file since 1495 was 1495, checked in by bruno, 7 years ago

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

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

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

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