puppet: Extract an external-tarball-dependency manifest.

This commit is contained in:
Alex Vandiver
2021-11-18 13:47:10 -08:00
committed by Tim Abbott
parent 3c8d7e2598
commit bb9d2df1ae
2 changed files with 50 additions and 30 deletions

View File

@@ -0,0 +1,44 @@
define zulip::external_dep(
String $version,
String $sha256,
String $url,
String $tarball_prefix,
String $bin = '',
) {
$dir = "/srv/zulip-${title}-${version}/"
zulip::sha256_tarball_to { $title:
url => $url,
sha256 => $sha256,
install => {
$tarball_prefix => $dir,
},
}
file { $dir:
ensure => directory,
require => Zulip::Sha256_tarball_to[$title],
}
if $bin != '' {
file { "${dir}${bin}":
ensure => file,
require => File[$dir],
}
}
unless $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '18.04' {
# Puppet 5.5.0 and below make this always-noisy, as they spout out
# a notify line about tidying the managed directory above. Skip
# on Bionic, which has that old version; they'll get tidied upon
# upgrade to 20.04.
tidy { "/srv/zulip-${title}-*":
path => '/srv/',
recurse => 1,
rmdirs => true,
matches => "zulip-${title}-*",
require => File[$dir],
}
}
}

View File

@@ -6,35 +6,11 @@ class zulip::golang {
$dir = "/srv/zulip-golang-${version}/"
$bin = "${dir}bin/go"
zulip::sha256_tarball_to { 'golang':
url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
install => {
'go/' => $dir,
},
}
file { $bin:
ensure => file,
require => Zulip::Sha256_tarball_to['golang'],
}
file { $dir:
ensure => directory,
require => Zulip::Sha256_tarball_to['golang'],
}
unless $::operatingsystem == 'Ubuntu' and $::operatingsystemrelease == '18.04' {
# Puppet 5.5.0 and below make this always-noisy, as they spout out
# a notify line about tidying the managed directory above. Skip
# on Bionic, which has that old version; they'll get tidied upon
# upgrade to 20.04.
tidy { '/srv/zulip-golang-*':
path => '/srv/',
recurse => 1,
rmdirs => true,
matches => 'zulip-golang-*',
require => File[$dir],
}
zulip::external_dep { 'golang':
version => $version,
url => "https://golang.org/dl/go${version}.linux-amd64.tar.gz",
sha256 => '550f9845451c0c94be679faf116291e7807a8d78b43149f9506c1b15eb89008c',
tarball_prefix => 'go/',
bin => 'bin/go',
}
}