Changeset 2305


Ignore:
Timestamp:
Sep 6, 2017, 7:36:28 PM (3 weeks ago)
Author:
bruno
Message:

Fix newproj for git

handle the case now in the vcs_compliant function

Location:
devel/pb-modules/lib/ProjectBuilder
Files:
2 edited

Legend:

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

    r2292 r2305  
    260260
    261261my $pbconfpath = "$ENV{'PBDEFDIR'}/$ENV{'PBPROJ'}";
    262 
    263 # Put under CMS the PBPROJ dir
    264 if ($action =~ /^newproj$/) {
    265     if (! -d "$pbconfpath") {
    266         # TODO: There is also the need to do
    267         # svn import svn://repo "$pbconfpath
    268         # in case it doesn't exist there
    269         pb_mkdir_p("$pbconfpath");
    270     }
    271     pb_vcs_add($pbconf{$ENV{'PBPROJ'}},"$pbconfpath");
    272 }
    273262
    274263#
     
    13111300            }
    13121301            pb_vcs_add($pbconf{$ENV{'PBPROJ'}},$ENV{'PBCONFDIR'});
    1313             my $msg = "updated to ".basename("$pbconfpath");
    1314             $msg = "Project $ENV{'PBPROJ'} creation" if (defined $pbinit);
    1315             pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$pbconfpath",$msg);
     1302            my $msg = "Project $ENV{'PBPROJ'} creation";
     1303            pb_vcs_checkin($pbconf{$ENV{'PBPROJ'}},"$ENV{'PBCONFDIR'}",$msg);
    13161304        } else {
    13171305            pb_log(0,"ERROR: no pbroot defined, used $ENV{'PBROOTDIR'}, without finding $ENV{'PBPROJ'}.yml in it\n");
  • devel/pb-modules/lib/ProjectBuilder/VCS.pm

    r2284 r2305  
    694694    pb_log(1,"pb_vcs_compliant useless\n");
    695695    return;
    696 } elsif (defined $pbinit) {
    697     pb_mkdir_p("$ENV{$envar}");
    698 } elsif (! -d "$ENV{$envar}") {
     696} elsif ((defined $pbinit) || (! -d "$ENV{$envar}")) {
     697    my $exportdir = $ENV{$envar};
    699698    # Either we have a version in the uri, and it should be the same
    700699    # as the one in the envar. Or we should add the version to the uri
    701700    # But not if it's git as it manages version branches internally
    702     if ((basename($uri) ne basename($ENV{$envar})) && ($scheme !~ /^git/)) {
    703         $uri .= "/".basename($ENV{$envar})
     701    if ((basename($uri) ne basename($exportdir)) && ($scheme !~ /git/)) {
     702        $uri .= "/".basename($exportdir);
     703    }
     704    if ((defined $pbinit) && ($scheme =~ /git/)) {
     705        # If initializing remove the potential pbconf part if we treat pbconfdir
     706        $exportdir =~ s|pbconf[/]*||;
    704707    }
    705708    pb_log(1,"Checking out $uri\n");
    706709    # Create structure and remove end dir before exporting
    707     pb_mkdir_p("$ENV{$envar}");
    708     pb_rm_rf($ENV{$envar});
    709     pb_vcs_checkout($scheme,$uri,$ENV{$envar});
     710    pb_mkdir_p("$exportdir");
     711    pb_rm_rf($exportdir);
     712    pb_vcs_checkout($scheme,$uri,$exportdir);
     713    if ((defined $pbinit) && ($scheme =~ /git/)) {
     714        # And now created the potentially missin gpbconf dir
     715        pb_mkdir_p("$exportdir/pbconf");
     716    }
    710717} else {
    711718    pb_log(1,"$uri found locally, checking content\n");
Note: See TracChangeset for help on using the changeset viewer.