Convert make-version.pl and the associated cvsversion.h and CVSVERSION
definition to Subversion. "svn info" prints out the last changed date of the repository, so we don't have to go hunting through "CVS/Entries" files anymore. svn path=/trunk/; revision=11379
This commit is contained in:
parent
b5384b0bd3
commit
8106dc0862
|
@ -288,7 +288,7 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/wiretap
|
|||
# FORCE is the portable version of .PHONY
|
||||
FORCE:
|
||||
|
||||
cvsversion.h: FORCE
|
||||
svnversion.h: FORCE
|
||||
$(PERL) $(srcdir)/make-version.pl
|
||||
|
||||
#
|
||||
|
@ -364,7 +364,7 @@ dftest_LDADD = \
|
|||
dftest_LDFLAGS = -export-dynamic
|
||||
|
||||
CLEANFILES = \
|
||||
cvsversion.h \
|
||||
svnversion.h \
|
||||
@rdps_bin@ \
|
||||
idl2eth
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ DISSECTOR_SUPPORT_INCLUDES = \
|
|||
|
||||
# "BUILT_SOURCES" are built before any "make all" or "make check" targets.
|
||||
BUILT_SOURCES = \
|
||||
cvsversion.h \
|
||||
svnversion.h \
|
||||
ps.c
|
||||
|
||||
# sources common for ethereal and tethereal
|
||||
|
@ -379,7 +379,7 @@ text2pcap_SOURCES = \
|
|||
mergecap_SOURCES = \
|
||||
mergecap.c \
|
||||
merge.c \
|
||||
cvsversion.h
|
||||
svnversion.h
|
||||
|
||||
# editcap specifics
|
||||
editcap_SOURCES = \
|
||||
|
|
|
@ -30,7 +30,7 @@ include Makefile.common
|
|||
include epan\Makefile.common
|
||||
|
||||
BUILT_SOURCES = $(BUILT_SOURCES) \
|
||||
cvsversion.h
|
||||
svnversion.h
|
||||
|
||||
DISSECTOR_SRC = $(DISSECTOR_SRC:../=)
|
||||
DISSECTOR_OBJECTS = $(DISSECTOR_SRC:.c=.obj)
|
||||
|
@ -144,7 +144,7 @@ wiretap\wiretap-$(WTAP_VERSION).lib: wiretap
|
|||
!IFNDEF GTK1_DIR
|
||||
ethereal.exe :
|
||||
!ELSE
|
||||
ethereal.exe : config.h cvsversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk\libui.lib dissectors.lib plugins
|
||||
ethereal.exe : config.h svnversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk\libui.lib dissectors.lib plugins
|
||||
@echo Linking $@
|
||||
$(LINK) @<<
|
||||
/OUT:ethereal.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK1_LIBS) gtk\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res
|
||||
|
@ -154,14 +154,14 @@ ethereal.exe : config.h cvsversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan g
|
|||
!IFNDEF GTK2_DIR
|
||||
ethereal-gtk2.exe :
|
||||
!ELSE
|
||||
ethereal-gtk2.exe : config.h cvsversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk2 image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk2.tmp\libui.lib dissectors.lib plugins
|
||||
ethereal-gtk2.exe : config.h svnversion.h $(ethereal_OBJECTS) $(EXTRA_OBJECTS) epan gtk2 image\ethereal.res wiretap\wiretap-$(WTAP_VERSION).lib gtk2.tmp\libui.lib dissectors.lib plugins
|
||||
@echo Linking $@
|
||||
$(LINK) @<<
|
||||
/OUT:ethereal-gtk2.exe $(guiflags) $(guilibsdll) $(LDFLAGS) /SUBSYSTEM:windows $(ethereal_LIBS) $(GTK2_LIBS) gtk2.tmp\libui.lib $(ethereal_OBJECTS) $(EXTRA_OBJECTS) image\ethereal.res
|
||||
<<
|
||||
!ENDIF
|
||||
|
||||
tethereal.exe : config.h cvsversion.h $(tethereal_OBJECTS) $(EXTRA_OBJECTS) epan image\tethereal.res wiretap\wiretap-$(WTAP_VERSION).lib dissectors.lib plugins
|
||||
tethereal.exe : config.h svnversion.h $(tethereal_OBJECTS) $(EXTRA_OBJECTS) epan image\tethereal.res wiretap\wiretap-$(WTAP_VERSION).lib dissectors.lib plugins
|
||||
@echo Linking $@
|
||||
$(LINK) @<<
|
||||
/OUT:tethereal.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console $(tethereal_LIBS) $(tethereal_OBJECTS) $(EXTRA_OBJECTS) image\tethereal.res
|
||||
|
@ -173,7 +173,7 @@ editcap.exe : config.h editcap.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).li
|
|||
/OUT:editcap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console editcap.obj getopt.obj $(editcap_LIBS) image\editcap.res
|
||||
<<
|
||||
|
||||
mergecap.exe : config.h cvsversion.h mergecap.obj merge.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
|
||||
mergecap.exe : config.h svnversion.h mergecap.obj merge.obj getopt.obj wiretap\wiretap-$(WTAP_VERSION).lib image\mergecap.res
|
||||
@echo Linking $@
|
||||
$(LINK) @<<
|
||||
/OUT:mergecap.exe $(conflags) $(conlibsdll) $(LDFLAGS) /SUBSYSTEM:console mergecap.obj merge.obj getopt.obj $(mergecap_LIBS) image\mergecap.res
|
||||
|
@ -217,7 +217,7 @@ ps.c : rdps.exe print.ps
|
|||
#
|
||||
# Build the version string
|
||||
#
|
||||
cvsversion.h:
|
||||
svnversion.h:
|
||||
$(PERL) make-version.pl
|
||||
|
||||
#
|
||||
|
@ -346,13 +346,13 @@ wiretap::
|
|||
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
|
||||
cd ..
|
||||
|
||||
gtk:: help config.h cvsversion.h AUTHORS-SHORT doxygen
|
||||
gtk:: help config.h svnversion.h AUTHORS-SHORT doxygen
|
||||
cd gtk
|
||||
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake GTK_CFLAGS="$(GTK1_CFLAGS)" GTK_LIBS="$(GTK1_LIBS)" libui.lib
|
||||
cd ..
|
||||
|
||||
# copy all required files to gtk2.tmp (but only when newer than existing) and compile in that dir
|
||||
gtk2:: help config.h cvsversion.h AUTHORS-SHORT
|
||||
gtk2:: help config.h svnversion.h AUTHORS-SHORT
|
||||
if not exist gtk2.tmp mkdir gtk2.tmp
|
||||
cd gtk
|
||||
cp --update --preserve Makefile.* *.c *.h ..\gtk2.tmp
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#endif
|
||||
#include "webbrowser.h"
|
||||
|
||||
#include "cvsversion.h"
|
||||
#include "svnversion.h"
|
||||
|
||||
#include "../image/eicon3d64.xpm"
|
||||
#include "gtkglobals.h"
|
||||
|
@ -156,8 +156,8 @@ about_ethereal_page_new(void)
|
|||
about_ethereal(top_level, main_vb, title);
|
||||
|
||||
msg_label = gtk_label_new("Version " VERSION
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
" (C) 1998-2004 Gerald Combs <gerald@ethereal.com>\n\n");
|
||||
gtk_container_add(GTK_CONTAINER(main_vb), msg_label);
|
||||
|
|
10
gtk/main.c
10
gtk/main.c
|
@ -80,7 +80,7 @@
|
|||
#include <epan/resolv.h>
|
||||
|
||||
/* general (not GTK specific) */
|
||||
#include "cvsversion.h"
|
||||
#include "svnversion.h"
|
||||
#include "file.h"
|
||||
#include "summary.h"
|
||||
#include "filters.h"
|
||||
|
@ -957,8 +957,8 @@ print_usage(gboolean print_ver) {
|
|||
if (print_ver) {
|
||||
output = stdout;
|
||||
fprintf(output, "This is GNU " PACKAGE " " VERSION
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
"\n%s\n\n%s\n",
|
||||
comp_info_str->str, runtime_info_str->str);
|
||||
|
@ -994,8 +994,8 @@ show_version(void)
|
|||
#endif
|
||||
|
||||
printf(PACKAGE " " VERSION
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
"\n%s\n\n%s\n",
|
||||
comp_info_str->str, runtime_info_str->str);
|
||||
|
|
|
@ -35,89 +35,50 @@
|
|||
# Default configuration:
|
||||
#
|
||||
# enable: 1
|
||||
# format: CVS %Y%m%d%H%M%S
|
||||
# format: SVN %Y%m%d%H%M%S
|
||||
|
||||
use strict;
|
||||
|
||||
use Time::Local;
|
||||
use POSIX qw(strftime);
|
||||
|
||||
my $version_file = 'cvsversion.h';
|
||||
my $version_file = 'svnversion.h';
|
||||
my $vconf_file = 'version.conf';
|
||||
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");
|
||||
my %version_pref = ("enable" => 1, "format" => "SVN %Y%m%d%H%M%S");
|
||||
|
||||
|
||||
# Recursively find all CVS Entries files starting from the given directory,
|
||||
# Recursively find all SVN Entries files starting from the given directory,
|
||||
# and compute the modification time of the most recently modified Entries file.
|
||||
sub find_last_CVS_Entries {
|
||||
my $dir = shift;
|
||||
my $d;
|
||||
sub read_svn_info {
|
||||
my $line;
|
||||
|
||||
opendir(DIR, "$dir") || print STDERR "Can't open directory $dir ($!)\n" && next;
|
||||
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");
|
||||
}
|
||||
open(SVNINFO, "svn info |") || return;
|
||||
while ($line = <SVNINFO>) {
|
||||
if ($line =~ /^Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
|
||||
$last = timegm($6, $5, $4, $3, $2 - 1, $1);
|
||||
}
|
||||
}
|
||||
closedir DIR;
|
||||
close SVNINFO;
|
||||
}
|
||||
|
||||
|
||||
# Check all entries in $file. In case they are newer, update $last accordingly
|
||||
# Args: Entries file
|
||||
sub lastentry {
|
||||
my $date;
|
||||
my ($wdayascii, $monthascii, $day, $time, $year);
|
||||
my $file = shift;
|
||||
my $current;
|
||||
|
||||
open(FILE, "<$file") || print STDERR "Open $file for reading failed ($!)\n" && return 1;
|
||||
|
||||
while (<FILE>) {
|
||||
chomp;
|
||||
# Regular lines look like this: /ethereal_be.py/1.6/Fri Aug 2 22:55:19 2002//
|
||||
next if (/^D/);
|
||||
$date = (split(/\//, $_, 5))[3];
|
||||
# Month Day Hour Minute Second Year
|
||||
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;
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
# Print the CVS version to $version_file.
|
||||
# Print the SVN version to $version_file.
|
||||
# Don't change the file if it is not needed.
|
||||
sub print_cvs_version
|
||||
sub print_svn_version
|
||||
{
|
||||
my $cvs_version;
|
||||
my $svn_version;
|
||||
my $needs_update = 1;
|
||||
|
||||
if ($last) {
|
||||
$cvs_version = "#define CVSVERSION \"" .
|
||||
$svn_version = "#define SVNVERSION \"" .
|
||||
strftime($version_pref{"format"}, gmtime($last)) .
|
||||
"\"\n";
|
||||
} else {
|
||||
$cvs_version = "/* #define CVSVERSION \"\" */\n";
|
||||
$svn_version = "/* #define SVNVERSION \"\" */\n";
|
||||
}
|
||||
if (open(OLDVER, "<$version_file")) {
|
||||
if (<OLDVER> eq $cvs_version) {
|
||||
if (<OLDVER> eq $svn_version) {
|
||||
print "$version_file is up-to-date.\n";
|
||||
$needs_update = 0;
|
||||
}
|
||||
|
@ -125,9 +86,9 @@ sub print_cvs_version
|
|||
}
|
||||
|
||||
if ($needs_update == 1) {
|
||||
# print "Updating $version_file so it contains:\n$cvs_version";
|
||||
# print "Updating $version_file so it contains:\n$svn_version";
|
||||
open(VER, ">$version_file") || die ("Cannot write to $version_file ($!)\n");
|
||||
print VER "$cvs_version";
|
||||
print VER "$svn_version";
|
||||
close VER;
|
||||
print "$version_file has been updated.\n";
|
||||
}
|
||||
|
@ -155,15 +116,15 @@ sub get_config {
|
|||
|
||||
if ($version_pref{"enable"} == 0) {
|
||||
print "Version tag disabled in $vconf_file.\n";
|
||||
} elsif (-d "./CVS") {
|
||||
print "This is a build from CVS (or a CVS snapshot), "
|
||||
. "CVS version tag will be computed.\n";
|
||||
&find_last_CVS_Entries(".");
|
||||
} elsif (-d "./.svn") {
|
||||
print "This is a build from SVN (or a SVN snapshot), "
|
||||
. "SVN version tag will be computed.\n";
|
||||
&read_svn_info(".");
|
||||
} else {
|
||||
print "This is not a CVS build.\n";
|
||||
print "This is not a SVN build.\n";
|
||||
}
|
||||
|
||||
# Now that we've computed everything, print the CVS version to $version_file
|
||||
&print_cvs_version;
|
||||
# Now that we've computed everything, print the SVN version to $version_file
|
||||
&print_svn_version;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "getopt.h"
|
||||
#endif
|
||||
|
||||
#include "cvsversion.h"
|
||||
#include "svnversion.h"
|
||||
#include "merge.h"
|
||||
|
||||
#ifdef HAVE_IO_H
|
||||
|
@ -152,8 +152,8 @@ main(int argc, char *argv[])
|
|||
|
||||
case 'h':
|
||||
printf("mergecap version %s"
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
"\n", VERSION);
|
||||
usage();
|
||||
|
|
10
tethereal.c
10
tethereal.c
|
@ -72,7 +72,7 @@
|
|||
#include "getopt.h"
|
||||
#endif
|
||||
|
||||
#include "cvsversion.h"
|
||||
#include "svnversion.h"
|
||||
|
||||
#include <glib.h>
|
||||
#include <epan/epan.h>
|
||||
|
@ -260,8 +260,8 @@ print_usage(gboolean print_ver)
|
|||
if (print_ver) {
|
||||
output = stdout;
|
||||
fprintf(output, "This is GNU t" PACKAGE " " VERSION
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
"\n (C) 1998-2004 Gerald Combs <gerald@ethereal.com>"
|
||||
"\n%s\n%s\n",
|
||||
|
@ -1243,8 +1243,8 @@ main(int argc, char *argv[])
|
|||
break;
|
||||
case 'v': /* Show version and exit */
|
||||
printf("t" PACKAGE " " VERSION
|
||||
#ifdef CVSVERSION
|
||||
" (" CVSVERSION ")"
|
||||
#ifdef SVNVERSION
|
||||
" (" SVNVERSION ")"
|
||||
#endif
|
||||
"\n%s\n%s\n",
|
||||
comp_info_str->str, runtime_info_str->str);
|
||||
|
|
Loading…
Reference in New Issue