my $set_release = 0;
my %version_pref = (
"version_major" => 1,
- "version_minor" => 9,
- "version_micro" => 0,
+ "version_minor" => 11,
+ "version_micro" => 1,
"version_build" => 0,
"enable" => 1,
#"pkg_format" => "",
);
my $srcdir = ".";
-my $svn_info_cmd = "";
+my $info_cmd = "";
# Ensure we run with correct locale
$ENV{LANG} = "C";
$package_format = $version_pref{"pkg_format"};
}
- if (-d "$srcdir/.svn") {
+ if (-d "$srcdir/.svn" or -d "$srcdir/../.svn") {
$info_source = "Command line (svn info)";
- $svn_info_cmd = "svn info $srcdir";
+ $info_cmd = "svn info $srcdir";
} elsif (-d "$srcdir/.git/svn") {
$info_source = "Command line (git-svn)";
- $svn_info_cmd = "(cd $srcdir; git svn info)";
+ $info_cmd = "(cd $srcdir; git svn info)";
}
if ($version_pref{"svn_client"}) {
eval {
use warnings "all";
no warnings "all";
- $line = qx{$svn_info_cmd};
+ $line = qx{$info_cmd};
if (defined($line)) {
if ($line =~ /Last Changed Date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
$last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
close(TORTOISE);
$info_source = "Command line (SubWCRev)";
- $svn_info_cmd = "SubWCRev $srcdir $tortoise_file $version_file";
- my $tortoise = system($svn_info_cmd);
+ $info_cmd = "SubWCRev $srcdir $tortoise_file $version_file";
+ my $tortoise = system($info_cmd);
if ($tortoise == 0) {
$do_hack = 0;
}
}
close (CFGNMAKE);
}
- if ($revision == 0) {
+ if ($revision == 0 and -d "$srcdir/.git") {
# Try git...
eval {
use warnings "all";
no warnings "all";
- $svn_info_cmd = "(cd $srcdir; git log --format='commit: %h%ndate: %ad' -n 1 --date=iso)";
- $line = qx{$svn_info_cmd};
+ # If someone had properly tagged 1.9.0 we could also use
+ # "git describe --abbrev=1 --tags HEAD"
+
+ $info_cmd = "(cd $srcdir; git log --format='%b' -n 1)";
+ $line = qx{$info_cmd};
if (defined($line)) {
- if ($line =~ /date: (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
- $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
- }
- if ($line =~ /commit: (\S+)/) {
+ if ($line =~ /svn path=.*; revision=(\d+)/) {
$revision = $1;
}
}
- $svn_info_cmd = "(cd $srcdir; git branch)";
- $line = qx{$svn_info_cmd};
+ $info_cmd = "(cd $srcdir; git log --format='%ad' -n 1 --date=iso)";
+ $line = qx{$info_cmd};
+ if (defined($line)) {
+ if ($line =~ /(\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
+ $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
+ }
+ }
+ $info_cmd = "(cd $srcdir; git branch)";
+ $line = qx{$info_cmd};
if (defined($line)) {
if ($line =~ /\* (\S+)/) {
$repo_path = $1;
1;
};
}
+ if ($revision == 0 and -d "$srcdir/.bzr") {
+
+ # Try bzr...
+ eval {
+ use warnings "all";
+ no warnings "all";
+ $info_cmd = "(cd $srcdir; bzr log -l 1)";
+ $line = qx{$info_cmd};
+ if (defined($line)) {
+ if ($line =~ /timestamp: \S+ (\d{4})-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/) {
+ $last_change = timegm($6, $5, $4, $3, $2 - 1, $1);
+ }
+ if ($line =~ /svn revno: (\d+) \(on (\S+)\)/) {
+ $revision = $1;
+ $repo_path = $2;
+ }
+ }
+ 1;
+ };
+ }
# 'svn info' failed or the user really wants us to dig around in .svn/entries
}
-# Read configure.in, then write it back out with an updated
+# Read configure.ac, then write it back out with an updated
# "AC_INIT" line.
sub update_configure_ac
{
open(CFGIN, "< $filepath") || die "Can't read $filepath!";
while ($line = <CFGIN>) {
- if ($line =~ /^AC_INIT\(wireshark, (\d+)\.(\d+).(\d+) *,(.*[\r\n]+)$/) {
- $line = sprintf("AC_INIT\(wireshark, %d.%d.%d%s,$4",
- $set_version ? $version_pref{"version_major"} : $1,
- $set_version ? $version_pref{"version_minor"} : $2,
- $set_version ? $version_pref{"version_micro"} : $3,
- $package_string
- );
-
+ if ($line =~ /^m4_define\( *\[?version_major\]? *,.*([\r\n]+)$/) {
+ $line = sprintf("m4_define([version_major], [%d])$1", $version_pref{"version_major"});
+ } elsif ($line =~ /^m4_define\( *\[?version_minor\]? *,.*([\r\n]+)$/) {
+ $line = sprintf("m4_define([version_minor], [%d])$1", $version_pref{"version_minor"});
+ } elsif ($line =~ /^m4_define\( *\[?version_micro\]? *,.*([\r\n]+)$/) {
+ $line = sprintf("m4_define([version_micro], [%d])$1", $version_pref{"version_micro"});
+ } elsif ($line =~ /^m4_append\( *\[?version_micro_extra\]? *,.*([\r\n]+)$/) {
+ $line = sprintf("m4_append([version_micro_extra], [%s])$1", $package_string);
}
$contents .= $line
}
print "$filepath has been updated.\n";
}
-# Read docbook/release_notes.xml, then write it back out with an updated
-# "WiresharkCurrentVersion" line.
+# Read docbook/asciidoc.conf, then write it back out with an updated
+# wireshark-version replacement line.
sub update_release_notes
{
my $line;
my $contents = "";
my $version = "";
- my $filepath = "$srcdir/docbook/release-notes.xml";
+ my $filepath = "$srcdir/docbook/asciidoc.conf";
return if (!$set_version);
- open(RELNOTES, "< $filepath") || die "Can't read $filepath!";
- while ($line = <RELNOTES>) {
- # <!ENTITY WiresharkCurrentVersion "1.7.1">
+ open(ADOC_CONF, "< $filepath") || die "Can't read $filepath!";
+ while ($line = <ADOC_CONF>) {
+ # wireshark-version:\[\]=1.9.1
- if ($line =~ /<\!ENTITY\s+WiresharkCurrentVersion\s+.*([\r\n]+)$/) {
- $line = sprintf("<!ENTITY WiresharkCurrentVersion \"%d.%d.%d\">$1",
+ if ($line =~ /^wireshark-version:\\\[\\\]=.*([\r\n]+)$/) {
+ $line = sprintf("wireshark-version:\\\[\\\]=%d.%d.%d$1",
$version_pref{"version_major"},
$version_pref{"version_minor"},
$version_pref{"version_micro"},
$contents .= $line
}
- open(RELNOTES, "> $filepath") || die "Can't write $filepath!";
- print(RELNOTES $contents);
- close(RELNOTES);
+ open(ADOC_CONF, "> $filepath") || die "Can't write $filepath!";
+ print(ADOC_CONF $contents);
+ close(ADOC_CONF);
print "$filepath has been updated.\n";
}
--set-svn, -s Set the information in svnversion.h
--set-version, -v Set the major, minor, and micro versions in
configure.ac, config.nmake, debian/changelog,
- and docbook/release_notes.xml.
+ and docbook/asciidoc.conf.
Resets the release information when used by
itself.
--set-release, -r Set the release information in configure.ac
Options can be used in any combination. If none are specified B<--set-svn>
is assumed.
+
+#
+# Editor modelines - http://www.wireshark.org/tools/modelines.html
+#
+# Local variables:
+# c-basic-offset: 8
+# tab-width: 8
+# indent-tabs-mode: t
+# End:
+#
+# vi: set shiftwidth=8 tabstop=8 noexpandtab:
+# :indentSize=8:tabSize=8:noTabs=false:
+#
+#