From f4aa1da0b662cba035d99030b6b46d7d61ec3ca8 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 14 Nov 2004 00:11:27 +0000 Subject: Add maintainer script to propagate Tor version to windows svn:r2842 --- contrib/updateVersions.pl | 57 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 contrib/updateVersions.pl (limited to 'contrib') diff --git a/contrib/updateVersions.pl b/contrib/updateVersions.pl new file mode 100755 index 000000000..6dc5c0572 --- /dev/null +++ b/contrib/updateVersions.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w + +$CONFIGURE_IN = './configure.in'; +$ORCONFIG_H = './src/win32/orconfig.h'; +$TOR_NSI = './contrib/tor.nsi'; + +sub demand { + my $fn = shift; + die "Missing file $fn" unless (-f $fn); +} + +demand($CONFIGURE_IN); +demand($ORCONFIG_H); +demand($TOR_NSI); + +# extract version from configure.in + +open(F, $CONFIGURE_IN) or die "$!"; +$version = undef; +while () { + if (/AM_INIT_AUTOMAKE\(tor,\s*([^\)]*)\)/) { + $version = $1; + last; + } +} +die "No version found" unless $version; +print "Tor version is $version\n"; +close F; + +sub correctversion { + my ($fn, $defchar) = @_; + undef $/; + open(F, $fn) or die "$!"; + my $s = ; + close F; + if ($s =~ /^$defchar(?:)define\s+VERSION\s+\"([^\"]+)\"/m) { + $oldver = $1; + if ($oldver ne $version) { + print "Version mismatch in $fn: It thinks that the version is $oldver. Fixing.\n"; + $line = $defchar . "define VERSION \"$version\""; + open(F, ">$fn.bak"); + print F $s; + close F; + $s =~ s/^$defchar(?:)define\s+VERSION.*?$/$line/m; + open(F, ">$fn"); + print F $s; + close F; + } else { + print "$fn has the correct version. Good.\n"; + } + } else { + print "Didn't find a version line in $fn -- uh oh.\n"; + } +} + +correctversion($TOR_NSI, "!"); +correctversion($ORCONFIG_H, "#"); -- cgit v1.2.3