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