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