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

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

Now uses pbprojurl instead of pburl to be consistent with pbconfurl

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