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

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

Fix package based installation of pb

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