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

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

Moves documentation aruond directories to pod file

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