Replace "svn" with "git" all over the place.

Rename "SVNPATH" to "GITBRANCH" since that seems more appropriate.
Rename "svnversion.h" to "version.h" as Evan suggested. Update some
URLs. In make-version.pl, make sure we don't set an improper upstream
branch name. Use the number of commits + short hash from `git describe`
for package names by default.

Change-Id: I922bba8d83eabdf49284a119f55b4076bc469b96
Reviewed-on: https://code.wireshark.org/review/139
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2014-02-07 11:14:52 -08:00
parent 217f9fd0d9
commit f966980937
36 changed files with 191 additions and 179 deletions

2
.gitignore vendored
View File

@ -40,7 +40,7 @@ epan/ps.c
ui/cli/tshark-tap-register-cache.pkl
plugin.c
plugins/mate/mate_parser.c
svnversion.h
version.h
tools/lemon/lemon
tools/lemon/lemon
tools/setuid-root.pl

View File

@ -781,17 +781,17 @@ link_directories(
)
ADD_CUSTOM_TARGET(
svnversion ALL
gitversion ALL
COMMAND ${PERL_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
)
set_target_properties(svnversion PROPERTIES FOLDER "Auxiliary")
set_target_properties(gitversion PROPERTIES FOLDER "Auxiliary")
ADD_CUSTOM_COMMAND(
OUTPUT svnversion.h
OUTPUT version.h
COMMAND ${PERL_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/make-version.pl
${CMAKE_CURRENT_SOURCE_DIR}
@ -826,7 +826,7 @@ set(SHARK_COMMON_SRC
cfutils.c
clopts_common.c
frame_tvbuff.c
svnversion.h
version.h
sync_pipe_write.c
version_info.c
)
@ -980,7 +980,7 @@ if(BUILD_wireshark AND GTK_FOUND)
# qtshark and wireshark share wireshark_FILES
add_executable(wireshark ${wireshark_FILES})
add_dependencies(wireshark svnversion)
add_dependencies(wireshark gitversion)
set_target_properties(wireshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(wireshark PROPERTIES FOLDER "Executables")
target_link_libraries(wireshark ${wireshark_LIBS})
@ -1003,7 +1003,7 @@ if(BUILD_qtshark AND QT_FOUND)
# qtshark and wireshark share wireshark_FILES
add_executable(qtshark ${wireshark_FILES})
add_dependencies(qtshark svnversion)
add_dependencies(qtshark gitversion)
set_target_properties(qtshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(qtshark PROPERTIES FOLDER "Executables")
target_link_libraries(qtshark ${qtshark_LIBS})
@ -1031,7 +1031,7 @@ if(BUILD_tshark)
${SHARK_COMMON_SRC}
)
add_executable(tshark ${tshark_FILES})
add_dependencies(tshark svnversion)
add_dependencies(tshark gitversion)
set_target_properties(tshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(tshark PROPERTIES FOLDER "Executables")
target_link_libraries(tshark ${tshark_LIBS})
@ -1053,7 +1053,7 @@ if(BUILD_tfshark)
${SHARK_COMMON_SRC}
)
add_executable(tfshark ${tfshark_FILES})
add_dependencies(tfshark svnversion)
add_dependencies(tfshark gitversion)
set_target_properties(tfshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(tfshark PROPERTIES FOLDER "Executables")
target_link_libraries(tfshark ${tfshark_LIBS})
@ -1072,7 +1072,7 @@ if(BUILD_rawshark AND PCAP_FOUND)
ui/util.c
)
add_executable(rawshark ${rawshark_FILES})
add_dependencies(rawshark svnversion)
add_dependencies(rawshark gitversion)
set_target_properties(rawshark PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(rawshark PROPERTIES FOLDER "Executables")
target_link_libraries(rawshark ${rawshark_LIBS})
@ -1133,7 +1133,7 @@ if(BUILD_text2pcap)
text2pcap-scanner.l
)
add_executable(text2pcap ${text2pcap_FILES})
add_dependencies(text2pcap svnversion)
add_dependencies(text2pcap gitversion)
set_target_properties(text2pcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(text2pcap PROPERTIES FOLDER "Executables")
target_link_libraries(text2pcap ${text2pcap_LIBS})
@ -1148,10 +1148,10 @@ if(BUILD_mergecap)
)
set(mergecap_FILES
mergecap.c
svnversion.h
version.h
)
add_executable(mergecap ${mergecap_FILES})
add_dependencies(mergecap svnversion)
add_dependencies(mergecap gitversion)
set_target_properties(mergecap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(mergecap PROPERTIES FOLDER "Executables")
target_link_libraries(mergecap ${mergecap_LIBS})
@ -1166,10 +1166,10 @@ if(BUILD_reordercap)
)
set(reordercap_FILES
reordercap.c
svnversion.h
version.h
)
add_executable(reordercap ${reordercap_FILES})
add_dependencies(reordercap svnversion)
add_dependencies(reordercap gitversion)
set_target_properties(reordercap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(reordercap PROPERTIES FOLDER "Executables")
target_link_libraries(reordercap ${reordercap_LIBS})
@ -1188,7 +1188,7 @@ if(BUILD_capinfos)
capinfos.c
)
add_executable(capinfos ${capinfos_FILES})
add_dependencies(capinfos svnversion)
add_dependencies(capinfos gitversion)
set_target_properties(capinfos PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(capinfos PROPERTIES FOLDER "Executables")
target_link_libraries(capinfos ${capinfos_LIBS})
@ -1206,7 +1206,7 @@ if(BUILD_captype)
captype.c
)
add_executable(captype ${captype_FILES})
add_dependencies(captype svnversion)
add_dependencies(captype gitversion)
set_target_properties(captype PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(captype PROPERTIES FOLDER "Executables")
target_link_libraries(captype ${captype_LIBS})
@ -1223,7 +1223,7 @@ if(BUILD_editcap)
editcap.c
)
add_executable(editcap ${editcap_FILES})
add_dependencies(editcap svnversion)
add_dependencies(editcap gitversion)
set_target_properties(editcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(editcap PROPERTIES FOLDER "Executables")
target_link_libraries(editcap ${editcap_LIBS})
@ -1245,7 +1245,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
${NL_LIBRARIES}
)
set(dumpcap_FILES
svnversion.h
version.h
capture_opts.c
capture-pcap-util.c
capture_stop_conditions.c
@ -1261,7 +1261,7 @@ if(BUILD_dumpcap AND PCAP_FOUND)
${PLATFORM_PCAP_SRC}
)
add_executable(dumpcap ${dumpcap_FILES})
add_dependencies(dumpcap svnversion)
add_dependencies(dumpcap gitversion)
set_target_properties(dumpcap PROPERTIES LINK_FLAGS "${WS_LINK_FLAGS}")
set_target_properties(dumpcap PROPERTIES FOLDER "Executables")
target_link_libraries(dumpcap ${dumpcap_LIBS})
@ -1432,6 +1432,7 @@ install(
WORLD_EXECUTE WORLD_READ
DESTINATION
${CMAKE_INSTALL_DATADIR}/${CPACK_PACKAGE_NAME}
PATTERN ".git" EXCLUDE
PATTERN ".svn" EXCLUDE
PATTERN "Makefile.*" EXCLUDE
PATTERN "faq.py" EXCLUDE

View File

@ -632,7 +632,7 @@ am__v_PERL_ = $(am__v_PERL_@AM_DEFAULT_V@)
am__v_PERL_0 = @echo " PERL " $@;
am__v_PERL_1 =
svnversion.h: FORCE
version.h: FORCE
$(AM_V_PERL)$(PERL) $(srcdir)/make-version.pl $(srcdir)
#
@ -655,7 +655,7 @@ CLEANFILES = \
vgcore.*
#
# We have to remove svnversion.h with "make distclean", as, otherwise,
# We have to remove version.h with "make distclean", as, otherwise,
# "make distcheck" fails. We still need to make the tarballs work
# even if you do "make distclean" and try to rebuild; that's a work in
# progress.
@ -666,7 +666,7 @@ CLEANFILES = \
#
DISTCLEANFILES = \
ps.c \
svnversion.h
version.h
MAINTAINERCLEANFILES = \
$(GENERATED_FILES) \

View File

@ -25,7 +25,7 @@
# "BUILT_SOURCES" are built before any "make all" or "make check" targets.
BUILT_HEADER_FILES = \
svnversion.h
version.h
BUILT_C_FILES =
@ -54,7 +54,7 @@ SHARK_COMMON_SRC = \
# corresponding headers
SHARK_COMMON_INCLUDES = \
svnversion.h \
version.h \
capture-pcap-util.h \
capture-pcap-util-int.h \
cfile.h \
@ -156,7 +156,7 @@ editcap_SOURCES = \
# reordercap specifics
reordercap_SOURCES = \
reordercap.c \
svnversion.h
version.h
# capinfos specifics
capinfos_SOURCES = \

View File

@ -537,15 +537,18 @@ QMAKE_LFLAGS *= /LARGEADDRESSAWARE $(LDFLAGS)
#
# Build the version string
#
!IF EXIST(".svn/wc.db")
SVNENTRIES = .svn/wc.db
# XXX - Makefile.am uses FORCE for this.
!IF EXIST(".git/index")
GITINDEX = .git/index
!ELSE IF EXIST(".svn/wc.db")
GITINDEX = .svn/wc.db
!ELSE IF EXIST(".svn/entries")
SVNENTRIES = .svn/entries
GITINDEX = .svn/entries
!ELSE
SVNENTRIES =
GITINDEX =
!ENDIF
svnversion.h: $(SVNENTRIES)
rm -f svnversion.h
version.h: $(GITINDEX)
rm -f version.h
$(PERL) make-version.pl
@ -557,9 +560,9 @@ text2pcap-scanner.obj : text2pcap-scanner.c
#
# The following targets will rebuild their respective objs
# if and when svnversion.h should change.
# if and when version.h should change.
#
text2pcap.obj mergecap.obj capinfos.obj captype.obj editcap.obj reordercap.obj version_info.obj: svnversion.h
text2pcap.obj mergecap.obj capinfos.obj captype.obj editcap.obj reordercap.obj version_info.obj: version.h
clean-local:
@ -808,12 +811,12 @@ codecs::
$(MAKE) /$(MAKEFLAGS) -f Makefile.nmake
cd ..
ui:: help config.h svnversion.h doxygen
ui:: help config.h version.h doxygen
cd ui
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libui.lib
cd ..
gtk:: help config.h svnversion.h doxygen
gtk:: help config.h version.h doxygen
cd ui/gtk
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libgtkui.lib
cd ../..
@ -821,7 +824,7 @@ gtk:: help config.h svnversion.h doxygen
# The Visual C++ static analyzer currently fails with error C2171
# when compiling summary_dialog.cpp. If/when this ever gets fixed
# we can remove the ENABLE_CODE_ANALYSIS check.
qt:: help config.h svnversion.h doxygen
qt:: help config.h version.h doxygen
!IFDEF QT5_BASE_DIR
cd ui/qt
$(QT5_BASE_DIR)\bin\qmake CONFIG+=release QtShark.pro
@ -838,7 +841,7 @@ win32::
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libgtkui_win32.lib
cd ../..
cli:: help config.h svnversion.h doxygen
cli:: help config.h version.h doxygen
cd ui/cli
$(MAKE) /$(MAKEFLAGS) /f Makefile.nmake libcliui.lib
cd ../..
@ -935,7 +938,7 @@ check_libs:
# If $(CHECK_TAG) is non-null then checktag failed; Exit with an error message. (See beginning of this Makefile).
# Otherwise do detailed library package files verification only if Makefile.nmake or config.make have been updated
# (or dummy file doesn't exist because of 'make clean' or whatever).
# Note that the creation/modification time of a file after an svn update of that file
# Note that the creation/modification time of a file after a git pull of that file
# is the time of the update (not the time of the file in the repository).
# touch is only called if libverify succeeds.
$(LIBS_CHECK): $(CHECK_TAG) config.nmake Makefile.nmake

View File

@ -100,7 +100,7 @@
#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
#include "svnversion.h"
#include "version.h"
/*
* By default capinfos now continues processing
@ -1005,8 +1005,8 @@ usage(gboolean is_error)
}
fprintf(output, "Capinfos %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n", VERSION);
fprintf(output, "Prints various information (infos) about capture files.\n");

View File

@ -61,14 +61,14 @@
#include <wsutil/unicode-utils.h>
#endif /* _WIN32 */
#include "svnversion.h"
#include "version.h"
static void
usage(void)
{
fprintf(stderr, "Captype %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n", VERSION);
fprintf(stderr, "Prints the file types of capture files.\n");

View File

@ -29,15 +29,15 @@ WIRESHARK_TARGET_PLATFORM=win32
##### Versions #####
# The SVN revision of our build. Updated by make-version.pl
SVN_REVISION=0
# The Git description of our build. Updated by make-version.pl
GIT_REVISION=0
# The current Wireshark version. Recommended: Leave unchanged.
# Updated by make-version.pl
VERSION_MAJOR=1
VERSION_MINOR=11
VERSION_MICRO=3
VERSION_BUILD=$(SVN_REVISION)
VERSION_BUILD=$(GIT_REVISION)
# Local build information. Recommended: Unique string for your
# environment, e.g. "-JackStackBarbecue". Updated by make-version.pl
@ -1308,7 +1308,7 @@ LYNX=lynx
# The RC_VERSION should be comma-separated, not dot-separated,
# as per Graham Bloice's message in
#
# http://www.ethereal.com/lists/ethereal-dev/200303/msg00283.html
# http://www.wireshark.org/lists/ethereal-dev/200303/msg00283.html
#
# "The RC_VERSION variable in config.nmake should be comma separated.
# This allows the resources to be built correctly and the version

View File

@ -93,7 +93,7 @@ you use this to differentiate it from official Wireshark releases.
4.1. Source-level version detection.
The SVN version corresponding to each release is in svnversion.h. It's
The Git version corresponding to each release is in version.h. It's
defined as a string. If you need a numeric definition, let us know.
5. Trademarks.

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Check for SVN version
# Check for Git version
#
# $Id$
#
@ -23,14 +23,14 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
#if [ -d ../.git ] ; then
# GIT_VERSION=`git describe --tags --dirty`
#fi
#echo '<!ENTITY GitVersion "'${GIT_VERSION}'">' > git_version_tmp.xml
if [ -d ../.git ] ; then
GIT_VERSION=`git describe --tags --dirty`
fi
echo '<!ENTITY GitVersion "'${GIT_VERSION}'">' > git_version_tmp.xml
echo -n '<!ENTITY GitVersion "' > git_version_tmp.xml
[ -x svnversion ] && svnversion -n . >> git_version_tmp.xml
echo '">' >> git_version_tmp.xml
#echo -n '<!ENTITY GitVersion "' > git_version_tmp.xml
#[ -x svnversion ] && svnversion -n . >> git_version_tmp.xml
#echo '">' >> git_version_tmp.xml
# /dev/null buries the output of the "cmp" command.
diff git_version.xml git_version_tmp.xml &> /dev/null

View File

@ -480,7 +480,7 @@ print_usage(gboolean print_ver)
"Dumpcap " VERSION "%s\n"
"Capture network packets and dump them into a pcapng file.\n"
"See http://www.wireshark.org for more information.\n",
wireshark_svnversion);
wireshark_gitversion);
} else {
output = stderr;
}
@ -570,7 +570,7 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
"%s\n"
"%s\n"
"See http://www.wireshark.org for more information.\n",
wireshark_svnversion, get_copyright_info(), comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, get_copyright_info(), comp_info_str->str, runtime_info_str->str);
}
/*
@ -2872,7 +2872,7 @@ capture_loop_init_output(capture_options *capture_opts, loop_data *ld, char *err
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_svnversion);
g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_gitversion);
successful = pcapng_write_session_header_block(ld->pdh,
(const char *)capture_opts->capture_comment, /* Comment*/
NULL, /* HW*/
@ -3365,7 +3365,7 @@ do_file_switch_or_stop(capture_options *capture_opts,
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_svnversion);
g_snprintf(appname, sizeof(appname), "Dumpcap " VERSION "%s", wireshark_gitversion);
successful = pcapng_write_session_header_block(global_ld.pdh,
NULL, /* Comment */
NULL, /* HW */
@ -4219,7 +4219,7 @@ main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);

View File

@ -489,7 +489,7 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
get_runtime_version_info(runtime_info_str, NULL);
version_long_str = g_strdup_printf("%s%s\n%s\n%s\n%s",
version_str, wireshark_svnversion, get_copyright_info(),
version_str, wireshark_gitversion, get_copyright_info(),
comp_info_str->str, runtime_info_str->str);
if (error) {
@ -498,7 +498,7 @@ static void preinit_epan(char* argv0, int (*main)(int, char **)) {
/* Add it to the information to be reported on a crash. */
ws_add_crash_info("Echld " VERSION "%s\n%s\n%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
init_stuff();

View File

@ -82,7 +82,7 @@
#include <wsutil/md5.h>
#include <wsutil/plugins.h>
#include "svnversion.h"
#include "version.h"
#include "ringbuffer.h" /* For RINGBUFFER_MAX_NUM_FILES */
@ -676,8 +676,8 @@ usage(gboolean is_error)
output = stderr;
fprintf(output, "Editcap %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n", VERSION);
fprintf(output, "Edit and/or translate the format of capture files.\n");

View File

@ -1639,7 +1639,7 @@ add_library(epan ${LINK_MODE_LIB}
${LIBWIRESHARK_ASM_FILES}
)
add_dependencies(epan svnversion)
add_dependencies(epan gitversion)
set(FULL_SO_VERSION "0.0.0")

2
file.c
View File

@ -2614,7 +2614,7 @@ cf_print_packets(capture_file *cf, print_args_t *print_args)
callback_args.num_visible_cols = 0;
callback_args.visible_cols = NULL;
if (!print_preamble(print_args->stream, cf->filename, wireshark_svnversion)) {
if (!print_preamble(print_args->stream, cf->filename, wireshark_gitversion)) {
destroy_print_stream(print_args->stream);
return CF_PRINT_WRITE_ERROR;
}

View File

@ -38,7 +38,7 @@
#
# If run with the "-r" or "--set-release" argument the AC_INIT macro in
# configure.ac and the VERSION macro in config.nmake will have the
# pkg_format template appended to the version number. svnversion.h will
# pkg_format template appended to the version number. version.h will
# _not_ be generated if either argument is present.
#
# Default configuration:
@ -47,7 +47,7 @@
# svn_client: 1
# format: SVN %Y%m%d%H%M%S
# pkg_enable: 1
# pkg_format: -SVN-%#
# pkg_format: -%#
# XXX - We're pretty dumb about the "%#" substitution, and about having
# spaces in the package format.
@ -62,13 +62,14 @@ use Pod::Usage;
use IO::Handle;
use English;
my $version_file = 'svnversion.h';
my $version_file = 'version.h';
my $package_string = "";
my $vconf_file = 'version.conf';
my $tortoise_file = "tortoise_template";
my $last_change = 0;
my $revision = 0;
my $repo_path = "unknown";
my $num_commits = 0;
my $commit_id = '';
my $repo_branch = "unknown";
my $git_description = undef;
my $get_svn = 0;
my $set_svn = 0;
@ -84,12 +85,12 @@ my %version_pref = (
"git_client" => 0,
"svn_client" => 1,
"tortoise_svn" => 0,
"format" => "SVN %Y%m%d%H%M%S",
"format" => "git %Y%m%d%H%M%S",
"is_release" => 0,
# Normal development builds
"pkg_enable" => 1,
"pkg_format" => "-SVN-%#",
"pkg_format" => "-%#",
# Development releases
#"pkg_enable" => 0,
@ -161,37 +162,43 @@ sub read_repo_info {
no warnings "all";
chomp($line = qx{git --git-dir=$srcdir/.git log -1 --pretty=format:%at});
if (defined($line)) {
if ($? == 0 && length($line) > 1) {
$last_change = $line;
}
# Commits in current (master-1.8) branch. We may want to use
# a different number.
chomp($line = qx{git --git-dir=$srcdir/.git rev-list --count ea19c7f952ce9fc53fe4c223f1d9d6797346258b..HEAD});
if (defined($line)) {
$revision = $line;
# Commits since last annotated tag.
chomp($line = qx{git --git-dir=$srcdir/.git describe --long --always});
if ($? == 0 && length($line) > 1) {
my @parts = split(/-/, $line);
$num_commits = $parts[-2];
$commit_id = $parts[-1];
}
# Current short hash prefixed with "g"
chomp($line = qx{git --git-dir=$srcdir/.git rev-parse --short HEAD});
if ($? == 0 && length($line) > 1) {
}
chomp($line = qx{git --git-dir=$srcdir/.git ls-remote --get-url origin});
if (defined($line)) {
if ($? == 0 && length($line) > 1) {
$repo_url = $line;
}
# Probably not quite what we're looking for
chomp($line = qx{git --git-dir=$srcdir/.git rev-parse --abbrev-ref --symbolic-full-name \@\{upstream\}});
if (defined($line)) {
$repo_path = basename($line);
if ($? == 0 && length($line) > 1) {
$repo_branch = basename($line);
}
chomp($line = qx{git --git-dir=$srcdir/.git describe --dirty --match "v*"});
if (defined($line)) {
if ($? == 0 && length($line) > 1) {
$git_description = "wireshark-" . substr($line, 1);
}
1;
};
if ($last_change && $revision && $repo_url && $repo_path) {
if ($last_change && $num_commits && $repo_url && $repo_branch) {
$do_hack = 0;
}
} elsif ($version_pref{"svn_client"}) {
@ -204,7 +211,7 @@ sub read_repo_info {
$last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
}
if ($line =~ /Last Changed Rev: (\d+)/) {
$revision = $1;
$num_commits = $1;
}
if ($line =~ /URL: (\S+)/) {
$repo_url = $1;
@ -216,14 +223,14 @@ sub read_repo_info {
1;
};
if ($last_change && $revision && $repo_url && $repo_root) {
if ($last_change && $num_commits && $repo_url && $repo_root) {
$do_hack = 0;
}
} elsif ($version_pref{"tortoise_svn"}) {
# Dynamically generic template file needed by TortoiseSVN
open(TORTOISE, ">$tortoise_file");
print TORTOISE "#define SVNVERSION \"\$WCREV\$\"\r\n";
print TORTOISE "#define SVNPATH \"\$WCURL\$\"\r\n";
print TORTOISE "#define GITVERSION \"\$WCREV\$\"\r\n";
print TORTOISE "#define GITBRANCH \"\$WCURL\$\"\r\n";
close(TORTOISE);
$info_source = "Command line (SubWCRev)";
@ -237,21 +244,21 @@ sub read_repo_info {
unlink($tortoise_file);
}
if ($revision == 0) {
if ($num_commits == 0) {
# Fall back to config.nmake
$info_source = "Prodding config.nmake";
my $filepath = "$srcdir/config.nmake";
open(CFGNMAKE, "< $filepath") || die "Can't read $filepath!";
while ($line = <CFGNMAKE>) {
if ($line =~ /^SVN_REVISION=(\d+)/) {
$revision = $1;
if ($line =~ /^GIT_REVISION=(\d+)/) {
$num_commits = $1;
$do_hack = 0;
last;
}
}
close (CFGNMAKE);
}
if ($revision == 0 and -d "$srcdir/.git") {
if ($num_commits == 0 and -d "$srcdir/.git") {
# Try git...
eval {
@ -264,7 +271,7 @@ sub read_repo_info {
$line = qx{$info_cmd};
if (defined($line)) {
if ($line =~ /svn path=.*; revision=(\d+)/) {
$revision = $1;
$num_commits = $1;
}
}
$info_cmd = "(cd $srcdir; git log --format='%ad' -n 1 --date=iso)";
@ -278,13 +285,13 @@ sub read_repo_info {
$line = qx{$info_cmd};
if (defined($line)) {
if ($line =~ /\* (\S+)/) {
$repo_path = $1;
$repo_branch = $1;
}
}
1;
};
}
if ($revision == 0 and -d "$srcdir/.bzr") {
if ($num_commits == 0 and -d "$srcdir/.bzr") {
# Try bzr...
eval {
@ -297,8 +304,8 @@ sub read_repo_info {
$last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
}
if ($line =~ /svn revno: (\d+) \(on (\S+)\)/) {
$revision = $1;
$repo_path = $2;
$num_commits = $1;
$repo_branch = $2;
}
}
1;
@ -336,11 +343,11 @@ sub read_repo_info {
if ($line =~ /committed-date="(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)/) {
$last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
}
if ($line =~ /revision="(\d+)"/) { $revision = $1; }
if ($line =~ /revision="(\d+)"/) { $num_commits = $1; }
}
if ($line =~ /\/>/) {
if (($svn_name eq "" || $svn_name eq "svn:this_dir") &&
$last_change && $revision) {
$last_change && $num_commits) {
$in_entries = 0;
last;
}
@ -354,19 +361,20 @@ sub read_repo_info {
# If we picked up the revision and modification time,
# generate our strings.
if ($revision && $last_change) {
$version_format =~ s/%#/$revision/;
$package_format =~ s/%#/$revision/;
if ($num_commits && $last_change) {
$version_format =~ s/%#/$num_commits/;
$package_format =~ s/%#/$num_commits-$commit_id/;
$package_string = strftime($package_format, gmtime($last_change));
}
if ($repo_url && $repo_root && index($repo_url, $repo_root) == 0) {
$repo_path = substr($repo_url, length($repo_root));
$repo_branch = substr($repo_url, length($repo_root));
}
if ($get_svn) {
print <<"Fin";
SVN revision : $revision
Commit distance : $num_commits
Commit ID : $commit_id
Revision source : $info_source
Release stamp : $package_string
Fin
@ -416,8 +424,8 @@ sub update_config_nmake
open(CFGNMAKE, "< $filepath") || die "Can't read $filepath!";
while ($line = <CFGNMAKE>) {
if ($line =~ /^SVN_REVISION=.*([\r\n]+)$/) {
$line = sprintf("SVN_REVISION=%d$1", $revision);
if ($line =~ /^GIT_REVISION=.*([\r\n]+)$/) {
$line = sprintf("GIT_REVISION=%d$1", $num_commits);
} elsif ($set_version && $line =~ /^VERSION_MAJOR=.*([\r\n]+)$/) {
$line = sprintf("VERSION_MAJOR=%d$1", $version_pref{"version_major"});
} elsif ($set_version && $line =~ /^VERSION_MINOR=.*([\r\n]+)$/) {
@ -574,26 +582,26 @@ sub update_versioned_files
# Print the SVN version to $version_file.
# Don't change the file if it is not needed.
sub print_svn_revision
sub print_GIT_REVISION
{
my $svn_revision;
my $GIT_REVISION;
my $needs_update = 1;
if ($git_description) {
$svn_revision = "#define SVNVERSION \"" .
$GIT_REVISION = "#define GITVERSION \"" .
$git_description . "\"\n" .
"#define SVNPATH \"" . $repo_path . "\"\n";
} elsif ($last_change && $revision) {
$svn_revision = "#define SVNVERSION \"SVN Rev " .
$revision . "\"\n" .
"#define SVNPATH \"" . $repo_path . "\"\n";
"#define GITBRANCH \"" . $repo_branch . "\"\n";
} elsif ($last_change && $num_commits) {
$GIT_REVISION = "#define GITVERSION \"Git Rev " .
$num_commits . "\"\n" .
"#define GITBRANCH \"" . $repo_branch . "\"\n";
} else {
$svn_revision = "#define SVNVERSION \"SVN Rev Unknown\"\n" .
"#define SVNPATH \"unknown\"\n";
$GIT_REVISION = "#define GITVERSION \"Git Rev Unknown\"\n" .
"#define GITBRANCH \"unknown\"\n";
}
if (open(OLDREV, "<$version_file")) {
my $old_svn_revision = <OLDREV> . <OLDREV>;
if ($old_svn_revision eq $svn_revision) {
my $old_GIT_REVISION = <OLDREV> . <OLDREV>;
if ($old_GIT_REVISION eq $GIT_REVISION) {
$needs_update = 0;
}
close OLDREV;
@ -602,9 +610,9 @@ sub print_svn_revision
if (! $set_svn) { return; }
if ($needs_update) {
# print "Updating $version_file so it contains:\n$svn_revision";
# print "Updating $version_file so it contains:\n$GIT_REVISION";
open(VER, ">$version_file") || die ("Cannot write to $version_file ($!)\n");
print VER "$svn_revision";
print VER "$GIT_REVISION";
close VER;
print "$version_file has been updated.\n";
} else {
@ -661,7 +669,7 @@ sub get_config {
&read_repo_info();
&print_svn_revision;
&print_GIT_REVISION;
if ($set_version || $set_release) {
if ($set_version) {
@ -677,7 +685,7 @@ if ($set_version || $set_release) {
print "Generating release information\n";
} else {
print "Resetting release information\n";
$revision = 0;
$num_commits = 0;
$package_string = "";
}
@ -698,7 +706,7 @@ make-version.pl [options] [source directory]
--help, -h This help message
--get-svn, -g Print the SVN revision and source.
--set-svn, -s Set the information in svnversion.h
--set-svn, -s Set the information in version.h
--set-version, -v Set the major, minor, and micro versions in
configure.ac, config.nmake, debian/changelog,
and docbook/asciidoc.conf.

View File

@ -52,7 +52,7 @@
#include <wiretap/merge.h>
#include "svnversion.h"
#include "version.h"
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
@ -117,8 +117,8 @@ usage(gboolean is_error)
}
fprintf(output, "Mergecap %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n", VERSION);
fprintf(output, "Merge two or more capture files into one.\n");

View File

@ -195,7 +195,7 @@ print_usage(gboolean print_ver)
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
wireshark_svnversion, get_copyright_info());
wireshark_gitversion, get_copyright_info());
} else {
output = stderr;
}
@ -435,7 +435,7 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@ -486,7 +486,7 @@ main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);

View File

@ -53,8 +53,8 @@ static void usage(gboolean is_error)
}
fprintf(output, "Reordercap %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n", VERSION);
fprintf(output, "Reorder timestamps of input file frames into output file.\n");
@ -98,10 +98,10 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf,
gchar *err_info;
struct wtap_pkthdr phdr;
DEBUG_PRINT("\nDumping frame (offset=%" G_GINT64_MODIFIER "u)\n",
DEBUG_PRINT("\nDumping frame (offset=%" G_GINT64_MODIFIER "u)\n",
frame->offset);
/* Re-read the first frame from the stored location */
if (!wtap_seek_read(wth, frame->offset, &phdr, buf, &err, &err_info)) {
if (err != 0) {

View File

@ -135,7 +135,7 @@
#include "pcapio.h"
#include "text2pcap.h"
#include "svnversion.h"
#include "version.h"
#ifdef _WIN32
#include <wsutil/unicode-utils.h>
@ -888,8 +888,8 @@ write_file_header (void)
gboolean success;
if (use_pcapng) {
#ifdef SVNVERSION
const char *appname = "text2pcap (" SVNVERSION " from " SVNPATH ")";
#ifdef GITVERSION
const char *appname = "text2pcap (" GITVERSION " from " GITBRANCH ")";
#else
const char *appname = "text2pcap";
#endif
@ -1387,8 +1387,8 @@ usage (gboolean is_error)
fprintf(output,
"Text2pcap %s"
#ifdef SVNVERSION
" (" SVNVERSION " from " SVNPATH ")"
#ifdef GITVERSION
" (" GITVERSION " from " GITBRANCH ")"
#endif
"\n"
"Generate a capture file from an ASCII hexdump of packets.\n"

View File

@ -203,7 +203,7 @@ print_usage(gboolean print_ver)
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
wireshark_svnversion, get_copyright_info());
wireshark_gitversion, get_copyright_info());
} else {
output = stderr;
}
@ -271,7 +271,7 @@ glossary_option_help(void)
output = stdout;
fprintf(output, "TFShark " VERSION "%s\n", wireshark_svnversion);
fprintf(output, "TFShark " VERSION "%s\n", wireshark_gitversion);
fprintf(output, "\n");
fprintf(output, "Usage: tfshark -G [report]\n");
@ -749,7 +749,7 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@ -802,7 +802,7 @@ main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@ -2101,7 +2101,7 @@ write_preamble(capture_file *cf)
switch (output_action) {
case WRITE_TEXT:
return print_preamble(print_stream, cf ? cf->filename : NULL, wireshark_svnversion);
return print_preamble(print_stream, cf ? cf->filename : NULL, wireshark_gitversion);
case WRITE_XML:
if (print_details)

View File

@ -142,7 +142,7 @@ PATH_SPECIFIC_WHITELISTED_LICENSES = {
'packaging/macosx': [
'UNKNOWN',
],
'svnversion.h': [
'version.h': [
'UNKNOWN',
],
'tools/lemon': [

View File

@ -259,7 +259,7 @@ print_usage(gboolean print_ver)
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
wireshark_svnversion, get_copyright_info());
wireshark_gitversion, get_copyright_info());
} else {
output = stderr;
}
@ -381,7 +381,7 @@ glossary_option_help(void)
output = stdout;
fprintf(output, "TShark " VERSION "%s\n", wireshark_svnversion);
fprintf(output, "TShark " VERSION "%s\n", wireshark_gitversion);
fprintf(output, "\n");
fprintf(output, "Usage: tshark -G [report]\n");
@ -887,7 +887,7 @@ show_version(GString *comp_info_str, GString *runtime_info_str)
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@ -988,7 +988,7 @@ main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
#ifdef _WIN32
arg_list_utf_16to8(argc, argv);
@ -3050,7 +3050,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
}
/* If we don't have an application name add Tshark */
if (shb_hdr->shb_user_appl == NULL) {
g_snprintf(appname, sizeof(appname), "TShark " VERSION "%s", wireshark_svnversion);
g_snprintf(appname, sizeof(appname), "TShark " VERSION "%s", wireshark_gitversion);
shb_hdr->shb_user_appl = appname;
}
@ -3550,7 +3550,7 @@ write_preamble(capture_file *cf)
switch (output_action) {
case WRITE_TEXT:
return print_preamble(print_stream, cf ? cf->filename : NULL, wireshark_svnversion);
return print_preamble(print_stream, cf ? cf->filename : NULL, wireshark_gitversion);
case WRITE_XML:
if (print_details)

View File

@ -328,7 +328,7 @@ about_wireshark_page_new(void)
"Wireshark is Open Source Software released under the GNU General Public License.\n"
"\n"
"Check the man page and http://www.wireshark.org for more information.",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
msg_label = gtk_label_new(message);

View File

@ -475,7 +475,7 @@ file_import_open(text_import_info_t *info)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_svnversion);
g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_gitversion);
shb_hdr = g_new(wtapng_section_t,1);
shb_hdr->section_length = -1;

View File

@ -460,7 +460,7 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
return;
}
if (!print_preamble(stream, cfile.filename, wireshark_svnversion))
if (!print_preamble(stream, cfile.filename, wireshark_gitversion))
goto print_error;
switch (follow_read_stream(follow_info, follow_print_text, stream)) {

View File

@ -1163,7 +1163,7 @@ print_usage(gboolean print_ver) {
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
wireshark_svnversion, get_copyright_info());
wireshark_gitversion, get_copyright_info());
} else {
output = stderr;
}
@ -1260,7 +1260,7 @@ show_version(void)
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@ -2270,7 +2270,7 @@ main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
/* Start windows sockets */
WSAStartup( MAKEWORD( 1, 1 ), &wsaData );
@ -2568,7 +2568,7 @@ main(int argc, char *argv[])
prefs_p = read_configuration_files (&gdp_path, &dp_path);
/* Removed thread code:
* http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=35027
* https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9e277ae6154fd04bf6a0a34ec5655a73e5a736a3
*/
/* this is to keep tap extensions updating once every 3 seconds */

View File

@ -78,7 +78,7 @@ main_titlebar_update(void)
if ((prefs.gui_version_placement == version_title_only) ||
(prefs.gui_version_placement == version_both)) {
gchar *old_title = title;
title = g_strdup_printf("%s [Wireshark %s %s]", title, VERSION, wireshark_svnversion);
title = g_strdup_printf("%s [Wireshark %s %s]", title, VERSION, wireshark_gitversion);
g_free(old_title);
}
gtk_window_set_title(GTK_WINDOW(top_level), title);

View File

@ -338,7 +338,7 @@ welcome_header_set_message(gchar *msg) {
if ((prefs.gui_version_placement == version_welcome_only) ||
(prefs.gui_version_placement == version_both)) {
g_string_append_printf(message, "</span>\n<span size=\"large\" foreground=\"white\">Version " VERSION "%s",
wireshark_svnversion);
wireshark_gitversion);
}
}

View File

@ -671,7 +671,7 @@ summary_to_texbuff(GtkTextBuffer *buffer)
#endif
/* Add Wireshark version*/
g_snprintf(string_buff, SUM_STR_MAX, "Summary created by Wireshark %s\n\n", wireshark_svnversion);
g_snprintf(string_buff, SUM_STR_MAX, "Summary created by Wireshark %s\n\n", wireshark_gitversion);
gtk_text_buffer_insert_at_cursor (buffer, string_buff, -1);
/* Info about file */

View File

@ -126,7 +126,7 @@ AboutDialog::AboutDialog(QWidget *parent) :
"Wireshark is Open Source Software released under the GNU General Public License.\n"
"\n"
"Check the man page and http://www.wireshark.org for more information.",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
ui->label_wireshark->setTextInteractionFlags(Qt::TextSelectableByMouse);

View File

@ -210,7 +210,7 @@ print_usage(gboolean print_ver) {
"See http://www.wireshark.org for more information.\n"
"\n"
"%s",
wireshark_svnversion, get_copyright_info());
wireshark_gitversion, get_copyright_info());
} else {
output = stderr;
}
@ -302,7 +302,7 @@ show_version(void)
"%s"
"\n"
"%s",
wireshark_svnversion, get_copyright_info(), comp_info_str->str,
wireshark_gitversion, get_copyright_info(), comp_info_str->str,
runtime_info_str->str);
}
@ -544,7 +544,7 @@ int main(int argc, char *argv[])
"%s"
"\n"
"%s",
wireshark_svnversion, comp_info_str->str, runtime_info_str->str);
wireshark_gitversion, comp_info_str->str, runtime_info_str->str);
/*
* Get credential information for later use, and drop privileges
@ -905,7 +905,7 @@ int main(int argc, char *argv[])
wsApp->installTranslator(&qtTranslator);
/* Removed thread code:
* http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=35027
* https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=9e277ae6154fd04bf6a0a34ec5655a73e5a736a3
*/
g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: timestamp types should be set elsewhere");

View File

@ -127,7 +127,7 @@ QString SummaryDialog::SummaryToString()
QString summaryStr;
QTextStream out(&summaryStr);
out << tr("Summary created by Wireshark %1\n\n").arg(wireshark_svnversion);
out << tr("Summary created by Wireshark %1\n\n").arg(wireshark_gitversion);
// File Section
out << tr("File: \n");

View File

@ -102,7 +102,7 @@ exp_pdu_file_open(exp_pdu_t *exp_pdu_tap_data)
os_info_str = g_string_new("");
get_os_version_info(os_info_str);
g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_svnversion);
g_snprintf(appname, sizeof(appname), "Wireshark " VERSION "%s", wireshark_gitversion);
shb_hdr = g_new(wtapng_section_t,1);
shb_hdr->section_length = -1;

View File

@ -43,7 +43,7 @@
#include "capture-pcap-util.h"
#include <wsutil/unicode-utils.h>
#include "svnversion.h"
#include "version.h"
#ifdef HAVE_WINDOWS_H
#include <windows.h>
@ -58,10 +58,10 @@
# include <sys/capability.h>
#endif
#ifdef SVNVERSION
const char *wireshark_svnversion = " (" SVNVERSION " from " SVNPATH ")";
#ifdef GITVERSION
const char *wireshark_gitversion = " (" GITVERSION " from " GITBRANCH ")";
#else
const char *wireshark_svnversion = "";
const char *wireshark_gitversion = "";
#endif
/*
@ -626,7 +626,7 @@ do_cpuid(int *CPUInfo, guint32 selector){
__cpuid(CPUInfo, selector);
}
#elif defined(__GNUC__)
#if defined(__x86_64__)
#if defined(__x86_64__)
static inline void
do_cpuid(guint32 *CPUInfo, int selector)
{
@ -697,7 +697,7 @@ static void get_mem_info(GString *str _U_)
MEMORYSTATUSEX statex;
statex.dwLength = sizeof (statex);
if(GlobalMemoryStatusEx (&statex))
g_string_append_printf(str, ", with ""%" G_GINT64_MODIFIER "d" "MB of physical memory.\n", statex.ullTotalPhys/(1024*1024));
#endif

View File

@ -31,9 +31,9 @@ extern "C" {
#endif /* __cplusplus */
/*
* The svn version string or ""
* The Git version string or ""
*/
extern const gchar *wireshark_svnversion;
extern const gchar *wireshark_gitversion;
/*
* Get various library compile-time versions and append them to