forked from puppetlabs/puppet-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.rb
45 lines (39 loc) · 1.85 KB
/
cleanup.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# This component exists only to remove unnecessary files that bloat the final puppet-agent package.
component "cleanup" do |pkg, settings, platform|
# This component must depend on all other C++ components in order to be
# executed last, after they all finish building.
pkg.build_requires "cpp-pcp-client"
pkg.build_requires "cpp-hocon"
pkg.build_requires "facter"
pkg.build_requires "leatherman"
pkg.build_requires "libwhereami"
pkg.build_requires "pxp-agent"
unless settings[:dev_build]
# Unless the settings specify that this is a development build, remove
# unneeded header files (boost headers, for example, increase the size of
# the package to an unacceptable degree).
#
# Note that:
# - Ruby is not in this list because its headers are required to build native
# extensions for gems.
# - Curl and OpenSSL are not in this list because their headers are
# required to build other libraries (e.g. libssh2 and libgit2) in other
# projects that rely on puppet-agent (e.g. pe-r10k-vanagon).
unwanted_headers = ["augeas.h", "boost", "cpp-pcp-client", "fa.h",
"facter", "hocon", "leatherman", "libexslt", "libxml2",
"libxslt", "whereami", "yaml-cpp"]
# We need a full path on windows because /usr/bin is not in the PATH at this point
rm = platform.is_windows? ? '/usr/bin/rm' : 'rm'
cleanup_steps = [
unwanted_headers.map { |h| "#{rm} -rf #{settings[:includedir]}/#{h}" },
# Also remove OpenSSL manpages
"#{rm} -rf #{settings[:prefix]}/ssl/man",
]
if platform.is_windows?
# On Windows releases that distribute curl, these curl binaries can
# interfere with the native ones when puppet-agent's bindir is in the PATH:
cleanup_steps << "#{rm} #{settings[:bindir]}/curl*"
end
pkg.install { cleanup_steps }
end
end