Ethereal-dev: [Ethereal-dev] RFC: Put cvs date into version

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Wed, 7 Jan 2004 00:01:53 +0100
The attached patch changes the version for cvs-users to the date of
the last modified file. The version number will only change when
running configure.
Please comment.

 Ciao
    Jörg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/ethereal/Makefile.am,v
retrieving revision 1.683
diff -p -u -r1.683 Makefile.am
--- Makefile.am	4 Jan 2004 02:59:46 -0000	1.683
+++ Makefile.am	6 Jan 2004 22:54:33 -0000
@@ -1373,7 +1373,7 @@ svr4-package: $(bin_SCRIPTS) $(lib_LTLIB
 		$(MAKE) DESTDIR=$(stagedir) install; \
 		$(srcdir)/packaging/svr4/mkpkg \
 			$(PACKAGE) \
-			$(PACKAGE)-$(VERSION)-$(host_os)-$(host_cpu)-local \
+			$(PACKAGE)-$(PACKAGE_VERSION)-$(host_os)-$(host_cpu)-local \
 			$(prefix) \
 			$(top_stagedir) ; \
 	else \
@@ -1383,6 +1383,8 @@ svr4-package: $(bin_SCRIPTS) $(lib_LTLIB
 
 solaris-package: svr4-package
 
+distdir = $(PACKAGE)-$(PACKAGE_VERSION)
+
 rpm_topdir=`cd $(top_srcdir) && pwd`/packaging/rpm
 rpm-package: dist
 	if test x$(HAVE_RPM) = xyes ; then \
Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/ethereal/configure.in,v
retrieving revision 1.240
diff -p -u -r1.240 configure.in
--- configure.in	24 Dec 2003 14:06:36 -0000	1.240
+++ configure.in	6 Jan 2004 22:54:34 -0000
@@ -18,6 +18,7 @@ AC_CANONICAL_HOST
 AC_CANONICAL_TARGET
 
 AM_INIT_AUTOMAKE(ethereal, 0.10.0a)
+PACKAGE_VERSION="$VERSION"
 
 dnl Checks for programs.
 AC_PROG_CC
@@ -806,7 +807,7 @@ dnl
 dnl check whether plugins should be enabled and, if they should be,
 dnl check for plugins directory - stolen from Amanda's configure.in
 dnl
-plugindir="$libdir/ethereal/plugins/$VERSION"
+plugindir="$libdir/ethereal/plugins/$PACKAGE_VERSION"
 AC_ARG_WITH(plugins,
 changequote(<<, >>)dnl
 <<  --with-plugins[=DIR]    support plugins (installed in DIR, if supplied).>>,
@@ -832,6 +833,11 @@ changequote([, ])dnl
   esac
 ])
 
+if test -f CVS/Entries ; then
+  entriesfiles=`find . -name "Entries"`
+  VERSION=cvs`./cvsdate.pl $entriesfiles`
+fi
+
 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
 if test x$have_plugins = xyes
 then
Index: cvsdate.pl
===================================================================
RCS file: cvsdate.pl
diff -N cvsdate.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cvsdate.pl	6 Jan 2004 22:54:34 -0000
@@ -0,0 +1,29 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my ($d1,$d2,$d3,$date,$drest);
+my ($wdayascii, $monthascii, $day, $time, $year);
+
+my %asctonum = ( "Jan" => "01", "Feb" => "02", "Mar" => "03", "Apr" => "04",
+		"May" => "05", "Jun" => "06", "Jul" => "07", "Aug" => "08",
+		"Sep" => "09", "Oct" => "10", "Nov" => "11", "Dec" => "12" );
+
+my $current;
+my $last = "";
+
+while (<>) {
+	chomp;
+	# Line looks like this: /ethereal_be.py/1.6/Fri Aug  2 22:55:19 2002//
+	next if (/^D/);
+	($d1,$d2,$d2,$date,$drest) = split(/\//, $_, 5);
+	next if ($date =~ /merge/);
+	($wdayascii, $monthascii, $day, $time, $year) = split(/\s+/, $date);
+	$day = substr("0".$day, 0, 2);
+	$time =~ s/://g;
+	$current = "$year$asctonum{$monthascii}$day$time";
+	if ($current gt $last) {
+		$last = $current;
+	}
+}
+print "$last";