Re: [Monetdb-developers] [Monetdb-checkins] buildtools/conf mchangelog, Nov2009, NONE, 1.1.2.1 Makefile.am, Nov2009, 1.8.8.1, 1.8.8.2
You couldn't wait for the script I was creating? Also, my script does not depend on Perl (yet another dependency). Fabian wrote:
Update of /cvsroot/monetdb/buildtools/conf In directory sfp-cvsdas-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23498/conf
Modified Files: Tag: Nov2009 Makefile.am Added Files: Tag: Nov2009 mchangelog Log Message: Added mchangelog script that I use to add ChangeLog entries. The script is a highly modified version of Gentoo's echangelog script.
--- NEW FILE: mchangelog --- #!/usr/bin/env perl # # shameless echangelog rip from Gentoo with modifications for MonetDB # # echangelog: Update the ChangeLog for an ebuild. For example: # # $ echangelog 'Add ~alpha to KEYWORDS' # 4a5,7 # > 10 Feb 2003; Aron Griffis
oaf-0.6.8-r1.ebuild : # > Add ~alpha to KEYWORDS # > use strict; use POSIX qw(strftime getcwd setlocale);
# Fix bug 21022 by restricting to C locale setlocale(&POSIX::LC_ALL, "C");
use Text::Wrap; $Text::Wrap::columns = 77; $Text::Wrap::unexpand = 0;
# Global variables my (@files, @ebuilds, @conflicts, @trivial, @unknown, %actions); my ($input, $editor, $entry, $user, $date, $text, $version, $year);
my $ChangeLog = 'ChangeLog'; if (-f 'CVS/Tag') { open I, '
# Figure out what has changed around here if (-d 'CVS') { open C, 'cvs -fn up 2>&1 |' or die "Can't run cvs -fn up: $!\n"; while (<C>) { if (/^C (\S+)/) { push @conflicts, $1; next; } elsif (/^\? (\S+)/) { push @unknown, $1; $actions{$1} = '+'; next; } elsif (/^([ARM]) (\S+)/) { push @files, $2; ($actions{$2} = $1) =~ tr/ARM/+-/d; } } } elsif (-d '.svn') { open C, 'svn status 2>&1 |' or die "Can't run svn status: $!\n"; while (<C>) { if (/^ ?C +(\S+)/) { push @conflicts, $1; next; } elsif (/^\? +(\S+)/) { push @unknown, $1; $actions{$1} = '+'; next; } elsif (/^([ADRM])[ \+]+(\S+)/) { push @files, $2; ($actions{$2} = $1) =~ tr/ADRM/+-/d; } } }
# Separate out the trivial files for now @files = grep { !/files.digest|Manifest|ChangeLog.*/ or do { push @trivial, $_; 0; } } @files; @unknown = grep { !/files.digest|Manifest|ChangeLog.*/ or do { push @trivial, $_; 0; } } @unknown;
# Don't allow any conflicts if (@conflicts) { print STDERR <
# Don't allow unknown files (other than the trivial files that were separated # out above) if (@unknown) { print STDERR <
close C;
# Check if we have any files left, otherwise re-insert ebuild list # (of course, both might be empty anyway) @files = @ebuilds unless (@files);
# Allow ChangeLog entries with no changed files, but give a fat warning unless (@files) { print STDERR "**\n"; print STDERR "** NOTE: No non-trivial changed files found. Normally mchangelog\n"; print STDERR "** should be run after all affected files have been added and/or\n"; print STDERR "** modified. Did you forget to cvs/svn add?\n"; print STDERR "**\n"; @files = sort sortfunc @trivial; @files = qw/ChangeLog.*/ unless @files; # last resort to put something in the list }
# Get the input from the cmdline, editor or stdin if ($ARGV[0]) { $input = "@ARGV"; } else { # Testing for defined() allows ECHANGELOG_EDITOR='' to cancel EDITOR $editor = defined($ENV{'ECHANGELOG_EDITOR'}) ? $ENV{'ECHANGELOG_EDITOR'} : $ENV{'EDITOR'} || undef; if ($editor) { system("$editor ChangeLog.new"); if ($? != 0) { # This usually happens when the editor got forcefully killed; and # the terminal is probably messed up: so we reset things. system('/usr/bin/stty sane'); print STDERR "Editor died! Reverting to stdin method.\n"; undef $editor; } else { if (open I, "
; } } die "Empty entry; aborting\n" unless $input =~ /\S/; # If there are any long lines, then wrap the input at $columns chars # (leaving 2 chars on left, one char on right, after adding indentation below). $input =~ s/^\s*(.*?)\s*\z/$1/s; # trim whitespace $input = Text::Wrap::fill('', '', $input) if ($input =~ /^.{80}/m); $input =~ s/^/ /gm; # add indentation
# Prepend the user info to the input unless ($user = $ENV{'MCHANGELOG_USER'}) { my ($fullname, $username) = (getpwuid($<))[6,0]; $fullname =~ s/,.*//; # remove GECOS, bug 80011 $user = sprintf "%s <%s\@cwi.nl>", $fullname, $username; } # Make sure that we didn't get "root" die "Please set MCHANGELOG_USER or run as non-root\n" if $user =~ /
# Each one of these regular expressions will eat the whitespace # leading up to the next entry (except the two-space leader on the # front of a dated entry), so it needs to be replaced with a # double carriage-return. This helps to normalize the spacing in # the ChangeLogs. $text =~ s/^( .*? ) # grab header \s*\n(?=\ \ \d|\*|\z) # suck up trailing whitespace /$1\n\n$entry\n\n/sx or die "Failed to insert new entry (3)\n";
# Write the new ChangeLog open O, '>ChangeLog.new' or die "Can't open ChangeLog.new for output: $!\n"; print O $text or die "Can't write ChangeLog.new: $!\n"; close O or die "Can't close ChangeLog.new: $!\n";
# Move things around and show the ChangeLog diff system 'diff -Nu '.$ChangeLog.' ChangeLog.new'; rename 'ChangeLog.new', $ChangeLog or die "Can't rename ChangeLog.new: $!\n";
# Okay, now we have a starter ChangeLog to work with. # The text will be added just like with any other ChangeLog below. # Add the new ChangeLog to cvs/svn before continuing. if (-d 'CVS') { if (open F, "CVS/Entries") { system("cvs -f add $ChangeLog") unless (scalar grep /^\/$ChangeLog\//, <F>); } } elsif (-d '.svn') { if (open F, ".svn/entries") { system("svn add $ChangeLog") unless (scalar grep /^$ChangeLog$/, <F>); } }
# vim:sw=4 ts=8 expandtab
Index: Makefile.am =================================================================== RCS file: /cvsroot/monetdb/buildtools/conf/Makefile.am,v retrieving revision 1.8.8.1 retrieving revision 1.8.8.2 diff -u -d -r1.8.8.1 -r1.8.8.2 --- Makefile.am 6 Nov 2009 14:02:43 -0000 1.8.8.1 +++ Makefile.am 1 Dec 2009 13:13:58 -0000 1.8.8.2 @@ -18,7 +18,7 @@ ## Please run automake on this file to produce a Makefile.in
dist_pkgdata_DATA = rules.mk MonetDB.m4 -dist_bin_SCRIPTS = Mdebootstrap Mbootstrap buildtools-config +dist_bin_SCRIPTS = Mdebootstrap Mbootstrap buildtools-config mchangelog
MonetDB-release-1.0.tar.gz: MonetDB-release.spec MonetDB-release-1.0/monetdb.repo MonetDB-release-1.0/MonetDB-GPG-KEY tar czf MonetDB-release-1.0.tar.gz -C $(srcdir) MonetDB-release.spec MonetDB-release-1.0/monetdb.repo MonetDB-release-1.0/MonetDB-GPG-KEY
------------------------------------------------------------------------------ Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev _______________________________________________ Monetdb-checkins mailing list Monetdb-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/monetdb-checkins
-- Sjoerd Mullender
On 01-12-2009 15:47:12 +0100, Sjoerd Mullender wrote:
You couldn't wait for the script I was creating?
I can, but I was cleaning out my Aug2009 repo here.
Also, my script does not depend on Perl (yet another dependency).
It's not perfect.
participants (2)
-
Fabian Groffen
-
Sjoerd Mullender