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

Last change on this file since 2114 was 2114, checked in by Bruno Cornec, 8 years ago
  • Improve exmaple conf file generation for 0.14.x versions
File size: 40.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# Copyright B. Cornec 2007-2016
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;
142my $pbinit=shift;
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 ... bpbuild pbdelivery 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'}/pbdelivery";
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'}/pbbuild";
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 my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbconf{$ENV{'PBPROJ'}});
312
313 # Check where is our PBROOTDIR (release tag name can't be guessed the first time)
314 #
315 if (not defined $ENV{'PBROOTDIR'}) {
316 if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
317 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}";
318 pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
319 pb_log(1," Please use -r release if you want to use another release\n");
320 die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
321 } else {
322 my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
323 # That's always the environment variable that will be used
324 die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
325 $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};
326 }
327 } else {
328 # transform in full path if relative
329 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
330 # If git, then versions are in branch not in dirs, except for git+svn
331 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}" if (($scheme =~ /^git/) && ($scheme =~ /^svn/));
332 pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
333 die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
334 }
335 pb_log(1,"PBROOTDIR=$ENV{'PBROOTDIR'}\n");
336
337 # Adds that conf file to the list to consider
338 pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb");
339
340 return if ($action =~ /^(newver|getconf|setupve)$/);
341
342 my %version = ();
343 my %defpkgdir = ();
344 my %extpkgdir = ();
345 my %filteredfiles = ();
346 my %supfiles = ();
347
348 if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
349
350 # List of pkg to build by default (mandatory)
351 # TODO: projtag could be with a 1 default value
352 my ($defpkgdir,$pbpackager, $pkgv, $pkgt) = pb_conf_get("defpkgdir","pbpackager","projver","projtag");
353 # List of additional pkg to build when all is called (optional)
354 # Valid version names (optional)
355 # List of files to filter (optional)
356 # Project version and tag (optional)
357 my ($extpkgdir, $version, $filteredfiles, $supfiles) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles");
358 pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
359 pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
360 pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
361 pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
362 pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
363 # Global
364 %defpkgdir = %$defpkgdir;
365 %extpkgdir = %$extpkgdir if (defined $extpkgdir);
366 %version = %$version if (defined $version);
367 %filteredfiles = %$filteredfiles if (defined $filteredfiles);
368 %supfiles = %$supfiles if (defined $supfiles);
369 #
370 # Get global Version/Tag
371 #
372 if (not defined $ENV{'PBPROJVER'}) {
373 if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
374 $ENV{'PBPROJVER'}=$pkgv->{$ENV{'PBPROJ'}};
375 } else {
376 die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
377 }
378 }
379 die "Invalid version name $ENV{'PBPROJVER'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBPROJVER'} !~ /[0-9.]+/) && (defined $version) && ($ENV{'PBPROJVER'} =~ /$version{$ENV{'PBPROJ'}}/));
380
381 if (not defined $ENV{'PBPROJTAG'}) {
382 if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
383 $ENV{'PBPROJTAG'}=$pkgt->{$ENV{'PBPROJ'}};
384 } else {
385 die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
386 }
387 }
388 die "Invalid tag name $ENV{'PBPROJTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBPROJTAG'} !~ /[0-9.]+/);
389
390
391 if (not defined $ENV{'PBPACKAGER'}) {
392 if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
393 $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
394 } else {
395 die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
396 }
397 }
398 } else {
399 if (defined $pbinit) {
400 my @pkgs = @ARGV;
401 @pkgs = ("pkg1") if (not @pkgs);
402
403 open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
404 print CONF << "EOF";
405#
406# Project Builder configuration file
407# For project $ENV{'PBPROJ'}
408#
409# \$Id\$
410#
411
412#
413# What is the project URL
414#
415#pburl $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
416#pburl $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
417#pburl $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
418#pburl $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
419#pburl $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
420#pburl $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz
421#pburl $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel
422
423# Repository
424#pbrepo $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org
425#pbml $ENV{'PBPROJ'} = $ENV{'PBPROJ'}-announce\@lists.$ENV{'PBPROJ'}.org
426#pbsmtp $ENV{'PBPROJ'} = localhost
427#pbgpgcheck $ENV{'PBPROJ'} = 1
428# For distro supporting it, which area is used
429#projcomponent $ENV{'PBPROJ'} = main
430
431# Check whether project is well formed
432# when downloading from ftp/http/...
433# (containing already a directory with the project-version name)
434#pbwf $ENV{'PBPROJ'} = 1
435
436# Do we check GPG keys
437#pbgpgcheck $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'} = 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
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
574filter PBSRC = src/%{srcname}-%{version}\$pb->{'extdir'}.tar.gz
575
576# PBVER is replaced by the version (\$pb->{'ver'} in code)
577filter PBVER = \$pb->{'ver'}
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# PBBDEP is replaced by the list of build dependencies
651#filter PBBDEP =
652
653# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
654filter PBSUF = \$pb->{'suf'}
655
656# PBOBS is replaced by the Obsolete line
657#filter PBOBS =
658
659# transform a variable from the key on the right to the key on the left using the perl expression
660# after the input key name. Useful for taking multi-line documentation and removing trailing spaces
661# or leading spaces.
662#transform PBDESC = PBDESC_raw s/\\s+\\n/\\n/go;
663
664EOF
665 close(CONF);
666 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf";
667 print CONF << "EOF";
668#
669# \$Id\$
670#
671# Filter for rpm build
672#
673
674# PBGRP is replaced by the RPM group of apps
675# Cf: http://fedoraproject.org/wiki/RPMGroups
676#filter PBGRP = Applications/Archiving
677
678# PBLIC is replaced by the license of the application
679# Cf: http://fedoraproject.org/wiki/Licensing
680#filter PBLIC = GPLv2+
681
682# PBDEP is replaced by the list of dependencies
683#filter PBDEP =
684
685# PBBDEP is replaced by the list of build dependencies
686#filter PBBDEP =
687
688# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
689filter PBSUF = %{dist}
690
691# PBOBS is replaced by the Obsolete line
692#filter PBOBS =
693
694EOF
695 close(CONF);
696 foreach my $i (1..7) {
697 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf";
698 print CONF << "EOF";
699#
700# \$Id\$
701#
702# Filter for old fedora build
703#
704
705# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
706filter PBSUF = \$pb->{'suf'}
707
708EOF
709 close(CONF);
710 }
711 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
712 print CONF << "EOF";
713#
714# \$Id\$
715#
716# Filter for debian build
717#
718# PBGRP is replaced by the group of apps
719filter PBGRP = utils
720
721# PBLIC is replaced by the license of the application
722# Cf: http://www.debian.org/legal/licenses/
723#filter PBLIC = GPL
724
725# PBDEP is replaced by the list of dependencies
726#filter PBDEP =
727
728# PBBDEP is replaced by the list of build dependencies
729#filter PBBDEP =
730
731# PBSUG is replaced by the list of suggestions
732#filter PBSUG =
733
734# PBREC is replaced by the list of recommandations
735#filter PBREC =
736
737EOF
738 close(CONF);
739 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.pbf";
740 print CONF << "EOF";
741#
742# \$Id\$
743#
744# Filter for debian build
745#
746# PBDEBSTD is replaced by the Debian standard version
747filter PBDEBSTD = 3.6.1
748
749# PBDEBCOMP is replaced by the Debian Compatibility value
750filter PBDEBCOMP = 4
751
752EOF
753 close(CONF);
754 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf";
755 print CONF << "EOF";
756#
757# \$Id\$
758#
759# Filter for debian build
760#
761# PBDEBSTD is replaced by the Debian standard version
762filter PBDEBSTD = 3.6.1
763
764# PBDEBCOMP is replaced by the Debian Compatibility value
765filter PBDEBCOMP = 5
766
767EOF
768 close(CONF);
769 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf";
770 print CONF << "EOF";
771#
772# \$Id\$
773#
774# Filter for debian build
775#
776# PBDEBSTD is replaced by the Debian standard version
777filter PBDEBSTD = 3.8.0
778
779# PBDEBCOMP is replaced by the Debian Compatibility value
780filter PBDEBCOMP = 7
781
782EOF
783 close(CONF);
784 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf";
785 print CONF << "EOF";
786#
787# \$Id\$
788#
789# Filter for debian build
790#
791# PBDEBSTD is replaced by the Debian standard version
792filter PBDEBSTD = 3.8.0
793
794# PBDEBCOMP is replaced by the Debian Compatibility value
795filter PBDEBCOMP = 7
796
797EOF
798 close(CONF);
799 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf";
800 print CONF << "EOF";
801#
802# \$Id\$
803#
804# Filter for debian build
805#
806# PBDEBSTD is replaced by the Debian standard version
807filter PBDEBSTD = 3.9.4
808
809# PBDEBCOMP is replaced by the Debian Compatibility value
810filter PBDEBCOMP = 9
811
812EOF
813 close(CONF);
814 # 6?
815 foreach my $ubv ("debian.pbf") {
816 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
817 print CONF << "EOF";
818#
819# \$Id\$
820#
821# Filter for debian build
822#
823# PBDEBSTD is replaced by the Debian standard version
824filter PBDEBSTD = 3.8.0
825
826# PBDEBCOMP is replaced by the Debian Compatibility value
827filter PBDEBCOMP = 7
828
829EOF
830 close(CONF);
831 }
832 foreach my $ubv ("ubuntu-6.06.pbf","ubuntu-7.04.pbf","ubuntu-7.10.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.6.2
842
843# PBDEBCOMP is replaced by the Debian Compatibility value
844filter PBDEBCOMP = 4
845
846EOF
847 close(CONF);
848 }
849 foreach my $ubv ("ubuntu-8.04.pbf","ubuntu-8.10.pbf") {
850 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
851 print CONF << "EOF";
852#
853# \$Id\$
854#
855# Filter for ubuntu build
856#
857# PBDEBSTD is replaced by the Debian standard version
858filter PBDEBSTD = 3.7.3
859
860# PBDEBCOMP is replaced by the Debian Compatibility value
861filter PBDEBCOMP = 4
862
863EOF
864 close(CONF);
865 }
866 foreach my $ubv ("ubuntu-9.04.pbf") {
867 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
868 print CONF << "EOF";
869#
870# \$Id\$
871#
872# Filter for ubuntu build
873#
874# PBDEBSTD is replaced by the Debian standard version
875filter PBDEBSTD = 3.8.0
876
877# PBDEBCOMP is replaced by the Debian Compatibility value
878filter PBDEBCOMP = 4
879
880EOF
881 close(CONF);
882 }
883 # 9.10, 10.04, 10.10
884 foreach my $ubv ("ubuntu.pbf") {
885 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
886 print CONF << "EOF";
887#
888# \$Id\$
889#
890# Filter for ubuntu build
891#
892# PBDEBSTD is replaced by the Debian standard version
893filter PBDEBSTD = 3.8.3
894
895# PBDEBCOMP is replaced by the Debian Compatibility value
896filter PBDEBCOMP = 7
897
898EOF
899 close(CONF);
900 }
901 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
902 print CONF << "EOF";
903# Specific group for Mandriva for $ENV{'PBPROJ'}
904# Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
905#filter PBGRP = Archiving/Backup
906
907# PBLIC is replaced by the license of the application
908# Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
909#filter PBLIC = GPL
910
911EOF
912 close(CONF);
913 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
914 print CONF << "EOF";
915# Specific group for SuSE for $ENV{'PBPROJ'}
916# Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
917#filter PBGRP = Productivity/Archiving/Backup
918
919# PBLIC is replaced by the license of the application
920# Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
921#filter PBLIC = GPL
922
923EOF
924 close(CONF);
925 foreach my $pp (@pkgs) {
926 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb");
927 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
928 print CONF << "EOF";
929Source: PBPKG
930# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
931Section: PBGRP
932Priority: optional
933Maintainer: PBPACKAGER
934Build-Depends: debhelper (>= 4.2.20), PBBDEP
935Standards-Version: PBDEBSTD
936Vcs-Svn: svn://svn.PBPROJ.org/svn/PBVER/PBPKG
937Vcs-Browser: http://trac.PBPROJ.org/browser/PBVER/PBPKG
938Homepage: PBURL
939
940Package: PBPKG
941Architecture: amd64 i386 ia64
942# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
943Section: PBGRP
944Priority: optional
945Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
946Recommends: PBREC
947Suggests: PBSUG
948Description: PBSUMMARY
949 PBDESC
950 .
951
952EOF
953 close(CONF);
954 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
955 print CONF << "EOF";
956This package is debianized by PBPACKAGER
957`date`
958
959The current upstream source was downloaded from
960PBREPO.
961
962Upstream Authors: Put their name here
963
964Copyright:
965
966 This package is free software; you can redistribute it and/or modify
967 it under the terms of the GNU General Public License as published by
968 the Free Software Foundation; version 2 dated June, 1991.
969
970 This package is distributed in the hope that it will be useful,
971 but WITHOUT ANY WARRANTY; without even the implied warranty of
972 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
973 GNU General Public License for more details.
974
975 You should have received a copy of the GNU General Public License
976 along with this package; if not, write to the Free Software
977 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
978 MA 02110-1301, USA.
979
980On Debian systems, the complete text of the GNU General
981Public License can be found in /usr/share/common-licenses/GPL.
982
983EOF
984 close(CONF);
985 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
986 print CONF << "EOF";
987PBLOG
988EOF
989 close(CONF);
990 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
991 print CONF << "EOF";
992PBDEBCOMP
993EOF
994 close(CONF);
995 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
996 print CONF << "EOF";
997EOF
998 close(CONF);
999 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
1000 print CONF << "EOF";
1001INSTALL
1002COPYING
1003AUTHORS
1004NEWS
1005README
1006EOF
1007 close(CONF);
1008 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
1009 print CONF << 'EOF';
1010#!/usr/bin/make -f
1011# -*- makefile -*-
1012# Sample debian/rules that uses debhelper.
1013# GNU copyright 1997 to 1999 by Joey Hess.
1014#
1015# $Id$
1016#
1017
1018# Uncomment this to turn on verbose mode.
1019#export DH_VERBOSE=1
1020
1021# Define package name variable for a one-stop change.
1022PACKAGE_NAME = PBPKG
1023
1024# These are used for cross-compiling and for saving the configure script
1025# from having to guess our platform (since we know it already)
1026DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
1027DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
1028
1029CFLAGS = -Wall -g
1030
1031ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
1032 CFLAGS += -O0
1033else
1034 CFLAGS += -O2
1035endif
1036ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
1037 INSTALL_PROGRAM += -s
1038endif
1039
1040config.status: configure
1041 dh_testdir
1042
1043 # Configure the package.
1044 CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man
1045
1046# Build both architecture dependent and independent
1047build: build-arch build-indep
1048
1049# Build architecture dependent
1050build-arch: build-arch-stamp
1051
1052build-arch-stamp: config.status
1053 dh_testdir
1054
1055 # Compile the package.
1056 $(MAKE)
1057
1058 touch build-stamp
1059
1060# Build architecture independent
1061build-indep: build-indep-stamp
1062
1063build-indep-stamp: config.status
1064 # Nothing to do, the only indep item is the manual which is available as html in original source
1065 touch build-indep-stamp
1066
1067# Clean up
1068clean:
1069 dh_testdir
1070 dh_testroot
1071 rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
1072 # Clean temporary document directory
1073 rm -rf debian/doc-temp
1074 # Clean up.
1075 -$(MAKE) distclean
1076 rm -f config.log
1077ifneq "$(wildcard /usr/share/misc/config.sub)" ""
1078 cp -f /usr/share/misc/config.sub config.sub
1079endif
1080ifneq "$(wildcard /usr/share/misc/config.guess)" ""
1081 cp -f /usr/share/misc/config.guess config.guess
1082endif
1083
1084 dh_clean
1085
1086# Install architecture dependent and independent
1087install: install-arch install-indep
1088
1089# Install architecture dependent
1090install-arch: build-arch
1091 dh_testdir
1092 dh_testroot
1093 dh_clean -k -s
1094 dh_installdirs -s
1095
1096 # Install the package files into build directory:
1097 # - start with upstream make install
1098 $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man
1099 # - copy html manual to temporary location for renaming
1100 mkdir -p debian/doc-temp
1101 dh_install -s
1102
1103# Install architecture independent
1104install-indep: build-indep
1105 dh_testdir
1106 dh_testroot
1107 dh_clean -k -i
1108 dh_installdirs -i
1109 dh_install -i
1110
1111# Must not depend on anything. This is to be called by
1112# binary-arch/binary-indep
1113# in another 'make' thread.
1114binary-common:
1115 dh_testdir
1116 dh_testroot
1117 dh_installchangelogs ChangeLog
1118 dh_installdocs
1119 dh_installman
1120 dh_link
1121 dh_strip
1122 dh_compress
1123 dh_fixperms
1124 dh_installdeb
1125 dh_shlibdeps
1126 dh_gencontrol
1127 dh_md5sums
1128 dh_builddeb
1129
1130# Build architecture independant packages using the common target.
1131binary-indep: build-indep install-indep
1132 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
1133
1134# Build architecture dependant packages using the common target.
1135binary-arch: build-arch install-arch
1136 $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
1137
1138# Build architecture depdendent and independent packages
1139binary: binary-arch binary-indep
1140.PHONY: clean binary
1141
1142EOF
1143 close(CONF);
1144 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm");
1145 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
1146 print CONF << 'EOF';
1147#
1148# $Id$
1149#
1150# Used if virtual name != real name (perl, ...) - replace PBPKG by PBREALPKG in the line below
1151%define srcname PBPKG
1152
1153Summary: PBSUMMARY
1154Summary(fr): french bla-bla
1155
1156Name: PBREALPKG
1157Version: PBVER
1158Release: PBTAGPBSUF
1159License: PBLIC
1160Group: PBGRP
1161Url: PBURL
1162Source: PBREPO/PBSRC
1163#PBPATCHSRC
1164BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
1165#Requires: PBDEP
1166#BuildRequires: PBBDEP
1167
1168%description
1169PBDESC
1170
1171%description -l fr
1172french desc
1173
1174%prep
1175%setup -q %{name}-%{version}PBEXTDIR
1176# Used if virtual name != real name (perl, ...)
1177#%setup -q -n %{srcname}-%{version}PBEXTDIR
1178#PBPATCHCMD
1179
1180%build
1181%configure
1182make %{?_smp_mflags}
1183
1184%install
1185%{__rm} -rf $RPM_BUILD_ROOT
1186make DESTDIR=$RPM_BUILD_ROOT install
1187
1188%clean
1189%{__rm} -rf $RPM_BUILD_ROOT
1190
1191%files
1192%defattr(-,root,root)
1193%doc ChangeLog
1194%doc INSTALL COPYING README AUTHORS NEWS
1195
1196%changelog
1197PBLOG
1198
1199EOF
1200 close(CONF);
1201 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf";
1202 print CONF << "EOF";
1203#
1204# \$Id\$
1205#
1206# Filter for pkg build
1207#
1208# Solaris package name (VENDOR : 4 letters in uppercase, SOFT : 8 letters in lowercase)
1209filter PBSOLPKG = SUNWsoftware
1210
1211EOF
1212 close(CONF);
1213 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter");
1214 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pkg");
1215 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo";
1216 print CONF << 'EOF';
1217#
1218# $Id$
1219#
1220PKG="PBSOLPKG"
1221NAME="PBREALPKG"
1222VERSION="PBVER"
1223# all or i386
1224ARCH="all"
1225CATEGORY="application"
1226DESC="PBSUMMARY"
1227EMAIL="PBPACKAGER"
1228VENDOR="PBPACKAGER"
1229HOTLINE="PBURL"
1230EOF
1231 close(CONF);
1232 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild";
1233 print CONF << 'EOF';
1234#
1235# $Id$
1236#
1237#perl Makefile.PL INSTALLDIRS=vendor
1238./configure --prefix=/usr
1239make
1240make install DESTDIR=\$1
1241EOF
1242 close(CONF);
1243 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/depend") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/depend";
1244 print CONF << 'EOF';
1245#
1246# $Id$
1247#
1248#P SUNWperl584core Perl 5.8.4 (core)
1249EOF
1250 close(CONF);
1251
1252 }
1253 pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
1254 my $msg = "updated to ".basename("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
1255 $msg = "Project $ENV{'PBPROJ'} creation" if (defined $pbinit);
1256 pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$msg);
1257 } else {
1258 pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
1259 pb_log(0," Please use -r release in order to be able to initialize your environment correctly\n");
1260 die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
1261 }
1262 }
1263 umask 0022;
1264 return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
1265} elsif ($action =~ /^(newv|setupv)/) {
1266 # No PBDESTDIR yet so doing nothing
1267 return;
1268} else {
1269 # Setup the variables from what has been stored at the end of cms2build
1270 my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
1271 $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
1272
1273 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
1274 $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
1275
1276 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
1277 $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
1278
1279 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
1280 $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
1281
1282 return;
1283}
1284}
1285
1286=head1 WEB SITES
1287
1288The 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/>.
1289
1290=head1 USER MAILING LIST
1291
1292None exists for the moment.
1293
1294=head1 AUTHORS
1295
1296The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
1297
1298=head1 COPYRIGHT
1299
1300Project-Builder.org is distributed under the GPL v2.0 license
1301described in the file C<COPYING> included with the distribution.
1302
1303=cut
1304
13051;
Note: See TracBrowser for help on using the repository browser.