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