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

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