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

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

r4765@localhost: bruno | 2012-05-10 17:08:00 +0200

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