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

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

Minor skeleton improvements

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