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

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