Skip to content

Remove deprecated DESTDIR and unused things from install.rb #9425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 3 additions & 74 deletions install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
require 'optparse'
require 'ostruct'

begin
require 'rdoc/rdoc'
$haverdoc = true
rescue LoadError
puts "Missing rdoc; skipping documentation"
$haverdoc = false
end

PREREQS = %w{openssl facter cgi}
MIN_FACTER_VERSION = 1.5

Expand Down Expand Up @@ -140,25 +132,9 @@ def prepare_installation
InstallOptions.check_prereqs = true
InstallOptions.batch_files = true

# Only try to do docs if we're sure they have rdoc
if $haverdoc
InstallOptions.rdoc = true
InstallOptions.ri = true
else
InstallOptions.rdoc = false
InstallOptions.ri = false
end


ARGV.options do |opts|
opts.banner = "Usage: #{File.basename($0)} [options]"
opts.separator ""
opts.on('--[no-]rdoc', 'Prevents the creation of RDoc output.', 'Default on.') do |onrdoc|
InstallOptions.rdoc = onrdoc
end
opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri|
InstallOptions.ri = onri
end
opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |ontest|
InstallOptions.configs = ontest
end
Expand Down Expand Up @@ -205,14 +181,8 @@ def prepare_installation
InstallOptions.batch_files = false
end
opts.on('--quick', 'Performs a quick installation. Only the', 'installation is done.') do |quick|
InstallOptions.rdoc = false
InstallOptions.ri = false
InstallOptions.configs = true
end
opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full|
InstallOptions.rdoc = true
InstallOptions.ri = true
InstallOptions.configs = true
warn "--quick is deprecated. Use --configs"
end
opts.separator("")
opts.on_tail('--help', "Shows this help text.") do
Expand All @@ -223,9 +193,6 @@ def prepare_installation
opts.parse!
end

version = [RbConfig::CONFIG["MAJOR"], RbConfig::CONFIG["MINOR"]].join(".")
libdir = File.join(RbConfig::CONFIG["libdir"], "ruby", version)

# Mac OS X 10.5 and higher declare bindir
# /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin
# which is not generally where people expect executables to be installed
Expand Down Expand Up @@ -312,7 +279,8 @@ def prepare_installation
if sitelibdir.nil?
sitelibdir = $LOAD_PATH.find { |x| x =~ /site_ruby/ }
if sitelibdir.nil?
sitelibdir = File.join(libdir, "site_ruby")
version = [RbConfig::CONFIG["MAJOR"], RbConfig::CONFIG["MINOR"]].join(".")
sitelibdir = File.join(RbConfig::CONFIG["libdir"], "ruby", version, "site_ruby")
elsif sitelibdir !~ Regexp.quote(version)
sitelibdir = File.join(sitelibdir, version)
end
Expand All @@ -328,10 +296,6 @@ def prepare_installation
# This is the new way forward
if not InstallOptions.destdir.nil?
destdir = InstallOptions.destdir
# To be deprecated once people move over to using --destdir option
elsif not ENV['DESTDIR'].nil?
destdir = ENV['DESTDIR']
warn "DESTDIR is deprecated. Use --destdir instead."
else
destdir = ''
end
Expand Down Expand Up @@ -362,7 +326,6 @@ def prepare_installation
InstallOptions.codedir = codedir
InstallOptions.config_dir = configdir
InstallOptions.bin_dir = bindir
InstallOptions.lib_dir = libdir
InstallOptions.man_dir = mandir
InstallOptions.var_dir = vardir
InstallOptions.public_dir = publicdir
Expand All @@ -381,36 +344,6 @@ def join(basedir, dir)
"#{basedir}#{dir}"
end

##
# Build the rdoc documentation. Also, try to build the RI documentation.
#
def build_rdoc(files)
return unless $haverdoc
begin
r = RDoc::RDoc.new
r.document(["--main", "README", "--title", "Puppet -- Site Configuration Management", "--line-numbers"] + files)
rescue RDoc::RDocError => e
$stderr.puts e.message
rescue Exception => e
$stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
end
end

def build_ri(files)
return unless $haverdoc
return if $osname == "windows"
begin
ri = RDoc::RDoc.new
#ri.document(["--ri-site", "--merge"] + files)
ri.document(["--ri-site"] + files)
rescue RDoc::RDocError => e
$stderr.puts e.message
rescue Exception => e
$stderr.puts "Couldn't build Ri documentation\n#{e.message}"
$stderr.puts "Continuing with install..."
end
end

##
# Install file(s) from ./bin to RbConfig::CONFIG['bindir']. Patch it on the way
# to insert a #! line; on a Unix install, the command is named as expected
Expand Down Expand Up @@ -476,8 +409,6 @@ def install_binfile(from, op_file, target)
# Set these values to what you want installed.
configs = glob(%w{conf/puppet.conf conf/hiera.yaml})
bins = glob(%w{bin/*})
#rdoc = glob(%w{bin/* lib/**/*.rb README* }).reject { |e| e=~ /\.(bat|cmd)$/ }
#ri = glob(%w{bin/*.rb lib/**/*.rb}).reject { |e| e=~ /\.(bat|cmd)$/ }
man = glob(%w{man/man[0-9]/*})
libs = glob(%w{lib/**/*})
locales = glob(%w{locales/**/*})
Expand All @@ -488,8 +419,6 @@ def install_binfile(from, op_file, target)
windows_bins = glob(%w{ext/windows/*bat})
end

#build_rdoc(rdoc) if InstallOptions.rdoc
#build_ri(ri) if InstallOptions.ri
do_configs(configs, InstallOptions.config_dir) if InstallOptions.configs
do_bins(bins, InstallOptions.bin_dir)
do_bins(windows_bins, InstallOptions.bin_dir, 'ext/windows/') if $osname == "windows" && InstallOptions.batch_files
Expand Down