Repository: bigtop Updated Branches: refs/heads/master d8d4408bc -> c2760214a
BIGTOP-3022 Auto find of latest Ant That patch allow to derminate latest version of Ant available on apache dist. There is one restriction. We query main apache mirror instead of nearest one because we can't be sure it use Apache with same configuration as main. Signed-off-by: Olaf Flebbe <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/c2760214 Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/c2760214 Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/c2760214 Branch: refs/heads/master Commit: c2760214a1e2430eec313ebb53f9e52311b501f3 Parents: d8d4408 Author: Anton Chevychalov <[email protected]> Authored: Tue Apr 17 14:20:39 2018 +0300 Committer: Olaf Flebbe <[email protected]> Committed: Thu Apr 19 22:10:42 2018 +0200 ---------------------------------------------------------------------- .../parser/functions/latest_ant_binary.rb | 22 ++++++++++++++++++++ bigtop_toolchain/manifests/ant.pp | 4 ++-- 2 files changed, 24 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/c2760214/bigtop_toolchain/lib/puppet/parser/functions/latest_ant_binary.rb ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/lib/puppet/parser/functions/latest_ant_binary.rb b/bigtop_toolchain/lib/puppet/parser/functions/latest_ant_binary.rb new file mode 100644 index 0000000..94d0c6c --- /dev/null +++ b/bigtop_toolchain/lib/puppet/parser/functions/latest_ant_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_ant_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/ant/binaries/?F=0&V=1' | grep -o '<li>.*href="apache-ant-#{versionmask}-bin.tar.gz"' | grep -o "apache-ant-#{versionmask}" | tail -1 | tr -d '\r').chomp + end +end http://git-wip-us.apache.org/repos/asf/bigtop/blob/c2760214/bigtop_toolchain/manifests/ant.pp ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/manifests/ant.pp b/bigtop_toolchain/manifests/ant.pp index 12fc10c..c8e4327 100644 --- a/bigtop_toolchain/manifests/ant.pp +++ b/bigtop_toolchain/manifests/ant.pp @@ -14,8 +14,8 @@ # limitations under the License. class bigtop_toolchain::ant { - $ant = 'apache-ant-1.9.10' - + # Ant version restricted to 1.9 because 1.10 supports Java>=8 only. + $ant = latest_ant_binary("1.9.[0-9]*") $apache_prefix = nearest_apache_mirror() exec {"/usr/bin/wget $apache_prefix/ant/binaries/$ant-bin.tar.gz":
