Repository: bigtop Updated Branches: refs/heads/master 11af728be -> 7a7df5d05
BIGTOP-3031: Auto find latest maven dist Similar to ant, maven dist binaries may get updated from time to time on Apache mirrors. A better way is to auto find latest maven-3 binary release. Used the same way in BIGTOP-3022. This closes #356 Change-Id: I0384a656701f62bd7ef7fc40cd6ab85533ba49fc Signed-off-by: Jun He <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/7a7df5d0 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/7a7df5d0 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/7a7df5d0 Branch: refs/heads/master Commit: 7a7df5d052d256397c55a8a69d3f06e24e2e99fc Parents: 11af728 Author: Jun He <[email protected]> Authored: Mon May 14 13:56:04 2018 +0800 Committer: Jun He <[email protected]> Committed: Tue May 15 06:11:43 2018 +0000 ---------------------------------------------------------------------- .../parser/functions/latest_maven_binary.rb | 22 ++++++++++++++++++++ bigtop_toolchain/manifests/maven.pp | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/7a7df5d0/bigtop_toolchain/lib/puppet/parser/functions/latest_maven_binary.rb ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/lib/puppet/parser/functions/latest_maven_binary.rb b/bigtop_toolchain/lib/puppet/parser/functions/latest_maven_binary.rb new file mode 100644 index 0000000..5aaffac --- /dev/null +++ b/bigtop_toolchain/lib/puppet/parser/functions/latest_maven_binary.rb @@ -0,0 +1,22 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +module Puppet::Parser::Functions + newfunction(:latest_maven_binary, :type => :rvalue) do |args| + versionmask=args[0] + # We are using main mirror here because can't be sure about Apache Server config on every mirror. It could be Nginx, btw. + %x(curl --stderr /dev/null 'https://www.apache.org/dist/maven/maven-3/?F=0&V=1' | grep -o '<li>.*href="#{versionmask}/"' | grep -o '#{versionmask}').chomp + end +end http://git-wip-us.apache.org/repos/asf/bigtop/blob/7a7df5d0/bigtop_toolchain/manifests/maven.pp ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/manifests/maven.pp b/bigtop_toolchain/manifests/maven.pp index 34ada29..adbb0c8 100644 --- a/bigtop_toolchain/manifests/maven.pp +++ b/bigtop_toolchain/manifests/maven.pp @@ -14,7 +14,7 @@ # limitations under the License. class bigtop_toolchain::maven { - $mvnversion = '3.5.2' + $mvnversion = latest_maven_binary("3.5.[0-9]*") $mvn = "apache-maven-$mvnversion" $apache_prefix = nearest_apache_mirror()
