]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1365734 - Handle BMO version number in Makefile.PL / MYMETA.json
authorDylan William Hardison <dylan@hardison.net>
Wed, 31 May 2017 21:48:17 +0000 (17:48 -0400)
committerDylan William Hardison <dylan@hardison.net>
Wed, 31 May 2017 21:48:38 +0000 (17:48 -0400)
Bugzilla.pm
Bugzilla/Config/Core.pm
Bugzilla/Constants.pm
Bugzilla/Template.pm
Makefile.PL
index.cgi
template/en/default/admin/params/core.html.tmpl
template/en/default/index.html.tmpl

index ba662feb58481ead58a8a062d3b9ae8027d0601a..b4b7a48c853dff594e47e05aa6c1c278052c24bb 100644 (file)
@@ -20,6 +20,8 @@ BEGIN {
     }
 }
 
+our $VERSION = '20170531.2';
+
 use Bugzilla::Auth;
 use Bugzilla::Auth::Persist::Cookie;
 use Bugzilla::CGI;
index 0e95741a9c47a2d2fa424d2bee6f5f3a2c5bea62..654e569ba1b30583fa37c661b04de1b771e8b32f 100644 (file)
@@ -23,12 +23,6 @@ use constant get_param_list => (
    checker => \&check_urlbase
   },
 
-  {
-   name => 'bugzilla_version',
-   type => 't',
-   default => '',
-  },
-
   {
    name => 'ssl_redirect',
    type => 'b',
index 852c9c362d11c57d9cde4a11aa8ffb1e781e4030..7d5f6fa2e9bf2a2d978e1a037bbb7f33cc0dd5b9 100644 (file)
@@ -208,7 +208,7 @@ use Memoize;
 sub BUGZILLA_VERSION {
     my $bugzilla_version = '4.2';
     eval { require Bugzilla } || return $bugzilla_version;
-    return Bugzilla->params->{bugzilla_version} || $bugzilla_version;
+    eval { Bugzilla->VERSION } || $bugzilla_version;
 }
 
 # A base link to the current REST Documentation. We place it here
index 75711e1ef5d1b477143c6c403a180b5623f88a59..5bef599d4f37e718a6e5fd25c1511dbd26b30f03 100644 (file)
@@ -983,6 +983,21 @@ sub create {
             # Function for retrieving global parameters.
             'Param' => sub { return Bugzilla->params->{$_[0]}; },
 
+            'bugzilla_version' => sub {
+                my $version = Bugzilla->VERSION;
+                if (my @ver = $version =~ /^(\d{4})(\d{2})(\d{2})\.(\d+)$/s) {
+                    if ($ver[3] eq '1') {
+                        return join('.', @ver[0,1,2]);
+                    }
+                    else {
+                        return join('.', @ver);
+                    }
+                }
+                else {
+                    return $version;
+                }
+            },
+
             json_encode => sub {
                 return encode_json($_[0]);
             },
index d3ee9ae890bcc28d2d1ba42bc863a83ea9f04264..3bc7eac4d0e30d676a6e6807edfa8b435e9144c2 100755 (executable)
@@ -24,8 +24,7 @@ BEGIN {
     lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5)));
 }
 
-use ExtUtils::MakeMaker 6.55;
-use constant BUGZILLA_VERSION => $ENV{BUGZILLA_VERSION} // 42;
+use ExtUtils::MakeMaker 7.24;
 use File::Basename;
 use File::Spec;
 
@@ -382,7 +381,7 @@ $optional_features{bmo} = {
 WriteMakefile(
     NAME             => 'Bugzilla',
     AUTHOR           => q{Bugzilla Developers <developers@bugzilla.org>},
-    VERSION          => BUGZILLA_VERSION,
+    VERSION_FROM     => 'Bugzilla.pm',
     ABSTRACT         => 'Bugzilla Bug Tracking System',
     LICENSE          => 'Mozilla_2_0',
     MIN_PERL_VERSION => '5.10.1',
index 7ebc3130ff39c7b1a5781a131ad68d5771111143..d73ccd5d906da98b9ed34b90538f4f96a298811c 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -45,7 +45,7 @@ if ($cgi->param('logout')) {
 # our weak etag is based on the bugzilla version parameter (BMO customization) and the announcehtml
 # if either change, the cache will be considered invalid.
 my @etag_parts = (
-    Bugzilla->params->{bugzilla_version},
+    Bugzilla->VERSION,
     Bugzilla->params->{announcehtml},
     Bugzilla->params->{createemailregexp},
 );
index 0f7a9513960f23abf0bab69fd920e48801139481..b1578f422b4cccc8b55b8363816cc136925746aa 100644 (file)
@@ -28,9 +28,6 @@
   urlbase => "The URL that is the common initial leading part of all $terms.Bugzilla " _
              "URLs.",
 
-  bugzilla_version => "The visible version number of Bugzilla. This should be set to " _
-                      "the date when BMO was last updated, in the format <tt>yyyy.mm.dd</tt>",
-
   sslbase => "The URL that is the common initial leading part of all HTTPS " _
              "(SSL) $terms.Bugzilla URLs.",
 
index c79be57caebfde830ce178476ab9697ffa97d665..70c3d7f3efefe048cca822d04d2969a26855f7ae 100644 (file)
@@ -28,7 +28,7 @@
 [% PROCESS global/header.html.tmpl
    title = "$terms.Bugzilla Main Page"
    header = "Main Page" 
-   header_addl_info = "version " _ (Bugzilla.params.bugzilla_version || constants.BUGZILLA_VERSION)
+   header_addl_info = "version " _ bugzilla_version
    style_urls = [ 'skins/standard/index.css' ]
    no_yui = 1
 %]