From 12ba664f0e69a5ca075ce63647d49a1ddcb3bfe4 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 1 Jun 2010 00:00:23 +0100 Subject: [PATCH 01/16] debian/rules: Remove `/usr/share/info/dir.gz'. The switch to GNU `install-info' from the dpkg version means that we generate a (largely bogus) `dir.gz' file. This gets picked up by `update-info-dir' and we lose the original `dir'. This in turn is a hopeless bummer because Emacs doesn't look for a `dir.gz' file, only an uncompressed `dir', and can't find any Info documents as a result. So terminate the offending file with extreme prejudice in the nick of time. --- debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/debian/rules b/debian/rules index da79b9ed..21eca792 100755 --- a/debian/rules +++ b/debian/rules @@ -5,3 +5,6 @@ include $(CDBS)/rules/debhelper.mk include $(CDBS)/class/autotools.mk DEB_BUILDDIR = build + +install/cfd:: + rm -f debian/cfd/usr/share/info/dir -- 2.11.0 From 1f74bcf6852709029674ec167b02502449ad8f36 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 1 Jun 2010 00:14:05 +0100 Subject: [PATCH 02/16] Release 1.3.6.1. --- debian/changelog | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 69039d7c..c02a6ef1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +cfd (1.3.6.1) experimental; urgency=low + + * Don't ship a /usr/share/info/dir.gz file, because it screws everything + up. + * Other minor distribution fettling. + + -- Mark Wooding Tue, 01 Jun 2010 00:13:46 +0100 + cfd (1.3.6) experimental; urgency=low * Support for Automake 1.11's `silent-rules' feature. -- 2.11.0 From 4fd54ed3c8cedc3f4d3fbe7f51a24eaaaa391aff Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 11 Jun 2011 19:31:53 +0100 Subject: [PATCH 03/16] mdw-setup: Fix regexp portability. The `\?' quantifier is a GNU extension. Apparently \{0,1\} is a more portable replacement. --- mdw-setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mdw-setup b/mdw-setup index f60a45ef..ab62f092 100755 --- a/mdw-setup +++ b/mdw-setup @@ -89,7 +89,7 @@ if [ "$configure" ]; then autoconf --force if grep >/dev/null 'AC_CONFIG_AUX_DIR' $configure; then auxdir=$( - sed -n 's:^.*AC_CONFIG_AUX_DIR(\[\?\([^])]*\)\]\?).*$:\1:p' $configure) + sed -n 's:^.*AC_CONFIG_AUX_DIR(\[\{0,1\}\([^])]*\)\]\{0,1\}).*$:\1:p' $configure) mkdir -p $auxdir fi grep >/dev/null 'A[MC]_CONFIG_HEADER' $configure && autoheader -- 2.11.0 From 407625c794eee748e4c2cb4ea52cc5467e0ed5be Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 5 Apr 2012 15:08:09 +0100 Subject: [PATCH 04/16] aclocal: Reinstate `mdw_TEXMF_DIR'. The version from the Autoconf archive has vanished. --- aclocal.glob | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/aclocal.glob b/aclocal.glob index c20cfac1..7c15e1ef 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -175,4 +175,33 @@ AC_ARG_WITH([man-ext], [manext=$withval], [manext=mLib]) AC_SUBST(manext)]) +dnl --- *@-mdw_DIR_TEXMF-@* --- +dnl +dnl Author: Mark Wooding +dnl +dnl Synopsis: mdw_DIR_TEXMF +dnl +dnl Arguments: --- +dnl +dnl Use: Sets the substitution `texmfdir' as a sensible TeX install +dnl tree. + +AC_DEFUN([mdw_DIR_TEXMF], [ +AC_ARG_WITH([texmfdir], +[ --with-texmfdir=DIR set the TeX install directory to DIR], +[texmfdir=$withval], +[AC_MSG_CHECKING([where to put installed TeX files]) +mdw_DEFINE_PATHS([ +texmfdir='${datadir}/texmf' +for d in \ + '${datadir}/texmf' '${prefix}/lib/texmf' \ + '${prefix}/texmf' '${libdir}/lib/texmf'; do + if test -d "mdw_PATH([$d])"; then + texmfdir=$d + break + fi +done +AC_MSG_RESULT([$texmfdir])])]) +AC_SUBST(texmfdir)]) + dnl----- That's all, folks --------------------------------- *@--GLOB-END--@* -- 2.11.0 From f3f9e1bbf0f94f4add7f8016bc6cc5a031c5ebac Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 5 Apr 2012 15:08:47 +0100 Subject: [PATCH 05/16] debian/rules: Switch to Debhelper for building. --- debian/.gitignore | 2 +- debian/compat | 1 + debian/control | 3 ++- debian/rules | 10 +--------- 4 files changed, 5 insertions(+), 11 deletions(-) create mode 100644 debian/compat diff --git a/debian/.gitignore b/debian/.gitignore index 8f178075..5b88400f 100644 --- a/debian/.gitignore +++ b/debian/.gitignore @@ -2,6 +2,6 @@ files *.debhelper tmp cfd -compat stamp-* *.log +*.substvars diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..45a4fb75 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control index cbe7595f..0355e9c2 100644 --- a/debian/control +++ b/debian/control @@ -2,11 +2,12 @@ Source: cfd Section: devel Priority: extra Maintainer: Mark Wooding +Build-Depends: debhelper (>> 8.9) Standards-Version: 3.1.1 Package: cfd Architecture: all -Recommends: autoconf (<< 2.50) | autoconf2.13, automake +Recommends: autoconf, automake Description: A collection of miscellaneous bits of build system. The common files distribution (CFD) contains standard boilerplate files and some handy autoconf macros. It also contains some scripts which diff --git a/debian/rules b/debian/rules index 21eca792..88179629 100755 --- a/debian/rules +++ b/debian/rules @@ -1,10 +1,2 @@ #! /usr/bin/make -f - -CDBS = /usr/share/cdbs/1 -include $(CDBS)/rules/debhelper.mk -include $(CDBS)/class/autotools.mk - -DEB_BUILDDIR = build - -install/cfd:: - rm -f debian/cfd/usr/share/info/dir +%:; dh $@ --builddirectory=debian/build -- 2.11.0 From d29994fb48747321b384f841cccd7be2b089373e Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 10 Apr 2012 10:52:13 +0100 Subject: [PATCH 06/16] gpl.texi, lgpl.texi: Headings must be at top level. --- gpl.texi | 9 +-------- lgpl.texi | 7 +------ 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/gpl.texi b/gpl.texi index 23ba2610..319d5d48 100644 --- a/gpl.texi +++ b/gpl.texi @@ -286,14 +286,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. -@iftex -@vskip -@baselineskip -@vskip -@baselineskip -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo +@center @b{NO WARRANTY} @item BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY diff --git a/lgpl.texi b/lgpl.texi index 2db17b4b..dd030beb 100644 --- a/lgpl.texi +++ b/lgpl.texi @@ -459,12 +459,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. -@iftex -@heading NO WARRANTY -@end iftex -@ifinfo -@center NO WARRANTY -@end ifinfo +@center @b{NO WARRANTY} @item BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -- 2.11.0 From 6780bad42e580fa88aa41f1b6ba33af764cec51b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 10 Apr 2012 10:42:10 +0100 Subject: [PATCH 07/16] Release 1.3.7. --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index c02a6ef1..6040c222 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +cfd (1.3.7) experimental; urgency=low + + * Reinstate mdw_PATH_TEXMF. + * Improve regexp portability. + + -- Mark Wooding Tue, 10 Apr 2012 10:41:47 +0100 + cfd (1.3.6.1) experimental; urgency=low * Don't ship a /usr/share/info/dir.gz file, because it screws everything -- 2.11.0 From ac02f540559129ed95a9f44e531b7d5e949a0214 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 5 Mar 2013 17:36:59 +0000 Subject: [PATCH 08/16] aclocal.glob: Clean up bad whitespace. --- aclocal.glob | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/aclocal.glob b/aclocal.glob index 7c15e1ef..35d78531 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -34,7 +34,7 @@ dnl dnl Arguments: --- dnl dnl Use: Defines an m4 macro AUTO_VERSION which contains the current -dnl version number, worked out in some clever way. +dnl version number, worked out in some clever way. AC_DEFUN([mdw_AUTO_VERSION], [nobody cares...]) m4_define([mdw_AUTO_VERSION], [m4_define([AUTO_VERSION], m4_esyscmd([ @@ -57,7 +57,7 @@ dnl dnl Arguments: --- dnl dnl Use: Decodes the PACKAGE_VERSION variable as a libtool -dnl version-info string. Strictly speaking, this is very +dnl version-info string. Strictly speaking, this is very dnl naughty. AC_DEFUN([mdw_LIBTOOL_VERSION_INFO], [ @@ -111,7 +111,7 @@ AC_DEFUN([mdw_DECL_ENVIRON], #endif], [mdw_cv_environ=yes], [mdw_cv_environ=no])]) if test $mdw_cv_environ = yes; then AC_DEFINE([DECL_ENVIRON], [1], - [Define if you have the `environ' vector of environment variables.]) + [Define if you have the `environ' vector of environment variables.]) fi]) dnl --- *@-mdw_DEFINE_PATHS-@* @@ -154,10 +154,10 @@ case "$t" in dnl esac; done; dnl echo "$t"`]) AC_DEFUN([mdw_DEFINE_PROG], - [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"], - [Program name for $2.])]) + [AC_DEFINE_UNQUOTED([$1], ["mdw_PROG([$2])"], + [Program name for $2.])]) AC_DEFUN([mdw_DEFINE_PATH], [AC_DEFINE_UNQUOTED([$1], ["mdw_PATH([$2])"], - [Pathname for $2.])]) + [Pathname for $2.])]) dnl --- *@-mdw_MANEXT-@* --- dnl -- 2.11.0 From e628825ade3480166013c03f76f6f5081d521e59 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 5 Mar 2013 17:44:45 +0000 Subject: [PATCH 09/16] debian/control: No, we don't need such a shiny `debhelper'. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 0355e9c2..056012d8 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: cfd Section: devel Priority: extra Maintainer: Mark Wooding -Build-Depends: debhelper (>> 8.9) +Build-Depends: debhelper (>> 8.0) Standards-Version: 3.1.1 Package: cfd -- 2.11.0 From 026f4519ff6a9045231822462e8d35e2dedd3120 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 5 Mar 2013 17:40:37 +0000 Subject: [PATCH 10/16] aclocal.glob (mdw_LIBTOOL_VERSION_INFO): Use most significant numbers! The regexp had an initial `.*', which causes the captures to pick up the rightmost version numbers, which is entirely wrong for brown-paper-bag releases. Release 1.3.8. --- aclocal.glob | 2 +- debian/changelog | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/aclocal.glob b/aclocal.glob index 35d78531..8aa3fcc7 100644 --- a/aclocal.glob +++ b/aclocal.glob @@ -62,7 +62,7 @@ dnl naughty. AC_DEFUN([mdw_LIBTOOL_VERSION_INFO], [ set -- $(echo $PACKAGE_VERSION | - sed 's:[^.*\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$]:\1 \2 \3:' + sed 's:[^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*$]:\1 \2 \3:' ) LIBTOOL_VERSION_INFO="$(expr $[]1 + $[]2):$[]3:$[]2" AC_SUBST([LIBTOOL_VERSION_INFO]) diff --git a/debian/changelog b/debian/changelog index 6040c222..7449e9d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +cfd (1.3.8) experimental; urgency=low + + * Fix `mdw_LIBTOOL_VERSION_INFO' to use the correct part of a four (or + more) component version number. + + -- Mark Wooding Tue, 05 Mar 2013 17:43:05 +0000 + cfd (1.3.7) experimental; urgency=low * Reinstate mdw_PATH_TEXMF. -- 2.11.0 From 657c75463f04c02c1fe70f54a49df7eb32111387 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 16 Mar 2013 14:22:49 +0000 Subject: [PATCH 11/16] Makefile.am: Ship `debian/compat'. Debhelper goes horribly wrong otherwise. --- Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.am b/Makefile.am index ede8e901..39cb00b3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -149,6 +149,7 @@ dist-hook:: ###-------------------------------------------------------------------------- ### Debian. +EXTRA_DIST += debian/compat EXTRA_DIST += debian/control EXTRA_DIST += debian/copyright EXTRA_DIST += debian/rules -- 2.11.0 From 02c378f34a03892e2db0277f6a9a64c1dc38b85a Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Thu, 14 Mar 2013 20:18:31 +0000 Subject: [PATCH 12/16] debian/rules: Don't ship `/usr/share/info/dir.gz'. It causes great disaster. --- debian/changelog | 6 ++++++ debian/rules | 9 ++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 7449e9d5..a542d4ab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cfd (1.3.9) experimental; urgency=low + + * Don't ship `/usr/share/info/dir.gz'. + + -- Mark Wooding Thu, 14 Mar 2013 20:25:49 +0000 + cfd (1.3.8) experimental; urgency=low * Fix `mdw_LIBTOOL_VERSION_INFO' to use the correct part of a four (or diff --git a/debian/rules b/debian/rules index 88179629..269f8518 100755 --- a/debian/rules +++ b/debian/rules @@ -1,2 +1,9 @@ #! /usr/bin/make -f -%:; dh $@ --builddirectory=debian/build + +BUILDDIR = debian/build + +%:; dh $@ --builddirectory=$(BUILDDIR) + +override_dh_auto_install: + make -C$(BUILDDIR) install DESTDIR=../cfd/ + rm -f debian/cfd/usr/share/info/dir -- 2.11.0 From fcc208c558816bbbf9df27f21b007c3f50dcdef5 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 Jun 2013 21:55:42 +0100 Subject: [PATCH 13/16] Crack down on whitespace badness. --- Makefile.am | 6 +++--- configure.ac | 8 ++++---- getdate.y | 20 ++++++++++---------- gpl.texi | 4 ++-- install-ac | 42 +++++++++++++++++++++--------------------- lgpl.tex | 2 +- lgpl.texi | 2 +- maninst | 6 +++--- texinice.tex | 4 ++-- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Makefile.am b/Makefile.am index 39cb00b3..ee272b3f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,17 +8,17 @@ ###----- Licensing notice --------------------------------------------------- ### ### This file is part of the Common Files Distribution (`common') -### +### ### `Common' is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. -### +### ### `Common' is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. -### +### ### You should have received a copy of the GNU General Public License ### along with `common'; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. diff --git a/configure.ac b/configure.ac index 2c11f694..f99af941 100644 --- a/configure.ac +++ b/configure.ac @@ -8,17 +8,17 @@ dnl dnl----- Licensing notice --------------------------------------------------- dnl dnl This file is part of the Common Files Distribution (`common') -dnl +dnl dnl `Common' is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 2 of the License, or dnl (at your option) any later version. -dnl +dnl dnl `Common' is distributed in the hope that it will be useful, dnl but WITHOUT ANY WARRANTY; without even the implied warranty of dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the dnl GNU General Public License for more details. -dnl +dnl dnl You should have received a copy of the GNU General Public License dnl along with `common'; if not, write to the Free Software Foundation, dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -27,7 +27,7 @@ dnl-------------------------------------------------------------------------- dnl Initialization. mdw_AUTO_VERSION -AC_INIT([Common Files Distribution], AUTO_VERSION, +AC_INIT([Common Files Distribution], AUTO_VERSION, [mdw@distorted.org.uk], [cfd]) AC_CONFIG_SRCDIR([mdw-setup]) AC_CONFIG_AUX_DIR([config]) diff --git a/getdate.y b/getdate.y index a9de9915..1a7c788a 100644 --- a/getdate.y +++ b/getdate.y @@ -371,7 +371,7 @@ relunit : tUNUMBER tYEAR_UNIT { ; number : tUNUMBER - { + { if (yyHaveTime && yyHaveDate && !yyHaveRel) yyYear = $1; else @@ -393,8 +393,8 @@ number : tUNUMBER } else { - yyHour = $1 / 100; - yyMinutes = $1 % 100; + yyHour = $1 / 100; + yyMinutes = $1 % 100; } yySeconds = 0; yyMeridian = MER24; @@ -924,13 +924,13 @@ get_date (p, now) { /* Guard against falsely reporting errors near the time_t boundaries - when parsing times in other time zones. For example, if the min - time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead - of UTC, then the min localtime value is 1970-01-01 08:00:00; if - we apply mktime to 1970-01-01 00:00:00 we will get an error, so - we apply mktime to 1970-01-02 08:00:00 instead and adjust the time - zone by 24 hours to compensate. This algorithm assumes that - there is no DST transition within a day of the time_t boundaries. */ + when parsing times in other time zones. For example, if the min + time_t value is 1970-01-01 00:00:00 UTC and we are 8 hours ahead + of UTC, then the min localtime value is 1970-01-01 08:00:00; if + we apply mktime to 1970-01-01 00:00:00 we will get an error, so + we apply mktime to 1970-01-02 08:00:00 instead and adjust the time + zone by 24 hours to compensate. This algorithm assumes that + there is no DST transition within a day of the time_t boundaries. */ #ifndef GETDATE_IGNORE_TIMEZONE if (yyHaveZone) diff --git a/gpl.texi b/gpl.texi index 319d5d48..5d0c579f 100644 --- a/gpl.texi +++ b/gpl.texi @@ -358,7 +358,7 @@ when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19@var{yy} @var{name of author} Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome -to redistribute it under certain conditions; type `show c' +to redistribute it under certain conditions; type `show c' for details. @end smallexample @@ -376,7 +376,7 @@ necessary. Here is a sample; alter the names: @group Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' -(which makes passes at compilers) written +(which makes passes at compilers) written by James Hacker. @var{signature of Ty Coon}, 1 April 1989 diff --git a/install-ac b/install-ac index 07de7dc1..b10dadde 100755 --- a/install-ac +++ b/install-ac @@ -12,10 +12,10 @@ case $mode in printf "Uninstalling aclocal fragments... " awk -v dir="$dir" ' /\*@-([a-zA-Z0-9][-a-zA-Z0-9_]*)-@\*/ { - out = $0; - sub(/^.*\*@-/, "", out); - sub(/-@\*.*$/, "", out); - system(sprintf("rm %s/%s.m4", dir, out)); + out = $0; + sub(/^.*\*@-/, "", out); + sub(/-@\*.*$/, "", out); + system(sprintf("rm %s/%s.m4", dir, out)); }' <"$glob" echo "done." ;; @@ -24,30 +24,30 @@ case $mode in awk -v dir="$dir" ' BEGIN { out = ""; delete files; notice = ""} /\*@--NOTICE--@\*/ { - if (out != "") close(out); - out = "NOTICE"; - notice = $0 "\n"; - next; + if (out != "") close(out); + out = "NOTICE"; + notice = $0 "\n"; + next; } /\*@-([a-zA-Z0-9][-a-zA-Z0-9_]*)-@\*/ { - if (out != "") close(out); - out = $0; - sub(/^.*\*@-/, "", out); - sub(/-@\*.*$/, "", out); - files[out] = 1; - out = sprintf("%s/%s.new", dir, out); - printf "%s", notice >(out); + if (out != "") close(out); + out = $0; + sub(/^.*\*@-/, "", out); + sub(/-@\*.*$/, "", out); + files[out] = 1; + out = sprintf("%s/%s.new", dir, out); + printf "%s", notice >(out); } /\*@--[-a-zA-Z0-9_]*-@\*/ { next; } { - if (out == "NOTICE") - notice = notice $0 "\n"; - else - if (out != "") print $0 >(out); + if (out == "NOTICE") + notice = notice $0 "\n"; + else + if (out != "") print $0 >(out); } END { - for (f in files) - system(sprintf("mv %s/%s.new %s/%s.m4", dir, f, dir, f)); + for (f in files) + system(sprintf("mv %s/%s.new %s/%s.m4", dir, f, dir, f)); }' <"$glob" echo "done." ;; diff --git a/lgpl.tex b/lgpl.tex index 2f850fce..f421d54b 100644 --- a/lgpl.tex +++ b/lgpl.tex @@ -192,7 +192,7 @@ Public License rather than by this special one. on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + \item [1.] You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate diff --git a/lgpl.texi b/lgpl.texi index dd030beb..5b9b2717 100644 --- a/lgpl.texi +++ b/lgpl.texi @@ -151,7 +151,7 @@ such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - + @item You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that diff --git a/maninst b/maninst index bdf5a0fe..cb238c54 100755 --- a/maninst +++ b/maninst @@ -39,14 +39,14 @@ for i; do for l in `sed 's:^\.\\\" *@::p; d' "$srcdir/$i"`; do case $op in install) - if [ "$l.$sec" != "$base" ]; then - echo -n "." + if [ "$l.$sec" != "$base" ]; then + echo -n "." echo ".so man$sec/$base$ext" >"$mandir/man$sec/$l.$sec$ext" chmod $mode "$mandir/man$sec/$l.$sec$ext" fi ;; uninstall) - rm -f "$mandir/man$sec/$l.$sec$ext" + rm -f "$mandir/man$sec/$l.$sec$ext" ;; esac done diff --git a/texinice.tex b/texinice.tex index bb2b6780..27b84cf2 100644 --- a/texinice.tex +++ b/texinice.tex @@ -11,12 +11,12 @@ % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 2 of the License, or % (at your option) any later version. -% +% % This file is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. -% +% % You should have received a copy of the GNU General Public License % along with this file; if not, write to the Free Software Foundation, % Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- 2.11.0 From f0c2c8a058f10da98831cdf5e67883813049b4f1 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 Jun 2013 21:56:57 +0100 Subject: [PATCH 14/16] mdwsetup.py: Fix the licensing header. --- mdwsetup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mdwsetup.py b/mdwsetup.py index 9ce67e62..b423c2a7 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -7,20 +7,20 @@ ###----- Licensing notice --------------------------------------------------- ### -### This file is part of the Python interface to mLib. +### This file is part of the Common Files Distribution (`common') ### -### mLib/Python is free software; you can redistribute it and/or modify +### `Common' is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### -### mLib/Python is distributed in the hope that it will be useful, +### `Common' is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License -### along with mLib/Python; if not, write to the Free Software Foundation, +### along with `common'; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import sys as SYS -- 2.11.0 From 2f8140f93e6672705e378e4588b21657f3098034 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 Jun 2013 22:02:50 +0100 Subject: [PATCH 15/16] mdwsetup.py: Use `with open(...) as f' instead of `try'/`finally'. --- mdwsetup.py | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/mdwsetup.py b/mdwsetup.py index b423c2a7..7b864c8a 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -23,6 +23,8 @@ ### along with `common'; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +from __future__ import with_statement + import sys as SYS import os as OS import re as RE @@ -143,16 +145,10 @@ def derive(target, source, substmap): return False print "making `%s' from `%s'" % (target, source) temp = target + '.new' - ft = open(temp, 'w') - try: - fs = open(source, 'r') - try: + with open(temp, 'w') as ft: + with open(source, 'r') as fs: for line in fs: ft.write(RX_SUBST.sub((lambda m: substmap[m.group(1)]), line)) - finally: - fs.close() - finally: - ft.close() OS.rename(temp, target) def generate(target, source = None): @@ -167,11 +163,8 @@ def generate(target, source = None): return print "making `%s' using `%s'" % (target, source) temp = target + '.new' - ft = open(temp, 'w') - try: + with open(temp, 'w') as ft: rc = SUB.call([SYS.executable, source], stdout = ft) - finally: - ft.close() if rc != 0: raise SubprocessFailure, (source, rc) OS.rename(temp, target) @@ -188,11 +181,7 @@ def auto_version(writep = True): """ version = progoutput(['./auto-version']) if writep: - ft = open('RELEASE.new', 'w') - try: - ft.write('%s\n' % version) - finally: - ft.close() + with open('RELEASE.new', 'w') as ft: ft.write('%s\n' % version) OS.rename('RELEASE.new', 'RELEASE') return version -- 2.11.0 From f74ba2bb507cfeadd5518d5468c7ab7281b581b7 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 15 Jun 2013 22:08:36 +0100 Subject: [PATCH 16/16] mdwsetup.py: Integrate better with `distutils'. * Move the file-generation functionality into new commands, and arrange to have them cleaned. * Override `sdist' to dereference symbolic links, rather than including them literally into tarballs (which breaks for out-of-tree links), and to write `RELEASE' into the tarball. * Add a command to extract the archive name, for release management. --- mdwsetup.py | 241 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 207 insertions(+), 34 deletions(-) diff --git a/mdwsetup.py b/mdwsetup.py index 7b864c8a..a6ca3f4a 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -31,6 +31,7 @@ import re as RE import subprocess as SUB import distutils.core as DC +import distutils.log as DL ###-------------------------------------------------------------------------- ### Random utilities. @@ -118,56 +119,74 @@ def pkg_config(pkg, version): ###-------------------------------------------------------------------------- ### Substituting variables in files. -def needs_update_p(target, sources): +class BaseGenFile (object): """ - Returns whether TARGET is out of date relative to its SOURCES. + A base class for file generators. - If TARGET exists and was modified more recentently than any of its SOURCES - then it doesn't need updating. + Instances of subclasses are suitable for listing in the `genfiles' + attribute, passed to `setup'. + + Subclasses need to implement `_gen', which should simply do the work of + generating the target file from its sources. This class will print + progress messages and check whether the target actually needs regenerating. """ - if not OS.path.exists(target): - return True - t_target = OS.stat(target).st_mtime - for source in sources: - if OS.stat(source).st_mtime >= t_target: - return True - return False + def __init__(me, target, sources = []): + me.target = target + me.sources = sources + def _needs_update_p(me): + if not OS.path.exists(me.target): return True + t_target = OS.stat(me.target).st_mtime + for s in me.sources: + if OS.stat(s).st_mtime >= t_target: return True + return False + def gen(me, dry_run_p = False): + if not me._needs_update_p(): return + DL.log(DL.INFO, "generate `%s' from %s", me.target, + ', '.join("`%s'" % s for s in me.sources)) + if not dry_run_p: me._gen() + def clean(me, dry_run_p): + if not OS.path.exists(me.target): return + DL.log(DL.INFO, "delete `%s'", me.target) + if not dry_run_p: OS.remove(me.target) -RX_SUBST = RE.compile(r'\%(\w+)\%') -def derive(target, source, substmap): +class Derive (BaseGenFile): """ Derive TARGET from SOURCE by making simple substitutions. The SOURCE may contain markers %FOO%; these are replaced by SUBSTMAP['FOO'] in the TARGET file. """ - if not needs_update_p(target, [source]): - return False - print "making `%s' from `%s'" % (target, source) - temp = target + '.new' - with open(temp, 'w') as ft: - with open(source, 'r') as fs: - for line in fs: - ft.write(RX_SUBST.sub((lambda m: substmap[m.group(1)]), line)) - OS.rename(temp, target) + RX_SUBST = RE.compile(r'\%(\w+)\%') + def __init__(me, target, source, substmap): + BaseGenFile.__init__(me, target, [source]) + me._map = substmap + def _gen(me): + temp = me.target + '.new' + with open(temp, 'w') as ft: + with open(me.sources[0], 'r') as fs: + for line in fs: + ft.write(me.RX_SUBST.sub((lambda m: me._map[m.group(1)]), line)) + OS.rename(temp, me.target) -def generate(target, source = None): +class Generate (BaseGenFile): """ Generate TARGET by running the SOURCE Python script. If SOURCE is omitted, replace the extension of TARGET by `.py'. """ - if source is None: - source = OS.path.splitext(target)[0] + '.py' - if not needs_update_p(target, [source]): - return - print "making `%s' using `%s'" % (target, source) - temp = target + '.new' - with open(temp, 'w') as ft: - rc = SUB.call([SYS.executable, source], stdout = ft) - if rc != 0: - raise SubprocessFailure, (source, rc) - OS.rename(temp, target) + def __init__(me, target, source = None): + if source is None: source = OS.path.splitext(target)[0] + '.py' + BaseGenFile.__init__(me, target, [source]) + def _gen(me): + temp = me.target + '.new' + with open(temp, 'w') as ft: + rc = SUB.call([SYS.executable, me.sources[0]], stdout = ft) + if rc != 0: raise SubprocessFailure, (source, rc) + OS.rename(temp, me.target) + +## Backward compatibility. +def derive(target, source, substmap): Derive(target, source, substmap).gen() +def generate(target, source = None): Generate(target, source).gen() ###-------------------------------------------------------------------------- ### Discovering version numbers. @@ -178,6 +197,10 @@ def auto_version(writep = True): As a side-effect, if WRITEP is true, then write the version number to the RELEASE file so that it gets included in distributions. + + All of this is for backwards compatibility. New projects should omit the + `version' keyword entirely and let `setup' discover it and write it into + tarballs automatically. """ version = progoutput(['./auto-version']) if writep: @@ -185,4 +208,154 @@ def auto_version(writep = True): OS.rename('RELEASE.new', 'RELEASE') return version +###-------------------------------------------------------------------------- +### Adding new commands. + +CMDS = {} + +class CommandClass (type): + """ + Metaclass for command classes: automatically adds them to the `CMDS' map. + """ + def __new__(cls, name, supers, dict): + c = super(CommandClass, cls).__new__(cls, name, supers, dict) + try: name = c.NAME + except AttributeError: pass + else: CMDS[name] = c + return c + +class Command (DC.Command, object): + """ + Base class for `mdwsetup' command classes. + + This provides the automatic registration machinery, via the metaclass, and + also trivial implementations of various responsibilities of `DC.Command' + methods and attributes. + """ + __metaclass__ = CommandClass + user_options = [] + def initialize_options(me): pass + def finalize_options(me): pass + def run_subs(me): + for s in me.get_sub_commands(): me.run_command(s) + +###-------------------------------------------------------------------------- +### Some handy new commands. + +class distdir (Command): + NAME = 'distdir' + description = "print the distribution directory name to stdout" + def run(me): + d = me.distribution + print '%s-%s' % (d.get_name(), d.get_version()) + +class build_gen(Command): + """ + Generate files, according to the `genfiles'. + + The `genfiles' keyword argument to `setup' lists a number of objects which + guide the generation of output files. These objects must implement the + following methods. + + clean(DRY_RUN_P) Remove the output files. + + gen(DRY_RUN_P) Generate the output files, if they don't exist or are + out of date with respect to their prerequisites. + + If DRY_RUN_P is true then the methods must not actually do anything with a + lasting effect, but should print progress messages as usual. + """ + NAME = 'build_gen' + description = "build generated source files" + def run(me): + d = me.distribution + for g in d.genfiles: g.gen(dry_run_p = me.dry_run) + +from distutils.command.build import build as _build +class build (_build, Command): + ## Add `build_gen' early in the list of subcommands. + NAME = 'build' + sub_commands = [('build_gen', lambda me: me.distribution.genfiles)] + sub_commands += _build.sub_commands + +class clean_gen(Command): + """ + Remove the generated files, as listed in `genfiles'. + + See the `build_gen' command for more detailed information. + """ + NAME = 'clean_gen' + description = "clean generated source files" + def run(me): + d = me.distribution + for g in d.genfiles: g.clean(dry_run_p = me.dry_run) + +class clean_others(Command): + """ + Remove the files listed in the `cleanfiles' argument to `setup'. + """ + NAME = 'clean_others' + description = "clean miscellaneous output files" + def run(me): + d = me.distribution + for f in d.cleanfiles: + if not OS.path.exists(f): continue + DL.log(DL.INFO, "delete `%s'", f) + if not me.dry_run: OS.remove(f) + +from distutils.command.clean import clean as _clean +class clean (_clean, Command): + ## Add `clean_gen' and `clean_others' to the list of subcommands. + NAME = 'clean' + sub_commands = [('clean_gen', lambda me: me.distribution.genfiles), + ('clean_others', lambda me: me.distribution.cleanfiles)] + sub_commands += _clean.sub_commands + def run(me): + me.run_subs() + _clean.run(me) + +from distutils.command.sdist import sdist as _sdist +class sdist (_sdist, Command): + ## Write a `RELEASE' file to the output, if we extracted the version number + ## from version control. Also arrange to dereference symbolic links while + ## copying. Symlinks to directories will go horribly wrong, so don't do + ## that. + NAME = 'sdist' + def make_release_tree(me, base_dir, files): + _sdist.make_release_tree(me, base_dir, files) + d = me.distribution + if d._auto_version_p: + v = d.metadata.get_version() + DL.log(DL.INFO, "write `RELEASE' file: %s" % v) + with open(OS.path.join(base_dir, 'RELEASE'), 'w') as f: + f.write('%s\n' % v) + def copy_file(me, infile, outfile, link = None, *args, **kw): + if OS.path.islink(infile): link = None + return _sdist.copy_file(me, infile, outfile, link = link, *args, **kw) + +###-------------------------------------------------------------------------- +### Our own version of `setup'. + +class Dist (DC.Distribution): + ## Like the usual version, but with some additional attributes to support + ## our enhanced commands. + def __init__(me, attrs = None): + me.genfiles = [] + me.cleanfiles = [] + me._auto_version_p = False + DC.Distribution.__init__(me, attrs) + if me.metadata.version is None: + me.metadata.version = auto_version(writep = False) + me._auto_version_p = True + me.cleanfiles = set(me.cleanfiles) + me.cleanfiles.add('MANIFEST') + +def setup(cmdclass = {}, distclass = Dist, **kw): + ## Like the usual version, but provides defaults more suited to our + ## purposes. + cmds = dict() + cmds.update(CMDS) + cmds.update(cmdclass) + DC.setup(cmdclass = cmds, distclass = distclass, **kw) + ###----- That's all, folks -------------------------------------------------- -- 2.11.0