Changeset 2258 in ProjectBuilder for devel/pb


Ignore:
Timestamp:
Aug 30, 2017, 5:07:39 PM (7 years ago)
Author:
Bruno Cornec
Message:

Fix temporary files so they are also YAML and transform projects.pb files into YAML files as well

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r2256 r2258  
    565565 % pb -p I<$project> -r I<$version> newproj I<$pkg>
    566566
    567 to create the new project. Running the newproj command will then generate the file $pbdefdir/$project/pbconf/$version/$project.pb, and the directory $pbdefdir/$project/pbconf/$version/$pkg. You will need to edit those files to make the later commands work.
     567to create the new project. Running the newproj command will then generate the file $pbdefdir/$project/pbconf/$version/$project.yml, and the directory $pbdefdir/$project/pbconf/$version/$pkg. You will need to edit those files to make the later commands work.
    568568
    569569=head2 cms2build
     
    573573=over 4
    574574
    575 =item Update your $project.pb configuration file.
     575=item Update your $project.yml configuration file.
    576576
    577577You need to set the pburl, pbrepo, pbwf, pbpackager, projver, projtag, testver, delivery, and defpkgdir lines as described in the configuration file. The pburl entry is used to find the source for your package. The pbrepo entry is used to build the .repo or .sources.list files for use by downloaders of the package. The pbwf entry indicates that the source tar file is named by I<package-name>-I<version>. The pbpackager entry will be stored in the packages and should be you or your team. The projver/projtag entries indicate the version of the software and the version of the packaging scripts. The testver entry when true indicates that the package is in a test version, so no log file is computed (can be long), and version is made up using a timstamp. The delivery entry gives the subdirectory under which the packages will be delivered on the repository, and the defpkgdir entry corresponds to the local subdirectory hosting the package content.
     
    595595 % pb -p $project -r $version cms2build
    596596
    597 To create the $pbdefdir/$project/pbdelivery/$project-$version.{,pbconf}.tar.gz files, the $version-$projtag.pb and pbrc files in the same directory.
     597To create the $pbdefdir/$project/pbdelivery/$project-$version.{,pbconf}.tar.gz files, the $version-$projtag.yml and pbrc.yml files in the same directory.
    598598
    599599=back
     
    656656=item Run the cms2build command
    657657
    658 If you have deleted your $package/pbdelivery directory, re-run the cms2build command as in the earlier step. This step is necessary to generate the I<package>/pbdelivery/pbrc file.
     658If you have deleted your $package/pbdelivery directory, re-run the cms2build command as in the earlier step. This step is necessary to generate the I<package>/pbdelivery/pbrc.yml file.
    659659
    660660=item Create the new virtual environment
     
    672672=over 4
    673673
    674 =item Update $project.pb
     674=item Update $project.yml
    675675
    676676You need to have a sshhost entry for setupve to work, so add one, even an invalid one, e.g.:
     
    695695=over 4
    696696
    697 =item Update $project.pb
     697=item Update $project.yml
    698698
    699699You need to have a valid sshdir and sshhost entry for build2ve to work, so add them. Note that you need to be able to ssh from the host you run the command on to the repository host, preferably without needing to type in a password, so using ssh-agent or having a special passwordless project-builder ssh key will make this step easier.
     
    13731373   
    13741374                # Find all build files first relatively to PBROOTDIR
    1375                 # Find also all specific files referenced in the .pb conf file
     1375                # Find also all specific files referenced in the .yml conf file
    13761376                my %bfiles = ();
    13771377                my %pkgfiles = ();
     
    16171617    # Keep track of per package version
    16181618    pb_log(2,"DEBUG pkgs: ".Dumper(%pkgs)."\n");
    1619     open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb";
     1619    open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml";
     1620    print PKG "---\n";
    16201621    foreach my $pbpkg (keys %pkgs) {
    1621         print PKG "pbpkg $pbpkg = $pkgs{$pbpkg}\n";
     1622        print PKG "pbpkg:\n";
     1623        print PKG "  $pbpkg: $pkgs{$pbpkg}\n";
    16221624    }
    16231625    close(PKG);
     
    16251627    # Keep track of what is generated by default
    16261628    # We need to store the dir and info on version-tag
    1627     # Base our content on the existing .pb file
    1628     copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb","$ENV{'PBDESTDIR'}/pbrc");
    1629     open(LAST,">> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc";
    1630     print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n";
    1631     print LAST "projver $ENV{'PBPROJ'} = $ENV{'PBPROJVER'}\n";
    1632     print LAST "projtag $ENV{'PBPROJ'} = $ENV{'PBPROJTAG'}\n";
    1633     print LAST "pbpackager $ENV{'PBPROJ'} = $ENV{'PBPACKAGER'}\n";
    1634     print LAST "pbextdir $ENV{'PBPROJ'} = $pbextdir\n";
     1629    # Base our content on the existing .yml file
     1630    copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml","$ENV{'PBDESTDIR'}/pbrc.yml");
     1631    open(LAST,">> $ENV{'PBDESTDIR'}/pbrc.yml") || die "Unable to append to $ENV{'PBDESTDIR'}/pbrc.yml";
     1632    print LAST "pbroot:\n";
     1633    print LAST " $ENV{'PBPROJ'}: $ENV{'PBROOTDIR'}\n";
     1634    print LAST "projver:\n";
     1635    print LAST "  $ENV{'PBPROJ'}: $ENV{'PBPROJVER'}\n";
     1636    print LAST "projtag:\n";
     1637    print LAST "  $ENV{'PBPROJ'}: $ENV{'PBPROJTAG'}\n";
     1638    print LAST "pbpackager:\n";
     1639    print LAST "  $ENV{'PBPROJ'}: $ENV{'PBPACKAGER'}\n";
     1640    print LAST "pbextdir:\n";
     1641    print LAST "  $ENV{'PBPROJ'}: $pbextdir\n";
    16351642    close(LAST);
    16361643}
     
    16701677   
    16711678    # Get content saved in cms2build
    1672     my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     1679    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    16731680    $pkg = { } if (not defined $pkg);
    16741681    my $pbextdir = pb_get_extdir();
     
    17301737
    17311738    # Get content saved in cms2build
    1732     my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     1739    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    17331740    $pkg = { } if (not defined $pkg);
    17341741    my $pbextdir = pb_get_extdir();
     
    22022209        my $pkg = { };
    22032210        # Get content saved in cms2build
    2204         if ((defined $ENV{'PBDESTDIR'}) && (defined $ENV{'PBPROJVER'}) && (defined $ENV{'PBPROJTAG'}) && (-f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb")) {
    2205             ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     2211        if ((defined $ENV{'PBDESTDIR'}) && (defined $ENV{'PBPROJVER'}) && (defined $ENV{'PBPROJTAG'}) && (-f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml")) {
     2212            ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    22062213            $pkg = { } if (not defined $pkg);
    22072214        }
     
    22362243        }
    22372244        # Adds conf file for availability of conf elements
    2238         pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if ((defined $ENV{'PBROOTDIR'}) && (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"));
     2245        pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml") if ((defined $ENV{'PBROOTDIR'}) && (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml"));
    22392246    }
    22402247    my ($rbsconf,$testver,$delivery) = pb_conf_get_if($conf,"testver","delivery");
     
    22482255
    22492256    if ($cmt =~ /(V[EM]|RM)(build|prep)/) {
    2250         $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $pbscript{$v}";
     2257        $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc.yml $pbscript{$v}";
    22512258    } elsif ($cmt =~ /(V[EM]|RM)Script/) {
    22522259        $src="$src $pbscript{$v}";
    22532260    } elsif ($cmt =~ /(V[EM]|RM)test/) {
    2254         $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc $pbscript{$v} $ENV{'PBDESTDIR'}/pbtest";
     2261        $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc.yml $pbscript{$v} $ENV{'PBDESTDIR'}/pbtest";
    22552262    } elsif (($cmt eq "Announce") || ($cmt eq "Web") || ($cmt eq "CPAN")) {
    22562263        $src="$src $ENV{'PBTMP'}/pbscript";
     
    27542761        # Install from sandbox mean using the result of the just passed sbx2build command
    27552762        # Get content saved in cms2build
    2756         my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     2763        my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    27572764        my $pbextdir = pb_get_extdir();
    27582765        confess "Unable to get package list" if (not defined $pkg);
     
    35863593    pb_vcs_up($scheme2,"$tmp");
    35873594
    3588     # Update the .pb file
    3589     open(FILE,"$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb") || die "Unable to open $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb";
    3590     open(OUT,"> $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new") || die "Unable to write to $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new";
     3595    # Update the .yml file
     3596    open(FILE,"$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml") || die "Unable to open $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml";
     3597    open(OUT,"> $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml.new") || die "Unable to write to $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml.new";
    35913598    while(<FILE>) {
    35923599        if (/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldvertxt$/) {
    35933600            s/^projver\s+$ENV{'PBPROJ'}\s*=\s*$oldvertxt$/projver $ENV{'PBPROJ'} = $newvertxt/;
    3594             pb_log(0,"Changing projver from $oldvertxt to $newvertxt in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n");
     3601            pb_log(0,"Changing projver from $oldvertxt to $newvertxt in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml\n");
    35953602        }
    35963603        if (/^testver/) {
    35973604            s/^testver/#testver/;
    3598             pb_log(0,"Commenting testver in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n") if (/^testver/);
     3605            pb_log(0,"Commenting testver in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml\n") if (/^testver/);
    35993606        }
    36003607        if (/^delivery/) {
    36013608            my $txt = $_;
    36023609            chomp($txt);
    3603             pb_log(0,"Please check delivery ($txt) in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb\n");
     3610            pb_log(0,"Please check delivery ($txt) in $ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml\n");
    36043611        }
    36053612        print OUT $_;
     
    36073614    close(FILE);
    36083615    close(OUT);
    3609     rename("$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb.new","$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.pb");
     3616    rename("$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml.new","$ENV{'PBCONFDIR'}/$newver/$ENV{'PBPROJ'}.yml");
    36103617
    36113618    # Checking pbcl files
     
    39743981    }
    39753982
    3976     my ($addrepo) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","addrepo");
     3983    my ($addrepo) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc.yml","addrepo");
    39773984    my $pbrepo = pb_distro_get_param($pbos,$addrepo);
    39783985    print SCRIPT << 'EOF';
     
    40024009            # Install from sandbox mean using the result of the just passed sbx2build command
    40034010            # Get content saved in cms2build
    4004             my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     4011            my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    40054012            my $pbextdir = pb_get_extdir();
    40064013            die "Unable to get package list" if (not defined $pkg);
     
    49114918
    49124919# In script actions that file may not exist.
    4913 return(\@pkgs) if ((not defined $ENV{'PBDESTDIR'}) || (not defined $ENV{'PBPROJVER'}) || (not defined $ENV{'PBPROJTAG'}) || (! -f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb"));
    4914 
    4915 my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg");
     4920return(\@pkgs) if ((not defined $ENV{'PBDESTDIR'}) || (not defined $ENV{'PBPROJVER'}) || (not defined $ENV{'PBPROJTAG'}) || (! -f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml"));
     4921
     4922my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml","pbpkg");
    49164923@pkgs = keys %$var if (defined $var);
    49174924
     
    51335140sub pb_get_extdir {
    51345141
    5135     # the pbrc file should contain it and whatever the key, we take it
    5136     my ($ed) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc","pbextdir");
     5142    # the pbrc.yml file should contain it and whatever the key, we take it
     5143    my ($ed) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc.yml","pbextdir");
    51375144    pb_log(2,"ed: ".Dumper($ed)."\n");
    51385145    my $pbextdir = "";
     
    51575164my %h;
    51585165my $h = \%h;
    5159 $h = pb_conf_cache("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb",$h);
     5166$h = pb_conf_cache("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml",$h);
    51605167$h->{'pbstep'}->{"$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}"} = $pbstep;
    5161 pb_conf_write("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb",$h);
     5168pb_conf_write("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.yml",$h);
    51625169}
    51635170
Note: See TracChangeset for help on using the changeset viewer.