Remove dependencies on Subversion.

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]
This commit is contained in:
Simon Tatham
2014-09-24 10:33:21 +00:00
parent bc930a1214
commit 2ebbdbf2a5
8 changed files with 49 additions and 51 deletions

View File

@ -3,10 +3,17 @@
module puzzles module puzzles
set Version $(!builddate).$(vcsid)
# Start by substituting the right version number in configure.ac. # 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~ 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. # First build some local binaries, to run the icon build.
in puzzles do perl mkfiles.pl -U in puzzles do perl mkfiles.pl -U
in puzzles do make in puzzles do make
@ -28,7 +35,7 @@ in puzzles do ./mkauto.sh
# Build the OS X .dmg archive. # Build the OS X .dmg archive.
delegate osx delegate osx
in puzzles do make -f Makefile.osx clean 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 return puzzles/Puzzles.dmg
enddelegate enddelegate
@ -36,14 +43,14 @@ enddelegate
in puzzles do make -f Makefile.doc clean in puzzles do make -f Makefile.doc clean
in puzzles do make -f Makefile.doc chm in puzzles do make -f Makefile.doc chm
in puzzles do make -f Makefile.doc # build help file for installer 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 delegate windows
# Ignore the poorly controlled return value from HHC, and instead # Ignore the poorly controlled return value from HHC, and instead
# just test that the output file was generated. # just test that the output file was generated.
in puzzles do hhc puzzles.hhp; test -f puzzles.chm in puzzles do hhc puzzles.hhp; test -f puzzles.chm
# FIXME: Cygwin alternative? # FIXME: Cygwin alternative?
in puzzles do cmd /c 'vcvars32 & nmake -f Makefile.vc clean' 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. # Build installer.
in puzzles do iscc puzzles.iss in puzzles do iscc puzzles.iss
return puzzles/puzzles.chm return puzzles/puzzles.chm
@ -76,7 +83,7 @@ in puzzles do chmod +x *.exe
#in puzzles do perl wceinf.pl gamedesc.txt > puzzles.inf #in puzzles do perl wceinf.pl gamedesc.txt > puzzles.inf
#delegate windows #delegate windows
# in puzzles do cmd /c 'wcearmv4 & nmake -f Makefile.wce clean' # 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, # # Nasty piece of sh here which saves the return code from cabwiz,
# # outputs its errors and/or warnings, and then propagates the # # outputs its errors and/or warnings, and then propagates the
# # return code back to bob. If only cabwiz could output to # # 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 # Create the source archive. (That writes the archive into the
# _parent_ directory, so be careful when we deliver it.) # _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 perl -i~ -pe 'print "!srcdir unfinished/\n" if /!srcdir icons/' Recipe
ifneq "$(JAVA_UNFINISHED)" "" in puzzles do ln -s unfinished/group.R . 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. # Build the Java applets.
delegate nestedvm 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 return puzzles/*.jar
enddelegate 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 .hlp" >> .htaccess
in puzzles do echo "AddType application/octet-stream .cnt" >> .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 . 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! # Phew, we're done. Deliver everything!
deliver puzzles/icons/*-web.png $@ deliver puzzles/icons/*-web.png $@
@ -147,7 +154,7 @@ deliver puzzles/puzzles.chm $@
deliver puzzles/puzzles.hlp $@ deliver puzzles/puzzles.hlp $@
deliver puzzles/puzzles.cnt $@ deliver puzzles/puzzles.cnt $@
deliver puzzles/puzzles.zip $@ 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/*.jar java/$@
deliver puzzles/js/*.js js/$@ deliver puzzles/js/*.js js/$@
deliver puzzles/html/*.html html/$@ deliver puzzles/html/*.html html/$@

8
Recipe
View File

@ -118,8 +118,6 @@ version.o: version.c version2.def
version2.def: FORCE version2.def: FORCE
if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \ if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
cat version.def > version2.def.new; \ 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 \ else \
echo "$(VER)" >version2.def.new; \ echo "$(VER)" >version2.def.new; \
fi && \ fi && \
@ -136,7 +134,7 @@ version2.def: FORCE
# backtick expression. We also force rebuilding via a -D option that # backtick expression. We also force rebuilding via a -D option that
# makes version.o include empty.h, which we construct ourselves and # makes version.o include empty.h, which we construct ourselves and
# touch whenever any source file is updated. # 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 !begin am
BUILT_SOURCES = empty.h BUILT_SOURCES = empty.h
CLEANFILES = empty.h CLEANFILES = empty.h
@ -156,8 +154,6 @@ version.o: version.c version2.def
version2.def: FORCE version2.def: FORCE
if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \ if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
cat version.def > version2.def.new; \ 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 \ else \
echo "$(VER)" >version2.def.new; \ echo "$(VER)" >version2.def.new; \
fi && \ fi && \
@ -180,8 +176,6 @@ version.i386.o: version.c version2.def
version2.def: FORCE version2.def: FORCE
if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \ if test -z "$(VER)" && test -f manifest && (md5 -r `awk '{print $$2}' manifest` | diff -w manifest -); then \
cat version.def > version2.def.new; \ 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 \ else \
echo "$(VER)" >version2.def.new; \ echo "$(VER)" >version2.def.new; \
fi && \ fi && \

View File

@ -19,5 +19,3 @@
\cfg{html-body-end}{} \cfg{html-body-end}{}
\cfg{html-head-end}{<link rel="stylesheet" type="text/css" href="chm.css">} \cfg{html-head-end}{<link rel="stylesheet" type="text/css" href="chm.css">}
\versionid $Id$

View File

@ -1,6 +1,6 @@
dnl Configure script for the Unix GTK build of puzzles. 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]) AC_CONFIG_SRCDIR([midend.c])
AM_INIT_AUTOMAKE([foreign]) AM_INIT_AUTOMAKE([foreign])
AC_PROG_CC AC_PROG_CC

View File

@ -2,27 +2,15 @@
# Build a Unix source distribution from the Puzzles SVN area. # Build a Unix source distribution from the Puzzles SVN area.
# #
# Pass a numeric argument to have the archive tagged as that SVN # Pass a version number argument to have the archive tagged with that
# revision. Otherwise, the script will work it out itself by # version number. Otherwise, the script will not version-tag the
# calling `svnversion', or failing that it will not version-tag the
# archive at all. # archive at all.
case "$#" in version="$1"
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
if test "x$rev" != "x"; then if test "x$version" != "x"; then
arcsuffix="-r$rev" arcsuffix="-$version"
ver="-DREVISION=$rev" ver="-DVER=$version"
else else
arcsuffix= arcsuffix=
ver= 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 \ HACKING puzzles.txt puzzles.hlp puzzles.cnt puzzles.chm \
icons/Makefile icons/*.{sav,pl,sh} icons/win16pal.xpm \ icons/Makefile icons/*.{sav,pl,sh} icons/win16pal.xpm \
icons/*.png icons/*.ico icons/*.rc icons/*.c \ 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 case $i in
*/*) ln -s ../../../$i tmp.$$/puzzles$arcsuffix/$i;; */*) ln -s ../../../$i tmp.$$/puzzles$arcsuffix/$i;;
*) ln -s ../../$i tmp.$$/puzzles$arcsuffix/$i;; *) ln -s ../../$i tmp.$$/puzzles$arcsuffix/$i;;

View File

@ -36,8 +36,6 @@ See \k{licence} for the licence text in full.
\cfg{html-local-head}{<meta name="AppleTitle" content="Puzzles Help">} \cfg{html-local-head}{<meta name="AppleTitle" content="Puzzles Help">}
\versionid $Id$
\C{intro} Introduction \C{intro} Introduction
I wrote this collection because I thought there should be more small I wrote this collection because I thought there should be more small

View File

@ -21,9 +21,9 @@
# include "empty.h" # include "empty.h"
#endif #endif
#if defined REVISION #if defined VER
char ver[] = "Revision: r" STR(REVISION); char ver[] = "Version: " STR(VER);
#else #else

View File

@ -6,15 +6,27 @@
# Usage: # 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 # where the first argument is the version number which will be encoded
# installer's version indicators. # 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 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; $desc = shift @ARGV;
open DESC, "<", $desc; open DESC, "<", $desc;
while (<DESC>) { while (<DESC>) {
@ -31,10 +43,10 @@ print '; -- Inno Setup installer script for Puzzles.'."\n";
print ''."\n"; print ''."\n";
print '[Setup]'."\n"; print '[Setup]'."\n";
print 'AppName=Simon Tatham\'s Portable Puzzle Collection'."\n"; print 'AppName=Simon Tatham\'s Portable Puzzle Collection'."\n";
print 'AppVerName=Puzzles revision '.$rev."\n"; print 'AppVerName=Puzzles version '.$ver."\n";
print 'VersionInfoTextVersion=Revision '.$rev."\n"; print 'VersionInfoTextVersion=Version '.$ver."\n";
print 'AppVersion=r'.$rev."\n"; print 'AppVersion=r'.$ver."\n";
print 'VersionInfoVersion=0.0.'.$revclean.'.0'."\n"; print 'VersionInfoVersion=0.0.'.$integer_date.'.0'."\n";
print 'AppPublisher=Simon Tatham'."\n"; print 'AppPublisher=Simon Tatham'."\n";
print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n"; print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n";
print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n"; print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n";