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 | # $Id$
|
---|
8 | #
|
---|
9 | # Copyright B. Cornec 2007
|
---|
10 | # Provided under the GPL v2
|
---|
11 |
|
---|
12 | package ProjectBuilder::Env;
|
---|
13 |
|
---|
14 | use strict 'vars';
|
---|
15 | use Data::Dumper;
|
---|
16 | use English;
|
---|
17 | use File::Basename;
|
---|
18 | use File::stat;
|
---|
19 | use POSIX qw(strftime);
|
---|
20 | use lib qw (lib);
|
---|
21 | use ProjectBuilder::Base;
|
---|
22 | use ProjectBuilder::Conf;
|
---|
23 | use ProjectBuilder::CMS;
|
---|
24 |
|
---|
25 | # Inherit from the "Exporter" module which handles exporting functions.
|
---|
26 |
|
---|
27 | use Exporter;
|
---|
28 |
|
---|
29 | # Export, by default, all the functions into the namespace of
|
---|
30 | # any code which uses this module.
|
---|
31 |
|
---|
32 | our @ISA = qw(Exporter);
|
---|
33 | our @EXPORT = qw(pb_env_init);
|
---|
34 |
|
---|
35 | =pod
|
---|
36 |
|
---|
37 | =head1 NAME
|
---|
38 |
|
---|
39 | ProjectBuilder::Env, part of the project-builder.org
|
---|
40 |
|
---|
41 | =head1 DESCRIPTION
|
---|
42 |
|
---|
43 | This modules provides environment functions suitable for pbinit calls.
|
---|
44 |
|
---|
45 | =head1 USAGE
|
---|
46 |
|
---|
47 | =over 4
|
---|
48 |
|
---|
49 | =item B<pb_env_init>
|
---|
50 |
|
---|
51 | This function setup the environment for project-builder.
|
---|
52 | The first parameter is the project if given on the command line.
|
---|
53 | The second parameter is a flag indicating whether we should setup up the pbconf environment or not.
|
---|
54 | The third parameter is the action passed to pb.
|
---|
55 | It sets up environement variables (PBETC, PBPROJ, PBDEFDIR, PBBUILDDIR, PBROOTDIR, PBDESTDIR, PBCONFDIR, PBPROJVER)
|
---|
56 |
|
---|
57 | =cut
|
---|
58 |
|
---|
59 | sub pb_env_init {
|
---|
60 |
|
---|
61 | my $proj=shift || undef;
|
---|
62 | my $pbinit=shift || undef;
|
---|
63 | my $action=shift;
|
---|
64 | my $ver;
|
---|
65 | my $tag;
|
---|
66 |
|
---|
67 | $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
|
---|
68 |
|
---|
69 | # We only have one configuration file for now.
|
---|
70 | pb_conf_add("$ENV{'PBETC'}");
|
---|
71 |
|
---|
72 | #
|
---|
73 | # Check project name
|
---|
74 | # Could be with env var PBPROJ
|
---|
75 | # or option -p
|
---|
76 | # if not define take the first in conf file
|
---|
77 | #
|
---|
78 | if ((defined $ENV{'PBPROJ'}) &&
|
---|
79 | (not (defined $proj))) {
|
---|
80 | $proj = $ENV{'PBPROJ'};
|
---|
81 | }
|
---|
82 |
|
---|
83 | #
|
---|
84 | # We get the pbconf file for that project
|
---|
85 | # and use its content
|
---|
86 | #
|
---|
87 | my ($pbconf) = pb_conf_get("pbconfurl");
|
---|
88 | pb_log(2,"DEBUG pbconfurl: ".Dumper($pbconf)."\n");
|
---|
89 |
|
---|
90 | my %pbconf = %$pbconf;
|
---|
91 | if (not defined $proj) {
|
---|
92 | # Take the first as the default project
|
---|
93 | $proj = (keys %pbconf)[0];
|
---|
94 | if (defined $proj) {
|
---|
95 | pb_log(1,"WARNING: using $proj as default project as none has been specified\n");
|
---|
96 | pb_log(1," Please either create a pbconfurl reference for project $proj in $ENV{'PBETC'}\n");
|
---|
97 | pb_log(1," or call pb with the -p project option or use the env var PBPROJ\n");
|
---|
98 | pb_log(1," if you want to use another project\n");
|
---|
99 | }
|
---|
100 | }
|
---|
101 | die "No project defined - use env var PBPROJ or -p proj or a pbconfurl entry in $ENV{'PBETC'}" if (not (defined $proj));
|
---|
102 |
|
---|
103 | # That's always the environment variable that will be used
|
---|
104 | $ENV{'PBPROJ'} = $proj;
|
---|
105 | pb_log(2,"PBPROJ: $ENV{'PBPROJ'}\n");
|
---|
106 |
|
---|
107 | if (not defined ($pbconf{$ENV{'PBPROJ'}})) {
|
---|
108 | die "Please create a pbconfurl reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n";
|
---|
109 | }
|
---|
110 |
|
---|
111 | # Adds a potential conf file now as it's more
|
---|
112 | # important than the project conf file
|
---|
113 | my ($vmpath,$vepath) = pb_conf_get("vmpath","vepath");
|
---|
114 | pb_conf_add("$vmpath->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$vmpath->{$ENV{'PBPROJ'}}/.pbrc");
|
---|
115 | pb_conf_add("$vepath->{$ENV{'PBPROJ'}}/.pbrc") if (-f "$vepath->{$ENV{'PBPROJ'}}/.pbrc");
|
---|
116 |
|
---|
117 | #
|
---|
118 | # Detect the root dir for hosting all the content generated with pb
|
---|
119 | #
|
---|
120 | =over 4
|
---|
121 |
|
---|
122 | Tree will look like this:
|
---|
123 |
|
---|
124 | maint pbdefdir PBDEFDIR dev dir (optional)
|
---|
125 | | |
|
---|
126 | ------------------------ --------------------
|
---|
127 | | | | |
|
---|
128 | pbproj1 pbproj2 PBPROJ pbproj1 pbproj2 PBPROJDIR
|
---|
129 | | |
|
---|
130 | --------------------------------------------- ----------
|
---|
131 | * * * | | | * *
|
---|
132 | tag dev pbconf ... build delivery PBCONFDIR dev tag
|
---|
133 | | | | PBDESTDIR |
|
---|
134 | --- ------ pbrc PBBUILDDIR -------
|
---|
135 | | | | | |
|
---|
136 | 1.1 dev tag 1.0 1.1 PBDIR
|
---|
137 | |
|
---|
138 | -------
|
---|
139 | | |
|
---|
140 | 1.0 1.1 PBROOTDIR
|
---|
141 | |
|
---|
142 | ----------------------------------
|
---|
143 | | | | |
|
---|
144 | pkg1 pbproj1.pb pbfilter pbcl
|
---|
145 | |
|
---|
146 | -----------------
|
---|
147 | | | |
|
---|
148 | rpm deb pbfilter
|
---|
149 |
|
---|
150 |
|
---|
151 | (*) By default, if no relocation in .pbrc, dev dir is taken in the maint pbdefdir (when appropriate)
|
---|
152 | Names under a pbproj and the corresponding pbconf should be similar
|
---|
153 |
|
---|
154 | =cut
|
---|
155 |
|
---|
156 | my ($pbdefdir) = pb_conf_get_if("pbdefdir");
|
---|
157 |
|
---|
158 | if (not defined $ENV{'PBDEFDIR'}) {
|
---|
159 | if ((not defined $pbdefdir) || (not defined $pbdefdir->{$ENV{'PBPROJ'}})) {
|
---|
160 | pb_log(1,"WARNING: no pbdefdir defined, using /var/cache\n");
|
---|
161 | pb_log(1," Please create a pbdefdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
|
---|
162 | pb_log(1," if you want to use another directory\n");
|
---|
163 | $ENV{'PBDEFDIR'} = "/var/cache";
|
---|
164 | } else {
|
---|
165 | # That's always the environment variable that will be used
|
---|
166 | $ENV{'PBDEFDIR'} = $pbdefdir->{$ENV{'PBPROJ'}};
|
---|
167 | }
|
---|
168 | }
|
---|
169 | # Expand potential env variable in it
|
---|
170 | eval { $ENV{'PBDEFDIR'} =~ s/(\$ENV.+\})/$1/eeg };
|
---|
171 |
|
---|
172 | pb_log(2,"PBDEFDIR: $ENV{'PBDEFDIR'}\n");
|
---|
173 |
|
---|
174 | # Need to do that earlier as it's used potentialy in pb_cms_add
|
---|
175 | pb_temp_init();
|
---|
176 | pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");
|
---|
177 |
|
---|
178 | # Put under CMS the PBPROJ dir
|
---|
179 | if (defined $pbinit) {
|
---|
180 | if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
|
---|
181 | pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") || die "Unable to recursively create $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
|
---|
182 | }
|
---|
183 | pb_cms_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
|
---|
184 | }
|
---|
185 |
|
---|
186 | #
|
---|
187 | # Set delivery directory
|
---|
188 | #
|
---|
189 | $ENV{'PBDESTDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/delivery";
|
---|
190 |
|
---|
191 | pb_log(2,"PBDESTDIR: $ENV{'PBDESTDIR'}\n");
|
---|
192 | #
|
---|
193 | # Removes all directory existing below the delivery dir
|
---|
194 | # as they are temp dir only except when called from pbinit
|
---|
195 | # Files stay and have to be cleaned up manually if needed
|
---|
196 | # those files serves as communication channels between pb phases
|
---|
197 | # Removing them prevents a following phase to detect what has been done before
|
---|
198 | #
|
---|
199 | if ((-d $ENV{'PBDESTDIR'}) && ($action !~ /pbinit/)) {
|
---|
200 | opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";
|
---|
201 | foreach my $d (readdir(DIR)) {
|
---|
202 | next if ($d =~ /^\./);
|
---|
203 | next if (-f "$ENV{'PBDESTDIR'}/$d");
|
---|
204 | pb_rm_rf("$ENV{'PBDESTDIR'}/$d") if (-d "$ENV{'PBDESTDIR'}/$d");
|
---|
205 | }
|
---|
206 | closedir(DIR);
|
---|
207 | }
|
---|
208 | if (! -d "$ENV{'PBDESTDIR'}") {
|
---|
209 | pb_mkdir_p($ENV{'PBDESTDIR'}) || die "Unable to recursively create $ENV{'PBDESTDIR'}";
|
---|
210 | }
|
---|
211 |
|
---|
212 | #
|
---|
213 | # Set build directory
|
---|
214 | #
|
---|
215 | $ENV{'PBBUILDDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/build";
|
---|
216 | if (! -d "$ENV{'PBBUILDDIR'}") {
|
---|
217 | pb_mkdir_p($ENV{'PBBUILDDIR'}) || die "Unable to recursively create $ENV{'PBBUILDDIR'}";
|
---|
218 | }
|
---|
219 |
|
---|
220 | pb_log(2,"PBBUILDDIR: $ENV{'PBBUILDDIR'}\n");
|
---|
221 |
|
---|
222 | #
|
---|
223 | # The following part is only useful when in cms2something or newsomething
|
---|
224 | # In VMs/VEs we want to skip that by providing good env vars.
|
---|
225 | # return values in that case are useless
|
---|
226 | #
|
---|
227 | if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^web/)) {
|
---|
228 |
|
---|
229 | #
|
---|
230 | # Check pbconf cms compliance
|
---|
231 | #
|
---|
232 | pb_cms_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
|
---|
233 |
|
---|
234 | # Check where is our PBROOTDIR (release tag name can't be guessed the first time)
|
---|
235 | #
|
---|
236 | if (not defined $ENV{'PBROOTDIR'}) {
|
---|
237 | if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
|
---|
238 | opendir(DIR,$ENV{'PBCONFDIR'}) || die "Unable to open directory $ENV{'PBCONFDIR'}: $!";
|
---|
239 | my $maxmtime = 0;
|
---|
240 | foreach my $d (readdir(DIR)) {
|
---|
241 | pb_log(3,"Looking at \'$d\'...");
|
---|
242 | next if ($d =~ /^\./);
|
---|
243 | next if (! -d "$ENV{'PBCONFDIR'}/$d");
|
---|
244 | my $s = stat("$ENV{'PBCONFDIR'}/$d");
|
---|
245 | next if (not defined $s);
|
---|
246 | pb_log(3,"KEEP\n");
|
---|
247 | # Keep the most recent
|
---|
248 | pb_log(2," $s->mtime\n");
|
---|
249 | if ($s->mtime > $maxmtime) {
|
---|
250 | $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$d";
|
---|
251 | $maxmtime = $s->mtime;
|
---|
252 | }
|
---|
253 | }
|
---|
254 | closedir(DIR);
|
---|
255 | pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
|
---|
256 | pb_log(1," Please use -r release if you want to use another release\n");
|
---|
257 | die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
|
---|
258 | } else {
|
---|
259 | my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
|
---|
260 | # That's always the environment variable that will be used
|
---|
261 | die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
|
---|
262 | $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};
|
---|
263 | }
|
---|
264 | } else {
|
---|
265 | # transform in full path if relative
|
---|
266 | $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
|
---|
267 | pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
|
---|
268 | die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
|
---|
269 | }
|
---|
270 |
|
---|
271 | # Adds that conf file to the list to consider
|
---|
272 | pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb");
|
---|
273 |
|
---|
274 | return if ($action =~ /^newver$/);
|
---|
275 |
|
---|
276 | my %version = ();
|
---|
277 | my %defpkgdir = ();
|
---|
278 | my %extpkgdir = ();
|
---|
279 | my %filteredfiles = ();
|
---|
280 | my %supfiles = ();
|
---|
281 |
|
---|
282 | if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
|
---|
283 |
|
---|
284 | # List of pkg to build by default (mandatory)
|
---|
285 | my ($defpkgdir,$pbpackager, $pkgv, $pkgt) = pb_conf_get("defpkgdir","pbpackager","projver","projtag");
|
---|
286 | # List of additional pkg to build when all is called (optional)
|
---|
287 | # Valid version names (optional)
|
---|
288 | # List of files to filter (optional)
|
---|
289 | # Project version and tag (optional)
|
---|
290 | my ($extpkgdir, $version, $filteredfiles, $supfiles) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles");
|
---|
291 | pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
|
---|
292 | pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
|
---|
293 | pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
|
---|
294 | pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
|
---|
295 | pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
|
---|
296 | # Global
|
---|
297 | %defpkgdir = %$defpkgdir;
|
---|
298 | %extpkgdir = %$extpkgdir if (defined $extpkgdir);
|
---|
299 | %version = %$version if (defined $version);
|
---|
300 | %filteredfiles = %$filteredfiles if (defined $filteredfiles);
|
---|
301 | %supfiles = %$supfiles if (defined $supfiles);
|
---|
302 | #
|
---|
303 | # Get global Version/Tag
|
---|
304 | #
|
---|
305 | if (not defined $ENV{'PBPROJVER'}) {
|
---|
306 | if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
|
---|
307 | $ENV{'PBPROJVER'}=$pkgv->{$ENV{'PBPROJ'}};
|
---|
308 | } else {
|
---|
309 | die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
310 | }
|
---|
311 | }
|
---|
312 | 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'}}/));
|
---|
313 |
|
---|
314 | if (not defined $ENV{'PBPROJTAG'}) {
|
---|
315 | if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
|
---|
316 | $ENV{'PBPROJTAG'}=$pkgt->{$ENV{'PBPROJ'}};
|
---|
317 | } else {
|
---|
318 | die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
319 | }
|
---|
320 | }
|
---|
321 | die "Invalid tag name $ENV{'PBPROJTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBPROJTAG'} !~ /[0-9.]+/);
|
---|
322 |
|
---|
323 |
|
---|
324 | if (not defined $ENV{'PBPACKAGER'}) {
|
---|
325 | if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
|
---|
326 | $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
|
---|
327 | } else {
|
---|
328 | die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
329 | }
|
---|
330 | }
|
---|
331 | } else {
|
---|
332 | if (defined $pbinit) {
|
---|
333 | my @pkgs = @ARGV;
|
---|
334 | @pkgs = ("pkg1") if (not @pkgs);
|
---|
335 |
|
---|
336 | open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
337 | print CONF << "EOF";
|
---|
338 | #
|
---|
339 | # Project Builder configuration file
|
---|
340 | # For project $ENV{'PBPROJ'}
|
---|
341 | #
|
---|
342 | # \$Id\$
|
---|
343 | #
|
---|
344 |
|
---|
345 | #
|
---|
346 | # What is the project URL
|
---|
347 | #
|
---|
348 | #pburl $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
349 | #pburl $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
350 | #pburl $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
|
---|
351 | #pburl $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
352 | #pburl $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
353 | #pburl $ENV{'PBPROJ'} = file:///src/$ENV{'PBPROJ'}-devel.tar.gz
|
---|
354 | #pburl $ENV{'PBPROJ'} = dir:///src/$ENV{'PBPROJ'}-devel
|
---|
355 |
|
---|
356 | # Repository
|
---|
357 | #pbrepo $ENV{'PBPROJ'} = ftp://ftp.$ENV{'PBPROJ'}.org
|
---|
358 | #pbml $ENV{'PBPROJ'} = $ENV{'PBPROJ'}-announce\@lists.$ENV{'PBPROJ'}.org
|
---|
359 | #pbsmtp $ENV{'PBPROJ'} = localhost
|
---|
360 |
|
---|
361 | # Check whether project is well formed
|
---|
362 | # when downloading from ftp/http/...
|
---|
363 | # (containing already a directory with the project-version name)
|
---|
364 | #pbwf $ENV{'PBPROJ'} = 1
|
---|
365 |
|
---|
366 | #
|
---|
367 | # Packager label
|
---|
368 | #
|
---|
369 | #pbpackager $ENV{'PBPROJ'} = William Porte <bill\@$ENV{'PBPROJ'}.org>
|
---|
370 | #
|
---|
371 |
|
---|
372 | # For delivery to a machine by SSH (potentially the FTP server)
|
---|
373 | # Needs hostname, account and directory
|
---|
374 | #
|
---|
375 | #sshhost $ENV{'PBPROJ'} = www.$ENV{'PBPROJ'}.org
|
---|
376 | #sshlogin $ENV{'PBPROJ'} = bill
|
---|
377 | #sshdir $ENV{'PBPROJ'} = /$ENV{'PBPROJ'}/ftp
|
---|
378 | #sshport $ENV{'PBPROJ'} = 22
|
---|
379 |
|
---|
380 | #
|
---|
381 | # For Virtual machines management
|
---|
382 | # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
|
---|
383 | # followed by '-' and by release number
|
---|
384 | # followed by '-' and by architecture
|
---|
385 | # a .vmtype extension will be added to the resulting string
|
---|
386 | # a QEMU rhel-3-i286 here means that the VM will be named rhel-3-i386.qemu
|
---|
387 | #
|
---|
388 | #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
|
---|
389 |
|
---|
390 | #
|
---|
391 | # Valid values for vmtype are
|
---|
392 | # qemu, (vmware, xen, ... TBD)
|
---|
393 | #vmtype $ENV{'PBPROJ'} = qemu
|
---|
394 |
|
---|
395 | # Hash for VM stuff on vmtype
|
---|
396 | #vmntp default = pool.ntp.org
|
---|
397 |
|
---|
398 | # We suppose we can commmunicate with the VM through SSH
|
---|
399 | #vmhost $ENV{'PBPROJ'} = localhost
|
---|
400 | #vmlogin $ENV{'PBPROJ'} = pb
|
---|
401 | #vmport $ENV{'PBPROJ'} = 2222
|
---|
402 |
|
---|
403 | # Timeout to wait when VM is launched/stopped
|
---|
404 | #vmtmout default = 120
|
---|
405 |
|
---|
406 | # per VMs needed paramaters
|
---|
407 | #vmopt $ENV{'PBPROJ'} = -m 384 -daemonize
|
---|
408 | #vmpath $ENV{'PBPROJ'} = /home/qemu
|
---|
409 | #vmsize $ENV{'PBPROJ'} = 5G
|
---|
410 |
|
---|
411 | #
|
---|
412 | # For Virtual environment management
|
---|
413 | # Naming convention to follow: distribution name (as per ProjectBuilder::Distribution)
|
---|
414 | # followed by '-' and by release number
|
---|
415 | # followed by '-' and by architecture
|
---|
416 | # a .vetype extension will be added to the resulting string
|
---|
417 | # a chroot rhel-3-i286 here means that the VE will be named rhel-3-i386.chroot
|
---|
418 | #
|
---|
419 | #velist $ENV{'PBPROJ'} = fedora-7-i386
|
---|
420 |
|
---|
421 | # VE params
|
---|
422 | #vetype $ENV{'PBPROJ'} = chroot
|
---|
423 | #ventp default = pool.ntp.org
|
---|
424 | #velogin $ENV{'PBPROJ'} = pb
|
---|
425 | #vepath $ENV{'PBPROJ'} = /var/lib/mock
|
---|
426 | #veconf $ENV{'PBPROJ'} = /etc/mock
|
---|
427 | #verebuild $ENV{'PBPROJ'} = false
|
---|
428 |
|
---|
429 | #
|
---|
430 | # Global version/tag for the project
|
---|
431 | #
|
---|
432 | #projver $ENV{'PBPROJ'} = devel
|
---|
433 | #projtag $ENV{'PBPROJ'} = 1
|
---|
434 |
|
---|
435 | # Hash of valid version names
|
---|
436 | #version $ENV{'PBPROJ'} = devel,stable
|
---|
437 |
|
---|
438 | # Is it a test version or a production version
|
---|
439 | testver $ENV{'PBPROJ'} = true
|
---|
440 |
|
---|
441 | # Adapt to your needs:
|
---|
442 | # Optional if you need to overwrite the global values above
|
---|
443 | #
|
---|
444 | EOF
|
---|
445 |
|
---|
446 | foreach my $pp (@pkgs) {
|
---|
447 | print CONF << "EOF";
|
---|
448 | #pkgver $pp = stable
|
---|
449 | #pkgtag $pp = 3
|
---|
450 | EOF
|
---|
451 | }
|
---|
452 | foreach my $pp (@pkgs) {
|
---|
453 | print CONF << "EOF";
|
---|
454 | # Hash of default package/package directory
|
---|
455 | #defpkgdir $pp = dir-$pp
|
---|
456 | EOF
|
---|
457 | }
|
---|
458 |
|
---|
459 | print CONF << "EOF";
|
---|
460 | # Hash of additional package/package directory
|
---|
461 | #extpkgdir minor-pkg = dir-minor-pkg
|
---|
462 |
|
---|
463 | # List of files per pkg on which to apply filters
|
---|
464 | # Files are mentioned relatively to pbroot/defpkgdir
|
---|
465 | EOF
|
---|
466 | foreach my $pp (@pkgs) {
|
---|
467 | print CONF << "EOF";
|
---|
468 | #filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.8
|
---|
469 | #supfiles $pp = $pp.init
|
---|
470 |
|
---|
471 | # For perl modules, names are different depending on distro
|
---|
472 | # Here perl-xxx for RPMs, libxxx-perl for debs, ...
|
---|
473 | # So the package name is indeed virtual
|
---|
474 | #namingtype $pp = perl
|
---|
475 | EOF
|
---|
476 | }
|
---|
477 | close(CONF);
|
---|
478 | pb_mkdir_p("$ENV{'PBROOTDIR'}/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter";
|
---|
479 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.pbf";
|
---|
480 | print CONF << "EOF";
|
---|
481 | #
|
---|
482 | # \$Id\$
|
---|
483 | #
|
---|
484 | # Filter for all files
|
---|
485 | #
|
---|
486 | #
|
---|
487 | # PBREPO is replaced by the root URL to access the repository
|
---|
488 | filter PBREPO = \$pb->{'repo'}
|
---|
489 |
|
---|
490 | # PBSRC is replaced by the source package location after the repo
|
---|
491 | #filter PBSRC = src/%{name}-%{version}.tar.gz
|
---|
492 | # Used if virtual name != real name (perl, ...)
|
---|
493 | #filter PBSRC = src/%{srcname}-%{version}.tar.gz
|
---|
494 |
|
---|
495 | # PBVER is replaced by the version (\$pb->{'ver'} in code)
|
---|
496 | filter PBVER = \$pb->{'ver'}
|
---|
497 |
|
---|
498 | # PBDATE is replaced by the date (\$pb->{'date'} in code)
|
---|
499 | filter PBDATE = \$pb->{'date'}
|
---|
500 |
|
---|
501 | # PBLOG is replaced by the changelog if value is yes
|
---|
502 | #filter PBLOG = yes
|
---|
503 |
|
---|
504 | # PBPATCHSRC is replaced by the patches names if value is yes
|
---|
505 | #filter PBPATCHSRC = yes
|
---|
506 |
|
---|
507 | # PBPATCHCMD is replaced by the patches commands if value is yes
|
---|
508 | #filter PBPATCHCMD = yes
|
---|
509 |
|
---|
510 | # PBTAG is replaced by the tag (\$pb->{'tag'} in code)
|
---|
511 | filter PBTAG = \$pb->{'tag'}
|
---|
512 |
|
---|
513 | # PBREV is replaced by the revision (\$pb->{'rev'} in code)
|
---|
514 | filter PBREV = \$pb->{'rev'}
|
---|
515 |
|
---|
516 | # PBREALPKG is replaced by the package name (\$pb->{'realpkg'} in code)
|
---|
517 | filter PBREALPKG = \$pb->{'realpkg'}
|
---|
518 |
|
---|
519 | # PBPKG is replaced by the package name (\$pb->{'pkg'} in code)
|
---|
520 | filter PBPKG = \$pb->{'pkg'}
|
---|
521 |
|
---|
522 | # PBPROJ is replaced by the project name (\$pb->{'proj'} in code)
|
---|
523 | filter PBPROJ = \$pb->{'proj'}
|
---|
524 |
|
---|
525 | # PBPACKAGER is replaced by the packager name (\$pb->{'packager'} in code)
|
---|
526 | filter PBPACKAGER = \$pb->{'packager'}
|
---|
527 |
|
---|
528 | # PBDESC contains the description of the package
|
---|
529 | #filter PBDESC = "Bla-Bla"
|
---|
530 |
|
---|
531 | # PBURL contains the URL of the Web site of the project
|
---|
532 | #filter PBURL = http://www.$ENV{'PBPROJ'}.org
|
---|
533 | EOF
|
---|
534 | close(CONF);
|
---|
535 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";
|
---|
536 | print CONF << "EOF";
|
---|
537 | #
|
---|
538 | # \$Id\$
|
---|
539 | #
|
---|
540 | # Filter for rpm build
|
---|
541 | #
|
---|
542 |
|
---|
543 | # PBGRP is replaced by the RPM group of apps
|
---|
544 | #filter PBGRP = Applications/Archiving
|
---|
545 |
|
---|
546 | # PBLIC is replaced by the license of the application
|
---|
547 | #filter PBLIC = GPL
|
---|
548 |
|
---|
549 | # PBDEP is replaced by the list of dependencies
|
---|
550 | #filter PBDEP =
|
---|
551 |
|
---|
552 | # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
|
---|
553 | filter PBSUF = \$pb->{'suf'}
|
---|
554 |
|
---|
555 | # PBOBS is replaced by the Obsolete line
|
---|
556 | #filter PBOBS =
|
---|
557 |
|
---|
558 | EOF
|
---|
559 | close(CONF);
|
---|
560 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora.pbf";
|
---|
561 | print CONF << "EOF";
|
---|
562 | #
|
---|
563 | # \$Id\$
|
---|
564 | #
|
---|
565 | # Filter for rpm build
|
---|
566 | #
|
---|
567 |
|
---|
568 | # PBGRP is replaced by the RPM group of apps
|
---|
569 | # Cf: http://fedoraproject.org/wiki/RPMGroups
|
---|
570 | #filter PBGRP = Applications/Archiving
|
---|
571 |
|
---|
572 | # PBLIC is replaced by the license of the application
|
---|
573 | # Cf: http://fedoraproject.org/wiki/Licensing
|
---|
574 | #filter PBLIC = GPLv2+
|
---|
575 |
|
---|
576 | # PBDEP is replaced by the list of dependencies
|
---|
577 | #filter PBDEP =
|
---|
578 |
|
---|
579 | # PBSUF is replaced by the package suffix (\$pbsuf'} in code)
|
---|
580 | filter PBSUF = %{dist}
|
---|
581 |
|
---|
582 | # PBOBS is replaced by the Obsolete line
|
---|
583 | #filter PBOBS =
|
---|
584 |
|
---|
585 | EOF
|
---|
586 | close(CONF);
|
---|
587 | foreach my $i (1..7) {
|
---|
588 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/fedora-$i.pbf";
|
---|
589 | print CONF << "EOF";
|
---|
590 | #
|
---|
591 | # \$Id\$
|
---|
592 | #
|
---|
593 | # Filter for old fedora build
|
---|
594 | #
|
---|
595 |
|
---|
596 | # PBSUF is replaced by the package suffix (\$pb->{'suf'} in code)
|
---|
597 | filter PBSUF = \$pb->{'suf'}
|
---|
598 |
|
---|
599 | EOF
|
---|
600 | close(CONF);
|
---|
601 | }
|
---|
602 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
|
---|
603 | print CONF << "EOF";
|
---|
604 | #
|
---|
605 | # \$Id\$
|
---|
606 | #
|
---|
607 | # Filter for debian build
|
---|
608 | #
|
---|
609 | # PBGRP is replaced by the group of apps
|
---|
610 | filter PBGRP = utils
|
---|
611 |
|
---|
612 | # PBLIC is replaced by the license of the application
|
---|
613 | # Cf:
|
---|
614 | #filter PBLIC = GPL
|
---|
615 |
|
---|
616 | # PBDEP is replaced by the list of dependencies
|
---|
617 | #filter PBDEP =
|
---|
618 |
|
---|
619 | # PBSUG is replaced by the list of suggestions
|
---|
620 | #filter PBSUG =
|
---|
621 |
|
---|
622 | # PBREC is replaced by the list of recommandations
|
---|
623 | #filter PBREC =
|
---|
624 |
|
---|
625 | EOF
|
---|
626 | close(CONF);
|
---|
627 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
|
---|
628 | print CONF << "EOF";
|
---|
629 | # Specific group for Mandriva for $ENV{'PBPROJ'}
|
---|
630 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
|
---|
631 | #filter PBGRP = Archiving/Backup
|
---|
632 |
|
---|
633 | # PBLIC is replaced by the license of the application
|
---|
634 | # Cf: http://wiki.mandriva.com/en/Development/Packaging/Licenses
|
---|
635 | #filter PBLIC = GPL
|
---|
636 |
|
---|
637 | EOF
|
---|
638 | close(CONF);
|
---|
639 | open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
|
---|
640 | print CONF << "EOF";
|
---|
641 | # Specific group for SuSE for $ENV{'PBPROJ'}
|
---|
642 | # Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
|
---|
643 | #filter PBGRP = Productivity/Archiving/Backup
|
---|
644 |
|
---|
645 | # PBLIC is replaced by the license of the application
|
---|
646 | # Cf: http://en.opensuse.org/Packaging/SUSE_Package_Conventions/RPM_Style#1.6._License_Tag
|
---|
647 | #filter PBLIC = GPL
|
---|
648 |
|
---|
649 | EOF
|
---|
650 | close(CONF);
|
---|
651 | foreach my $pp (@pkgs) {
|
---|
652 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb";
|
---|
653 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
|
---|
654 | print CONF << "EOF";
|
---|
655 | Source: PBPKG
|
---|
656 | Section: PBGRP
|
---|
657 | Priority: optional
|
---|
658 | Maintainer: PBPACKAGER
|
---|
659 | Build-Depends: debhelper (>= 4.2.20), PBDEP
|
---|
660 | Standards-Version: 3.6.1
|
---|
661 |
|
---|
662 | Package: PBPKG
|
---|
663 | Architecture: amd64 i386 ia64
|
---|
664 | Section: PBGRP
|
---|
665 | Priority: optional
|
---|
666 | Depends: \${shlibs:Depends}, \${misc:Depends}, PBDEP
|
---|
667 | Recommends: PBREC
|
---|
668 | Suggests: PBSUG
|
---|
669 | Description:
|
---|
670 | PBDESC
|
---|
671 | .
|
---|
672 | Homepage: PBURL
|
---|
673 |
|
---|
674 | EOF
|
---|
675 | close(CONF);
|
---|
676 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
|
---|
677 | print CONF << "EOF";
|
---|
678 | This package is debianized by PBPACKAGER
|
---|
679 | `date`
|
---|
680 |
|
---|
681 | The current upstream source was downloaded from
|
---|
682 | PBREPO.
|
---|
683 |
|
---|
684 | Upstream Authors: Put their name here
|
---|
685 |
|
---|
686 | Copyright:
|
---|
687 |
|
---|
688 | This package is free software; you can redistribute it and/or modify
|
---|
689 | it under the terms of the GNU General Public License as published by
|
---|
690 | the Free Software Foundation; version 2 dated June, 1991.
|
---|
691 |
|
---|
692 | This package is distributed in the hope that it will be useful,
|
---|
693 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
694 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
695 | GNU General Public License for more details.
|
---|
696 |
|
---|
697 | You should have received a copy of the GNU General Public License
|
---|
698 | along with this package; if not, write to the Free Software
|
---|
699 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
---|
700 | MA 02110-1301, USA.
|
---|
701 |
|
---|
702 | On Debian systems, the complete text of the GNU General
|
---|
703 | Public License can be found in /usr/share/common-licenses/GPL.
|
---|
704 |
|
---|
705 | EOF
|
---|
706 | close(CONF);
|
---|
707 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
|
---|
708 | print CONF << "EOF";
|
---|
709 | PBLOG
|
---|
710 | EOF
|
---|
711 | close(CONF);
|
---|
712 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
|
---|
713 | print CONF << "EOF";
|
---|
714 | 4
|
---|
715 | EOF
|
---|
716 | close(CONF);
|
---|
717 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
|
---|
718 | print CONF << "EOF";
|
---|
719 | EOF
|
---|
720 | close(CONF);
|
---|
721 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
|
---|
722 | print CONF << "EOF";
|
---|
723 | INSTALL
|
---|
724 | COPYING
|
---|
725 | AUTHORS
|
---|
726 | NEWS
|
---|
727 | README
|
---|
728 | EOF
|
---|
729 | close(CONF);
|
---|
730 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
|
---|
731 | print CONF << 'EOF';
|
---|
732 | #!/usr/bin/make -f
|
---|
733 | # -*- makefile -*-
|
---|
734 | # Sample debian/rules that uses debhelper.
|
---|
735 | # GNU copyright 1997 to 1999 by Joey Hess.
|
---|
736 | #
|
---|
737 | # $Id$
|
---|
738 | #
|
---|
739 |
|
---|
740 | # Uncomment this to turn on verbose mode.
|
---|
741 | #export DH_VERBOSE=1
|
---|
742 |
|
---|
743 | # Define package name variable for a one-stop change.
|
---|
744 | PACKAGE_NAME = PBPKG
|
---|
745 |
|
---|
746 | # These are used for cross-compiling and for saving the configure script
|
---|
747 | # from having to guess our platform (since we know it already)
|
---|
748 | DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
---|
749 | DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
|
---|
750 |
|
---|
751 | CFLAGS = -Wall -g
|
---|
752 |
|
---|
753 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
|
---|
754 | CFLAGS += -O0
|
---|
755 | else
|
---|
756 | CFLAGS += -O2
|
---|
757 | endif
|
---|
758 | ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
|
---|
759 | INSTALL_PROGRAM += -s
|
---|
760 | endif
|
---|
761 | config.status: configure
|
---|
762 | dh_testdir
|
---|
763 |
|
---|
764 | # Configure the package.
|
---|
765 | CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr
|
---|
766 | --mandir=\$${prefix}/share/man
|
---|
767 |
|
---|
768 | # Build both architecture dependent and independent
|
---|
769 | build: build-arch build-indep
|
---|
770 |
|
---|
771 | # Build architecture dependent
|
---|
772 | build-arch: build-arch-stamp
|
---|
773 |
|
---|
774 | build-arch-stamp: config.status
|
---|
775 | dh_testdir
|
---|
776 |
|
---|
777 | # Compile the package.
|
---|
778 | $(MAKE)
|
---|
779 |
|
---|
780 | touch build-stamp
|
---|
781 |
|
---|
782 | # Build architecture independent
|
---|
783 | build-indep: build-indep-stamp
|
---|
784 |
|
---|
785 | build-indep-stamp: config.status
|
---|
786 | # Nothing to do, the only indep item is the manual which is available as html in original source
|
---|
787 | touch build-indep-stamp
|
---|
788 |
|
---|
789 | # Clean up
|
---|
790 | clean:
|
---|
791 | dh_testdir
|
---|
792 | dh_testroot
|
---|
793 | rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
|
---|
794 | # Clean temporary document directory
|
---|
795 | rm -rf debian/doc-temp
|
---|
796 | # Clean up.
|
---|
797 | -$(MAKE) distclean
|
---|
798 | rm -f config.log
|
---|
799 | ifneq "$(wildcard /usr/share/misc/config.sub)" ""
|
---|
800 | cp -f /usr/share/misc/config.sub config.sub
|
---|
801 | endif
|
---|
802 | ifneq "$(wildcard /usr/share/misc/config.guess)" ""
|
---|
803 | cp -f /usr/share/misc/config.guess config.guess
|
---|
804 | endif
|
---|
805 |
|
---|
806 | dh_clean
|
---|
807 |
|
---|
808 | # Install architecture dependent and independent
|
---|
809 | install: install-arch install-indep
|
---|
810 |
|
---|
811 | # Install architecture dependent
|
---|
812 | install-arch: build-arch
|
---|
813 | dh_testdir
|
---|
814 | dh_testroot
|
---|
815 | dh_clean -k -s
|
---|
816 | dh_installdirs -s
|
---|
817 |
|
---|
818 | # Install the package files into build directory:
|
---|
819 | # - start with upstream make install
|
---|
820 | $(MAKE) install prefix=$(CURDIR)/debian/$(PACKAGE_NAME)/usr mandir=$(CURDIR)/debian/$(PACKAGE_NAME)/us
|
---|
821 | r/share/man
|
---|
822 | # - copy html manual to temporary location for renaming
|
---|
823 | mkdir -p debian/doc-temp
|
---|
824 | dh_install -s
|
---|
825 |
|
---|
826 | # Install architecture independent
|
---|
827 | install-indep: build-indep
|
---|
828 | dh_testdir
|
---|
829 | dh_testroot
|
---|
830 | dh_clean -k -i
|
---|
831 | dh_installdirs -i
|
---|
832 | dh_install -i
|
---|
833 |
|
---|
834 | # Must not depend on anything. This is to be called by
|
---|
835 | # binary-arch/binary-indep
|
---|
836 | # in another 'make' thread.
|
---|
837 | binary-common:
|
---|
838 | dh_testdir
|
---|
839 | dh_testroot
|
---|
840 | dh_installchangelogs ChangeLog
|
---|
841 | dh_installdocs
|
---|
842 | dh_installman
|
---|
843 | dh_link
|
---|
844 | dh_strip
|
---|
845 | dh_compress
|
---|
846 | dh_fixperms
|
---|
847 | dh_installdeb
|
---|
848 | dh_shlibdeps
|
---|
849 | dh_gencontrol
|
---|
850 | dh_md5sums
|
---|
851 | dh_builddeb
|
---|
852 |
|
---|
853 | # Build architecture independant packages using the common target.
|
---|
854 | binary-indep: build-indep install-indep
|
---|
855 | $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
|
---|
856 |
|
---|
857 | # Build architecture dependant packages using the common target.
|
---|
858 | binary-arch: build-arch install-arch
|
---|
859 | $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
|
---|
860 |
|
---|
861 | # Build architecture depdendent and independent packages
|
---|
862 | binary: binary-arch binary-indep
|
---|
863 | .PHONY: clean binary
|
---|
864 |
|
---|
865 | EOF
|
---|
866 | close(CONF);
|
---|
867 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm";
|
---|
868 | open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
|
---|
869 | print CONF << 'EOF';
|
---|
870 | #
|
---|
871 | # $Id$
|
---|
872 | #
|
---|
873 | # Used if virtual name != real name (perl, ...)
|
---|
874 | #%define srcname PBPKG
|
---|
875 |
|
---|
876 | Summary: bla-bla
|
---|
877 | Summary(fr): french bla-bla
|
---|
878 |
|
---|
879 | Name: PBREALPKG
|
---|
880 | Version: PBVER
|
---|
881 | Release: PBTAGPBSUF
|
---|
882 | License: PBLIC
|
---|
883 | Group: PBGRP
|
---|
884 | Url: PBURL
|
---|
885 | Source: PBREPO/PBSRC
|
---|
886 | #PBPATCHSRC
|
---|
887 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
|
---|
888 | #Requires: PBDEP
|
---|
889 |
|
---|
890 | %description
|
---|
891 | PBDESC
|
---|
892 |
|
---|
893 | %description -l fr
|
---|
894 | french desc
|
---|
895 |
|
---|
896 | %prep
|
---|
897 | %setup -q
|
---|
898 | # Used if virtual name != real name (perl, ...)
|
---|
899 | #%setup -q -n %{srcname}-%{version}
|
---|
900 | #PBPATCHCMD
|
---|
901 |
|
---|
902 | %build
|
---|
903 | %configure
|
---|
904 | make %{?_smp_mflags}
|
---|
905 |
|
---|
906 | %install
|
---|
907 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
908 | make DESTDIR=$RPM_BUILD_ROOT install
|
---|
909 |
|
---|
910 | %clean
|
---|
911 | %{__rm} -rf $RPM_BUILD_ROOT
|
---|
912 |
|
---|
913 | %files
|
---|
914 | %defattr(-,root,root)
|
---|
915 | %doc ChangeLog
|
---|
916 | %doc INSTALL COPYING README AUTHORS NEWS
|
---|
917 |
|
---|
918 | %changelog
|
---|
919 | PBLOG
|
---|
920 |
|
---|
921 | EOF
|
---|
922 | close(CONF);
|
---|
923 | pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
|
---|
924 |
|
---|
925 | }
|
---|
926 | pb_cms_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
|
---|
927 | pb_cms_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$pbinit);
|
---|
928 | } else {
|
---|
929 | die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
|
---|
930 | }
|
---|
931 | }
|
---|
932 | umask 0022;
|
---|
933 | return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
|
---|
934 | } else {
|
---|
935 | # Setup the variables from what has been stored at the end of cms2build
|
---|
936 | my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
|
---|
937 | $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
|
---|
938 |
|
---|
939 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
|
---|
940 | $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
|
---|
941 |
|
---|
942 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
|
---|
943 | $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
|
---|
944 |
|
---|
945 | ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
|
---|
946 | $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
|
---|
947 |
|
---|
948 | return;
|
---|
949 | }
|
---|
950 | }
|
---|
951 |
|
---|
952 | =back
|
---|
953 |
|
---|
954 | =head1 WEB SITES
|
---|
955 |
|
---|
956 | 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/>.
|
---|
957 |
|
---|
958 | =head1 USER MAILING LIST
|
---|
959 |
|
---|
960 | None exists for the moment.
|
---|
961 |
|
---|
962 | =head1 AUTHORS
|
---|
963 |
|
---|
964 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
|
---|
965 |
|
---|
966 | =head1 COPYRIGHT
|
---|
967 |
|
---|
968 | Project-Builder.org is distributed under the GPL v2.0 license
|
---|
969 | described in the file C<COPYING> included with the distribution.
|
---|
970 |
|
---|
971 | =cut
|
---|
972 |
|
---|
973 | 1;
|
---|