chiark / gitweb /
Remove dependencies on Subversion.
authorSimon Tatham <anakin@pobox.com>
Wed, 24 Sep 2014 10:33:21 +0000 (10:33 +0000)
committerSimon Tatham <anakin@pobox.com>
Wed, 24 Sep 2014 10:33:21 +0000 (10:33 +0000)
I'm going through all my projects and reworking them to avoid
depending on the monotonic integer-valued source control revision
identifier provided by Subversion, so I can migrate everything to git
without my builds and versioning breaking.

Puzzles's version number is now of the form YYYYMMDD.vvvvvv, where
vvvvvv is some string of source control information (currently still
the SVN-style "rNNNNN", but free to change in future). The date
provides monotonicity between my official automated builds, and the
second component is the one I'll be most interested in when people
send bug reports.

[originally from svn r10263]

Buildscr
Recipe
chm.but
configure.ac
makedist.sh
puzzles.but
version.c
winiss.pl

index 4d86ba62a2a39bd884e83a04df8a5243c246d81f..947102d5678ae8df88c7f452fb5e03512d1c527b 100644 (file)
--- a/Buildscr
+++ b/Buildscr
@@ -3,10 +3,17 @@
 
 module puzzles
 
+set Version $(!builddate).$(vcsid)
+
 # Start by substituting the right version number in configure.ac.
-in puzzles do perl -i~ -pe 's/rNNNN/r$(revision)/' configure.ac
+in puzzles do perl -i~ -pe 's/6.66/$(Version)/' configure.ac
 in puzzles do rm configure.ac~
 
+# And put it into the documentation as a versionid.
+# use perl to avoid inconsistent behaviour of echo '\v'
+in puzzles do perl -e 'print "\n\\versionid Simon Tatham'\''s Portable Puzzle Collection, version $$ARGV[0]\n"' $(Version) >> puzzles.but
+in puzzles do perl -e 'print "\n\\versionid Simon Tatham'\''s Portable Puzzle Collection, version $$ARGV[0]\n"' $(Version) >> devel.but
+
 # First build some local binaries, to run the icon build.
 in puzzles do perl mkfiles.pl -U
 in puzzles do make
@@ -28,7 +35,7 @@ in puzzles do ./mkauto.sh
 # Build the OS X .dmg archive.
 delegate osx
   in puzzles do make -f Makefile.osx clean
-  in puzzles do make -f Makefile.osx release VER=-DREVISION=$(revision)
+  in puzzles do make -f Makefile.osx release VER=-DVER=$(Version)
   return puzzles/Puzzles.dmg
 enddelegate
 
@@ -36,14 +43,14 @@ enddelegate
 in puzzles do make -f Makefile.doc clean
 in puzzles do make -f Makefile.doc chm
 in puzzles do make -f Makefile.doc # build help file for installer
-in puzzles do perl winiss.pl $(revision) gamedesc.txt > puzzles.iss
+in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss
 delegate windows
   # Ignore the poorly controlled return value from HHC, and instead
   # just test that the output file was generated.
   in puzzles do hhc puzzles.hhp; test -f puzzles.chm
   # FIXME: Cygwin alternative?
   in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc clean'
-  in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc VER=-DREVISION=$(revision)'
+  in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc VER=-DVER=$(Version)'
   # Build installer.
   in puzzles do iscc puzzles.iss
   return puzzles/puzzles.chm
@@ -76,7 +83,7 @@ in puzzles do chmod +x *.exe
 #in puzzles do perl wceinf.pl gamedesc.txt > puzzles.inf
 #delegate windows
 #  in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce clean'
-#  in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce VER=-DREVISION=$(revision)'
+#  in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce VER=-DVER=$(Version)'
 #  # Nasty piece of sh here which saves the return code from cabwiz,
 #  # outputs its errors and/or warnings, and then propagates the
 #  # return code back to bob. If only cabwiz could output to
@@ -107,7 +114,7 @@ in puzzles do zip -j puzzles.zip winbin/*.exe puzzles.chm puzzles.hlp puzzles.cn
 
 # Create the source archive. (That writes the archive into the
 # _parent_ directory, so be careful when we deliver it.)
-in puzzles do ./makedist.sh $(revision)
+in puzzles do ./makedist.sh $(Version)
 
 ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl -i~ -pe 'print "!srcdir unfinished/\n" if /!srcdir icons/' Recipe
 ifneq "$(JAVA_UNFINISHED)" "" in puzzles do ln -s unfinished/group.R .
@@ -115,7 +122,7 @@ ifneq "$(JAVA_UNFINISHED)" "" in puzzles do perl mkfiles.pl
 
 # Build the Java applets.
 delegate nestedvm
-  in puzzles do make -f Makefile.nestedvm NESTEDVM="$$NESTEDVM" VER=-DREVISION=$(revision)
+  in puzzles do make -f Makefile.nestedvm NESTEDVM="$$NESTEDVM" VER=-DVER=$(Version)
   return puzzles/*.jar
 enddelegate
 
@@ -134,7 +141,7 @@ in puzzles do echo "AddType application/octet-stream .chm" > .htaccess
 in puzzles do echo "AddType application/octet-stream .hlp" >> .htaccess
 in puzzles do echo "AddType application/octet-stream .cnt" >> .htaccess
 in . do set -- puzzles*.tar.gz; echo RedirectMatch temp '(.*/)'puzzles.tar.gz '$$1'"$$1" >> puzzles/.htaccess
