Repository: bigtop Updated Branches: refs/heads/master 70c8dec59 -> 7d406eebe
BIGTOP-1488. bigtop_toolchain hardcode the apache mirror sites for downloading maven Project: http://git-wip-us.apache.org/repos/asf/bigtop/repo Commit: http://git-wip-us.apache.org/repos/asf/bigtop/commit/7d406eeb Tree: http://git-wip-us.apache.org/repos/asf/bigtop/tree/7d406eeb Diff: http://git-wip-us.apache.org/repos/asf/bigtop/diff/7d406eeb Branch: refs/heads/master Commit: 7d406eebed1dfb27d570a021c1b85ca83aea1727 Parents: 70c8dec Author: Newton Alex <[email protected]> Authored: Tue Nov 11 11:31:45 2014 -0800 Committer: Konstantin Boudnik <[email protected]> Committed: Tue Nov 11 11:31:45 2014 -0800 ---------------------------------------------------------------------- .../parser/functions/nearest_apache_mirror.rb | 20 ++++++++++++++++++++ bigtop_toolchain/manifests/ant.pp | 4 ++-- bigtop_toolchain/manifests/deps.pp | 8 +++++--- bigtop_toolchain/manifests/maven.pp | 5 ++--- 4 files changed, 29 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/bigtop/blob/7d406eeb/bigtop_toolchain/lib/puppet/parser/functions/nearest_apache_mirror.rb ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/lib/puppet/parser/functions/nearest_apache_mirror.rb b/bigtop_toolchain/lib/puppet/parser/functions/nearest_apache_mirror.rb new file mode 100644 index 0000000..f7c8164 --- /dev/null +++ b/bigtop_toolchain/lib/puppet/parser/functions/nearest_apache_mirror.rb @@ -0,0 +1,20 @@ +# 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(:nearest_apache_mirror, :type => :rvalue) do |args| + %x( curl --stderr /dev/null https://www.apache.org/dyn/closer.cgi?as_json=1 | grep preferred |cut -d '"' -f 4 | tr -d '\r').chomp + end +end http://git-wip-us.apache.org/repos/asf/bigtop/blob/7d406eeb/bigtop_toolchain/manifests/ant.pp ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/manifests/ant.pp b/bigtop_toolchain/manifests/ant.pp index 347d0e0..fab0790 100644 --- a/bigtop_toolchain/manifests/ant.pp +++ b/bigtop_toolchain/manifests/ant.pp @@ -20,8 +20,8 @@ class bigtop_toolchain::ant { exec {'/bin/tar xvzf /usr/src/apache-ant-1.9.4-bin.tar.gz': cwd => '/usr/local', refreshonly => true, - subscribe => Exec["/usr/bin/wget http://mirrors.ibiblio.org/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz"], - require => Exec["/usr/bin/wget http://mirrors.ibiblio.org/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz"], + subscribe => Exec["/usr/bin/wget $bigtop_toolchain::deps::apache_prefix/ant/binaries/apache-ant-1.9.4-bin.tar.gz"], + require => Exec["/usr/bin/wget $bigtop_toolchain::deps::apache_prefix/ant/binaries/apache-ant-1.9.4-bin.tar.gz"], } file {'/usr/local/ant': http://git-wip-us.apache.org/repos/asf/bigtop/blob/7d406eeb/bigtop_toolchain/manifests/deps.pp ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/manifests/deps.pp b/bigtop_toolchain/manifests/deps.pp index e3534a4..a23fa49 100644 --- a/bigtop_toolchain/manifests/deps.pp +++ b/bigtop_toolchain/manifests/deps.pp @@ -12,11 +12,13 @@ # 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. + + class bigtop_toolchain::deps { + $apache_prefix = nearest_apache_mirror() include bigtop_toolchain::packages - - exec {"/usr/bin/wget http://mirrors.ibiblio.org/apache//ant/binaries/apache-ant-1.9.4-bin.tar.gz": + exec {"/usr/bin/wget $apache_prefix/ant/binaries/apache-ant-1.9.4-bin.tar.gz": cwd => "/usr/src", require => Package[$packages::pkgs], unless => "/usr/bin/test -f /usr/src/apache-ant-1.9.4-bin.tar.gz", @@ -28,7 +30,7 @@ class bigtop_toolchain::deps { unless => "/usr/bin/test -f /usr/src/apache-forrest-0.9.tar.gz", } - exec {"/usr/bin/wget ftp://mirror.reverse.net/pub/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz": + exec {"/usr/bin/wget $apache_prefix/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz": cwd => "/usr/src", require => Package[$packages::pkgs], unless => "/usr/bin/test -f /usr/src/apache-maven-3.0.5-bin.tar.gz", http://git-wip-us.apache.org/repos/asf/bigtop/blob/7d406eeb/bigtop_toolchain/manifests/maven.pp ---------------------------------------------------------------------- diff --git a/bigtop_toolchain/manifests/maven.pp b/bigtop_toolchain/manifests/maven.pp index e0f046b..90aab80 100644 --- a/bigtop_toolchain/manifests/maven.pp +++ b/bigtop_toolchain/manifests/maven.pp @@ -16,12 +16,11 @@ class bigtop_toolchain::maven { include bigtop_toolchain::deps - exec {'/bin/tar xvzf /usr/src/apache-maven-3.0.5-bin.tar.gz': cwd => '/usr/local', refreshonly => true, - subscribe => Exec["/usr/bin/wget ftp://mirror.reverse.net/pub/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"], - require => Exec["/usr/bin/wget ftp://mirror.reverse.net/pub/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"], + subscribe => Exec["/usr/bin/wget $bigtop_toolchain::deps::apache_prefix/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"], + require => Exec["/usr/bin/wget $bigtop_toolchain::deps::apache_prefix/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz"], } file {'/usr/local/maven':
