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

Last change on this file was 2659, checked in by Bruno Cornec, 3 years ago

Fix some wrong mageia URLs

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