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

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

Return from Env.pm early enough if command is updateconf

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