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

Last change on this file since 2207 was 2207, checked in by Bruno Cornec, 7 years ago

Expand potential vars in PBPROJDIR

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