Ignore:
Timestamp:
Apr 5, 2008, 2:36:14 AM (12 years ago)
Author:
bruno
Message:
  • pb_env_init does just setup env variables now. It does CMS checks and conf only if called on a CMS opration
  • systematic use of ENV VAR for PBPROJVER, PBPROJTAG, PBPACKAGER
  • new function to get package list for cms only context and the old one is simplified
  • setup2vm works also with fedora-6-i386
  • build2vm nearly works now
  • $DESTDIR/pbrc contains now aal the keys needed to be independant when building (pbroot, pbprojver, pbprojtag, pbpackager)
  • remove ntp calls for the moment (not ready)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Base.pm

    r347 r353  
    3232
    3333our @ISA = qw(Exporter);
    34 our @EXPORT = qw(pb_env_init pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg pb_get_uri pb_cms_get_uri $debug $LOG);
     34our @EXPORT = qw(pb_env_init pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_filter_file_inplace pb_cms_export pb_cms_log pb_cms_isdiff pb_cms_copy pb_cms_checkout pb_get_date pb_log pb_log_init pb_get_pkg pb_cms_get_pkg pb_get_uri pb_cms_get_uri $debug $LOG);
    3535
    3636$ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
     
    4040my $proj=shift || undef;
    4141my $pbinit=shift || undef;
     42my $action=shift;
    4243my $ver;
    4344my $tag;
     
    181182#
    182183# The following part is only useful when in cms2build
    183 # In VMs/VEs we want to skip that by providing a good PBCONFDIR env var.
     184# In VMs/VEs we want to skip that by providing good env vars.
    184185# return values in that case are useless
    185186#
    186 return if (defined $ENV{'PBCONFDIR'});
    187 
    188 #
    189 # Check pbconf cms compliance
    190 #
    191 pb_cms_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
    192 
    193 # Check where is our PBROOTDIR (release tag name can't be guessed the first time)
    194 #
    195 if (not defined $ENV{'PBROOTDIR'}) {
    196     if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
    197         opendir(DIR,$ENV{'PBCONFDIR'}) || die "Unable to open directory $ENV{'PBCONFDIR'}: $!";
    198         my $maxmtime = 0;
    199         foreach my $d (readdir(DIR)) {
    200             pb_log(3,"Looking at \'$d\'...");
    201             next if ($d =~ /^\./);
    202             next if (! -d "$ENV{'PBCONFDIR'}/$d");
    203             my $s = stat("$ENV{'PBCONFDIR'}/$d");
    204             next if (not defined $s);
    205             pb_log(3,"KEEP\n");
    206             # Keep the most recent
    207             pb_log(2," $s->mtime\n");
    208             if ($s->mtime > $maxmtime) {
    209                 $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$d";
    210                 $maxmtime = $s->mtime;
     187if ($action =~ /^cms2/) {
     188
     189    #
     190    # Check pbconf cms compliance
     191    #
     192    pb_cms_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
     193
     194    # Check where is our PBROOTDIR (release tag name can't be guessed the first time)
     195    #
     196    if (not defined $ENV{'PBROOTDIR'}) {
     197        if (! -f ("$ENV{'PBDESTDIR'}/pbrc")) {
     198            opendir(DIR,$ENV{'PBCONFDIR'}) || die "Unable to open directory $ENV{'PBCONFDIR'}: $!";
     199            my $maxmtime = 0;
     200            foreach my $d (readdir(DIR)) {
     201                pb_log(3,"Looking at \'$d\'...");
     202                next if ($d =~ /^\./);
     203                next if (! -d "$ENV{'PBCONFDIR'}/$d");
     204                my $s = stat("$ENV{'PBCONFDIR'}/$d");
     205                next if (not defined $s);
     206                pb_log(3,"KEEP\n");
     207                # Keep the most recent
     208                pb_log(2," $s->mtime\n");
     209                if ($s->mtime > $maxmtime) {
     210                    $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$d";
     211                    $maxmtime = $s->mtime;
     212                }
    211213            }
    212         }
    213         closedir(DIR);
    214         die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
    215         pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
    216         pb_log(1,"         Please use -r release if you want to use another release\n");
     214            closedir(DIR);
     215            die "No directory found under $ENV{'PBCONFDIR'}" if (not defined $ENV{'PBROOTDIR'});
     216            pb_log(1,"WARNING: no pbroot defined, using $ENV{'PBROOTDIR'}\n");
     217            pb_log(1,"         Please use -r release if you want to use another release\n");
     218        } else {
     219            my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
     220            # That's always the environment variable that will be used
     221            die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
     222            $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};
     223        }
    217224    } else {
    218         my ($pbroot) = pb_conf_read_if("$ENV{'PBDESTDIR'}/pbrc","pbroot");
    219         # That's always the environment variable that will be used
    220         die "Please remove inconsistent $ENV{'PBDESTDIR'}/pbrc" if ((not defined $pbroot) || (not defined $pbroot->{$ENV{'PBPROJ'}}));
    221         $ENV{'PBROOTDIR'} = $pbroot->{$ENV{'PBPROJ'}};
    222     }
    223 } else {
    224     # transform in full path if relative
    225     $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
    226     pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
    227     die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
    228 }
    229 
    230 my %version = ();
    231 my %defpkgdir = ();
    232 my %extpkgdir = ();
    233 my %filteredfiles = ();
    234 my %supfiles = ();
    235 
    236 if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
    237     # List of pkg to build by default (mandatory)
    238     my ($defpkgdir,$pbpackager) = pb_conf_get("defpkgdir","pbpackager");
    239     # List of additional pkg to build when all is called (optional)
    240     # Valid version names (optional)
    241     # List of files to filter (optional)
    242     # Project version and tag (optional)
    243     my ($extpkgdir, $version, $filteredfiles, $supfiles, $pkgv, $pkgt) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles","projver","projtag");
    244     pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
    245     pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
    246     pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
    247     pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
    248     pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
    249     # Global
    250     %defpkgdir = %$defpkgdir;
    251     %extpkgdir = %$extpkgdir if (defined $extpkgdir);
    252     %version = %$version if (defined $version);
    253     %filteredfiles = %$filteredfiles if (defined $filteredfiles);
    254     %supfiles = %$supfiles if (defined $supfiles);
    255     #
    256     # Get global Version/Tag
    257     #
    258     if (not defined $ENV{'PBVER'}) {
    259         if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
    260             $ENV{'PBVER'}=$pkgv->{$ENV{'PBPROJ'}};
    261         } else {
    262             die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    263         }
    264     }
    265     die "Invalid version name $ENV{'PBVER'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not defined $version) && ($ENV{'PBVER'} =~ /$version{$ENV{'PBPROJ'}}/));
     225        # transform in full path if relative
     226        $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
     227        pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
     228        die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
     229    }
     230
     231    my %version = ();
     232    my %defpkgdir = ();
     233    my %extpkgdir = ();
     234    my %filteredfiles = ();
     235    my %supfiles = ();
    266236   
    267     if (not defined $ENV{'PBTAG'}) {
    268         if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
    269             $ENV{'PBTAG'}=$pkgt->{$ENV{'PBPROJ'}};
    270         } else {
    271             die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    272         }
    273     }
    274     die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
    275 
    276 
    277     if (not defined $ENV{'PBPACKAGER'}) {
    278         if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
    279             $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
    280         } else {
    281             die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    282         }
    283     }
    284 } else {
    285     if (defined $pbinit) {
    286         my $ptr = pb_get_pkg();
    287         my @pkgs = @$ptr;
    288         @pkgs = ("pkg1") if (not @pkgs);
    289 
    290         open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    291         print CONF << "EOF";
     237    if ((-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") and (not defined $pbinit)) {
     238        # List of pkg to build by default (mandatory)
     239        my ($defpkgdir,$pbpackager, $pkgv, $pkgt) = pb_conf_get("defpkgdir","pbpackager","projver","projtag");
     240        # List of additional pkg to build when all is called (optional)
     241        # Valid version names (optional)
     242        # List of files to filter (optional)
     243        # Project version and tag (optional)
     244        my ($extpkgdir, $version, $filteredfiles, $supfiles) = pb_conf_get_if("extpkgdir","version","filteredfiles","supfiles");
     245        pb_log(2,"DEBUG: defpkgdir: ".Dumper($defpkgdir)."\n");
     246        pb_log(2,"DEBUG: extpkgdir: ".Dumper($extpkgdir)."\n");
     247        pb_log(2,"DEBUG: version: ".Dumper($version)."\n");
     248        pb_log(2,"DEBUG: filteredfiles: ".Dumper($filteredfiles)."\n");
     249        pb_log(2,"DEBUG: supfiles: ".Dumper($supfiles)."\n");
     250        # Global
     251        %defpkgdir = %$defpkgdir;
     252        %extpkgdir = %$extpkgdir if (defined $extpkgdir);
     253        %version = %$version if (defined $version);
     254        %filteredfiles = %$filteredfiles if (defined $filteredfiles);
     255        %supfiles = %$supfiles if (defined $supfiles);
     256        #
     257        # Get global Version/Tag
     258        #
     259        if (not defined $ENV{'PBPROJVER'}) {
     260            if ((defined $pkgv) && (defined $pkgv->{$ENV{'PBPROJ'}})) {
     261                $ENV{'PBPROJVER'}=$pkgv->{$ENV{'PBPROJ'}};
     262            } else {
     263                die "No projver found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
     264            }
     265        }
     266        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'}}/));
     267       
     268        if (not defined $ENV{'PBPROJTAG'}) {
     269            if ((defined $pkgt) && (defined $pkgt->{$ENV{'PBPROJ'}})) {
     270                $ENV{'PBPROJTAG'}=$pkgt->{$ENV{'PBPROJ'}};
     271            } else {
     272                die "No projtag found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
     273            }
     274        }
     275        die "Invalid tag name $ENV{'PBPROJTAG'} in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb" if ($ENV{'PBPROJTAG'} !~ /[0-9.]+/);
     276   
     277   
     278        if (not defined $ENV{'PBPACKAGER'}) {
     279            if ((defined $pbpackager) && (defined $pbpackager->{$ENV{'PBPROJ'}})) {
     280                $ENV{'PBPACKAGER'}=$pbpackager->{$ENV{'PBPROJ'}};
     281            } else {
     282                die "No pbpackager found in $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
     283            }
     284        }
     285    } else {
     286        if (defined $pbinit) {
     287            my $ptr = pb_get_pkg();
     288            my @pkgs = @$ptr;
     289            @pkgs = ("pkg1") if (not @pkgs);
     290   
     291            open(CONF,"> $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") || die "Unable to create $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
     292            print CONF << "EOF";
    292293#
    293294# Project Builder configuration file
     
    389390EOF
    390391       
    391         foreach my $pp (@pkgs) {
    392             print CONF << "EOF";
     392            foreach my $pp (@pkgs) {
     393                print CONF << "EOF";
    393394#pkgver $pp = stable
    394395#pkgtag $pp = 3
    395396EOF
    396         }
    397         foreach my $pp (@pkgs) {
    398             print CONF << "EOF";
     397            }
     398            foreach my $pp (@pkgs) {
     399                print CONF << "EOF";
    399400# Hash of default package/package directory
    400401#defpkgdir $pp = dir-$pp
    401402EOF
    402         }
    403 
    404         print CONF << "EOF";
     403            }
     404   
     405            print CONF << "EOF";
    405406# Hash of additional package/package directory
    406407#extpkgdir minor-pkg = dir-minor-pkg
     
    409410# Files are mentioned relatively to pbroot/defpkgdir
    410411EOF
    411         foreach my $pp (@pkgs) {
    412             print CONF << "EOF";
     412            foreach my $pp (@pkgs) {
     413                print CONF << "EOF";
    413414#filteredfiles $pp = Makefile.PL,configure.in,install.sh,$pp.8
    414415#supfiles $pp = $pp.init
    415416EOF
    416         }
    417         close(CONF);
    418         pb_mkdir_p("$ENV{'PBROOTDIR'}/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter";
    419         open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.pbf";
    420         print CONF << "EOF";
     417            }
     418            close(CONF);
     419            pb_mkdir_p("$ENV{'PBROOTDIR'}/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter";
     420            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/all.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/all.pbf";
     421            print CONF << "EOF";
    421422#
    422423# \$Id\$
     
    454455#filter PBURL = http://www.$ENV{'PBPROJ'}.org
    455456EOF
    456         close(CONF);
    457         open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";
    458         print CONF << "EOF";
     457            close(CONF);
     458            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/rpm.pbf";
     459            print CONF << "EOF";
    459460#
    460461# \$Id\$
     
    481482
    482483EOF
    483         close(CONF);
    484         open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
    485         print CONF << "EOF";
     484            close(CONF);
     485            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/deb.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/deb.pbf";
     486            print CONF << "EOF";
    486487#
    487488# \$Id\$
     
    506507
    507508EOF
    508         close(CONF);
    509         open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
    510         print CONF << "EOF";
     509            close(CONF);
     510            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/md.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/md.pbf";
     511            print CONF << "EOF";
    511512# Specific group for Mandriva for $ENV{'PBPROJ'}
    512513# Cf: http://wiki.mandriva.com/en/Development/Packaging/Groups
     
    518519
    519520EOF
    520         close(CONF);
    521         open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
    522         print CONF << "EOF";
     521            close(CONF);
     522            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/novell.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/novell.pbf";
     523            print CONF << "EOF";
    523524# Specific group for SuSE for $ENV{'PBPROJ'}
    524525# Cf: http://en.opensuse.org/SUSE_Package_Conventions/RPM_Groups
     
    530531
    531532EOF
    532         close(CONF);
    533         foreach my $pp (@pkgs) {
    534             pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb";
    535             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
    536             print CONF << "EOF";
     533            close(CONF);
     534            foreach my $pp (@pkgs) {
     535                pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/deb") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb";
     536                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/control") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/control";
     537                print CONF << "EOF";
    537538Source: PBPKG
    538539Section: PBGRP
     
    555556
    556557EOF
    557             close(CONF);
    558             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
    559             print CONF << "EOF";
     558                close(CONF);
     559                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/copyright") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/copyright";
     560                print CONF << "EOF";
    560561This package is debianized by PBPACKAGER
    561562`date`
     
    586587
    587588EOF
    588             close(CONF);
    589             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
    590             print CONF << "EOF";
     589                close(CONF);
     590                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/changelog") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/changelog";
     591                print CONF << "EOF";
    591592PBLOG
    592593EOF
    593             close(CONF);
    594             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
    595             print CONF << "EOF";
     594                close(CONF);
     595                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/compat") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/compat";
     596                print CONF << "EOF";
    5965974
    597598EOF
    598             close(CONF);
    599             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
    600             print CONF << "EOF";
     599                close(CONF);
     600                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.dirs";
     601                print CONF << "EOF";
    601602EOF
    602             close(CONF);
    603             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
    604             print CONF << "EOF";
     603                close(CONF);
     604                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/$pp.docs";
     605                print CONF << "EOF";
    605606INSTALL
    606607COPYING
     
    609610README
    610611EOF
    611             close(CONF);
    612             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
    613             print CONF << 'EOF';
     612                close(CONF);
     613                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/deb/rules") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/deb/rules";
     614                print CONF << 'EOF';
    614615#!/usr/bin/make -f
    615616# -*- makefile -*-
     
    746747
    747748EOF
    748             close(CONF);
    749             pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm";
    750             open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
    751             print CONF << 'EOF';
     749                close(CONF);
     750                pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/rpm") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm";
     751                open(CONF,"> $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/rpm/$pp.spec";
     752                print CONF << 'EOF';
    752753#
    753754# $Id$
     
    796797
    797798EOF
    798             close(CONF);
    799             pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
    800 
    801             pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");
    802         }
    803     } else {
    804         die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
    805     }
    806 }
    807 umask 0022;
    808 return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
     799                close(CONF);
     800                pb_mkdir_p("$ENV{'PBROOTDIR'}/$pp/pbfilter") || die "Unable to create $ENV{'PBROOTDIR'}/$pp/pbfilter";
     801   
     802                pb_log(0,"\nDo not to forget to commit the pbconf directory in your CMS if needed\n");
     803            }
     804        } else {
     805            die "Unable to open $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb";
     806        }
     807    }
     808    umask 0022;
     809    return(\%filteredfiles, \%supfiles, \%defpkgdir, \%extpkgdir);
     810} else {
     811    # Setup the variables from what has been stored at the end of cms2build
     812    my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbroot");
     813    $ENV{'PBROOTDIR'} = $var->{$ENV{'PBPROJ'}};
     814
     815    ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projver");
     816    $ENV{'PBPROJVER'} = $var->{$ENV{'PBPROJ'}};
     817
     818    ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","projtag");
     819    $ENV{'PBPROJTAG'} = $var->{$ENV{'PBPROJ'}};
     820
     821    ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbpackager");
     822    $ENV{'PBPACKAGER'} = $var->{$ENV{'PBPROJ'}};
     823
     824    return;
     825}
    809826}
    810827
     
    832849#system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log");
    833850system($cmd);
     851pb_log(1,"Executing $cmd\n");
    834852my $res = $?;
    835853if ($res == -1) {
     
    15271545
    15281546#
    1529 # Return the list of packages we are working on
    1530 #
    1531 sub pb_get_pkg {
     1547# Return the list of packages we are working on in a CMS action
     1548#
     1549sub pb_cms_get_pkg {
    15321550
    15331551my @pkgs = ();
     
    15441562    @pkgs = @ARGV;
    15451563}
     1564pb_log(0,"Packages: ".join(',',@pkgs)."\n");
     1565return(\@pkgs);
     1566}
     1567
     1568#
     1569# Return the list of packages we are working on in a non CMS action
     1570#
     1571sub pb_get_pkg {
     1572
     1573my @pkgs = ();
     1574
     1575my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     1576@pkgs = keys %$var;
     1577
    15461578pb_log(0,"Packages: ".join(',',@pkgs)."\n");
    15471579return(\@pkgs);
Note: See TracChangeset for help on using the changeset viewer.