Changeset 2205


Ignore:
Timestamp:
Mar 11, 2017, 12:55:09 AM (3 years ago)
Author:
bruno
Message:

Improve newproj action review skeletons, fix some tests)
Use PBPROJDIR to allow having a different project dir than the project name

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Env.pm

    r2176 r2205  
    250250pb_log(2,"PBTMP: $ENV{'PBTMP'}\n");
    251251
     252my ($pbprojdir) = pb_conf_get_if("pbprojdir");
     253if (not defined $ENV{'PBPROJDIR'}) {
     254    if ((not defined $pbprojdir) || (not defined $pbprojdir->{$ENV{'PBPROJ'}})) {
     255        pb_log(1,"WARNING: no pbprojdir defined, using $ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}\n");
     256        pb_log(1,"         Please create a pbprojdir reference for project $ENV{'PBPROJ'} in $ENV{'PBETC'}\n");
     257        pb_log(1,"         if you want to use another directory\n");
     258        $ENV{'PBPROJDIR'} = "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
     259    } else {
     260        # That's always the environment variable that will be used
     261        $ENV{'PBPROJDIR'} = $pbprojdir->{$ENV{'PBPROJ'}};
     262    }
     263}
     264
    252265# Put under CMS the PBPROJ dir
    253266if ($action =~ /^newproj$/) {
    254     if (! -d "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}") {
     267    if (! -d "$ENV{'PBPROJDIR'}") {
    255268        # TODO: There is also the need to do
    256         # svn import "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}" svn://repo
     269        # svn import svn://repo "$ENV{'PBPROJDIR'}
    257270        # in case it doesn't exist there
    258         pb_mkdir_p("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
     271        pb_mkdir_p("$ENV{'PBPROJDIR'}");
    259272    }
    260     pb_vcs_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
     273    pb_vcs_add($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBPROJDIR'}");
    261274}
    262275
     
    264277# Set delivery directory
    265278#
    266 $ENV{'PBDESTDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbdelivery";
     279$ENV{'PBDESTDIR'}="$ENV{'PBPROJDIR'}/pbdelivery";
    267280
    268281pb_log(2,"PBDESTDIR: $ENV{'PBDESTDIR'}\n");
    269282#
    270283# Removes all directory existing below the delivery dir
    271 # as they are temp dir only except when called from pbinit
     284# as they are temp dir only except when called from newproj
    272285# Files stay and have to be cleaned up manually if needed
    273286# those files serves as communication channels between pb phases
    274287# Removing them prevents a following phase to detect what has been done before
    275288#
    276 if ((-d $ENV{'PBDESTDIR'}) && ($action !~ /pbinit/)) {
     289if ((-d $ENV{'PBDESTDIR'}) && (not defined $pbinit)) {
    277290    opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!";
    278291    foreach my $d (readdir(DIR)) {
     
    290303# Set build directory
    291304#
    292 $ENV{'PBBUILDDIR'}="$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbbuild";
     305$ENV{'PBBUILDDIR'}="$ENV{'PBPROJDIR'}/pbbuild";
    293306if (! -d "$ENV{'PBBUILDDIR'}") {
    294307    pb_mkdir_p($ENV{'PBBUILDDIR'});
     
    304317#
    305318
    306 if ($action =~ /^(cms2|sbx2|newver|pbinit|newproj|announce|checkssh|cleanssh|getconf|setupve)/) {
     319if ($action =~ /^(cms2|sbx2|newver|newproj|announce|checkssh|cleanssh|getconf|setupve)/) {
    307320
    308321    #
    309322    # Check pbconf cms compliance
    310323    #
    311     pb_vcs_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
     324    pb_vcs_compliant("pbconfdir",'PBCONFDIR',"$ENV{'PBPROJDIR'}/pbconf",$pbconf{$ENV{'PBPROJ'}},$pbinit);
    312325    my ($scheme, $account, $host, $port, $path) = pb_get_uri($pbconf{$ENV{'PBPROJ'}});
    313326
     
    330343        $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}/$ENV{'PBROOTDIR'}" if ($ENV{'PBROOTDIR'} !~ /^\//);
    331344        # If git, then versions are in branch not in dirs, except for git+svn
    332         $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}" if (($scheme =~ /^git/) && ($scheme =~ /^svn/));
     345        $ENV{'PBROOTDIR'} = "$ENV{'PBCONFDIR'}" if (($scheme =~ /^git/) && ($scheme =~ /svn/));
    333346        pb_mkdir_p($ENV{'PBROOTDIR'}) if (defined $pbinit);
    334347        die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
     
    415428#
    416429#pburl $ENV{'PBPROJ'} = svn://svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
    417 #pburl $ENV{'PBPROJ'} = svn://svn+ssh.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
     430#pburl $ENV{'PBPROJ'} = svn+ssh://user\@svn.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
     431#pburl $ENV{'PBPROJ'} = git+ssh//user\@git.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
    418432#pburl $ENV{'PBPROJ'} = cvs://cvs.$ENV{'PBPROJ'}.org/$ENV{'PBPROJ'}/devel
    419433#pburl $ENV{'PBPROJ'} = http://www.$ENV{'PBPROJ'}.org/src/$ENV{'PBPROJ'}-devel.tar.gz
     
    460474# a QEMU rhel-3-i286 here means that the VM will be named rhel-3-i386.qemu
    461475#
    462 #vmlist $ENV{'PBPROJ'} = asianux-2-i386,asianux-3-i386,mandrake-10.1-i386,mandrake-10.2-i386,mandriva-2006.0-i386,mandriva-2007.0-i386,mandriva-2007.1-i386,mandriva-2008.0-i386,mandriva-2008.1-i386,mandriva-2009.0-i386,mandriva-2009.1-i386,mandriva-2010.0-i386,mandriva-2010.1-i386,redhat-7.3-i386,redhat-9-i386,fedora-4-i386,fedora-5-i386,fedora-6-i386,fedora-7-i386,fedora-8-i386,fedora-9-i386,fedora-10-i386,fedora-11-i386,fedora-12-i386,fedora-13-i386,fedora-14-i386,fedora-15-i386,fedora-16-i386,fedora-17-i386,fedora-18-i386,rhel-2-i386,rhel-3-i386,rhel-4-i386,rhel-5-i386,rhel-6-i386,suse-10.0-i386,suse-10.1-i386,opensuse-10.2-i386,opensuse-10.3-i386,opensuse-11.0-i386,opensuse-11.1-i386,opensuse-11.2-i386,opensuse-11.3-i386,opensuse-11.4-i386,opensuse-12.1-i386,opensuse-12.2-i386,opensuse-12.3-i386,sles-9-i386,sles-10-i386,sles-11-i386,gentoo-nover-i386,debian-3.1-i386,debian-4.0-i386,debian-5.0-i386,debian-6.0-i386,ubuntu-6.06-i386,ubuntu-7.04-i386,ubuntu-7.10-i386,ubuntu-8.04-i386,ubuntu-8.10-i386,ubuntu-9.04-i386,ubuntu-9.10-i386,ubuntu-10.04-i386,ubuntu-10.10-i386,ubuntu-11.04-i386,ubuntu-11.10-i386,ubuntu-12.04-i386,ubuntu-12.10-i386,solaris-10-i386,asianux-2-x86_64,asianux-3-x86_64,mandriva-2007.0-x86_64,mandriva-2007.1-x86_64,mandriva-2008.0-x86_64,mandriva-2008.1-x86_64,mandriva-2009.0-x86_64,mandriva-2009.1-x86_64,mandriva-2010.0-x86_64,mandriva-2010.1-x86_64,mageia-1-i386,mageia-2-i386,mageia-1-x86_64,mageia-2-x86_64,fedora-6-x86_64,fedora-7-x86_64,fedora-8-x86_64,fedora-9-x86_64,fedora-10-x86_64,fedora-11-x86_64,fedora-12-x86_64,fedora-13-x86_64,fedora-14-x86_64,fedora-15-x86_64,fedora-16-x86_64,fedora-17-x86_64,fedora-18-x86_64,rhel-3-x86_64,rhel-4-x86_64,rhel-5-x86_64,rhel-6-x86_64,opensuse-10.2-x86_64,opensuse-10.3-x86_64,opensuse-11.0-x86_64,opensuse-11.1-x86_64,opensuse-11.2-x86_64,opensuse-11.3-x86_64,opensuse-11.4-x86_64,opensuse-12.1-x86_64,opensuse-12.2-x86_64,opensuse-12.3-i386,sles-10-x86_64,sles-11-x86_64,gentoo-nover-x86_64,debian-4.0-x86_64,debian-5.0-x86_64,debian-6.0-x86_64,ubuntu-7.04-x86_64,ubuntu-7.10-x86_64,ubuntu-8.04-x86_64,ubuntu-8.10-x86_64,ubuntu-9.04-x86_64,ubuntu-9.10-x86_64,ubuntu-10.04-x86_64,ubuntu-10.10-x86_64,ubuntu-11.04-x86_64,ubuntu-11.10-x86_64,ubuntu-12.04-x86_64,ubuntu-12.10-x86_64
     476#vmlist $ENV{'PBPROJ'} = asianux-2-i386,asianux-3-i386,centos-7-x86_64,mandrake-10.1-i386,mandrake-10.2-i386,mandriva-2006.0-i386,mandriva-2007.0-i386,mandriva-2007.1-i386,mandriva-2008.0-i386,mandriva-2008.1-i386,mandriva-2009.0-i386,mandriva-2009.1-i386,mandriva-2010.0-i386,mandriva-2010.1-i386,redhat-7.3-i386,redhat-9-i386,fedora-4-i386,fedora-5-i386,fedora-6-i386,fedora-7-i386,fedora-8-i386,fedora-9-i386,fedora-10-i386,fedora-11-i386,fedora-12-i386,fedora-13-i386,fedora-14-i386,fedora-15-i386,fedora-16-i386,fedora-17-i386,fedora-18-i386,fedora-19-i386,fedora-20-i386,fedora-21-i386,rhel-2-i386,rhel-3-i386,rhel-4-i386,rhel-5-i386,rhel-6-i386,suse-10.0-i386,suse-10.1-i386,opensuse-10.2-i386,opensuse-10.3-i386,opensuse-11.0-i386,opensuse-11.1-i386,opensuse-11.2-i386,opensuse-11.3-i386,opensuse-11.4-i386,opensuse-12.1-i386,opensuse-12.2-i386,opensuse-12.3-i386,opensuse-13.1-i386,opensuse-13.2-i386,sles-9-i386,sles-10-i386,sles-11-i386,gentoo-nover-i386,debian-3-i386,debian-4-i386,debian-5-i386,debian-6-i386,debian-7-i386,debian-8-i386,ubuntu-6.06-i386,ubuntu-7.04-i386,ubuntu-7.10-i386,ubuntu-8.04-i386,ubuntu-8.10-i386,ubuntu-9.04-i386,ubuntu-9.10-i386,ubuntu-10.04-i386,ubuntu-10.10-i386,ubuntu-11.04-i386,ubuntu-11.10-i386,ubuntu-12.04-i386,ubuntu-12.10-i386,ubuntu-13.04-i386,ubuntu-13.10-i386,ubuntu-14.04-i386,ubuntu-14.10-i386,ubuntu-15.04-i386,ubuntu-15.10-i386,ubuntu-16.04-i386,solaris-10-i386,asianux-2-x86_64,asianux-3-x86_64,mandriva-2007.0-x86_64,mandriva-2007.1-x86_64,mandriva-2008.0-x86_64,mandriva-2008.1-x86_64,mandriva-2009.0-x86_64,mandriva-2009.1-x86_64,mandriva-2010.0-x86_64,mandriva-2010.1-x86_64,mageia-1-i386,mageia-2-i386,mageia-3-i386,mageia-4-i386,mageia-5-i386,mageia-1-x86_64,mageia-2-x86_64,mageia-3-x86_64,mageia-4-x86_64,mageia-5-x86_64,fedora-6-x86_64,fedora-7-x86_64,fedora-8-x86_64,fedora-9-x86_64,fedora-10-x86_64,fedora-11-x86_64,fedora-12-x86_64,fedora-13-x86_64,fedora-14-x86_64,fedora-15-x86_64,fedora-16-x86_64,fedora-17-x86_64,fedora-18-x86_64,fedora-19-x86_64,fedora-20-x86_64,fedora-21-x86_64,fedora-22-x86_64,fedora-23-x86_64,rhel-3-x86_64,rhel-4-x86_64,rhel-5-x86_64,rhel-6-x86_64,rhel-7-x86_64,opensuse-10.2-x86_64,opensuse-10.3-x86_64,opensuse-11.0-x86_64,opensuse-11.1-x86_64,opensuse-11.2-x86_64,opensuse-11.3-x86_64,opensuse-11.4-x86_64,opensuse-12.1-x86_64,opensuse-12.2-x86_64,opensuse-12.3-x86_64,opensuse-13.1-x86_64,opensuse-13.2-x86_64,sles-10-x86_64,sles-11-x86_64,sles-12-x86_64,gentoo-nover-x86_64,debian-4-x86_64,debian-5-x86_64,debian-6-x86_64,debian-7-x86_64,debian-8-x86_64,ubuntu-7.04-x86_64,ubuntu-7.10-x86_64,ubuntu-8.04-x86_64,ubuntu-8.10-x86_64,ubuntu-9.04-x86_64,ubuntu-9.10-x86_64,ubuntu-10.04-x86_64,ubuntu-10.10-x86_64,ubuntu-11.04-x86_64,ubuntu-11.10-x86_64,ubuntu-12.04-x86_64,ubuntu-12.10-x86_64,ubuntu-13.04-x86_64,ubuntu-13.10-x86_64,ubuntu-14.04-x86_64,ubuntu-14.10-x86_64,ubuntu-15.04-x86_64,ubuntu-15.10-x86_64,ubuntu-16.04-x86_64
    463477
    464478#
     
    491505# a chroot rhel-3-i286 here means that the VE will be named rhel-3-i386.chroot
    492506#
    493 #velist $ENV{'PBPROJ'} = fedora-7-i386
     507#velist $ENV{'PBPROJ'} = velist default = debian-7-x86_64,debian-8-x86_64,centos-5-x86_64,centos-6-x86_64,centos-7-x86_64,fedora-21-x86_64,fedora-22-x86_64,fedora-23-x86_64,fedora-24-x86_64,fedora-25-x86_64,ubuntu-12.04-x86_64,ubuntu-14.04-x86_64,ubuntu-14.10-x86_64,ubuntu-15.04-x86_64,ubuntu-15.10-x86_64,ubuntu-16.04-x86_64,ubuntu-16.10-x86_64,opensuse-42.1-x86_64,opensuse-42.2-x86_64,opensuse-13.2-x86_64,opensuse-13.1-x86_64,mageia-4-x86_64,mageia-5-x86_64
    494508
    495509# VE params
     
    798812EOF
    799813            close(CONF);
    800             open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian-7.0.pbf";
     814            open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/debian.pbf") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/debian.pbf";
    801815            print CONF << "EOF";
    802816#
     
    813827EOF
    814828            close(CONF);
    815             # 6?
    816             foreach my $ubv ("debian.pbf") {
    817                 open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
    818                 print CONF << "EOF";
    819 #
    820 # \$Id\$
    821 #
    822 # Filter for debian build
    823 #
    824 # PBDEBSTD is replaced by the Debian standard version
    825 filter PBDEBSTD = 3.8.0
    826 
    827 # PBDEBCOMP is replaced by the Debian Compatibility value
    828 filter PBDEBCOMP = 7
    829 
    830 EOF
    831                 close(CONF);
    832             }
    833829            foreach my $ubv ("ubuntu-6.06.pbf","ubuntu-7.04.pbf","ubuntu-7.10.pbf") {
    834830                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
     
    882878                close(CONF);
    883879            }
    884             # 9.10, 10.04, 10.10
     880            # 9.10+
    885881            foreach my $ubv ("ubuntu.pbf") {
    886882                open(CONF,"> $ENV{'PBROOTDIR'}/pbfilter/$ubv") || die "Unable to create $ENV{'PBROOTDIR'}/pbfilter/$ubv";
     
    12531249            }
    12541250            pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
    1255             my $msg = "updated to ".basename("$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}");
     1251            my $msg = "updated to ".basename("$ENV{'PBPROJDIR'}");
    12561252            $msg = "Project $ENV{'PBPROJ'} creation" if (defined $pbinit);
    1257             pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}",$msg);
     1253            pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBPROJDIR'}",$msg);
    12581254        } else {
    12591255            pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.pb in it\n");
Note: See TracChangeset for help on using the changeset viewer.