class RBT::CompileBase

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/compile/base/compile_base.rb, line 35
def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Public Instance Methods

appdir_prefix?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
check_whether_we_will_install_only_programs_from_the_bin_subdirectory() click to toggle source
#

check_whether_we_will_install_only_programs_from_the_bin_subdirectory

#
# File lib/rbt/compile/base/compile_base.rb, line 351
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() click to toggle source
#

cleanup_system_tag_directory

#
# File lib/rbt/compile/base/compile_base.rb, line 392
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() click to toggle source
#

consider_removing_libtool_la_files

To test this, try:

ry apr ntrad
#
# File lib/rbt/compile/base/compile_base.rb, line 206
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.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() click to toggle source
#

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 416
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( 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? ) click to toggle source
#

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 372
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 .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( shall_we_symlink = cookbook_dataset_autosymlink_lib64? ) click to toggle source
#

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 241
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?() click to toggle source
#

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 461
def cookbook_dataset_program_version?
  if cookbook_dataset?
    return cookbook_dataset?.program_version?
  end
  nil
end
create_architecture_file( create_where = prefix?.to_s, can_we_create_the_architecture_file = is_on_gobolinux? ) click to toggle source
#

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 314
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_play_song( song_location = '/Depot/Audio/YoonDohyun_Dolgo.mp3' ) click to toggle source
#

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 70
def do_play_song(
    song_location = '/Depot/Audio/YoonDohyun_Dolgo.mp3'
  )
  _ = "mplayer #{song_location} -endpos 4"
  esystem(_) if File.exist? song_location
end
Also aliased as: play_song
has_an_error_occurred?() click to toggle source
#

has_an_error_occurred?

#
# File lib/rbt/compile/base/compile_base.rb, line 552
def has_an_error_occurred?
  RBT.has_an_error_occurred?
end
install_only_binaries?() click to toggle source
#

install_only_binaries?

#
# File lib/rbt/compile/base/compile_base.rb, line 337
def install_only_binaries?
  @internal_hash[:install_only_binaries]
end
is_an_appdir_installation?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
is_an_appdir_program?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
is_appdir_compilation_style?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
is_installed_in_an_appdir_like_fashion?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
no_error_has_occurred?() click to toggle source
#

no_error_has_occurred?

#
# File lib/rbt/compile/base/compile_base.rb, line 559
def no_error_has_occurred?
  !has_an_error_occurred?
end
original_stdout()
Alias for: silent_redirection?
original_stdout?()
Alias for: silent_redirection?
play_song( song_location = '/Depot/Audio/YoonDohyun_Dolgo.mp3' )
Alias for: do_play_song
register_program( this_program = compile_which_program?, can_we_register_the_program = RBT.register_program_files_into_yaml_database? ) click to toggle source
#

register_program

This method will register the program files into a yaml “database”.

The second argument can be used to determine whether we will really register the program at hand.

#
# File lib/rbt/compile/base/compile_base.rb, line 476
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'
    appdir_prefix_of_this_program = static_appdir_prefix_of?(this_program)
    # ===================================================================== #
    # 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() click to toggle source
#

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 84
def remove_compiling_is_in_progress
  _ = 'COMPILING_IS_IN_PROGRESS'
  remove_file(_) if File.exist? _
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/compile/base/compile_base.rb, line 45
def reset
  super()
  # ======================================================================= #
  # The following instance-variable can be used to determine whether we
  # will silently redirect the output-stream or whether we will not.
  # ======================================================================= #
  @silent_redirection = false
end
run() click to toggle source
#

run

#
# File lib/rbt/compile/base/compile_base.rb, line 593
def run
end
silent_redirection?() click to toggle source
#

silent_redirection?

#
# File lib/rbt/compile/base/compile_base.rb, line 57
def silent_redirection?
  @silent_redirection
end
Also aliased as: original_stdout, original_stdout?
store_full_configure_command_into_resources_directory() click to toggle source
#

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 571
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
use_appdir_prefix?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
use_gobolinux_symlinkprogram?() click to toggle source
#

use_gobolinux_symlinkprogram?

#
# File lib/rbt/compile/base/compile_base.rb, line 302
def use_gobolinux_symlinkprogram?
  @internal_hash[:use_gobolinux_symlinkprogram]
end
uses_an_appdir_prefix?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
uses_appdir_approach?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? )
Alias for: uses_appdir_prefix?
uses_appdir_prefix?( use_this_as_prefix = prefix?.to_s, use_this_as_cookbook_dataset = cookbook_dataset? ) click to toggle source
#

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 532
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