[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Revive updateVersions.pl with `make update-versions`.



commit e85ba7459e6270b5ec1186a18e87a60c13153344
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Thu Mar 12 09:28:41 2015 +0100

    Revive updateVersions.pl with `make update-versions`.
---
 Makefile.am                        |    4 +++
 configure.ac                       |    1 +
 scripts/maint/updateVersions.pl    |   59 ------------------------------------
 scripts/maint/updateVersions.pl.in |   59 ++++++++++++++++++++++++++++++++++++
 4 files changed, 64 insertions(+), 59 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4527dd1..1c2d2c1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -122,6 +122,10 @@ check-changes:
 		$(PYTHON) $(top_srcdir)/scripts/maint/lintChanges.py $(top_srcdir)/changes/*; \
 		fi
 
+.PHONY: update-versions
+update-versions:
+	$(PERL) $(top_builddir)/scripts/maint/updateVersions.pl
+
 version:
 	@echo "Tor @VERSION@"
 	@if test -d "$(top_srcdir)/.git" && test -x "`which git 2>&1;true`"; then \
diff --git a/configure.ac b/configure.ac
index 3ba6868..4905e69 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1664,6 +1664,7 @@ AC_CONFIG_FILES([
         src/config/torrc.sample
         src/config/torrc.minimal
         scripts/maint/checkOptionDocs.pl
+        scripts/maint/updateVersions.pl
 ])
 
 if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
diff --git a/scripts/maint/updateVersions.pl b/scripts/maint/updateVersions.pl
deleted file mode 100755
index 15c83b8..0000000
--- a/scripts/maint/updateVersions.pl
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/perl -w
-
-$CONFIGURE_IN = './configure.ac';
-$ORCONFIG_H = './src/win32/orconfig.h';
-$TOR_NSI = './contrib/win32build/tor-mingw.nsi.in';
-
-$quiet = 1;
-
-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.ac
-
-open(F, $CONFIGURE_IN) or die "$!";
-$version = undef;
-while (<F>) {
-    if (/AC_INIT\(\[tor\],\s*\[([^\]]*)\]\)/) {
-	$version = $1;
-	last;
-    }
-}
-die "No version found" unless $version;
-print "Tor version is $version\n" unless $quiet;
-close F;
-
-sub correctversion {
-    my ($fn, $defchar) = @_;
-    undef $/;
-    open(F, $fn) or die "$!";
-    my $s = <F>;
-    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.  I think it's $version.  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" unless $quiet;
-	}
-    } else {
-	print "Didn't find a version line in $fn -- uh oh.\n";
-    }
-}
-
-correctversion($TOR_NSI, "!");
-correctversion($ORCONFIG_H, "#");
diff --git a/scripts/maint/updateVersions.pl.in b/scripts/maint/updateVersions.pl.in
new file mode 100755
index 0000000..65c51a1
--- /dev/null
+++ b/scripts/maint/updateVersions.pl.in
@@ -0,0 +1,59 @@
+#!/usr/bin/perl -w
+
+$CONFIGURE_IN = '@abs_top_srcdir@/configure.ac';
+$ORCONFIG_H = '@abs_top_srcdir@/src/win32/orconfig.h';
+$TOR_NSI = '@abs_top_srcdir@/contrib/win32build/tor-mingw.nsi.in';
+
+$quiet = 1;
+
+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.ac
+
+open(F, $CONFIGURE_IN) or die "$!";
+$version = undef;
+while (<F>) {
+    if (/AC_INIT\(\[tor\],\s*\[([^\]]*)\]\)/) {
+	$version = $1;
+	last;
+    }
+}
+die "No version found" unless $version;
+print "Tor version is $version\n" unless $quiet;
+close F;
+
+sub correctversion {
+    my ($fn, $defchar) = @_;
+    undef $/;
+    open(F, $fn) or die "$!";
+    my $s = <F>;
+    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.  I think it's $version.  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" unless $quiet;
+	}
+    } else {
+	print "Didn't find a version line in $fn -- uh oh.\n";
+    }
+}
+
+correctversion($TOR_NSI, "!");
+correctversion($ORCONFIG_H, "#");



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits