source: ProjectBuilder/0.14.4/pb-modules/lib/ProjectBuilder/Env.pm@ 2215

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

Backport rev [2214] to 0.14.4 not yet announced and regenerate it

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