Delete obsolete utilities

mk/fake_change_log.pl
mk/git-changelog
mk/make_emacs_changelog
mk/set-version.pl
This commit is contained in:
Bastien 2020-02-18 23:46:22 +01:00
parent 45f6844cdf
commit 6381fc96cf
4 changed files with 0 additions and 327 deletions

View File

@ -1,72 +0,0 @@
#!/usr/bin/perl
$file1 = shift;
$file2 = shift;
open file1,"<$file1" or die;
while (<file1>) {
if (m/^\s*\((defun|defsubst|defmacro|defcustom|defgroup|defface|defvar|defconst)\s+([-a-zA-Z0-9]+)/) {
if ($1 eq "defun") {
$fun1{$2}++;
} elsif ($1 eq "defsubst") {
$subst1{$2}++;
} elsif ($1 eq "defmacro") {
$macro1{$2}++;
} elsif ($1 eq "defgroup") {
$group1{$2}++;
} elsif ($1 eq "defcustom") {
$custom1{$2}++;
} elsif ($1 eq "defface") {
$face1{$2}++;
} elsif ($1 eq "defvar") {
$var1{$2}++;
} elsif ($1 eq "defconst") {
$const1{$2}++;
}
}
}
close file1;
open file2,"<$file2" or die;
while (<file2>) {
if (m/^\s*\((defun|defsubst|defmacro|defcustom|defgroup|defface|defvar|defconst)\s+([-a-zA-Z0-9]+)/) {
if ($1 eq "defun") {
$fun2{$2}++;
} elsif ($1 eq "defsubst") {
$subst2{$2}++;
} elsif ($1 eq "defmacro") {
$macro2{$2}++;
} elsif ($1 eq "defgroup") {
$group2{$2}++;
} elsif ($1 eq "defcustom") {
$custom2{$2}++;
} elsif ($1 eq "defface") {
$face2{$2}++;
} elsif ($1 eq "defvar") {
$var2{$2}++;
} elsif ($1 eq "defconst") {
$const2{$2}++;
}
}
}
close file2;
foreach $type ("fun","subst","macro","group","custom","face","var","const") {
$cmd1 = '%n1 = %' . $type . "1;";
$cmd2 = '%n2 = %' . $type . "2;";
eval $cmd1;
eval $cmd2;
print "$type added:\n";
foreach (keys %n2) {
unless (defined $n1{$_}) {
print " $_\n";
}
}
print "$type removed:\n";
foreach (keys %n1) {
unless (defined $n2{$_}) {
print " $_\n";
}
}
}

View File

@ -1,93 +0,0 @@
#!/usr/bin/env python
# git-changelog
#
# version 2.0, by John Wiegley
#
# The purpose of this code is to turn "git log" output into a complete
# ChangeLog, for projects who wish to begin using a ChangeLog, but haven't
# been.
#
# This version of git-changelog depends on GitPython:
# git://gitorious.org/git-python/mainline.git
import time
import string
import sys
import re
import os
from git import * # GitPython
from subprocess import *
repo = Repo(os.getcwd())
ref = 'origin/master..'
path = ''
# Usage: git changelog [COMMITISH] [-- [PATH]]
saw_dashdash = False
if len(sys.argv) > 1:
for arg in sys.argv[1:]:
if arg == "--":
saw_dashdash = True
elif saw_dashdash:
path = arg
else:
ref = arg
for commit in repo.iter_commits(ref, paths=path):
hash_id = commit.sha
author = commit.author
date = commit.committed_date
log_text = commit.message.split('\n')[0]
log_text_remainder = commit.message.split('\n\n')[1:]
while len(log_text_remainder) > 0 and not log_text_remainder[0]:
log_text_remainder = log_text_remainder[1:]
log_text_remainder = string.join(log_text_remainder, '\n\t')
if log_text_remainder:
log_text_remainder = '\n\t' + log_text_remainder
diff = commit.diff(commit.parents[0])
files = []
for f in diff:
if not f.a_blob:
p = f.b_blob.path
elif not f.b_blob:
p = f.a_blob.path
else:
continue
p2 = re.sub('^' + path + '/', '', p)
if p != p2:
files.append(p2)
fp = Popen(["fmt", "-72"], shell = True, stdin = PIPE, stdout = PIPE)
if files:
fp.stdin.write("\t* %s: %s" % (string.join(files, ",\n\t"), log_text))
else:
fp.stdin.write("\t* %s" % log_text)
fp.stdin.close()
log_text = fp.stdout.read()
del fp
print "%s %s <%s>\n" % \
(time.strftime("%Y-%m-%d", time.gmtime(date)),
author.name, author.email)
if path:
log_text = re.sub(' ' + path + '/', ' ', log_text)
log_text_remainder = re.sub(' ' + path + '/', ' ', log_text_remainder)
# If the log_text_remainder already begins with a *, then use that as the
# changelog text.
if re.match('\s+\* ', log_text_remainder):
if log_text_remainder[0] == '\n':
print log_text_remainder[1:]
else:
print log_text_remainder
else:
print "%s%s" % (log_text, log_text_remainder)
# git-changelog ends here

View File

@ -1,117 +0,0 @@
#!/usr/bin/perl
$commitrange = shift @ARGV;
if (!$commitrange) {
print STDERR "Enter commitrange: ";
$commitrange = <>;
$commitrange =~ s/\s*(.*?)\s+/$1/;
}
$syncdate = shift @ARGV;
if (!$syncdate) {
print STDERR "Enter syncdate YYYY-MM-DD: ";
$syncdate = <>;
$syncdate =~ s/\s*(.*?)\s+/$1/;
}
$kind = shift @ARGV;
if (!$kind) {
print STDERR 'Enter kind ("lisp" or "texi" or "card" or press RET): ';
$kind = <>;
$kind =~ s/\s*(.*?)\s+/$1/;
$kind =~ s/"(.*?)"/$1/;
}
if ($kind ne "lisp" and $kind ne "texi" and $kind ne "card"
and $kind ne "") {
die "Invalid Changelog kind";
}
# commit must touch these paths or files to be considered
$fpath = "lisp/ doc/";
# Run git log to get the commits the messages
open IN,"git log --no-merges --format='%aN%n<%aE>%n%b%x0c' $commitrange -- $fpath|";
undef $/;
$log = <IN>;
@commits = split(/\f/,$log);
my %entries;
foreach my $commit (@commits) {
$name = ( $commit=~ s/([^\n]+)\n//m ) ? $1 : "N/A";
$address = ( $commit=~ s/([^\n]+)\n//m ) ? $1 : "N/A";
$tiny = $commit =~ s/TINYCHANGE//mg ? " (tiny change)" : "";
$entry = $commit;
if ($entry) {
# remove whitespace at beginning of line
$entry =~ s/^[ \t]*//mg;
# add linebreaks before each starred line except the very first
$entry =~ s/\A[\n\t]*/@/mg;
$entry =~ s/^\*/\n\n*/mg;
$entry =~ s/\A@//mg;
# normalize starred lines
$entry =~ s/^(\*[^(]*\S)\(/\1 (/mg;
# remove blocks of more than one empty line
$entry =~s/\n{3,}/\n\n/mg;
# Fix the path when directories have been omitted
$entry =~ s/^\* ([-a-zA-Z]+\.el)/* lisp\/$1/mg;
$entry =~ s/^\* (org[a-z]*\.texi?)/* doc\/$1/mg;
# remove stuff which is not for this output
if ($kind =~ /\S/) {
# do not delete or rename directories from the list as long as
# Changelog entries referring to them exist!
remove_parts(qw( contrib/ testing/ xemacs/ mk/ etc/ ));
remove_parts(qw( .*Makefile README .+\.mk ));
}
if ($kind eq "lisp") { remove_parts("doc/") }
if ($kind eq "texi") { remove_parts("lisp/","doc/orgcard","doc/orgguide") }
if ($kind eq "card") { remove_parts("lisp/","doc/org\\.","doc/orgguide") }
# remove/replace parts of the path
$entry =~ s:^\* lisp/:* :mg;
$entry =~ s:^\* doc/orgcard:* refcards/orgcard:mg;
$entry =~ s:^\* doc/:* misc/:mg;
# remove empty space at beginning and end
$entry =~ s/\A\s*//;
$entry =~ s/\s*\Z//;
# remove everything that is not a starred entry
my @entries = grep( /^\*/, split( /\n\n/, $entry ));
# If there is anything left in the entry, print it
if (scalar @entries) {
push @{ $entries{"$syncdate $name $address$tiny"} }, @entries;
}
}
}
foreach my $key ( sort keys %entries ) {
next if (! exists $entries{"$key"} );
print "$key\n";
if ( exists $entries{"$key (tiny change)"} ) {
push @{ $entries{"$key"} }, @{ $entries{"$key (tiny change)"} };
delete $entries{"$key (tiny change)"};
}
my @entries = @{ $entries{"$key"} };
foreach my $entry ( @entries ) {
# indent each line by exactly one TAB
$entry =~ s/^/\t/mg;
print "\n$entry\n";
}
print "\n\n";
}
sub remove_parts {
foreach $path (@_) {
$re = "^[ \t]*\\*\\s+" . $path . "[^\\000]*?(?=^[ \\t]*\\*|\\Z)";
$entry =~ s/$re/\n$1/mg;
}
}

View File

@ -1,45 +0,0 @@
#!/usr/bin/perl
$version = $ARGV[0];
if ($version eq "--all" or $version eq "-a") {
$all = 1;
$version = $ARGV[1]
}
if ($version eq "--only" or $version eq "-o") {
$only = 1;
$version = $ARGV[1]
}
die "No version given" unless $version=~/\S/;
$date = `date "+%B %Y"`; chomp $date;
$year = `date "+%Y"` ; chomp $year;
print STDERR "Changing version to \"$version\" and date to \"$date\" in all relevant files\n" ;
if (not $only) {
print STDERR join("\n",glob("lisp/*.el")),"\n";
$cmd = qq{s/^(;; Version:)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\(defconst org-version )"(\\S+)"/\$1"$version"/};
$c1 = "perl -pi -e '$cmd' lisp/*.el";
system($c1);
print STDERR "doc/org.texi\n";
$cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
$c1 = "perl -pi -e '$cmd' doc/org.texi";
system($c1);
print STDERR "doc/orgguide.texi\n";
$cmd = qq{s/^(\\\@set VERSION)\\s+(\\S+)[ \t]*\$/\$1 $version/;s/^(\\\@set DATE)\\s+(.*)\$/\$1 $date/;};
$c1 = "perl -pi -e '$cmd' doc/orgguide.texi";
system($c1);
print STDERR "doc/orgcard.tex\n";
$cmd = qq{s/^\\\\def\\\\orgversionnumber\\{\\S+\\}/\\\\def\\\\orgversionnumber{$version}/;s/\\\\def\\\\versionyear\\{\\S+\\}/\\\\def\\\\versionyear{$year}/;s/\\\\def\\\\year\\{\\S+\\}/\\\\def\\\\year{$year}/;};
$c1 = "perl -pi -e '$cmd' doc/orgcard.tex";
system($c1);
print STDERR "README\n";
$cmd = qq{s/^(The version of this release is:)\\s+(\\S+)[ \t]*\$/\$1 $version/;};
$c1 = "perl -pi -e '$cmd' README";
system($c1);
}