Changeset 1097 in ProjectBuilder for devel


Ignore:
Timestamp:
Oct 25, 2010, 12:26:55 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Fix #36 by adding new targets to pb with sbx2 suffix. They replace in feature the previous cms2 targets which now becomes really an extract from the Configuration Management System, where the former are from the exported content aka sandbox.
Location:
devel/pb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1096 r1097  
    142142=over 4
    143143
    144 =item B<cms2build>
     144=item B<sbx2build>
    145145
    146146Create tar files for the project under your CMS.
    147 CMS supported are SVN, CVS and Mercurial
     147Current state of the exported content is taken.
     148CMS supported are SVN, SVK, CVS, Git and Mercurial
    148149parameters are packages to build
    149150if not using default list
    150151
     152=item B<cms2build>
     153
     154Create tar files for the project under your CMS.
     155Current state of the CMS is taken.
     156CMS supported are SVN, SVK, CVS, Git and Mercurial
     157parameters are packages to build
     158if not using default list
     159
    151160=item B<build2pkg>
    152161
     
    157166cms2build + build2pkg
    158167
     168=item B<sbx2pkg>
     169
     170sbx2build + build2pkg
     171
    159172=item B<build2ssh>
    160173
    161174Send the tar files to a SSH host
     175
     176=item B<sbx2ssh>
     177
     178sbx2build + build2ssh
    162179
    163180=item B<cms2ssh>
     
    179196Create packages in VEs, creating it if needed
    180197and send those packages to a SSH host once built
     198
     199=item B<sbx2vm>
     200
     201sbx2build + build2vm
     202
     203=item B<sbx2ve>
     204
     205sbx2build + build2ve
    181206
    182207=item B<cms2vm>
     
    441466# Act depending on action
    442467if ($action =~ /^cms2build$/) {
    443     pb_cms2build();
     468    pb_cms2build("CMS");
     469} elsif ($action =~ /^sbx2build$/) {
     470    pb_cms2build("SandBox");
    444471} elsif ($action =~ /^build2pkg$/) {
    445472    pb_build2pkg();
    446473} elsif ($action =~ /^cms2pkg$/) {
    447     pb_cms2build();
     474    pb_cms2build("CMS");
     475    pb_build2pkg();
     476} elsif ($action =~ /^sbx2pkg$/) {
     477    pb_cms2build("SandBox");
    448478    pb_build2pkg();
    449479} elsif ($action =~ /^build2ssh$/) {
    450480    pb_build2ssh();
    451481} elsif ($action =~ /^cms2ssh$/) {
    452     pb_cms2build();
     482    pb_cms2build("CMS");
     483    pb_build2ssh();
     484} elsif ($action =~ /^sbxs2ssh$/) {
     485    pb_cms2build("SandBox");
    453486    pb_build2ssh();
    454487} elsif ($action =~ /^pkg2ssh$/) {
     
    459492    pb_build2v("vm","build");
    460493} elsif ($action =~ /^cms2ve$/) {
    461     pb_cms2build();
     494    pb_cms2build("CMS");
     495    pb_build2v("ve","build");
     496} elsif ($action =~ /^sbx2ve$/) {
     497    pb_cms2build("SandBox");
    462498    pb_build2v("ve","build");
    463499} elsif ($action =~ /^cms2vm$/) {
    464     pb_cms2build();
     500    pb_cms2build("CMS");
     501    pb_build2v("vm","build");
     502} elsif ($action =~ /^sbx2vm$/) {
     503    pb_cms2build("SandBox");
    465504    pb_build2v("vm","build");
    466505} elsif ($action =~ /^launchvm$/) {
     
    528567    my %pb;             # Structure to store conf info
    529568
     569    die "pb_cms2build requires a parameter: Web, SandBox or CMS" if (not defined $param);
     570
    530571    # If Website, then pkg is only the website
    531     if ((defined $param) && ($param eq "Web")) {
     572    if ($param eq "Web") {
    532573        ($webdir) = pb_conf_get("webdir");
    533574        pb_log(2,"webdir: ".Dumper($webdir)."\n");
     
    540581    }
    541582
    542     my ($scheme, $uri) = pb_cms_init($pbinit);
     583    my ($scheme, $uri) = pb_cms_init($pbinit,$param);
    543584
    544585    # We need 2 lines here
     
    586627        my $dir = $defpkgdir->{$pbpkg};
    587628        $dir = $extpkgdir->{$pbpkg} if (not defined $dir);
    588         $dir = $webdir->{$ENV{'PBPROJ'}} if ((defined $param) && ($param eq "Web"));
     629        $dir = $webdir->{$ENV{'PBPROJ'}} if ($param eq "Web");
    589630        pb_log(2,"def:".Dumper($defpkgdir)." ext: ".Dumper($extpkgdir)." \n");
    590631
    591632        # Exporting content from CMS
    592         my $preserve = pb_cms_export($uri,"$ENV{'PBDIR'}/$dir",$dest);
     633        my $sourcedir = undef;
     634        my $sourceuri = $uri;
     635        if ($param eq "SandBox") {
     636            # Point to the local instance
     637            $sourcedir = "$ENV{'PBDIR'}/$dir";
     638        } else {
     639            # Get it from a subdir of the URI with same version as localy but different root
     640            $sourceuri = "$ENV{'PBDIR'}/$dir";
     641            $sourceuri =~ s|^$ENV{'PBPROJDIR'}/|$uri|;
     642        }
     643        my $preserve = pb_cms_export($sourceuri,$sourcedir,$dest);
    593644
    594645        # Generated fake content for test versions to speed up stuff
     
    617668        my %patches;
    618669
    619         # Get list of distributions for which I need to generate build files
     670        # Get list of distributions for which we need to generate build files
    620671        if (defined $pt[0]->{$ENV{'PBPROJ'}}) {
    621672            $tmpl .= $pt[0]->{$ENV{'PBPROJ'}};
    622673        }
    623674        if (defined $pt[1]->{$ENV{'PBPROJ'}}) {
    624             # the 2 lists needs to be grouped with a ',' separating them
     675            # The 2 lists needs to be grouped with a ',' separating them
    625676            if ($tmpl ne "") {
    626677                $tmpl .= ",";
     
    645696   
    646697        # Do not do that for website
    647         if ((not defined $param) || ($param ne "Web")) {
     698        if ($param ne "Web") {
    648699            pb_log(0,"Build files are being generated for ...\n");
    649700            my %virt;
     
    768819
    769820        # Do not do that for website
    770         if ((not defined $param) || ($param ne "Web")) {
     821        if ($param ne "Web") {
    771822            my %tmp;
     823            my $warnflag = 0;
    772824            # Filter potential patches (local + remote)
    773825            pb_log(0,"Delivering and compressing patches ");
     
    776828                foreach my $pf (split(/,/,$patches{$v})) {
    777829                    my $pp = basename($pf);
     830                    if ($param eq "SandBox") {
     831                        $warnflag = 1;
     832                    }
    778833                    pb_cms_export($pf,undef,"$dest/pbconf/$v/pbpatch");
    779834                    pb_filter_file_inplace($ptr,"$dest/pbconf/$v/pbpatch/$pp",\%pb);
     
    786841            }
    787842            pb_log(0,"\n");
     843            pb_log(0,"WARNING: Patches are always taken from repository not local export\n") if ($warnflag == 1);
    788844        } else {
    789845            # Instead call News generation
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r940 r1097  
    5757
    5858my $pbinit = shift || undef;
     59my $param = shift || undef;
    5960
    6061my ($pburl) = pb_conf_get("pburl");
     
    7071    $ENV{'PBPROJDIR'} = "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
    7172}
     73# Expand potential env variable in it to allow string replacement
     74eval { $ENV{'PBPROJDIR'} =~ s/(\$ENV.+\})/$1/eeg };
     75
    7276
    7377# Computing the default dir for PBDIR.
     
    101105    $ENV{'PBCMSLOGFILE'}="flat.log";
    102106} elsif ($scheme =~ /^svn/) {
    103     # svnversion more precise than svn info
    104     $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd"version" .)`;
     107    # svnversion more precise than svn info if sbx
     108    if ($param eq "CMS") {
     109        $tmp = `(LANGUAGE=C $vcscmd info $pburl->{$ENV{'PBPROJ'}} | grep -E '^Revision:' | cut -d: -f2)`;
     110        $tmp =~ s/\s+//;
     111    } else {
     112        $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd"version" .)`;
     113    }
    105114    chomp($tmp);
    106115    $ENV{'PBREVISION'}=$tmp;
    107116    $ENV{'PBCMSLOGFILE'}="svn.log";
    108117} elsif ($scheme =~ /^svk/) {
    109     $tmp = `(cd "$ENV{'PBDIR'}" ; $vcscmd info . | grep -E '^Revision:' | cut -d: -f2)`;
     118    $tmp = `(cd "$ENV{'PBDIR'}" ; LANGUAGE=C $vcscmd info . | grep -E '^Revision:' | cut -d: -f2)`;
    110119    $tmp =~ s/\s+//;
    111120    chomp($tmp);
     
    267276    } else {
    268277        # Probably not right, should be checked, but that way I'll notice it :-)
     278        pb_log(0,"You're in an untested part of project-builder.org, please report any result upstream\n");
    269279        $tmp1 = $uri;
    270280    }
  • devel/pb/lib/ProjectBuilder/Env.pm

    r1094 r1097  
    286286return if ($action =~ /^clean$/);
    287287
    288 if (($action =~ /^cms2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^web/)) {
     288if (($action =~ /^cms2/) || ($action =~ /^sbx2/) || ($action =~ /^newver$/) || ($action =~ /pbinit/) || ($action =~ /^newproj$/) || ($action =~ /^announce/) || ($action =~ /^web/)) {
    289289
    290290    #
Note: See TracChangeset for help on using the changeset viewer.