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

Last change on this file since 2102 was 2102, checked in by Bruno Cornec, 8 years ago

Fix generation of example files to correspond to current test version naming implementation

File size: 40.7 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
574#filter PBSRC = src/%{name}-%{version}\$pb->{'extdir'}.tar.gz
575# Used if virtual name != real name (perl, ...)
576#filter PBSRC = src/%{srcname}-%{version}\$pb->{'extdir'}.tar.gz
577
578# PBVER is replaced by the version (\$pb->{'ver'} in code)
579filter PBVER = \$pb->{'ver'}
580
581# PBDATE is replaced by the date (\$pb->{'date'} in code)
582filter PBDATE = \$pb->{'date'}
583
584# PBEXTDIR is replaced by the testdir extension if needed (\$pb->{'extdir'} in code)
585filter PBEXTDIR = \$pb->{'extdir'}
586
587# PBPATCHSRC is replaced by the patches names if value is yes. Patches are located under the pbpatch dir of the pkg.
588#filter PBPATCHSRC = yes
589
590# PBPATCHCMD is replaced by the patches commands if value is yes
591#filter PBPATCHCMD = yes
592
593# PBMULTISRC is replaced by the sources names if value is yes. Sources are located under the pbsrc dir of the pkg.
594#filter PBMULTISRC = yes
595
596# PBTAG is replaced by the tag (\$pb->{'tag'} in code)
597filter PBTAG = \$pb->{'tag'}
598
599# PBREV is replaced by the revision (\$pb->{'rev'} in code)
600filter PBREV = \$pb->{'rev'}
601
602# PBREALPKG is replaced by the package name (\$pb->{'realpkg'} in code)
603filter PBREALPKG = \$pb->{'realpkg'}
604
605# PBPKG is replaced by the package name (\$pb->{'pkg'} in code)
606filter PBPKG = \$pb->{'pkg'}
607
608# PBPROJ is replaced by the project name (\$pb->{'proj'} in code)
609filter PBPROJ = \$pb->{'proj'}
610
611# PBPACKAGER is replaced by the packager name (\$pb->{'packager'} in code)
612filter PBPACKAGER = \$pb->{'packager'}
613
614# PBDESC contains the description of the package
615#filter PBDESC = Bla-Bla \
616# with a trailing \, the variable can be multi-line. \
617# only the trailing \'s will be removed, the leading spaces, \
618# trailing spaces, and newlines will remain except on the \
619# last line. You can use dollar slash as a way to introduce carraige \
620# return (perl syntax). \
621# You can use transform e.g. in rpm.pbf to adjust spaces
622
623# PBSUMMARY contains a short single line description of the package
624#filter PBSUMMARY = Bla
625
626# PBURL contains the URL of the Web site of the project
627#filter PBURL = http://www.$ENV{'PBPROJ'}.org
628
629# PBLOG is replaced by the changelog if value is yes
630# and should be last as when used we need the %pb hash filled
631#filter PBLOG = yes
632
633EOF
634 close(CONF);
635 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";
636 print CONF << "EOF";
637#
638# \$Id\$
639#
640# Filter for rpm build
641#
642
643# PBGRP is replaced by the RPM group of apps
644#filter PBGRP = Applications/Archiving
645
646# PBLIC is replaced by the license of the application
647#filter PBLIC = GPL
648
649# PBDEP is replaced by the list of dependencies
650#filter PBDEP =
651
652# PBBDEP is replaced by the list of build dependencies
653#filter PBBDEP =
654
655# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
656filter PBSUF = \$pb->{'suf'}
657
658# PBOBS is replaced by the Obsolete line
659#filter PBOBS =
660
661# transform a variable from the key on the right to the key on the left using the perl expression
662# after the input key name. Useful for taking multi-line documentation and removing trailing spaces
663# or leading spaces.
664#transform PBDESC = PBDESC_raw s/\\s+\\n/\\n/go;
665
666EOF
667 close(CONF);
668 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf";
669 print CONF << "EOF";
670#
671# \$Id\$
672#
673# Filter for rpm build
674#
675
676# PBGRP is replaced by the RPM group of apps
677# Cf: http://fedoraproject.org/wiki/RPMGroups
678#filter PBGRP = Applications/Archiving
679
680# PBLIC is replaced by the license of the application
681# Cf: http://fedoraproject.org/wiki/Licensing
682#filter PBLIC = GPLv2+
683
684# PBDEP is replaced by the list of dependencies
685#filter PBDEP =
686
687# PBBDEP is replaced by the list of build dependencies
688#filter PBBDEP =
689
690# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
691filter PBSUF = %{dist}
692
693# PBOBS is replaced by the Obsolete line
694#filter PBOBS =
695
696EOF
697 close(CONF);
698 foreach my $i (1..7) {
699 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf";
700 print CONF << "EOF";
701#
702# \$Id\$
703#
704# Filter for old fedora build
705#
706
707# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
708filter PBSUF = \$pb->{'suf'}
709
710EOF
711 close(CONF);
712 }
713 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
714 print CONF << "EOF";
715#
716# \$Id\$
717#
718# Filter for debian build
719#
720# PBGRP is replaced by the group of apps
721filter PBGRP = utils
722
723# PBLIC is replaced by the license of the application
724# Cf: http://www.debian.org/legal/licenses/
725#filter PBLIC = GPL
726
727# PBDEP is replaced by the list of dependencies
728#filter PBDEP =
729
730# PBBDEP is replaced by the list of build dependencies
731#filter PBBDEP =
732
733# PBSUG is replaced by the list of suggestions
734#filter PBSUG =
735
736# PBREC is replaced by the list of recommandations
737#filter PBREC =
738
739EOF
740 close(CONF);
741 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-3.1.pbf";
742 print CONF << "EOF";
743#
744# \$Id\$
745#
746# Filter for debian build
747#
748# PBDEBSTD is replaced by the Debian standard version
749filter PBDEBSTD = 3.6.1
750
751# PBDEBCOMP is replaced by the Debian Compatibility value
752filter PBDEBCOMP = 4
753
754EOF
755 close(CONF);
756 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-4.0.pbf";
757 print CONF << "EOF";
758#
759# \$Id\$
760#
761# Filter for debian build
762#
763# PBDEBSTD is replaced by the Debian standard version
764filter PBDEBSTD = 3.6.1
765
766# PBDEBCOMP is replaced by the Debian Compatibility value
767filter PBDEBCOMP = 5
768
769EOF
770 close(CONF);
771 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-5.0.pbf";
772 print CONF << "EOF";
773#
774# \$Id\$
775#
776# Filter for debian build
777#
778# PBDEBSTD is replaced by the Debian standard version
779filter PBDEBSTD = 3.8.0
780
781# PBDEBCOMP is replaced by the Debian Compatibility value
782filter PBDEBCOMP = 7
783
784EOF
785 close(CONF);
786 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-6.0.pbf";
787 print CONF << "EOF";
788#
789# \$Id\$
790#
791# Filter for debian build
792#
793# PBDEBSTD is replaced by the Debian standard version
794filter PBDEBSTD = 3.8.0
795
796# PBDEBCOMP is replaced by the Debian Compatibility value
797filter PBDEBCOMP = 7
798
799EOF
800 close(CONF);
801 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf";
802 print CONF << "EOF";
803#
804# \$Id\$
805#
806# Filter for debian build
807#
808# PBDEBSTD is replaced by the Debian standard version
809filter PBDEBSTD = 3.9.4
810
811# PBDEBCOMP is replaced by the Debian Compatibility value
812filter PBDEBCOMP = 9
813
814EOF
815 close(CONF);
816 # 6?
817 foreach my $ubv ("debian.pbf") {
818 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
819 print CONF << "EOF";
820#
821# \$Id\$
822#
823# Filter for debian build
824#
825# PBDEBSTD is replaced by the Debian standard version
826filter PBDEBSTD = 3.8.0
827
828# PBDEBCOMP is replaced by the Debian Compatibility value
829filter PBDEBCOMP = 7
830
831EOF
832 close(CONF);
833 }
834 foreach my $ubv ("ubuntu-6.06.pbf","ubuntu-7.04.pbf","ubuntu-7.10.pbf") {
835 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
836 print CONF << "EOF";
837#
838# \$Id\$
839#
840# Filter for ubuntu build
841#
842# PBDEBSTD is replaced by the Debian standard version
843filter PBDEBSTD = 3.6.2
844
845# PBDEBCOMP is replaced by the Debian Compatibility value
846filter PBDEBCOMP = 4
847
848EOF
849 close(CONF);
850 }
851 foreach my $ubv ("ubuntu-8.04.pbf","ubuntu-8.10.pbf") {
852 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
853 print CONF << "EOF";
854#
855# \$Id\$
856#
857# Filter for ubuntu build
858#
859# PBDEBSTD is replaced by the Debian standard version
860filter PBDEBSTD = 3.7.3
861
862# PBDEBCOMP is replaced by the Debian Compatibility value
863filter PBDEBCOMP = 4
864
865EOF
866 close(CONF);
867 }
868 foreach my $ubv ("ubuntu-9.04.pbf") {
869 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
870 print CONF << "EOF";
871#
872# \$Id\$
873#
874# Filter for ubuntu build
875#
876# PBDEBSTD is replaced by the Debian standard version
877filter PBDEBSTD = 3.8.0
878
879# PBDEBCOMP is replaced by the Debian Compatibility value
880filter PBDEBCOMP = 4
881
882EOF
883 close(CONF);
884 }
885 # 9.10, 10.04, 10.10
886 foreach my $ubv ("ubuntu.pbf") {
887 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
888 print CONF << "EOF";
889#
890# \$Id\$
891#
892# Filter for ubuntu build
893#
894# PBDEBSTD is replaced by the Debian standard version
895filter PBDEBSTD = 3.8.3
896
897# PBDEBCOMP is replaced by the Debian Compatibility value
898filter PBDEBCOMP = 7
899
900EOF
901 close(CONF);
902 }
903 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
904 print CONF << "EOF";
905# Specific group for Mandriva for $ENV{'PBPROJ'}
906# Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
907#filter PBGRP = Archiving/Backup
908
909# PBLIC is replaced by the license of the application
910# Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
911#filter PBLIC = GPL
912
913EOF
914 close(CONF);
915 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
916 print CONF << "EOF";
917# Specific group for SuSE for $ENV{'PBPROJ'}
918# Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
919#filter PBGRP = Productivity/Archiving/Backup
920
921# PBLIC is replaced by the license of the application
922# Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
923#filter PBLIC = GPL
924
925EOF
926 close(CONF);
927 foreach my $pp (@pkgs) {
928 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb");
929 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
930 print CONF << "EOF";
931Source: PBPKG
932# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
933Section: PBGRP
934Priority: optional
935Maintainer: PBPACKAGER
936Build-Depends: debhelper (>= 4.2.20), PBBDEP
937Standards-Version: PBDEBSTD
938Vcs-Svn: svn://svn.PBPROJ.org/svn/PBVER/PBPKG
939Vcs-Browser: http://trac.PBPROJ.org/browser/PBVER/PBPKG
940Homepage: PBURL
941
942Package: PBPKG
943Architecture: amd64 i386 ia64
944# http://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections
945Section: PBGRP
946Priority: optional
947Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
948Recommends: PBREC
949Suggests: PBSUG
950Description: PBSUMMARY
951 PBDESC
952 .
953
954EOF
955 close(CONF);
956 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
957 print CONF << "EOF";
958This package is debianized by PBPACKAGER
959`date`
960
961The current upstream source was downloaded from
962PBREPO.
963
964Upstream Authors: Put their name here
965
966Copyright:
967
968 This package is free software; you can redistribute it and/or modify
969 it under the terms of the GNU General Public License as published by
970 the Free Software Foundation; version 2 dated June, 1991.
971
972 This package is distributed in the hope that it will be useful,
973 but WITHOUT ANY WARRANTY; without even the implied warranty of
974 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
975 GNU General Public License for more details.
976
977 You should have received a copy of the GNU General Public License
978 along with this package; if not, write to the Free Software
979 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
980 MA 02110-1301, USA.
981
982On Debian systems, the complete text of the GNU General
983Public License can be found in /usr/share/common-licenses/GPL.
984
985EOF
986 close(CONF);
987 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
988 print CONF << "EOF";
989PBLOG
990EOF
991 close(CONF);
992 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
993 print CONF << "EOF";
994PBDEBCOMP
995EOF
996 close(CONF);
997 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
998 print CONF << "EOF";
999EOF
1000 close(CONF);
1001 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
1002 print CONF << "EOF";
1003INSTALL
1004COPYING
1005AUTHORS
1006NEWS
1007README
1008EOF
1009 close(CONF);
1010 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
1011 print CONF << 'EOF';
1012#!/usr/bin/make -f
1013# -*- makefile -*-
1014# Sample debian/rules that uses debhelper.
1015# GNU copyright 1997 to 1999 by Joey Hess.
1016#
1017# $Id$
1018#
1019
1020# Uncomment this to turn on verbose mode.
1021#export DH_VERBOSE=1
1022
1023# Define package name variable for a one-stop change.
1024PACKAGE_NAME = PBPKG
1025
1026# These are used for cross-compiling and for saving the configure script
1027# from having to guess our platform (since we know it already)
1028DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
1029DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
1030
1031CFLAGS = -Wall -g
1032
1033ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
1034 CFLAGS += -O0
1035else
1036 CFLAGS += -O2
1037endif
1038ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
1039 INSTALL_PROGRAM += -s
1040endif
1041
1042config.status: configure
1043 dh_testdir
1044
1045 # Configure the package.
1046 CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man
1047
1048# Build both architecture dependent and independent
1049build: build-arch build-indep
1050
1051# Build architecture dependent
1052build-arch: build-arch-stamp
1053
1054build-arch-stamp: config.status
1055 dh_testdir
1056
1057 # Compile the package.
1058 $(MAKE)
1059
1060 touch build-stamp
1061
1062# Build architecture independent
1063build-indep: build-indep-stamp
1064
1065build-indep-stamp: config.status
1066 # Nothing to do, the only indep item is the manual which is available as html in original source
1067 touch build-indep-stamp
1068
1069# Clean up
1070clean:
1071 dh_testdir
1072 dh_testroot
1073 rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
1074 # Clean temporary document directory
1075 rm -rf debian/doc-temp
1076 # Clean up.
1077 -$(MAKE) distclean
1078 rm -f config.log
1079ifneq "$(wildcard /usr/share/misc/config.sub)" ""
1080 cp -f /usr/share/misc/config.sub config.sub
1081endif
1082ifneq "$(wildcard /usr/share/misc/config.guess)" ""
1083 cp -f /usr/share/misc/config.guess config.guess
1084endif
1085
1086 dh_clean
1087
1088# Install architecture dependent and independent
1089install: install-arch install-indep
1090
1091# Install architecture dependent
1092install-arch: build-arch
1093 dh_testdir
1094 dh_testroot
1095 dh_clean -k -s
1096 dh_installdirs -s
1097
1098 # Install the package files into build directory:
1099 # - start with upstream make install
1100 $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/usr/share/man
1101 # - copy html manual to temporary location for renaming
1102 mkdir -p debian/doc-temp
1103 dh_install -s
1104
1105# Install architecture independent
1106install-indep: build-indep
1107 dh_testdir
1108 dh_testroot
1109 dh_clean -k -i
1110 dh_installdirs -i
1111 dh_install -i
1112
1113# Must not depend on anything. This is to be called by
1114# binary-arch/binary-indep
1115# in another 'make' thread.
1116binary-common:
1117 dh_testdir
1118 dh_testroot
1119 dh_installchangelogs ChangeLog
1120 dh_installdocs
1121 dh_installman
1122 dh_link
1123 dh_strip
1124 dh_compress
1125 dh_fixperms
1126 dh_installdeb
1127 dh_shlibdeps
1128 dh_gencontrol
1129 dh_md5sums
1130 dh_builddeb
1131
1132# Build architecture independant packages using the common target.
1133binary-indep: build-indep install-indep
1134 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
1135
1136# Build architecture dependant packages using the common target.
1137binary-arch: build-arch install-arch
1138 $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
1139
1140# Build architecture depdendent and independent packages
1141binary: binary-arch binary-indep
1142.PHONY: clean binary
1143
1144EOF
1145 close(CONF);
1146 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm");
1147 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
1148 print CONF << 'EOF';
1149#
1150# $Id$
1151#
1152# Used if virtual name != real name (perl, ...) - replace hash by percent in the below line
1153#define srcname PBPKG
1154
1155Summary: PBSUMMARY
1156Summary(fr): french bla-bla
1157
1158Name: PBREALPKG
1159Version: PBVER
1160Release: PBTAGPBSUF
1161License: PBLIC
1162Group: PBGRP
1163Url: PBURL
1164Source: PBREPO/PBSRC
1165#PBPATCHSRC
1166BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
1167#Requires: PBDEP
1168#BuildRequires: PBBDEP
1169
1170%description
1171PBDESC
1172
1173%description -l fr
1174french desc
1175
1176%prep
1177%setup -q %{name}-%{version}PBEXTDIR
1178# Used if virtual name != real name (perl, ...)
1179#%setup -q -n %{srcname}-%{version}PBEXTDIR
1180#PBPATCHCMD
1181
1182%build
1183%configure
1184make %{?_smp_mflags}
1185
1186%install
1187%{__rm} -rf $RPM_BUILD_ROOT
1188make DESTDIR=$RPM_BUILD_ROOT install
1189
1190%clean
1191%{__rm} -rf $RPM_BUILD_ROOT
1192
1193%files
1194%defattr(-,root,root)
1195%doc ChangeLog
1196%doc INSTALL COPYING README AUTHORS NEWS
1197
1198%changelog
1199PBLOG
1200
1201EOF
1202 close(CONF);
1203 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/pkg.pbf";
1204 print CONF << "EOF";
1205#
1206# \$Id\$
1207#
1208# Filter for pkg build
1209#
1210# Solaris package name (VENDOR : 4 letters in uppercase, SOFT : 8 letters in lowercase)
1211filter PBSOLPKG = SUNWsoftware
1212
1213EOF
1214 close(CONF);
1215 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter");
1216 pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pkg");
1217 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pkginfo";
1218 print CONF << 'EOF';
1219#
1220# $Id$
1221#
1222PKG="PBSOLPKG"
1223NAME="PBREALPKG"
1224VERSION="PBVER"
1225# all or i386
1226ARCH="all"
1227CATEGORY="application"
1228DESC="PBSUMMARY"
1229EMAIL="PBPACKAGER"
1230VENDOR="PBPACKAGER"
1231HOTLINE="PBURL"
1232EOF
1233 close(CONF);
1234 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/pbbuild";
1235 print CONF << 'EOF';
1236#
1237# $Id$
1238#
1239#perl Makefile.PL INSTALLDIRS=vendor
1240./configure --prefix=/usr
1241make
1242make install DESTDIR=\$1
1243EOF
1244 close(CONF);
1245 open(CONF,"> $ENV{'PBROOTDIR'}/$pp/pkg/depend") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pkg/depend";
1246 print CONF << 'EOF';
1247#
1248# $Id$
1249#
1250#P SUNWperl584core Perl 5.8.4 (core)
1251EOF
1252 close(CONF);
1253
1254 }
1255 pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
1256 my $msg = "updated to ".basename("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
1257 $msg = "Project $ENV{'PBPROJ'} creation" if (defined $pbinit);
1258 pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$msg);
1259 } else {
1260 pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
1261 pb_log(0," Please use -r release in order to be able to initialize your environment correctly\n");
1262 die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
1263 }
1264 }
1265 umask 0022;
1266 return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
1267} elsif ($action =~ /^(newv|setupv)/) {
1268 # No PBDESTDIR yet so doing nothing
1269 return;
1270} else {
1271 # Setup the variables from what has been stored at the end of cms2build
1272 my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
1273 $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
1274
1275 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
1276 $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
1277
1278 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
1279 $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
1280
1281 ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
1282 $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
1283
1284 return;
1285}
1286}
1287
1288=head1 WEB SITES
1289
1290The 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/>.
1291
1292=head1 USER MAILING LIST
1293
1294None exists for the moment.
1295
1296=head1 AUTHORS
1297
1298The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
1299
1300=head1 COPYRIGHT
1301
1302Project-Builder.org is distributed under the GPL v2.0 license
1303described in the file C<COPYING> included with the distribution.
1304
1305=cut
1306
13071;
Note: See TracBrowser for help on using the repository browser.