make-version: Silence one diagnostic message with a verbose option
authorJoão Valverde <joao.valverde@tecnico.ulisboa.pt>
Wed, 3 Feb 2016 14:46:17 +0000 (14:46 +0000)
committerAnders Broman <a.broman58@gmail.com>
Thu, 4 Feb 2016 05:19:24 +0000 (05:19 +0000)
Change-Id: If8b9d7e356ebfe2cbb263a4cb67b18bafdd1b8ee
Reviewed-on: https://code.wireshark.org/review/13690
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
make-version.pl

index a3643ddef8e6f6d377e8a6f1a803b3fdf87431af..76fbf2c4516d57f6ea8501cce06a28c480da9d26 100755 (executable)
@@ -103,12 +103,17 @@ my %version_pref = (
        );
 my $srcdir = ".";
 my $info_cmd = "";
+my $verbose = 0;
 
 # Ensure we run with correct locale
 $ENV{LANG} = "C";
 $ENV{LC_ALL} = "C";
 $ENV{GIT_PAGER} = "";
 
+sub print_diag {
+       print STDERR @_ if $verbose;
+}
+
 # Attempt to get revision information from the repository.
 sub read_repo_info {
        my $line;
@@ -694,7 +699,8 @@ sub get_config {
                   "git-bin", \$git_executable,
                   "print-vcs", \$print_vcs,
                   "set-version|v", \$set_version,
-                  "set-release|r|package-version|p", \$set_release
+                  "set-release|r|package-version|p", \$set_release,
+                  "verbose", \$verbose
                   ) || pod2usage(2);
 
        if ($show_help) { pod2usage(1); }
@@ -708,8 +714,8 @@ sub get_config {
        }
 
        if (! open(FILE, "<$vconf_file")) {
-               print STDERR "Version configuration file $vconf_file not "
-               . "found.  Using defaults.\n";
+               print_diag "Version configuration file $vconf_file not "
+               . "found. Using defaults.\n";
                return 1;
        }
 
@@ -778,6 +784,7 @@ make-version.pl [options] [source directory]
     --set-release, -r          Set the release information in configure.ac
                                and config.nmake
     --package-version, -p      Deprecated. Same as --set-release.
+    --verbose                  Print diagnostic messages to STDERR.
 
 Options can be used in any combination. If none are specified B<--set-svn>
 is assumed.