-in puzzles do echo RedirectMatch temp '(.*/)'puzzles-installer.exe '$$1'puzzles-r$(revision)-installer.exe >> .htaccess
+in puzzles do echo RedirectMatch temp '(.*/)'puzzles-installer.exe '$$1'puzzles-$(Version)-installer.exe >> .htaccess
 
 # Phew, we're done. Deliver everything!
 deliver puzzles/icons/*-web.png $@
@@ -147,7 +154,7 @@ deliver puzzles/puzzles.chm $@
 deliver puzzles/puzzles.hlp $@
 deliver puzzles/puzzles.cnt $@
 deliver puzzles/puzzles.zip $@
-deliver puzzles/Output/setup.exe puzzles-r$(revision)-installer.exe
+deliver puzzles/Output/setup.exe puzzles-$(Version)-installer.exe
 deliver puzzles/*.jar java/$@
 deliver puzzles/js/*.js js/$@
 deliver puzzles/html/*.html html/$@
diff --git a/Recipe b/Recipe
index e6af51d4517aba8581f737fa4210005488eaa855..0d9e2a32dda14d73a34ba5e66d51d718d21bfa6d 100644 (file)
--- a/Recipe
+++ b/Recipe
@@ -118,8 +118,6 @@ version.o: version.c version2.def
 version2.def: FORCE
        if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
                cat version.def > version2.def.new; \
-       elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
-               echo "-DREVISION=`svnversion .`" >version2.def.new; \
        else \
                echo "$(VER)" >version2.def.new; \
        fi && \
@@ -136,7 +134,7 @@ version2.def: FORCE
 # backtick expression. We also force rebuilding via a -D option that
 # makes version.o include empty.h, which we construct ourselves and
 # touch whenever any source file is updated.
-!cflags am version $(VER) -DINCLUDE_EMPTY_H `if test -z "$(VER)" && (cd $(srcdir) && test -f manifest && md5sum -c manifest >/dev/null 2>&1); then cat $(srcdir)/version.def; elif test -z "$(VER)" && test -d $(srcdir)/.svn && svnversion $(srcdir) >/dev/null 2>&1; then echo "-DREVISION=\`svnversion $(srcdir)\`"; else echo "$(VER)"; fi`
+!cflags am version -DINCLUDE_EMPTY_H `if test -z "$(VER)" && (cd $(srcdir) && test -f manifest && md5sum -c manifest >/dev/null 2>&1); then cat $(srcdir)/version.def; else echo "$(VER)"; fi`
 !begin am
 BUILT_SOURCES = empty.h
 CLEANFILES = empty.h
@@ -156,8 +154,6 @@ version.o: version.c version2.def
 version2.def: FORCE
        if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
                cat version.def > version2.def.new; \
-       elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
-               echo "-DREVISION=`svnversion .`" >version2.def.new; \
        else \
                echo "$(VER)" >version2.def.new; \
        fi && \
@@ -180,8 +176,6 @@ version.i386.o: version.c version2.def
 version2.def: FORCE
        if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
                cat version.def > version2.def.new; \
-       elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
-               echo "-DREVISION=`svnversion .`" >version2.def.new; \
        else \
                echo "$(VER)" >version2.def.new; \
        fi && \
diff --git a/chm.but b/chm.but
index a28384dca27eedce3dfea17ce0bdcbd220a474a6..e0237044e4a87cbdd625c744255cac3d1ccecc56 100644 (file)
--- a/chm.but
+++ b/chm.but
@@ -19,5 +19,3 @@
 \cfg{html-body-end}{}
 
 \cfg{html-head-end}{<link rel="stylesheet" type="text/css" href="chm.css">}
-
-\versionid $Id$
index 4281e965c53e39229330989044dd8411a74defc3..49dc5c64df623af24da851656af6ee68a9d27c67 100644 (file)
@@ -1,6 +1,6 @@
 dnl Configure script for the Unix GTK build of puzzles.
 
-AC_INIT([puzzles], rNNNN, [anakin@pobox.com])
+AC_INIT([puzzles], [6.66], [anakin@pobox.com])
 AC_CONFIG_SRCDIR([midend.c])
 AM_INIT_AUTOMAKE([foreign])
 AC_PROG_CC
index 3b87bff329e344a144dd721b0339f1ecd947355c..65eb51987bcd535fc4363948447ceb54d8d54fb4 100755 (executable)
@@ -2,27 +2,15 @@
 
 # Build a Unix source distribution from the Puzzles SVN area.
 #
-# Pass a numeric argument to have the archive tagged as that SVN
-# revision. Otherwise, the script will work it out itself by
-# calling `svnversion', or failing that it will not version-tag the
+# Pass a version number argument to have the archive tagged with that
+# version number. Otherwise, the script will not version-tag the
 # archive at all.
 
-case "$#" in
-  0)
-    # Ignore errors; if we can't get a version, we'll have a blank
-    # string.
-    rev=`svnversion . 2>/dev/null`
-    if test "x$rev" = "xexported"; then rev=; fi
-    ;;
-  *)
-    case "$1" in *[!0-9M]*) echo "Malformed revision number '$1'">&2;exit 1;;esac
-    rev="$1"
-    ;;
-esac
+version="$1"
 
-if test "x$rev" != "x"; then
-  arcsuffix="-r$rev"
-  ver="-DREVISION=$rev"
+if test "x$version" != "x"; then
+  arcsuffix="-$version"
+  ver="-DVER=$version"
 else
   arcsuffix=
   ver=
@@ -45,7 +33,8 @@ for i in *.c *.m *.h *.R *.rc *.but *.plist *.icns LICENCE README Recipe \
   HACKING puzzles.txt puzzles.hlp puzzles.cnt puzzles.chm \
   icons/Makefile icons/*.{sav,pl,sh} icons/win16pal.xpm \
   icons/*.png icons/*.ico icons/*.rc icons/*.c \
-  configure.ac mkauto.sh aclocal.m4 configure depcomp install-sh missing; do
+  configure.ac mkauto.sh aclocal.m4 \
+  configure depcomp install-sh missing compile; do
   case $i in
     */*) ln -s ../../../$i tmp.$$/puzzles$arcsuffix/$i;;
     *)   ln -s ../../$i tmp.$$/puzzles$arcsuffix/$i;;
