Changeset 285 for devel


Ignore:
Timestamp:
Nov 15, 2007, 12:04:08 AM (13 years ago)
Author:
Bruno Cornec
Message:

Adds support of NEWS, AUTHORS, svn|cvs.log, ChangeLog? files and changelog info from single files under pbconf

Location:
devel
Files:
1 added
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r283 r285  
    204204        pb_cms_export($cms,$pbdatecvs,"$ENV{'PBROOT'}/$dir",$dest);
    205205
     206        # Get project info on authors and log file
     207        my $chglog = "$ENV{'PBCONF'}/$pbpkg/pbcl";
     208        $chglog = "$ENV{'PBCONF'}/pbcl" if (! -f $chglog);
     209        $chglog = undef if (! -f $chglog);
     210
     211        my $authors = "$ENV{'PBCONF'}/$pbpkg/pbauthors";
     212        $authors = "$ENV{'PBCONF'}/pbauthors" if (! -f $authors);
     213        $authors = "/dev/null" if (! -f $authors);
     214
    206215        # Extract cms log history and store it
    207         pb_cms_log($cms,"$ENV{'PBROOT'}/$dir","$dest/$ENV{'PBCMSLOGFILE'}");
     216        if ((defined $chglog) && (! -f "$dest/NEWS")) {
     217            print $LOG "Generating NEWS file from $chglog\n";
     218            copy($chglog,"$dest/NEWS") || die "Unable to create $dest/NEWS";
     219        }
     220        pb_cms_log($cms,"$ENV{'PBROOT'}/$dir",$dest,$chglog,$authors);
    208221
    209222        my %build;
     
    269282            if (defined $ptr) {
    270283                foreach my $f (values %bfiles) {
    271                     pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager);
     284                    pb_filter_file_pb("$ENV{'PBROOT'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$pbpackager,$chglog);
    272285                }
    273286            }
     
    364377
    365378        my $src="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.gz";
    366         # Suse 10.0 forces tar.bz2 usage :-(
    367         #if (($ddir eq "suse") && ($dver eq "10.0")) {
    368         #   print "SuSE 10.0 needs bz2 type of packages so recompressing...\n";
    369         #   my $newsrc="$ENV{'PBDESTDIR'}/$pbpkg-$pbver.tar.bz2";
    370         #   system "gzip -cd $src | bzip2 -c6 > $newsrc";
    371         #   $src = $newsrc;
    372         #}
    373379        print $LOG "Source file: $src\n" if ($debug >= 0);
    374380
     
    919925    print "\n";
    920926    print "\tscript2vm: Launch one virtual machine if needed        \n";
    921     print "\t           and executes a script on it                 \n";
     927    print "\t           and executes a script on it                 \n";
    922928    print "\n";
    923929    print "\tnewvm:     Create a new virtual machine\n";
  • devel/pb/lib/ProjectBuilder/Base.pm

    r273 r285  
    803803    $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; svnversion .)`;
    804804    chomp($ENV{'PBREVISION'});
    805     $ENV{'PBCMSLOG'}="svn log";
    806805    $ENV{'PBCMSLOGFILE'}="svn.log";
    807806} elsif ($cms->{$proj} eq "flat") {
    808807    $ENV{'PBREVISION'}="flat";
    809     $ENV{'PBCMSLOG'}="/bin/true";
    810808    $ENV{'PBCMSLOGFILE'}="flat.log";
    811809} elsif ($cms->{$proj} eq "cvs") {
     
    814812    #chomp($ENV{'PBREVISION'});
    815813    $ENV{'PBREVISION'}="CVS";
    816     $ENV{'PBCMSLOG'}="cvs log";
    817814    $ENV{'PBCMSLOGFILE'}="cvs.log";
    818815    #
     
    868865}
    869866
     867
     868sub pb_create_authors {
     869
     870my $authors=shift;
     871my $dest=shift;
     872my $cms=shift;
     873
     874return if ((not defined $authors) || (! -f $authors));
     875open(AUT,$authors) || die "Unable to open $authors";
     876open(DAUTH,"> $dest/AUTHORS") || die "Unable to create $dest/AUTHORS";
     877print DAUTH "Authors of the project are:\n";
     878print DAUTH "===========================\n";
     879while (<AUT>) {
     880    my ($nick,$gcos) = split(/:/);
     881    print DAUTH "$gcos";
     882    print DAUTH " ($nick under $cms)\n" if (defined $cms);
     883}
     884close(DAUTH);
     885close(AUTH);
     886}
     887
    870888sub pb_cms_log {
    871889my $cms = shift;
    872890my $pkgdir = shift;
    873 my $destfile = shift;
     891my $dest = shift;
     892my $authors = shift;
     893
     894pb_create_authors($authors,$dest,$cms->{$ENV{'PBPROJ'}});
    874895
    875896if ($cms->{$ENV{'PBPROJ'}} eq "svn") {
    876     pb_system("svn log -v $pkgdir > $destfile","Extracting log info from SVN");
     897    pb_system("svn log -v $pkgdir > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from SVN");
     898    if ((-x "/usr/bin/svn2cl") && (! -f $dest/ChangeLog)) {
     899        pb_system("/usr/bin/svn2cl --group-by-day --authors=$authors -i -o $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN");
     900    }
    877901} elsif ($cms->{$ENV{'PBPROJ'}} eq "flat") {
    878902    # Nothing to do
     
    880904    my $tmp=basename($pkgdir);
    881905    # CVS needs a relative path !
    882     pb_system("cvs log $tmp > $destfile","Extracting log info from CVS");
     906    pb_system("cvs log $tmp > $dest/$ENV{'PBCMSLOGFILE'}","Extracting log info from CVS");
     907    if ((-x "/usr/bin/svn2cl") && (! -f $dest/ChangeLog)) {
     908        pb_system("/usr/bin/cvs2cl --group-by-day -U $authors -f $dest/ChangeLog $pkgdir","Generating ChangeLog from SVN");
     909    }
    883910} else {
    884911    die "cms $cms->{$ENV{'PBPROJ'}} unknown";
     
    10551082my $extpkgdir = shift;
    10561083my $pbpackager = shift;
     1084my $chglog = shift || undef;
    10571085
    10581086# For the moment not dynamic
     
    10791107            my $p = $defpkgdir->{$pbpkg};
    10801108            $p = $extpkgdir->{$pbpkg} if (not defined $p);
    1081             pb_changelog($dtype, $pbpkg, $pbver, $pbtag, $pbsuf, $p, \*DEST, $tmp);
     1109            pb_changelog($dtype, $pbpkg, $pbver, $pbtag, $pbsuf, $p, \*DEST, $tmp, $chglog);
    10821110            $tmp = "";
    10831111        }
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r273 r285  
    2222my $OUTPUT = shift;
    2323my $doit = shift;
     24my $chglog = shift || undef;
    2425
    2526my $log = "";
     
    2829$ENV{LANG}="C";
    2930
    30 return("\n") if ((not (defined $dtype)) || ($dtype eq "") ||
     31if ((not (defined $dtype)) || ($dtype eq "") ||
    3132        (not (defined $pkg)) || ($pkg eq "") ||
    3233        (not (defined $pbver)) || ($pbver eq "") ||
     
    3536        (not (defined $path)) || ($path eq "") ||
    3637        (not (defined $OUTPUT)) || ($OUTPUT eq "") ||
    37         (not (defined $doit)) || ($doit eq ""));
     38        (not (defined $doit)) || ($doit eq "")) {
     39    print $OUTPUT "\n";
     40    return;
     41}
    3842
    39 my $chglog = "$ENV{'PBROOT'}/$path/ChangeLog";
    40 if ((! -f $chglog) && ($doit eq "yes")) {
     43if (((not defined $chglog) || (! -f $chglog)) && ($doit eq "yes")) {
    4144    #print "No ChangeLog file ($chglog) for $pkg\n";
    42     return("\n");
     45    print $OUTPUT "\n";
     46    return;
    4347}
    4448
     
    5054my ($packager) = pb_conf_get("packager");
    5155
    52 # If we don't need to do it, fake something
    53 if ($doit ne "yes") {
     56# If we don't need to do it, or don't have it fake something
     57if (((not defined $chglog) || (! -f $chglog)) && ($doit ne "yes")) {
    5458    my @date=(localtime->sec(), localtime->min(), localtime->hour(), localtime->mday(), localtime->mon(), localtime->year(), localtime->wday(), localtime->yday(), localtime->isdst());
    5559    $date = strftime("%Y-%m-%d", @date);
Note: See TracChangeset for help on using the changeset viewer.