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