]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Autogenerate licence text in doc subdir from LICENCE.
authorSimon Tatham <anakin@pobox.com>
Thu, 25 Feb 2016 20:45:27 +0000 (20:45 +0000)
committerSimon Tatham <anakin@pobox.com>
Mon, 29 Feb 2016 19:59:35 +0000 (19:59 +0000)
Now we have licence.pl, it seems to me to make very good sense to have
it generate the Halibut form(s) of the licence and copyright year as
well as the source-code forms.

As a result, I believe _no_ copies of the licence text or copyright
date exist any more except for the master one in LICENCE - so I can
completely remove the checklist section about all the places to update
it, because there's only one. Hooray!

(cherry picked from commit 774d37a0dc79441d6add265a0d360af3e53f8460)

Conflicts:
doc/licence.but

(cherry-picker's note: the conflict was just because the deleted file
didn't have identical contents)

.gitignore
CHECKLST.txt
doc/Makefile
doc/blurb.but
doc/licence.but [deleted file]
licence.pl

index 05d3b2c327030d0bd2574ea3b693b02dafdea2c5..f4b14901f22d7884366d78db09f7ae7561a4b475 100644 (file)
@@ -79,6 +79,7 @@
 /doc/*.hhp
 /doc/*.hhc
 /doc/*.hhk
+/doc/licence.but
 /icons/*.png
 /icons/*.ico
 /icons/*.xpm
index 034f570863fb57385806cc42ef7ee874b023bd09..35de3368d2a8ada313d39f64a13164b301e20c2a 100644 (file)
@@ -1,23 +1,6 @@
 Checklists for PuTTY administrative procedures
 ==============================================
 
-Locations of the licence
-------------------------
-
-The PuTTY copyright notice and licence are stored in multiple
-places. At the start of a new year, the copyright year needs
-updating in all of them; and when someone sends a massive patch,
-their name needs adding in all of them too.
-
-The LICENCE file in the main source distribution:
-
- - putty/LICENCE
-
-The documentation (both the preamble blurb and the licence appendix):
-
- - putty/doc/blurb.but
- - putty/doc/licence.but
-
 Preparing to make a release
 ---------------------------
 
index 96a19eb175a55273b0f46eae835065f55c0511a5..37d8b0c1aee5dcdd6ec6876b0cf28b3a6e771482 100644 (file)
@@ -34,8 +34,8 @@ else
 VERSIONIDS=vids
 endif
 
-CHAPTERS := $(SITE) blurb intro gs using config pscp psftp plink pubkey
-CHAPTERS += pageant errors faq feedback licence udp pgpkeys sshnames
+CHAPTERS := $(SITE) copy blurb intro gs using config pscp psftp plink
+CHAPTERS += pubkey pageant errors faq feedback licence udp pgpkeys sshnames
 CHAPTERS += index $(VERSIONIDS)
 
 INPUTS = $(patsubst %,%.but,$(CHAPTERS))
index d04c4ddb5d9d10d14fe3869e234b1bce2be18677..4e3ccf71869fc9d5db5ec6bb7a8a6a4f5c047069 100644 (file)
@@ -31,6 +31,6 @@ features not described here; and the \i\cw{pterm} and command-line
 Unix-specific documentation that currently exists is the
 \I{man pages for PuTTY tools}man pages.
 
-\copyright This manual is copyright 2001-2015 Simon Tatham. All
+\copyright This manual is copyright \shortcopyrightdetails. All
 rights reserved. You may distribute this documentation under the MIT
 licence. See \k{licence} for the licence text in full.
diff --git a/doc/licence.but b/doc/licence.but
deleted file mode 100644 (file)
index 0856d86..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-\A{licence} PuTTY \ii{Licence}
-
-PuTTY is \i{copyright} 1997-2015 Simon Tatham.
-
-Portions copyright Robert de Bath, Joris van Rantwijk, Delian
-Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
-Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus
-Kuhn, Colin Watson, and CORE SDI S.A.
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation files
-(the \q{Software}), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, sublicense, and/or sell copies of the Software,
-and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED \q{AS IS}, WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
index 12d38a559fc684a9ea30eb0a5d666df661c4bfe6..e1d3a51f95bde03964431f75d65c14238a02dfbc 100644 (file)
@@ -2,24 +2,14 @@
 
 # This script generates licence.h (containing the PuTTY licence in the
 # form of macros expanding to C string literals) from the LICENCE
-# master file.
+# master file. It also regenerates the licence-related Halibut input
+# files.
 
 use File::Basename;
 
+# Read the input file.
 $infile = "LICENCE";
-$outfile = "licence.h";
 open my $in, $infile or die "$infile: open: $!\n";
-open my $out, ">", $outfile or die "$outfile: open: $!\n";
-select $out;
-
-print "/*\n";
-print " * $outfile - macro definitions for the PuTTY licence.\n";
-print " *\n";
-print " * Generated by @{[basename __FILE__]} from $infile.\n";
-print " * You should edit those files rather than editing this one.\n";
-print " */\n";
-print "\n";
-
 my @lines = ();
 while (<$in>) {
     chomp;
@@ -41,6 +31,25 @@ for my $line (@lines) {
     }
 }
 
+# Get the copyright years and short form of copyright holder.
+die "bad format of first paragraph\n"
+    unless $paras[0] =~ m!copyright ([^\.]*)\.!i;
+$shortdetails = $1;
+
+# Write out licence.h.
+
+$outfile = "licence.h";
+open my $out, ">", $outfile or die "$outfile: open: $!\n";
+select $out;
+
+print "/*\n";
+print " * $outfile - macro definitions for the PuTTY licence.\n";
+print " *\n";
+print " * Generated by @{[basename __FILE__]} from $infile.\n";
+print " * You should edit those files rather than editing this one.\n";
+print " */\n";
+print "\n";
+
 print "#define LICENCE_TEXT(parsep) \\\n";
 for my $i (0..$#paras) {
     my $lit = &stringlit($paras[$i]);
@@ -51,10 +60,7 @@ for my $i (0..$#paras) {
 }
 print "\n";
 
-die "bad format of first paragraph\n"
-    unless $paras[0] =~ m!copyright ([^\.]*)\.!i;
-
-printf "#define SHORT_COPYRIGHT_DETAILS \"%s\"\n", &stringlit($1);
+printf "#define SHORT_COPYRIGHT_DETAILS \"%s\"\n", &stringlit($shortdetails);
 
 sub stringlit {
     my ($lit) = @_;
@@ -62,3 +68,48 @@ sub stringlit {
     $lit =~ s!"!\\"!g;
     return $lit;
 }
+
+close $out;
+
+# Write out doc/licence.but.
+
+$outfile = "doc/licence.but";
+open $out, ">", $outfile or die "$outfile: open: $!\n";
+select $out;
+
+print "\\# Generated by @{[basename __FILE__]} from $infile.\n";
+print "\\# You should edit those files rather than editing this one.\n\n";
+
+print "\\A{licence} PuTTY \\ii{Licence}\n\n";
+
+for my $i (0..$#paras) {
+    my $para = &halibutescape($paras[$i]);
+    if ($i == 0) {
+        $para =~ s!copyright!\\i{copyright}!; # index term in paragraph 1
+    }
+    print "$para\n\n";
+}
+
+close $out;
+
+# And write out doc/copy.but, which defines a macro used in the manual
+# preamble blurb.
+
+$outfile = "doc/copy.but";
+open $out, ">", $outfile or die "$outfile: open: $!\n";
+select $out;
+
+print "\\# Generated by @{[basename __FILE__]} from $infile.\n";
+print "\\# You should edit those files rather than editing this one.\n\n";
+
+printf "\\define{shortcopyrightdetails} %s\n\n",
+    &halibutescape($shortdetails);
+
+close $out;
+
+sub halibutescape {
+    my ($text) = @_;
+    $text =~ s![\\{}]!\\$&!g; # Halibut escaping
+    $text =~ s!"([^"]*)"!\\q{$1}!g; # convert quoted strings to \q{}
+    return $text;
+}