class RBT::CompileBase
Public Class Methods
Public Instance Methods
#¶ ↑
check_whether_we_will_install_only_programs_from_the_bin_subdirectory
¶ ↑
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 347 def check_whether_we_will_install_only_programs_from_the_bin_subdirectory if install_only_binaries? opne 'We will only retain the '+sdir('bin/')+' subdirectory.' delete_these_directories = Dir[return_proper_prefix?.to_s+'*'].select {|entry| File.directory? entry } delete_these_directories.reject! {|entry| entry.end_with? 'bin' } unless delete_these_directories.empty? opne 'We will now delete several directories that we did find.' remove(delete_these_directories) end end end
#¶ ↑
cleanup_system_tag_directory
¶ ↑
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 388 def cleanup_system_tag_directory # ======================================================================= # # Be quiet - and only report when a stray symlink is removed. # ======================================================================= # RBT::CleanupSystemTags.new { :be_quiet } end
#¶ ↑
consider_removing_libtool_la_files
¶ ↑
To test this, try:
ry apr ntrad
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 247 def consider_removing_libtool_la_files # ======================================================================= # # Must check for two conditions: # # (a) the user specifically wants to delete libtool files, due # to setting a configuration value # (b) the program at hand uses an appdir-like prefix # # ======================================================================= # if delete_libtool_files? require 'rbt/libtool/remove_libtool_files/remove_libtool_files.rb' prefix_to_the_libtool_files = rds("#{prefix?.to_s}/lib/") RBT::Libtool::RemoveLibtoolFiles.new( prefix_to_the_libtool_files ) end end
#¶ ↑
consider_symlinking_cmake_modules
¶ ↑
Prior to entering this method, there is already a check whether we are using an AppDir-like prefix. Only if this is the case, will this method here be entered at all.
This method will normally be called from the method consider_performing_postinstall_actions().
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 412 def consider_symlinking_cmake_modules # ======================================================================= # # We must first check whether there are any cmake modules in the # first place. # ======================================================================= # target_cmake_dir = "#{prefix?}lib64/cmake/" if File.directory? target_cmake_dir # ===================================================================== # # But we must also check whether a cmake directory exists at a # /usr hierarchy. # ===================================================================== # if File.directory? '/usr/lib/cmake/' opne "Symlinking from #{sdir(target_cmake_dir)} into "\ "#{sdir('/usr/lib/cmake/')}" # =================================================================== # # Symlink only directories. # =================================================================== # all_dirs = Dir["#{target_cmake_dir}*"].select {|entry| File.directory? entry } all_dirs.each {|this_directory| basename = File.basename(this_directory) target_in_usr_lib_cmake = "/usr/lib/cmake/#{basename}" # ================================================================= # # Only on roebe-like systems will we also remove the target # directory. # ================================================================= # if is_on_roebe? if File.exist?(target_in_usr_lib_cmake) and File.directory?(target_in_usr_lib_cmake) and !File.symlink?(target_in_usr_lib_cmake) remove_directory(target_in_usr_lib_cmake) end end symlink(this_directory, target_in_usr_lib_cmake) } end end end
#¶ ↑
consider_symlinking_header_files_into_the_usr_include_hierarchy
¶ ↑
This method can be called if you wish to symlink any .h files or directories within the AppDir at hand, into the /usr/include/ hierarchy.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 368 def consider_symlinking_header_files_into_the_usr_include_hierarchy( i = compile_which_program?, shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = shall_we_symlink_the_header_files_into_the_usr_include_hierarchy? ) if shall_we_symlink_the_header_files_into_the_usr_include_hierarchy # ===================================================================== # # Delegate into class RBT::SymlinkHeaders next. # ===================================================================== # opne "Next attempting to symlink all #{royalblue('.h')} files into "\ "the #{sdir('/usr/include/')} hierarchy." opne "In order for this to work, #{royalblue('.h ')}"\ " files have to exist in the AppDir directory." RBT::SymlinkHeaders.new(i) { :do_not_notify_if_there_were_no_header_files } end end
#¶ ↑
consider_symlinking_lib64_into_lib
¶ ↑
This method will symlink lib64/ into lib/. Only invoke this method if you have an AppDir versioned directory though.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 271 def consider_symlinking_lib64_into_lib( shall_we_symlink = cookbook_dataset_autosymlink_lib64? ) if shall_we_symlink old_dir = Dir.pwd # Keep a reference to the old directory. cd prefix?.to_s # cd into the AppDir prefix. opne 'Next trying to symlink '+sdir('lib64/')+' into '+ sdir('lib/')+' from the directory '+sdir(return_pwd)+':' symlink('lib64','lib') # ===================================================================== # # Next check whether the operation was a success, so that we can # inform the user about this. # ===================================================================== # if File.symlink?('lib') and File.directory?('lib') opne 'Success!' else opne swarn('Failed to symlink `')+sdir('lib64/')+ swarn('` towards `')+sdir('lib/')+swarn('`.') end cd old_dir # And go back again. end end
#¶ ↑
cookbook_dataset_program_version?¶ ↑
Obtain the version string of the program at hand through this method. This method is quite reliable and can ideally be used whenever we need to determine the version of a program.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 457 def cookbook_dataset_program_version? if cookbook_dataset? return cookbook_dataset?.program_version? end nil end
#¶ ↑
create_architecture_file
¶ ↑
This method here will create a file called “Architecture”.
The first argument, ‘create_where`, should be the AppDir path to the program in question, such as /Programs/Htop/Current.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 310 def create_architecture_file( create_where = prefix?.to_s, can_we_create_the_architecture_file = is_on_gobolinux? ) if can_we_create_the_architecture_file this_architecture = `uname -m` resources_directory = rds("#{create_where}/Resources/") # ===================================================================== # # Point to the new target that will hold the file Architecture: # ===================================================================== # file_location = rds(resources_directory+'Architecture') mkdir(resources_directory) unless File.directory? resources_directory # ===================================================================== # # Remove the old file it if already exists. # ===================================================================== # remove_file(file_location) if File.exist? file_location write_what_into(this_architecture, file_location) end end
#¶ ↑
do_invoke_symlink_program
¶ ↑
This will either use the RBT-internal class called RBT::SymlinkProgram; or it will, on GoboLinux, make use of SymlinkProgram instead.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 671 def do_invoke_symlink_program( i = compile_which_program?, use_this_program_version = program_version? ) if use_gobolinux_symlinkprogram? # ================================================================= # # === Delegate onto GoboLinux next # # In this case, use the GoboLinux program called 'SymlinkProgram.' # # This program then requires two arguments: # # (1) the program name, and # (2) the program_version # # ================================================================= # # We should also check via 'NamingConventions'. # ================================================================= # _ = "SymlinkProgram #{compile_which_program?} #{use_this_program_version}" esystem _ else symlink_program?.run # ================================================================= # # Since as of September 2022 we will use an action here. The # second argument must be the appdir-prefix to the corresponding # bin/ directory. We will, however had, also supply sbin/, for # compatibility reasons mostly - thus why an Array is passed. # ================================================================= # action( :symlink_into_the_usr_bin_hierarchy, [ "#{prefix?}bin/", "#{prefix?}sbin/" ] ) end end
#¶ ↑
play_song
¶ ↑
Play a song when the compilation phase has finished. This can be disabled via the configuration file, in the entry called play_song. Please call CONFIG.play_song before calling this method. We will play the audio file only if it exists, otherwise we will be silent.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 95 def do_play_song( song_location = '/home/x/songs/YoonDohyun_Dolgo.mp3', use_this_player = 'mpv' ) _ = "#{use_this_player} #{song_location} -endpos 4" esystem(_) if File.exist? song_location end
#¶ ↑
is_make_available?¶ ↑
This method will attempt to find out whether make is available. It will do so by checking on the available path of the host ruby.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 582 def is_make_available?( path = query_path? ) is_make_available = false # By default it is assumed that make is NOT available. if path.include? ':' check_these_directories = path.split(':') check_these_directories.each {|dir| if File.exist?("#{dir}/make") is_make_available = true # Yup, make is available. end } end return is_make_available end
#¶ ↑
register_program
¶ ↑
This method will register the program files into a yaml “database”.
The first argument to this method may be an AppDir (String) such as ‘/home/Programs/Libfontenc/1.1.5/’.
The second argument to this method can be used to determine whether we will really register the program at hand.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 641 def register_program( this_program = compile_which_program?, can_we_register_the_program = RBT.register_program_files_into_yaml_database? ) if can_we_register_the_program require 'rbt/utility_scripts/register_program_files_into_yaml_database.rb' if this_program.include?('/') # In this case assume a target such as # "/home/Programs/Libfontenc/1.1.5/" appdir_prefix_of_this_program = this_program.dup else # else we have to determine the AppDir on our own appdir_prefix_of_this_program = static_appdir_prefix_of?(this_program) end # ===================================================================== # # Next we will delegate towards class # RBT::RegisterProgramFilesIntoYamlDatabase, but this can be # controlled via the above flag. # ===================================================================== # RBT::RegisterProgramFilesIntoYamlDatabase.new( appdir_prefix_of_this_program ) # bl RegisterProgramFilesIntoYamlDatabase end end
#¶ ↑
remove_compiling_is_in_progress
¶ ↑
We must get rid of special files. Right now only of a file called “COMPILING_IS_IN_PROGRESS” - this file will be created when we start compiling.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 111 def remove_compiling_is_in_progress( this_file = 'COMPILING_IS_IN_PROGRESS.md' ) remove_file(this_file) if File.exist? this_file end
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
RBT::Base#reset
# File lib/rbt/compile_base/compile_base.rb, line 68 def reset super() # ======================================================================= # # === :silent_redirection # # The following instance-variable can be used to determine whether we # will silently redirect the output-stream or whether we will not. # ======================================================================= # @internal_hash[:silent_redirection] = false end
#¶ ↑
return_files_from_the_profiles_directory
¶ ↑
This method will return all .md files from the RBT
profiles directory.
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 122 def return_files_from_the_profiles_directory( target_directory = DIRECTORY_RBT_PROFILES ) Dir["#{target_directory}*.md"] end
#¶ ↑
silent_redirection?¶ ↑
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 82 def silent_redirection? @internal_hash[:silent_redirection] end
#¶ ↑
store_full_configure_command_into_resources_directory
¶ ↑
We will store the full configure command into:
/Programs/Name/Version/Resources/full_configure_command
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 479 def store_full_configure_command_into_resources_directory what = full_configure_command? unless what.strip.empty? # ===================================================================== # # Designate the file into where to store this: # ===================================================================== # into = real_prefix?.to_s.dup into << '/Resources/full_configure_command.md' unless File.directory? File.dirname(into) mkdir(File.dirname(into)) end # ===================================================================== # # Remove old files at that position first. # ===================================================================== # delete_file(into) if File.exist? into append_what_into(what, into) end end
#¶ ↑
symlink_m4_macros
¶ ↑
The various .m4 macros usually reside within the share/ subdirectory.
So in order to symlink them, we need to enter that directory.
This method is called from do_postinstall_actions().
#¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 549 def symlink_m4_macros( i, do_run_fetch_all_m4_macros = do_run_fetch_all_m4_macros? ) if do_run_fetch_all_m4_macros # ===================================================================== # # Delegate the job to class RBT::FetchAllM4Macros # ===================================================================== # RBT::FetchAllM4Macros.new(i) { :do_not_report_anything_if_there_were_no_matches } end end
#¶ ↑
uses_appdir_prefix?¶ ↑
This method will return true if the program at hand is compiled in an AppDir-like fashion (e. g. having a prefix including the String “/Programs/” directory), and false otherwise.
# ¶ ↑
# File lib/rbt/compile_base/compile_base.rb, line 505 def uses_appdir_prefix?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? ) if use_this_as_cookbook_dataset.nil? ensure_dataset_for_this_program(compile_which_program?) end use_this_as_prefix.to_s.include? programs_dir? end