index fb0e4829a85b5e057efc88570f6c5ffdd4fd8187..3d0597faf09c13f44e9c9893fc2f0ffd3b4d956c 100644 (file)
@@ -36,8 +36,6 @@ See \k{licence} for the licence text in full.
 
 \cfg{html-local-head}{<meta name="AppleTitle" content="Puzzles Help">}
 
-\versionid $Id$
-
 \C{intro} Introduction
 
 I wrote this collection because I thought there should be more small
index 590e5879f9c94f0ce180b68dd891c2fe9a0712eb..1dde602942947cebabb7fa3bc9fac5fa8f66cf98 100644 (file)
--- a/version.c
+++ b/version.c
@@ -21,9 +21,9 @@
 # include "empty.h"
 #endif
 
-#if defined REVISION
+#if defined VER
 
-char ver[] = "Revision: r" STR(REVISION);
+char ver[] = "Version: " STR(VER);
 
 #else
 
index 9e796e04322e6c755030e063a20f0d9459737171..449916c8ea0ddaada68ed18ee1bad6b4e8a66904 100755 (executable)
--- a/winiss.pl
+++ b/winiss.pl
@@ -6,15 +6,27 @@
 
 # Usage:
 #
-#   $ ./winiss.pl 1234 gamedesc.txt > puzzles.iss
+#   $ ./winiss.pl 20140922.sdfsdf gamedesc.txt > puzzles.iss
 #
-# where `1234' is the revision number which will be encoded in the
-# installer's version indicators.
+# where the first argument is the version number which will be encoded
+# in the installer's version indicators. The first component of that
+# version number will be expected to be a YYYYMMDD-format date.
 
 use warnings;
+use Time::Local;
+
+$ver = shift @ARGV;
+
+# Parse the date out of $ver, and convert it into an integer number of
+# days since an arbitrary epoch. This number is used for the Windows
+# version resource (which wants a monotonic 16-bit integer). The epoch
+# is chosen so that the first build using this date-based mechanism
+# has a higher number than the last build in which that number was
+# derived from a Subversion revision.
+die "bad date format" if $ver !~ /^(\d{4})(\d{2})(\d{2})/;
+$date = timegm(0,0,0,$3,$2-1,$1);
+$integer_date = int($date / 86400) - 6000;
 
-$rev = shift @ARGV;
-($revclean=$rev) =~ s/M$//;
 $desc = shift @ARGV;
 open DESC, "<", $desc;
 while (<DESC>) {
@@ -31,10 +43,10 @@ print '; -- Inno Setup installer script for Puzzles.'."\n";
 print ''."\n";
 print '[Setup]'."\n";
 print 'AppName=Simon Tatham\'s Portable Puzzle Collection'."\n";
-print 'AppVerName=Puzzles revision '.$rev."\n";
-print 'VersionInfoTextVersion=Revision '.$rev."\n";
-print 'AppVersion=r'.$rev."\n";
-print 'VersionInfoVersion=0.0.'.$revclean.'.0'."\n";
+print 'AppVerName=Puzzles version '.$ver."\n";
+print 'VersionInfoTextVersion=Version '.$ver."\n";
+print 'AppVersion=r'.$ver."\n";
+print 'VersionInfoVersion=0.0.'.$integer_date.'.0'."\n";
 print 'AppPublisher=Simon Tatham'."\n";
 print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n";
 print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n";