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

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

Use .pbrc.yml now as a YAML file as well instead of .pbrc

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