From 2ebbdbf2a567c73d75af4f0e04f4f42bfe6d3530 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 24 Sep 2014 10:33:21 +0000 Subject: [PATCH] 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] --- Buildscr | 25 ++++++++++++++++--------- Recipe | 8 +------- chm.but | 2 -- configure.ac | 2 +- makedist.sh | 27 ++++++++------------------- puzzles.but | 2 -- version.c | 4 ++-- winiss.pl | 30 +++++++++++++++++++++--------- 8 files changed, 49 insertions(+), 51 deletions(-) diff --git a/Buildscr b/Buildscr index 4d86ba6..947102d 100644 --- 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 e6af51d..0d9e2a3 100644 --- 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 a28384d..e023704 100644 --- a/chm.but +++ b/chm.but @@ -19,5 +19,3 @@ \cfg{html-body-end}{} \cfg{html-head-end}{} - -\versionid $Id$ diff --git a/configure.ac b/configure.ac index 4281e96..49dc5c6 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/makedist.sh b/makedist.sh index 3b87bff..65eb519 100755 --- a/makedist.sh +++ b/makedist.sh @@ -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;; diff --git a/puzzles.but b/puzzles.but index fb0e482..3d0597f 100644 --- a/puzzles.but +++ b/puzzles.but @@ -36,8 +36,6 @@ See \k{licence} for the licence text in full. \cfg{html-local-head}{} -\versionid $Id$ - \C{intro} Introduction I wrote this collection because I thought there should be more small diff --git a/version.c b/version.c index 590e587..1dde602 100644 --- 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 diff --git a/winiss.pl b/winiss.pl index 9e796e0..449916c 100755 --- 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 () { @@ -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";