Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Ethereal-dev: Re: [Ethereal-dev] Changed required automake to 1.6 and autoconf to 2.53

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

From: Andrew Hood <ajhood@xxxxxxxxx>
Date: Thu, 04 Mar 2004 22:05:24 +1100
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Joerg Mayer wrote:
| On Thu, Mar 04, 2004 at 12:46:35AM +0100, Olivier Biot wrote:
|
|>BTW the .PHONY target correctly runs make-version.pl, but I've seen it
|>running at least twice (once at the very beginning, and once at the
|>very end of the build). As a matter of fact, it runs once at the very
|>beginning of the make, then once for every binary requiring
|>cvsversion.h, and finally at the very end of the build. As a result,
|>even without any changes to the source files, make rebuilds
|>tethereal.exe (but not ethereal.exe), but then the last run of
|>make-version.pl is not run.
|
|
| Yes, I arrived at the same result some minutes ago. As a bonus, look
at this:
|
| jmayer@madhatter:~/work/ethereal/main> rm cvsversion.h
| jmayer@madhatter:~/work/ethereal/main> make cvsversion.h
| /usr/bin/perl ./make-version.pl
| This is a build from CVS (or a CVS snapshot), CVS version tag will be
computed.
| cvsversion.h has been updated.
| jmayer@madhatter:~/work/ethereal/main> cat cvsversion.h
| #define CVSVERSION "CVS 20010711054138"
|
| Now, that's an old repository
|
| Anyway. I'm too tired to immediatly find the source of the problem.

The logic to find the newest line in the Entries doesn't work. When you
run "cvs update" all the Entries files seem to get touched. You have to
read them all to find the newest file.

The version in CVS almost works - still doesn't handle multiple Entries
having the same timestamp - if you:
~ initialise $last=0,
~ change '$current gt $last' to '$current > $last',
~ and the if from '($last eq "")' to '($last)'.

gt does not work comparing numbers.

I have an ANSI c program to do a similar job.

- --
There's no point in being grown up if you can't be childish sometimes.
~                -- Dr. Who
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFARw10UpRmj8xnsFgRAhPkAKCC8CwbKf5DGx1U2iw7vWBNl/67cwCfUzFF
zy5iU9Lswiw6/Hgc071gD8c=
=WnR2
-----END PGP SIGNATURE-----
Index: make-version.pl
===================================================================
RCS file: /cvsroot/ethereal/make-version.pl,v
retrieving revision 1.6
diff -b -c -r1.6 make-version.pl
*** make-version.pl	20 Feb 2004 20:36:13 -0000	1.6
--- make-version.pl	4 Mar 2004 10:59:11 -0000
***************
*** 47,54 ****
  my %monthnum = ( "Jan" => "0", "Feb" => "1", "Mar" => "2", "Apr" => "3",
  		"May" => "4", "Jun" => "5", "Jul" => "6", "Aug" => "7",
  		"Sep" => "8", "Oct" => "9", "Nov" => "10", "Dec" => "11" );
! my $last = "";
! my $last_modified = 0;
  my $last_file = undef;
  my %version_pref = ("enable" => 1, "format" => "CVS %Y%m%d%H%M%S");
  
--- 47,53 ----
  my %monthnum = ( "Jan" => "0", "Feb" => "1", "Mar" => "2", "Apr" => "3",
  		"May" => "4", "Jun" => "5", "Jul" => "6", "Aug" => "7",
  		"Sep" => "8", "Oct" => "9", "Nov" => "10", "Dec" => "11" );
! my $last = 0;
  my $last_file = undef;
  my %version_pref = ("enable" => 1, "format" => "CVS %Y%m%d%H%M%S");
  
***************
*** 63,75 ****
  	foreach $d (readdir(DIR)) {
  		if (-d "$dir/$d" && $d !~ /^\.(|.)$/) {
  			if ($d =~ /^CVS$/) {
! 				my @stat = stat("$dir/CVS/Entries");
! 
! 				if (@stat) {
! 					if ($last_modified < $stat[9]) {
! 						$last_modified = $stat[9];
! 						$last_file = "$dir/CVS/Entries"
! 					}
  				}
  			} else { # Recurse in directory
  				&find_last_CVS_Entries("$dir/$d");
--- 62,69 ----
  	foreach $d (readdir(DIR)) {
  		if (-d "$dir/$d" && $d !~ /^\.(|.)$/) {
  			if ($d =~ /^CVS$/) {
! 				if (-f "$dir/CVS/Entries") {
! 					&lastentry("$dir/CVS/Entries");
  				}
  			} else { # Recurse in directory
  				&find_last_CVS_Entries("$dir/$d");
***************
*** 99,105 ****
  		next if ($date !~ /\w{3} (\w{3}) (.\d) (\d\d):(\d\d):(\d\d) (\d{4})/);
  		$current = timegm($5, $4, $3, $2, $monthnum{$1}, $6);
  
! 		if ($current gt $last) {
  			$last = $current;
  		}
  	}
--- 93,99 ----
  		next if ($date !~ /\w{3} (\w{3}) (.\d) (\d\d):(\d\d):(\d\d) (\d{4})/);
  		$current = timegm($5, $4, $3, $2, $monthnum{$1}, $6);
  
! 		if ($current > $last) {
  			$last = $current;
  		}
  	}
***************
*** 115,121 ****
  	my $cvs_version;
  	my $needs_update = 1;
  
! 	if ($last ne "") {
  		$cvs_version = "#define CVSVERSION \"" . 
  			strftime($version_pref{"format"}, gmtime($last)) .
  			"\"\n";
--- 109,115 ----
  	my $cvs_version;
  	my $needs_update = 1;
  
! 	if ($last) {
  		$cvs_version = "#define CVSVERSION \"" . 
  			strftime($version_pref{"format"}, gmtime($last)) .
  			"\"\n";
***************
*** 169,187 ****
  	print "This is not a CVS build.\n";
  }
  
- # Now $last_modified and $last_file are set if we found one CVS/Entries file.
- # We need to invoke lastentry on the most recent entries file.
- 
- if (defined $last_file) {
- 	my @version_stat = stat($version_file);
- 	my $version_mtime = 0;
- 	if (@version_stat) {
- 		$version_mtime = $version_stat[9];
- 	}
- 	&lastentry($last_file);
- 	# print "Last: $last_file\t($last)\n";
- }
- 
  # Now that we've computed everything, print the CVS version to $version_file
  &print_cvs_version;
  
--- 163,168 ----