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

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