class RBT::Installer

Constants

ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM
#

ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM

If the following constant is set to true, then the RBT project will also attempt to automatically install this given ruby-gem.

That way you can easily batch-update all registered rubygems; they must have a corresponding .yml file that is registered in the respective .yml file at hand, though.

#
ARRAY_CHECK_FOR_BINARY_DUPLICATES_OPTIONS
#

ARRAY_CHECK_FOR_BINARY_DUPLICATES_OPTIONS

This constant shall include regexes that check for the following commandline options:

rbt --check-for-binary-duplicates
rbt --report-binary-duplicates
rbt --report-duplicates
rbt --binary-duplicates
rbt --duplicate-binaries
#
ARRAY_FEEDBACK_CONFIGURE_OPTIONS
#

ARRAY_FEEDBACK_CONFIGURE_OPTIONS

#
ARRAY_FEEDBACK_MAKE_OPTIONS
#

ARRAY_FEEDBACK_MAKE_OPTIONS

#
ARRAY_HELP_ALL_AVAILABLE_PROGRAMS
#

ARRAY_HELP_ALL_AVAILABLE_PROGRAMS

#
ARRAY_HELP_AVAILABLE_PROGRAM_VERSIONS
#

ARRAY_HELP_AVAILABLE_PROGRAM_VERSIONS

#
ARRAY_HELP_CHECK_ALL_TAGS_OPTIONS
#

ARRAY_HELP_CHECK_ALL_TAGS_OPTIONS

#
ARRAY_HELP_CONFIG_OPTIONS
#

ARRAY_HELP_CONFIG_OPTIONS

These options are valid for when the user wishes to feedback the main configuration options.

#
ARRAY_HELP_CREATE_SHELLSCRIPT_OPTIONS
#

ARRAY_HELP_CREATE_SHELLSCRIPT_OPTIONS

These options are all used for the creation of a shell script, a shell “recipe”.

#
ARRAY_HELP_DISABLE_AUTOGEN
#

ARRAY_HELP_DISABLE_AUTOGEN

#
ARRAY_HELP_DONT_KEEP_EXTRACTED_OPTIONS
#

ARRAY_HELP_DONT_KEEP_EXTRACTED_OPTIONS

Allowed options for when we wish to keep the extracted archive.

#
ARRAY_HELP_DOWNLOAD_THE_SOURCE_OPTIONS
#

ARRAY_HELP_DOWNLOAD_THE_SOURCE_OPTIONS

All download options are stored here.

#
ARRAY_HELP_DO_COMPILE_IN_A_NON_TRADITIONAL_WAY_OPTIONS
#

ARRAY_HELP_DO_COMPILE_IN_A_NON_TRADITIONAL_WAY_OPTIONS (ntrad tag)

These are the options for when you wish to install in an app-dir like manner.

#
ARRAY_HELP_DO_COMPILE_IN_A_TRADITIONAL_WAY_OPTIONS
#

ARRAY_HELP_DO_COMPILE_IN_A_TRADITIONAL_WAY_OPTIONS (trad tag)

These options are for compilation into the “/usr/” hierarchy, also called the traditional way to compile a program.

#
ARRAY_HELP_DO_NOT_COMPILE_OPTIONS
#

ARRAY_HELP_DO_NOT_COMPILE_OPTIONS

#
#
#
ARRAY_HELP_DO_USE_STOW_OPTIONS
#

ARRAY_HELP_DO_USE_STOW_OPTIONS

#
ARRAY_HELP_ENABLE_STATIC
#

ARRAY_HELP_ENABLE_STATIC (static tag)

These are the options for static compilation mode.

#
ARRAY_HELP_FEEDBACK_ALL_BINARIES_OPTIONS
#

ARRAY_HELP_FEEDBACK_ALL_BINARIES_OPTIONS

Keep track of which binaries a specific program should install.

#
ARRAY_HELP_FEEDBACK_EVERY_CASE_OPTION_OPTIONS
#

ARRAY_HELP_FEEDBACK_EVERY_CASE_OPTION_OPTIONS

#
ARRAY_HELP_FEEDBACK_LAST_COMPILED_OPTIONS
#

ARRAY_HELP_FEEDBACK_LAST_COMPILED_OPTIONS

#
ARRAY_HELP_FEEDBACK_PROGRAM_VERSION_OPTIONS
#

ARRAY_HELP_FEEDBACK_PROGRAM_VERSION_OPTIONS

#
ARRAY_HELP_FEEDBACK_VERSIONS_OPTIONS
#

ARRAY_HELP_FEEDBACK_VERSIONS_OPTIONS

This Array is used to feedback different versions in use.

#
ARRAY_HELP_FIND_ALL_ARCHIVES
#

ARRAY_HELP_FIND_ALL_ARCHIVES

#
ARRAY_HELP_GENERATE_ALL_SLACK_DESC_FILES_OPTIONS
#

ARRAY_HELP_GENERATE_ALL_SLACK_DESC_FILES_OPTIONS

All the registered options for creating slackware .desc files.

#
ARRAY_HELP_GENERATE_HOMEPAGE_OPTIONS
#

ARRAY_HELP_GENERATE_HOMEPAGE_OPTIONS

#
ARRAY_HELP_GENERATE_PDF_TUTORIAL_OPTIONS
#

ARRAY_HELP_GENERATE_PDF_TUTORIAL_OPTIONS

All options that can be used to generate the .pdf tutorial.

#
ARRAY_HELP_GENERATE_SHELL_COMPLETION_OPTIONS
#

ARRAY_HELP_GENERATE_SHELL_COMPLETION_OPTIONS

There are the options for shell-completion.

#
ARRAY_HELP_GENERATE_SLACK_DESC_FILE
#

ARRAY_HELP_GENERATE_SLACK_DESC_FILE

Help entries to generate a slack-desc file.

#
ARRAY_HELP_INCLUDED_OPTIONS
#

ARRAY_HELP_INCLUDED_OPTIONS

#
ARRAY_HELP_KEEP_EXTRACTED_OPTIONS
#

ARRAY_HELP_KEEP_EXTRACTED_OPTIONS

Note that an alias to this is –dont-remove-extracted-archive

#
ARRAY_HELP_LAST_COMPILED_OPTIONS
#

ARRAY_HELP_LAST_COMPILED_OPTIONS

#
ARRAY_HELP_LAST_COMPILED_PROGRAM_OPTIONS
#

ARRAY_HELP_LAST_COMPILED_PROGRAM_OPTIONS

#
ARRAY_HELP_LAST_CONFIGURE_OPTIONS
#

ARRAY_HELP_LAST_CONFIGURE_OPTIONS

#
ARRAY_HELP_LAST_DOWNLOADED_OPTIONS
#

ARRAY_HELP_LAST_DOWNLOADED_OPTIONS

#
ARRAY_HELP_LOG_DIR_OPTIONS
#

ARRAY_HELP_LOG_DIR_OPTIONS

#
ARRAY_HELP_OUTPUT_ALL_URLS_OPTIONS
#

ARRAY_HELP_OUTPUT_ALL_URLS_OPTIONS

#
ARRAY_HELP_PACKAGE_RBT_OPTIONS
#

ARRAY_HELP_PACKAGE_RBT_OPTIONS

All options if one wishes to package up the RBT scripts.

#
ARRAY_HELP_PREFIX_IN_USE
#

ARRAY_HELP_PREFIX_IN_USE

#
ARRAY_HELP_PURGE_ALL_MAN_ENTRIES
#

ARRAY_HELP_PURGE_ALL_MAN_ENTRIES

#
ARRAY_HELP_QUERY_THE_EXISTANCE_OF_A_BINARY_NAME
#

ARRAY_HELP_QUERY_THE_EXISTANCE_OF_A_BINARY_NAME

#
#

This Array collects all options used for when we wish to remove all symlinks in the /Programs hierarchy.

#
#
#
ARRAY_HELP_REPORT_N_PROGRAMS_OPTIONS
#

ARRAY_HELP_REPORT_N_PROGRAMS_OPTIONS

#
ARRAY_HELP_SCAN_SOURCE_ARCHIVE_OPTIONS
#

ARRAY_HELP_SCAN_SOURCE_ARCHIVE_OPTIONS

#
ARRAY_HELP_SHOW_ALL_OPTIONS
#

ARRAY_HELP_SHOW_ALL_OPTIONS

This covers all options that can be obtained via e. g “ry gcc show_all”.

#
ARRAY_HELP_SHOW_HIGHEST_PROGRAMS_OPTIONS
#

ARRAY_HELP_SHOW_HIGHEST_PROGRAMS_OPTIONS

#
ARRAY_HELP_SHOW_LAST_UPDATE_OPTIONS
#

ARRAY_HELP_SHOW_LAST_UPDATE_OPTIONS

#
ARRAY_HELP_SHOW_REGISTERED_KEYS
#

ARRAY_HELP_SHOW_REGISTERED_KEYS

#
ARRAY_HELP_SHOW_WHICH_COLOURS_WILL_BE_USED
#

ARRAY_HELP_SHOW_WHICH_COLOURS_WILL_BE_USED

The constants stored in the Array here can be used to display which colours will be used by the RBT project.

#
ARRAY_HELP_SIMULATION_MODE_OPTIONS
#

ARRAY_HELP_SIMULATION_MODE_OPTIONS

#
ARRAY_HELP_SKIP_EXTRACTING_OPTIONS
#

ARRAY_HELP_SKIP_EXTRACTING_OPTIONS

Options in order to skip extracting the tarball.

#
ARRAY_HELP_TEMP_DIR
#

RBT::ARRAY_HELP_TEMP_DIR

This constant will keep track of the RBT temp directory, e. g. where we will extract archives to.

#
ARRAY_HELP_TOGGLE_DEBUG_VALUE_OPTIONS
#

ARRAY_HELP_TOGGLE_DEBUG_VALUE_OPTIONS

#
ARRAY_HELP_UPDATE_BINARY_NAMES_OPTIONS
#

ARRAY_HELP_UPDATE_BINARY_NAMES_OPTIONS

#
ARRAY_HELP_USE_AUTOGEN
#

ARRAY_HELP_USE_AUTOGEN

All options when we wish to use autogen.

#
ARRAY_HELP_USE_BUILD_DIRECTORY_OPTIONS
#

ARRAY_HELP_USE_BUILD_DIRECTORY_OPTIONS

#
ARRAY_HELP_VIEW_AVAILABLE_LICENSES_OPTIONS
#

ARRAY_HELP_VIEW_AVAILABLE_LICENSES_OPTIONS

#
ARRAY_SHOW_LAST_UPDATED_OPTIONS
#

ARRAY_SHOW_LAST_UPDATED_OPTIONS

#
#

All “symlink all programs” options are stored here.

#
DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
#

DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY

What name will our default build directory have? Useful when we wish to use other build dirs.

The reason the name is so long is because the shorter name “BUILD” sometimes may already be an existing file. The program “brotli” has had this problem - it carried a file called “BUILD” by default, which obviously means that a “cd BUILD/” event will fail lateron.

#
DEFAULT_PROGRAM
#

DEFAULT_PROGRAM

Set the default program here.

#
FILE_AUTOGEN
#

FILE_AUTOGEN

#
OPTIONS_NO_COLOURS
#

OPTIONS_NO_COLOURS

Synonyms for colour usage. All these instructions can be used to disable colours.

#
SILENT_REDIRECTION
#

SILENT_REDIRECTION

This can simply be appended.

#
TEMP_DIR
#

TEMP_DIR

#
TEMP_DIR_FOR_RBT
#

TEMP_DIR_FOR_RBT

#
THIS_FILE
#

THIS_FILE

#

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::Installer[]

#
# File lib/rbt/installer/installer.rb, line 77
def self.[](i = ARGV)
  new(i)
end
display_standard_help_options( exit_now = :default ) click to toggle source
#

RBT::Installer.display_standard_help_options

Set the standard help-options only here.

You can view them by issuing this command:

rbt --help
#
# File lib/rbt/installer/misc.rb, line 808
def self.display_standard_help_options(
    exit_now = :default
  )
  case exit_now
  when :default
    exit_now = false
  end
  pad_to_most_right = ' ' * 40
  lpad = '  '
  middle_pad = 44
  # RBT::Installer.output_namespace? # ← Disabled as of 03.10.2020.
  e
  efancy lpad+'The following help subsection describes some of '
  efancy lpad+'the available help options for the'
  efancy lpad+::RBT.steelblue('Compile-Section')+
         sfancy(' of the RBT scripts.')
  e
  efancy lpad+'The '+
         RBT.mediumslateblue('basic ')+
         sfancy('command to ')+
         RBT.steelblue('compile a program')+
         sfancy(' is:')
  e
  e
  e lpad+RBT.gold('    rbt [NAME_OF_THE_PROGRAM]')
  e lpad+RBT.gold('    rbt python')+RBT.orange(' # ← example input; here we '\
      'would try to compile python')
  e lpad+RBT.gold('    rbt htop')+RBT.orange('   # ← here, RBT would try to '\
      'compile htop')
  e lpad+RBT.gold('    rbt php')+RBT.orange('    # ← here, RBT would try to '\
      'compile php')
  e
  e
  efancy lpad+lpad+'-b      --build-dir=[]                        Set a specific build directory'
  efancy lpad+lpad+'-h      --help                                Display this help subsection here'
  efancy lpad+'          --permanently_extract_to=[]           permanently extract the '\
         'archives to another directory'
  efancy lpad+lpad+'-e      --extract_to=[]                       extract '\
         'the archives to another directory'
  efancy '                                                  (--homedir= is an alias to this setting)'
  efancy lpad+lpad+'-k      --keep_extracted                      Keep '\
         'the sourceball extracted (normally the extracted'
  efancy '                                                  archive is '\
         'removed after compilation)'
  efancy lpad+'          --batch-compile=                      Batch-compile some '\
         'programs such as batch compiling'
  e
  e      (' ' * middle_pad)+
         RBT.royalblue("        rbt --batch-compile=mate\n")
  efancy lpad+
         '          --dont-use-configure-options          Do not use any configure options '\
         'from the .yml file'
  efancy lpad+lpad+'-n      --no-harm                             Run in simulation mode'
  efancy lpad+lpad+'-nc     --nocolour / --nocolor                Disable colours'
  efancy lpad+
         '          --use-old-configure-options           Re-use old configure '\
         'options, e. g. from GCC'
  efancy lpad+lpad+'-sl     --sleep<number>                       Sleep for <number> seconds before continuing'
  efancy lpad+
         '          --permanently-disable-ccache          Permanently disable ccache, '\
         'via the commandline'
  efancy lpad+
         '          --disable-ccache                      Do not use ccache for the current run'
  efancy lpad+lpad+'-S      --no-symlink                          Do not symlink the AppDir that was compiled'
  efancy lpad+lpad+'-P      --no-postinstall                      Do not run the postinstall instructions'
  efancy lpad+
         '          --preinstall="sh bootstrap"           Run the specified pre-install action'
  efancy lpad+
         '          --use-gobolinux-symlinkprogram        Use the GoboLinux SymlinkProgram rather than '
  efancy '                                                  '\
         'class RBT::SymlinkProgram, for symlinking'
  efancy lpad+
         '          --use-meson                           Use the meson build system'
  efancy lpad+lpad+'-no     --no-extract                          Do not extract tarball '\
         'again (skip extracting the source archive)'
  efancy lpad+lpad+'-cmake  --cmake                               Use cmake rather than make'
  efancy lpad+lpad+'-clang  --clang                               Use clang '\
         'rather than the default GCC to compile C/C++ programs'
  efancy lpad+
         '          --create-yaml-file-for=subversion     Create a .yml file '\
         'for this program, holding the relevant '
  efancy '                                                  '\
         'information for compiling the program from source'
  efancy '                                                  (Note that this requires the clang '\
                                                            'compiler of LLVM being'
  efancy '                                                  available, of course.)'
  efancy lpad+
         '          --create-log-directory                Create the log directory.'
  efancy lpad+
         '          --paste-blfs-page                     Fetch and paste remote '\
         'data from the BLFS page of the given program'
  efancy lpad+lpad+'-slack  --slack-desc                          Create a Slackware slack-desc file'
  efancy lpad+
         '          --purge-traditional-binaries-of=gnupg Purge binaries of this program'
  efancy lpad+
         '          --valid-sys-tags?                     Show which '+
         sdir('/System/Tag')+
          sfancy(' entries are valid')
  efancy lpad+
         '          --symlink-headers                     Symlink all .h files into '\
         'the '+sdir('/usr/include/')+sfancy(' hierarchy')
  efancy lpad+
         '          --symlink-all-upcased-programs-to-downcased-variants Create '\
         'symlinks'
  efancy (' ' * (middle_pad-2))+'        '\
         'for all upcased program entries under '+
         sdir(RBT.programs_dir?)+'.' 
  efancy lpad+
         '          --homedir                             Compile the program into your '\
         'HOME directory such as '+
         sdir('/home/name/')+sfancy('.')
  efancy lpad+lpad+'-ver    --verbose                             Be verbose in the output'
  efancy lpad+
         '          --do-not-use-special-flags            Do not use ENV (environmental '\
         'flags) at all.'
  efancy lpad+
         "          --update-entry                        Update a program, such "\
         "as via\n"
  e      RBT.royalblue(
           (' ' * middle_pad)+
           "        rbt --update-entry "\
           "http://ftp.gnu.org/gnu/grep/grep-3.5.tar.xz\n"
         )
  efancy lpad+
         '          --edit-file=htop                      Open the '+
         ::Colours.sfile('htop.yml')+
         sfancy(' cookbook-file, in order to inspect '\
         'and/or edit it;')
  efancy '                                                  the '+simp('$EDITOR')+
         sfancy(' variable can be used to specify which editor is to be used.')
  efancy lpad+
         "          --remove-la-files                     Remove "\
         ".la files of this program (requires the --prefix to include "\
         "#{sdir(::RBT.programs_dir?)})"
  efancy lpad+
         '          --suggest-cookbook-for=glib           Show a possible '\
         'content of glib.yml file'
  efancy lpad+lpad+
         "-v      --version                             Use a "\
         "specific version, such as, for instance:\n"
  efancy (' ' * middle_pad)+
         RBT.royalblue('        rbt bluefish --version=1.0.7')

  efancy '                                                  '\
         'ignore errors via '+simp('--ignore-errors')
  e
  # ======================================================================= #
  # === Documented help options for the GUI section
  # ======================================================================= #
  efancy lpad+gold('[GUI section]')
  e
  efancy lpad+
         '          --libui                               start the libui-wrapper for RBT (in '\
         'regards to compiling programs from source)'
  efancy lpad+
         '          --gtk                                 start the ruby-gtk3 interface '\
         '(tabbed notebook interface)'
  if RBT.is_on_gobolinux?
    # ===================================================================== #
    # If we are on gobolinux then we also mention how to create
    # gobolinux-recipes.
    # ===================================================================== #
    efancy '   --gobolinux-recipe                            '\
           'Create a GoboLinux recipe. (The "-" can be omitted.'
    efancy pad_to_most_right+'        A usage example follows next.)'
    efancy pad_to_most_right+'        Usage example: '+
           simp('rbt zenity --gobolinux-recipe')
  end
  e
  efancy lpad+'Some shorter commandline options exist for '\
         'toplevel methods:'
  e
  efancy lpad+'  rbt --download htop # This will download htop into '\
         'the local directory'
  efancy lpad+'  rbt --extract htop  # This will extract htop; or '\
         'download and extract it,'
  efancy lpad+'# should it not exist locally'.rjust(51)
  e # Need a spacer before we display the next part.
  e
  eimp lpad+'Also note that these options can be chained together. '\
       'Abbreviations '
  eimp lpad+'can be used as well. The options '+
       sfancy('noext nocol')+
       simp(' will all work fine,  ')
  eimp lpad+
       simp('being equal to ')+
       sfancy('--no-extract --nocolor')+simp('.')
  e
  eimp lpad+'Abbreviations allow us to have to type less, but '\
       'the longer variants '
  eimp lpad+
       'als work, in the event that you wish '\
       'to be more explicit.'
  e
  exit if exit_now
end
do_not_show_names?() click to toggle source
#

RBT::Installer.do_not_show_names?

#
# File lib/rbt/installer/misc.rb, line 766
def self.do_not_show_names?
  ::RBT.do_not_show_names?
end
e(i = '') click to toggle source
#

RBT::Installer.e

#
# File lib/rbt/installer/misc.rb, line 773
def self.e(i = '')
  ::RBT.e(i)
end
efancy(i = '') click to toggle source
#

RBT::Installer.efancy

#
# File lib/rbt/installer/misc.rb, line 794
def self.efancy(i = '')
  ::RBT.efancy(i)
end
eimp(i = '') click to toggle source
#

RBT::Installer.eimp

#
# File lib/rbt/installer/misc.rb, line 1015
def self.eimp(i = '')
  ::RBT.eimp(i)
end
gold(i = '') click to toggle source
#

RBT::Installer.gold

#
# File lib/rbt/installer/misc.rb, line 780
def self.gold(i = '')
  ::RBT.gold(i)
end
is_this_program_included?( i, be_verbose = :default ) click to toggle source
#

RBT::Installer.is_this_program_included?

ry --included?
#
# File lib/rbt/installer/misc.rb, line 498
def self.is_this_program_included?(
    i,
    be_verbose = :default
  )
  case be_verbose
  # ======================================================================= #
  # === :include_abbreviations_and_be_quiet
  # ======================================================================= #
  when :include_abbreviations_and_be_quiet
    be_verbose = false
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    be_verbose = true
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet,
       :silent
    be_verbose = false
  end
  if i.is_a? Array
    i.each {|entry| is_this_program_included?(entry, be_verbose) }
  else
    i = i.to_s.dup
    i.delete!('-')
    i.delete!('_')
    # ===================================================================== #
    # Note that RBT.does_include? tries harder to find a program
    # than does RBT.is_this_program_included?.
    # ===================================================================== #
    is_included = RBT.does_include?(i)
    if is_included
      if be_verbose
        RBT::Installer.opnn; e "The program `#{RBT.simp(i)}` is included."
      end
      @is_included = true
    else
      if be_verbose
        RBT::Installer.opnn; e "The program `#{RBT.simp(i)}` is "\
                               "#{RBT.swarn('not')} included."
      end
      @is_included = false
    end
  end
end
new( commandline_arguments = ARGV, run_already = true ) { || ... } click to toggle source
#

initialize

The first argument to this method will contain the commandline arguments for class RBT::Install. These are usually the name of the program (or programs) that you wish to compile.

So, for example, “htop” could be passed as the first argument to this method. You can also pass in an Array here, and this class will then attempt to batch-compile these programs.

#
# File lib/rbt/installer/initialize.rb, line 24
def initialize(
    commandline_arguments = ARGV, # ← This should usually be an Array of programs that should be installed.
    run_already           = true
  )
  register_sigint
  reset
  # ======================================================================= #
  # Handle symbols given as first argument next.
  # ======================================================================= #
  case commandline_arguments
  # ======================================================================= #
  # === :do_not_run_yet
  # ======================================================================= #
  when :do_not_run_yet,
       :do_not_yet_run,
       :dont_run_yet
    run_already = false
    commandline_arguments = []
  end
  set_commandline_arguments(
    commandline_arguments
  )
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :dont_run_yet
    # ===================================================================== #
    when :dont_run_yet
      run_already = false
    end
  end
  case run_already
  # ======================================================================= #
  # === :do_not_run_yet
  # ======================================================================= #
  when :do_not_run_yet
    run_already = false
  end
  consider_entering_the_log_directory
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # Handle Symbols first:
    # ===================================================================== #
    if yielded.is_a? Symbol
      case yielded
      # =================================================================== #
      # === :do_not_run_yet
      # =================================================================== #
      when :do_not_run_yet,
           :do_not_run,
           :dont_run_yet
        run_already = false
      # =================================================================== #
      # === :do_not_check_whether_the_program_exists
      # =================================================================== #
      when :do_not_check_whether_the_program_exists
        do_not_check_whether_the_program_exists # ← This method exists, so use it too.
      # =================================================================== #
      # === :use_root_prefix
      # =================================================================== #
      when :use_root_prefix
        do_use_root_prefix
      end
    # ===================================================================== #
    # === Handle Hashes next
    # ===================================================================== #
    elsif yielded.is_a? Hash
      # =================================================================== #
      # === :run_already
      #
      # This entry point should be checked last.
      # =================================================================== #
      if yielded.has_key? :run_already
        case yielded[:run_already]
        when :do_not_run_yet
          run_already = false
        end
      end
      # =================================================================== #
      # === :use_this_prefix
      # =================================================================== #
      if yielded.has_key? :use_this_prefix
        set_use_this_prefix(yielded[:use_this_prefix])
      end
      # =================================================================== #
      # === :shall_we_check_whether_the_program_exists
      # =================================================================== #
      if yielded.has_key? :shall_we_check_whether_the_program_exists
        case yielded[:shall_we_check_whether_the_program_exists]
        # ================================================================= #
        # === nope
        #
        # In this case we will not check whether the program exists.
        # ================================================================= #
        when :nope, false
          do_not_check_whether_the_program_exists
        end
      end
      # =================================================================== #
      # === :prefix
      #
      # Handle prefix-related keys first.
      # =================================================================== #
      if yielded.has_key? :prefix
        set_user_prefix(yielded.delete(:prefix)) # ← Set the new prefix via a method call.
      # =================================================================== #
      # === :use_this_prefix
      # =================================================================== #
      elsif yielded.has_key? :use_this_prefix
        set_user_prefix(yielded.delete(:use_this_prefix))
      # =================================================================== #
      # === :use_this_as_prefix
      # =================================================================== #
      elsif yielded.has_key? :use_this_as_prefix
        set_user_prefix(yielded.delete(:use_this_as_prefix))
      end
      # =================================================================== #
      # === :symlink_after_compilation_has_finished
      # =================================================================== #
      if yielded.has_key? :symlink_after_compilation_has_finished
        value = yielded.delete(:symlink_after_compilation_has_finished)
        if value == false
          set_do_not_symlink(:be_verbose) # Disable symlinking after compilation.
        end
      end
      # =================================================================== #
      # Add commandline_arguments if the key is :commandline_arguments
      #
      # Such a Hash may have a key like this:
      #
      #   {:commandline_arguments=>["--dont-use-colours", "ntrad"]}
      # =================================================================== #
      if yielded.has_key? :commandline_arguments
        append_to_the_commandline(
          yielded.delete(:commandline_arguments)
        )
      end
    else
      append_to_the_commandline(yielded)
    end
  end
  # ======================================================================= #
  # Handle special symbols passed to run_already next:
  # ======================================================================= #
  case run_already
  when :dont_run_yet,
       :do_not_run_yet,
       :do_not_run_already
    run_already = false
  end
  time_snapshot # Store the first snapshot, which is the start-mark.
  run if run_already
end
opnn( i = { namespace: RBT.namespace?, use_colours: RBT.use_colours? } ) click to toggle source
#

RBT::Installer.opnn

Use this method when you wish to output the RBT::Installer namespace to the user.

#
# File lib/rbt/installer/misc.rb, line 708
def self.opnn(
    i = {
      namespace:   RBT.namespace?,
      use_colours: RBT.use_colours?
    }
  )
  if i.is_a? Hash
    unless i.has_key? :use_colours
      i.update(use_colours: RBT.use_colours?)
    end
  end
  if RBT.show_the_classname?
    ::RBT.opnn(i) # Delegate to the module_method here.
  # else # else we will not use Opn at all.
  end
end
program_is_included?() click to toggle source
#

Compile.program_is_included?

#
# File lib/rbt/installer/misc.rb, line 754
def self.program_is_included?
  @is_included
end
sdir(i = '') click to toggle source
#

RBT::Installer.sdir

#
# File lib/rbt/installer/misc.rb, line 787
def self.sdir(i = '')
  ::RBT.sdir(i)
end
sfancy(i = '') click to toggle source
#

RBT::Installer.sfancy

#
# File lib/rbt/installer/misc.rb, line 1008
def self.sfancy(i = '')
  ::RBT.sfancy(i)
end
show_the_classname?() click to toggle source
#

RBT::Installer.show_the_classname?

#
# File lib/rbt/installer/misc.rb, line 549
def self.show_the_classname?
  ::RBT.show_the_classname?
end
simp(i = '') click to toggle source
#

RBT::Installer.simp

#
# File lib/rbt/installer/misc.rb, line 1022
def self.simp(i = '')
  ::RBT.simp(i)
end
the_program_is_included() click to toggle source
#

RBT::Installer.the_program_is_included

#
# File lib/rbt/installer/misc.rb, line 740
def self.the_program_is_included
  @is_included = true
end
use_colours?() click to toggle source
#

RBT::Installer.use_colours?

#
# File lib/rbt/installer/misc.rb, line 556
def self.use_colours?
  config?.use_colours.to_s
end

Public Instance Methods

a_problem_has_occurred() click to toggle source
#

a_problem_has_occurred

This method simply denotes that a problem has occurred. It is not more specific than that.

#
# File lib/rbt/installer/misc.rb, line 10571
def a_problem_has_occurred
  @internal_hash[:problem] = true
end
a_problem_has_occurred?()
a_program_has_been_initialized?() click to toggle source
#

a_program_has_been_initialized?

#
# File lib/rbt/installer/misc.rb, line 15591
def a_program_has_been_initialized?
  !main_dataset?.nil?
end
action_install_only_headers( from_this_directory = " click to toggle source
#

action_install_only_headers

This method handles the actual copying of all headers. It must be called at the proper time.

#
# File lib/rbt/installer/misc.rb, line 15639
def action_install_only_headers(
    from_this_directory = "#{extract_to_this_directory?}"\
                          "#{program_name_and_program_version?}/",
    be_verbose          = be_verbose?
  )
  from_this_directory = from_this_directory.to_s.dup
  from_this_directory << '/' unless from_this_directory.end_with? '/'
  _ = ''.dup
  all_headers = Dir["#{from_this_directory}*.h"]
  _ = all_headers.join(',')[0..3] unless all_headers.empty?
  opne "Now copying all found #{steelblue(_.size.to_s)} "\
       "headers from `#{sdir(from_this_directory)}`"\
       " to #{sdir('/usr/include/')}:"
  copy_recursively(all_headers, '/usr/include/', be_verbose)
  if be_verbose
    opne "The following #{royalblue(_.size.to_s)} headers were copied:"
    e
    all_headers.each {|entry|
      e "  #{steelblue(entry)} "\
        "#{tomato('→')} "\
        "#{lightgreen('/usr/include/'+File.basename(entry))} "
    }
    e
  end
  do_not_continue_after_configure_step
  do_not_continue_after_make_step
  be_silent
end
add_package_user( name = compile_which_program? ) click to toggle source
#

add_package_user

This allows you to add a package-user.

Usage example:

ry htop add_package_user
#
# File lib/rbt/installer/misc.rb, line 2991
def add_package_user(
    name = compile_which_program?
  )
  _ = '/Users/Packages/'
  cmd_to_run = 'useradd -m -d '+_+name.capitalize+' '+name
  create_directory _ unless File.directory? _
  opne "Adding a new user called `#{simp(name)}`:"
  custom_system cmd_to_run
end
add_the_default_dataset_to_the_internal_hash()
add_the_invariant_dataset_to_the_internal_hash()
add_this_global_flag(i)
adhoc_fix_gcc() click to toggle source
#

adhoc_fix_gcc

#
# File lib/rbt/installer/misc.rb, line 4514
def adhoc_fix_gcc
  require 'rbt/misc/classes_for_individual_programs/change_lib64_to_lib.rb'
  RBT::ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib.new
end
all_available_programs?() click to toggle source
#

all_available_programs?

To invoke and test this:

ry --all_available_programs?
#
# File lib/rbt/installer/misc.rb, line 13358
def all_available_programs?
  e
  opne 'These programs are available:'
  e
  RBT.feedback_available_programs
end
all_configure_options?() click to toggle source
#

all_configure_options?

Use this method to show all configure options for a given program.

This means all options available through “./configure –help”.

Invocation example:

ry htop allconfigureoptions?
#
# File lib/rbt/installer/misc.rb, line 3691
def all_configure_options?
  ensure_that_the_main_dataset_exists
  #_ = extract_to? # TEMP_DIR+File.basename(compile_this_program?)
  _ = ::RBT.temp_dir?+
      program_name_and_program_version?
  # ======================================================================= #
  # The target may be empty though. Rescue this case.
  # ======================================================================= #
  _ = rbt_log_directory? if _.nil? or _.empty?
  opne 'Will extract to '+sdir(_)+'. In the event that you need '\
       'to know '
  opne 'where the extracted archive resides.'
  opne "All configure options for "\
       "#{simp(compile_this_program?)} will be shown next, "\
       "before exiting."
  set_extract_to(_)
  consider_extracting_this_program(
    program_path?
  )
  _ = rbt_log_directory?+program_name_and_version?
  opne "We will next cd (change directory) into `#{sdir(_)}`."
  cd _, :be_quiet # Now we should be in the proper directory.
  e
  RBT::BeautifyConfigureHelpOutput.new # Delegate to this class next.
  e
  exit_program
end
an_error_has_occurred() click to toggle source
#

an_error_has_occurred

This is a setter-method.

#
# File lib/rbt/installer/misc.rb, line 5296
def an_error_has_occurred
  we_can_not_continue_and_we_will_not_run_make_install
  @internal_hash[:an_error_has_occurred] = true
  the_program_has_failed_to_install
end
an_error_has_occurred?() click to toggle source
#

an_error_has_occurred?

Query-method over as to whether an error has occurred.

#
# File lib/rbt/installer/misc.rb, line 5307
def an_error_has_occurred?
  result = @internal_hash[:an_error_has_occurred]
  ignore_errors = ignore_errors?
  case ignore_errors
  # ======================================================================= #
  # === :infer
  # ======================================================================= #
  when :infer
    ignore_errors = cookbook_dataset_ignore_errors?
  end
  result = false if ignore_errors
  result = false if result.is_a?(Array) and result.empty?
  return result
end
app_dir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
appdir_prefix?( i = compile_which_program?, use_this_program_version = :default ) click to toggle source
#

appdir_prefix? (appdir prefix)

This method will return the (assumed) AppDir prefix for a given program at hand.

The program version must be set before calling this method. If the program_version? has not been defined properly then the method here may return an incorrect result.

This method MUST be guaranteed to return a trailing ‘/’ character.

#
# File lib/rbt/installer/misc.rb, line 9676
def appdir_prefix?(
    i                        = compile_which_program?,
    use_this_program_version = :default
  )
  if cookbook_for?.nil?
    # ===================================================================== #
    # We do the next method primarily so that we can find
    # a proper program version.
    # ===================================================================== #
    initialize_cookbook_dataset_for(i)
  end
  case use_this_program_version
  when :default
    use_this_program_version = program_version?
  when nil
    initialize_cookbook_dataset_for(i)
  end
  # ======================================================================= #
  # We need a safeguard next, as the program version may be nil.
  # ======================================================================= #
  if use_this_program_version.nil?
    use_this_program_version = cookbook_dataset_program_version?
  end
  result = rds(
    programs_directory?.to_s+
    i.to_s.capitalize.to_s+
    '/'+
    use_this_program_version.to_s+'/'
  )
  # ======================================================================= #
  # === Handle GoboLinux next
  # ======================================================================= #
  if is_on_gobolinux?
    # ===================================================================== #
    # If we are on GoboLinux, then we have to honour the other variant
    # called program_compile_name? instead.
    # ===================================================================== #
    result = rds(
      programs_directory?.to_s+
      program_compile_name?.to_s+'/'+ # This line is specific to GoboLinux.
      use_this_program_version.to_s+'/'
    )
  end
  return result
end
appdir_prefix_was_used?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
append_disable_static_to_the_configure_options() click to toggle source
#

append_disable_static_to_the_configure_options

This method is somewhat similar to the method called append_enable_shared_to_the_configure_options in that it will also modify the configure options; but it will add “–disable-static” to the configure options.

#
# File lib/rbt/installer/misc.rb, line 6170
def append_disable_static_to_the_configure_options
  append_this_to_the_configure_options(:disable_static)
end
append_enable_shared_to_the_configure_options() click to toggle source
#

append_enable_shared_to_the_configure_options

This method will simply add –enable-shared onto the configure options.

This can then be used by GNU configure sripts or meson builds or even cmake builds (though the latter may use another format, so keep this in mind for the time being; the primary use cases are for GNU configure scripts and meson builds).

#
# File lib/rbt/installer/misc.rb, line 6248
def append_enable_shared_to_the_configure_options
  append_this_to_the_configure_options(:enable_shared)
end
append_make_option(i)
Alias for: append_make_options
append_make_options(i) click to toggle source
#

append_make_options

This will append parameters issued to “make”. It will also start with a ‘ ’, always.

#
# File lib/rbt/installer/misc.rb, line 9617
def append_make_options(i)
  if i
    make_object?.append_make_options(i)
    append_this = i.to_s.dup
    if parameters_to_make?
      joined_make_options = parameters_to_make?
      if joined_make_options.respond_to? :join
        joined_make_options = joined_make_options.join(' ').strip
      end
      unless append_this.include? joined_make_options
        append_this.prepend(joined_make_options.dup)
      end
    end
    # ======================================================================= #
    # Prepend a ' ' for some spacing.
    # ======================================================================= #
    unless append_this.empty?
      append_this.prepend(' ') unless append_this.start_with? ' '
      set_make_options(append_this)
    end
  end
end
append_onto_the_cflags(i) click to toggle source
#

append_onto_the_cflags

This method can be used to append the given value onto the CFLAGS.

#
# File lib/rbt/installer/misc.rb, line 13384
def append_onto_the_cflags(i)
  ENV['CFLAGS'] = "#{old_cflags?} #{i}" 
end
append_parameters_to_make(i)
Alias for: append_make_options
append_shell_error_code?() click to toggle source
#

append_shell_error_code?

#
# File lib/rbt/installer/misc.rb, line 1128
def append_shell_error_code?
  @internal_hash[:append_shell_error_code]
end
append_static_onto_the_cflags() click to toggle source
#

append_static_onto_the_cflags

This method will, sort of, “enable” static compilation.

#
# File lib/rbt/installer/misc.rb, line 2977
def append_static_onto_the_cflags
  ENV['CFLAGS'] = old_cflags?+' -static -g'
end
append_these_configure_options( i = nil ) click to toggle source
#

append_these_configure_options

This method will only append non-nil entries to the extra configure options.

#
# File lib/rbt/installer/misc.rb, line 9859
def append_these_configure_options(
    i = nil
  )
  case i
  # ======================================================================= #
  # === :release
  # ======================================================================= #
  when :release
    i = '-DCMAKE_BUILD_TYPE=Release'
  end
  if i
    if @internal_hash[:append_this_to_the_configure_options].nil?
      # =================================================================== #
      # In this case we must turn it into a String.
      # =================================================================== #
      @internal_hash[:append_this_to_the_configure_options] = ''.dup
    end
    @internal_hash[:append_this_to_the_configure_options] << " #{i}"
  end
end
append_this_to_full_configure_command(i = ' build') click to toggle source
#

append_this_to_full_configure_command

#
# File lib/rbt/installer/misc.rb, line 6421
def append_this_to_full_configure_command(i = ' build')
  unless i.end_with? ' '
    i = i.dup if i.frozen?
    i << ' ' # Properly pad it here.
  end
  i.squeeze!(' ')
  @internal_hash[:full_configure_command] << i
end
append_this_to_make(i)
Alias for: append_make_options
append_this_to_the_configure_options( i = :enable_bootstrap ) click to toggle source
#

append_this_to_the_configure_options

This method can be used to append options to the ./configure line, such as –enable-shared, without having to type the long version. So for example, the Symbol :libdir64 will be expanded to mean –libdir=/usr/lib64. That way the user can get away with typing less on the commandline.

#
# File lib/rbt/installer/misc.rb, line 6103
def append_this_to_the_configure_options(
    i = :enable_bootstrap
  )
  # ======================================================================= #
  # The following case-when menu could be replaced with generic code
  # that turns the Symbol-input into the equivalent String e. g.
  # --disable-something or --enable-something. However had, for the
  # time being (Dec 2018) I will leave it as it is. In April 2021,
  # I decided to retain the symbol-as-input approach, since some
  # symbols get expanded to longer strings than other symbols.
  # ======================================================================= #
  case i
  # ======================================================================= #
  # === :libdir
  # ======================================================================= #
  when :libdir
    i = ' --libdir=/usr/lib'
  # ======================================================================= #
  # === :libdir64
  # ======================================================================= #
  when :libdir64
    i = ' --libdir=/usr/lib64'
  # ======================================================================= #
  # === :enable_shared
  # ======================================================================= #
  when :enable_shared
    i = ' --enable-shared'
  # ======================================================================= #
  # === :disable_static
  # ======================================================================= #
  when :disable_static
    i = ' --disable-static'
  # ======================================================================= #
  # === :enable_bootstrap
  # ======================================================================= #
  when :enable_bootstrap
    i = ' --enable-bootstrap'
  end
  _ = @internal_hash[:configure_options]
  _ = ''.dup if _.nil?
  unless i.start_with? ' '
    i = i.dup if i.frozen?
    i.prepend(' ')
  end
  # ======================================================================= #
  # Next simply append these to the configure options.
  # ======================================================================= #
  _ << i
  @internal_hash[:configure_options] = _
end
apply_patch?()
apply_sed_operation_on(sed_line) click to toggle source
#

apply_sed_operation_on

This method will either use class SedWrapper, or it will use the sed-binary.

#
# File lib/rbt/installer/misc.rb, line 9530
def apply_sed_operation_on(sed_line)
  if sed_line.is_a? Array
    sed_line.each {|entry|
      apply_sed_operation_on(entry)
    }
  else
    if sed_binary_is_available?
      run_this_system_command_in_a_coloured_and_padded_manner(sed_line)
    else
      if use_the_internal_sed_wrapper?
        # ================================================================= #
        # In this case, use the SedWrapper as a fallback.
        # ================================================================= #
        SedWrapper.new(sed_line)
      else
        # ================================================================= #
        # Else we will default to the system-sed.
        # ================================================================= #
        opne 'We can not use the sed line '+
             sfancy(sed_line)+' because '\
             'sed is not available'
        opne ', and no commandline option has been passed to allow '\
             'us to use the sed wrapper.'
      end
    end
  end
end
Also aliased as: run_this_sed_instruction
archive?()
Alias for: archive_type?
archive_type?() click to toggle source
#

archive_type?

#
# File lib/rbt/installer/misc.rb, line 5165
def archive_type?
  if cookbook_dataset?
    cookbook_dataset?.archive_type?
  end
end
Also aliased as: archive?, cookbooks_archive_type?
array?()
array_compile_these_programs?()
array_sys_command_string?() click to toggle source
#

array_sys_command_string?

The array is fed in line by line.

#
# File lib/rbt/installer/misc.rb, line 4679
def array_sys_command_string?
  @internal_hash[:array_sys_command_string]
end
Also aliased as: sys_command_string?
assemble_full_path()
Alias for: update_program_path
assemble_program_path() click to toggle source
#

assemble_program_path

#
# File lib/rbt/installer/misc.rb, line 8854
def assemble_program_path
  cookbook_dataset?.assemble_program_path
end
assign_to_the_main_dataset( i, check_for_stringent_input = true ) click to toggle source
#

assign_to_the_main_dataset

This method should be used when we wish to assign to the main dataset at hand. The expected input should be class ::RBT::Cookbooks::SanitizeCookbook. If it is not then this will cause an argument error.

The second argument to this method can be used to control how strict the method shall behave.

#
# File lib/rbt/installer/misc.rb, line 1367
def assign_to_the_main_dataset(
    i, check_for_stringent_input = true
  )
  if check_for_stringent_input
    unless i.is_a? ::RBT::Cookbooks::SanitizeCookbook
      raise ArgumentError,
            'The method assign_to_the_main_dataset() expects input as '\
            'class RBT::Cookbooks::SanitizeCookbook'
    end
    set_on_ihash(:cookbook_dataset, i)
  end
end
assume_default_archive_type() click to toggle source
#

assume_default_archive_type

#
# File lib/rbt/installer/misc.rb, line 8891
def assume_default_archive_type
  cookbook_dataset?.assume_default_archive_type
end
attach_program_name_and_program_version() click to toggle source
#

attach_program_name_and_program_version

#
# File lib/rbt/installer/misc.rb, line 8847
def attach_program_name_and_program_version
  cookbook_dataset?.attach_program_name_and_program_version
end
autofix?()
Alias for: try_to_autofix?
automatically_create_package?() click to toggle source
#

automatically_create_package?

#
# File lib/rbt/installer/misc.rb, line 3036
def automatically_create_package?
  RBT.automatically_create_package?
end
automatically_infer_program_name_and_program_version_from_this_input( i, optional_arguments = nil ) click to toggle source
#

automatically_infer_program_name_and_program_version_from_this_input

This method will try to automatically set the program_name and @program_version variables.

#
# File lib/rbt/installer/misc.rb, line 6017
def automatically_infer_program_name_and_program_version_from_this_input(
    i,
    optional_arguments = nil
  )
  if compile_which_program?.nil?
    set_program_name(
      program_information_return_program_real_name(i)
    )
  end
  if program_version?.nil?
    set_program_version(
      program_information_return_program_version(i)
    )
  end
  case optional_arguments
  when :overwrite_old_values_should_they_exist
    set_program_name    program_information_return_program_real_name(i)
    set_program_version program_information_return_program_version(i)
  end
  set_program_name_and_program_version(
    compile_which_program?+'-'+program_version?
  )
end
autoswitch_python?() click to toggle source
#

autoswitch_python?

This query-method determines whether we will autoswitch the python version or not.

#
# File lib/rbt/installer/misc.rb, line 14108
def autoswitch_python?
  config?.autoswitch_python
end
backup_program( i = compile_which_program? ) click to toggle source
#

backup_program

Backup an existingp rogram under the /Programs/ hierarchy.

#
# File lib/rbt/installer/misc.rb, line 5895
def backup_program(
    i = compile_which_program?
  )
  require 'rbt/utility_scripts/backup_program.rb'
  RBT::BackupProgram.new(i)
end
base_dir?() click to toggle source
#

base_dir?

#
# File lib/rbt/installer/misc.rb, line 15584
def base_dir?
  cookbook_for?.base_dir?.to_s
end
batch_compile_the_programs()
batch_compile_these_programs()
batch_download_all_source_archives() click to toggle source
#

batch_download_all_source_archives

For this method we have to delegate towards class Cookbooks::DownloadAllSourceArchives.

#
# File lib/rbt/installer/misc.rb, line 12942
def batch_download_all_source_archives
  require 'rbt/toplevel_methods/download_all_source_archives.rb'
  RBT.download_all_source_archives
end
batch_validate_the_cookbooks() click to toggle source
#

batch_validate_the_cookbooks

#
# File lib/rbt/installer/misc.rb, line 8290
def batch_validate_the_cookbooks
  unless RBT::Cookbooks.const_defined? :BatchValidateTheCookbookRecipes
    require 'rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb'
  end
  BatchValidateTheCookbookRecipes.new
end
be_completely_quiet() click to toggle source
#

be_completely_quiet

#
# File lib/rbt/installer/misc.rb, line 7438
def be_completely_quiet
  @internal_hash[:original_stdout] = $stdout
  # $stdout = StringIO.new # This is the redirection.
  $stdout = File.open(IO::NULL, 'w') # This one works better, according to drbrain.
end
binaries?()
Alias for: cookbooks_binaries?
binary?( i = compile_which_program? ) click to toggle source
#

binary?

Wrapper towards answering the question of binary pointing.

#
# File lib/rbt/installer/misc.rb, line 10472
def binary?(
    i = compile_which_program?
  )
  i = i.first if i.is_a? Array
  i = i.downcase
  opne "Checking for a binary name called `#{simp(i)}` next:"
  return_program_based_on_this_binary(i)
end
blfs?() click to toggle source
#

blfs?

#
# File lib/rbt/installer/misc.rb, line 10402
def blfs?
  dataset?.blfs?
end
build_directory?()
build_directory_object?() click to toggle source
#

build_directory_object?

#
# File lib/rbt/installer/build_directory.rb, line 298
def build_directory_object?
  @internal_hash[:build_directory]
end
build_static?() click to toggle source
#

build_static?

We have to first check the build_static entry of the cookbook dataset, before we query the value of the @internal_hash.

#
# File lib/rbt/installer/misc.rb, line 2852
def build_static?
  _ = cookbook_dataset_build_static?
  unless @internal_hash[:build_static].nil?
    _ = @internal_hash[:build_static]
  end
  _
end
build_system?()
build_system_in_use?()
build_system_to_be_used?()
build_type?()
can_be_compiled_statically?() click to toggle source
#

can_be_compiled_statically?

#
# File lib/rbt/installer/misc.rb, line 14028
def can_be_compiled_statically?
  cookbooks_dataset?.send(__method__)
end
can_not_continue(be_verbose = false)
Alias for: we_can_not_continue
can_we_continue?() click to toggle source
#

can_we_continue?

#
# File lib/rbt/installer/misc.rb, line 181
def can_we_continue?
  result = @internal_hash[:can_we_continue]
  # if cookbook_dataset?.nil?
  #   initialize_dataset_for(compile_which_program?)
  # end
  ignore_errors = @internal_hash[:ignore_errors]
  case ignore_errors
  # ======================================================================= #
  # === :infer
  # ======================================================================= #
  when :infer
    ignore_errors = cookbook_dataset_ignore_errors? if cookbook_dataset?
  end
  if ignore_errors
    result = true
  end
  result
end
cd_into_the_rbt_log_directory?() click to toggle source
#

cd_into_the_rbt_log_directory?

#
# File lib/rbt/installer/misc.rb, line 13339
def cd_into_the_rbt_log_directory?
  @internal_hash[:cd_into_the_rbt_log_directory]
end
cd_to_the_build_directory( i = use_this_build_directory? ) click to toggle source
#

cd_to_the_build_directory

#
# File lib/rbt/installer/build_directory.rb, line 152
def cd_to_the_build_directory(
    i = use_this_build_directory?
  )
  cd(i)
end
cd_to_the_configure_base_directory( be_verbose_or_be_quiet = :be_quiet ) click to toggle source
#

cd_to_the_configure_base_directory

This method can be used to cd into the configure base directory.

It can report what it is doing to, in the verbose variant.

#
# File lib/rbt/installer/misc.rb, line 7337
def cd_to_the_configure_base_directory(
    be_verbose_or_be_quiet = :be_quiet
  )
  target = @internal_hash[:configure_base_directory].dup
  case be_verbose_or_be_quiet
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet
    cd target, :be_quiet
  else
    opnn; cd target, :be_verbose
  end
end
cd_to_the_configure_base_directory_to_be_used( be_verbose_or_be_quiet = :be_quiet )
cd_to_the_extracted_archive() click to toggle source
#

cd_to_the_extracted_archive

This method can be used to quickly cd to the extracted archive.

This assumes that:

(a) the archive exists
(b) the archive has been extracted to its designated target
#
# File lib/rbt/installer/misc.rb, line 10895
def cd_to_the_extracted_archive
  target = "#{extract_to_this_directory?}"\
           "#{program_name_and_program_version?}"
  cd target
end
cd_to_the_extracted_directory( i = use_this_build_directory? )
cflags?() click to toggle source
#

cflags?

Just a convenience wrapper over the CFLAGS environment variable. A getter method, which will tell us the CFLAGS in use of the environment.

#
# File lib/rbt/installer/misc.rb, line 9112
def cflags?
  ENV['CFLAGS'].to_s.dup
end
Also aliased as: default_cflags?, cflags_in_use?
cflags_in_use?()
Alias for: cflags?
chained_programs?()
change_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? )
check_all_tags_under_programs_directory() click to toggle source
#

check_all_tags_under_programs_directory

Use this method to check for all entries in the PROGRAMS_DIRECTORY, whether they also have an entry in /System/Tags.

To invoke this method, try:

ry --check-all-tags
#
# File lib/rbt/installer/misc.rb, line 2508
def check_all_tags_under_programs_directory
  entries = Dir["#{programs_directory?}*"].map {|entry|
    entry << '/Current/'
  }.sort
  entries.each {|entry|
    # ===================================================================== #
    # A particular entry may look like this:
    #   /Programs/Zip/Current/
    # ===================================================================== #
    # Must check whether the directory exists.
    # ===================================================================== #
    if Dir.exist? entry
      splitted = entry.split('/') # ← e. g. "/Programs/Zip/Current/"
      program_name = splitted[2]
      program_name.downcase!
      dataset = instantiate_a_new_cookbook_for(program_name)
      symlink_into_tags(entry, dataset)
    end
  }
  opne 'All done now.'
end
check_for_available_versions( for_this_program = program? ) click to toggle source
#

check_for_available_versions

Use this method if you wish to check for available program versions.

Usage examples:

ry bluefish available_versions
ry gcc available_versions
#
# File lib/rbt/installer/misc.rb, line 9965
def check_for_available_versions(
    for_this_program = program?
  )
  require 'rbt/utility_scripts/check_for_available_versions.rb'
  _ = RBT::Cookbooks::CheckForAvailableVersions.new(
    for_this_program, :do_not_run_yet
  )
  _.be_verbose
  _.run
end
check_for_binary_duplicates_in_this_directory( i = Dir.pwd ) click to toggle source
#

check_for_binary_duplicates_in_this_directory

This method can be used to check for binary duplicates, aka binaries that exist more than once on the given system, in the given (passed) directory.

#
# File lib/rbt/installer/misc.rb, line 1245
def check_for_binary_duplicates_in_this_directory(
    i = Dir.pwd
  )
  require 'rbt/utility_scripts/check_for_duplicate_binaries.rb'
  RBT::CheckForDuplicateBinaries.new(Dir.pwd)
end
check_for_common_errors() click to toggle source
#

check_for_common_errors

This mehod can be used to check (and handle) errors that we have encountered.

#
# File lib/rbt/installer/misc.rb, line 10602
def check_for_common_errors
  _ = errors?
  if _.is_a? Array
    _.each {|entry|
      case entry
      # =================================================================== #
      # === :gir_file_could_not_be_found
      # =================================================================== #
      when :gir_file_could_not_be_found
        opne 'A required package could not be found, related '\
             'to .gir (gobject introspection) files.'
        error_is(:required_package_was_not_found)
      # =================================================================== #
      # === :required_package_was_not_found
      # =================================================================== #
      when :required_package_was_not_found
        error_is(:required_package_was_not_found)
      # =================================================================== #
      # === :ninja_build_encountered_an_error
      # =================================================================== #
      when :ninja_build_encountered_an_error
        error_is(:ninja_build_encountered_an_error)
      # =================================================================== #
      # === :configure_error
      #
      # This error occurs when configure failed for some reason. It is
      # a somewhat generic error and may occur, for example, when a
      # certain package is missing.
      #
      # Example for this:
      #
      #   No package 'libmate-menu' found
      #
      # =================================================================== #
      when :configure_error
        opnerror 'Some configure-related error has occurred.'
      # =================================================================== #
      # === Python syntax error: Invalid Syntax
      # =================================================================== #
      when :python_syntax_error_invalid_syntax
        opnerror 'This InvalidSyntax error is often related to the different'
        opnerror 'syntax that python2 and python3 use.'
        # ================================================================= #
        # Consider autoswitching the python-version next:
        # ================================================================= #
        if is_on_roebe?
          if autoswitch_python?
            opne "The configuration file "\
                 "#{slateblue('autoswitch_python.yml')}"\
                 " has been set to true."
            opne "We will consider switching python "\
                 "next (to #{slateblue('python')})."
            result_of_enabling_python2 = enable_python2
            if result_of_enabling_python2 == true
              clear_errors
              do_compile_this_program(
                compile_which_program?
              )
            end
          else
            # ============================================================= #
            # In this case, notify the user that autoswitching could
            # be enabled. This clause here is entered when autoswitching
            # has been disabled.
            # ============================================================= #
            opne 'Do note that you could set the autoswitch-python '\
                 'variable to true.'
            opne "This could be done by modifying the content "\
                 "of the file #{slateblue('autoswitch_python.yml')}."
            opne 'Having autoswitch-python enabled may, however had, '\
                 'also lead to problems sometimes, so'
            opne 'make sure that you really want to enable this '\
                 'functionality, prior to changing that file.'
          end
        end
      # =================================================================== #
      # === A general make-related error
      # =================================================================== #
      when :make_encountered_some_error
        # ================================================================= #
        # This error type is too generic for now - but perhaps in the
        # future we may also handle it somehow, or give the user
        # more information about it.
        # ================================================================= #
      else
        # ================================================================= #
        # For now this "debugging" part only occurs on roebe-systems.
        # ================================================================= #
        if is_on_roebe?
          opnn
          stderr "Unregistered error: #{slateblue(entry)}"\
                 " (class: #{lightblue(entry.class.to_s)})"
        end
      end
    }
  end
end
check_for_common_problems() click to toggle source
#

check_for_common_problems (problems tag, problem tag)

This method will check for some problems and offer ways to resolve these issues. For this to work, the particular problem at hand has to be registered in the following case/when menu.

This method is for checking problems - but for the time being (Nov 2018) we will also check for common errors within this method. This is perhaps not ideal, but simplifies the code for now. In the future this may have to be changed (or the method may have to be renamed).

#
# File lib/rbt/installer/misc.rb, line 15960
def check_for_common_problems
  _ = problems?
  if _
    # ===================================================================== #
    # We will only handle registered Symbols next.
    # ===================================================================== #
    if _.is_a? Symbol
      case _ # case tag
      # =================================================================== #
      # === Libtool could not find the library
      # =================================================================== #
      when :libtool_could_not_find_the_library
        if is_on_roebe?
          unless @internal_hash[:invalid_libtool_archive].nil?
            line = @internal_hash[:invalid_libtool_archive]
            try_to_autocorrect_this_erroneous_libtool_entry(line)
          end
        end
      # =================================================================== #
      # === Encountered an invalid libtool archive
      # =================================================================== #
      when :encountered_an_invalid_libtool_archive
        if is_on_roebe?
          unless @internal_hash[:invalid_libtool_archive].nil?
            line = @internal_hash[:invalid_libtool_archive]
            try_to_autocorrect_this_erroneous_libtool_entry(line)
          end
        end
      # =================================================================== #
      # === Libtool can not install to another prefix
      # =================================================================== #
      when :libtool_can_not_install_to_another_prefix
        opne 'Libtool apparently can not install to another prefix.'
        opne 'The main reason for this is usually that the configure script'
        opne 'was run from a directory before, but with another --prefix.'
        opne 'Try to run "make clean" in the base directory or remove the'
        opne 'extracted archive, in order to try to fix this problem.'
        if is_on_roebe?
          opne tomato('Removing')+' the extracted archive next.'
          remove_the_extracted_archive
        end
      # =================================================================== #
      # === missing_header_ladspa
      # =================================================================== #
      when :missing_header_ladspa
        opne 'The header ladspa.h is missing. This is part of the '\
             'ladspa-sdk package.'
        opne 'The remote URL should be at: '+
              sfancy(return_url_for(:ladspa))
        e
        e 'This program can probably be installed via:'
        e
        e "  #{sfancy('rbt ladspa')}"
        e
      # =================================================================== #
      # === Incomplete configure error via cmake
      #
      # This entry point is for cmake-related errors that are not further
      # specified - in other words, generic cmake-related errors.
      # =================================================================== #
      when :incomplete_configure_error_via_cmake
        do_skip_postinstall_actions
        opne "Something went wrong via `#{powderblue('cmake')}`."
      # =================================================================== #
      # === The totem playlist was not found
      # =================================================================== #
      when :totem_playlist_was_not_found
        opne 'The totem playlist was not found. You can try '\
             'to compile it:'
        e
        opne sfancy('  rbt totem-playlist')
        e
      # =================================================================== #
      # === Missing C .h (header) file
      # =================================================================== #
      when :missing_c_header_file
        opne swarn('An important C .h file is missing - the compilation '\
             'can not proceed.')
        # ================================================================= #
        # The next line was added on 22.08.2018. I wanted to make sure to
        # easily look at the error for programs that have failed, like
        # this program here.
        # ================================================================= #
        do_not_remove_extracted_archive
        which_h_file = sys_command_string?.select {|inner_line|
          inner_line.include?('fatal error:') and
          inner_line.include?('No such file or directory')
        }
        use_this_regex = /fatal error. (.+\.h):/
        which_h_file.first =~ use_this_regex
        this_file = $1.to_s.dup
        case this_file
        # ================================================================= #
        # === xf86Resources.h
        # ================================================================= #
        when 'xf86Resources.h'
          opne "The file #{sfile(this_file)} belongs to the very old package"
          opne 'xf86-video-amd-2.7.7.7.tar.xz. This has not been updated since'
          opne '2008 so things will most likely no longer compile.'
        end
      # =================================================================== #
      # === Python import error: an undefined symbol
      #
      # Note that this is a problem, not necessarily an error.
      # =================================================================== #
      when :python_import_error_undefined_symbol
        opne 'A python '+swarn('ImportError')+' has happened, about '\
             'a missing/undefined Symbol.'
        if sys_command_string?.any? {|inner_line|
            inner_line.include? 'lib/gobject-introspection'
          }
          opne 'The problem appears to be somehow related to gobject-introspection.'
          opne 'This error may appear when different python versions or '
          opne 'different library locations are used at the same time.'
        end
      # =================================================================== #
      # === Docbook failed to load a network entity
      #
      # This entry point is related to docbook.
      # =================================================================== #
      when :docbook_failed_to_load_a_network_entity
        opne 'Docbook failed to load a '+
             steelblue('(remote) network entity')+'.'
        opne 'In theory, this could be resolved by installing the docbook'
        opne 'stack, but this is not necessarily trivial. Have a look at the'
        opne 'LFS page for now:'
        e
        e '  '+sfancy(::RBT.return_blfs_entry_for('docbook'))
        e
      # =================================================================== #
      # === No configure file
      # =================================================================== #
      when :no_configure_file
        opnn; _ = 'No '+sfancy('configure')+' file was found.'
      # =================================================================== #
      # === Jam is missing
      # =================================================================== #
      when :jam_is_missing
        do_skip_postinstall_actions
        notify_the_user_that_this_program_is_missing(:jam)
      # =================================================================== #
      # === Meson could not be found
      # =================================================================== #
      when :meson_could_not_be_found
        do_skip_postinstall_actions
        notify_the_user_that_this_program_is_missing(:meson) {
          e orange(
              'Note that this will require a recent python 3.x '\
              'version on your host system.'
            )
          e orange(
              'Additionally, you may need the build tool called '\
              'ninja:'
            )
          e
          e '  '+sfancy('rbt ninja')
          e
        }
      end
    elsif _.is_a? Array
      _ = problem?
      first = _.first
      last  = _.last
      last  = last.first if last.is_a? Array
      case first # case tag
      # =================================================================== #
      # === python_import_error_missing_module
      # =================================================================== #
      when :python_import_error_missing_module
        opne "The python module `#{sfancy(last)}` is missing."
        case last
        # ================================================================= #
        # === libxml2
        # ================================================================= #
        when /libxml2?/
          opne "You may be able to resolve this problem, by "\
               "#{steelblue('compiling libxml2')}:"
          e
          opne "  #{sfancy('rbt libxml2')}"
          e
        end
      end
    end
  end
end
check_for_common_problems_and_common_errors() click to toggle source
#

check_for_common_problems_and_common_errors

#
# File lib/rbt/installer/misc.rb, line 15943
def check_for_common_problems_and_common_errors
  check_for_common_problems
  check_for_common_errors
end
check_for_errors?() click to toggle source
#

check_for_errors?

#
# File lib/rbt/installer/misc.rb, line 459
def check_for_errors?
  !ignore_errors?
end
Also aliased as: honour_error_results?
check_for_inclusion() click to toggle source
#

check_for_inclusion

We will check the source directory for program-inclusion.

To invoke this method, try something like this:

ry htop --check_for_inclusion
#
# File lib/rbt/installer/misc.rb, line 13398
def check_for_inclusion
  RBT::Cookbooks::CheckForInclusion.new # bl $RUBY_COOKBOOKS/lib/cookbooks/check_for_inclusion.rb
end
check_for_latest() click to toggle source
#

check_for_latest

Method-Wrapper over class LocalCheckForLatest.

Invocation example:

ry --checkforlatest
#
# File lib/rbt/installer/misc.rb, line 5517
def check_for_latest
  require 'rbt/cookbooks/local_check_for_latest.rb'
  RBT::Cookbooks::LocalCheckForLatest.new # bl $RUBY_COOKBOOKS/lib/cookbooks/local_check_for_latest.rb
end
check_for_problems_again()
check_for_sed_action() click to toggle source
#

check_for_sed_action (sed tag)

Some programs have a sed-entry. We thus need a method to handle these sed entries.

As of August 2017, we will delegate towards class RBT::SedWrapper to deal with sed-related editing. However had, since as of February 2018, we will use system-sed (the binary called “sed”), if it is available. The reason as to why is because my sed-wrapper is incomplete and buggy.

Perhaps one day class SedWrapper may work reliably, but for the time being, and as new default, we will not use the SedWrapper by default.

#
# File lib/rbt/installer/misc.rb, line 11318
def check_for_sed_action
  _ = sed? # Note that this ought to be an Array.
  if _ and !_.empty?
    if use_the_internal_sed_wrapper?
      unless _.empty?
        notify_the_user_that_we_will_use_sed_from_the_pwd
        _.each {|sed_line| # Must be an Array.
          opne 'Next applying the following sed-operation:'
          apply_sed_operation_on(sed_line)
        }
      end
    else
      # =================================================================== #
      # Else we will delegate towards class ApplySedOperations.
      # =================================================================== #
      RBT::ApplySedOperations.new(_)
    end
  end
end
check_for_this_licence?() click to toggle source
#

check_for_this_licence?

#
# File lib/rbt/installer/misc.rb, line 3722
def check_for_this_licence?
  @internal_hash[:check_for_this_licence]
end
check_if_source_directories_exist() click to toggle source
#

check_if_source_directories_exist

#
# File lib/rbt/installer/misc.rb, line 1514
def check_if_source_directories_exist
  RBT.check_if_source_directories_exist
end
check_whether_the_given_input_is_a_file_and_does_exist?() click to toggle source
#

check_whether_the_given_input_is_a_file_and_does_exist?

#
# File lib/rbt/installer/misc.rb, line 14237
def check_whether_the_given_input_is_a_file_and_does_exist?
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist]
end
chop_off_revision_number() click to toggle source
#

chop_off_revision_number

#
# File lib/rbt/installer/misc.rb, line 8868
def chop_off_revision_number
  cookbook_dataset?.chop_off_revision_number
end
clear_configure_options() click to toggle source
#

clear_configure_options

This method will clear the old configure options.

#
# File lib/rbt/installer/misc.rb, line 6281
def clear_configure_options
  @internal_hash[:configure_options] = nil
  if cookbook_for?
    cookbook_for?.clear_configure_options
  end
end
clear_env( be_verbose = true ) click to toggle source
#

clear_env

This method will clear ENV. This may sometimes be necessary to start from a clean state.

#
# File lib/rbt/installer/misc.rb, line 5773
def clear_env(
    be_verbose = true
  )
  if be_verbose
    opne "Clearing (resetting) the environment variable of "\
         "ruby via #{slateblue('ENV.clear()')}."
  end
  ENV.clear
end
clear_env_variables_but_ensure_the_path_variable_works() click to toggle source
#

clear_env_variables_but_ensure_the_path_variable_works

#
# File lib/rbt/installer/misc.rb, line 3523
def clear_env_variables_but_ensure_the_path_variable_works
  old_path = query_path?
  clear_env
  unless old_path.empty?
    # ===================================================================== #
    # Set a new PATH here, as otherwise compilation would fail.
    # ===================================================================== #
    opne "Note that this will lead to compile-time failures because "\
         "#{orange('$PATH')}"
    opne 'would not be set. We will use the old path entry '\
         'there as a consequence:'
    opne sfancy("  #{old_path}")
    set_path(old_path)
  end
end
clear_errors() click to toggle source
#

clear_errors

#
# File lib/rbt/installer/misc.rb, line 10703
def clear_errors
  RBT.clear_errors
end
clear_global_flags() click to toggle source
#

clear_global_flags

Clear the global files in use that may be stored in the file global_flags.yml.

#
# File lib/rbt/installer/misc.rb, line 4141
def clear_global_flags
  _ = RBT.file_global_flags
  if File.exist?(_) and !File.empty?(_)
    zero_this_global_flag_file(_)
  end
  if is_on_roebe? # And on my home system as well.
    _ = ROEBE_FILE_GLOBAL_FLAGS
    zero_this_global_flag_file(_)
  end
end
clear_old_configure_options() click to toggle source
#

clear_old_configure_options

#
# File lib/rbt/installer/misc.rb, line 10779
def clear_old_configure_options
  set_configure_options('')
end
clear_problems() click to toggle source
#

clear_problems

Reset the problems, so that we don’t have any problems.

#
# File lib/rbt/installer/misc.rb, line 10744
def clear_problems
  problem_is :no_problem
end
cmake_configure_options?()
cmake_exists?() click to toggle source
#

cmake_exists?

This method will try to determine whether “cmake” exists on the local computer host or whether it does not.

#
# File lib/rbt/installer/misc.rb, line 13472
def cmake_exists?
  result = `cmake #{ERROR_LINE}`
  !result.include?('cmake: command not found')
end
Also aliased as: is_cmake_available?
cmake_file?()
Alias for: cmake_file_exists?
cmake_file_exists?() click to toggle source
#

cmake_file_exists?

#
# File lib/rbt/installer/misc.rb, line 13556
def cmake_file_exists?
  File.exist? 'CMakeLists.txt'
end
Also aliased as: cmake_file?
colourize_parser?() click to toggle source
#

colourize_parser?

#
# File lib/rbt/installer/misc.rb, line 2448
def colourize_parser?
  @internal_hash[:colourize_parser]
end
compile_all_games() click to toggle source
#

compile_all_games

This method can be used to compile all registered games.

#
# File lib/rbt/installer/misc.rb, line 13434
def compile_all_games
  we_will_not_try_to_determine_which_programs_have_to_be_installed
  compile_all_programs_that_belong_to_this_tag(:game)
end
compile_all_kde5_plasma_components(be_verbose = true) click to toggle source
#

compile_all_kde5_plasma_components

This entry point allows us to compile all the various KDE5 plasma components.

Invocation example:

ry --compile-all-kde5-plasma-components
#
# File lib/rbt/installer/misc.rb, line 6715
def compile_all_kde5_plasma_components(be_verbose = true)
  _ = return_kde5_plasma
  be_verbose = false if be_verbose == :be_quiet
  if be_verbose
    opne "We will next compile all #{lightgreen(_.size)}"\
         " KDE5 plasma-components:"
  end
  set_compile_these_programs(_)
end
compile_all_kde_foundation() click to toggle source
#

compile_all_kde_foundation

#
# File lib/rbt/installer/misc.rb, line 6631
def compile_all_kde_foundation
  set_compile_these_programs(
    return_these_programs(:kde5_foundation)
  )
end
compile_all_lxqt_components() click to toggle source
#

compile_all_lxqt_components

This entry point allows us to compile all LxQT components, e. g. for the lxqt-desktop.

To compile all LXQT components, try this on the commandline:

ry --compile-lxqt
#
# File lib/rbt/installer/misc.rb, line 2083
def compile_all_lxqt_components
  set_array_compile_these_programs(
    return_lxqt_components,
    :do_not_replace
  )
end
compile_all_of_gstreamer() click to toggle source
#

compile_all_of_gstreamer

This entry point allows us to compile all of gstreamer.

To invoke this, try something like:

ry --gstreamer1
#
# File lib/rbt/installer/misc.rb, line 15759
def compile_all_of_gstreamer
  array = %w(
    gstreamer
    gstreamerpluginsbase
    gstpluginsgood
    gstpluginsbad
  )
  opne 'Now compiling the various '+
       steelblue('gstreamer components')+
       ' ('+array.size.to_s+'4 components).'
  # do_compile_these_programs(array)
  set_install_these_programs(array)
end
compile_all_of_kde() click to toggle source
#

compile_all_of_kde

To invoke this method, do:

ry --compile-all-of-kde
#
# File lib/rbt/installer/misc.rb, line 6733
def compile_all_of_kde
  _ = []
  # ======================================================================= #
  # === The KDE foundation (including extra-cmake-modules)
  # ======================================================================= #
  _ << return_these_programs(:kde5_foundation)
  # ======================================================================= #
  # === The KDE applications
  # ======================================================================= #
  _ << return_kde5_applications
  # ======================================================================= #
  # === The KDE plasma stack
  # ======================================================================= #
  _ << return_kde5_plasma
  # ======================================================================= #
  # === The KDE porting aids
  # ======================================================================= #
  _ << return_kde5_porting_aids
  _.flatten!
  set_compile_these_programs(_) # ← Set it just in case.
end
compile_all_of_xfce() click to toggle source
#

compile_all_of_xfce

#
# File lib/rbt/installer/misc.rb, line 13139
def compile_all_of_xfce
  _ = return_xfce_components
  we_will_not_try_to_determine_which_programs_have_to_be_installed
  set_compile_these_programs(_)
  opne 'Finished compiling '+steelblue(_.size.to_s)+' XFCE components.'
end
compile_all_programs( shall_we_exit = true ) click to toggle source
#

compile_all_programs

This method is a direct approach to compile every program that we have registered, in our database.

This method accepts one argument, which decides whether we will quit afterwards or whether we will not.

Invocation example:

ry --compile_all_programs
#
# File lib/rbt/installer/misc.rb, line 7313
def compile_all_programs(
    shall_we_exit = true
  )
  case shall_we_exit
  when :do_exit_afterwards
    shall_we_exit = true
  end
  _ = return_available_programs.shuffle # We shuffle for more "randomness".
  n_programs = _.size.to_s
  clear_commandline_options
  opne sfancy('Compiling all available programs next (by a brute'\
       'force approach - we found ')+
       simp(n_programs)+sfancy(' programs):')
  compile_every_program(_)
  exit_program if shall_we_exit
end
compile_all_programs_that_belong_to_this_tag(i) click to toggle source
#

compile_all_programs_that_belong_to_this_tag

Invocation examples:

rbt --compile-this-tag=gnome
rbt --compile-this-tag=kde
rbt --compile-this-tag=kde5
rbt --compile-this-tag=game
#
# File lib/rbt/installer/misc.rb, line 13450
def compile_all_programs_that_belong_to_this_tag(i)
  # ======================================================================= #
  # (1) first obtain all programs that belong to a particular tag
  # ======================================================================= #
  these_programs = RBT.return_array_of_this_tag(i)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
  opne "Determining all programs that belong to the tag #{steelblue(i)} -"
  opne "note that this may take a moment or two."
  # ======================================================================= #
  # (2) then set to the main array
  # ======================================================================= #
  set_compile_these_programs(
    these_programs
  )
end
compile_all_up_until_konsole() click to toggle source
#

compile_all_up_until_konsole

This method can be used to quickly get to compile konsole - and, prior to that, the programs that KDE Konsole depends on.

Invocation example:

ry --compile-towards-konsole
#
# File lib/rbt/installer/misc.rb, line 6611
def compile_all_up_until_konsole
  _ = []
  _ << return_these_programs(:kde5_foundation) # ← This is fine.
  _ << :konsole
  _.flatten!
  set_compile_these_programs(_) # ← Set it just in case.
end
compile_array?()
compile_as_appdir( program_name_and_program_version = program_name_and_program_version?, be_verbose = true )
compile_every_program()
compile_gcc_with_only_c_and_cpp() click to toggle source
#

compile_gcc_with_only_c_and_cpp

To invoke this method, try:

ry gcc --only-c-and-cpp
#
# File lib/rbt/installer/misc.rb, line 8910
def compile_gcc_with_only_c_and_cpp
  initialize_dataset_for(:gcc)
  clear_configure_options
  # ===================================================================== #
  # --disable-multilib is necessary as otherwise it won't work.
  # ===================================================================== #
  append_this_to_the_configure_options(
    '--enable-languages=c,c++ --disable-multilib'
  )
end
compile_in_a_non_traditional_manner()
compile_into_the_home_directory() click to toggle source
#

compile_into_the_home_directory

#
# File lib/rbt/installer/misc.rb, line 11458
def compile_into_the_home_directory
  set_user_prefix('$HOME')
end
compile_into_the_home_directory_as_appdir() click to toggle source
#

compile_into_the_home_directory_as_appdir

This method will enable compilation into the user’s home directory, via AppDir style.

Invocation example:

rbt xwd --homedir
#
# File lib/rbt/installer/misc.rb, line 1063
def compile_into_the_home_directory_as_appdir
  set_user_prefix("$HOME#{static_appdir_prefix?}")
end
compile_kde_apps() click to toggle source
#

compile_kde_apps

#
# File lib/rbt/installer/misc.rb, line 6622
def compile_kde_apps
  set_compile_these_programs(
    return_kde5_applications
  )
end
compile_mate_desktop_components_into_one_standalone_directory() click to toggle source
#

compile_mate_desktop_components_into_one_standalone_directory

To invoke this method from the commandline, do:

ry --mate-desktop-into-standalone-dir
#
# File lib/rbt/installer/misc.rb, line 7963
def compile_mate_desktop_components_into_one_standalone_directory
  _ = return_mate_desktop_components
  # ======================================================================= #
  # We currently (Oct 2018) will use a hardcoded path. This may change
  # at a later point in the future.
  # ======================================================================= #
  use_this_prefix = "#{programs_dir?}Mate/1.25/"
  set_use_this_prefix(use_this_prefix)
  set_compile_these_programs(_)
end
compile_mouse_and_keyboard_xorg_server_components( array_components = %w( xf86-input-evdev xf86-input-joystick xf86-input-libinput xf86-input-synaptics xf86-input-mouse xf86-input-vmmouse xf86-input-wacom ) ) click to toggle source
#

compile_mouse_and_keyboard_xorg_server_components

The input-argument to this method defaults to the components that we wish to compile.

To compile the entries in this method, issue:

ry --compile-mouse-and-keyboard
#
# File lib/rbt/installer/misc.rb, line 13259
def compile_mouse_and_keyboard_xorg_server_components(
    array_components = %w(
      xf86-input-evdev
      xf86-input-joystick
      xf86-input-libinput
      xf86-input-synaptics
      xf86-input-mouse
      xf86-input-vmmouse
      xf86-input-wacom
    )
  )
  opne "Next compiling `#{royalblue(array_components.size.to_s)}` programs:"
  set_compile_these_programs(array_components)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
end
compile_mouse_components() click to toggle source
#

compile_mouse_components

This method will compile mouse-related components (on a linux system, aka using the xorg-server).

#
# File lib/rbt/installer/misc.rb, line 13160
def compile_mouse_components
  compile_mouse_and_keyboard_xorg_server_components(
    %w(
      xf86-input-vmmouse
      xf86-input-mouse
    )
  )
end
compile_or_install_string?() click to toggle source
#

compile_or_install_string?

#
# File lib/rbt/installer/misc.rb, line 13972
def compile_or_install_string?
  if has_to_be_compiled?
    'compiled'
  else
    'installed'
  end
end
compile_post_xorg_server_components() click to toggle source
#

compile_post_xorg_server_components

Invocation example for this method:

insta --post-xorg-server
#
# File lib/rbt/installer/misc.rb, line 14284
def compile_post_xorg_server_components
  _ = RBT.report_post_xorg_server_components
  opne "Next compiling `#{royalblue(_.size.to_s)}` programs:"
  set_compile_these_programs(_)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
end
compile_statically?()
Alias for: build_static?
compile_the_initial_lfs_toolchain() click to toggle source
#

compile_the_initial_lfs_toolchain

#
# File lib/rbt/installer/misc.rb, line 4155
  def compile_the_initial_lfs_toolchain
    ENV['PATH'] = '/tools/bin:/bin:/usr/bin'
    opne 'We will next try to install a LFS-like toolchain - aka, similar to'
    opne 'How the Linux from Scratch system is bootstrapped.'
    e
    e 'In order to do so, certain '+
      steelblue('assumptions')+' will have to be made.'
    e
    # ======================================================================= #
    # Next comes the general LFS prefix to use.
    # ======================================================================= #
    use_this_prefix    = '/home/LFS/'
    prefix_for_tools   = use_this_prefix+'tools'
    # ======================================================================= #
    # === tools_lib_path
    # ======================================================================= #
    tools_lib_path     = prefix_for_tools+'/lib'
    prefix_for_sources = use_this_prefix+'sources'
    opne 'The target directory for this boostrapped toolchain will be at:'
    e
    e "  #{steelblue(use_this_prefix)}"
    e
    mkdir(use_this_prefix)
    mkdir(prefix_for_tools)
    mkdir(prefix_for_sources)
    mkdir(tools_lib_path)
    unless File.symlink? '/tools'
      run_this_system_command_in_a_coloured_and_padded_manner("ln -sv #{prefix_for_tools} /")
    end
    # ======================================================================= #
    # === Create .bash_profile next:
    # ======================================================================= #
    this_file = File.expand_path('~/.bash_profile')
    unless File.exist? this_file
      what = <<-EOF
exec env -i HOME=$HOME TERM=$TERM PS1=' ' /bin/bash
EOF
      opne 'Next storing into the file `'+sfile(this_file)+'`.'
      write_what_into(what, this_file)
    end
    # ======================================================================= #
    # === Create .bashrc next:
    # ======================================================================= #
    this_file = File.expand_path('~/.bashrc')
    # ======================================================================= #
    # Overrule for the LFS user:
    # ======================================================================= #
    this_file = File.expand_path('/home/lfs/.bashrc')
    architecture = `uname -m`.strip
    # ======================================================================= #
    # === lfs_target_architecture
    #
    # Specify which target architecture is to be used. Oddly enough GCC
    # seems to be picky about the name chosen here.
    # ======================================================================= #
    lfs_target_architecture = "#{architecture}-pc-linux-gnu"
    unless File.exist? this_file
      what = "set +h
umask 022
LFS=#{use_this_prefix}
LC_ALL=POSIX
LFS_TGT=#{lfs_target_architecture}
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH
"
      opne 'Next storing into the file `'+sfile(this_file)+'`.'
      write_what_into(what, this_file)
    end
    # ======================================================================= #
    # Next compile binutils, first pass - see also this URL:
    #
    #   http://www.linuxfromscratch.org/lfs/view/development/chapter05/binutils-pass1.html
    #
    # ======================================================================= #
    _ = RBT::Installer.new(:binutils) { :do_not_run_yet }
    _.clear_configure_options
    _.set_prefix_to_use('/tools')
    _.do_not_store_the_compile_time
    use_these_configure_options = <<-EOF
--with-sysroot=#{use_this_prefix}
--with-lib-path=/tools/lib
--target=#{lfs_target_architecture}
--disable-nls
--disable-werror
EOF
    _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ')
    _.skip_postinstallation_step
    _.do_not_register_the_last_compiled_program
    _.run
    if is_on_64_bit?
      cd prefix_for_tools
      run_this_system_command_in_a_coloured_and_padded_manner 'ln -sv lib /tools/lib64'
    end
    # ======================================================================= #
    # Next prepare GCC
    # ======================================================================= #
    cd log_dir?
    _ = RBT::Installer.new(:gcc) { :do_not_run_yet }
    extract_what_to(
      _.cookbook_dataset_program_path?,
      _.extracted_path?
    )
    target_dir = _.extracted_path?+
                 remove_archive_from_the_end(
                   File.basename(_.cookbook_dataset_program_path?)
                 )
    opne 'Changing directory into '+sdir(target_dir)+' next.'
    cd target_dir
    path_to_mpfr = return_path_to_the_archive_of_this_program(:mpfr)
    path_to_gmp  = return_path_to_the_archive_of_this_program(:gmp)
    path_to_mpc  = return_path_to_the_archive_of_this_program(:mpc)
    extract_what_to(
      path_to_mpfr,
      return_pwd
    )
    unless File.directory? 'mpfr'
      opnn; mv remove_archive_from_the_end(File.basename(path_to_mpfr)),'mpfr'
    end
    extract_what_to(
      path_to_gmp,
      return_pwd
    )
    unless File.directory? 'gmp'
      opnn; mv remove_archive_from_the_end(File.basename(path_to_gmp)),'gmp'
    end
    extract_what_to(
      path_to_mpc,
      return_pwd
    )
    unless File.directory? 'mpc'
      opnn; mv remove_archive_from_the_end(File.basename(path_to_mpc)),'mpc'
    end
    what = <<-EOF
for file in gcc/config/{linux,i386/linux{,64}}.h
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools@g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done

EOF
    run_this_system_command_in_a_coloured_and_padded_manner(what)
    adhoc_fix_gcc
    _.clear_configure_options
    _.set_prefix_to_use(prefix_for_tools)
    _.do_not_store_the_compile_time
    use_these_configure_options = <<-EOF
--target=#{lfs_target_architecture}
--with-glibc-version=2.11
--with-sysroot=#{use_this_prefix}
--with-newlib
--without-headers
--with-local-prefix=/tools
--with-native-system-header-dir=/tools/include
--enable-languages=c,c++
--disable-nls
--disable-shared
--disable-multilib
--disable-decimal-float
--disable-threads
--disable-libatomic
--disable-libgomp
--disable-libquadmath
--disable-libssp
--disable-libvtv
--disable-libstdcxx

EOF
    _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ').squeeze(' ')
    _.skip_postinstallation_step
    _.do_not_register_the_last_compiled_program
    _.run
    # ======================================================================= #
    # Next install the linux kernel header files:
    # ======================================================================= #
    path_to_linux = return_path_to_the_archive_of_this_program(:linux)
    extract_what_to(
      path_to_linux,
      return_pwd
    )
    cd remove_archive_at_the_end(File.basename(path_to_linux))
    e 'We are in the directory '+sdir(return_pwd)+' and will '\
      'run three commands:'
    run_this_system_command_in_a_coloured_and_padded_manner 'make mrproper'
    run_this_system_command_in_a_coloured_and_padded_manner 'make headers'
    run_this_system_command_in_a_coloured_and_padded_manner 'cp -rv usr/include/* /tools/include'
    # ======================================================================= #
    # Next glibc:
    # ======================================================================= #
    cd log_dir?
    _ = RBT::Installer.new(:glibc) { :do_not_run_yet }
    extract_what_to(
      _.cookbook_dataset_program_path?,
      _.extracted_path?
    )
    target_dir = _.extracted_path?+
                 remove_archive_from_the_end(
                   File.basename(_.cookbook_dataset_program_path?)
                 )
    opne 'Changing directory into '+sdir(target_dir)+' next.'
    _.clear_configure_options
    _.set_prefix_to_use(prefix_for_tools)
    _.do_not_store_the_compile_time
    use_these_configure_options = <<-EOF
--host=#{lfs_target_architecture}
--build=$(../scripts/config.guess)
--enable-kernel=3.2
--with-headers=/tools/include
EOF
    _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ').squeeze(' ')
    _.skip_postinstallation_step
    _.do_not_register_the_last_compiled_program
    _.run
    # ======================================================================= #
    # Next install Libstdc++
    # ======================================================================= #
    cd log_dir?
    _ = RBT::Installer.new(:gcc) { :do_not_run_yet }
    extract_what_to(
      _.cookbook_dataset_program_path?,
      _.extracted_path?
    )
    target_dir = _.extracted_path?+
                 remove_archive_from_the_end(
                   File.basename(_.cookbook_dataset_program_path?)
                 )
    opne 'Changing directory into '+sdir(target_dir)+' next.'
    cd target_dir
    mkdir 'build'
    cd 'build'
    opne 'We are now in the directory '+sdir(target_dir)+'.'
    ENV['LD_CONFIG_PATH'] = tools_lib_path
    run_this_system_command_in_a_coloured_and_padded_manner "../libstdc++-v3/configure
    --host=#{lfs_target_architecture}
    --prefix=/tools
    --disable-bootstrap
    --disable-multilib
    --disable-nls
    --disable-libstdcxx-threads
    --disable-libstdcxx-pch
    --with-system-zlib
    --with-newlib
    --disable-libquadmath
    --with-gxx-include-dir=/tools/#{lfs_target_architecture}/include/c++/9.2.0".squeeze(' ').tr("\n",' ').squeeze(' ')
    # ======================================================================= #
    # This here may lead to problems - in that event, have a look at the
    # config.log file, as it should show why, for example, link tests
    # were disabled. --disable-libquadmath should help in that case,
    # by the way.
    # ======================================================================= #
    run_make_command
    run_make_install_command
  end
compile_the_main_program_including_the_dependencies() click to toggle source
#

compile_the_main_program_including_the_dependencies

#
# File lib/rbt/installer/misc.rb, line 13038
def compile_the_main_program_including_the_dependencies
  ensure_that_the_main_dataset_exists
  # ======================================================================= #
  # Prepend to this chain the known dependencies.
  # ======================================================================= #
  _ = compile_these_programs?
  _.prepend(
    required_deps_on?
  )
  _.flatten!
  set_array_compile_these_programs(_)
end
compile_the_python_addons( array = chained_programs?['python_addons'] ) click to toggle source
#

compile_the_python_addons

This method can be used to compile all the various python addons.

Invocation example:

installer --python-addons
#
# File lib/rbt/installer/misc.rb, line 11131
def compile_the_python_addons(
    array = chained_programs?['python_addons']
  )
  opne "Installing various registered python-addons (#{array.size.to_s}) next."
  set_compile_these_programs(array)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
end
compile_the_ruby_addons() click to toggle source
#

compile_the_ruby_addons

This method can be used to compile all the various ruby addons.

Invocation example:

ry --ruby-addons
#
# File lib/rbt/installer/misc.rb, line 13026
def compile_the_ruby_addons
  array = chained_programs?['ruby_addons'].reject {|entry|
    entry == 'ruby'
  }
  opne "Installing various registered ruby-addons "\
       "(#{steelblue(array.size.to_s)}) next."
  set_compile_these_programs(array, :do_not_replace)
end
Also aliased as: install_the_ruby_addons
compile_these_programs?()
compile_these_tags(i) click to toggle source
#

compile_these_tags

Invocation example:

rbt --tag_compile=science
#
# File lib/rbt/installer/misc.rb, line 3178
def compile_these_tags(i)
  opne "We will next find all programs that have the "\
       "tag `#{sfancy(i)}`."
  _ = ::RBT.return_array_of_this_tag(i) # This depends on ScanForTags.
  set_compile_these_programs(_)
end
compile_this=( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
compile_this_existing_file( i = first_argument? ) click to toggle source
#

compile_this_existing_file

This method can be used to compile an existing file.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 59
def compile_this_existing_file(
    i = first_argument?
  )
  _ = extract_to?.dup
  extract_this_source_archive(i, _)
  sanitized_first_argument = remove_archive_at_the_end(
    return_program_name_hyphen_then_program_version_or_first_argument
  )
  unless _.end_with? sanitized_first_argument
    _ << sanitized_first_argument
  end
  _ = remove_archive_from_the_end(_)
  opne "Changing directory into #{sdir(_)} next."
  cd _
  run_configure
  run_make_then_make_install
end
compile_this_program( this_program )
compile_this_program?()
compile_this_program_again()
compile_which_program?()
compile_which_programs?()
compile_xcb_components() click to toggle source
#

compile_xcb_components

To invoke this method, issue:

ry --compile-xcb-components
#
# File lib/rbt/installer/misc.rb, line 371
def compile_xcb_components
  opne "#{rev}Now compiling the various #{steelblue('xcb components')}."
  # ======================================================================= #
  # The array should be kept in the correct order - xcbutilrenderutil
  # must come before xcbutilcursor, for instance.
  # ======================================================================= #
  array = %i(
    xcbproto
    libxcb
    xcbutil
    xcbutilerrors
    xcbutilimage
    xcbutilkeysyms
    xcbutilrenderutil
    xcbutilcursor
    xcbutilwm
    xcbutilxrm
  )
  set_array_compile_these_programs(array)
end
compile_xfce_components_into_one_standalone_directory() click to toggle source
#

compile_xfce_components_into_one_standalone_directory

To invoke this method from the commandline, do:

ry --xfce-into-standalone-dir
#
# File lib/rbt/installer/misc.rb, line 9167
def compile_xfce_components_into_one_standalone_directory
  _ = return_xfce_components
  # ======================================================================= #
  # We currently (Oct 2018) will use a hardcoded path. This may change
  # at a later point in the future.
  # ======================================================================= #
  use_this_prefix = programs_dir?+'Xfce/4.16/'
  set_use_this_prefix(
    use_this_prefix
  )
  batch_compile_the_programs(_)
end
compile_xorg_libraries() click to toggle source
#

compile_xorg_libraries

Invocation example for this method:

ry --compile_xorg_libraries
#
# File lib/rbt/installer/misc.rb, line 13283
def compile_xorg_libraries
  _ = RBT.return_xorg_server_libraries
  opne "Next compiling `#{royalblue(_.size.to_s)}` programs:"
  set_compile_these_programs(_)
end
compiled_n_times?()
compiled_programs?( from_this_file = file_compiled_programs? ) click to toggle source
#

compiled_programs?

This will grab the full dataset of compiled_programs.yml

#
# File lib/rbt/installer/misc.rb, line 5041
def compiled_programs?(
    from_this_file = file_compiled_programs?
  )
  if File.exist? from_this_file
    return load_yaml(from_this_file)
  else
    opne "The file at #{sfile(from_this_file)} does not exist."
  end
end
compiled_successfully?()
compiler_to_be_used?()
Alias for: use_which_compiler?
compiler_to_use?() click to toggle source
#

compiler_to_use?

#
# File lib/rbt/installer/misc.rb, line 5158
def compiler_to_use?
  @internal_hash[:compiler_to_use]
end
config?()
Alias for: configuration?
configuration?() click to toggle source
#

configuration?

#
# File lib/rbt/installer/misc.rb, line 10491
def configuration?
  RBT.configuration?
end
Also aliased as: config?
configure_base_dir?()
configure_base_directory?() click to toggle source
#

configure_base_directory?

This should always have a trailing ‘/’ character IF it is defined. class Cookbook will make sure of that.

#
# File lib/rbt/installer/misc.rb, line 6374
def configure_base_directory?
  _ = @internal_hash[:configure_base_directory]
  if _.nil?
    _ = cookbook_dataset_configure_base_directory?
  end
  return _
end
configure_base_directory_to_use?()
configure_command?()
configure_command_to_use?() click to toggle source
#

configure_command_to_use?

#
# File lib/rbt/installer/misc.rb, line 3992
def configure_command_to_use?
  cookbook_for?.configure_command_to_use?
end
configure_has_a_higher_priority_than_meson?() click to toggle source
#

configure_has_a_higher_priority_than_meson?

This method will return true if “configure” has a higher priority than “meson”. A yaml file keeps track of these priorities.

#
# File lib/rbt/installer/misc.rb, line 13425
def configure_has_a_higher_priority_than_meson?
  ::RBT.configure_has_a_higher_priority_than_meson?
end
configure_options?() click to toggle source
#

configure_options?

This method will retrieve the configure options. We default to using the configure-options stored in the cookbook dataset, but we can overrule this on the commandline (when we store it onto the @internal_hash).

#
# File lib/rbt/installer/misc.rb, line 2641
def configure_options?
  _ = cookbook_dataset_configure_options?
  if @internal_hash[:configure_options]
    _ = @internal_hash[:configure_options]
  end
  return _
end
configure_options_or_meson_options?( i = 'configure-options:' )
configure_script?()
configure_script_exists?() click to toggle source
#

configure_script_exists?

#
# File lib/rbt/installer/misc.rb, line 5151
def configure_script_exists?
  File.exist?('configure')
end
Also aliased as: configure_script?
consider_applying_a_patch() click to toggle source
#

consider_applying_a_patch

Check whether we should apply a patch_set or not.

This should happen before we make use of preinstall, and after displaying an optional start message.

#
# File lib/rbt/installer/misc.rb, line 5448
def consider_applying_a_patch
  apply_patch = apply_patch?
  if apply_patch
    patchset = apply_patch
    patchset = [patchset] unless patchset.is_a? Array
    patchset.flatten.each {|this_patchset|
      cliner {
        this_dir = configure_base_directory?
        opne simp('Trying to ')+
             orange('apply a patch')+
             simp(' next:')+
             simp(' (in ')+
             sdir(this_dir)+
             simp(')')
        opne "  #{this_patchset}"
      }
      # =================================================================== #
      # (1) Download the patch unless it exists locally.
      # =================================================================== #
      unless File.exist? File.basename(this_patchset)
        opne 'Next trying to download '+steelblue(this_patchset)+'.'
        do_download_this_program(this_patchset)
      end
      this_command = "patch -Np1 -i #{File.basename(this_patchset)}"
      opne "Running this command next (from the directory "\
           "#{sdir(return_pwd)}):"
      e
      e "#{sfancy(this_command)}"
      e
      # =================================================================== #
      # (2) Run the patchset.
      # =================================================================== #
      custom_system(this_command) # Delegate to Kernel#system.
    }
  end
end
consider_changing_the_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? ) click to toggle source
#

consider_changing_the_tab_title (shell tag)

Use this method to change the title of a tab in a Terminal like Bash.

#
# File lib/rbt/installer/misc.rb, line 13308
def consider_changing_the_tab_title(
    i                             = return_program_name_then_hyphen_then_the_program_version,
    shall_we_rename_the_tab_title = rename_tab_title?
  )
  ::RBT.consider_changing_the_tab_title(
    i,
    shall_we_rename_the_tab_title
  )
end
consider_checking_whether_the_compiled_binaries_are_already_registered() click to toggle source
#

consider_checking_whether_the_compiled_binaries_are_already_registered

#
# File lib/rbt/installer/misc.rb, line 1421
def consider_checking_whether_the_compiled_binaries_are_already_registered
  if is_on_roebe? and # ← Only allow this on roebe-systems.
     is_app_dir? and
     has_to_be_compiled? and
     compiled_successfully? and
     !prefix?.include?('Toolchain') # Make /home/Programs/Toolchain exempt from this.
    locally_existing_executables = Dir["#{prefix?}bin/*"].map {|entry|
      File.basename(entry)
    }
    locally_existing_executables << Dir["#{prefix?}sbin/*"].map {|entry|
      File.basename(entry)
    }
    locally_existing_executables.flatten!
    locally_existing_executables.uniq!
    registered_binaries = cookbooks_binaries?
    # ===================================================================== #
    # Next compare these entries:
    # ===================================================================== #
    locally_existing_executables.each {|entry|
      if registered_binaries.include? entry
        # In this case all is fine.
      else
        compile_this_program = compile_which_program?
        # ================================================================= #
        # Else it is a not-registered binary, so report it.
        # ================================================================= #
        cliner
        opne crimson('The entry ')+steelblue(entry)+
             crimson(' is not a registered')
        opne crimson('binary for the program ')+
             royalblue(compile_this_program)+
             crimson('.')
        opne olivedrab('^^^ Consider changing this. ^^^')
        cliner
        # ================================================================= #
        # Since as of 09.12.2019 we will also store this result into a
        # log file.
        # ================================================================= #
        what = "#{entry} belongs to the program called "\
               "#{rarrow?} #{compile_this_program}"
        into = "#{log_dir?}these_binaries.yml"
        opne 'Storing '+steelblue(entry)+' into the file '+sfile(into)+
             ' as well.'
        append_what_into("#{what}#{N}", into)
      end
    }
  end
end
consider_comparing_the_installed_libraries_versus_the_assumed_libraries() click to toggle source
#

consider_comparing_the_installed_libraries_versus_the_assumed_libraries

This method will try to compare the installed libraries in an AppDir with the ones that are registered in the various cookbook .yml files.

This will happen ONLY if we are on a roebe-system; and ONLY if we use an AppDir approach.

#
# File lib/rbt/installer/misc.rb, line 1390
def consider_comparing_the_installed_libraries_versus_the_assumed_libraries
  if is_on_roebe? and is_an_appdir_installation? and
    has_been_installed_successfully?
    assumed_libraries = RBT.infer_these_libraries_will_be_installed_by(
      compile_which_program?
    )
    if assumed_libraries
      libraries?.each {|this_already_registered_library|
        # ================================================================= #
        # The variable this_already_registered_library may be something
        # like 'libgmodule-2.0.so'.
        # ================================================================= #
        if assumed_libraries.any? {|entry|
            entry.include? this_already_registered_library
          }
        else
          opne "The library "\
               "#{orange(this_already_registered_library)}"\
               " is not registered."
          opne 'Consider '+crimson('updating')+' it (file: '+
               sfile(compile_which_program?+'.yml')+
               ').'
        end
      }
    end
  end
end
consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation() click to toggle source
#

consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation

This method will create a log file that will contain the information about all environment information.

#
# File lib/rbt/installer/misc.rb, line 15723
def consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation
  base_dir_to_use = rbt_log_dir?+'log_files/'
  mkdir(base_dir_to_use) unless File.directory?(base_dir_to_use)
  # ======================================================================= #
  # We must designate where we store this information. This will be
  # stored under log_files/.
  # ======================================================================= #
  store_where = base_dir_to_use+
                'environment_information_for_the_program_'+program_name?+'.md'
  create_log_file = RBT::CreateLogFile.new {{
    clear_the_main_hash:   true,
    store_where:           store_where,
    use_environment_flags: true,
    uses_appdir_prefix:    app_dir_prefix?,
    program_name:          program_name?
  }}
  if app_dir_prefix?
    # ===================================================================== #
    # We will also store into the appdir prefix.
    # ===================================================================== #
    create_log_file.do_store_into_the_appdir(
      prefix?.to_s+'Resources/'+File.basename(store_where)
    )
  end
end
consider_creating_and_populating_the_pkgconfig_directory() click to toggle source
#

consider_creating_and_populating_the_pkgconfig_directory

#
# File lib/rbt/installer/misc.rb, line 14411
def consider_creating_and_populating_the_pkgconfig_directory
  if uses_an_appdir_prefix?
    CreateAndPopulatePkgconfigDirectory.new(appdir_prefix?)
  end
end
consider_creating_appdir_skeleton( i = return_proper_prefix )
consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install() click to toggle source
#

consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install

#
# File lib/rbt/installer/misc.rb, line 8243
def consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install
  consider_creating_appdir_skeleton
  consider_running_autoconf_then_run_configure_then_make_then_make_install
end
consider_creating_the_appdir_skeleton( i = return_proper_prefix ) click to toggle source
#

consider_creating_the_appdir_skeleton

This method will create an AppDir skeleton, by delegating towards class RBT::CreateAppDirSkeleton.

We will only do so if the prefix includes the AppDir base directory though. By default, that base directory would hold the value of the $PROGRAMS environment variable - at the least on my system, this defaults to /Programs/. You can change this value if you modify a yaml file though. That yaml file is called “programs_dir.yml” and resides in the yaml/configuration/ subdirectory of the RBT project.

The method accepts one argument, which is either the program name, or alternatively the full name to the program in question.

Normally, the program name will be defined in the yaml data object, but since you can also overrule this setting in the yaml file, we need an argument here to allow this too.

#
# File lib/rbt/installer/misc.rb, line 3412
def consider_creating_the_appdir_skeleton(
    i = return_proper_prefix
  )
  if uses_an_appdir_prefix?
    # ===================================================================== #
    # Check for an AppDir prefix next:
    # ===================================================================== #
    i = i.to_s.dup
    if i.include? programs_dir?
      unless i =~ /\d+/
        i << program_version?
      end
      i << '/' unless i.end_with? '/'
      # =================================================================== #
      # Next, delegate towards class RBT::CreateAppDirSkeleton. Since as
      # of 20.01.2020 we will specify which programs should NOT modify
      # the old symlink, for the new 'Current →' symlink. Otherwise
      # compilation would fail, e. g. if /usr/bin/make would point to
      # a not-yet compiled target prefix.
      # =================================================================== #
      _ = RBT::CreateAppDirSkeleton.new(i.dup, :dont_run_yet) {{
        use_colours: use_colours?,
        use_opn:     use_opn?,
        do_not_symlink_these_programs: %i( make gcc binutils ) # ← An exception for these programs.
      }}
      _.no_opn unless use_opn?
      _.run_simulation = run_simulation?
      # _.set_base_directory = programs_directory? # ← I think this is no longer needed.
      _.run
    end
  end
end
consider_creating_the_build_directory()
consider_displaying_the_start_message() click to toggle source
#

consider_displaying_the_start_message

#
# File lib/rbt/installer/misc.rb, line 4455
def consider_displaying_the_start_message
  _ = cookbook_dataset?.optional_start_message
  if _
    unless _.empty? 
      opne sfancy(_)
    end
  end
end
consider_enabling_python2( shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?) ) click to toggle source
#

consider_enabling_python2

This may ensure that we will use python 2.x, primarily due to the meson build system. Right now it only works on roebe-systems though.

It can also be enabled from the commandline, such as by issuing the following command:

rbt --enable-python2
#
# File lib/rbt/installer/misc.rb, line 7527
def consider_enabling_python2(
    shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?)
  )
  if shall_we_enable_python_2
    # ======================================================================= #
    # Try to use python version 3 here.
    # ======================================================================= #
    if File.directory?(programs_directory?+'Python/')
      availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry|
        File.directory? entry
      }.select {|entries_with_numbers|
        entries_with_numbers =~ /\d+/
      }.select {|entries_that_might_be_python_version_two|
        entries_that_might_be_python_version_two.include? 'Python/2'
      }
      unless availabe_python_versions.empty?
        use_this_python_version = availabe_python_versions.first
        unless RBT.const_defined? :ToCurrent
          require 'rbt/utility_scripts/to_current.rb'
        end
        RBT::ToCurrent.new(use_this_python_version)
        return true # Determine that it was a success.
      end
    end
  end
  false
end
Also aliased as: do_use_python2
consider_enabling_python3( shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?) ) click to toggle source
#

consider_enabling_python3

This may ensure that we will use python 3.x, primarily due to the meson build system. Right now it only works on roebe-systems though.

It can also be enabled from the commandline, such as by issuing the following command:

rbt --enable-python3
#
# File lib/rbt/installer/misc.rb, line 7574
def consider_enabling_python3(
    shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?)
  )
  if shall_we_enable_python_3
    # ======================================================================= #
    # Try to use python version 3 here.
    # ======================================================================= #
    if File.directory?(programs_directory?+'Python/')
      availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry|
        File.directory? entry
      }.select {|entries_with_numbers|
        entries_with_numbers =~ /\d+/
      }.select {|entries_that_might_be_python_version_three|
        entries_that_might_be_python_version_three.include? 'Python/3'
      }
      unless availabe_python_versions.empty?
        use_this_python_version = availabe_python_versions.first
        unless RBT.const_defined? :ToCurrent
          require 'rbt/utility_scripts/to_current.rb'
        end
        RBT::ToCurrent.new(use_this_python_version)
        return true # Determine that it was a success.
      end
    end
  end
  false
end
Also aliased as: do_use_python3
consider_entering_the_log_directory() click to toggle source
#

consider_entering_the_log_directory

#
# File lib/rbt/installer/misc.rb, line 9287
def consider_entering_the_log_directory
  # ======================================================================= #
  # cd into the main log directory:
  # ======================================================================= #
  if cd_into_the_rbt_log_directory?
    cd rbt_log_directory?, :be_quiet
  end
end
consider_extracting_this_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
consider_handling_build_directory() click to toggle source
#

consider_handling_build_directory

This method can create a build directory, that is, a directory which will keep other generated files and directories inside of it.

#
# File lib/rbt/installer/build_directory.rb, line 111
def consider_handling_build_directory
  if use_build_directory?
    # ===================================================================== #
    # First determine the path we ought to use for the build directory.
    #
    # This has to be a correct path since we depend on it for the
    # change_directory action lateron. Note that if the name for the
    # build directory begins with a '/' then it will be used as the
    # full build directory instead - in this case we assume that the
    # user knew what he wanted to do.
    # ===================================================================== #
    if name_for_the_build_directory?.start_with? '/'
      use_this_as_path_to_the_build_directory =
        name_for_the_build_directory?.dup
    else
      use_this_as_path_to_the_build_directory = 
        @internal_hash[:configure_base_directory]+
        name_for_the_build_directory?
    end
    # ===================================================================== #
    # Delegate towards class BuildDirectory next:
    # ===================================================================== #
    build_directory_object?.path_to_build_directory = use_this_as_path_to_the_build_directory
    # ===================================================================== #
    # Next assign it onto the @internal_hash variable:
    # ===================================================================== #
    # @internal_hash[:build_directory] = @build_directory
    set_name_for_the_build_directory(build_directory_object?.full_path?)
    build_directory_object?.silently_make_sure_that_the_build_directory_exists
    # ===================================================================== #
    # We will not cd into that directory if we use the meson-build system.
    # ===================================================================== #
    unless do_we_use_the_meson_build_system?
      opnn; @build_directory.cd :be_verbose # cd into that directory.
    end
  end
end
consider_invoking_autoconf()
consider_making_use_of_cookbook_aliases() click to toggle source
#

consider_making_use_of_cookbook_aliases

#
# File lib/rbt/installer/misc.rb, line 14392
def consider_making_use_of_cookbook_aliases
  unless make_use_of_cookbook_aliases? == :user_disabled_this_setting_via_the_commandline
    @internal_hash[:make_use_of_cookbook_aliases] = true
  end
end
consider_modifying_postinstall( i = program_version? )
consider_modifying_postinstall_with_this_prefix( i = program_version? ) click to toggle source
#

consider_modifying_postinstall_with_this_prefix

This method can be used to modify all prefix-targets in the postinstall Array.

We will only modify the program_version normally here.

#
# File lib/rbt/installer/postinstallation.rb, line 179
def consider_modifying_postinstall_with_this_prefix(
    i = program_version?
  )
  return unless i
  unless i.start_with? '/'
    i = i.dup if i.frozen?
    i.prepend('/') # A bit hackish as a workaround but this works.
  end
  # ======================================================================= #
  # The regex is also stored here:
  #
  #   https://rubular.com/r/U7J9cbbqUBPI
  #
  # ======================================================================= #
  regex_to_use = /\/(\d{1,2}\.?\d{1,2}\.?\d{0,2})/
  cookbook_dataset_postinstallation = cookbook_dataset_postinstallation?
  if cookbook_dataset_postinstallation
    set_postinstallation(
      cookbook_dataset_postinstallation.map {|line|
        # =================================================================== #
        # We must use .gsub!() here rather than .sub!() because the
        # full line may be like this:
        #
        #   ln -s /Programs/Gtk+/3.24.1/include/gtk-2.0 /Programs/Gtk+/3.24.1/include/gtk
        #
        # =================================================================== #
        line.gsub!(regex_to_use, i)
        line
      }
    )
  end
end
consider_performing_postinstallation_actions( run_postinstall_actions = run_postinstall_actions? ) click to toggle source
#

consider_performing_postinstallation_actions (postinstall tag, post tag)

Postinstall actions are optional - they are done after the “make install” step has finished.

This method here handles postinstall-related actions, like starting a service after compilation has finished, or removing a directory after installation - these sorts of actions.

A song may also be played if the configuration option tells us to do so. (This may give us an audio-cue that compilation has finished. I no longer make use of this, but if others want to, here we go)

We make use of RBT::SymlinkProgram to symlink the AppDir properly, in the event that we compile into AppDirs.

Since as of February 2019, a separate class handles these postinstallation steps.

As a summary and an overview, these are valid postinstall actions:

- Running cleanup actions
- Renaming a shell (optional)
- Playing a song (when the configuration option told us to do so)
- Symlinking files after installation
- Copying several files to another location
- Deleting any .la files if the user specified so (this is
  now the default; RBT::Installer will always try to remove
  .la files under an AppDir prefix, unless the user has
  specified otherwise)
#
# File lib/rbt/installer/postinstallation.rb, line 103
def consider_performing_postinstallation_actions(
    run_postinstall_actions = run_postinstall_actions?
  )
  # ======================================================================= #
  # Only run these actions if we actually do run postinstall actions:
  # ======================================================================= #
  if run_postinstall_actions and can_we_continue?
    # ===================================================================== #
    # Next delegate towards class RBT::PostinstallationStep.
    # ===================================================================== #
    RBT::PostinstallationStep.new(
      return_hash_for_the_postinstallation_step
    ) {{ use_opn: use_opn? }}
  end
end
Also aliased as: do_postinstall_actions
consider_removing_empty_subdirectories( prefix = prefix?.to_s ) click to toggle source
#

consider_removing_empty_subdirectories

We will remove empty subdirectories but only from AppDir-like prefixes.

#
# File lib/rbt/installer/misc.rb, line 278
def consider_removing_empty_subdirectories(
    prefix = prefix?.to_s # ← This will be like "/Programs/Gcide/0.52/".
  )
  if uses_an_appdir_prefix?
    subdirectories = Dir[prefix+'*'].select {|entry|
      File.directory?(entry) and Dir.empty?(entry)
    }
    # ===================================================================== #
    # Since as of December 2022 we will remove only some empty
    # subdirectories.
    # ===================================================================== #
    subdirectories.select! {|entry|
      RBT::SymlinkFromToCurrent::ARRAY_ALLOWED_SUBDIRECTORIES.include?(
        File.basename(entry)
      )
    }
    remove_directories(
      subdirectories
    )
    consider_removing_the_current_symlink_if_the_directory_is_empty
    consider_removing_the_settings_directory_if_it_is_empty
    consider_removing_the_empty_versioned_directory
    consider_removing_the_empty_base_directory_of_the_program
  end
end
consider_removing_extracted_archive( where = :build_anew )
consider_removing_the_empty_base_directory_of_the_program() click to toggle source
#

consider_removing_the_empty_base_directory_of_the_program

#
# File lib/rbt/installer/misc.rb, line 1630
def consider_removing_the_empty_base_directory_of_the_program
  if uses_an_appdir_prefix? and !is_a_gem_file?
    target = rds(
      programs_dir?+program_name?.capitalize.delete('-_')+'/'
    )
    if File.directory?(target) and
       Dir.empty?(target)
      opne tomato('Removing')+' the empty directory at `'+sdir(target)+'` next.'
      remove_this_directory(target)
    end
  end
end
consider_removing_the_empty_versioned_directory() click to toggle source
#

consider_removing_the_empty_versioned_directory

#
# File lib/rbt/installer/misc.rb, line 8213
def consider_removing_the_empty_versioned_directory
  if uses_an_appdir_prefix?
    prefix = prefix?.to_s
    if File.directory?(prefix) and
      Dir.empty?(prefix)
      remove_this_directory(prefix)
    end
  end
end
consider_removing_the_extracted_archive()
consider_removing_the_extracted_directory( where = :build_anew )
consider_removing_the_old_extracted_directory_if_it_exists( i = remove_archive_stuff_from_the_end(will_be_extracted_towards?) ) click to toggle source
#

consider_removing_the_old_extracted_directory_if_it_exists

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 40
def consider_removing_the_old_extracted_directory_if_it_exists(
    i = remove_archive_stuff_from_the_end(will_be_extracted_towards?)
  )
  if File.directory?(i) and i.include?(log_dir?)
    if i == log_dir?
      opne 'Can not remove '+sdir(i)+'.'
    else
      opne steelblue('Removing')+rev+
           ' the extracted directory at '+sdir(i)+' next.'
      remove_directory(i)
    end
  end
end
consider_removing_the_settings_directory_if_it_is_empty() click to toggle source
#

consider_removing_the_settings_directory_if_it_is_empty

This method will attempt to remove the /Settings subdirectory, if it is empty.

#
# File lib/rbt/installer/misc.rb, line 8199
def consider_removing_the_settings_directory_if_it_is_empty
  if uses_an_appdir_prefix?
    prefix = prefix?.to_s
    settings_directory = File.dirname(prefix)+'/Settings'
    if File.directory?(settings_directory) and
       Dir.empty?(settings_directory)
      remove_this_directory(settings_directory)
    end
  end
end
consider_renaming_the_kde_konsole_tab( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? )
consider_reporting_the_cflags_we_will_use() click to toggle source
#

consider_reporting_the_cflags_we_will_use

Notify the user which CFLAGS he is using.

#
# File lib/rbt/installer/misc.rb, line 9038
def consider_reporting_the_cflags_we_will_use
  _ = cflags?
  unless _.empty?
    opne "The #{steelblue('CFLAGS')} in use are:"
    e
    e "  #{simp(_)}"
    e
  end
end
consider_reporting_the_time_it_took_to_compile_this_program() click to toggle source
#

consider_reporting_the_time_it_took_to_compile_this_program

#
# File lib/rbt/installer/misc.rb, line 12288
def consider_reporting_the_time_it_took_to_compile_this_program
  if time_the_compilation? and no_error_has_occurred?
    program_name = compile_which_program?.to_s # Keep a reference.
    _ = @internal_hash[:array_time_compilation]
    # ===================================================================== #
    # We need the start-time and the end-time, in order to calculate
    # the difference.
    # ===================================================================== #
    start_time = @internal_hash[:array_time_compilation][-2]
    end_time   = @internal_hash[:array_time_compilation][-1]
    # ===================================================================== #
    # We must next check that both end time and start time exist, as
    # otherwise we would run into an error.
    # ===================================================================== #
    if start_time and end_time
      duration   = (end_time - start_time)
      rounded_duration = duration.round(3)
      in_minutes = (rounded_duration.to_f / 60.0).round(2)
      if has_to_be_compiled?
        compiling_or_installing = 'Compiling'
      else
        compiling_or_installing = 'Installing'
      end
      # =================================================================== #
      # Notify the user how long it took to compile/install the given
      # program at hand.
      # =================================================================== #
      opne "#{compiling_or_installing} the program `"\
           "#{olivedrab(program_name)}"\
           "` took #{sfancy(rounded_duration.to_s)} seconds "\
           "(aka #{sfancy(in_minutes)} minutes)."
      # =================================================================== #
      # Also store this now into a file.
      # =================================================================== #
      _ = RBT.file_storing_the_time_it_took_to_compile_programs
      if File.exist? _
        dataset = YAML.load_file(_)
      else
        dataset = {} # Use a Hash format.
      end
      dataset[program_name] = rounded_duration
      opne 'Also storing this information into the file'
      opne "  #{sfile(_)}"
      write_what_into(YAML.dump(dataset), _)
    else
      opne 'Can not store the time as the variable tracking the time'
      opne 'is incorrect. It will be displayed next, to aid in debugging:'
      e
      pp @internal_hash[:array_time_compilation][-1]
      e
    end
  end
end
consider_running_autoconf_then_run_configure_then_make_then_make_install() click to toggle source
#

consider_running_autoconf_then_run_configure_then_make_then_make_install

#
# File lib/rbt/installer/misc.rb, line 5976
def consider_running_autoconf_then_run_configure_then_make_then_make_install
  consider_running_the_pre_configure_steps
  decide_whether_to_invoke_the_autoconf_command
  run_configure_then_make_then_make_install
end
consider_running_cleanup_actions( prefix = prefix?.to_s )
consider_running_ldconfig()
consider_running_premake_instructions( array = cookbook_dataset_pre_make_commands? )
consider_running_the_pre_configure_steps() click to toggle source
#

consider_running_the_pre_configure_steps

This method will perform the pre-configure steps, if they were given at all that is.

#
# File lib/rbt/installer/misc.rb, line 6258
def consider_running_the_pre_configure_steps
  _ = pre_configure_steps?
  unless _.empty?
    _.each {|entry|
      e steelblue('Running the following command next, '\
        'as a pre-configure step')
      e peru(' (in the directory ')+
        sdir(return_pwd)+
        peru(')')+
        steelblue(':')
      e
      e mediumseagreen("  #{entry}")
      system entry
      e
    }
  end
end
consider_sanitizing_the_program_path() click to toggle source
#

consider_sanitizing_the_program_path

This method will only be used when @internal_hash has been set.

#
# File lib/rbt/installer/misc.rb, line 1537
def consider_sanitizing_the_program_path
  if @internal_hash[:use_this_specific_program_version]
    # ===================================================================== #
    # The above variable is nil by default, so if it has another value
    # we can use this.
    # ===================================================================== #
    splitted    = @internal_hash[:use_this_specific_program_version].split('/')
    last        = splitted.last # ← This will hold the new program version.
    old_value   = cookbook_dataset_program_path?.dup
    old_version = program_information_return_version(old_value)
    set_cookbook_dataset_program_version(
      last
    )
    old_value.sub!(/#{old_version}/, last)
    set_cookbook_dataset_program(
      remove_extension(
        File.basename(old_value)
      )
    )
    set_cookbook_dataset_program_path(old_value)
  end
end
consider_showing_the_flexbox() click to toggle source
#

consider_showing_the_flexbox

#
# File lib/rbt/installer/misc.rb, line 12096
def consider_showing_the_flexbox
  show_flexbox if show_flexbox?
end
Also aliased as: do_show_the_infobox
consider_storing_a_snapshot() click to toggle source
#

consider_storing_a_snapshot

This method may store the compilation time into an Array.

#
# File lib/rbt/installer/misc.rb, line 12347
def consider_storing_a_snapshot
  if @internal_hash[:time_compilation]
    @internal_hash[:array_time_compilation] << Time.now
  end
end
consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy() click to toggle source
#

consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy

Invoke this method if we wish to symlink the schema files into the /usr/ hierarchy.

#
# File lib/rbt/installer/misc.rb, line 3783
def consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy
  if uses_appdir_prefix? and
     use_glib_schema? and
    !an_error_has_occurred?
    # ===================================================================== #
    # Delegate towards class SymlinGlibSchema eventually:
    # ===================================================================== #
    symlink_glib_schema
  end
end
consider_symlinking_pkgconfig_files()
consider_symlinking_the_pkgconfig_files() click to toggle source
#

consider_symlinking_the_pkgconfig_files

If the cookbook has symlinking_pkgconfig_files set to true, and if the program is compiled, as AppDir, then we will symlink .pc files into /usr/lib/pkgconfig/, if the latter one exists.

#
# File lib/rbt/installer/misc.rb, line 11876
def consider_symlinking_the_pkgconfig_files
  target_dir = '/usr/lib/pkgconfig/'
  if symlink_pkgconfig_files? and
     is_appdir_compilation_style? and
     File.directory?(target_dir) and
     !do_not_symlink?
    appdir_target_with_pc_files = "#{return_appdir_prefix}lib/pkgconfig/"
    # ===================================================================== #
    # Delegate towards class SymlinkPkgconfigFiles next.
    # ===================================================================== #
    SymlinkPkgconfigFiles.new(appdir_target_with_pc_files)
  end
end
consider_to_run_ldconfig() click to toggle source
#

consider_to_run_ldconfig (ldconfig tag)

Run ‘ldconfig’ here in this method.

Check whether we are allowed to invoke this method before calling it however.

#
# File lib/rbt/installer/misc.rb, line 12185
def consider_to_run_ldconfig
  return if are_we_on_windows?
  if continue_after_make_step? # Makes only sense if we are past the make-step.
    # ===================================================================== #
    # ruby and python add-ons normally do not require ldconfig,
    # so we don't have to invoke it.
    # ===================================================================== #
    if tags?.include?('ruby') or
       tags?.include?('python')
      do_not_run_ldconfig
    end
    # ===================================================================== #
    # Only run it if the config-file tells us to do so and only for
    # those programs that have to be compiled.
    #
    # class RBT::Installer will, however had, NOT run ldconfig when the
    # program has failed to install - that is specifically if an
    # error has occurred.
    # ===================================================================== #
    if run_ldconfig? and
       has_to_be_compiled? and
       can_we_continue? and
      !a_problem_has_occurred? and # Also check for no problem.
      !an_error_has_occurred?
      # =================================================================== #
      # Build up the command to run next.
      # =================================================================== #
      cmd_to_run = 'ldconfig'.dup
      # =================================================================== #
      # We could be verbose, but it is not that useful, so uncomment it.
      # cmd_to_run << ' -v'
      # =================================================================== #
      # Since as of July 2011, we will be quieter and ignore whether
      # ldconfig exists or not.
      # =================================================================== #
      cmd_to_run << " #{SHELL_ERROR_CODE}"
      # =================================================================== #
      # Check for superuser privilege next. ldconfig requires the
      # superuser.
      # =================================================================== #
      if is_superuser?
        opne "Now running `#{sfancy(cmd_to_run)}`." # We output the ldconfig command variant here.
        system cmd_to_run
      else
        opne "You are not the superuser so we will not "\
             "try to run `#{sfancy(cmd_to_run)}`."
      end
    end
  end
end
Also aliased as: consider_running_ldconfig
consider_uploading_binaries( upload_binaries = upload_binaries? ) click to toggle source
#

consider_uploading_binaries

This method can be used to upload some binaries.

Invocation example:

ry htop uploadbinaries
#
# File lib/rbt/installer/misc.rb, line 12379
def consider_uploading_binaries(
    upload_binaries = upload_binaries?
  )
  if upload_binaries
    opne 'We will next upload any files found in the bin/ subdirectory.'
    _ = "#{dataset?.prefix}bin/"
    files = Dir["#{_}*"]
    if files.empty?
      opne "No files were found in #{sdir(_)}."
    else
      upload_to(
        files, :default, 'bin'
      )
    end
  end
end
consider_using_maximum_speed_for_compilation() click to toggle source
#

consider_using_maximum_speed_for_compilation

This method also has to check whether we will compile the given program at all or whether we will not.

#
# File lib/rbt/installer/misc.rb, line 13100
def consider_using_maximum_speed_for_compilation
  if use_maximum_speed_for_compilation? and
     the_program_has_to_be_compiled? and
     can_we_continue?
    opne "The configuration file "\
         "#{sfile('use_maximum_speed_for_compilation.yml')}"\
         " specified"
    opne 'that maximum speed should be used for compilation.'
    opne "This means to pass the #{orange('-j')} option "\
         "to the program #{slateblue('make')},"
    opne 'with the number of processors this computer '\
         'has ('+steelblue(this_computer_has_how_many_processors?.to_s)+').'
    speed_up_the_compilation
  end
end
consider_using_this_file_for_the_configure_options_that_are_to_be_used( this_file ) click to toggle source
#

consider_using_this_file_for_the_configure_options_that_are_to_be_used

The argument to this method should be the file that contains the configure-options.

#
# File lib/rbt/installer/misc.rb, line 8672
def consider_using_this_file_for_the_configure_options_that_are_to_be_used(
    this_file
  )
  if File.exist? this_file
    opne 'Making use of the file '+sfile(this_file)+' for configure-options.'
    dataset = File.read(this_file).strip.tr("\n", ' ').squeeze(' ')
    opne 'The options are:'
    e
    e sfancy("  #{dataset}")
    e
    clear_configure_options
    @internal_hash[:configure_options] = dataset
  else
    opnn; no_file_exists_at(this_file)
  end
end
considering_creating_the_build_directory( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY ) click to toggle source
#

considering_creating_the_build_directory

#
# File lib/rbt/installer/build_directory.rb, line 187
def considering_creating_the_build_directory(
    i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
  )
  create_the_build_directory(i) if use_build_directory?
end
considering_running_make_command_via_system()
Alias for: run_make
considering_running_make_install_command_via_system()
Alias for: run_make_install
considering_setting_any_special_environment_variable( be_verbose = true ) click to toggle source
#

considering_setting_any_special_environment_variable

This is the method that will be used to determine whether we have to set any special environment variable.

#
# File lib/rbt/installer/misc.rb, line 3464
def considering_setting_any_special_environment_variable(
    be_verbose = true
  )
  _ = set_env_variables?
  if _ and !extract_only? # If we only extract something, then we don't need to do the rest.
    if be_verbose
      opne "Making use of these #{aliceblue('special environment variables')}:"
      e # And an elegant extra line, as of July 2021.
    end
    set_these_env_variables(
      _, :do_set_these_variables, :be_verbose
    )
  end
end
continue_after_make_step?() click to toggle source
#

continue_after_make_step?

#
# File lib/rbt/installer/misc.rb, line 3263
def continue_after_make_step?
  @internal_hash[:continue_after_make_step]
end
convert_to_non_traditional(i = program?) click to toggle source
#

convert_to_non_traditional

Use this method to convert a program to non-traditional (Gobolinux style) again.

#
# File lib/rbt/installer/misc.rb, line 5886
def convert_to_non_traditional(i = program?)
  RBT::ConvertToNonTraditional.new(i)
end
convert_to_traditional( i = compile_which_program? ) click to toggle source
#

convert_to_traditional

Convert to traditional format via this method here.

Invoke this by doing something like:

ry php ctotrad
#
# File lib/rbt/installer/misc.rb, line 9818
def convert_to_traditional(
    i = compile_which_program?
  )
  RBT::ConvertToTraditional.new(i) # bl ConvertToTraditional
end
cookbook?()
Alias for: cookbook_for?
cookbook_build_system?()
cookbook_dataset()
Alias for: cookbook_for?
cookbook_dataset?()
Alias for: cookbook_for?
cookbook_dataset_apply_patch?() click to toggle source
#

cookbook_dataset_apply_patch?

#
# File lib/rbt/installer/misc.rb, line 2598
def cookbook_dataset_apply_patch?
  cookbook_dataset?.apply_patch?
end
Also aliased as: apply_patch?
cookbook_dataset_base_dir?() click to toggle source
#

cookbook_dataset_base_dir?

#
# File lib/rbt/installer/misc.rb, line 14191
def cookbook_dataset_base_dir?
  cookbook_dataset?.base_dir?
end
cookbook_dataset_build_static?() click to toggle source
#

cookbook_dataset_build_static?

#
# File lib/rbt/installer/misc.rb, line 2968
def cookbook_dataset_build_static?
  cookbook_dataset?.build_static?
end
cookbook_dataset_cmake_configure_options?() click to toggle source
#

cookbook_dataset_cmake_configure_options?

This method will return all options used for the “cmake” build system of the program at hand, should cmake be used at all.

If GNU configure is used then this method will not be used.

#
# File lib/rbt/installer/misc.rb, line 14184
def cookbook_dataset_cmake_configure_options?
  cookbook_dataset?.cmake_configure_options?
end
Also aliased as: cmake_configure_options?
cookbook_dataset_configure_base_dir?()
cookbook_dataset_configure_base_directory?() click to toggle source
#

cookbook_dataset_configure_base_directory?

We ask the cookbook-dataset object for the configure base directory.

Most programs will NOT have such a setting.

#
# File lib/rbt/installer/misc.rb, line 5144
def cookbook_dataset_configure_base_directory?
  cookbook_dataset?.configure_base_directory?
end
cookbook_dataset_configure_command?() click to toggle source
#

cookbook_dataset_configure_command?

Most programs may use GNU autoconfigure, and thus “configure”, but a few programs such as openssl, require another program name, such as “/config”. This method here will query whether the given program needs such a name. If this is the case then this will be used as name rather than the alternative name “configure”.

#
# File lib/rbt/installer/misc.rb, line 5122
def cookbook_dataset_configure_command?
  cookbook_dataset?.configure_command
end
Also aliased as: configure_command?
cookbook_dataset_configure_options?()
cookbook_dataset_flatpak_url?() click to toggle source
#

cookbook_dataset_flatpak_url?

#
# File lib/rbt/installer/misc.rb, line 7171
def cookbook_dataset_flatpak_url?
  cookbook_for?.flatpak_url
end
Also aliased as: flatpak_url?, flatpak?
cookbook_dataset_has_been_initialized?() click to toggle source
#

cookbook_dataset_has_been_initialized?

#
# File lib/rbt/installer/misc.rb, line 10793
def cookbook_dataset_has_been_initialized?
  !@internal_hash[:cookbook_for].nil?
end
cookbook_dataset_has_to_be_compiled?()
cookbook_dataset_headers?() click to toggle source
#

cookbook_dataset_headers?

#
# File lib/rbt/installer/misc.rb, line 14005
def cookbook_dataset_headers?
  cookbook_for?.headers?
end
Also aliased as: headers?
cookbook_dataset_ignore_errors?() click to toggle source
#

cookbook_dataset_ignore_errors?

#
# File lib/rbt/installer/misc.rb, line 174
def cookbook_dataset_ignore_errors?
  cookbook_for? and cookbook_for?.ignore_errors?
end
cookbook_dataset_keep_extracted?() click to toggle source
#

cookbook_dataset_keep_extracted?

This method simply wraps over the cookbook_dataset keep_extracted value.

#
# File lib/rbt/installer/misc.rb, line 14070
def cookbook_dataset_keep_extracted?
  cookbook_for?.keep_extracted?
end
Also aliased as: dataset_keep_extracted?
cookbook_dataset_libraries?() click to toggle source
#

cookbook_dataset_libraries?

#
# File lib/rbt/installer/misc.rb, line 2612
def cookbook_dataset_libraries?
  cookbook_dataset?.libraries?
end
Also aliased as: libraries?
cookbook_dataset_make_command?() click to toggle source
#

cookbook_dataset_make_command?

#
# File lib/rbt/installer/misc.rb, line 2605
def cookbook_dataset_make_command?
  cookbook_dataset?.use_which_make_command?
end
cookbook_dataset_make_options?()
cookbook_dataset_manual_steps?() click to toggle source
#

cookbook_dataset_manual_steps?

#
# File lib/rbt/installer/misc.rb, line 14198
def cookbook_dataset_manual_steps?
  cookbook_dataset?.manual_steps?
end
cookbook_dataset_meson_configure_options?() click to toggle source
#

cookbook_dataset_meson_configure_options?

This method will return all options used for the “meson” build system of the program at hand, should meson be used at all.

#
# File lib/rbt/installer/misc.rb, line 14045
def cookbook_dataset_meson_configure_options?
  cookbook_for?.meson_configure_options?
end
Also aliased as: meson_configure_options?
cookbook_dataset_parameters_to_make?() click to toggle source
#

cookbook_dataset_parameters_to_make?

#
# File lib/rbt/installer/misc.rb, line 14098
def cookbook_dataset_parameters_to_make?
  cookbook_for?.parameters_to_make?
end
cookbook_dataset_path?()
cookbook_dataset_postinstall?( cookbook_for = cookbook_for? ) click to toggle source
#

cookbook_dataset_postinstall?

Query from the cookbook-yaml file at hand whether we will run a postinstall-step or not.

#
# File lib/rbt/installer/postinstallation.rb, line 19
def cookbook_dataset_postinstall?(
    cookbook_for = cookbook_for?
  )
  cookbook_for and cookbook_for.postinstall?
end
cookbook_dataset_postinstallation?( cookbook_for = cookbook_for? )
cookbook_dataset_pre_make_commands?() click to toggle source
#

cookbook_dataset_pre_make_commands?

The premake options are the ones that are run before “make” is invoked.

#
# File lib/rbt/installer/misc.rb, line 2629
def cookbook_dataset_pre_make_commands?
  cookbook_dataset?.pre_make_commands?
end
cookbook_dataset_prefix?() click to toggle source
#

cookbook_dataset_prefix?

This method name may be a slight misnomer, since class Prefix may handle the prefix here.

#
# File lib/rbt/installer/misc.rb, line 5102
def cookbook_dataset_prefix?
  if cookbook_dataset?
    cookbook_dataset?.prefix?
  else
    nil
  end
end
cookbook_dataset_preinstall?() click to toggle source
#

cookbook_dataset_preinstall?

#
# File lib/rbt/installer/misc.rb, line 4686
def cookbook_dataset_preinstall?
  cookbook_for?.preinstall?
end
Also aliased as: preinstall?
cookbook_dataset_program_has_to_be_compiled?() click to toggle source
#

cookbook_dataset_program_has_to_be_compiled?

#
# File lib/rbt/installer/misc.rb, line 7085
def cookbook_dataset_program_has_to_be_compiled?
  cookbooks_for? and cookbooks_for?.has_to_be_compiled?
end
cookbook_dataset_program_name?() click to toggle source
#

cookbook_dataset_program_name?

#
# File lib/rbt/installer/misc.rb, line 3826
def cookbook_dataset_program_name?
  cookbook_for?.program_name? # Delegate to cookbook_for? here.
end
cookbook_dataset_program_name_and_program_version( cookbook_for = cookbook_for? )
cookbook_dataset_program_name_and_program_version?( cookbook_for = cookbook_for? )
cookbook_dataset_program_path?() click to toggle source
#

cookbook_dataset_program_path?

#
# File lib/rbt/installer/misc.rb, line 5086
def cookbook_dataset_program_path?
  if cookbook_dataset?
    cookbook_dataset?.program_path
  end
end
cookbook_dataset_program_version?()
cookbook_dataset_real_program_name?()
cookbook_dataset_run_configure?() click to toggle source
#

cookbook_dataset_run_configure?

The program “manpages” is an example for a program that does not need to run configure.

#
# File lib/rbt/installer/misc.rb, line 7235
def cookbook_dataset_run_configure?
  cookbook_for?.run_configure?
end
cookbook_dataset_run_configure_script?()
cookbook_dataset_run_make?() click to toggle source
#

cookbook_dataset_run_make?

#
# File lib/rbt/installer/misc.rb, line 2619
def cookbook_dataset_run_make?
  cookbook_dataset?.run_make?
end
cookbook_dataset_set_configure_command(i) click to toggle source
#

cookbook_dataset_set_configure_command

#
# File lib/rbt/installer/misc.rb, line 11266
def cookbook_dataset_set_configure_command(i)
  case i
  when :meson
    i = i.to_s
  end
  cookbook_for?.set_configure_command_to_use(i)
end
Also aliased as: set_configure_command
cookbook_dataset_set_program_name(i) click to toggle source
#

cookbook_dataset_set_program_name

#
# File lib/rbt/installer/misc.rb, line 14084
def cookbook_dataset_set_program_name(i)
  cookbook_for?.set_program_name(i)
end
cookbook_dataset_set_program_version(i) click to toggle source
#

cookbook_dataset_set_program_version

#
# File lib/rbt/installer/misc.rb, line 14077
def cookbook_dataset_set_program_version(i)
  cookbook_for?.set_program_version(i)
end
cookbook_dataset_set_this_archive(i) click to toggle source
#

cookbook_dataset_set_this_archive

#
# File lib/rbt/installer/misc.rb, line 8861
def cookbook_dataset_set_this_archive(i)
  cookbook_dataset?.set_this_archive(i)
end
cookbook_dataset_short_name?() click to toggle source
#

cookbook_dataset_short_name?

#
# File lib/rbt/installer/misc.rb, line 13368
def cookbook_dataset_short_name?
  cookbook_for?.short_name?.to_s
end
Also aliased as: short_name?
cookbook_dataset_use_autogen?() click to toggle source
#

cookbook_dataset_use_autogen?

Query-method over as to the cookbook-dataset has an entry called use_autogen set to true.

#
# File lib/rbt/installer/misc.rb, line 3985
def cookbook_dataset_use_autogen?
  cookbook_for?.use_autogen?
end
cookbook_dataset_use_build_directory?() click to toggle source
#

cookbook_dataset_use_build_directory?

#
# File lib/rbt/installer/misc.rb, line 4640
def cookbook_dataset_use_build_directory?
  cookbook_for?.use_build_directory?
end
cookbook_dataset_use_this_build_system?() click to toggle source
#

cookbook_dataset_use_this_build_system?

Query which build-system is to be used. This will determine how we will install a given program at hand.

#
# File lib/rbt/installer/misc.rb, line 600
def cookbook_dataset_use_this_build_system?
  cookbook_for?.use_which_build_system?
end
cookbook_dataset_use_this_make_command?() click to toggle source
#

cookbook_dataset_use_this_make_command?

#
# File lib/rbt/installer/misc.rb, line 3811
def cookbook_dataset_use_this_make_command?
  cookbook_for?.use_this_make_command?
end
cookbook_for?() click to toggle source
#

cookbook_for? (dataset tag)

Keep this query method on top of this file here, ideally.

This method can be used whenever we wish to query the main data structure of the target program at hand.

The dataset variable will typically be an instance of class RBT::Cookbooks::SanitizeCookbook.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 872
def cookbook_for?
  @internal_hash[:cookbook_for]
end
cookbook_installation_steps?() click to toggle source
#

cookbook_installation_steps?

The installation-steps contain the instructions in how to install a given program at hand.

#
# File lib/rbt/installer/misc.rb, line 14150
def cookbook_installation_steps?
  cookbook_for?.installation_steps?
end
Also aliased as: installation_steps?
cookbook_prefix?()
cookbook_program_path?()
Also aliased as: program_path?
cookbook_program_version?() click to toggle source
#

cookbook_program_version?

#
# File lib/rbt/installer/misc.rb, line 10800
def cookbook_program_version?
  cookbook_for? and cookbook_for?.program_version?
end
cookbook_use_autoconf?() click to toggle source
#

cookbook_use_autoconf?

#
# File lib/rbt/installer/misc.rb, line 9512
def cookbook_use_autoconf?
  cookbook_for?.use_autoconf?
end
cookbooks_archive_type?()
Alias for: archive_type?
cookbooks_binaries?() click to toggle source
#

cookbooks_binaries?

#
# File lib/rbt/installer/misc.rb, line 14035
def cookbooks_binaries?
  cookbooks_dataset?.binaries?
end
Also aliased as: binaries?
cookbooks_dataset?()
Alias for: cookbook_for?
cookbooks_dataset_configure_options?() click to toggle source
#

cookbooks_dataset_configure_options?

#
# File lib/rbt/installer/misc.rb, line 5214
def cookbooks_dataset_configure_options?
  cookbook_for?.configure_options?
end
cookbooks_dataset_extracted_towards?() click to toggle source
#

cookbooks_dataset_extracted_towards?

#
# File lib/rbt/installer/misc.rb, line 14157
def cookbooks_dataset_extracted_towards?
  if cookbooks_dataset?
    cookbooks_dataset?.extracted_towards?
  else
    rbt_log_directory?
  end
end
cookbooks_dataset_use_glib_schema?() click to toggle source
#

cookbooks_dataset_use_glib_schema?

Whether our dataset uses glib install schema for some .xml files.

#
# File lib/rbt/installer/misc.rb, line 7263
def cookbooks_dataset_use_glib_schema?
  cookbook_for?.use_glib_schema
end
Also aliased as: use_glib_schema?
cookbooks_for?()
Alias for: cookbook_for?
cookbooks_prefix?()
cookbooks_program_name?( cookbook_for = cookbook_for? )
cookbooks_program_path?()
cookbookset_dataset_use_which_build_system?()
copy_expanded_cookbooks()
copy_expanded_directory() click to toggle source
#

copy_expanded_directory

This method will copy the expanded cookbooks directory.

Invocation example:

rbt --copy-expanded-directory
#
# File lib/rbt/installer/misc.rb, line 132
def copy_expanded_directory
  source_directory = "#{project_yaml_dir?}expanded_cookbooks/"
  # ======================================================================= #
  # Designate the target directory to be used.
  # ======================================================================= #
  target_directory = expanded_cookbooks? # This will be e. g. '/home/Temp/rbt/expanded_cookbooks/'.
  if File.directory? source_directory
    opne 'Now copying from '+sdir(source_directory)
    opne "onto #{sdir(target_directory)}."
    mkdir(target_directory) unless File.directory? target_directory
    Dir[source_directory+'*.yml'].each {|this_yaml_file|
      opnn; copy_file(this_yaml_file, target_directory) { :be_verbose }
    }
  else
    opne "No directory exists at `#{sdir(source_directory)}`."
  end
end
Also aliased as: copy_expanded_cookbooks
copy_headers_from(i) click to toggle source
#

copy_headers_from

This method will copy the registered headers from the given program at hand.

The first argument to this method is the path to the header files.

Invocation examples:

ry glibc --copy-headers-from=/usr/include
ry glibc --copy-headers-to-pwd
#
# File lib/rbt/installer/misc.rb, line 4912
def copy_headers_from(i)
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  to = return_pwd 
  headers = headers?
  unless headers.empty?
    headers.each {|this_header|
      from = "#{i}#{this_header}"
      if this_header.include? '/'
        # ================================================================= #
        # In this case we must create such a subdirectory.
        # ================================================================= #
        dirname = File.dirname(this_header)
        unless File.directory? File.dirname(dirname)
          mkdir(dirname)
        end
      end
      e 'Now trying to copy `'+sfile(from)+'` to `'+
        sfile(to+this_header)+'`.'
      copy_file(from, to+this_header)
    }
  end
end
copy_ruby() click to toggle source
#

copy_ruby

#
# File lib/rbt/installer/misc.rb, line 12072
def copy_ruby
  begin
    require 'roebe/toplevel_methods/setup.rb'
    Roebe.copy_setup_file_to_pwd
  rescue LoadError
    opne 'The method '+steelblue('Roebe.copy_setup_file_to_pwd()')+
         ' is not available.'
    opne "Please install the #{slateblue('roebe')} project:"
    e
    e '  gem install roebe'
    e
  end
end
copy_source_archive_of_this_program_into_the_current_directory(i) click to toggle source
#

copy_source_archive_of_this_program_into_the_current_directory

This method can be used to copy the source archive of the given input program at hand, into the current working directory.

Invocation examples:

ry --copy-source=php
ry --copy-source=ruby
#
# File lib/rbt/installer/misc.rb, line 10767
def copy_source_archive_of_this_program_into_the_current_directory(i)
  _ = load_yaml_dataset_for_this_program(i)
  stored_where = _.program_path?
  opne "#{steelblue('=>')} Copying "\
       "#{sfile(stored_where)} to "\
       "#{sdir(return_pwd)}#{mediumpurple(File.basename(stored_where))}"
  copy_file(stored_where, return_pwd)
end
Also aliased as: copy_source
copy_these_archives( i = :kde5_plasma ) click to toggle source
#

copy_these_archives

This method will copy the selected applications into the current working directory.

To invoke this method from the commandline, try:

rbt --copy-archives=kde5_plasma
rbt --copy-archives=ruby
#
# File lib/rbt/installer/misc.rb, line 4950
def copy_these_archives(
    i = :kde5_plasma
  )
  if i.is_a? String
    i = i.split(',') if i.include? ','
  end
  case i
  when :kde5_plasma, 'kde5_plasma'
    i = return_kde_plasma_components
  end
  i = [i].flatten.compact.reject {|entry| entry.strip.empty? }.map {|entry|
    try_to_find_an_alias_to_this_input_unless_the_program_exists(entry)
  }
  if i.empty?
    opne 'Please provide at the least one argument - the '\
         'directory that is to be copied.'
  else
    opne "Now copying #{i.size.to_s} entries into the local "\
         "working directory:"
    i.each {|this_program|
      target_directory = source_dir?+this_program.downcase+'/'
      if File.directory? target_directory
        copy_directory(target_directory, :be_verbose)
      else
        opne "No directory exists at `#{sdir(target_directory)}`."
      end
    }
  end
end
copy_this_yaml_file( i = compile_which_program?, be_verbose = be_verbose? ) click to toggle source
#

copy_this_yaml_file

#
# File lib/rbt/installer/misc.rb, line 3210
def copy_this_yaml_file(
    i          = compile_which_program?,
    be_verbose = be_verbose?
  )
  if is_registered? i
    opne "#{rev}Now copying the .yml file for #{steelblue(i)}"
    opne "into the current working directory."
    target_file = cookbook_directory?+i+'.yml'
    if File.exist? target_file
      opnn; copy_file(target_file) { :be_verbose }
    end
  else
    opne "Not a registered program: #{i}"
  end
end
create_a_new_cookbook_instance( i = install_this_program?, simple_or_complex = simple_or_complex? )
create_a_slackdesc_file_for_this_program(i) click to toggle source
#

create_a_slackdesc_file_for_this_program

#
# File lib/rbt/installer/misc.rb, line 4467
def create_a_slackdesc_file_for_this_program(i)
  require 'rbt/linux/slackware/generate_slack_desc_file.rb'
  RBT::Linux::Slackware::GenerateSlackDescFile.new(i)
end
create_app_skeleton( i = return_proper_prefix )
create_appdir_skeleton( i = return_proper_prefix )
create_appdir_skeleton?() click to toggle source
#

create_appdir_skeleton?

#
# File lib/rbt/installer/misc.rb, line 5000
def create_appdir_skeleton?
  @internal_hash[:create_appdir_skeleton]
end
create_build_directory_then_cd_into_it( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, &block )
create_dependencies_file( create_where = rbt_log_directory? ) click to toggle source
#

create_dependencies_file

This method will create a Gobolinux dependencies file.

To invoke it, do something like:

ry htop create_dependencies_file
#
# File lib/rbt/installer/misc.rb, line 14769
def create_dependencies_file(
    create_where = rbt_log_directory?
  )
  _ = RBT::Linux::Gobolinux::CreateDependenciesFile.new(
        create_where, 
        required_deps_on?,
        :dont_run_yet
      )
  _.allow_creation_of_resources
  _.run # Finally, run.
end
create_description_file(create_where) click to toggle source
#

create_description_file

Creates a Description file, for use in Gobolinux systems.

#
# File lib/rbt/installer/misc.rb, line 8004
def create_description_file(create_where)
  if create_where.include? programs_directory?
    create_where = create_where.delete('-')
  end
  file_location = create_where+'Resources/Description'
  remove_file(file_location) if File.exist? file_location # Remove it if it already exists.
  append_what_into(
    dataset?.description?,
    file_location
  )
end
create_gobolinux_recipe_for(i = compile_which_program?)
create_log_directory() click to toggle source
#

create_log_directory

#
# File lib/rbt/installer/misc.rb, line 4522
def create_log_directory
  action(:create_log_directory)
end
create_program_skeleton( i = return_proper_prefix )
create_programs_url_file() click to toggle source
#

create_programs_url_file

#
# File lib/rbt/installer/misc.rb, line 13194
def create_programs_url_file
  action(__method__.to_sym)
end
create_shell_scripts() click to toggle source
#

create_shell_scripts (bash tag bashrc tag)

This method will convert the yaml dataset to bash scripts, so that the bash shell can make use this information as well.

To invoke this method, do something such as this:

ry --bash

To get the array content do this (after sourcing the file):

echo ${programs[*]}
#

cat /System/Settings/bash_programs_rc

#

cd /System/Settings/

#
# File lib/rbt/installer/misc.rb, line 11110
def create_shell_scripts
  RBT::CreateBashScripts.new # bl $RBT/create_bash_scripts.rb
end
Also aliased as: to_bash
create_shellscript( program = compile_which_program?, save_into_a_file = true, display_result = false ) click to toggle source
#

create_shellscript (shell tag, script tag)

This is a wrapper over the class GenerateShellscript.

It will return a string, which contains all the information to create a specific shell script.

The first argument to this method is the name of the program in question.

To invoke this method, do:

ry htop create_shellscript
ry php cshell
#
# File lib/rbt/installer/misc.rb, line 12822
def create_shellscript(
    program          = compile_which_program?,
    save_into_a_file = true,
    display_result   = false
  )
  _ = GenerateShellscript.new(
    program,
    save_into_a_file,
    display_result
  )
  return _.string?
end
create_slackware_description_file( i = compile_which_program? )
create_standalone_yaml_file() click to toggle source
#

create_standalone_yaml_file

This will create standalone yaml files.

Usage example:

ry htop --csyf
#
# File lib/rbt/installer/misc.rb, line 7696
def create_standalone_yaml_file
  require 'rbt/cookbooks/create_cookbook_yaml_file/create_cookbook_yaml_file.rb'
  cliner {
    opne 'Dumping all available recipes next.'
  }
  store_here = RBT.configuration?.recipes_directory
  all_programs.each { |this_program|
    e sfancy("This program is: `")+simp(this_program)+sfancy('`.')
    initialize_cookbook_dataset_for(this_program)
    _ = RBT::Cookbooks::CreateCookbookYamlFile.new(this_program, :do_not_run_yet)
    _.store_where(store_here)
    _.run
  }
  cliner {
    opne sfancy('Finished dumping all Recipes into ')+
         sdir(store_here)
    opne "#{N}There were: #{sfancy(all_programs.size.to_s)} of them.#{N}"
  }
end
create_the_build_directory( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY ) click to toggle source
#

create_the_build_directory

#
# File lib/rbt/installer/build_directory.rb, line 178
def create_the_build_directory(
    i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
  )
  mkdir i
end
create_the_build_directory_then_cd_into_it( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY ) { || ... } click to toggle source
#

create_the_build_directory_then_cd_into_it

Note that we will only cd into the directory if we actually use a build directory.

#
# File lib/rbt/installer/build_directory.rb, line 199
def create_the_build_directory_then_cd_into_it(
    i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY,
    &block
  )
  if use_build_directory?
    # ===================================================================== #
    # === Handle blocks next
    # ===================================================================== #
    if block_given?
      yielded = yield
      case yielded
      # =================================================================== #
      # === :be_verbose
      # =================================================================== #
      when :be_verbose
        opne "Changing directory into "\
             "#{sdir(absolute_path(i))} "\
             "next,"
        opne "thus honouring the #{steelblue('use-build-directory')} "\
             "setting."
      end
    end
    create_the_build_directory
    cd i
  end
end
create_yaml_file_for_this_program( i = compile_which_program? ) click to toggle source
#

create_yaml_file_for_this_program

#
# File lib/rbt/installer/misc.rb, line 4889
def create_yaml_file_for_this_program(
    i = compile_which_program?
  )
  require 'rbt/utility_scripts/expand_cookbooks.rb'
  e
  opnn; RBT.expand_this_cookbook(i)
  e
end
Also aliased as: expand_this_cookbook
custom_system( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
data?()
Alias for: cookbook_for?
dataset()
Alias for: cookbook_for?
dataset?()
Alias for: cookbook_for?
dataset_from_the_file_cookbook_chained_programs?() click to toggle source
#

dataset_from_the_file_cookbook_chained_programs?

This query-method obtains the dataset from the yaml file containing all chained-programs.

The alias-name .chained_programs?() makes accessing this information even simpler.

#
# File lib/rbt/installer/misc.rb, line 2591
def dataset_from_the_file_cookbook_chained_programs?
  @internal_hash[:dataset_from_the_file_cookbook_chained_programs]
end
Also aliased as: chained_programs?
dataset_keep_extracted?()
dataset_object?()
Alias for: cookbook_for?
dataset_prefix?()
dataset_program_name?()
dataset_program_name_and_program_version?( cookbook_for = cookbook_for? ) click to toggle source
#

dataset_program_name_and_program_version?

This method will always return the program name and the associated program version of any given program, such as:

"htop-2.0.2"
#
# File lib/rbt/installer/misc.rb, line 14130
def dataset_program_name_and_program_version?(
    cookbook_for = cookbook_for?
  )
  if cookbook_for
    cookbook_for.program_name_and_program_version? # Delegate to cookbook_for? here.
  else
    nil
  end
end
dataset_program_short_name?() click to toggle source
#

dataset_program_short_name?

The short name would be “gnomemusic” if the regular name is “gnome-music”.

#
# File lib/rbt/installer/misc.rb, line 7273
def dataset_program_short_name?
  cookbook_for?.short_name?
end
decide_whether_to_build_statically() click to toggle source
#

decide_whether_to_build_statically

#
# File lib/rbt/installer/misc.rb, line 9948
def decide_whether_to_build_statically
  if build_static?
    append_static_onto_the_cflags
  end
end
decide_whether_to_invoke_autoconf_command()
decide_whether_to_invoke_autogen( _ = FILE_AUTOGEN ) click to toggle source
#

decide_whether_to_invoke_autogen

Invoke autogen.sh if specified so, and only if the file autogen.sh actually exists.

There may be some situations where it does not make sense to invoke autogen, such as when the build type specifically tells us to use meson.

#
# File lib/rbt/installer/misc.rb, line 13664
def decide_whether_to_invoke_autogen(
    _ = FILE_AUTOGEN
  )
  if use_autogen?
    if uses_the_meson_build_system?
      opne crimson('The value for autogen is set to ')+
           royalblue('true')+
           crimson(', meaning "do use autogen".')
      opne crimson('The .yml file specifies to use the meson-build system, though.')
      opne crimson('Autogen is only useful for GNU configure based system, so')
      opne crimson('autogen is set to false for this run - thus, not making '\
                   'use of autogen.')
      e
      opne crimson('If you need autogen, consider changing '\
           'the information in the')
      opne crimson('.yml file ')+
           sfile("#{compile_which_program?}.yml")+
           crimson('.')
      e
      opne 'Do note that this behaviour may be changed at a later time.'
      disable_autogen
    end
    if File.exist?(_)
      do_use_autogen # This is the do-action that invokes autogen.sh
    end
  end
end
decide_whether_to_invoke_the_autoconf_command() click to toggle source
#

decide_whether_to_invoke_the_autoconf_command

Whether to run “autoconf” or whether we will not. Only very few programs will need this.

Note that the invocation of autoconf must happen AFTER the pre-installation step has finished, and after checking whether sed must be used or whether sed is not needed. Afterwards, we can then check whether we will use a build directory, and whether we must use another prefix.

A program that may require this is “bridgeutils”.

Invocation example:

ry bridgeutils
#
# File lib/rbt/installer/misc.rb, line 10080
def decide_whether_to_invoke_the_autoconf_command
  if use_autoconf?
    do_invoke_autoconf
  end
end
default_cflags?()
Alias for: cflags?
default_download_then_exit(i = :default) click to toggle source
#

default_download_then_exit

#
# File lib/rbt/installer/misc.rb, line 10830
def default_download_then_exit(i = :default)
  download_program(:def, true, i) # Download here. Overrule settings.
  exit_program # Then exit.
end
default_extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
default_extract_step( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false )
Alias for: invoke_extracter
delete(this_key) click to toggle source
#

delete

This method is similar to the method .delete() for class Hash. The method here will only return the value, though, and NOT delete anything - while this behaviour is, strictly speaking, not the same as for class Hash, there does not seem to be a big reason as to why the information should be deleted from an instance of class RBT::Installer.

In other words: .delete() here is mostly a compatibility method, in order to “fake-simulate” behaviour that a Hash would normally show.

#
# File lib/rbt/installer/misc.rb, line 8569
def delete(this_key)
  case this_key
  # ======================================================================= #
  # === :prefix
  # ======================================================================= #
  when :prefix
    prefix?.to_s
  # ======================================================================= #
  # === :program_version
  # ======================================================================= #
  when :program_version
    program_version?.to_s
  # ======================================================================= #
  # === :description
  #
  # This is actually a pointer towards the short description, since
  # it is used primarily for autogenerating pkgconfig files.
  # ======================================================================= #
  when :description
    short_description?.to_s
  end
end
delete_libtool_files?() click to toggle source
#

delete_libtool_files?

Query whether we will delete .la files or whether we will not. If we will not, then any installed .la files will be removed.

Note that this will ONLY be honoured if compilation was a success AND we use an AppDir path as prefix - so .la files that are installed under /usr/lib/ will not be removed, ever.

#
# File lib/rbt/installer/misc.rb, line 6472
def delete_libtool_files?
  if @internal_hash[:keep_la_files]
    !@internal_hash[:keep_la_files]
  else
    RBT.configuration?.delete_libtool_files
  end
end
depends_on_cmake?() click to toggle source
#

depends_on_cmake?

#
# File lib/rbt/installer/misc.rb, line 13549
def depends_on_cmake?
  RBT.depends_on_cmake?(required_deps_on?)
end
Also aliased as: program_uses_cmake?
depends_on_ninja?() click to toggle source
#

depends_on_ninja?

#
# File lib/rbt/installer/misc.rb, line 5287
def depends_on_ninja?
  ::RBT.depends_on_ninja?(required_deps_on?)
end
depends_on_python?() click to toggle source
#

depends_on_python?

Whether python is registered as a dependency.

#
# File lib/rbt/installer/misc.rb, line 7504
def depends_on_python?
  RBT.depends_on_python?(required_deps_on?)
end
depends_on_waf?() click to toggle source
#

depends_on_waf?

#
# File lib/rbt/installer/misc.rb, line 7511
def depends_on_waf?
  ::RBT.depends_on_waf?
end
deregistering_from_the_status_file() click to toggle source
#

deregistering_from_the_status_file

De-register the program that we are currently compiling from the status file again.

#
# File lib/rbt/installer/misc.rb, line 13884
def deregistering_from_the_status_file
  into = RBT.file_status
  dataset = {}
  if File.exist? into
    dataset.merge!(YAML.load_file(into))
  end
  if dataset.has_key? 'currently_compiling_these_programs'
    _ = dataset['currently_compiling_these_programs']
    if _.include? compile_which_program?
      dataset['currently_compiling_these_programs'] = dataset['currently_compiling_these_programs'].reject {|line|
        line == compile_which_program?
      }
      what = YAML.dump(dataset)
      write_what_into(what, into)
    end
  end
end
description?() click to toggle source
#

description?

#
# File lib/rbt/installer/misc.rb, line 4733
def description?
  cookbook_for?.description?
end
determine_cookbook_dataset_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
determine_prefix_from_the_cookbook_dataset()
determine_program_full_name() click to toggle source
#

determine_program_full_name

#
# File lib/rbt/installer/misc.rb, line 8884
def determine_program_full_name
  cookbook_dataset?.determine_program_full_name
end
determine_program_name_and_program_version() click to toggle source
#

determine_program_name_and_program_version

#
# File lib/rbt/installer/misc.rb, line 14091
def determine_program_name_and_program_version
  cookbook_for?.send(__method__)
end
determine_the_build_system_in_use_and_consider_syncing_this_back_onto_the_cookbook_dataset() click to toggle source
#

determine_the_build_system_in_use_and_consider_syncing_this_back_onto_the_cookbook_dataset

#
# File lib/rbt/installer/misc.rb, line 8984
def determine_the_build_system_in_use_and_consider_syncing_this_back_onto_the_cookbook_dataset
  _ = build_system?
  case _
  # ======================================================================= #
  # === :infer_automatically
  # ======================================================================= #
  when :infer_automatically
    _ = RBT.infer_build_system
  end
  cookbook_for?.set_build_system(_)
end
determine_the_configure_base_directory_to_use( target = extract_to_this_dir?.dup+ yaml_dataset?.program_name_and_program_version?+ '/'+ cookbook_dataset_configure_base_directory?.to_s ) click to toggle source
#

determine_the_configure_base_directory_to_use

This method can be used to determine the full path to the configure base directory to be used.

#
# File lib/rbt/installer/misc.rb, line 11757
def determine_the_configure_base_directory_to_use(
    target = extract_to_this_dir?.dup+
             yaml_dataset?.program_name_and_program_version?+
             '/'+
             cookbook_dataset_configure_base_directory?.to_s
  )
  set_configure_base_directory(target)
end
determine_the_dataset_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
determine_the_program_path() click to toggle source
#

determine_the_program_path

This method will determine the (internal) program path that is to be used, that is - the path to finding the program on the local harddisc.

A word about the variable use_this_as_short_name:

Since as of September 2019 we will also remove ‘.’ characters, so that programs such as “ruamel.yaml” can reside in a directory called “ruamelyaml”.

#
# File lib/rbt/installer/misc.rb, line 8261
def determine_the_program_path
  use_this_as_short_name = yaml_dataset?.program_short_name?.dup.downcase.
                           delete('-.')
  use_this_as_short_name.delete!('_')
  value = source_directory?+
          use_this_as_short_name+
          '/'+
          yaml_dataset?.program_name_and_program_version?+
          yaml_dataset?.archive_type?
  set_program_path(value)
end
determine_which_compiler_will_be_used() click to toggle source
#

determine_which_compiler_will_be_used

This method currently will only check if the clang-compiler is used.

#
# File lib/rbt/installer/misc.rb, line 7357
def determine_which_compiler_will_be_used
  case use_which_compiler?
  when 'clang'
    do_use_clang_compiler(:be_quiet)
  end
end
determine_which_programs_to_compile( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
did_we_encounter_an_error?()
dir?()
directory_rbt_profiles?() click to toggle source
#

directory_rbt_profiles?

This will point to a location such as “/home/Programs/Ruby/2.6.5/lib/ruby/site_ruby/2.6.0/rbt/misc/profiles/”

#
# File lib/rbt/installer/misc.rb, line 14272
def directory_rbt_profiles?
  DIRECTORY_RBT_PROFILES
end
disable_autogen( be_verbose = true ) click to toggle source
#

disable_autogen

#
# File lib/rbt/installer/misc.rb, line 13695
def disable_autogen(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not make use of autogen.'
  end
  @internal_hash[:use_autogen] = false # Enable the use of autogen in our dataset here.
end
disable_ccache() click to toggle source
#

disable_ccache

Use this method to temporarily disable ccache, that is - for the current run. If you do not want to use ccache at all, simply set the content of the corresponding .yml file to false.

#
# File lib/rbt/installer/misc.rb, line 12165
def disable_ccache
  @internal_hash[:use_ccache] = false
end
disable_colours( be_verbose = true ) click to toggle source
#

disable_colours (colours tag)

Disable colours with this method. This will not be permanent, it will be valid only for the running instance (this object). If you want to permanently disable colours, use:

rbt_config --disable-colours

To use this specific method here, do something like this:

ry htop disablecolours

Remember that you can chain together instructions, so:

ry htop disablecolours ntrad

Would compile in an appdir-like fashion, without using any colours.

#
# File lib/rbt/installer/misc.rb, line 13238
def disable_colours(
    be_verbose = true
  )
  RBT.disable_colours  # ← Defined in rbt/colours/colours.rb
  disable_colours # This one is defined in base.rb.
  if be_verbose
    opne 'We will not use any colours.'
  end
end
Also aliased as: no_colours
disable_internal_sed() click to toggle source
#

disable_internal_sed

#
# File lib/rbt/installer/misc.rb, line 11443
def disable_internal_sed
  @internal_hash[:use_the_internal_sed_wrapper] = false
end
disable_logging( be_verbose = true ) click to toggle source
#

disable_logging

We no longer log here.

#
# File lib/rbt/installer/misc.rb, line 9799
def disable_logging(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not log.'
  end
  @internal_hash[:may_we_log] = false
end
disable_md5sum_calculation() click to toggle source
#

disable_md5sum_calculation

This method here can be used to disable the md5sum calculation altogether.

Invocation example:

ry htop --no-md5sum
#
# File lib/rbt/installer/misc.rb, line 3364
def disable_md5sum_calculation
  opne 'We will not calculate the md5sum of an archive. This '\
       'should speed up'
  opne 'things a little bit, in particular for very large files.'
  RBT::Cookbooks::SanitizeCookbook.disable_md5sum_calculation # Cookbooks::Cookbook must provide this method.
end
disable_opn() click to toggle source
#

disable_opn

Use this method to stop reporting any program names.

To trigger this, try one of these usage examples:

ry php noopn
ry htop nonames
#
# File lib/rbt/installer/misc.rb, line 4556
def disable_opn
  e 'We will not use Opn (class name output, aka output-program-name)'
  RBT.do_not_show_the_classname
  @internal_hash[:use_opn] = false
end
disable_porg() click to toggle source
#

disable_porg

Disable porg via this method.

#
# File lib/rbt/installer/misc.rb, line 15853
def disable_porg
  @internal_hash[:use_porg] = config?.use_porg = false
end
disable_static_compilation( be_verbose = :be_verbose ) click to toggle source
#

disable_static_compilation

Use this method to disable static compilation.

#
# File lib/rbt/installer/misc.rb, line 2920
def disable_static_compilation(
    be_verbose = :be_verbose
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  when :do_not_be_verbose
    be_verbose = false
  end
  if be_verbose
    opne 'Disabling static compilation.'
  end
  @internal_hash[:build_static] = false
  if cflags?.include? '-static'
    set_cflags(cflags?.dup.sub(/-static/,''))
  end
end
Also aliased as: do_not_compile_statically
disable_stow() click to toggle source
#

disable_stow

#
# File lib/rbt/installer/misc.rb, line 8055
def disable_stow
  configuration?.use_stow = false
  opne 'Disabling stow next.'
  configuration?.save
end
disallow_changing_the_cookbook_dataset() click to toggle source
#

disallow_changing_the_cookbook_dataset

#
# File lib/rbt/installer/misc.rb, line 10786
def disallow_changing_the_cookbook_dataset
  cookbook_for?.freeze
end
display_postinstall_dataset() click to toggle source
#

display_postinstall_dataset

This method will display the postinstall actions that will be done for the given program at hand.

Invocation examples:

ry perl p?
ry docbookxsl --display_postinstall
ry libraw1394 --postinstallation_steps?
ry bash --postinstallation_steps?
ry vte --postinstallation_steps?
ry lighttpd --postinstallation_steps?
#
# File lib/rbt/installer/postinstallation.rb, line 48
def display_postinstall_dataset
  result = cookbook_dataset_postinstall?
  compile_this_program = compile_which_program?
  compile_this_program = first_argument? if compile_this_program.nil?
  ensure_proper_dataset_for(compile_this_program) if result.nil?
  result = cookbook_dataset_postinstall? if result.nil?
  unless result.empty?
    opne "The postinstall instructions for `#{royalblue(program?)}` are:"
    result = [result].flatten.compact # ← We need an Array past this point.
    e
    result.each {|entry|
      # e
      e "  #{yellowgreen(entry)}" # Display with a slight padding.
      # e
    }
    e
    opne 'Also assigning the above result to the xorg buffer.'
    set_xorg_buffer(result.join(N))
  end if result
end
display_standard_help_options( exit_now = true ) click to toggle source
#

display_standard_help_options (help tag)

#
# File lib/rbt/installer/misc.rb, line 6433
def display_standard_help_options(
    exit_now = true
  )
  RBT::Install.display_standard_help_options(exit_now)
end
display_the_oldest_programs() click to toggle source
#

display_the_oldest_programs

This method will report, on the commandline, the oldest programs.

#
# File lib/rbt/installer/misc.rb, line 12861
def display_the_oldest_programs
  require 'rbt/cookbooks/show_last_updated.rb'
  RBT::Cookbooks::ShowLastUpdated.new('--sort-by-oldest')
end
do_binary_upload_of_this_file(this_file) click to toggle source
#

do_binary_upload_of_this_file

#
# File lib/rbt/installer/misc.rb, line 5684
def do_binary_upload_of_this_file(this_file)
  _ = this_file
  if File.exist? _
    FtpParadise.upload_this_binary_file(_, :be_verbose)
  else
    e "No file at `#{sfile(_)}` exists."
  end
end
do_check_for_binary_duplicates() click to toggle source
#

do_check_for_binary_duplicates

If you wish to check for binary-duplicates under /usr/bin/, then this method may be helpful to you.

#
# File lib/rbt/installer/misc.rb, line 8383
def do_check_for_binary_duplicates
  target_dir = :default
  # ======================================================================= #
  # The next line of code handles the situation when we are in the
  # directory /usr/sbin/, and when we are on a roebe-system (aka at home).
  # ======================================================================= #
  if is_on_roebe? and (return_pwd == '/usr/sbin/')
    target_dir = '/usr/sbin/'
  end
  array = RBT.array_binary_duplicates(:default, target_dir)
  if array.empty?
    target_dir = '/usr/bin/' if target_dir == :default
    opne "No duplicates appear to exist under the "\
         "#{sdir(target_dir)} hierarchy."
  else
    opne 'The following duplicates were found:'
    e
    array.each {|entry|
      e "  #{sfile(entry.ljust(40))}"
    }
  end
end
do_compile_all_available_local_version( i = compile_which_program? )
do_compile_all_available_local_version_of_this_program( i = compile_which_program? ) click to toggle source
#

do_compile_all_available_local_version_of_this_program

Invocation example:

ry libsigc++ --compile-all-available-local-versions
#
# File lib/rbt/installer/misc.rb, line 6883
def do_compile_all_available_local_version_of_this_program(
    i = compile_which_program?
  )
  opne "Checking for the locally available versions "\
       "of the program #{sfancy(i)} next."
  target_directory = source_dir?+
                     i.downcase+'/'
  e
  opne "We will check at the directory `#{sdir(target_directory)}`."
  e
  matches = Dir[target_directory+'*']
  if matches.empty?
    opne 'No result was found at the directory `'+sdir(target_directory)+'`.'
    opne 'This usually indicates that the '\
         'directory does not exist - or is empty.'
  else
    matches.each {|entry|
      opne 'Working on the entry `'+sfancy(entry)+'` next.'
      entry = remove_archive_at_the_end(entry)
      basename = File.basename(entry)
      program_name    = program_information_return_program_name(basename)
      program_version = program_information_return_version(basename)
      reset
      set_compile_this_program(program_name)
      initialize_dataset_for_this_program(program_name)
      set_program_version(program_version)
      do_compile_this_program(program_name) { :do_not_initialize_the_dataset }
    }
  end
end
do_compile_all_of_mate() click to toggle source
#

do_compile_all_of_mate

#
# File lib/rbt/installer/misc.rb, line 13129
def do_compile_all_of_mate
  i = RBT.returned_chained_programs_of_the_mate_desktop
  opne "We will compile all #{sfancy(i.size.to_s)} programs "\
       "of the mate-desktop."
  set_compile_these_programs(i)
end
do_compile_in_a_non_traditional_way( program_name_and_program_version = program_name_and_program_version?, be_verbose = true ) click to toggle source
#

do_compile_in_a_non_traditional_way

We enable Gobolinux-style compilation here, as in AppDir-like compilation.

#
# File lib/rbt/installer/misc.rb, line 15388
def do_compile_in_a_non_traditional_way(
    program_name_and_program_version = program_name_and_program_version?,
    be_verbose                       = true
  )
  if can_we_continue?
    case program_name_and_program_version
    when :be_silent,
         :be_quiet
      be_verbose = false
      program_name_and_program_version = program_name_and_program_version?
    end
    case be_verbose
    when :be_silent,
         :be_quiet
      be_verbose = false
    end
    if be_verbose
      opne 'Overruling any potential traditional setting.'
    end
    @internal_hash[:counter_called_traditional_or_non_traditional_compilation] += 1
    # ensure_that_a_cookbook_object_has_been_instantiated
    set_user_prefix(:ntrad)
    opne "Enabling #{steelblue('AppDir prefix')}."
    # enable_non_traditional_compilation(
    #   program_name_and_program_version
    # )
  end
end
Also aliased as: enable_non_traditional_compilation, set_standalone_compilation, compile_as_appdir, ntrad, use_non_traditional_prefix, do_run_via_nontraditional_way, do_use_an_appdir_prefix
do_compile_in_a_traditional_way( be_verbose = true, can_we_continue = can_we_continue? ) click to toggle source
#

do_compile_in_a_traditional_way

Use this method when you want to use ‘/usr/’ as the main prefix of compilation.

Usage example:

ry php --trad
#
# File lib/rbt/installer/misc.rb, line 14252
def do_compile_in_a_traditional_way(
    be_verbose      = true,
    can_we_continue = can_we_continue?
  )
  if can_we_continue
    @internal_hash[:we_tried_to_compile_this_program_n_times] += 1
    if be_verbose
      opne 'Using a "'+sfancy(:traditional)+'" strategy for compilation '\
           '(which means prefix '+sdir('/usr/')+').'
    end
    set_user_prefix '/usr/' # Specify a user-prefix here.
  end
end
do_compile_in_both_traditional_and_non_traditional_manner() click to toggle source
#

do_compile_in_both_traditional_and_non_traditional_manner

This method combines both main strategies for compilation - first, into the /usr/ prefix, and then into the appdir prefix.

#
# File lib/rbt/installer/misc.rb, line 13578
def do_compile_in_both_traditional_and_non_traditional_manner
  opne 'We will first compile in the traditional way, and then after that'
  opne 'we will compile in the non-traditional (appdir) way.'
  do_compile_in_a_traditional_way # First, compile in a traditional way.
  @internal_hash[:extra_compilation] = true
end
do_compile_libstdc_plus_plus() click to toggle source
#

do_compile_libstdc_plus_plus

This method will compile/install libstdc++, which is part of GCC.

To invoke this method try:

ry --install-libstdc++
#
# File lib/rbt/installer/misc.rb, line 8620
def do_compile_libstdc_plus_plus
  set_compile_these_programs :gcc
  opne steelblue('libstdc++')+', from GCC, will be installed next.'
  opne royalblue('1')+') The GCC-archive of GCC will be extracted first.'
  dataset = return_dataset_for_this_program(compile_which_program?)
  path = dataset.path?
  gcc_version = dataset.program_version?
  if File.exist? path
    opne 'Extracting '+sfile(path)+' to '+sdir(log_dir?)+'.'
    extract_what_to(path, log_dir?)
    # ===================================================================== #
    # cd into the right target:
    # ===================================================================== #
    target = log_dir?+cookbook_dataset_program_name_and_program_version?+'/libstdc++-v3/'
    opne royalblue('2')+') cd to the target directory at '+sdir(target)+' next.'
    cd(target)
    opne royalblue('3')+') create the build directory, then cd into it next.'
    mkdir 'BUILD_DIRECTORY'
    cd 'BUILD_DIRECTORY'
    opne royalblue('4')+') Running configure, then "make", then "make install" next.'
    # ===================================================================== #
    # Find out the prefix that we wish to use (required for a cd-action
    # lateron.
    # ===================================================================== #
    use_this_prefix = rds(
      programs_dir?+'Libstdc++/'+gcc_version+'/'
    )
    cmd = (
      '../configure '\
      '--prefix='+use_this_prefix+'
      --disable-multilib 
      --disable-nls 
      --disable-libstdcxx-threads 
      --disable-libstdcxx-pch'
    ).squeeze(' ').gsub(/\n/,' ').squeeze(' ')
    e
    e steelblue(cmd)
    e
    run_this_system_command_in_a_coloured_and_padded_manner(cmd)
    run_make_then_make_install
    RBT.to_current(use_this_prefix)
    cd use_this_prefix
    rnsymc
  end
end
do_compile_the_perl_addons() click to toggle source
#

do_compile_the_perl_addons

#
# File lib/rbt/installer/misc.rb, line 13119
def do_compile_the_perl_addons
  array = chained_programs?['perl_addons'].reject {|entry| entry == 'perl' }
  opne "Installing various registered perl-addons (#{array.size}) next."
  set_compile_these_programs(array)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
end
do_compile_these_programs()
do_compile_this_program( this_program )
do_create_a_slackware_package( i = return_pwd ) click to toggle source
#

do_create_a_slackware_package

#
# File lib/rbt/installer/misc.rb, line 11849
def do_create_a_slackware_package(
    i = return_pwd
  )
  require 'rbt/linux/slackware/create_slackware_package.rb'
  this_program = File.basename(i)
  if this_program.include? '-'
    this_program = program_information_return_name(this_program)
  end
  RBT::CreateSlackwarePackage.new(this_program) { :do_not_autoinstall }
end
do_create_this_appdir_skeleton(i) click to toggle source
#

do_create_this_appdir_skeleton

#
# File lib/rbt/installer/misc.rb, line 3451
def do_create_this_appdir_skeleton(i)
  RBT::CreateAppDirSkeleton.new(i.dup) {{
    use_colours: use_colours?,
    use_opn:     use_opn?
  }}
end
Also aliased as: rcp
do_download(i)
do_download_this_program(i) click to toggle source
#

do_download_this_program (download tag)

This is simply a plain wget wrapper.

#
# File lib/rbt/installer/misc.rb, line 15808
def do_download_this_program(i)
  run_this_system_command_in_a_coloured_and_padded_manner("wget #{i}")
end
do_enable_static_compilation() click to toggle source
#

do_enable_static_compilation

Enable static compilations.

#
# File lib/rbt/installer/misc.rb, line 2943
def do_enable_static_compilation
  @internal_hash[:build_static] = true
end
Also aliased as: enable_static?
do_exit_before_make() click to toggle source
#

do_exit_before_make

#
# File lib/rbt/installer/misc.rb, line 10914
def do_exit_before_make
  @internal_hash[:exit_before_make] = true
end
do_exit_before_make_install() click to toggle source
#

do_exit_before_make_install

#
# File lib/rbt/installer/misc.rb, line 10921
def do_exit_before_make_install
  @internal_hash[:exit_before_make_install] = true
end
do_expand_the_cookbooks() click to toggle source
#

do_expand_the_cookbooks

#
# File lib/rbt/installer/misc.rb, line 1506
def do_expand_the_cookbooks
  ::RBT.expand_cookbooks(:all_of_them)
end
do_extensively_report_the_build_statistics() click to toggle source
#

do_extensively_report_the_build_statistics

#
# File lib/rbt/installer/misc.rb, line 15088
def do_extensively_report_the_build_statistics
  report_the_compile_strategies
  unless RBT.respond_to? :show_how_many_files_are_tracked
    require 'rbt/statistics/show_how_many_files_are_tracked.rb'
  end
  # ======================================================================= #
  # Since as of July 2020 we will also show how many files are tracked.
  # ======================================================================= #
  RBT.show_how_many_files_are_tracked
end
do_extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
do_extract_the_archive( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false )
Alias for: invoke_extracter
do_guess_the_build_type()
Alias for: guess_build_type
do_ignore_errors() click to toggle source
#

do_ignore_errors

#
# File lib/rbt/installer/misc.rb, line 9299
def do_ignore_errors
  @internal_hash[:ignore_errors] = true
end
Also aliased as: do_ignore_the_errors
do_ignore_the_errors()
Alias for: do_ignore_errors
do_include_clang_for_the_llvm_compilation() click to toggle source
#

do_include_clang_for_the_llvm_compilation

Here we have to do four steps in particular - extract two programs into the extracted directory of LLVM.

The code below is not very elegant and quite hackish; I simply wanted to finish this on the same day as I had this idea, which was on 09.09.2020. At a later point this should be cleaned up.

Invocation examples:

ry llvm --include-clang-for-compilation
ry llvm --compile-clang
#
# File lib/rbt/installer/misc.rb, line 8937
def do_include_clang_for_the_llvm_compilation
  # ======================================================================= #
  # First, we must extract LLVM.
  # ======================================================================= #
  initialize_dataset_for(:llvm)
  extracted_to = extract(cookbook_dataset_program_path?)+
                 cookbook_dataset_program_name_and_program_version?
  cd extracted_to # cd into that directory.
  initialize_dataset_for(:clang)
  extract_what_to(cookbook_dataset_program_path?, return_pwd+'tools')
  rename(
    'tools/'+cookbook_dataset_program_name_and_program_version?,
    'tools/clang'
  )
  initialize_dataset_for(:compilerrt)
  extract_what_to(cookbook_dataset_program_path?, return_pwd+'compiler-rt')
  # ======================================================================= #
  # First, we must extract LLVM.
  # ======================================================================= #
  initialize_dataset_for(:llvm)
  create_build_directory_then_cd_into_it
  set_this_env_variable 'CC=gcc'
  set_this_env_variable 'CXX=g++'
  # ======================================================================= #
  # The next cmake-line is a hack - at a later point we should clean this
  # up.
  # ======================================================================= #
  cmd = 'cmake -DCMAKE_INSTALL_PREFIX='+appdir_prefix?(:llvm)+'
         -DLLVM_ENABLE_FFI=ON
         -DCMAKE_BUILD_TYPE=Release
         -DLLVM_BUILD_LLVM_DYLIB=ON
         -DLLVM_LINK_LLVM_DYLIB=ON
         -DLLVM_ENABLE_RTTI=ON
         -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF"
         -DLLVM_BUILD_TESTS=ON
         -Wno-dev -G Ninja ..'.delete(N).
                               squeeze(' ')
  run_this_system_command_in_a_coloured_and_padded_manner(cmd)
  do_run_ninja
  do_run_ninja_install
  rnsymc(appdir_prefix?(:llvm))
  exit_program
end
do_initiate_batch_compilation()
do_install_only_binaries() click to toggle source
#

do_install_only_binaries

#
# File lib/rbt/installer/misc.rb, line 8283
def do_install_only_binaries
  @internal_hash[:install_only_binaries] = true
end
do_install_only_the_headers( of_this_program = compile_these_programs?.first ) click to toggle source
#

do_install_only_the_headers

This method will only intall the headers of a program. You must call the method action_install_only_headers() for real action.

#
# File lib/rbt/installer/misc.rb, line 583
def do_install_only_the_headers(
    of_this_program = compile_these_programs?.first
  )
  do_not_compile
  do_not_run_configure
  disable_logging # We dont want to log.
  opne "Installing only headers for the program `"\
       "#{sfancy(of_this_program)}` now."
  @internal_hash[:install_only_the_headers] = true
end
do_install_the_programs() click to toggle source
#

do_install_the_programs (compile tag, main tag, run tag)

This method is the general entry-point in order to batch-compile the programs. The programs are typically stored as an Array, in the variable called @array_compile_these_programs.

The logic for this task will be handled internally, on a per-program basis.

The argument to this method should be an Array which holds the programs that we wish to compile. This is normally set elsewhere in class RBT::Installer.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 632
def do_install_the_programs
  do_install_these_programs
end
do_install_these_programs( i = install_which_programs? ) click to toggle source
#

do_install_these_programs

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1535
def do_install_these_programs(
    i = install_which_programs?
  )
  [i].flatten.compact.each {|this_program|
    do_install_this_program(this_program)
  }
end
Also aliased as: batch_compile_the_programs, do_initiate_batch_compilation
do_install_this_program( this_program ) { |== :do_not_initialize_the_dataset| ... } click to toggle source
#

do_install_this_program (real compile tag)

This method can be used to compile a given program. It is the main “workhorse” for class RBT::Installer.

To not initialize the dataset, use :do_not_initialize_the_dataset as block-argument.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1571
def do_install_this_program(
    this_program
  )
  # ======================================================================= #
  # Handle the * argument. We will show to the user what programs
  # exist that start with this name.
  #
  # To trigger this method, do:
  #
  #   ry a*
  #   ry e*
  #
  # ======================================================================= #
  if this_program.respond_to?(:include?) and
     this_program.include?('*')
    verbose_find_all_keys_starting_with(this_program)
    exit_program
  end
  return unless can_we_continue?
  # ======================================================================= #
  # First check if the user wants to ensure a specific licence:
  # ======================================================================= #
  if check_for_this_licence?
    unless licence? == check_for_this_licence?
      opne "#{tomato('The licences do not match. ')}Expected licence"
      opne 'was: '+
           steelblue(
             RBT.sanitize_this_licence(check_for_this_licence?)
           )+', specified licence was: '+
           steelblue(licence?)
      return
    end
  end
  # ======================================================================= #
  # === Check whether ccache exists
  #
  # Query for the use and availability of ccache. This should come
  # after any special environment was set.
  # ======================================================================= #
  if use_ccache? and !is_ccache_available?
    notify_the_user_that_ccache_is_not_available
  end
  # ======================================================================= #
  # Next we have to sanitize the given input a little bit, such as by
  # getting rid of any '/' character.
  # ======================================================================= #
  this_program = this_program.to_s.dup # We need a String.
  this_program.delete!('_') if this_program.include? '_'
  this_program = File.basename(this_program) if this_program.include? '/'
  # ======================================================================= #
  # Note that the next clause will return and thus break from this
  # method. Subsequent method calls will not be triggered.
  # ======================================================================= #
  if do_we_check_whether_the_program_exists? and
    !is_this_program_included?(this_program, :be_quiet)
    opne "The program #{steelblue(this_program)} is #{tomato('not')} "\
         "registered as part of the RBT project."
    opne 'Thus, it could not be found and, subsequently, it can not be'
    opne 'installed or compiled.'
    return :the_program_is_not_registered_in_the_rbt_project
  end unless this_program.include?('@')
  # ======================================================================= #
  # The @ allows us to bypass the is-included check here. We simply
  # assume that the user knows what he/she is doing in this case.
  # ======================================================================= #
  if is_this_program_included?(this_program, :include_abbreviations_and_be_quiet) or
     this_program.include?('@') # Allow for '@' as input here.
    if this_program.include? '@'
      splitted = this_program.split('@')
      first_part = splitted.first
      set_install_this_program(first_part)
      initialize_a_new_cookbook_for(first_part.delete('-'))
      # =================================================================== #
      # In this case we must change the version and then sync back.
      # =================================================================== #
      cookbook_dataset?.set_complex_program_version(this_program)
      cookbook_dataset?.set_program_version(splitted.last)
      cookbook_dataset?.update_program_name_and_program_version
      # =================================================================== #
      # ^^^ program_name_and_program_version must exist, before
      # we call the next method:
      # =================================================================== #
      cookbook_dataset?.update_program_full_name
      cookbook_dataset?.update_the_program_path
    else
      set_install_this_program(this_program)
      # ==================================================================== #
      # Next, we will typically initialize a new cookbok instance.
      # =================================================================== #
      if block_given?
        if yield == :do_not_initialize_the_dataset
        else
          initialize_a_new_cookbook_for(this_program) # ← Instantiate a new cookbook instance here.
        end
      else
        initialize_a_new_cookbook_for(this_program) # ← Instantiate a new cookbook instance here.
      end
    end
    # ===================================================================== #
    # Next we have to determine which compiler we want to use.
    # ===================================================================== #
    determine_which_compiler_will_be_used
    prefix?.set_program_version(program_version?) # Set the program version here just in case.
    program_path = cookbook_program_path?
    # ===================================================================== #
    # Sometimes we must re-write the program path, e. g. if we take
    # another program version. The following method does that for us.
    # It no longer works as of 2022, though. May have to reconsider this
    # approach.
    # ===================================================================== #
    # consider_sanitizing_the_program_path
    # determine_the_configure_base_directory_to_use
    # ===================================================================== #
    # ===================================================================== #
    # We must check whether the file already exists locally. If not then
    # we have to try to download it.
    # ===================================================================== #
    if program_path
      unless File.exist? program_path
        # ================================================================= #
        # === Download the program if it does not yet exist locally
        #
        # Download the program if it does not exist here. This
        # functionality must come before we try to extract the
        # program.
        #
        # Obtain the program path first, though.
        # ================================================================= #
        # ================================================================= #
        # === Honour the "do_not_download" settings if it exists.
        # ================================================================= #
        if cookbook_dataset? and cookbook_dataset?.do_not_download?
          do_not_download
        else
          download_program
          unicode_middle_cliner # Looks better with cliner, I think.
        end
      end
    end
    # ===================================================================== #
    # === (1) Set special environment variables
    #
    # Next, ensure that if the cookbooks file at hand is using any special
    # environment variable, that this will also be used. For example,
    # the program called "htop" will use these LDFLAGS: -ltinfow,
    # so this has to be enabled.
    # This should come before we will check for ccache. It can also
    # come before we check for the program path - some environment
    # variables may influence any further downstream checks, so
    # let's call it here to be on the safe side.
    # ===================================================================== #
    considering_setting_any_special_environment_variable
    # ===================================================================== #
    # Check whether the archive exists. If not then notify the user about
    # it. This has to happen before we consider removing the old
    # extracted archive directory.
    # ===================================================================== #
    unless File.exist? program_path
      opne "No archive exists at `#{sfile(program_path)}`."
      opne 'As it was specified to extract the archive in this '\
           'case, yet this'
      opne 'archive could not be found at the above reported path, '\
           'we will exit'
      opne 'now. You may consider downloading the source archive, '\
           'should'
      opne 'it exist remotely.' 
      exit_program
    end
    if File.exist? program_path
      # =================================================================== #
      # === (2) Notify the user which program will be compiled/installed
      #         next.
      #
      # This requires the name of the program, as well as the assumed
      # program path.
      # =================================================================== #
      notify_the_user_as_to_which_program_will_be_compiled_or_installed_next(
        this_program, program_path
      )
      # =================================================================== #
      # === (3) Consider changing the tab title
      #
      # In this case we may be able to install/compile the given program
      # at hand, so we can rename the terminal.
      #
      # Changing the name of the tab title should happen only after the
      # program name was set.
      #
      # Note that when we refer to "tab", we really mean KDE konsole
      # tabs primarily.
      #
      # The old code was:
      #
      #
      #   consider_changing_the_tab_title(use_this_as_tab_title)
      #
      # =================================================================== #
      use_this_as_tab_title = return_program_name_then_hyphen_then_the_program_version # :default
      if check_whether_the_given_input_is_a_file_and_does_exist? and
        does_this_file_exist_and_is_it_a_file?(this_program) # This may be the case when the user supplied a path.
        use_this_as_tab_title = remove_archive_at_the_end(File.basename(this_program))
      end
      action(
        :rename_konsole_tab,
        use_this_as_tab_title
      ) if rename_the_terminal?
      # =================================================================== #
      # Keep track of the base-directory onto which we will extract.
      # =================================================================== #
      # set_extract_to_this_directory(
      #   TEMP_DIR_FOR_RBT+
      #   program_name_and_program_version?.to_s
      # )
      # =================================================================== #
      # Next, check whether we have to extract the archive at hand.
      # We do not have to extract .gem files, since "gem" does
      # this for us.
      # =================================================================== #
      skip_extracting_if_it_is_a_gem_file
      if is_a_gem_file?(program_path)
        install_ruby_gem(program_path) # Install this rubygem.
        return
      end
      unless ignore_errors?
        we_can_not_continue if an_error_has_occurred?
      end
      # =================================================================== #
      # === (4) Set the CFLAGS next.
      #
      # This should come before we extract the program. We will also
      # honour the build_static variable.
      #
      # We will do this only for programs that have to be compiled, though.
      # =================================================================== #
      if has_to_be_compiled?
        if build_static?
          # =============================================================== #
          # Honour static compilation settings in the ymal file.
          # =============================================================== #
          opne 'The yaml file specifies that this program is to '\
               'be '+steelblue('compiled statically')+'.'
          opne "Thus, we will use these CFLAGS: "\
               "#{lightblue(default_cflags?)}"
          # =============================================================== #
          # We also have to scan the configure command string. If that
          # string contains an instruction such as "--disable-static",
          # then we will get rid of it, and notify the user. The reason
          # is that, quite obviously, we can not have conflicting options
          # passed.
          #
          # Note that this may be changed at a later time in the future,
          # if we decide that only user-supplied options to RBT may change
          # this behaviour. For now, we simply add a way to check the logic
          # on it, which is an improvement over the old code which did
          # not do any logic-checking at all whatsoever.
          # =============================================================== #
          configure_options = configure_options?
          if configure_options.include? '--disable-static'
            opne 'The configure option to '+sfancy(compile_which_program?)+
                 ' is using the option called '+simp('--disable-static')+'.'
            opne "As this #{steelblue('would contradict')} with our goal "\
                 "to enable static compilation,"
            opne 'this option was replaced with --enable-static, from '\
                 'the configure command string.'
            cookbook_dataset?.configure_options = configure_options?.sub(
              /-?-?disable-?static/, '--enable-static'
            )
          end
          set_cflags(:build_static)
        end
      end
      # =================================================================== #
      # === (5) Consider showing the Flexbox next (flexbox tag, infobox tag)
      #
      # Consider showing the fluxbox next. This must happen AFTER we
      # modified the CFLAGS variable.
      #
      # The flexbox may also show the required dependencies of the
      # given program at hand, which should always come before
      # the archive at hand is extracted.
      #
      # A configuration showing the dependencies, within the file called
      # "always_show_dependencies.yml".
      #
      # Note that since as of Nov 2017, the default is to not always show
      # the dependencies, so the user has to specifically enable this
      # option if he/she wants to have that.
      #
      # In the old code, we used to call the method
      # feedback_dependencies_of_the_program() rather than
      # show the flexbox at hand.
      # =================================================================== #
      consider_showing_the_flexbox
      # =================================================================== #
      # === (6) Extract the main archive next
      # =================================================================== #
      unless skip_extracting?
        consider_removing_the_old_extracted_directory_if_it_exists
      end
      return unless can_we_continue? # This should come before we extract anything.
      if File.exist? program_path
        extract_this_archive(program_path)
      end
      # =================================================================== #
      # Next, exit if this was specified that way.
      # =================================================================== #
      exit_program if extract_only?
      ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation
      # =================================================================== #
      # Also reset the compiled n-times counter next.
      # =================================================================== #
      reset_compiled_n_times_counter
      # =================================================================== #
      # Create the AppDir skeleton before cd-ing to the base directory.
      # =================================================================== #
      consider_creating_the_appdir_skeleton
      # =================================================================== #
      # Change directory to the extract directory next.
      # =================================================================== #
      cd_to_the_extracted_archive
      # =================================================================== #
      # Next, change to the extracted directory. We will also have to
      # honour the configure_base_dir setting.
      # =================================================================== #
      cd_into_this_directory = rds(
        TEMP_DIR_FOR_RBT+
        program_name_and_program_version?+'/'+
        configure_base_dir?.to_s
      )
      cd(cd_into_this_directory)
      opne "The current working directory is now #{sdir(return_pwd)}."
      # =================================================================== #
      # === (7) Handle patches
      #
      # Consider applying a patch next - this should come before the
      # preinstall action and before the sed-action, but after the
      # optional start message.
      # =================================================================== #
      consider_applying_a_patch
      # if use_build_directory?
      #   create_the_build_directory_then_cd_into_it
      #   ^^^ disabled as of 21.09.2022 - see README.gen for an explanation.
      # end
      # =================================================================== #
      # === Optional start messages
      #
      # Display optional start message here, right before we continue
      # to the preinstall? stage and other stages.
      # =================================================================== #
      consider_displaying_the_start_message
      # =================================================================== #
      # === (8) Reset any possible error message at this point.
      # =================================================================== #
      RBT.reset_error_message
      # =================================================================== #
      # === (9) Check for sed-action
      #
      # Next, we check whether we must apply sed. It must come before any
      # preinstall-action, and after we have cd-ed to the correct directory.
      # This also means after we have extracted the archive at hand.
      # =================================================================== #
      check_for_sed_action
      # =================================================================== #
      # === (10) Pre-install actions
      #
      # Next, handle pre-install actions first, should they exist.
      # These should come after we have checked for sed-related
      # actions.
      # =================================================================== #
      run_preinstall_actions
      # =================================================================== #
      # Here the user only wants to install the .h header files.
      # =================================================================== #
      if install_only_the_headers?
        action_install_only_headers
        exit_program
      end
      # =================================================================== #
      # Next register that we are compiling a program.
      # =================================================================== #
      register_that_this_program_is_currently_being_compiled
      run_pre_configure_steps_if_requested_to_do_so
      decide_whether_to_build_statically
      # =================================================================== #
      # === (11) The (optional) autogen-step
      #
      # Consider running "autogen" next.
      #
      # This should come after the archive was already extracted, and
      # after pre-installation steps were performed - but it should come
      # BEFORE we invoke "autoconf" (the latter one is an optional step
      # as well, though).
      # =================================================================== #
      decide_whether_to_invoke_autogen # (autogen tag)
      # =================================================================== #
      # === (12) The next method-call must occur AFTER the
      #          pre-installation steps.
      # =================================================================== #
      decide_whether_to_invoke_the_autoconf_command
      # =================================================================== #
      # The next method used to be called run_configure_like_stage() in
      # the past, until the rewrite in September 2022.
      # =================================================================== #
      find_the_corresponding_install_method_and_proceed_from_there
      # =================================================================== #
      # The next method should come after calling the "configure-like
      # method".
      # =================================================================== #
      check_for_common_problems_and_common_errors
      consider_running_ldconfig
      # ===================================================================== #
      # Consider symlinking glib-schema files into the /usr/ hierarchy.
      # ===================================================================== #
      consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy
      # ===================================================================== #
      # Make our instance of SymlinkProgram behave properly - this should
      # come before we perform postinstallation actions, and after the
      # glib schema files were symlinked.
      # ===================================================================== #
      prepare_symlink_program_instance
      if appdir_prefix_was_used?
        do_store_the_configure_options_that_were_used_into_a_markdown_file
      end
      if has_an_error_occurred? or RBT::Errors::MapLineToASpecificError.all_programs_and_errors?.flatten.any? {|inner_line|
          inner_line.to_s.include?('.h: No such file or directory')
        }
        opne swarn('An error has occurred in the directory ')+
             sdir(return_pwd)+
             swarn('.')
        opne swarn('We will most likely not be able to continue.')
        try_to_give_additional_information_to_the_user_if_the_missing_header_is_registered
        case ignore_errors?
        when true
          # =============================================================== #
          # pass through
          # =============================================================== #
        when :infer # This is the new default.
          we_can_not_continue
        else
          we_can_not_continue
        end
      end
      # =================================================================== #
      # Next, compare the installed libraries versus the assumed
      # libraries. This can then be used to updated the dataset.
      # =================================================================== #
      if ignore_errors_anyway? or successfully_compiled?
        # ================================================================= #
        # Next, consider performing postinstallation steps:
        # ================================================================= #
        consider_performing_postinstallation_actions # ← Postinstallation step
        # ================================================================= #
        # Consider stripping the compiled binaries.
        # ================================================================= #
        if had_to_be_compiled?
          # =============================================================== #
          # Next check whether we have to strip the compiled binaries or
          # whether we do not have to strip them. The checks are done
          # with the method itself, so we don't have to do any conditional
          # checks here at this point.
          # =============================================================== #
          do_strip_the_compiled_binaries
          # =============================================================== #
          # Next, we will consider creating and populating the subdirectory
          # called "lib/pkgconfig/". This may be necessary for programs that
          # install into "share/pkgconfig/" rather than "lib/pkgconfig".
          #
          # This step has to be done before we call the method
          # consider_symlinking_the_pkgconfig_files().
          # =============================================================== #
          consider_creating_and_populating_the_pkgconfig_directory
          # =============================================================== #
          # Next register the configure-line into the configure "database",
          # unless a problem or error has occurred.
          # =============================================================== #
          if no_problem_was_encountered? and
             no_error_was_encountered?
            # ============================================================= #
            # Register the configure-line that was used into the "global"
            # configure database next - this should come before we symlink
            # the .pc files:
            # ============================================================= #
            register_configure_line_into_configure_database
            # ============================================================= #
            # If the cookbook file at hand has symlinking_pkgconfig_files
            # enabled, and if the program is compiled, as AppDir, then we
            # will symlink .pc iles into /usr/lib/pkgconfig/, if the
            # latter one exists.
            #
            # This should actually be part of the post-installation actions,
            # but before running ldconfig.
            # ============================================================= #
            consider_symlinking_the_pkgconfig_files
            if did_we_use_an_appdir_prefix?
              # =========================================================== #
              # And store this into the app-dir prefix.
              # =========================================================== #
              do_store_the_configure_options_that_were_used_into_a_markdown_file
              # =========================================================== #
              # === Handle .gir files since as of 22.02.2020.
              # =========================================================== #
              if has_gir_files? and symlink_gir_files?
                target_directory = '/usr/share/gir-1.0/'
                symlink_the_available_gir_files_into_this_target_directory(target_directory)
              end
            end
            # ============================================================= #
            # Also register it to the file that keeps track of which
            # programs were compiled successfully.
            # ============================================================= #
            register_last_compiled_program
          end
        end
        # ================================================================= #
        # Make sure that the registered binaries are already registered, if
        # the program has been compiled successfully. This will only be run
        # on my home setup, though.
        # ================================================================= #
        consider_checking_whether_the_compiled_binaries_are_already_registered
        # ================================================================= #
        # Consider running "ldconfig" next.
        # ================================================================= #
        consider_running_ldconfig
      else
        # ================================================================= #
        # Else a problem or an error may have occurred. We will thus check
        # for that. The error will be re-set more on the beginning of
        # this method rather than its end.
        # ================================================================= #
        check_for_common_problems_and_common_errors
      end
      consider_comparing_the_installed_libraries_versus_the_assumed_libraries
      # =================================================================== #
      # === Go back to the temp-directory again
      #
      # Return to the temp-directory as start again. This has to happen
      # because the underlying directory may have been removed, so we
      # need to go to a "stable" directory instead.
      #
      # The second argument exists so that we are silent about this.
      # =================================================================== #
      change_directory(temp_directory?, :do_not_report_anything)
      unless keep_extracted?
        # ================================================================= #
        # === Remove the extracted archive / directory
        #
        # We have to clean-up again, by removing the extracted archive. This
        # behaviour can be changed by the user, though. Additionally, the
        # individual .yml file may decide for us whether we will remove the
        # extracted directory or whether we will keep that directory. User
        # instructions overrule the settings in the .yml file, though.
        # ================================================================= #
        do_remove_the_extracted_archive
      end
      this_program = this_program.split('@').first.to_s if this_program.include?('@')
      # =================================================================== #
      # Ensure that the expanded cookbook .yml file exists
      # =================================================================== #
      if is_on_roebe? and
        !does_the_expanded_cookbook_file_exist_for_this_program?(this_program)
        expand_this_cookbook(this_program)
      end
      # =================================================================== #
      # Also store the prefix that we used on the toplevel namespace.
      # =================================================================== #
      RBT.set_last_prefix_used(use_which_prefix?)
      # =================================================================== #
      # === Handle empty subdirectories
      #
      # Next we will consider removing empty subdirectories. This has to
      # happen here again, after the postinstall step, because the installation
      # may have failed. The method will also do a more general clean-up
      # step in the respective AppDir prefix.
      #
      # However had, in December 2022 it was realised that some directories
      # should NOT be removed, even if they are empty - such as temp or
      # logs directories called during the post-installation step. So
      # we have to include that as well.
      # =================================================================== #
      consider_removing_empty_subdirectories
      store_time_snapshot
      consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation
      # =================================================================== #
      # Report to the user how long it took us to compile/install the program
      # at hand.
      # =================================================================== #
      consider_reporting_the_time_it_took_to_compile_this_program
      # =================================================================== #
      # Go back into the starting directory again.
      # =================================================================== #
      consider_entering_the_log_directory
      show_the_everything_is_finished_message
      # =================================================================== #
      # Show success or failure - this should come last.
      # =================================================================== #
      show_success_or_failure_status
    else
      opne "No archive exists at #{sfile(program_path)}."
    end
    # ===================================================================== #
    # consider_changing_the_tab_title :clear
    # ===================================================================== #
    action(:rename_konsole_tab, :clear) if rename_the_terminal?
  else
    opne "#{steelblue(this_program)} is not included in the RBT database."
  end
end
do_install_via_cmake()
Alias for: run_the_cmake_steps
do_install_via_meson()
Alias for: run_the_meson_steps
do_invoke_autoconf() click to toggle source
#

do_invoke_autoconf

This variant invokes autoconf without any additional check.

#
# File lib/rbt/installer/misc.rb, line 9728
def do_invoke_autoconf
  cmd = 'autoconf' # " #{SHELL_ERROR_CODE}"
  cliner
  opne "Doing `#{teal(cmd)}` in directory #{sdir_return_pwd}"
  opne 'using this command next:'
  opne sfancy("  #{cmd}")
  cliner
  `#{cmd}`
end
Also aliased as: invoke_autoconf
do_keep_la_files() click to toggle source
#

do_keep_la_files

Use this method if you wish to keep the libtool .la files. This may sometimes be necessary, even though libtool .la files are a fairly bad solution altogether.

#
# File lib/rbt/installer/misc.rb, line 14424
def do_keep_la_files
  @internal_hash[:keep_la_files] = true
end
do_not_check_whether_the_program_exists() click to toggle source
#

do_not_check_whether_the_program_exists

#
# File lib/rbt/installer/misc.rb, line 3229
def do_not_check_whether_the_program_exists
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = false
end
do_not_compile( be_verbose = be_verbose? ) click to toggle source
#

do_not_compile

This method can be invoked to set the :continue_after_configure_step entry in the internal hash to false.

If set to false then we will NOT compile a program. Instead, we will run the configure script and quit after having done so.

#
# File lib/rbt/installer/misc.rb, line 7453
def do_not_compile(
    be_verbose = be_verbose?
  )
  case be_verbose
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'We will not continue after the '+
         steelblue('configure phase')+'.'
  end
  @internal_hash[:continue_after_configure_step] = false
  @internal_hash[:do_not_compile] = true
  set_do_not_symlink(be_verbose) # So we don't run advanced symlink.
end
do_not_compile?() click to toggle source
#

do_not_compile?

#
# File lib/rbt/installer/misc.rb, line 3386
def do_not_compile?
  @internal_hash[:do_not_compile]
end
do_not_compile_statically( be_verbose = :be_verbose )
do_not_continue(be_verbose = false)
Alias for: we_can_not_continue
do_not_continue_after_configure_step() click to toggle source
#

do_not_continue_after_configure_step

#
# File lib/rbt/installer/misc.rb, line 15678
def do_not_continue_after_configure_step
  @internal_hash[:continue_after_configure_step] = false
end
do_not_continue_after_make_step() click to toggle source
#

do_not_continue_after_make_step

#
# File lib/rbt/installer/misc.rb, line 4500
def do_not_continue_after_make_step
  @internal_hash[:continue_after_make_step] = false
end
do_not_continue_past_the_make_step()
do_not_create_the_appdir_skeleton() click to toggle source
#

do_not_create_the_appdir_skeleton

#
# File lib/rbt/installer/misc.rb, line 1498
def do_not_create_the_appdir_skeleton
  @internal_hash[:create_appdir_skeleton] = false
end
do_not_display_the_flexbox() click to toggle source
#

do_not_display_the_flexbox

#
# File lib/rbt/installer/misc.rb, line 5814
def do_not_display_the_flexbox
  @internal_hash[:show_the_flexbox] = false
end
Also aliased as: do_not_show_the_flexbox
do_not_download() click to toggle source
#

do_not_download

Setter-method to disable downloading the remote source package.

#
# File lib/rbt/installer/misc.rb, line 10840
def do_not_download
  ihash?[:may_we_download] = false
end
do_not_exit_after_a_rubygem_has_been_installed() click to toggle source
#

do_not_exit_after_a_rubygem_has_been_installed

#
# File lib/rbt/installer/misc.rb, line 12046
def do_not_exit_after_a_rubygem_has_been_installed
  @internal_hash[:exit_after_a_rubygem_has_been_installed] = false
end
do_not_extract( be_verbose = true )
Alias for: set_skip_extracting
do_not_honour_check_to_ensure_that_the_program_exists()
do_not_initialize_a_new_cookbook_dataset() click to toggle source
#

do_not_initialize_a_new_cookbook_dataset

#
# File lib/rbt/installer/misc.rb, line 6044
def do_not_initialize_a_new_cookbook_dataset
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset] = false
end
do_not_invoke_configure( be_verbose = true )
do_not_register_into_the_yaml_database() click to toggle source
#

do_not_register_into_the_yaml_database

#
# File lib/rbt/installer/misc.rb, line 11705
def do_not_register_into_the_yaml_database
  RBT.do_not_register_into_the_yaml_database
end
do_not_register_the_last_compiled_program() click to toggle source
#

do_not_register_the_last_compiled_program

#
# File lib/rbt/installer/misc.rb, line 13856
def do_not_register_the_last_compiled_program
  @internal_hash[:register_the_last_compiled_program] = false
end
do_not_remove_extracted_archive(i = true)
do_not_remove_the_extracted_archive(i = true)
do_not_rename_the_kde_konsole_tab() click to toggle source
#

do_not_rename_the_kde_konsole_tab

#
# File lib/rbt/installer/misc.rb, line 13331
def do_not_rename_the_kde_konsole_tab
  opne 'We will not rename the KDE Konsole tab.'
  @internal_hash[:rename_tab_title] = false
end
do_not_run_configure( be_verbose = true ) click to toggle source
#

do_not_run_configure

Do not run the configure script. Since Jan 2012 we also disable running ldconfig in this method.

#
# File lib/rbt/installer/misc.rb, line 6196
def do_not_run_configure(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not compile - or run any configure script.'
  end
  do_not_run_the_configure_script
  do_not_use_ldconfig
  no_postinstall_actions
end
Also aliased as: do_not_invoke_configure
do_not_run_configure_script() click to toggle source
#

do_not_run_configure_script

#
# File lib/rbt/installer/misc.rb, line 6210
def do_not_run_configure_script
  @internal_hash[:run_configure_script] = false
end
do_not_run_ldconfig() click to toggle source
#

do_not_run_ldconfig

#
# File lib/rbt/installer/misc.rb, line 14377
def do_not_run_ldconfig
  do_not_use_ldconfig :be_silent
end
do_not_run_make() click to toggle source
#

do_not_run_make

#
# File lib/rbt/installer/misc.rb, line 3321
def do_not_run_make
  @internal_hash[:run_make_command] = false
end
do_not_run_make_install( be_verbose = false ) click to toggle source
#

do_not_run_make_install

Use this method if you wish to specifically skipping the “make install” step.

#
# File lib/rbt/installer/misc.rb, line 3340
def do_not_run_make_install(
    be_verbose = false
  )
  @internal_hash[:run_make_install] = false
  if be_verbose
    opne 'We will not run the "'+slateblue('make install')+'" command.'
  end
  # ======================================================================= #
  # Running ldconfig seems pointless, so it is also disabled (silently).
  # ======================================================================= #
  do_not_use_ldconfig(:do_not_be_verbose)
end
Also aliased as: dont_make_install
do_not_run_ninja() click to toggle source
#

do_not_run_ninja

#
# File lib/rbt/installer/misc.rb, line 5235
def do_not_run_ninja
  @internal_hash[:may_we_run_ninja] = false 
end
do_not_run_postinstall_actions()
do_not_run_the_configure_script()
do_not_show_the_flexbox()
do_not_skip_extracting() click to toggle source
#

do_not_skip_extracting

This method will set towards extracting the archive.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 18
def do_not_skip_extracting
  @internal_hash[:skip_extracting] = false
end
do_not_store_the_compile_time() click to toggle source
#

do_not_store_the_compile_time

#
# File lib/rbt/installer/misc.rb, line 9790
def do_not_store_the_compile_time
  @internal_hash[:time_compilation] = false
end
do_not_strip_binaries()
do_not_strip_binaries?() click to toggle source
#

do_not_strip_binaries?

#
# File lib/rbt/installer/misc.rb, line 1869
def do_not_strip_binaries?
  !strip_binaries?
end
Also aliased as: do_not_strip_the_binaries?
do_not_strip_the_binaries() click to toggle source
#

do_not_strip_the_binaries

This is the non-verbose variant to disable stripping of binaries.

If you need the verbose variant, use the method called verbose_do_not_strip_the_binaries() instead.

#
# File lib/rbt/installer/misc.rb, line 1855
def do_not_strip_the_binaries
  @internal_hash[:strip_binaries] = false
end
Also aliased as: do_not_strip_binaries
do_not_strip_the_binaries?()
do_not_try_to_autofix() click to toggle source
#

do_not_try_to_autofix

This method will specifically disable any attempts to try to autofix libtool-related problems. It is currently silent, all of the time.

#
# File lib/rbt/installer/misc.rb, line 8178
def do_not_try_to_autofix
  @internal_hash[:try_to_autofix] = false
end
do_not_use_a_build_directory() { || ... } click to toggle source
#

do_not_use_a_build_directory

#
# File lib/rbt/installer/build_directory.rb, line 48
def do_not_use_a_build_directory(&block)
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :be_verbose
    # ===================================================================== #
    when :be_verbose
      opne "We will not use a build directory."
    end
  end
  @internal_hash[:use_build_directory] = false
end
do_not_use_a_prefix() click to toggle source
#

do_not_use_a_prefix

Do not use any prefix in general, no matter whether we will use GNU configure, meson/ninja, cmake or any other build system..

#
# File lib/rbt/installer/misc.rb, line 1073
def do_not_use_a_prefix
  opne 'No '+steelblue('--prefix')+' option will be used.'
  @internal_hash[:use_a_prefix] = false
end
do_not_use_any_compile_time_flags() click to toggle source
#

do_not_use_any_compile_time_flags

If you do not want to use any compile-time flags, aka CFLAGS, then you can use this method here.

#
# File lib/rbt/installer/misc.rb, line 5908
def do_not_use_any_compile_time_flags
  opne 'Setting compile-time flags ('+
       royalblue('CFLAGS')+', '+
       royalblue('LDFLAGS')+
       ') to empty.'
  set_cflags('')
end
do_not_use_any_configure_option( be_verbose = be_verbose? ) { || ... } click to toggle source
#

do_not_use_any_configure_option

This option allows us to avoid using any configure option.

Invocation example from the commandline:

ry htop --dont-use-configure-options
#
# File lib/rbt/installer/misc.rb, line 3243
def do_not_use_any_configure_option(
    be_verbose = be_verbose?,
    &block
  )
  if block_given?
    be_verbose = yield
  end
  case be_verbose
  when :be_verbose, true
    # ===================================================================== #
    # Be verbose in this case.
    # ===================================================================== #
    opne 'No configure options will be used for this run.'
  end
  @internal_hash[:try_to_use_configure_options] = false
end
do_not_use_any_configure_options( be_verbose = be_verbose?, &block )
do_not_use_autoconf() click to toggle source
#

do_not_use_autoconf

#
# File lib/rbt/installer/misc.rb, line 9519
def do_not_use_autoconf
  @internal_hash[:use_autoconf] = false
  opne 'We will '+tomato('not')+' invoke autoconf.'
end
do_not_use_cookbook_aliases( be_verbose = :be_verbose ) click to toggle source
#

do_not_use_cookbook_aliases

#
# File lib/rbt/installer/misc.rb, line 1521
def do_not_use_cookbook_aliases(
    be_verbose = :be_verbose
  )
  case be_verbose
  when true, :be_verbose
    opne 'Disabling cookbook aliases for this run.'
  end
  @internal_hash[:make_use_of_the_cookbook_aliases] = false
end
do_not_use_ldconfig( be_verbose = be_verbose? ) click to toggle source
#

do_not_use_ldconfig

Use only this method when you wish to disable running ldconfig.

To set this, do something like:

ry htop do_not_use_ldconfig
#
# File lib/rbt/installer/misc.rb, line 14306
def do_not_use_ldconfig(
    be_verbose = be_verbose?
  )
  case be_verbose
  when :do_not_be_verbose, :be_silent
    be_verbose = false
  end
  if be_verbose
    opne "We will not run `#{teal('ldconfig')}`."
  end
  RBT.configuration?.run_ldconfig = false
end
do_not_use_sed( be_verbose = false ) click to toggle source
#

do_not_use_sed

Disable the use of sed through this method.

#
# File lib/rbt/installer/misc.rb, line 11279
def do_not_use_sed(
    be_verbose = false
  )
  case be_verbose
  # ======================================================================= #
  # === :be_verbose
  # ======================================================================= #
  when :be_verbose
    be_verbose = true
  end
  if be_verbose
    opne "We will not be using #{lightgreen('sed')}."
  end
  @internal_hash[:sed] = false
end
do_perform_an_intelligent_bootstrap() click to toggle source
#

do_perform_an_intelligent_bootstrap

Usage example:

rbt --intelligent-bootstrap
#
# File lib/rbt/installer/misc.rb, line 5401
def do_perform_an_intelligent_bootstrap
  begin
    require 'environment_information'
  rescue LoadError; end
  opne 'Attempting to perform an '+
       steelblue('intelligent bootstrap operation next')+'.'
  if Object.const_defined? :EnvironmentInformation
    EnvironmentInformation.initialize
    array_of_outdated_programs = EnvironmentInformation.return_array_of_outdated_programs
    # ===================================================================== #
    # Now that we have these programs, we must sort them based on
    # filesize.
    # ===================================================================== #
    array_of_outdated_programs = array_of_outdated_programs.sort_by {|this_program|
      result = 1_000_000 # Use a bogus entry here, to sort it towards the bottom.
      target_yaml_file = ::RBT.path_to_expanded_directory?+this_program.to_s+'.yml'
      if File.exist? target_yaml_file
        dataset = YAML.load_file(target_yaml_file)
        if dataset.has_key? 'archive_size'
          result = dataset['archive_size']
        end
      end
      result
    }
    array_of_outdated_programs.each {|this_program|
      opne "Now compiling #{steelblue(this_program)}."
      ::RBT::Installer.new(this_program)
    }
  end
end
do_permanently_disable_ccache( into = FILE_CCACHE, what = "false\n" ) click to toggle source
#

do_permanently_disable_ccache

#
# File lib/rbt/installer/misc.rb, line 5536
def do_permanently_disable_ccache(
    into = FILE_CCACHE,
    what = "false\n"
  )
  write_what_into(what, into)
  opne "Permanently disabling the use of ccache "\
       "(Stored into this file: `#{sfile(into)}`)."
  if is_on_roebe?
    into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\
           "#{File.basename(into)}"
    write_what_into(what, into)
    opne "Permanently disabling the use of ccache "\
         "(Stored into this file: `#{sfile(into)}`)."
  end
end
do_permanently_disable_the_colours() click to toggle source
#

do_permanently_disable_the_colours

This method can be used to permanently disable the colours.

Invoke this method by issuing:

ry --permanent-no-colours
#
# File lib/rbt/installer/misc.rb, line 7147
def do_permanently_disable_the_colours
  opne 'Now permanently disabling the colours.'
  configuration?.use_colours = false
  what = false
  into = RBT.file_use_colours
  write_what_into(what, into)
  if is_on_roebe?
    into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+
           File.basename(into)
    opne "Also storing in `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
do_permanently_enable_ccache( into = FILE_CCACHE, what = "true\n" ) click to toggle source
#

do_permanently_enable_ccache

#
# File lib/rbt/installer/misc.rb, line 13638
def do_permanently_enable_ccache(
    into = FILE_CCACHE,
    what = "true\n"
  )
  write_what_into(what, into)
  opne "Permanently enabling the use of ccache "\
       "(Stored into this file: `#{sfile(into)}`)."
  if is_on_roebe?
    into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\
           "#{File.basename(into)}"
    write_what_into(what, into)
    opne "Permanently enabling the use of ccache "\
         "(Stored into this file: `#{sfile(into)}`)."
  end
end
do_permanently_enable_the_colours() click to toggle source
#

do_permanently_enable_the_colours

This method can be used to permanently enable the colours.

Invoke this method by issuing:

ry --permanent-enable-colours
#
# File lib/rbt/installer/misc.rb, line 7125
def do_permanently_enable_the_colours
  opne 'Now permanently enable the colours.'
  configuration?.use_colours = true
  write_what_into(false, RBT.file_use_colours)
  if is_on_roebe?
    into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+
           File.basename(into)
    opne "Also storing in `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
do_permanently_use_clang() click to toggle source
#

do_permanently_use_clang

This method will permanently enable clang, the compiler, on a project-wide default.

Invocation example:

ry --do-permanently-use-clang
#
# File lib/rbt/installer/misc.rb, line 9066
def do_permanently_use_clang
  configuration?.use_this_compiler = :clang
  configuration?.do_save
end
do_permanently_use_psych() click to toggle source
#

do_permanently_use_psych

Use this method if you wish to permanently use psych, rather than syck.

#
# File lib/rbt/installer/misc.rb, line 13591
def do_permanently_use_psych
  opne 'We will use the psych module for yaml-datasets from now on.'
  opne 'This will be stored in the file '+sfile(FILE_USE_PSYCH_OR_SYCK)
  write_what_into(YAML.dump(:psych), FILE_USE_PSYCH_OR_SYCK)
  if is_on_roebe?
    write_what_into(YAML.dump(:psych),
      ROEBE_PATH_TO_COOKBOOKS+'yaml/configuration/'+
      File.basename(FILE_USE_PSYCH_OR_SYCK)
    )
  end
end
do_permanently_use_syck() click to toggle source
#

do_permanently_use_syck

Use this method if you wish to permanently use syck, rather than psych.

#
# File lib/rbt/installer/misc.rb, line 8471
def do_permanently_use_syck
  opne 'We will use the syck module for yaml-datasets from now on.'
  opne 'This will be stored in the file '+sfile(FILE_USE_PSYCH_OR_SYCK)
  write_what_into(YAML.dump(:syck), FILE_USE_PSYCH_OR_SYCK)
  if is_on_roebe?
    write_what_into(YAML.dump(:syck),
      ROEBE_PATH_TO_COOKBOOKS+'yaml/configuration/'+
      File.basename(FILE_USE_PSYCH_OR_SYCK)
    )
  end
end
do_postinstall_actions( run_postinstall_actions = run_postinstall_actions? )
do_remove_la_files_after_compilation() click to toggle source
#

do_remove_la_files_after_compilation

#
# File lib/rbt/installer/misc.rb, line 14431
def do_remove_la_files_after_compilation
  @internal_hash[:keep_la_files] = false
end
do_remove_the_extracted_archive() click to toggle source
#

do_remove_the_extracted_archive

This is the method that will remove the extracted archive again. Only invoke it when we are absolutely certain that the archive has to be extracted.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 152
def do_remove_the_extracted_archive
  _ = remove_archive_stuff_from_the_end(
        extract_where_to?+
        File.basename(program_path?.to_s)
      )
  if File.directory?(_) and remove_the_extracted_archive?
    opne "Next, the directory at `#{sdir(_)}` will be removed."
    remove_directory(_)
  end
end
do_run_GNU_configure_then_make_then_make_install( use_this_configure_command = use_this_build_system? ) click to toggle source
#

do_run_GNU_configure_then_make_then_make_install

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 360
def do_run_GNU_configure_then_make_then_make_install(
    use_this_configure_command = use_this_build_system?
  )
  run_the_configure_command
  run_premake_make_then_make_install if run_make?
end
do_run_ninja() click to toggle source
#

do_run_ninja

This method will run “ninja”.

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 99
def do_run_ninja
  reset_error_map_line_to_a_specific_error
  opne "Proceeding to run the command #{('mediumpurple(ninja')} next,"
  opne "from the working directory "\
        "#{sdir(return_pwd)}:"
  run_this_system_command_in_a_coloured_and_padded_manner 'ninja'
  run_through_the_registered_problems_registered_errors_and_behaviour_changes
  reset_error_map_line_to_a_specific_error
end
do_run_ninja_and_then_ninja_install() click to toggle source
#

do_run_ninja_and_then_ninja_install (ninja tag)

This entry point will run “ninja” and then “nina install”.

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 67
def do_run_ninja_and_then_ninja_install
  if may_we_run_ninja?
    this_file = 'build.ninja'
    if File.exist?(this_file) or
       File.exist?(File.absolute_path(this_file))
      # =================================================================== #
      # === Run "ninja" next:
      # =================================================================== #
      do_run_ninja
      # =================================================================== #
      # === Run "ninja install" next:
      # =================================================================== #
      do_run_ninja_install
    else
      opne "No file called #{sfile(this_file)} could be found in the directory"
      opne "#{sdir(return_pwd)} - thus, the build tool called"
      opne "#{orange('ninja')} can not be run."
      # =================================================================== #
      # Register this error as well:
      # =================================================================== #
      error_is :could_not_find_file_called_build_ninja
    end
  end
end
Also aliased as: ninja_install, ninjait, run_ninja
do_run_ninja_install() click to toggle source
#

do_run_ninja_install

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 112
def do_run_ninja_install
  reset_error_map_line_to_a_specific_error
  run_this_system_command_in_a_coloured_and_padded_manner 'ninja install'
  run_through_the_registered_problems_registered_errors_and_behaviour_changes
  reset_error_map_line_to_a_specific_error
end
do_run_simulation() click to toggle source
#

do_run_simulation

#
# File lib/rbt/installer/misc.rb, line 4507
def do_run_simulation
  @internal_hash[:run_simulation] = true
end
do_run_via_nontraditional_way( optional_use_this_as_program_name_and_program_version = program_name_and_program_version? )
do_run_with_this_input(i) click to toggle source
#

do_run_with_this_input

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 673
def do_run_with_this_input(i)
  we_will_not_try_to_determine_which_programs_have_to_be_installed
  menu
  set_install_these_programs(i)
  do_install_the_programs
end
do_set_keep_extracted( be_verbose = true ) click to toggle source
#

do_set_keep_extracted

This delegates towards the method set_keep_the_extracted_archive and may also report to the end-user as to what is being done.

#
# File lib/rbt/installer/misc.rb, line 10866
def do_set_keep_extracted(
    be_verbose = true
  )
  case be_verbose
  # ======================================================================= #
  # === :be_silent
  # ======================================================================= #
  when :be_silent,
       :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'The extracted directory will not be removed '\
         'after compilation / installation has finished.'
  end
  set_keep_the_extracted_archive
end
do_set_keep_extracted_archive( be_verbose = true )
do_show_the_flexbox() click to toggle source
#

do_show_the_flexbox

#
# File lib/rbt/installer/misc.rb, line 5821
def do_show_the_flexbox
  @internal_hash[:show_the_flexbox] = true
end
do_show_the_infobox()
do_skip_extracting() click to toggle source
#

do_skip_extracting

Not every archive has to be extracted. For example, .gem files do not have to be extracted.

#
# File lib/rbt/installer/misc.rb, line 12137
def do_skip_extracting
  @internal_hash[:skip_extracting] = true
end
Also aliased as: skip_extracting
do_skip_postinstall_actions()
do_start_the_sinatra_interface() click to toggle source
#

do_start_the_sinatra_interface

#
# File lib/rbt/installer/misc.rb, line 10441
def do_start_the_sinatra_interface
  require 'rbt/sinatra/app.rb'
  RBT.run_app
end
do_store_the_configure_options_that_were_used_into_a_markdown_file() click to toggle source
#

do_store_the_configure_options_that_were_used_into_a_markdown_file

This method is only invoked for an AppDir program. It will store the configure options, but not the full configure command; for that another .md file is used.

#
# File lib/rbt/installer/misc.rb, line 11726
def do_store_the_configure_options_that_were_used_into_a_markdown_file
  store_this = configure_options?.dup
  unless store_this.empty?
    # ===================================================================== #
    # We will remove some stuff from it before storing:
    # ===================================================================== #
    if store_this.include? rbt_temp_dir?
      store_this.sub!(
        /#{Regexp.quote(rbt_temp_dir?)}/, ''
      )
      _ = program_name_and_program_version?
      if store_this.include? _
        store_this.sub!(/#{_}/, '.')
      end
    end
    into = "#{prefix?}Resources/configure_options.md"
    opne 'Storing the configure options that were used '\
         'into the file:'
    e
    e "  #{sfile(into)}"
    e
    write_what_into("#{store_this}\n", into)
  end
end
do_strip_the_compiled_binaries( strip_how = '--strip-unneeded' ) click to toggle source
#

do_strip_the_compiled_binaries

This method will strip the compiled binaries, but only if we install them in an AppDir-prefix, that is, a path such as:

/Programs/Htop/2.0.2/
/home/Programs/Htop/2.0.2/

This stripping-operation will be done by the program called “strip”, which is part of the binutils suite.

There are three major ways how to use the strip functionality essentially:

(1) --strip-unneeded
(2) --strip-debug
(3) --strip-all

“strip –strip-unneeded” will remove all symbols that are not needed for relocation processing.

“strip –strip-debug” will only remove the debugging symbols.

“strip –strip-all” will remove all symbols.

Note that you can also strip the symbol table, from an object file, by using the “-s option” of the strip command.

When I tested different strip variants, in particular –strip-debug and –strip-unneeded, the latter one was producing significantly smaller binary files. When I used –strip-all and compared it to –strip-unneeded, the results were the same - so based on this, I am setting “–strip-unneeded” as the default.

#
# File lib/rbt/installer/misc.rb, line 1739
def do_strip_the_compiled_binaries(
    # ===================================================================== #
    # Determine which strip-variant to use next:
    #   strip_how = '--strip-debug'
    #   strip_how = '--strip-all'
    # ===================================================================== #
    strip_how = '--strip-unneeded' # ← This is the current default.
  )
  # ======================================================================= #
  # Do not strip the binaries if an error has occurred or if the user
  # has not enabled this option.
  # ======================================================================= #
  return unless can_we_continue?
  return if an_error_has_occurred?
  return if do_not_strip_the_binaries?
  # ======================================================================= #
  # First, we must determine whether we will use the strip command or
  # whether we will not. Presently, we will use the strip command if
  # the user_prefix either includes the programs directory - or if
  # we use a path that is NOT using /usr as part of its prefix.
  #
  # As of January 2019, the above has been changed - we will only use
  # this if the real prefix includes the programs directory. Any other
  # prefixes will be ignored.
  #
  # As of December 2019, the method also has to check whether
  # real_prefix? returns a value other than nil (or false). The
  # reason for this is because RBT::Installer is able to respond
  # to --no-prefix again, so this requires more checks.
  # ======================================================================= #
  if real_prefix? and real_prefix?.include?(programs_dir?) # or
     # !real_prefix?.include?('/usr')
    _ = rds(real_prefix?.to_s+'/bin/')
    # ===================================================================== #
    # Next obtain all entries in the bin/ subdirectory there. This may
    # lead to wrong results, though, as it may also include other files
    # if we are not careful.
    # ===================================================================== #
    all_files_in_the_bin_subdirectory = Dir["#{_}*"]
    # ===================================================================== #
    # Since as of 01.02.2019 we will only keep entries that are also
    # registered under "binaries:" in the corresponding .yml file.
    # This was specifically done to prevent running strip on e. g.
    # /usr/bin/* or /root/bin/*.
    # ===================================================================== #
    binaries = binaries?
    all_files_in_the_bin_subdirectory.select! {|entry|
      binaries.include?(File.basename(entry))
    }
    strip_command = "strip #{strip_how.lstrip}"
    unless all_files_in_the_bin_subdirectory.empty?
      how_many = sfancy(all_files_in_the_bin_subdirectory.size.to_s)
      # =================================================================== #
      # Notify the user how many executables will be modified
      # through strip next.
      # =================================================================== #
      text = "Next running \"#{sfancy(strip_command)}\" on".dup
      if all_files_in_the_bin_subdirectory.size > 1
        text << ' all'
      end
      text << ' '+how_many # Add the number here.
      if all_files_in_the_bin_subdirectory.size > 1
        text << ' binaries.'
      else
        text << ' binary.'
      end
      # =================================================================== #
      # Display our findings to the user next:
      # =================================================================== #
      opne text
      all_files_in_the_bin_subdirectory.each {|this_file|
        # ================================================================= #
        # The following command will usually run:
        #   "strip --strip-unneeded *"
        # ================================================================= #
        cmd = "#{strip_command} #{this_file}"
        opne "  #{sfancy(cmd)}"
        system(cmd) 
      }
    end
  end
end
do_the_dependencies_include_this_program?( i = compile_which_program? ) click to toggle source
#

do_the_dependencies_include_this_program?

This method can be used to check whether the dependencies include a given program at hand (the input).

Keep in mind that dependencies can be written in either “name” or “name >= 1.2.3” style. So we also have to check for the second possibility there.

#
# File lib/rbt/installer/misc.rb, line 4700
def do_the_dependencies_include_this_program?(
    i = compile_which_program?
  )
  dependencies = required_dependencies_on?
  # ======================================================================= #
  # Simplify the dependencies next.
  # ======================================================================= #
  dependencies.map! {|entry|
    if entry.include?(' >') or entry.include?(' <')
      entry = entry.split(' ').first.strip
    end
    entry
  }
  dependencies.include? i
end
do_these_logic_steps(*array) click to toggle source
#

do_these_logic_steps (logic tag)

This is a “meta”-method - it bundles different logic-steps together.

#
# File lib/rbt/installer/misc.rb, line 10041
def do_these_logic_steps(*array)
  flattened = array.flatten
  flattened.each {|this_entry|
    case this_entry
    # ======================================================================= #
    # === :consider_applying_a_patch
    # ======================================================================= #
    when :consider_applying_a_patch
      consider_applying_a_patch
    # ======================================================================= #
    # === :consider_creating_the_appdir
    # ======================================================================= #
    when :consider_creating_the_appdir
      consider_creating_the_appdir_skeleton
    else # else assume a method-call as-is.
      send(this_entry.to_sym)
    end
  }
end
Also aliased as: do_this_logic_step
do_this_logic_step(*array)
do_upgrade_from_this_file(i) click to toggle source
#

do_upgrade_from_this_file

This method can be used to read input from a file, in order to determine which programs are to be compiled.

#
# File lib/rbt/installer/misc.rb, line 11508
def do_upgrade_from_this_file(i)
  case i # case tag
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default, :def
    i = 'these_programs_can_be_upgraded.yml'
  end
  if File.exist? i
    if i.end_with? '.yml'
      dataset_to_use = load_yaml(i)
    else
      dataset_to_use = File.readlines(i).map {|line| line.strip }
    end
    _ = dataset_to_use
    _ = _.join(', ') if _.is_a? Array
    opne "We will use this dataset: #{slateblue(_)}"
    set_compile_these_programs(dataset_to_use)
  else
    opne "No file called #{sfile(i)} appears to exists."
  end
end
do_upload_binaries() click to toggle source
#

do_upload_binaries

#
# File lib/rbt/installer/misc.rb, line 12358
def do_upload_binaries
  @internal_hash[:upload_binaries] = true
end
do_upload_ruby_binary() click to toggle source
#

do_upload_ruby_binary

To invoke this, try:

rbt --upload-ruby-binary
#
# File lib/rbt/installer/misc.rb, line 5582
def do_upload_ruby_binary
  ensure_that_the_log_directory_exists
  # ======================================================================= #
  # Obtain the path to the local ruby version in use:
  # ======================================================================= #
  path_to_ruby = "#{programs_dir?}Ruby/"
  base_directory_to_upload = "#{path_to_ruby}Current" # This is a symlink.
  ruby_version = File.readlink(base_directory_to_upload)
  cd log_dir?
  _ = path_to_ruby+ruby_version+'/' # This is the full, real path.
  # ======================================================================= #
  # Next, use tar to create an archive.
  # ======================================================================= #
  readelf_command_to_use  = "readelf -h #{_}bin/ruby"
  binary_32_bit_or_64_bit = `#{readelf_command_to_use}`
  binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.split(N).select {|line|
    line.include? 'Class:'
  }
  binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.to_s.dup
  binary_32_bit_or_64_bit =~ /(\d+)/
  binary_32_bit_or_64_bit = $1.to_s.dup+'-bit'
  e "We will put this archive into `#{sdir(return_pwd)}`."
  name_of_the_ruby_archive = 'ruby-'+ruby_version+'-'+binary_32_bit_or_64_bit+'.tar.xz'
  _ = 'tar cfJv '+name_of_the_ruby_archive+' '+_
  run_this_system_command_in_a_coloured_and_padded_manner(_)
  _ = (return_pwd+name_of_the_ruby_archive).squeeze '/'
  if File.exist? _
    e 'The file now resides at `'+sfile(_)+'`.'
    do_binary_upload_of_this_file(_) # Here we finally upload the archive.
  else
    e 'Some error appears to have happened - no archive at '+sfile(_)
    e ' could be found.'
  end
end
do_use_a_build_directory( be_verbose = true )
do_use_a_white_background() click to toggle source
#

do_use_a_white_background

We will silently assume that the user has a white background, and will re-assign to use a green font colour in this case, on KDE Konsole.

#
# File lib/rbt/installer/misc.rb, line 13498
def do_use_a_white_background
  ::Colours.table_colour_methods_to_specific_colour[:simp] = :seagreen
end
do_use_an_appdir_prefix( program_name_and_program_version = program_name_and_program_version?, be_verbose = true )
do_use_appdir_prefix() click to toggle source
#

do_use_appdir_prefix

This method will call do_compile_in_a_non_traditional_way, but it will always be quiet.

#
# File lib/rbt/installer/misc.rb, line 1032
def do_use_appdir_prefix
  do_compile_in_a_non_traditional_way(:be_quiet)
end
do_use_autoconf() click to toggle source
#

do_use_autoconf

This method enables the use of autoconf for the current invocation run.

#
# File lib/rbt/installer/misc.rb, line 9743
def do_use_autoconf
  @internal_hash[:use_autoconf] = true
  opne "We will #{steelblue('invoke autoconf')}."
end
do_use_autogen( use_this_cmd = "sh click to toggle source
#

do_use_autogen

This invokes the autogen script, by using ‘sh’.

In oldschool shell script code, this means that we will run the following command:

sh autogen.sh
#
# File lib/rbt/installer/misc.rb, line 6551
def do_use_autogen(
    use_this_cmd = "sh #{FILE_AUTOGEN}" # " #{SHELL_ERROR_CODE}"
  )
  cliner {
    _ = return_pwd
    opne simp('Doing `')+sfancy(use_this_cmd)+simp('` from ')+sdir(_)
    opne simp('using the following command:')
    opn; efancy "  #{use_this_cmd}"
  }
  `#{use_this_cmd}`
end
do_use_build_directory( be_verbose = true ) click to toggle source
#

do_use_build_directory

Use this method to specifcally “tell” a program to do use a build directory. For cmake-based projects it is recommended to use a build directory.

Usage example:

ry htop build
#
# File lib/rbt/installer/build_directory.rb, line 74
def do_use_build_directory(
    be_verbose = true
  )
  case be_verbose
  # ======================================================================= #
  # === :be_verbose
  # ======================================================================= #
  when :be_verbose
    be_verbose = true
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'A build directory will be used.'
  end
  @internal_hash[:use_build_directory] = true
end
do_use_clang_compiler( shall_we_notify_the_user = :notify_the_user )
do_use_cmake() click to toggle source
#

do_use_cmake

If you wish to use cmake, you can do so via this method here.

#
# File lib/rbt/installer/misc.rb, line 13541
def do_use_cmake
  opne "We will use #{steelblue('cmake')} rather than make."
  set_use_this_make_command 'cmake'
end
Also aliased as: use_cmake
do_use_gcc_compiler( shall_we_notify_the_user = :notify_the_user )
do_use_glib_schema() click to toggle source
#

do_use_glib_schema

Use this method to enable the use of a glib-schema.

#
# File lib/rbt/installer/misc.rb, line 1623
def do_use_glib_schema
  @internal_hash[:use_glib_schema] = true
end
do_use_gobolinux_symlinkprogram(be_verbose = true) click to toggle source
#

do_use_gobolinux_symlinkprogram

#
# File lib/rbt/installer/misc.rb, line 14631
def do_use_gobolinux_symlinkprogram(be_verbose = true)
  if be_verbose
    opne 'Using the GoboLinux SymlinkProgram rather than '\
         'the internal RBT::SymlinkProgram script.'
  end
  @internal_hash[:use_gobolinux_symlinkprogram] = true
end
do_use_libdir() click to toggle source
#

do_use_libdir

#
# File lib/rbt/installer/misc.rb, line 10434
def do_use_libdir
  append_this_to_the_configure_options(:libdir)
end
do_use_libdir64() click to toggle source
#

do_use_libdir64

This method essentially equals to passing the configure flag –libdir64 to ./configure.

#
# File lib/rbt/installer/misc.rb, line 10427
def do_use_libdir64
  append_this_to_the_configure_options(:libdir64)
end
do_use_meson() click to toggle source
#

do_use_meson

This method will allow us to use meson. It will, on roebe systems, also try to use Python 3 if it is not the main one in use.

#
# File lib/rbt/installer/misc.rb, line 5262
def do_use_meson
  use_utf8_encoding_in_env
  set_use_this_configure_command(:meson)
  set_use_this_build_directory('build')
  consider_enabling_python3
end
do_use_meson_and_ninja() click to toggle source
#

do_use_meson_and_ninja

#
# File lib/rbt/installer/misc.rb, line 5279
def do_use_meson_and_ninja
  do_use_meson
  do_use_ninja_as_the_build_system
end
do_use_ninja_as_the_build_system() click to toggle source
#

do_use_ninja_as_the_build_system

#
# File lib/rbt/installer/misc.rb, line 5272
def do_use_ninja_as_the_build_system
  set_use_this_make_command(:ninja)
end
do_use_python2( shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?) )
do_use_python3( shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?) )
do_use_random_build_directory( be_verbose = true ) click to toggle source
#

do_use_random_build_directory

This method can be used to use an ad-hoc random build directory.

#
# File lib/rbt/installer/build_directory.rb, line 278
def do_use_random_build_directory(
    be_verbose = true
  )
  the_alphabet = ('a'..'z').to_a
  use_this_as_the_new_name = ''.dup
  n_times = (8..16).to_a.sample
  n_times.times {
    use_this_as_the_new_name << the_alphabet.sample
  }
  if be_verbose
    opne "We will use a #{lightgreen('random directory')} as "\
         "build directory (#{sfancy(use_this_as_the_new_name)})."
  end
  do_use_build_directory :be_quiet
  set_name_for_the_build_directory(use_this_as_the_new_name)
end
do_use_random_version( this_program = compile_which_program? ) click to toggle source
#

do_use_random_version

Use a random version of a program.

Usage example:

ry gcc --use-random-version
#
# File lib/rbt/installer/misc.rb, line 9986
def do_use_random_version(
    this_program = compile_which_program?
  )
  require 'rbt/utility_scripts/check_for_available_versions.rb'
  cfav = RBT::Cookbooks::CheckForAvailableVersions.new(this_program)
  available_programs = cfav.programs?.map {|entry| File.basename(entry) }
  _ = available_programs.sample
  opne "We will use another version (for program #{simp(_)})"
  dataset?.set_complex_program_version(_) # This here sets the new version.
end
do_use_root_prefix() click to toggle source
#

do_use_root_prefix

#
# File lib/rbt/installer/misc.rb, line 63
def do_use_root_prefix
  set_user_prefix('/root/')
end
do_use_the_blfs_instructions_for_compiling_this_program( this_program = compile_which_program? ) click to toggle source
#

do_use_the_blfs_instructions_for_compiling_this_program

#
# File lib/rbt/installer/misc.rb, line 13819
def do_use_the_blfs_instructions_for_compiling_this_program(
    this_program = compile_which_program?
  )
  require 'rbt/linux/linux_from_scratch/parse_blfs_webpage.rb'
  _ = return_dataset_from_this_remote_blfs_page(this_program)
  _ = RBT::Linux::ParseBlfsWebpage.new(_).shell_commands?
  initialize_dataset_for(this_program)
  program_path = yaml_dataset?.program_path?
  if File.exist? program_path
    extract_what_to(program_path, :default)
    # ===================================================================== #
    # Next we must cd to the correct target, before making use of
    # the BLFS instructions.
    # ===================================================================== #
    cd_target = extracted_directory?+program_name_and_program_version?
    cd cd_target
    opne "We are in the directory #{sdir(return_pwd)}."
    e
    opne 'Next, the '+steelblue('BLFS instructions')+
         ' acquired will be run as-is:'
    e
    esystem _
  else
    opnn; no_file_exists_at(program_path)
  end
end
do_use_the_clang_compiler( shall_we_notify_the_user = :notify_the_user ) click to toggle source
#

do_use_the_clang_compiler

Use this method if you wish to make use of the (LLVM) clang compiler rather than gcc.

Do note that you can also use special arguments or combine clang with ccache, such as shown in the following examples:

export CC='ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'

Invocation example:

ry htop --clang
#
# File lib/rbt/installer/misc.rb, line 9088
def do_use_the_clang_compiler(
    shall_we_notify_the_user = :notify_the_user
  )
  case shall_we_notify_the_user
  # ======================================================================= #
  # === :notify_the_user
  # ======================================================================= #
  when :notify_the_user,
       :and_notify_the_user
    opne "We will attempt to use (#{teal('LLVM')}) #{slateblue('clang')} "\
         "to compile the code at hand."
  end
  set_this_env_variable 'CC=clang',    :be_quiet
  set_this_env_variable 'CXX=clang++', :be_quiet
  @internal_hash[:compiler_to_use] = :clang # Keep track of the compiler here.
end
Also aliased as: do_use_clang_compiler
do_use_the_gcc_compiler( shall_we_notify_the_user = :notify_the_user ) click to toggle source
#

do_use_the_gcc_compiler

Use this method if you wish to make use of the GCC compiler.

Invocation example:

ry htop --use-gcc
#
# File lib/rbt/installer/misc.rb, line 8538
def do_use_the_gcc_compiler(
    shall_we_notify_the_user = :notify_the_user
  )
  case shall_we_notify_the_user
  # ======================================================================= #
  # === :notify_the_user
  # ======================================================================= #
  when :notify_the_user,
       :and_notify_the_user
    opne "We will attempt to use #{teal('gcc')} to compile the "\
         "code at hand."
  end
  set_this_env_variable 'CC=gcc',    :be_quiet
  set_this_env_variable 'CXX=g++', :be_quiet
  @internal_hash[:compiler_to_use] = :gcc # Keep track of the compiler here.
end
Also aliased as: do_use_gcc_compiler
do_we_check_whether_the_program_exists?()
do_we_compile_statically?()
Alias for: build_static?
do_we_use_a_build_directory?()
do_we_use_any_prefix?() click to toggle source
#

do_we_use_any_prefix?

#
# File lib/rbt/installer/misc.rb, line 8999
def do_we_use_any_prefix?
  @internal_hash[:use_a_prefix]
end
do_we_use_python3?() click to toggle source
#

do_we_use_python3?

This method will return true if we use python version 3 or higher, and false otherwise.

#
# File lib/rbt/installer/misc.rb, line 7615
def do_we_use_python3?
  version = `python -V #{SHELL_ERROR_CODE}`.chomp
  if version.include? ' '
    version = version.split(' ').last
  end
  version.start_with? '3' # ← This check has to suffice for now.
end
do_we_use_the_meson_build_system?()
does_a_python_binary_exist?() click to toggle source
#

does_a_python_binary_exist?

This method will return true if a “python” binary can be found in the PATH variable - and it will return false otherwise.

#
# File lib/rbt/installer/misc.rb, line 7475
def does_a_python_binary_exist?
  _ = false
  check_these_directories = query_path?
  if check_these_directories.is_a?(String) and
     check_these_directories.include?(':')
    splitted = check_these_directories.split(':')
    splitted.each {|this_path|
      target = rds(this_path+'/python')
      if File.exist?(target)
        _ = true
      end
    }
  end
  _
end
does_the_program_have_to_be_compiled?()
does_this_file_exist?( this_file = FILE_SCONS ) click to toggle source
#

does_this_file_exist?

This method checks whether the given-input argument, an assumed path to a file, exists.

The reason why this method exists is because it was necessary to do a “does this file exist” check in other directories rather than the current working directory.

#
Calls superclass method RBT::Base#does_this_file_exist?
# File lib/rbt/installer/misc.rb, line 5014
def does_this_file_exist?(
    this_file = FILE_SCONS
  )
  this_file = this_file.dup # ← We must always work on a copy.
  # ======================================================================= #
  # We have to check whether the cookbook_dataset has been initialized.
  # If it has not been initialized yet, we will not query whether we
  # ought to use a build directory or not.
  # ======================================================================= #
  if cookbook_dataset? and use_build_directory?
    this_file.prepend('../')
  end
  super(this_file)
end
dont_make_install( be_verbose = false )
download( url_for_program = url1?, may_we_download = may_we_download?, change_to_this_directory = cookbook_dataset_base_dir?, shall_we_update_the_dataset = true )
Alias for: download_program
download_program( url_for_program = url1?, may_we_download = may_we_download?, change_to_this_directory = cookbook_dataset_base_dir?, shall_we_update_the_dataset = true ) click to toggle source
#

download_program (download tag, download archive, wget tag)

The method ‘download_program` will attempt to download the given program, which is the first argument passed to this method.

An URL is expected as argument here, a String, such as

'https://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz'

An Array can also be used as argument to this method. Internally the method here will make use of an Array, anyway.

For this download-related activity, we will either use a plain system() call to “wget” or we may use a ruby wget-wrapper. On Linux or BSD-based systems ‘wget’ may be simpler to use. On windows we may have to use a ruby-variant of ‘wget’ instead.

Do note that the method download_program() will always assume that the first argument given is an Array - that is, an Array of multiple urls. It will download all passed remote programs in a batch-like operation. This allows the user to, for example, download the whole KDE stack, in principle, by simply passing the Array of remote entries that constitute that KDE stack.

Please keep in mind that we will change_directory() in this method too, so you don’t have to call that on your own.

As of 05 September 2014 the method will also honour the “do_not_download” setting, if it was defined. This can be overruled in the arguments passed to this method.

The method here is used primarily to handle downloading of remote files.

#
# File lib/rbt/installer/misc.rb, line 6958
def download_program(
    url_for_program             = url1?,
    may_we_download             = may_we_download?,
    change_to_this_directory    = cookbook_dataset_base_dir?,
    shall_we_update_the_dataset = true
  )
  url_for_program = [url_for_program].flatten.compact
  # ======================================================================= #
  # We will handle some special Symbols next:
  # ======================================================================= #
  case shall_we_update_the_dataset
  # ======================================================================= #
  # === :do_not_update_the_dataset
  # ======================================================================= #
  when :do_not_update_the_dataset
    shall_we_update_the_dataset = false
  end
  case may_we_download
  # ======================================================================= #
  # === :do_download
  # ======================================================================= #
  when :do_download,
       :we_may_download
    may_we_download = true
  end
  case change_to_this_directory
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    change_to_this_directory = cookbook_dataset_base_dir?
  end
  change_to_this_directory = change_to_this_directory.to_s
  if is_on_roebe?
    unless change_to_this_directory.start_with? '/home/x/'
      this_file = RBT.file_source_directory?
      if File.exist? this_file
        if File.read(this_file).start_with? '$'
          # This is a small safeguard for my home system.
          opne 'The base directory does not seem to refer to '+
                sdir('/home/x/')
          opne 'as a base. Has the environment been properly set up?'
          return
        end
      else
        opnn; no_file_exists_at(this_file)
      end
    end  
  end
  url_for_program.each {|use_this_remote_url|
    if may_we_download
      url_for_program = use_this_remote_url
      url_for_program = url1? if url_for_program == :def
      # ======================================================================= #
      # Since Jul 2011 we use pure wget for this. Something is odd with
      # RubyWget and until we have fixed this, plain wget has to be used.
      # ======================================================================= #
      use_svn = dataset?.svn_url?
      # ======================================================================= #
      # Check whether the base directory exists.
      # ======================================================================= #
      if !File.exist?(change_to_this_directory)
        opne simp('Creating the directory `')+
             sdir(change_to_this_directory)+
             simp('` next.')
        create_directory(change_to_this_directory)
      end
      # ======================================================================= #
      # Change into the base directory first, before continuing to try
      # to download the archive in question.
      # ======================================================================= #
      change_directory(change_to_this_directory) # cd into the archive.
      # ======================================================================= #
      # Change into the archive. Be verbose about it.
      # ======================================================================= #
      cliner {
        opne "#{simp('Downloading ')}#{sfile(url_for_program)}"
        opne simp('into the directory ')+sdir(change_to_this_directory)+
             simp(' now.')
      }
      if url_for_program.to_s.include? 'tar.gz'
        # overrule here for .tar.gz files.
        _ = cookbook_dataset? #.data
        _.set_archive_type('.tar.gz')
        _.set_program_full_name
        _.assemble_program_path
        set_cookbook_dataset(
          cookbook_dataset?.return_dataset
        )
      end
      if use_svn.nil? or use_svn.empty? # Assume no SVN was given. bl rubywget
        do_download_this_program(url_for_program)
        # RubyWget.new(url_for_program)
      else # Else, we should use svn perhaps? Hmm or not.
        if _
          do_download_this_program(_)
        else
          do_download_this_program(url_for_program)
        end
        # RubyWget.new(_)
      end
      if shall_we_update_the_dataset
        # ================================================================= #
        # We will update the dataset as well.
        # ================================================================= #
        yaml_dataset = load_yaml_dataset_for_this_program(
          program_information_return_name(url_for_program), :return_flat_datastructure
        )
        assign_to_the_main_dataset(
          yaml_dataset
        )
      end
    end
  }
end
Also aliased as: download
download_the_latest_source_code_of_this_program( i = compile_which_program? ) click to toggle source
#

download_the_latest_source_code_of_this_program

This method can be used to do a git clone checkout.

To try this method, invoke it like this:

ry mpv --git-download
#
# File lib/rbt/installer/misc.rb, line 10115
def download_the_latest_source_code_of_this_program(
    i = compile_which_program?
  )
  old_directory_content = Dir['*'].select {|entry| File.directory? entry }
  if compile_which_program?.nil?
    initialize_dataset_for(i)
  end
  _ = git_url?
  if _.nil? or _.empty?
    opne tomato('No remote git-URL is known for `'+i.to_s+'`.')
    opne tomato('Consider adding such an entry to the .yml '\
         'file at hand.')
    return
  end
  # ======================================================================= #
  # Notify the user that we are about to download a remote package next:
  # ======================================================================= #
  opne "#{rev}Next trying to #{royalblue('download')} for #{simp(i)}"
  opne "from the remote URL #{steelblue(_)}."
  # ======================================================================= #
  # Invoke the git-command next:
  # ======================================================================= #
  e
  run_this_system_command_in_a_coloured_and_padded_manner("git clone #{_}")
  e
  new_directory_content = Dir['*'].select {|entry| File.directory? entry }
  difference = new_directory_content - old_directory_content
  unless difference.empty?
    case difference.size
    when 1
      # =================================================================== #
      # Currently we only handle one entry here.
      # =================================================================== #
      this_directory = difference.first
      opne 'A directory was found at '+
            sdir(File.absolute_path(this_directory))+'.'
      new_name = this_directory+'-'+return_current_time
      opne 'It will be renamed next, to '+sdir(new_name)+'.'
      opne 'Finally, it will be made into a .tar.xz file.'
      rename(this_directory, new_name)
      to_tar_xz(new_name)
      if is_on_roebe?
        opne 'You may be able to remove the directory at '+
             sdir(File.absolute_path(new_name))+' now.'
      end
    end
  end
end
download_the_remote_documentation_of_the_RBT_project( remote_URL = 'https://www.rubydoc.info/gems/rbt/' ) click to toggle source
#

download_the_remote_documentation_of_the_RBT_project

This method will download the documentation of the RBT project for local use.

Usage example:

rbt --download-docu
#
# File lib/rbt/installer/misc.rb, line 12986
def download_the_remote_documentation_of_the_RBT_project(
    remote_URL = 'https://www.rubydoc.info/gems/rbt/'
  )
  opne "Now downlading from the remote URL at `#{steelblue(remote_URL)}`."
  dataset = URI.open(remote_URL).read
  into = File.absolute_path('rbt_documentation.html')
  write_what_into(dataset, into)
  if File.exist? into
    opne 'Storing into the local file at '+sfile(into)+'.'
  end
end
download_this_remote_program(i)
download_this_remote_url_into_that_local_directory( url = url1?, local_directory = '/home/Temp/downloads/' ) click to toggle source
#

download_this_remote_url_into_that_local_directory

The first argument should be the remote URL to the program at hand.

The second argument should be a local directory.

#
# File lib/rbt/installer/misc.rb, line 10172
def download_this_remote_url_into_that_local_directory(
    url             = url1?,
    local_directory = '/home/Temp/downloads/'
  )
  local_directory = local_directory.dup if local_directory.frozen?
  local_directory << '/' unless local_directory.end_with? '/'
  unless File.directory? local_directory
    create_directory(local_directory) { :be_verbose }
  end
  cd local_directory # change directory into that target
  download_program(
    url,
    :we_may_download,
    local_directory,
    :do_not_update_the_dataset
  )
end
download_using_svn( i = compile_which_program? ) click to toggle source
#

download_using_svn

Use this method here to download/checkout from svn. In order for this to properly work, you need to define a svn_url in the yaml file for the respective program at hand.

To try out this method, do:

ry dosbox svn
#
# File lib/rbt/installer/misc.rb, line 9192
def download_using_svn(
    i = compile_which_program?
  )
  dataset = dataset?
  if dataset.nil?
    dataset = initialize_dataset_for(i)
  end
  _ = "svn co #{dataset.svn_url?}"
  working_directory = sdir(return_current_pwd)
  opne "Now trying to use svn to download the source directly "\
       "(working directory is: #{working_directory}."
  opnn; print '  '
  e _
  _result = `#{_}` # We may want to use this return-value at a later time.
  # ======================================================================= #
  # === Rename the trunk directory next
  # ======================================================================= #
  if File.directory? 'trunk'
    _ = "#{i}-#{today?}"
    opne "Now renaming directory `#{sdir('trunk')}` to `#{simp(_)}`."
    rename('trunk', _)
    if Object.const_defined? :ToTarXz
      opne 'Now trying to package the directory `'+sdir(_)+'`.'
      to_tar_xz(_)
      package_name = Dir["#{_}.tar.xz"]
      unless package_name.empty?
        opne 'All should be done now. You can move this .tar.xz '\
             'package ('+simp(package_name.first)+').'
      end
    end
  end
end
ecolourize_this_important_system_command(i) click to toggle source
#

colourize_this_important_system_command

#
# File lib/rbt/installer/misc.rb, line 15426
def ecolourize_this_important_system_command(i)
  e colourize_this_important_system_command(i)
end
edit_the_yaml_file_via_the_main_editor( this_yaml_file = install_which_program?, use_this_editor = editor_to_use? ) click to toggle source
#

edit_the_yaml_file_via_the_main_editor

Invocation example:

rbt --edit-file=nano
#
# File lib/rbt/installer/misc.rb, line 11946
def edit_the_yaml_file_via_the_main_editor(
    this_yaml_file  = install_which_program?,
    use_this_editor = editor_to_use?
  )
  this_yaml_file = this_yaml_file.to_s.dup
  this_yaml_file = 'nano' if this_yaml_file.empty?
  _ = nil # Default.
  # ======================================================================= #
  # Determine which editor to use next:
  # ======================================================================= #
  _ = use_this_editor.to_s.dup+' ' if use_this_editor
  # ======================================================================= #
  # Overrule on my home system.
  # ======================================================================= #
  if is_on_roebe? or _.nil?
    _ = "#{editor?} "
  end
  unless File.exist? this_yaml_file
    unless this_yaml_file.include? '/'
      this_yaml_file = return_location_to_this_programs_yaml_file(this_yaml_file)
    end
  end
  if File.exist? this_yaml_file
    _ << this_yaml_file
  else
    _ << find_this_yaml_file(this_yaml_file)
  end
  coloured_esystem _
end
edit_this_yaml_file_via_the_main_editor( this_yaml_file = install_which_program?, use_this_editor = editor_to_use? )
editor_to_use?() click to toggle source
#

editor_to_use?

#
# File lib/rbt/installer/misc.rb, line 5525
def editor_to_use?
  _ = ENV['EDITOR']
  if _.nil? or _.empty?
    _ = 'bluefish'
  end
  return _
end
either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install() click to toggle source
#

either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install

#
# File lib/rbt/installer/misc.rb, line 11770
def either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install
  if a_program_has_been_initialized?
    report_the_amount_of_binaries
  else
    RBT.report_how_many_binaries_are_registered
  end
end
empty_archive_type() click to toggle source
#

empty_archive_type

This will clear the archive type.

#
# File lib/rbt/installer/misc.rb, line 8877
def empty_archive_type
  cookbook_dataset?.archive_type = ''
end
enable_autogen( be_verbose = true ) click to toggle source
#

enable_autogen

This method will enable autogen.

#
# File lib/rbt/installer/misc.rb, line 13709
def enable_autogen(
    be_verbose = true
  )
  if be_verbose
    opne 'We will make use of autogen.'
  end
  @internal_hash[:use_autogen] = true # Enable the use of autogen in our dataset here.
end
enable_everything_for_the_current_compilation_run() click to toggle source
#

enable_everything_for_the_current_compilation_run

Note that currently we will only work on the “–enable*” entries.

Invocation example:

ry ncurses ntrad --enable-everything --dontsymlink
#
# File lib/rbt/installer/misc.rb, line 8706
def enable_everything_for_the_current_compilation_run
  default_extract_step(
    use_this_local_path: cookbook_dataset?.program_path?
  )
  cd_to_the_extracted_archive
  e 'running ./configure help ...'
  cmd = './configure --help'
  result = `#{cmd}`
  array = result.split(N)
  # ======================================================================= #
  # Entries may look like this:
  #
  #    --enable-symlinks       make tic use symbolic links not hard links\n" +
  #    --with-x11-rgb=FILE   file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)\n" +
  #
  # ======================================================================= #
  selection = array.select {|line|
    splitted = line.split(' ')
    line.start_with?('  --enable-') and
    (splitted[0].downcase == splitted[0]) # ← This checks for all-downcase.
    # ^^^ exclude entries such as "--enable-FEATURE[=ARG]"
  }
  selection = selection.map {|entry|
    entry.split(' ').first.to_s
  }.join(' ').strip
  clear_configure_options
  append_this_to_the_configure_options(selection)
end
enable_is_on_gobolinux() click to toggle source
#

enable_is_on_gobolinux

This method can be used to default to a GoboLinux behaviour.

We should closely follow the behaviour of GoboLinux via the RBT scripts, 1:1 - no need to create incompatibilities at this point.

#
# File lib/rbt/installer/misc.rb, line 11692
def enable_is_on_gobolinux
  # ENV['IS_ON_GOBOLINUX'] = '1' # ← Disabled as of 25.09.2018; we probably no longer need to do this.
  @internal_hash[:is_on_gobolinux] = true
  use_non_traditional_prefix
  do_not_symlink_headers
  do_not_symlink_pkgconfig_files
  do_use_gobolinux_symlinkprogram # ← Trying this as of Oct 2017.
  do_not_register_into_the_yaml_database
end
Also aliased as: is_on_gobolinux
enable_non_traditional_compilation( optional_use_this_as_program_name_and_program_version = program_name_and_program_version? ) click to toggle source
#

enable_non_traditional_compilation

This will essentially switch to app-dir prefix.

#
# File lib/rbt/installer/misc.rb, line 9490
def enable_non_traditional_compilation(
    optional_use_this_as_program_name_and_program_version = 
      program_name_and_program_version?
  )
  if optional_use_this_as_program_name_and_program_version
    @internal_hash[:prefix].set_program(
      optional_use_this_as_program_name_and_program_version
    )
  end
  @internal_hash[:prefix].enable_non_traditional_compilation
end
enable_porg() click to toggle source
#

enable_porg

Enable porg via this method.

#
# File lib/rbt/installer/misc.rb, line 15862
def enable_porg
  @internal_hash[:use_porg] = config?.use_porg = true
end
enable_python2() click to toggle source
#

enable_python3

#
# File lib/rbt/installer/misc.rb, line 7558
def enable_python2
  consider_enabling_python2(true)
end
enable_python3() click to toggle source
#

enable_python3

#
# File lib/rbt/installer/misc.rb, line 7605
def enable_python3
  consider_enabling_python3(true)
end
enable_shared_disable_static() click to toggle source
#

enable_shared_disable_static

#
# File lib/rbt/installer/misc.rb, line 6157
def enable_shared_disable_static
  append_enable_shared_to_the_configure_options
  append_disable_static_to_the_configure_options
end
enable_simulation( optional_message = '' ) click to toggle source
#

enable_simulation

Enable to run in simulation mode. The first argument is an optional message we give, in which case we will output that message.

#
# File lib/rbt/installer/misc.rb, line 7426
def enable_simulation(
    optional_message = ''
  )
  unless optional_message.empty?
    opne optional_message
  end
  do_run_simulation
end
enable_static?()
enable_static_compilation()
enable_stow() click to toggle source
#

enable_stow

This method will enable stow.

#
# File lib/rbt/installer/misc.rb, line 8046
def enable_stow
  configuration?.use_stow = true
  opne 'Enabling stow next.'
  configuration?.save # And store this.
end
enable_traditional_compilation( be_verbose = true, can_we_continue = can_we_continue? )
ensure_cookbooks_object_is_there( i = compile_these_programs?.first )
ensure_dataset_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_proper_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_proper_dataset_for( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_a_cookbook_object_has_been_instantiated( i = compile_these_programs?.first ) click to toggle source
#

ensure_that_a_cookbook_object_has_been_instantiated

#
# File lib/rbt/installer/misc.rb, line 5828
def ensure_that_a_cookbook_object_has_been_instantiated(
    i = compile_these_programs?.first
  )
  if cookbook_for?.nil?
    initialize_a_new_cookbook_instance(i)
  end
end
ensure_that_a_dataset_exists_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_all_directories_for_rbt_exist() click to toggle source
#

ensure_that_all_directories_for_rbt_exist

This is a separate method because we may want to create more than just one directory in the future.

#
# File lib/rbt/installer/misc.rb, line 6090
def ensure_that_all_directories_for_rbt_exist
  ensure_that_the_log_directory_exists
end
ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation() click to toggle source
#

ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation

#
# File lib/rbt/installer/misc.rb, line 2864
def ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation
  _ = configure_options?.dup
  if compile_statically?
    unless _.include? '--enable-static'
      _ << ' --enable-static' # Just to be safe.
    end
    if _.include?('--enable-static') and not
       (_.include?('--disable-shared'))
      _ << ' --disable-shared' unless _.include?('--enable-shared')
    end
    if _.include?('--enable-shared') and
       _.include?('--enable-static')
      set_configure_options(
        _.sub(/--enable-shared/, '--disable-shared')
      )
      sort_configure_options_alphabetically
    end
  end
end
ensure_that_the_cookbook_dataset_exists( i = compile_these_programs?.first )
ensure_that_the_cookbook_dataset_is_there( i = compile_which_program? ) click to toggle source
#

ensure_that_the_cookbook_dataset_is_there

#
# File lib/rbt/installer/misc.rb, line 8185
def ensure_that_the_cookbook_dataset_is_there(
    i = compile_which_program?
  )
  if cookbook_dataset?.nil?
    initialize_dataset_for(i)
  end
end
ensure_that_the_dataset_exists( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_the_dataset_exists_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_the_default_dataset_exists_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_the_log_directory_exists() click to toggle source
#

ensure_that_the_log_directory_exists

This method will ensure that the log directory, usually the one at “/Depot/Temp/rbt/”, exists.

#
# File lib/rbt/installer/misc.rb, line 6079
def ensure_that_the_log_directory_exists
  _ = log_directory?
  mkdir(_) unless File.directory? _
end
ensure_that_the_main_dataset_exists( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_that_the_program_exists( i ) click to toggle source
#

ensure_that_the_program_exists

This method will control whether we can continue to run.

We can continue to run if the program exists as part of the cookbooks project. One exception to this rule is when the last character is a ‘*’ token. In this case we assume that he user wants to simply get a list of available programs instead, starting with that specific name, e. g. “e*” should yield a list of all programs starting with the character “e”.

You can try this out by doing:

ry e*
#
# File lib/rbt/installer/misc.rb, line 5857
def ensure_that_the_program_exists(
    i
  )
  i = i.to_s
  if honour_check_to_ensure_that_the_program_exists?
    unless cookbooks_include_this_program?(i)
      # =================================================================== #
      # Handle not-registered programs next:
      # =================================================================== #
      opne "#{crimson('The program `')}#{seagreen(i)}"\
           "#{crimson('` could not be found. It thus can not be compiled')}"
      opne crimson('and hence, RBT::Installer can not continue. If this '\
           'file should exist,')
      opne crimson('it can be found at:')
      e
      e "  #{sfile(return_location_to_this_programs_yaml_file(i))}"
      e
      we_can_not_continue
    end unless i.end_with? '*'
  end
  return can_we_continue?
end
ensure_that_this_key_has_a_dataset( i = compile_these_programs?.first )
ensure_that_we_can_extract_to_a_proper_directory() click to toggle source
#

ensure_that_we_can_extract_to_a_proper_directory

#
# File lib/rbt/installer/misc.rb, line 6067
def ensure_that_we_can_extract_to_a_proper_directory
  if extract_to?.to_s.empty?
    set_extract_to(temp_directory?)
  end
end
ensure_that_we_have_a_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
ensure_there_exists_a_proper_dataset( i = compile_these_programs?.first )
env?() click to toggle source
#

env?

#
# File lib/rbt/installer/misc.rb, line 3516
def env?
  ENV
end
erroneous_libtool_entries?()
error_is( this_error = :meson_could_not_be_found ) click to toggle source
#

error_is (error_is tag)

This registered an error. An error is always a problem, but some problems allow us to continue the installation steps. An error on the other hand will end the installation procedure.

#
# File lib/rbt/installer/misc.rb, line 9310
def error_is(
    this_error = :meson_could_not_be_found
  )
  problem_is(this_error)
  an_error_has_occurred
  # ======================================================================= #
  # Register the error on the main RBT namespace as well.
  # ======================================================================= #
  RBT.append_error_message(
    this_error
  )
end
error_is?()
Alias for: error_message?
error_message?() click to toggle source
#

error_message?

#
# File lib/rbt/installer/misc.rb, line 4602
def error_message?
  RBT.error_message?
end
Also aliased as: error_is?
errors?() click to toggle source
#

errors?

#
# File lib/rbt/installer/misc.rb, line 10592
def errors?
  RBT::Errors::MapLineToASpecificError.registered_errors?.uniq
end
erun_this_sys_command(i) click to toggle source
#

erun_this_sys_command

#
# File lib/rbt/installer/misc.rb, line 2440
def erun_this_sys_command(i)
  e i
  run_this_sys_command(i)
end
exit_after_a_rubygem_has_been_installed?() click to toggle source
#

exit_after_a_rubygem_has_been_installed?

#
# File lib/rbt/installer/misc.rb, line 12053
def exit_after_a_rubygem_has_been_installed?
  @internal_hash[:exit_after_a_rubygem_has_been_installed]
end
exit_before_make?() click to toggle source
#

exit_before_make?

#
# File lib/rbt/installer/misc.rb, line 5620
def exit_before_make?
  @internal_hash[:exit_before_make]
end
exit_before_make_install?() click to toggle source
#

exit_before_make_install?

#
# File lib/rbt/installer/misc.rb, line 10928
def exit_before_make_install?
  @internal_hash[:exit_before_make_install]
end
expand_this_cookbook( i = compile_which_program? )
extra_information?() click to toggle source
#

extra_information?

#
# File lib/rbt/installer/misc.rb, line 4647
def extra_information?
  cookbook_for?.extra_information?
end
extract( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_only?() click to toggle source
#

extract_only?

#
# File lib/rbt/installer/misc.rb, line 12127
def extract_only?
  @internal_hash[:extract_only]
end
extract_package( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_program_and_cd_to_the_configure_base_directory() click to toggle source
#

extract_program_and_cd_to_the_configure_base_directory

#
# File lib/rbt/installer/misc.rb, line 7681
def extract_program_and_cd_to_the_configure_base_directory
  do_extract
  cd_to_the_configure_base_directory
end
extract_the_archive?()
extract_the_linux_kernel_archive() click to toggle source
#

extract_the_linux_kernel_archive

To tap into this method from the commandline, do:

ry --extract-linux
#
# File lib/rbt/installer/misc.rb, line 4091
def extract_the_linux_kernel_archive
  result = initialize_cookbook_dataset_for(:linux)
  target = result.extract_to?
  if File.symlink? '/usr/src/linux'
    delete_symlink('/usr/src/linux')
  end
  extract_what_to(
    result.path?, target, :do_keep_the_old_directory_if_it_exists
  )
  e "Finished extracting the linux kernel to #{sdir(target)}."
end
extract_the_program( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false )
Alias for: invoke_extracter
extract_this_archive( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true ) click to toggle source
#

extract_this_archive (extract tag, extracter tag)

This method will extract the given archive directory, by delegating towards class Extracter.

This method ought to be invoked quite early, logically; the method “consider_extracting_this_program()” may be used to invoke this method.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 180
def extract_this_archive(
    i                                                         = cookbook_dataset_program_path?,
    extract_to_this_location                                  = extract_where_to?,
    shall_we_report_to_the_user_if_the_archive_does_not_exist = true
  )
  if File.exist? i
    if run_simulation?
      opne "We would normally extract `#{sfile(i)}` "\
           "to #{sdir(extract_to_this_location)} next,"
      opne 'but since we run in simulation-mode, we will not '\
           'extract anything.'
    else
      _ = "Next trying to extract `#{sfile(i)}`".dup
      _ << ' (but do so silently)' unless show_output_from_the_extracter_class?
      _ << '.'
      opne _
      invoke_extracter( # ← Delegate to invoke_extracter() here.
        i,
        extract_to_this_location # Second argument is the location.
      )
    end
    # ===================================================================== #
    # Next we will exit if the user told us that he/she is only
    # interested in extracting the program.
    # ===================================================================== #
    exit_program if extract_only?
  else
    if shall_we_report_to_the_user_if_the_archive_does_not_exist
      opne swarn('No file could be found at `')+
           sfile(i)+
           swarn('` - thus,')
      opne swarn('we can not extract anything.')
      # =================================================================== #
      # Also set a specific error, so that we won't continue.
      # =================================================================== #
      error_is 'We can not continue. Has the archive '\
               'been properly extracted?'
    end
  end
  return extract_to_this_location # And return it too, in case downstream code needs it.
end
extract_this_archive_then_compile_it( i = first_argument? )
extract_this_program( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_this_program_if_it_exists( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
extract_this_source_archive( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false )
Alias for: invoke_extracter
extract_to( i = RBT.log_directory?, be_verbose = false )
extract_to?()
extract_to_default_directory( i = RBT.log_directory? ) click to toggle source
#

extract_to_default_directory

By default, we will extract to this directory - but the value is lateron refined to the full path instead; so the assignment done here is just so that we have a starting value we can work with.

This method will be called from within the method reset().

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 105
def extract_to_default_directory(
    i = RBT.log_directory?
  )
  @internal_hash[:extract_to_this_directory] = i
end
extract_to_this_dir?()
extract_to_this_directory?() click to toggle source
#

extract_to_this_directory?

This query-method tells us where we will extract (our archive) to.

The temp-directory is initially the same as RBT.rbt_log_directory?.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 118
def extract_to_this_directory?
  _ = @internal_hash[:extract_to_this_directory]
  # ======================================================================= #
  # Allow the user to overrule this value.
  # ======================================================================= #
  if @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
    _ = @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
  end
  return _
end
extract_to_this_directory_being_one_directory_below?() click to toggle source
#

extract_to_this_directory_being_one_directory_below?

This points to the base-directory.

#
# File lib/rbt/installer/misc.rb, line 14170
def extract_to_this_directory_being_one_directory_below?
  _ = extract_to_this_directory?.to_s.dup
  _ = "#{File.dirname(_)}/"
  return _
end
extract_to_which_directory?()
extract_what_to( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false )
Alias for: invoke_extracter
extract_where_to?()
extracted_base_directory?() click to toggle source
#

extracted_base_directory?

If you need to query the value for the path to the extracted directory, then make use of the method extract_to_this_directory? rather than the method here.

#
# File lib/rbt/installer/misc.rb, line 5734
def extracted_base_directory?
  @internal_hash[:extracted_base_directory]
end
extracted_dir?()
extracted_directory?()
extracted_path?()
extracted_towards?()
feedback_all( i = compile_which_program? ) click to toggle source
#

feedback_all

#
# File lib/rbt/installer/misc.rb, line 2156
def feedback_all(
    i = compile_which_program?
  )
  require 'rbt/cookbooks/display_cookbook_dataset/feedback/feedback.rb'
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_all(i)
end
feedback_all_available_formats() click to toggle source
#

feedback_all_available_formats

Invocation example:

ry --feedback_all_available_formats
#
# File lib/rbt/installer/misc.rb, line 15177
def feedback_all_available_formats
  RBT::Cookbooks::SanitizeCookbook.feedback_all_available_formats
end
feedback_all_binaries( this_program = compile_which_program?, report_how = :one_line_per_program )
feedback_all_case_options_of_the_main_menu() click to toggle source
#

feedback_all_case_options_of_the_main_menu

#
# File lib/rbt/installer/misc.rb, line 2133
def feedback_all_case_options_of_the_main_menu
  _ = THIS_FILE
  if File.exist? _
    if Object.const_defined? :CaseParser
      _ = CaseParser.parse(_)
      _.each {|entry|
        e entry
      }
    else
      opne 'The project case_parser is not available. Please install it.'
      e
      opne sfancy('  gem install case_parser')
      e
    end
  else # Else the file does not exist.
    opne "No file at #{sfile(_)} could be found. We "\
         "thus can not use CaseParser."
  end
end
feedback_all_libraries( from_this_program = program? ) click to toggle source
#

feedback_all_libraries

Feedback all libraries from a given program.

#
# File lib/rbt/installer/misc.rb, line 14542
def feedback_all_libraries(
    from_this_program = program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_all_libraries(from_this_program)
end
feedback_all_libraries_and_all_binaries( of_this_program = compile_which_program? ) click to toggle source
#

feedback_all_libraries_and_all_binaries

Invoke this method by issuing:

ry htop installs_what?
#
# File lib/rbt/installer/misc.rb, line 14530
def feedback_all_libraries_and_all_binaries(
    of_this_program = compile_which_program?
  )
  feedback_all_binaries(of_this_program)
  feedback_all_libraries(of_this_program)
end
feedback_all_registered_binaries_of_all_programs() click to toggle source
#

feedback_all_registered_binaries_of_all_programs

This method will show, on the commandline, all registered binaries of all the programs together.

Invocation example:

rbt --all-binaries
#
# File lib/rbt/installer/misc.rb, line 2357
def feedback_all_registered_binaries_of_all_programs
  _ = RBT.registered_binaries?
  opne 'These '+royalblue(_.size.to_s)+' binaries are registered:'
  e
  _.each_with_index {|this_binary, index| index += 1
    padded_index = (index.to_s+') ').rjust(5)
    e "  #{lightgreen(padded_index)}"\
      "#{slateblue(this_binary)}"
  }
  e
end
feedback_configure_options( i = compile_this_program? ) click to toggle source
#

feedback_configure_options

To test this method, try something like this:

ry htop configure_options?
ry gcc configure_options?
#
# File lib/rbt/installer/misc.rb, line 14495
def feedback_configure_options(
    i = compile_this_program?
  )
  opne "The configure options for the program #{sfancy(i)} are:"
  if dataset?.nil?
    ensure_that_we_have_a_dataset(i)
  end
  _ = configure_options?
  e
  e "  #{sfancy(_)}"
  e
end
feedback_default_values_of_the_internal_hash() click to toggle source
#

feedback_default_values_of_the_internal_hash

Invocation example from the commandline:

ry --feedback-the-default-values-of-the-internal-hash
#
# File lib/rbt/installer/misc.rb, line 14473
def feedback_default_values_of_the_internal_hash
  dataset = return_default_internal_hash
  e
  e "The following #{lightblue(dataset.keys.size.to_s)} entries are known:"
  e
  dataset.each_pair {|key, value|
    if value.nil?
      value = 'nil'
    end
    e "  #{slateblue(key)}: #{lightgreen(value)}"
  }; e
end
feedback_dependencies( i = compile_which_program? )
feedback_dependencies_of_the_program( i = compile_which_program? )
feedback_dependencies_of_this_program( i = compile_which_program? ) click to toggle source
#

feedback_dependencies_of_this_program

Feedback the dependencies of a given program through this method.

Invocation example:

ry pango --feedback_dependencies_of_this_program
#
# File lib/rbt/installer/misc.rb, line 15029
def feedback_dependencies_of_this_program(
    i = compile_which_program?
  )
  if dataset?.nil?
    ensure_proper_dataset(i)
  end
  dependencies = dataset?.deps_on?
  unless dependencies.empty?
    cliner
    opne 'The following dependencies were found for `'+sfancy(i)+'`:'
    e
    # =================================================================== #
    # We will next assume that dependencies is an Array.
    # =================================================================== #
    dependencies.each {|dep|
      e "  A dependency on: #{olivedrab(dep)}"
    }
    e
    cliner
  else
    opne "No dependency was found for `#{sfancy(i)}`."
  end
end
feedback_description( i = program_name? )
feedback_expanded_dependencies_of_this_program( i = compile_which_program? ) click to toggle source
#

feedback_expanded_dependencies_of_this_program

#
# File lib/rbt/installer/misc.rb, line 15158
def feedback_expanded_dependencies_of_this_program(
    i = compile_which_program?
  )
  e rev+'The expanded dependencies for '+steelblue(i)+' are:'
  e
  RBT::ReverseDependencies.dependencies?(i).each {|entry|
    e "  #{entry}"
  }
  e
end
feedback_extra_description( of_this_program = program? ) click to toggle source
#

feedback_extra_description

To trigger this method, do:

ry php edesc
#
# File lib/rbt/installer/misc.rb, line 14516
def feedback_extra_description(
    of_this_program = program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_extra_description(of_this_program)
end
feedback_format_specification_of(i) click to toggle source
#

feedback_format_specification_of

#
# File lib/rbt/installer/misc.rb, line 13187
def feedback_format_specification_of(i)
  RBT::Cookbooks::SanitizeCookbook.feedback_format_specification_of(i)
end
feedback_last_compiled( i = :all_of_them ) click to toggle source
#

feedback_last_compiled

There are several ways how to invoke this method. We thus need to be rather flexible about feedbacking this to the user.

One of the first distinctions will be whether we have a ‘=’ token in the input or whether we do not.

Examples:

rbt --last-compiled?
rbt --last-5-compiled?
rbt --last-five-compiled?
rbt --last-compiled?=5
rbt --last-compiled?=6
#
# File lib/rbt/installer/misc.rb, line 14957
def feedback_last_compiled(
    i = :all_of_them
  )
  i = i.first if i.is_a? Array # Grab the first entry.
  # ======================================================================= #
  # Next, we determine the dataset of which programs have been compiled.
  # ======================================================================= #
  dataset = compiled_programs?
  dataset = dataset.keys if dataset.respond_to? :keys
  case i
  when :all_of_them
    i = dataset.size
  end
  unless dataset
    opne 'No dataset was found in this file: '+sfile(file_compiled_programs?)
    return
  end
  show_n_programs = 1 # This is the default.
  if i.to_s =~ /^\d+$/
    show_n_programs = i.to_i
  end
  if i and i.to_s.include?('=')
    splitted = i.split('=')
    show_n_programs = splitted.last.to_i
  elsif (show_n_programs > 1)
    # pass through in this case
  else # Else it does not include a '='.
    regex_to_use = /--last(-\d+-)compiled\?/
    i =~ regex_to_use
    show_n_programs = $1.to_s.dup.delete('-').to_i if $1
    array = HASH_ENGLISH_NUMBERS.keys
    if array.any? {|entry| i.include? entry }
      result = array.select {|entry| i.include? entry }
      result = result.first unless result.empty?
      # =================================================================== #
      # Now we must convert this:
      # =================================================================== #
      result = HASH_ENGLISH_NUMBERS[result]
      show_n_programs = result.to_i
    end
  end
  # ======================================================================= #
  # Narrow our dataset down.
  # ======================================================================= #
  if show_n_programs > dataset.size
    opne 'We have not kept track of that many ('+
          sfancy(show_n_programs.to_s)+') registered programs, so'
    opne "only #{dataset.size.to_s} programs will be shown instead."
    show_n_programs = dataset.size
  end
  dataset = dataset.reverse[0 .. (show_n_programs - 1)].reverse
  e
  opne "The last #{simp(show_n_programs.to_s)} compiled "\
       "programs (most recent one comes first) were:"
  # ======================================================================= #
  # Now we can report this dataset, which contains our programs.
  # ======================================================================= #
  e; dataset.reverse.each {|key|
    e "  #{sfancy(key)}"
  }; e
end
feedback_licenses( filter_for_licenses = '*' ) click to toggle source
#

feedback_licenses

This will feedback all licenses, or apply a filter.

Usage example:

ry htop flicenses
#
# File lib/rbt/installer/misc.rb, line 2059
def feedback_licenses(
    filter_for_licenses = '*'
  )
  RBT::Cookbooks::FeedbackLicenses.new(filter_for_licenses) # bl $RUBY_COOKBOOKS/lib/cookbooks/feedback_licenses.rb
end
feedback_local_base( i = compile_which_program? ) click to toggle source
#

feedback_local_base

Feedback which local base directory is used for a particular program.

#
# File lib/rbt/installer/misc.rb, line 14932
def feedback_local_base(
    i = compile_which_program?
  )
  RBT::Cookbooks::DisplayCookbookDataset.feedback_local_base(i)
end
feedback_local_location( i = compile_which_program? ) click to toggle source
#

feedback_local_location

Invoke this like:

ry htop feedback_local_location
#
# File lib/rbt/installer/misc.rb, line 14566
def feedback_local_location(
    i = compile_which_program?
  )
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_local_location(i)
end
feedback_main_config() click to toggle source
#

feedback_main_config

In order to invoke this method, do:

rbt config?
#
# File lib/rbt/installer/misc.rb, line 2215
def feedback_main_config
  opne 'We will show the configuration options set for the '\
       'RBT project next.'
  cliner {
    hash = RBT.configuration?._ # Delegate to the config.
    hash.each_pair {|key, value|
      case key.to_s.strip
      when 'email'
        value = crimson(value.to_s.ljust(10))
      else
        value = slateblue(value.to_s.ljust(10))
      end
      key = lightgoldenrodyellow( ((key.to_s+':').ljust(46)) )
      e '  '+key+' '+value
    }
  }
end
feedback_main_config_then_exit() click to toggle source
#

feedback_main_config_then_exit

#
# File lib/rbt/installer/misc.rb, line 2236
def feedback_main_config_then_exit
  feedback_main_config
  exit_program
end
feedback_make_options( i = compile_which_program? ) click to toggle source
#

feedback_make_options

To trigger this method, do e. g.:

ry ruby make_opts
ry binutils make_opts
#
# File lib/rbt/installer/misc.rb, line 2039
def feedback_make_options(
    i = compile_which_program?
  )
  _ = cookbook_dataset_make_options?
  _ = _.first if _.is_a? Array
  e
  e royalblue(_)
  e
end
feedback_prefix_in_use( shall_we_exit = true )
feedback_prefix_in_use?( shall_we_exit = true ) click to toggle source
#

feedback_prefix_in_use?

Use this method to feedback which prefix is in use.

Usage examples:

ry allegro --prefix?
ry openmpi --prefix?
ry htop    prefix?
#
# File lib/rbt/installer/misc.rb, line 11151
def feedback_prefix_in_use?(
    shall_we_exit = true
  )
  program_name = compile_which_program?.dup
  if cookbook_for?.nil?
    ensure_proper_dataset_for(program_name)
  end
  e "#{rev}The prefix in use for #{lightgreen(program_name)} will be:"
  e "  #{sfancy(prefix?)}"
  exit_program if shall_we_exit
end
Also aliased as: feedback_prefix_in_use
feedback_program_description( i = program_name? ) click to toggle source
#

feedback_program_description

We feedback the description here, by tapping into the method feedback_description() from class Cookbooks.

#
# File lib/rbt/installer/misc.rb, line 2375
def feedback_program_description(
    i = program_name?
  )
  e
  RBT.feedback_description_of(i)
  e
end
Also aliased as: feedback_description
feedback_program_version() click to toggle source
#

feedback_program_version

#
# File lib/rbt/installer/misc.rb, line 15057
def feedback_program_version
  RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_program_version(program?)
end
feedback_programs_dir() click to toggle source
#

feedback_programs_dir

#
# File lib/rbt/installer/misc.rb, line 2068
def feedback_programs_dir
  opne "The programs directory is at #{sfile(programs_dir?)}"
end
feedback_rbt_version( ljust = 35, use_opn = true ) click to toggle source
#

feedback_rbt_version

#
# File lib/rbt/installer/misc.rb, line 2199
def feedback_rbt_version(
    ljust = 35, use_opn = true
  )
  opnn if use_opn
  e sfancy('RBT Version: '.ljust(ljust))+
    simp(RBT.version?)
end
feedback_sanitize_dataset_version( ljust = 35, use_opn = true ) click to toggle source
#

feedback_sanitize_dataset_version

#
# File lib/rbt/installer/misc.rb, line 2188
def feedback_sanitize_dataset_version(
    ljust = 35, use_opn = true
  )
  opnn if use_opn
  e sfancy('RBT::Cookbooks::SanitizeCookbook version: '.ljust(ljust))+
    simp(RBT.version?)
end
feedback_url( i = compile_which_program? ) click to toggle source
#

feedback_url

Wrapper around Cookbooks functionality.

Usage examples:

ry htop url?
ry libsigc++ --show-url
#
# File lib/rbt/installer/misc.rb, line 236
def feedback_url(
    i = compile_which_program?
  )
  if i.nil?
    i = first_argument?.to_s.dup
    initialize_dataset_for(i)
  end
  RBT::Cookbooks::Url.new(i)
  # ======================================================================= #
  # The next line of code has been commented out on the 21.09.2018:
  # ======================================================================= #
  # ::RBT::Cookbooks::DisplayCookbookDataset.feedback_url.feedback_url(compile_which_program?)
  # ======================================================================= #
  # The next part may be controversial, as it sets the xorg buffer.
  # As of May 2014 it was disabled.
  # ======================================================================= #
  #   result = @cookbooks.feedback_url
  #   set_xorg_buffer(result)
end
feedback_various_versions( optional_use_opn = true, ljust = 45 ) click to toggle source
#

feedback_various_versions

This actually will only feedback the RBT version in use, since we have merged the different projects together in September 2018.

To invoke this method, do:

ry htop feedback_version
#
# File lib/rbt/installer/misc.rb, line 2174
def feedback_various_versions(
    optional_use_opn = true,
    ljust            = 45
  )
  case optional_use_opn
  when :do_not_use_opn
    optional_use_opn = false
  end
  feedback_rbt_version(ljust, optional_use_opn)
end
feedback_what_we_are_currently_compiling?( status_file = FILE_STATUS ) click to toggle source
#

feedback_what_we_are_currently_compiling?

This method will feedback what we are currently compiling.

To invoke this method, do:

rbt --what-are-we-currently-compiling?
#
# File lib/rbt/installer/misc.rb, line 1904
def feedback_what_we_are_currently_compiling?(
    status_file = FILE_STATUS
  )
  if File.exist? status_file
    dataset = YAML.load_file(status_file)
  end
  this_key = 'currently_compiling_these_programs'
  if dataset.has_key?(this_key) and
     !dataset[this_key].empty? # This should work because it is an Array.
    these_programs_are_currently_compiled = dataset[this_key]
    opne 'The following programs are currently compiled:'
    e
    these_programs_are_currently_compiled.each {|this_program|
      e "  #{sfancy(this_program)}"
    }; e
  else
    opne 'No program is being currently compiled.'
  end
end
feedback_whether_the_cookbook_will_modify_env_variables( compile_this_program = compile_which_program? ) click to toggle source
#

feedback_whether_the_cookbook_will_modify_env_variables

#
# File lib/rbt/installer/misc.rb, line 15064
def feedback_whether_the_cookbook_will_modify_env_variables(
    compile_this_program = compile_which_program?
  )
  _ = set_env_variables?
  if is_this_program_registered?(compile_this_program)
    if _.nil?
      opne "The program #{sfancy(compile_this_program)} does not "\
           "set any ENV variable."
    else
      opne 'The program '+sfancy(compile_this_program)+' will '\
           'modify at the least one ENV variable.'
      opne 'Displaying these next:'
      e
      set_these_env_variables(_, :report_only)
      e
    end
  else
    opne 'No program with that name is known.'
  end
end
feedback_whether_we_will_strip_or_whether_we_will_not() click to toggle source
#

feedback_whether_we_will_strip_or_whether_we_will_not

Feedback whether we will run the “strip” binary or whether we will not.

Invocation example:

ry --strip?
#
# File lib/rbt/installer/misc.rb, line 2014
def feedback_whether_we_will_strip_or_whether_we_will_not
  _ = strip_binaries?
  case _
  when true
    opne 'Yes, we will run "'+slateblue('strip')+'" on the resulting '\
         'binaries of'
    opne 'the given program at hand.'
  when false
    opne "No, we will #{swarn('NOT')} run \"strip\" on the "\
         "resulting binaries of"
    opne 'the given program at hand.'
  else
    e 'Unknown value: '+steelblue(_.class.to_s)
  end
end
feedback_whether_we_will_use_stow() click to toggle source
#

feedback_whether_we_will_use_stow

To invoke this, do:

ry --use-stow?
#
# File lib/rbt/installer/misc.rb, line 14556
def feedback_whether_we_will_use_stow
  opne "Will we use stow? #{royalblue(verbose_truth(use_stow?))}"
end
find_all_archive_types() click to toggle source
#

find_all_archive_types

#
# File lib/rbt/installer/misc.rb, line 9827
def find_all_archive_types
  RBT::Cookbooks::FindAllArchiveTypes.new.show_results
end
find_all_keys_starting_with( i ) click to toggle source
#

find_all_keys_starting_with

This method will find all keys starting with a specific character.

Currently we will always exist when we use this method, so returning something is not hugely important.

#
# File lib/rbt/installer/misc.rb, line 5198
def find_all_keys_starting_with(
    i
  )
  i.delete!('*') # Get rid of '*' since we no longer need it past this point.
  all_matches = all_programs?.select {|key| key =~ /^#{i}/ } 
  e all_matches.sort.join(', ').split(N).map {|entry| '  '+entry }.join(N)
  e
  opne 'Found a total of '+
       royalblue(all_matches.size.to_s)+
       ' matches.'
  return all_matches
end
find_the_corresponding_install_method_and_proceed_from_there() click to toggle source
#

find_the_corresponding_install_method_and_proceed_from_there

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 183
def find_the_corresponding_install_method_and_proceed_from_there
  use_this_build_system = build_system_to_be_used?.to_sym
  case use_this_build_system
  # ======================================================================= #
  # === :meson
  # ======================================================================= #
  when :meson
    run_the_meson_steps
  # ======================================================================= #
  # === waf
  # ======================================================================= #
  when :waf
    run_waf_based_installation
  # ======================================================================= #
  # === ninja
  # ======================================================================= #
  when :ninja
    # ===================================================================== #
    # Since as of 02.10.2018, we try to use ninja here automatically,
    # if the cookbook_dataset has a dependency on ninja.
    # ===================================================================== #
    set_use_this_make_command('ninja')
  # ======================================================================= #
  # === :cmake
  # ======================================================================= #
  when :cmake
    run_the_cmake_steps
  # ======================================================================= #
  # === :python
  # ======================================================================= #
  when :python
    run_the_python_steps
  # ======================================================================= #
  # === :perl
  # ======================================================================= #
  when :perl
    run_the_perl_steps
  # ======================================================================= #
  # === scons
  # ======================================================================= #
  when :scon
    run_scons_based_installation
  # ======================================================================= #
  # === :configure
  # ======================================================================= #
  when :configure
    run_the_gnu_configure_steps
  # ======================================================================= #
  # === :configure_requiring_autoconf_step
  # ======================================================================= #
  when :configure_requiring_autoconf_step
    do_invoke_autoconf
    run_the_gnu_configure_steps
  # ======================================================================= #
  # === :infer_automatically
  #
  # This is kind of similar to the original else-clause in class
  # RBT::Compile.
  # ======================================================================= #
  when :infer_automatically
    # ======================================================================= #
    # In this case we have to guess the build type, before we proceed,
    # since we have given the path to a file that exists.
    #
    # This code was disabled in April 2021. Let's see if we will need
    # it again one day. In September 2022 it was re-enabled.
    # ======================================================================= #
    _ = RBT.infer_build_system
    opne "#{gold('Guessing the build-type next ...')} the build "\
         "type is: #{slateblue(':'+_.to_s)}"
    if _.nil?
      _ = :inferring_the_build_system_did_not_work
    else
      _ = _.to_sym
    end
    case _
    # ======================================================================= #
    # === :meson
    # ======================================================================= #
    when :meson
      run_the_meson_steps
    # ======================================================================= #
    # === :python
    # ======================================================================= #
    when :python
      run_the_python_steps
    # ======================================================================= #
    # === :perl
    # ======================================================================= #
    when :perl
      run_the_perl_steps
    # ======================================================================= #
    # === :cmake
    # ======================================================================= #
    when :cmake
      run_the_cmake_steps
    # ======================================================================= #
    # === waf
    # ======================================================================= #
    when :waf
      run_waf_based_installation
    # ======================================================================= #
    # === :ninja
    # ======================================================================= #
    when :ninja
      set_use_this_make_command('ninja')
    # ======================================================================= #
    # === scons
    # ======================================================================= #
    when :scon
      run_scons_based_installation
    # ======================================================================= #
    # === :configure
    # ======================================================================= #
    when :configure
      run_the_gnu_configure_steps
    # ======================================================================= #
    # === :configure_requiring_autoconf_step
    # ======================================================================= #
    when :configure_requiring_autoconf_step
      do_invoke_autoconf
      run_the_gnu_configure_steps
    # ======================================================================= #
    # === :make
    # ======================================================================= #
    when :make
      run_make_then_make_install
    # ======================================================================= #
    # === Handle setup.py next
    # ======================================================================= #
    else
      # =================================================================== #
      # Note that this clause also covers the problem where the build system
      # returns the symbol :inferring_the_build_system_did_not_work.
      # In this case we will still try to make sense of the given situation,
      # as much as that is possible - hence the subsequent checks.
      # =================================================================== #
      if File.exist?(RBT::FILE_SETUP_PY)
        run_python_installation
      # =================================================================== #
      # === Handle ruby setup.rb next
      # =================================================================== #
      elsif File.exist?('setup.rb')
        colourized_and_padded_esystem 'ruby setup.rb'
      # =================================================================== #
      # === This entry clause is specifically for perl
      # =================================================================== #
      elsif configure_command_to_use? and File.exist?(configure_command_to_use?)
        do_run_GNU_configure_then_make_then_make_install(configure_command_to_use?)
      # =================================================================== #
      # === This entry tries to handle programs such as "duktape", which
      #     come with plenty of different "Makefile.*" files, but no
      #     configure script. This functionality was added on February 2023.
      # =================================================================== #
      elsif (result = Dir['Makefile.*'].size) > 1
        opne 'Assuming a Makefile-based program, thus invoking the'
        opne 'command stored in '+
             steelblue('use_this_make_command:')+
             rev+' next'
        e
        colourized_and_padded_esystem use_this_make_command?
        e
      else
        opne tomato('Not yet implemented or understood: ')+
             lightgreen(
               _.to_s
             )+' [Directory: '+sdir(return_pwd)+']'
      end
    end
  else
    opne "Not implemented: #{_}"
  end
end
Also aliased as: run_configure_like_stage
first_arg()
fix_libtool_la_file_from_saved_file() click to toggle source
#

fix_libtool_la_file_from_saved_file

#
# File lib/rbt/installer/misc.rb, line 12752
def fix_libtool_la_file_from_saved_file
  RBT.fix_libtool_la_file_from_saved_file
end
flatpak?()
flatpak_url?()
full_configure_command?() click to toggle source
#

full_configure_command?

The @full_configure_command contains the full configure command that we will use. The advantage in using this is that we can easily copy/paste this at a later time, should we need to do so.

We can also store this into a local file, such as a .md file. In fact, this was the primary reason why it was added.

#
# File lib/rbt/installer/misc.rb, line 6414
def full_configure_command?
  @internal_hash[:full_configure_command]
end
full_path?()
generate_all_gobolinux_recipes() click to toggle source
#

generate_all_gobolinux_recipes

This method can be used to auto-generate all GoboLinux recipes.

Invocation example:

ry --generate-all-gobolinux-recipes
#
# File lib/rbt/installer/misc.rb, line 14649
  def generate_all_gobolinux_recipes
    # ======================================================================= #
    # Must first change into an appropriate directory.
    # ======================================================================= #
    target_dir = "#{rbt_log_directory?}gobolinux/"
    if File.directory? target_dir
      # ===================================================================== #
      # Always remove the old directory should it exist.
      # ===================================================================== #
      remove_directory(target_dir)
    end
    mkdir(target_dir)
    if File.directory? target_dir
      opnn; cd target_dir, :be_verbose
      # ===================================================================== #
      # Next, create the subdirectories but be silent about it.
      # ===================================================================== #
      array = ('a'..'z').to_a
      # ===================================================================== #
      # Add two exceptions.
      # ===================================================================== #
      array[0,0] = '3'
      array[0,0] = '0'
      array.each {|entry| mkdir(entry, :be_quiet) }
    else
      opne "The target directory `#{sdir(target_dir)}` does not exist."
      opne 'Please create it before we can create GoboLinux recipes.'
      return
    end
    available_programs?.each {|this_program|
      opne "Now generating a GoboLinux recipe for "\
           "the program `#{sfancy(this_program)}`."
      create_gobolinux_recipe_for(this_program)
    }
    # ======================================================================= #
    # Now that we have generated all these recipes, let's create a tarball
    # of the directory.
    # ======================================================================= #
    cd rbt_log_directory?, :be_quiet
    begin
      require 'totarxz'
      gobolinux_recipes_archive = "gobolinux-recipes-#{return_current_date}"
      mv 'gobolinux', gobolinux_recipes_archive
      to_tar_xz(gobolinux_recipes_archive)
      target_archive = "#{gobolinux_recipes_archive.dup}.tar.xz"
      if File.exist? target_archive
        opne "Everything has been packaged up into `"\
             "#{sfancy(target_archive)}` (cwd: #{sdir_return_pwd})."
        # =================================================================== #
        # Rename the directory again.
        # =================================================================== #
        opnn; mv gobolinux_recipes_archive, 'gobolinux'
        # =================================================================== #
        # FTP upload if we are on Roebe.
        # =================================================================== #
        if is_on_roebe?
          require 'ftp_paradise'
          if File.exist? target_archive
            FtpParadise.upload_this_binary_file(target_archive)
          else
            opne 'Can not upload the file '+sfile(target_archive)
            opne 'as it does not exist.' 
          end
          # ================================================================= #
          # Next, connect and upload all the individual directories to
          # my remote FTP host.
          # ================================================================= #
        end
        # =================================================================== #
        # Next, upload the individual directories to the remote FTP host.
        # Unfortunately this has a problem so we have disabled this for now.
        # =================================================================== #

# =========================================================================== #
# DISABLED FOR NOW. MUST BE FIXED ONE DAY.
# =========================================================================== #
if false
        _ = FtpParadise.new(:shevy)
        _.remote_mkdir 'gobolinux'
        _.remote_cd    'gobolinux'
        opnn; cd 'gobolinux', :be_verbose
        array.each {|this_directory|
          _.remote_mkdir(this_directory)
          _.rcd(this_directory)
          # ================================================================= #
          # Ok, we can obtain the local directories and then upload them
          # all.
          # ================================================================= #
          local_target = this_directory+'/*'
          all_local_directories = Dir[local_target].select {|entry|
            File.directory? entry
          }
          if all_local_directories.empty?
            opne 'Nothing found under '+sfancy(local_target)+'.'
          else
            all_local_directories.each {|this_entry|
              opne 'Now uploading the directory `'+sdir(this_entry)+'`.'
              _.upload_this_directory(this_entry)
            }
          end
          _.rcd '..' # Return to the base directory again.
        }
end # end false clause (DEBUG - FIXME!!!)
      end
    rescue LoadError
      opne 'Please install the gem totarxz, in order to create '\
           'a '+orange('.tar.xz')+' archive.'
    end
  end
generate_global_yaml_database() click to toggle source
#

generate_global_yaml_database

#
# File lib/rbt/installer/misc.rb, line 5435
def generate_global_yaml_database
  require 'rbt/generate_files/create_global_yaml_database.rb'
  RBT.generate_global_yaml_database
end
generate_gobolinux_recipe(i = compile_which_program?) click to toggle source
#

generate_gobolinux_recipe

This will delegate towards Cookbooks and generate gobolinux recipe for the given program.

Invocation example:

ry zenity --gobolinux-recipe
#
# File lib/rbt/installer/misc.rb, line 14923
def generate_gobolinux_recipe(i = compile_which_program?)
  RBT.create_gobolinux_recipe(i) { :store_in_alphanumeric_subdirectory }
end
Also aliased as: create_gobolinux_recipe_for
generate_homebrew_script( i = compile_which_program? )
generate_homepage() click to toggle source
#

generate_homepage

Generate a LFS-like homepage, which is part of the RBT project, within the Cookbooks namespace.

Invocation example:

ry --generate-homepage
#
# File lib/rbt/installer/misc.rb, line 1299
def generate_homepage
  require 'rbt/cookbooks/generate_homepage/generate_homepage.rb'
  RBT::Cookbooks::GenerateHomepage[]
end
generate_machomebrew_formula( i = compile_which_program? ) click to toggle source
#

generate_machomebrew_formula

This method will generate a (hopefully valid) Homebrew script.

Commandline-invocation example:

ry htop --generate_homebrew_script
#
# File lib/rbt/installer/misc.rb, line 1480
def generate_machomebrew_formula(
    i = compile_which_program?
  )
  RBT::GenerateMachomebrewFormula.new(i)
end
Also aliased as: generate_homebrew_script
generate_new_cookbook( shall_we_exit = true ) click to toggle source
#

generate_new_cookbook

This method can be used to generate a new cookbook file. It is no longer that useful, but retained mostly for legacy reasons.

To generate a new cookbook, do:

ry htop ---generate_new_cookbook
#
# File lib/rbt/installer/misc.rb, line 5334
def generate_new_cookbook(
    shall_we_exit = true
  )
  opne 'Will generate a new cookbook file, as instructed.'
  action(:create_new_cookbook)
  exit_program if shall_we_exit
end
generate_shell_completion( for_this_shell = :all ) click to toggle source
#

generate_shell_completion

Generates shell completion code. Right now it will only work for Bash.

Invocation example:

ry --generate_shell_completion
#
# File lib/rbt/installer/misc.rb, line 12846
def generate_shell_completion(
    for_this_shell = :all
  )
  if Object.const_defined?(:RBT) and RBT.const_defined?(:GenerateShellCompletion)
    RBT::GenerateShellCompletion.new(
      for_this_shell
    ) # bl GenerateShellCompletion
  end
end
generate_slack_desc_file_for_this_program( i = compile_which_program? ) click to toggle source
#

generate_slack_desc_file_for_this_program

Trigger like so:

rbt htop --gsc
#
# File lib/rbt/installer/misc.rb, line 8034
def generate_slack_desc_file_for_this_program(
    i = compile_which_program?
  )
  path_to_this_file = RBT.generate_slackware_description_file(i)
  return path_to_this_file
end
generate_slack_desc_files_for_every_program() click to toggle source
#

generate_slack_desc_files_for_every_program

#
# File lib/rbt/installer/misc.rb, line 11842
def generate_slack_desc_files_for_every_program
  action(:generate_all_slack_desc_files)
end
get_packages( this_program = compile_which_program? ) click to toggle source
#

get_packages

Get all packages from the directory /Depot/Packages and compare them to our given request.

I am no longer making heavy use of Packages but perhaps one day I may extend it, so this is one reason why it is kept.

Invoke it like so:

ry php pgk?
#
# File lib/rbt/installer/misc.rb, line 3015
def get_packages(
    this_program = compile_which_program?
  )
  this_program = this_program.first if this_program.is_a? Array
  packages_dir = packages_directory? # This constant is defined in Configuration.rb
  opnn
  e "Searching for matching packages to `#{simp(this_program)}`, "\
    "inside of the directory #{sdir(packages_dir)}."
  _ = get_files_from(packages_dir)
  if _ and !_.empty?
    result = _.grep(/#{this_program}/i)
    pp result
    return result
  else
    opne "Unfortunately no match was found in `#{sdir(packages_dir)}`."
  end
end
gir_files?() click to toggle source
#

gir_files?

#
# File lib/rbt/installer/misc.rb, line 4626
def gir_files?
  cookbook_for?.gir_files
end
git_url?() click to toggle source
#

git_url?

#
# File lib/rbt/installer/misc.rb, line 4719
def git_url?
  cookbook_for?.git_url?
end
guess_build_type() click to toggle source
#

guess_build_type

#
# File lib/rbt/installer/misc.rb, line 13208
def guess_build_type
  RBT.build_type?
end
Also aliased as: do_guess_the_build_type
had_to_be_compiled?()
handle_the_postinstallation_step() click to toggle source
#

handle_the_postinstallation_step

This will delegate towards class RBT::ToCurrent, to set the Current symlink.

#
# File lib/rbt/installer/postinstallation.rb, line 317
def handle_the_postinstallation_step
  if uses_appdir_prefix?
    _ = prefix?
    opne "Setting a symlink next, for #{steelblue(_)}:"
    # ===================================================================== #
    # Delegate onto class RBT::ToCurrent next.
    # ===================================================================== #
    RBT::ToCurrent.new(_)
  end
end
handle_this_program?()
handle_which_program?()
has_a_dependency_on_meson?() click to toggle source
#

has_a_dependency_on_meson?

#
# File lib/rbt/installer/misc.rb, line 9326
def has_a_dependency_on_meson?
  cookbook_for?.has_a_dependency_on_meson?
end
has_a_problem_occurred?() click to toggle source
#

has_a_problem_occurred?

Query-method over as to whether a problem has occurred or whether it has not.

#
# File lib/rbt/installer/misc.rb, line 10561
def has_a_problem_occurred?
  problem?
end
Also aliased as: a_problem_has_occurred?
has_an_error_occurred?()
has_been_installed_successfully?()
has_been_successfully_compiled?()
has_flatpak_url?() click to toggle source
#

has_flatpak_url?

#
# File lib/rbt/installer/misc.rb, line 7217
def has_flatpak_url?
  !cookbook_for?.flatpak_url.empty?
end
has_gir_files?() click to toggle source
#

has_gir_files?

This method will determine whether the package at hand has .gir files or whether it does not.

#
# File lib/rbt/installer/misc.rb, line 4619
def has_gir_files?
  !cookbook_for?.gir_files.empty?
end
has_key?(i) click to toggle source
#

has_key?

This is a substitute method, to enable hash-like behaviour for some keys. Right now (December 2019) this is a hardcoded Array, but in the future the code may be changed - let’s see.

Do note that this method is specifically synced (closely) with class RBT::CreatePkgconfigFile.new.

#
# File lib/rbt/installer/misc.rb, line 8602
def has_key?(i)
  %i(
    description
    prefix
    program_version
  ).include? i
end
has_linux_makefile?(i = 'Makefile.linux') click to toggle source
#

has_linux_makefile?

Return true if we find a linux-specific Makefile.

#
# File lib/rbt/installer/misc.rb, line 3282
def has_linux_makefile?(i = 'Makefile.linux')
  File.exist?(i)
end
has_makefile?(i = 'Makefile') click to toggle source
#

has_makefile?

Query whether we have a file called Makefile in the current working directory.

#
# File lib/rbt/installer/misc.rb, line 3273
def has_makefile?(i = 'Makefile') 
  File.exist?(i)
end
has_the_program_been_installed_successfully?() click to toggle source
#

has_the_program_been_installed_successfully?

#
# File lib/rbt/installer/misc.rb, line 3851
def has_the_program_been_installed_successfully?
  @internal_hash[:has_the_program_been_installed_successfully]
end
has_to_be_compiled?()
hash?() click to toggle source
#

hash?

#
# File lib/rbt/installer/misc.rb, line 1234
def hash?
  cookbook_for?.hash?
end
headers?()
highest_priority?() click to toggle source
#

highest_priority

This method will return the main build system to use in general, if possible.

#
# File lib/rbt/installer/misc.rb, line 4986
def highest_priority?
  return_build_systems_priorities.first
end
homepage?(cookbook_dataset = cookbook_dataset?) click to toggle source
#

homepage?

#
# File lib/rbt/installer/misc.rb, line 5175
def homepage?(cookbook_dataset = cookbook_dataset?)
  if cookbook_dataset
    cookbook_dataset.homepage?
  end
end
honour_check_to_ensure_that_the_program_exists?() click to toggle source
#

honour_check_to_ensure_that_the_program_exists?

#
# File lib/rbt/installer/misc.rb, line 11534
def honour_check_to_ensure_that_the_program_exists?
  @internal_hash[:honour_check_to_ensure_that_the_program_exists] # This is true by default.
end
honour_error_results?()
Alias for: check_for_errors?
ignore_errors?() click to toggle source
#

ignore_errors?

This query-method allows the user to ignore errors.

#
# File lib/rbt/installer/misc.rb, line 220
def ignore_errors?
  @internal_hash[:ignore_errors]
end
Also aliased as: ignore_errors_anyway?
ignore_errors_anyway?()
Alias for: ignore_errors?
increment_compiled_counter( by_plus_n = 1 )
increment_compiled_this_program_n_times_counter( by_plus_n = 1 ) click to toggle source
#

increment_compiled_this_program_n_times_counter

By default this method will increment by +1.

#
# File lib/rbt/installer/misc.rb, line 12621
def increment_compiled_this_program_n_times_counter(
    by_plus_n = 1
  )
  @internal_hash[:we_tried_to_compile_this_program_n_times] += by_plus_n
end
Also aliased as: increment_compiled_counter
infer_information_from_this_archive(i) click to toggle source
#

infer_information_from_this_archive

#
# File lib/rbt/installer/misc.rb, line 9883
def infer_information_from_this_archive(i)
  _ = remove_archive_at_the_end(
    File.basename(i)
  )
  _ = ProgramInformation.new(_)
  use_this_as_program_name    = _.program_name?
  use_this_as_program_version = _.program_version?
  # ======================================================================= #
  # Obtain a dummy-cookbook dataset first.
  # ======================================================================= #
  cookbook_dataset = load_yaml_dataset_for_this_program(
    use_this_as_program_name
  )
  # ======================================================================= #
  # Update the program_path next:
  # ======================================================================= #
  cookbook_dataset.program_path = i
  set_compile_this_program(use_this_as_program_name)
  cookbook_dataset.set_program_version(use_this_as_program_version)
  set_on_ihash(cookbook_dataset)
  cd :log_dir
  invoke_extracter(
    cookbook_dataset.program_path,
    log_dir?,
    true
  )
  cd log_dir?+remove_archive_stuff_from_the_end(File.basename(i))
  run_configure_like_stage    
  exit_program
end
initialize_a_new_cookbook_for( i = install_this_program?, simple_or_complex = simple_or_complex? ) click to toggle source
#

initialize_a_new_cookbook_for

The first argument to this method should be the program that the user wants to wish to compile or install, as a String, such as “php” or “ruby” or something like that.

Since as of January 2018, whenever you need an instance from class RBT::Cookbooks::SanitizeCookbook, this method here should be used.

The reason is simple:

  • This method will do all the required invocations needed to properly instantiate a new Cookbook instance.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1200
def initialize_a_new_cookbook_for(
    i                 = install_this_program?,
    simple_or_complex = simple_or_complex?
  )
  i = RBT.cookbook_for(i) {{
    make_use_of_aliases_kept_in_the_file_cookbook_aliases: make_use_of_cookbook_aliases?,
    simple_or_complex:                                     simple_or_complex?
  }}
  @internal_hash[:cookbook_for] = i
  # ======================================================================= #
  # Sync the make command to be used at once.
  # ======================================================================= #
  set_use_this_make_command(
    cookbook_dataset_use_this_make_command?
  )
  return i # Always return the dataset as well here.
end
initialize_a_new_cookbook_instance( i = install_this_program?, simple_or_complex = simple_or_complex? )
initialize_cookbook_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
initialize_cookbook_dataset_for( i = install_this_program?, simple_or_complex = simple_or_complex? )
Also aliased as: initialize_dataset_for
initialize_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
initialize_dataset_for( i = install_this_program?, simple_or_complex = simple_or_complex? )
initialize_dataset_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
initialize_default_values()
initialize_yaml_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
install_only_headers?() click to toggle source
#

install_only_headers?

#
# File lib/rbt/installer/misc.rb, line 15671
def install_only_headers?
  @internal_hash[:install_only_the_headers]
end
Also aliased as: install_only_the_headers?
install_only_the_headers?()
install_palemoon( path = '/home/x/src/palemoon/palemoon-'\ '28.5.2-64bit.tar.xz' ) click to toggle source
#

install_palemoon

To invoke this ad-hoc method, try:

rbt --install-palemoon
#
# File lib/rbt/installer/misc.rb, line 5990
def install_palemoon(
    path = '/home/x/src/palemoon/palemoon-'\
           '28.5.2-64bit.tar.xz'
  )
  if File.exist? path
    _ = remove_archive_from_the_end(
      File.basename(path)
    ).sub(/-64bit$/, '')
    program_name    = program_information_return_name(_)
    program_version = program_information_return_version(_)
    target = program_dir?+program_name.capitalize+'/'+program_version+'/'
    create_app_skeleton(target)
    cd target
    extract_to = target
    extract_what_to(path, extract_to)
    e 'Done!'
  else
    opnn; no_file_at(path)
  end
end
install_ruby_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? ) click to toggle source
#

install_ruby_gem (install gem, gem install, gem tag)

Use this method to install a ruby gem, then exit.

The input argument should be the path towards the .gem file in question.

Right now we will always exit when we use this method, by default. This behaviour can be changed through the variable ‘shall_we_exit’.

Invocation example:

ry /home/x/src/ruby/gems/wirble-0.1.3.gem
ry $MY_SRC/ruby/gems/unf-0.0.5.gem
ry thor
#
# File lib/rbt/installer/misc.rb, line 14590
def install_ruby_gem(
    this_gem      = program_path?,
    shall_we_exit = exit_after_a_rubygem_has_been_installed?
  )
  do_not_display_the_flexbox
  do_not_symlink :be_quiet
  case this_gem
  when :default
    this_gem = program_path?
  end
  case shall_we_exit
  when :then_exit, :do_exit
    shall_we_exit = true
  when :do_not_exit
    shall_we_exit = false
  end
  # ======================================================================= #
  # === Download the gem
  #
  # If the path to a gem includes a "http" string, then we will assume
  # that we will first have to download it.
  # ======================================================================= #
  if this_gem and this_gem.include? 'http'
    go_to_base_dir
    do_download(this_gem)
  end
  # ======================================================================= #
  # Next, install the gem via a system() call. There are several ways
  # how to install a gem through, most importantly, with or without
  # dependency management by gem.
  # ======================================================================= #
  _ = ("gem install #{return_gem_install_options} #{this_gem}").squeeze(' ')
  opne _
  system _
  exit_program if shall_we_exit
end
install_the_dependencies_of_this_program( this_program = compile_which_program? ) click to toggle source
#

install_the_dependencies_of_this_program

Invocation example:

ry rails --install-its-dependencies
#
# File lib/rbt/installer/misc.rb, line 8743
def install_the_dependencies_of_this_program(
    this_program = compile_which_program?
  )
  # ======================================================================= #
  # First obtain the direct-dependencies of the given program at hand.
  # ======================================================================= #
  dependencies = required_deps_on?
  e
  opne 'Next, installing the '+orange(dependencies.size.to_s)+
       ' dependencies of the program `'+
        sfancy(this_program)+'`.'
  e
  opne 'These programs are:'
  e
  dependencies.each {|this_entry|
    e slateblue(" #{this_entry}")
  }
  e
  dependencies.each {|this_entry|
    install_that_program = true
    # ===================================================================== #
    # Consider skipping a few of these programs.
    # ===================================================================== #
    case this_entry
    when 'python'
      target = "#{programs_directory?}Python/Current/bin/python"
      if File.exist? target
        install_that_program = false
        e "Skipping python as it is already installed at #{sfancy(target)}."
      end
    when 'ruby'
      target = "#{programs_directory?}Ruby/Current/bin/ruby"
      if File.exist? target
        install_that_program = false
        e "Skipping ruby as it is already installed at #{sfancy(target)}."
      end
    end
    if install_that_program
      # =================================================================== #
      # We ought to not quit after a rubygem has been installed.
      # =================================================================== #
      _ = RBT::Installer.new(this_entry, :do_not_run_yet)
      _.do_not_exit_after_a_rubygem_has_been_installed
      _.run
    end
  }
end
install_the_linux_kernel_header_files_via_appdir_prefix() click to toggle source
#

install_the_linux_kernel_header_files_via_appdir_prefix

This method essentially does what is described here:

http://www.linuxfromscratch.org/lfs/view/development/chapter05/linux-headers.html

The main difference is that we will use a proper appdir prefix.

Invocation examples:

ry --install-kernel-headers
ry --install-linux-headers
#
# File lib/rbt/installer/misc.rb, line 4079
def install_the_linux_kernel_header_files_via_appdir_prefix
  install_the_linux_kernel_header_files_via_this_prefix(:appdir_prefix)
end
install_the_linux_kernel_header_files_via_this_prefix( use_this_prefix = :appdir_prefix ) click to toggle source
#

install_the_linux_kernel_header_files_via_this_prefix

The argument to this method is the prefix to be used. For example, the default AppDir prefix on my system for the linux kernel is “/home/Programs/Linux/5.7/”.

This method can also be used to specify a prefix for “home” which refers to the “home directory”.

#
# File lib/rbt/installer/misc.rb, line 2540
def install_the_linux_kernel_header_files_via_this_prefix(
    use_this_prefix = :appdir_prefix
    )
  _ = initialize_cookbook_dataset_for(:linux)
  # ======================================================================= #
  # Get the local path to the latest linux kernel next.
  # ======================================================================= #
  program_path = _.program_path?
  # ======================================================================= #
  # Designate which prefix is to be used next:
  # ======================================================================= #
  case use_this_prefix
  when :appdir_prefix,
       :default
    use_this_prefix = _.prefix?
  end
  extract_to = _.extract_to?
  extract_what_to(program_path, extract_to) { :keep_the_old_directory_if_it_exists }
  rcp _.program_name_and_program_version?
  target = extract_to+_.program_name_and_program_version?
  opne 'Now changing into '+sdir(target)+'.'
  cd target
  run_this_system_command_in_a_coloured_and_padded_manner 'make mrproper'
  run_this_system_command_in_a_coloured_and_padded_manner 'make headers'
  if File.exist? 'usr/include/Makefile'
    remove_file 'usr/include/Makefile'
  end
  opne 'We are in the directory '+sdir(target)+'.'
  opne 'Doing a '+steelblue('recursive copy action')+rev+' next.'
  cpr('usr/include/', use_this_prefix)
  opne 'Done! The target was at '+sdir(use_this_prefix+'include/')
end
install_the_ruby_addons()
install_this_flatpak( this_program ) click to toggle source
#

install_this_flatpak

This method can be used to install a flatpak from the official flatpak-URL.

#
# File lib/rbt/installer/misc.rb, line 8496
def install_this_flatpak(
    this_program
  )
  # ======================================================================= #
  # We must first check whether this program has a flatpak-entry. But
  # before that, we must initialize the dataset for the given program
  # at hand.
  # ======================================================================= #
  initialize_dataset_for(this_program)
  if has_flatpak_url?
    cmd = "flatpak install --user #{flatpak_url?}"
    e
    run_this_system_command_in_a_coloured_and_padded_manner(cmd)
    e
  else
    opne "The program #{sfancy(this_program)} does not "\
         "have a registered flatpak-URL."
  end
end
install_this_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? )
Alias for: install_ruby_gem
install_this_program?() click to toggle source
#

install_this_program?

This is the variable that will keep track of the program that the user wants to install or compile next.

It has to be set anew whenever a new program is compiled.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 767
def install_this_program?
  @internal_hash[:install_this_program]
end
install_this_ruby_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? )
Alias for: install_ruby_gem
install_which_program?()
install_which_programs?() click to toggle source
#

install_which_programs?

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 646
def install_which_programs?
  ::RBT.install_which_programs?
end
installation_steps?()
installation_was_successful?()
instantiate_a_new_cookbook( i = install_this_program?, simple_or_complex = simple_or_complex? )
instantiate_a_new_cookbook_for( i = install_this_program?, simple_or_complex = simple_or_complex? )
instantiate_a_new_cookbook_instance( i = install_this_program?, simple_or_complex = simple_or_complex? )
internal_configure_options?() click to toggle source
#

internal_configure_options?

#
# File lib/rbt/installer/misc.rb, line 13346
def internal_configure_options?
  @internal_hash[:configure_options]
end
internal_hash_build_static?() click to toggle source
#

internal_hash_build_static?

#
# File lib/rbt/installer/misc.rb, line 2961
def internal_hash_build_static?
  @internal_hash[:build_static]
end
internal_pid?() click to toggle source
#

internal_pid?

#
# File lib/rbt/installer/misc.rb, line 11917
def internal_pid?
  @internal_hash[:pid]
end
internal_program_name?()
invoke_autoconf()
Alias for: do_invoke_autoconf
invoke_extracter( i = program_path?, extract_to_this_directory = extract_where_to?, keep_the_old_directory_if_it_exists = false ) { || ... } click to toggle source
#

invoke_extracter

Delegate towards class Extracter next.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 237
def invoke_extracter(
    i                                   = program_path?,
    extract_to_this_directory           = extract_where_to?,
    keep_the_old_directory_if_it_exists = false
  )
  append_to_the_commandline = ''.dup
  case extract_to_this_directory
  when nil
    extract_to_this_directory = will_be_extracted_towards?
    @internal_hash[:extract_to_this_directory_as_specified_by_the_user] =
      extract_to_this_directory
    set_extract_to_this_directory(extract_to_this_directory)
  end
  # ======================================================================= #
  # === Handle Hashes next
  # ======================================================================= #
  if i.is_a? Hash
    if i.has_key? :use_this_local_path
      i = i.delete(:use_this_local_path)
    end
  end
  yielded = nil
  case keep_the_old_directory_if_it_exists # case tag.
  # ======================================================================= #
  # === :do_keep_the_old_directory_if_it_exists,
  # ======================================================================= #
  when :do_keep_the_old_directory_if_it_exists,
       :keep_the_old_directory_if_it_exists
    keep_the_old_directory_if_it_exists = true
  end
  # ======================================================================= #
  # === Handle blocks given to this method next:
  # ======================================================================= #
  if block_given?
    yielded = yield
    case yielded
    # ===================================================================== #
    # === :keep_the_old_directory_if_it_exists
    # ===================================================================== #
    when :keep_the_old_directory_if_it_exists
      keep_the_old_directory_if_it_exists = true
    else
      # =================================================================== #
      # === Handle Hashes next
      # =================================================================== #
      if yielded.is_a? Hash
        # ================================================================= #
        # === :append_to_the_commandline
        # ================================================================= #
        if yielded.has_key? :append_to_the_commandline
          append_to_the_commandline << yielded[:append_to_the_commandline]
        end
      end
    end
  end
  unless skip_extracting?
    case extract_to_this_directory
    # ===================================================================== #
    # === :default
    # ===================================================================== #
    when :default
      extract_to_this_directory = will_be_extracted_towards?
    end
    # ===================================================================== #
    # Remove the extracted directory if it exists next. This will,
    # however had, NOT be done if we extract to another target
    # directory, such as when issuing a command like
    # "ry htop --extract-to=/opt/test".
    # ===================================================================== #
    # possibly_existing_old_extracted_archive = cookbooks_dataset_extracted_towards?
    # unless possibly_existing_old_extracted_archive.include? extract_to?
      # =================================================================== #
      # In this case we reasonably assume that the user has NOT given a
      # --extract-to value.
      #
      # Keep in mind that the user may specify another temp-directory,
      # which explains the check for user-input.
      # =================================================================== #
      if cookbooks_for? and !keep_the_old_directory_if_it_exists
        _ = will_be_extracted_towards?
        if @internal_hash.has_key?(:extract_to_this_directory_as_specified_by_the_user) and
           @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
          _ = @internal_hash[:extract_to_this_directory_as_specified_by_the_user]
        end
        unless (_.squeeze('/').strip == '/') # Prevent erroneous removal of /.
          if File.directory?(_)
            _ = _.dup if _.frozen?
            if (_ == rbt_log_dir?)
              opnerror 'A problem was encountered, but this should never happen.'
              opnerror 'RBT::Installer tried to remove the base directory at '+
                       sdir(rbt_log_dir?)
              opnerror 'which was the same as the passed directory `'+sdir(_)+'`.'
              e
              opnerror 'Something must be wrong in the information-chain, such as a'
              opnerror 'faulty .yml file. Please review the information shown above'
              opnerror 'and make sure that the used .yml file is correct.'
              e
              exit_program { :exit_no_matter_what }
            else
              _.strip!
              _.squeeze!('/')
              # =========================================================== #
              # Notify the user that we will remove the old directory next.
              # =========================================================== #
              notify_the_user_that_this_old_directory_will_be_removed_next(_)
              remove_directory(_)
            end
          end
        end
      end
    # end
    if i and File.exist?(i)
      if are_we_on_windows? and i.include?('.tar.')
        # =================================================================== #
        # Windows has to be handled in a special way.
        # =================================================================== #
        cmd = '7z x "'.dup
        cmd << i
        cmd << '" -so | 7z x -aoa -si -ttar -o"'+program_name_and_program_version?.to_s+'"'
        run_this_system_command_in_a_coloured_and_padded_manner(cmd)
      else
        # =================================================================== #
        # Delegate towards class Extracter next. The second argument is a
        # Hash which will typically carry a lot of information. This is
        # necessary because we want to "fine-tune" Extracter at this
        # step.
        # =================================================================== #
        ::Extracter.extract_this(
          i,
          to:                             extract_to_this_directory, # ← Extract to this directory.
          prepend_this_namespace:         'RBT→', # ← Use this modifier.
          use_colours:                    use_colours?,
          run_simulation:                 run_simulation?,
          pad_opn_with_n_tokens:          RBT.n_padding_to_use_for_opn?,
          use_opn:                        show_the_classname?,
          be_verbose:                     show_output_from_the_extracter_class?,
          append_this_to_the_commandline: append_to_the_commandline
        ) { :show_the_full_name_of_the_archive }
      end
    else
      no_file_exists_at(i.to_s)
    end
  end
end
is_a_gem?( i = program_path? )
Alias for: is_a_gem_file?
is_a_gem_file?( i = program_path? ) click to toggle source
#

is_a_gem_file?

Query whether we have a .gem file at hand here.

#
# File lib/rbt/installer/misc.rb, line 12007
def is_a_gem_file?(
    i = program_path?
  )
  i.to_s.end_with? '.gem'
end
Also aliased as: is_a_gem?
is_a_kde_program?() click to toggle source
#

is_a_kde_program?

We assume that every program that has the “kde” tag associated, is a KDE program. Thus this method will return true.

#
# File lib/rbt/installer/misc.rb, line 6658
def is_a_kde_program?
  tags.include? 'kde'
end
is_an_abbreviation?() click to toggle source
#

is_an_abbreviation?

#
# File lib/rbt/installer/misc.rb, line 5062
def is_an_abbreviation?
  @internal_hash[:is_an_abbreviation]
end
is_an_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
is_app_dir?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
is_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
is_clang_used_as_the_main_compiler?() click to toggle source
#

is_clang_used_as_the_main_compiler?

#
# File lib/rbt/installer/misc.rb, line 9051
def is_clang_used_as_the_main_compiler?
  @internal_hash[:compiler_to_use] == :clang
end
is_cmake_available?()
Alias for: cmake_exists?
is_compiled?()
is_meson_build_type?() click to toggle source
#

is_meson_build_type?

This method will return true if we can use meson in the current directory; and false otherwise.

#
# File lib/rbt/installer/misc.rb, line 5252
def is_meson_build_type?
  RBT.build_type? == :meson
end
Also aliased as: uses_meson?
is_on_32_bit_system?() click to toggle source
#

is_on_32_bit_system?

#
# File lib/rbt/installer/misc.rb, line 9783
def is_on_32_bit_system?
  TARGET_CPU == 'i686'
end
is_on_gobolinux()
is_on_gobolinux?() click to toggle source
#

is_on_gobolinux?

Query whether we are on GoboLinux or whether we are not.

In the past this was only a check for an environment variable.

Since we will allow commandline options to change this, we also had to use a proper variable to keep track of this.

#
# File lib/rbt/installer/misc.rb, line 11555
def is_on_gobolinux?
  @internal_hash[:is_on_gobolinux]
end
is_on_slackware?() click to toggle source
#

is_on_slackware?

This method will return true if we are using slackware; and false otherwise.

#
# File lib/rbt/installer/misc.rb, line 5072
def is_on_slackware?
  RBT.configuration?.operating_system == 'slackware'
end
is_registered?(i) click to toggle source
#

is_registered?

Determine whether a given program is registered or whether it is not.

#
# File lib/rbt/installer/misc.rb, line 14117
def is_registered?(i)
  return RBT.is_available? i
end
Also aliased as: is_this_program_registered?
is_this_a_registered_binary?(i) click to toggle source
#

is_this_a_registered_binary?

#
# File lib/rbt/installer/misc.rb, line 8801
def is_this_a_registered_binary?(i)
  i != return_program_based_on_this_binary(i)
end
is_this_a_registered_binary_name?(i) click to toggle source
#

is_this_a_registered_binary_name?

#
# File lib/rbt/installer/misc.rb, line 5079
def is_this_a_registered_binary_name?(i)
  ::RBT.has_this_binary?(i)
end
is_this_an_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
is_this_input_an_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
is_this_program_included?( i, be_verbose = be_verbose? ) click to toggle source
#

is_this_program_included?

#
# File lib/rbt/installer/misc.rb, line 15491
def is_this_program_included?(
    i,
    be_verbose = be_verbose?
  )
  RBT::Installer.is_this_program_included?(
    i, be_verbose
  )
end
is_this_program_registered?(i)
Alias for: is_registered?
keep_extracted?()
keep_extracted_archive?()
keep_the_extracted_archive?() click to toggle source
#

keep_the_extracted_archive?

This is a query method towards a setting kept in the internal Hash variable.

A boolean value will be returned. This boolean value determines whether the archive will be kept after it was extracted, or whether it will be removed again after it was extracted.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 87
def keep_the_extracted_archive?
  _ = cookbook_dataset_keep_extracted? # ← The default.
  unless @internal_hash[:keep_the_archive_extracted].nil?
    _ = @internal_hash[:keep_the_archive_extracted]
  end
  return _
end
kill_the_main_pid( main_pid = internal_pid? ) click to toggle source
#

kill_the_main_pid

This will kill the process that was spawned via IO.popen. Use with care.

#
# File lib/rbt/installer/misc.rb, line 11926
def kill_the_main_pid(
    main_pid = internal_pid?
  )
  if main_pid
    begin
      Process.kill('KILL', main_pid)
      set_internal_pid(nil)
    rescue Errno::ESRCH
    end
  end
end
last_compiled_program?()
last_error_line?() click to toggle source
#

last_error_line?

#
# File lib/rbt/installer/misc.rb, line 4572
def last_error_line?
  sys_command_string?.last
end
last_system_command_was_a_success?() click to toggle source
#

last_system_command_was_a_success?

#
# File lib/rbt/installer/misc.rb, line 2455
def last_system_command_was_a_success?
  $CHILD_STATUS.success?
end
libraries?()
licence?() click to toggle source
#

licence?

#
# File lib/rbt/installer/misc.rb, line 3729
def licence?
  cookbook_dataset?.licence?
end
linux_from_scratch() click to toggle source
#

linux_from_scratch (lfs tag)

We simply delegate this task to the class LFS.

#
# File lib/rbt/installer/misc.rb, line 1648
def linux_from_scratch
  RBT::LFS.new
end
load_and_display_the_allowed_tags( from_this_file = RBT.file_allowed_tags ) click to toggle source
#

load_and_display_the_allowed_tags

#
# File lib/rbt/installer/misc.rb, line 8300
def load_and_display_the_allowed_tags(
    from_this_file = RBT.file_allowed_tags
  )
  dataset = YAML.load_file(from_this_file).sort
  opne 'The following tags are allowed/registered/valid:'
  dataset.each {|entry|
    e "  #{simp(entry)}"
  }
end
load_data_from_this_gobolinux_recipe(i) click to toggle source
#

load_data_from_this_gobolinux_recipe

This method will allow us to load the dataset from a local GoboLinux recipe, as a drop-in replacement.

The most important setting there will be to use:

url="http://ftp.gnome.org/pub/gnome/sources/GConf/3.2/GConf-3.2.6.tar.xz"

which is part of the file called “Recipe”.

The other settings are also useful but not as important.

#
# File lib/rbt/installer/misc.rb, line 14795
def load_data_from_this_gobolinux_recipe(i)
  i = i.to_s.dup # Always work on a new String-copy anyway.
  case i
  when 'Dir.pwd'
    i = return_pwd
  end
  # ======================================================================= #
  # === Handle GoboLinux Recipes past that point
  # ======================================================================= #
  if i.include? '/'
    the_program_is_included # Enable the fact that the program is "included":
    # ===================================================================== #
    # Assume the input to be something like '/Depot/jjjjj/GConf/3.2.6-r3/'.
    # ===================================================================== #
    if i.count('/') > 1 # At the least two '/'.
      splitted = i.split('/')
      program_name = splitted[-2]
      program_version = splitted[-1]
      set_program_name(program_name)
      initialize_yaml_dataset(program_name, :bypass_check)
      set_program_version(program_version)
      chop_off_revision_number
      set_base_dir(i)
      # =================================================================== #
      # The position of the Description file.
      # =================================================================== #
      description_file = 'Resources/Description'
      dataset_from_the_description_file = nil
      assume_default_archive_type
      # =================================================================== #
      # Next, read in the information from the file 'Recipe'.
      # =================================================================== #
      this_file = 'Recipe'
      if File.exist? this_file
        recipe_dataset = File.read(this_file)
        use_this_regex = /^url="(.+)"/
        use_this_url = recipe_dataset.scan(use_this_regex).flatten.first
        set_url(use_this_url)
        set_this_archive(File.basename(use_this_url))
      else
        opne 'Something appears to be incorrect - no file '\
             'called '+sfile(this_file)+' could be found.'
        exit_program
      end
      if File.exist? description_file
        dataset_from_the_description_file = File.read(description_file)
        # ================================================================= #
        # Next, use some regexes to properly interprete the dataset.
        # ================================================================= #
        regex_for_url1              = /\[Homepage\] (.+)/
        regex_for_license           = /\[License\] (.+)/
        regex_for_description       = /\[Description\] (.+)/
        regex_for_short_description = /\[Summary\] (.+)/
        _regex_for_name             = /\[Name\] (.+)/
        # ================================================================= #
        # Next determine some values here.
        # ================================================================= #
        dataset_from_the_description_file =~ regex_for_url1
        set_url2($1.to_s.dup) # Here we change the "homepage" URL.
        dataset_from_the_description_file =~ regex_for_license
        set_license($1.to_s.dup)
        dataset_from_the_description_file =~ regex_for_description
        set_description($1.to_s.dup)
        dataset_from_the_description_file =~ regex_for_short_description
        set_short_desc($1.to_s.dup)
        set_short_name(program_name)
        # ================================================================= #
        # The following code is probably no longer needed, but we can
        # keep it for now - maybe one day we have to use it.
        #   dataset_from_the_description_file =~ regex_for_name
        #   this_program = $1.to_s.dup.downcase
        #   set_this_program(this_program)
        # ================================================================= #
        attach_program_name_and_program_version
        determine_program_full_name # This is like: 'gnome-mahjonng-5.08.tar.xz'
        assemble_program_path
        unless File.exist?(File.basename(program_full_name?))
          e 'As the program does not exist locally, we will download it from:'
          e
          e '  '+sfancy(url?.to_s)
          e
          download_this_remote_program(url1)
        end
        # ================================================================= #
        # Now we assume that the program must exist locally.
        # ================================================================= #
        opne 'The following information is known about this program:'
        cliner
        e main_eight? # Show some more information.
        cliner
        target = File.basename(program_full_name?)
        extract_this_archive(target, return_pwd)
        new_target = dataset_program_name?
        opnn; cd new_target, :be_verbose
        do_use_appdir_prefix(:be_quiet)
        use_default_configure_command
        # ================================================================= #
        # Determine the configure options.
        # ================================================================= #
        use_this_regex = /^configure_options=\(([\s\S]+)\)$/ # See: http://rubular.com/r/Zy29SMPvLm
        set_configure_options(
          recipe_dataset.scan(use_this_regex).flatten.first
        )
        set_configure_base_dir('')
        set_use_this_build_directory('')
        do_not_remove_the_extracted_archive
        # ================================================================= #
        # Run "configure" next.
        # ================================================================= #
        run_configure_via_system(nil, :do_not_change_the_directory)
        run_premake_make_then_make_install
        run_all_actions_after_the_make_install_step
      end
    end
  end
end
load_last_compiled_program() click to toggle source
#

load_last_compiled_program

This essentially does the following:

x = load_yaml('/Depot/Temp/rbt_logs/last_compiled_programs.yml')

To obtain this information from the commandline, try:

rbt --last-compiled-program?
#
# File lib/rbt/installer/misc.rb, line 1585
def load_last_compiled_program
  _ = RBT.file_compiled_programs
  if File.exist? _
    @internal_hash[:last_compiled_program] = load_yaml(_)
    result = @internal_hash[:last_compiled_program]
    # ===================================================================== #
    # If we store it as an Array, the last compiled program is the
    # one that comes last in that Array, too.
    # ===================================================================== #
    result = result.last if result.is_a? Array
    # ===================================================================== #
    # It may include a '#' character, in which case we will treat this
    # as a comment:
    # ===================================================================== #
    if result.include? '#'
      result = result[0, result.index('#')].strip
    end
    return result # ← And return the result here.
  else
    opne "No file exists at `#{sfile(_)}`."
    opne 'Thus, we can not load anything.'
    exit_program
  end
end
Also aliased as: last_compiled_program?
load_yaml_dataset_for_this_program( i = install_this_program?, simple_or_complex = simple_or_complex? )
location_to_the_build_directory?()
main_dataset()
Alias for: cookbook_for?
main_dataset?()
Alias for: cookbook_for?
main_eight?() click to toggle source
#

main_eight?

#
# File lib/rbt/installer/misc.rb, line 4663
def main_eight?
  cookbook_for?.main_eight?
end
make_command?() click to toggle source
#

make_command?

Tell us which make command we will be using.

#
# File lib/rbt/installer/misc.rb, line 3291
def make_command?
  @internal_hash[:make_command]
end
make_file?()
Alias for: make_file_exists?
make_file_exists?() click to toggle source
#

make_file_exists?

Determine whether a “Makefile” exists or whether it does not exist.

#
# File lib/rbt/installer/misc.rb, line 3330
def make_file_exists?
  File.exist? 'Makefile'
end
Also aliased as: make_file?
make_install_stage_was_a_success?() click to toggle source
#

make_install_stage_was_a_success?

#
# File lib/rbt/installer/misc.rb, line 10578
def make_install_stage_was_a_success?
  @internal_hash[:make_install_stage_was_a_success]
end
make_object?() click to toggle source
#

make_object?

Query-method towards the @make object (aka RBT::Make).

#
# File lib/rbt/installer/misc.rb, line 9607
def make_object?
  @internal_hash[:make]
end
make_use_of_cookbook_aliases?() click to toggle source
#

make_use_of_cookbook_aliases?

#
# File lib/rbt/installer/misc.rb, line 5221
def make_use_of_cookbook_aliases?
  @internal_hash[:make_use_of_cookbook_aliases]
end
may_we_download?() click to toggle source
#

may_we_download?

#
# File lib/rbt/installer/misc.rb, line 12932
def may_we_download?
  return ihash?[:may_we_download]
end
may_we_initialize_a_new_cookbook_dataset?() click to toggle source
#

may_we_initialize_a_new_cookbook_dataset?

#
# File lib/rbt/installer/misc.rb, line 5032
def may_we_initialize_a_new_cookbook_dataset?
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset]
end
may_we_run_make_install_command?()
Alias for: run_make_install?
may_we_run_ninja?() click to toggle source
#

may_we_run_ninja?

#
# File lib/rbt/installer/misc.rb, line 5242
def may_we_run_ninja?
  @internal_hash[:may_we_run_ninja]
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
meson_build_file_exists?( at_this_location = return_pwd ) click to toggle source
#

meson_build_file_exists?

When we check for the file called “meson.build”, we must also keep in mind that we may use a build directory. This is the reason why the following code uses a variable.

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 133
def meson_build_file_exists?(
    at_this_location = return_pwd
  )
  if File.exist?(at_this_location) and File.file?(at_this_location)
    return true
  else
    # ===================================================================== #
    # Next check whether we do use a build directory or whether we do not.
    # ===================================================================== #
    if use_build_directory?
      target_file = File.absolute_path("#{at_this_location}../meson.build")
      check_for_this_file = target_file
    else
      check_for_this_file = "#{at_this_location}meson.build"
    end
    File.exist?(check_for_this_file)
  end
end
Also aliased as: meson_file_exists?
meson_configure_options?()
meson_file_exists?( at_this_location = return_pwd )
missing_cookbooks_dataset?() click to toggle source
#

missing_cookbooks_dataset?

#
# File lib/rbt/installer/misc.rb, line 15598
def missing_cookbooks_dataset?
  !a_program_has_been_initialized?
end
missing_packages?() click to toggle source
#

missing_packages?

#
# File lib/rbt/installer/misc.rb, line 10585
def missing_packages?
  RBT::Errors::MapLineToASpecificError.missing_packages?
end
mode?() click to toggle source
#

mode?

#
# File lib/rbt/installer/misc.rb, line 1227
def mode?
  cookbook_for?.mode?
end
modify_the_makefile?() click to toggle source
#

modify_the_makefile?

If this is used then it should be used before invoking the “make” step.

#
# File lib/rbt/installer/misc.rb, line 3975
def modify_the_makefile?
  cookbook_for?.modify_the_makefile?
end
my_program()
Alias for: cookbook_for?
name?()
name_for_the_build_directory?() click to toggle source
#

name_for_the_build_directory?

#
# File lib/rbt/installer/build_directory.rb, line 100
def name_for_the_build_directory?
  @internal_hash[:name_for_the_build_directory]
end
name_of_program?()
name_of_the_build_directory?()
ninja_install()
no_colours( be_verbose = true )
Alias for: disable_colours
no_cookbook_dataset?() click to toggle source
#

no_cookbook_dataset?

#
# File lib/rbt/installer/misc.rb, line 5129
def no_cookbook_dataset?
  !(
    @internal_hash and 
    @internal_hash[:yaml_dataset] and 
   !@internal_hash[:yaml_dataset].nil?
  )
end
no_error_has_occurred?() click to toggle source
#

no_error_has_occurred?

#
# File lib/rbt/installer/misc.rb, line 4609
def no_error_has_occurred?
  !an_error_has_occurred?
end
no_error_was_encountered?() click to toggle source
#

no_error_was_encountered?

#
# File lib/rbt/installer/misc.rb, line 15936
def no_error_was_encountered?
  !an_error_has_occurred?
end
no_postinstall_actions()
no_postinstall_step()
no_problem_has_occurred?() click to toggle source
#

no_problem_has_occurred?

This method will return true if no problem has occurred - otherwise it will return false.

#
# File lib/rbt/installer/misc.rb, line 10551
def no_problem_has_occurred?
  !problem?
end
Also aliased as: no_problem_was_encountered?
no_problem_was_encountered?()
notify_the_user_as_to_which_program_will_be_compiled_or_installed_next( i = compile_which_program?, _ = program_path? ) click to toggle source
#

notify_the_user_as_to_which_program_will_be_compiled_or_installed_next

Notify the user which program will be compiled/installed next through this method.

#
# File lib/rbt/installer/misc.rb, line 4532
def notify_the_user_as_to_which_program_will_be_compiled_or_installed_next(
    i = compile_which_program?,
    _ = program_path?
  )
  opne "#{rev}The program `#{steelblue(i)}` "\
       "will be #{compile_or_install_string?} next, in "\
       "#{lightgreen(mode?.to_s)} mode."
  opne "The #{steelblue('assumed local path')} is:"
  e
  e "  #{sfile(_)}"
  e
end
notify_the_user_that_ccache_is_not_available() click to toggle source
#

notify_the_user_that_ccache_is_not_available

Provide some information to the user about the use of ccache.

#
# File lib/rbt/installer/misc.rb, line 469
def notify_the_user_that_ccache_is_not_available
  opne swarn('You are trying to use ')+
       steelblue('ccache')+
       swarn(', as specified by the configuration')
  opnwarn 'file, but ccache could not be found. '+
          tomato('Please install ccache if')
  opnwarn tomato('you wish to use it.')+
          ' The URL to the latest source would be:'
  e
  efancy "  #{::RBT.return_url1_of_this_program(:ccache)}"
  e
  opnwarn 'If you do not want to use ccache, you can '\
          'disable ccache, via'
  opnwarn 'either of the following two options:'
  e
  efancy '  rbt --permanently-disable-ccache'
  e
  efancy '  rbt --disable-ccache # this variant will avoid '\
         'ccache just for this run'
  e
  opnwarn 'RBT will now continue without ccache.'
end
notify_the_user_that_cmake_could_not_be_found() click to toggle source
#

notify_the_user_that_cmake_could_not_be_found

Do note that this method is solely here for notifying/reporting - it may presently not do anything else but to report to the user.

#
# File lib/rbt/installer/misc.rb, line 13483
def notify_the_user_that_cmake_could_not_be_found
  opne "#{swarn('The program ')}#{sfancy('cmake')} #{swarn('could not')} "\
       "#{swarn('be found - thus, ')}#{tomato(compile_which_program?)}"
  opnewarn 'can not be compiled.'
  opnewarn 'Consider installing cmake if you wish to compile programs'
  opnewarn 'that require cmake for their compilation.'
end
notify_the_user_that_no_binary_python_could_be_found() click to toggle source
#

notify_the_user_that_no_binary_python_could_be_found

#
# File lib/rbt/installer/misc.rb, line 7494
def notify_the_user_that_no_binary_python_could_be_found
  opne 'No binary called "'+gold('python')+'" could be found. This may'
  opne 'be resolved by a symlink to e. g. python3.'
end
notify_the_user_that_porg_is_not_available() click to toggle source
#

notify_the_user_that_porg_is_not_available

#
# File lib/rbt/installer/misc.rb, line 15882
def notify_the_user_that_porg_is_not_available
  opne 'You are trying to use porg, but porg is not installed.'
  opne 'Please either install porg - or disable the configuration '
  opne "option use_porg in the #{slateblue('configuration setting')}."
end
notify_the_user_that_something_failed_at_configure_stage() click to toggle source
#

notify_the_user_that_something_failed_at_configure_stage

#
# File lib/rbt/installer/misc.rb, line 4492
def notify_the_user_that_something_failed_at_configure_stage
  opne swarn('Something appears to have failed at the configure stage.')
  report_status
end
notify_the_user_that_this_old_directory_will_be_removed_next(i) click to toggle source
#

notify_the_user_that_this_old_directory_will_be_removed_next

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 140
def notify_the_user_that_this_old_directory_will_be_removed_next(i)
  opne tomato('Removing')+' the '+seagreen('old directory')+' at `'+
       sdir(i)+'`.'
end
notify_the_user_that_this_program_is_missing( i = :jam ) { || ... } click to toggle source
#

notify_the_user_that_this_program_is_missing

The first argument to this method should be the program that is missing, such as ‘ruby’ or ‘htop’ or ‘glib’.

The method will also notify the user how to install the program via the RBT scripts, if this is applicable - aka, if this program is registered.

#
# File lib/rbt/installer/misc.rb, line 10717
def notify_the_user_that_this_program_is_missing(
    i = :jam
  )
  i = i.to_s unless i.is_a? String
  e; cliner(use_colour: :konsole_slateblue) {
    e "#{rev}#{sfancy(i)} was not found on your system."
    e
    e 'As you are running via the RBT scripts, you can possibly '\
      'install '+simp(i)
    e 'by issuing the following command:'
    e
    e '  '+sfancy("rbt #{i}")
    e
    # ===================================================================== #
    # Extra options can be passed into the block to this method.
    # ===================================================================== #
    if block_given?
      yield
    end
  }; e
end
notify_the_user_that_we_will_use_sed_from_the_pwd() click to toggle source
#

notify_the_user_that_we_will_use_sed_from_the_pwd

#
# File lib/rbt/installer/misc.rb, line 11298
def notify_the_user_that_we_will_use_sed_from_the_pwd
  opne "Next applying #{teal('sed')} in the "\
       "directory #{sdir_return_pwd}:"
end
ntrad( program_name_and_program_version = program_name_and_program_version?, be_verbose = true )
old_cflags?() click to toggle source
#

old_cflags?

#
# File lib/rbt/installer/misc.rb, line 13631
def old_cflags?
  ENV['CFLAGS'].to_s.dup
end
operating_system_in_use?( i = RUBY_PLATFORM ) click to toggle source
#

operating_system_in_use?

#
# File lib/rbt/installer/misc.rb, line 7838
def operating_system_in_use?(
    i = RUBY_PLATFORM
  )
  case i
  # ======================================================================= #
  # === linux
  # ======================================================================= #
  when /linux$/ # e. g. "x86_64-linux"
    'Linux'
  # ======================================================================= #
  # === win
  # ======================================================================= #
  when /win/,
       /mingw/
    'Windows'
  else
    'Undetermined (as of yet - please report it upstream)'
  end
end
opn( optional_i = { namespace: namespace? } )
Alias for: opnn
opnn( optional_i = { namespace: namespace? } ) click to toggle source
#

opnn (opnn tag)

#
# File lib/rbt/installer/misc.rb, line 728
def opnn(
    optional_i = { namespace: namespace? }
  )
  if use_opn?
    ::RBT::Installer.opnn(optional_i)
  end
end
Also aliased as: output_namespace?, opn, output_namespace?
original_base_directory?()
original_start_directory?() click to toggle source
#

original_start_directory?

#
# File lib/rbt/installer/misc.rb, line 16150
def original_start_directory?
  @internal_hash[:original_start_directory]
end
Also aliased as: original_base_directory?
output_all_urls() click to toggle source
#

output_all_urls

This method will output all URLs of every registered program.

Invocation example:

ry --output_all_urls
#
# File lib/rbt/installer/misc.rb, line 9933
def output_all_urls
  dataset = RBT.all_urls(:no_opn).result? # Tap into this method here, without outputting the namespace.
  dataset = dataset.map {|entry|
    entry[0] = '  '+(entry[0]+' ').ljust(30)
    entry.join
  }.join("\n")
  store_where = rbt_log_dir?+'all_program_urls.md'
  File.delete(store_where) if File.exist? store_where # Let's get rid of the old file first.
  opne "Storing into #{sfile(store_where)}"
  save_file(dataset, store_where)
end
output_all_urls_then_exit() click to toggle source
#

output_all_urls_then_exit

#
# File lib/rbt/installer/misc.rb, line 9917
def output_all_urls_then_exit
  output_all_urls
  exit_program
end
output_namespace?( optional_i = { namespace: namespace? } )
Alias for: opnn
package_rbt_scripts( also_exit = false ) click to toggle source
#

package_rbt_scripts (package tag, release tag)

You can use this method to package the RBT scripts.

A specialized class will do this for us, class PackageRbtScripts.

Invocation examples:

ry --package_rbt_scripts
ry --release
#
# File lib/rbt/installer/misc.rb, line 2729
def package_rbt_scripts(
    also_exit = false
  )
  unless RBT.const_defined? :PackageRbtScripts
    require 'rbt/utility_scripts/package_rbt_scripts.rb'
  end
  RBT::PackageRbtScripts.new
  also_exit = true if also_exit == :then_exit
  exit_program if also_exit
end
package_this_appdir(i) click to toggle source
#

package_this_appdir

Invocation example:

ry --package-appdir=htop
#
# File lib/rbt/installer/misc.rb, line 2699
def package_this_appdir(i)
  target = programs_dir?+i.capitalize+'/Current'
  if File.exist?(target) and File.symlink?(target)
    old_pwd = return_pwd
    initialize_dataset_for(i)
    cd target
    use_this_as_the_archive_name = i.downcase+'-'+program_version?
    to_tar_xz("#{target}*") {{
      use_this_archive_name: use_this_as_the_archive_name
    }}
    full_target = target+use_this_as_the_archive_name
    if File.exist? full_target
      mv(full_target, old_pwd)
    end
  end
end
parameters_to_make?() click to toggle source
#

parameters_to_make?

The aliased method to this method, called make_options?, is mildly discouraged after 12.04.2019. The primary reason for this is that the name parameters_to_make? is more explicit, and thus better in the long run (less confusing).

In September 2022 the alias .make_options?() was commented out.

#
# File lib/rbt/installer/misc.rb, line 12785
def parameters_to_make?
  _ = @internal_hash[:parameters_to_make]
  if _.nil?
    _ = cookbook_dataset_parameters_to_make?
  end
  #_ = _.join(' ').strip if _.is_a? Array
  return _ # Do not use .to_s here.
end
parameters_to_make_as_string?() click to toggle source
#

parameters_to_make_as_string?

#
# File lib/rbt/installer/misc.rb, line 12608
def parameters_to_make_as_string?
  if @internal_hash[:parameters_to_make]
    @internal_hash[:parameters_to_make].join(' ').strip.squeeze(' ')
  else
    ''
  end
end
parse_this_line_obtained_via_io_popen( line, use_colours = use_colours?, use_inner_padding = false ) click to toggle source
#

parse_this_line_obtained_via_io_popen (io-open tag, sys tag)

This method is used to parse all output generated via IO.popen().

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 791
def parse_this_line_obtained_via_io_popen(
    line,
    use_colours       = use_colours?,
    use_inner_padding = false
  )
  case use_colours
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    use_colours = use_colours?
  end
  # ======================================================================= #
  # Delegate towards class ColourizeParser next.
  # ======================================================================= #
  cparser = @internal_hash[:colourize_parser]
  unless use_colours
    cparser.disable_colours
  end
  line.chomp!
  # ======================================================================= #
  # Feed towards module RBT::Errors::MapLineToASpecificError next:
  # ======================================================================= #
  RBT::Errors::MapLineToASpecificError.parse_this_line(line)
  # ======================================================================= #
  # Next, put the line towards ColourizeParser. The reason why this is
  # done after the error checking above is to simply keep the output
  # as it was originally, before changing it via colours and the like.
  # ======================================================================= #
  cparser.grab_this_line(line)
  line = cparser.line?.dup
  # ======================================================================= #
  # === A required package was not found
  #
  # Notify the user about this problem.
  # ======================================================================= #
  if line.include?('A required package was not found') and
     !RBT::Errors::MapLineToASpecificError.required_packages?.empty?
    name_of_the_package = RBT::Errors::MapLineToASpecificError.required_packages?.first.to_s
    # ===================================================================== #
    # That name may end with -4, such as "gtksourceview-4". This is not
    # good as we report this, but the user should really just use
    # "gtksourceview" instead - hence the following check.
    # ===================================================================== #
    if name_of_the_package.include?('-') and (name_of_the_package =~ /-\d{1,20}$/)
      name_of_the_package = name_of_the_package.split('-')[0 .. -2].join('-')
    end
    line << ' '+crimson("( → #{name_of_the_package} is missing)")
    line << "#{N}#{N}You can try to install it via:#{N}"
    line << "#{N}#{slateblue('  rbt '+name_of_the_package)}#{N}#{N}"
  end
  # ======================================================================= #
  # The reason we output the line here is so that we can still do
  # modifications to it, if we have to. This is the case e. g. for
  # when we wish to display which package is missing.
  # ======================================================================= #
  if use_inner_padding
    e
    e "  #{line}" # Output here.
    e
  else
    e line # Output here.
  end
  if line.include?('configure: No such file or directory')
    opne 'The '+crimson('above error message')+' most likely means '\
         'that no configure script could be found.'
  end
  @internal_hash[:array_sys_command_string] << line # We could also store the lines here.
end
path_to_build_directory?()
pc_files?()
Alias for: pkgconfig_files?
permanently_add_this_global_flag(i) click to toggle source
#

permanently_add_this_global_flag

Use this method in order to permanently add a new global flag, into the file called “global_flags.yml”.

To test this method, try:

rbt --add-global-flag=--disable-static
#
# File lib/rbt/installer/misc.rb, line 11627
def permanently_add_this_global_flag(i)
  i = i.to_s.dup
  into = RBT.file_global_flags
  opne "Now appending the flag `#{sfancy(i)}` into the "\
       "file `#{sfile(into)}`."
  old_file_content = ''.dup
  if File.exist? into
    old_file_content << File.read(into).strip
  end
  old_file_content << " #{i}"
  what = old_file_content
  write_what_into(what, into)
  if is_on_roebe?
    into = ROEBE_FILE_GLOBAL_FLAGS
    opne 'Now appending the flag `'+sfancy(i)+'` into the '\
         'file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
Also aliased as: add_this_global_flag
permanently_disable_porg() click to toggle source
#

permanently_disable_porg

Permanently disable porg via this method.

#
# File lib/rbt/installer/misc.rb, line 15826
def permanently_disable_porg
  if use_porg?
    opne 'Disabling porg.'
    if configuration?.respond_to? :use_porg=
      configuration?.use_porg = false
      if configuration?.respond_to? :save_config
        configuration?.save_config
      else
        what = false
        into = FILE_USE_PORG
        opne "Storing into `#{sfile(into)}`."
        write_what_into(what, into)
      end
    else
      opne 'The configuration-object is not functional - it does not'
      opne 'respond to the method called .use_porg='
    end
  else
    opne 'Porg is already disabled.'
  end
end
permanently_enable_is_on_gobolinux( be_verbose = :be_verbose ) click to toggle source
#

permanently_enable_is_on_gobolinux

Use this method to “enable” the GoboLinux file layout.

To call this method from the commandline, do:

rbt --permanently-enable-is-on-gobolinux
#
# File lib/rbt/installer/misc.rb, line 11582
def permanently_enable_is_on_gobolinux(
    be_verbose = :be_verbose
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  end
  _ = RBT.file_is_on_gobolinux
  if File.exist? _
    opne "The file at `#{sfile(_)}` already exists."
  else
    if be_verbose
      opne "Enabling GoboLinux layout now via the file `#{sfile(_)}`."
    end
    opne "Now creating the file #{sfile(_)}."
    create_file(_)
    enable_is_on_gobolinux # And also enable the GoboLinux behaviour.
  end
end
permanently_remove_this_global_flag(i) click to toggle source
#

permanently_remove_this_global_flag

Use this method in order to permanently remove a new global flag, into the file called “global_flags.yml”.

To test this method, try:

rbt --remove-global-flag=--disable-static
#
# File lib/rbt/installer/misc.rb, line 11658
def permanently_remove_this_global_flag(i)
  i = i.to_s.dup
  into = RBT.file_global_flags
  old_file_content = ''.dup
  if File.exist? into
    old_file_content << File.read(into).strip
  end
  if old_file_content.include? i
    opne 'Now removing the flag `'+sfancy(i)+'` from the '\
         'file `'+sfile(into)+'`.'
    old_file_content.gsub!(/#{i}/,'')
  else
    opne "The flag `#{sfancy(i)}` can not be removed from "\
         "the file `#{sfile(into)}`."
    opne 'because this file does not have that flag.'
  end
  what = old_file_content
  write_what_into(what, into)
  if is_on_roebe?
    into = ROEBE_FILE_GLOBAL_FLAGS
    opne 'Now removing the flag `'+sfancy(i)+'` from the '\
         'file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
Also aliased as: remove_this_global_flag
permanently_set_programs_dir( what, into = FILE_PROGRAMS_DIRECTORY ) click to toggle source
#

permanently_set_programs_dir

#
# File lib/rbt/installer/misc.rb, line 11605
def permanently_set_programs_dir(
    what,
    into = FILE_PROGRAMS_DIRECTORY
  )
  opne 'Storing '+sfancy(what)+' into the file `'+sfile(into)+'`.'
  write_what_into(what, into)
  if is_on_roebe?
    into = RUBY_SRC_DIR_RBT_YAML+'configuration/programs_directory.yml'
    opne 'Storing '+sfancy(what)+' into the file `'+sfile(into)+'`.'
    write_what_into(what, into)
  end
end
permanently_set_programs_directory( what, into = FILE_PROGRAMS_DIRECTORY )
pid?() click to toggle source
#

pid?

#
# File lib/rbt/installer/misc.rb, line 11903
def pid?
  $?.pid
end
pin_this_program(i) click to toggle source
#

pin_this_program

#
# File lib/rbt/installer/misc.rb, line 1328
def pin_this_program(i)
  ::RBT.pin_this_program(i)
end
pkgconfig_files?() click to toggle source
#

pkgconfig_files?

Query method over the registered .pc files of a particular program.

#
# File lib/rbt/installer/misc.rb, line 4656
def pkgconfig_files?
  cookbook_for?.pkgconfig_files?
end
Also aliased as: pc_files?
populate_the_internal_hash_with_values_specific_to_class_installer() click to toggle source
#

populate_the_internal_hash_with_values_specific_to_class_installer

#
# File lib/rbt/installer/reset.rb, line 52
def populate_the_internal_hash_with_values_specific_to_class_installer
  reset_user_definable_variables
  reset_the_invariant_dataset_to_the_internal_hash
end
postinstall?()
Alias for: postinstallation?
postinstallation?() click to toggle source
#

postinstallation?

#
# File lib/rbt/installer/postinstallation.rb, line 132
def postinstallation?
  _ = cookbook_dataset_postinstall?
  # ======================================================================= #
  # The following part is, as of January 2019, only added when we have
  # modified this variable through the method set_user_prefix(). The
  # user can (currently) not modify this variable on his/her own.
  # ======================================================================= #
  unless @internal_hash[:postinstallation].nil?
    _ = @internal_hash[:postinstallation]
  end
  _ # Return it here.
end
Also aliased as: postinstall?
pre_configure_steps?() click to toggle source
#

pre_configure_steps?

#
# File lib/rbt/installer/misc.rb, line 4633
def pre_configure_steps?
  cookbook_for?.pre_configure_steps?
end
pre_make_install_sed()
pre_make_install_sed?() click to toggle source
#

pre_make_install_sed

#
# File lib/rbt/installer/misc.rb, line 3833
def pre_make_install_sed?
  cookbook_dataset?.pre_make_install_sed?
end
Also aliased as: pre_make_install_sed
prefix()
Alias for: use_which_prefix?
prefix=( i = :appdir_prefix )
Alias for: set_user_prefix
prefix?()
Alias for: use_which_prefix?
prefix_as_string?() click to toggle source
#

prefix_as_string?

#
# File lib/rbt/installer/misc.rb, line 1100
def prefix_as_string?
  prefix?.to_s
end
preinstall?()
prepare_dataset_for( i = install_this_program?, simple_or_complex = simple_or_complex? )
prepare_for_gcc() click to toggle source
#

prepare_for_gcc

This method can be used to aid in the preparation of compiling a new GCC from source.

#
# File lib/rbt/installer/misc.rb, line 11803
def prepare_for_gcc
  # ======================================================================= #
  # === gmp
  # ======================================================================= #
  initialize_cookbook_dataset_for(:gmp)
  cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose }
  extract_what_to(File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists)
  rename(
    remove_archive_at_the_end(
      File.basename(cookbook_dataset_program_path?)
    ), 'gmp'
  )
  # ======================================================================= #
  # === mpc
  # ======================================================================= #
  initialize_cookbook_dataset_for(:mpc)
  cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose }
  extract_what_to(File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists)
  rename(
    remove_archive_at_the_end(
      File.basename(cookbook_dataset_program_path?)
    ), 'mpc'
  )
  # ======================================================================= #
  # === mpfr
  # ======================================================================= #
  initialize_cookbook_dataset_for(:mpfr)
  cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose }
  extract_what_to(File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists)
  rename(
    remove_archive_at_the_end(
      File.basename(cookbook_dataset_program_path?)
    ), 'mpfr'
  )
end
prepend_dot_to_configure_string() click to toggle source
#

prepend_dot_to_configure_string

#
# File lib/rbt/installer/misc.rb, line 7416
def prepend_dot_to_configure_string
  full_configure_command?.prepend('.')
end
prepend_env_path_with(i = '/usr/bin/') click to toggle source
#

prepend_env_path_with

This method will effectively prepend to the PATH variable.

#
# File lib/rbt/installer/misc.rb, line 7181
def prepend_env_path_with(i = '/usr/bin/')
  unless i.end_with? ':'
    i = i.dup if i.frozen?
    i << ':'
  end
  set_path("#{i}#{query_path?}")
end
problem?() click to toggle source
#

problem?

#
# File lib/rbt/installer/misc.rb, line 395
def problem?
  @internal_hash[:problem]
end
problem_is( i = nil, optional_extra_information = nil ) click to toggle source
#

problem_is

Keep in mind that not every problem is an error. An error will indicate that copilationg will (or already has) fail(ed).

An example for an error may be :missing_headers, which indicates that some .h files may be missing (or could not be found, anyway).

An example for a problem may be some add-on failing, without this being a “critical problem” (aka an error).

This file here holds code, as part of RBT::Installer, which handles specific “problems”, in particular during GNU configure invocations, and more serious problems, also called “errors” (aka “critical problems”).

Now - what does this effectively mean?

For instance, consider that the configure script determines that you are missing some .h header file or some linking step can not be done. Then the user should be notified about this problem in a constructive, useful manner as well - or at the least be able to do so. This information should be helpful, and ideally provide suggestions as to how to resolve the issue at hand.

The GNU configure scripts are often extremely cryptic to a user, so this code here also attempts to make it easier to discover what kind of problems are giving issues. Some errors such as faulty libtool files, can sometimes be automatically corrected, to some extent (that is, remove or correct the faulty libtool file, and then continue).

For each of the “triumvirate” of compiling, that is “configure”, “make” and “make install” steps, we can set success or failure individually.

#
# File lib/rbt/installer/misc.rb, line 437
def problem_is(
    i                          = nil,
    optional_extra_information = nil
  )
  case i
  when :default,
       :no_problem # This is the default too. The nil value will be used in these cases.
    i = nil
  end
  if i.is_a? Array
    i = i.first # Only use the first Array entry.
  end
  if optional_extra_information
    @internal_hash[:problem] = [i, optional_extra_information]
  else # This here is the default - it is a LOT more common.
    @internal_hash[:problem] = i
  end
end
problem_is?()
Alias for: problem?
problems?()
Alias for: problem?
program?()
program_compile_name?() click to toggle source
#

program_compile_name?

#
# File lib/rbt/installer/misc.rb, line 4670
def program_compile_name?
  cookbook_for?.program_compile_name?.to_s
end
program_full_name?() click to toggle source
#

program_full_name?

This will always query the dataset object.

#
# File lib/rbt/installer/misc.rb, line 5186
def program_full_name?
  cookbook_dataset?.program_full_name? # This returns e. g. 'gnome-mahjonng-5.08.tar.xz'
end
program_has_to_be_compiled?() click to toggle source
#

program_has_to_be_compiled?

The query-method program_has_to_be_compiled? determines whether our program has to be compiled or whether it does not have to be compiled.

For example, ruby .gem files typically do not have to be compiled, whereas C/C++ projects have to be compiled.

Note that this requires a setting in the .yml file. While it could probably be automatically determined whether a program has to be compiled, for the time being (November 2019) we will simply define this manually.

#
# File lib/rbt/installer/misc.rb, line 13994
def program_has_to_be_compiled?
  cookbook_for? and
  cookbook_dataset_program_has_to_be_compiled?
end
program_information_return_name(i) click to toggle source
#

program_information_return_name

This method can be used to specifically return the short name of a given input-String. That input-String usually is a remote URL to some program.

#
# File lib/rbt/installer/misc.rb, line 10534
def program_information_return_name(i)
  program_information_return_short_name(File.basename(i))
end
program_information_return_program_name(i) click to toggle source
#

program_information_return_program_name

#
# File lib/rbt/installer/misc.rb, line 10523
def program_information_return_program_name(i)
  ProgramInformation.return_program_name(i)
end
program_information_return_program_real_name(i) click to toggle source
#

program_information_return_program_real_name

#
# File lib/rbt/installer/misc.rb, line 10541
def program_information_return_program_real_name(i)
  ProgramInformation.return_program_real_name(i)
end
program_information_return_program_version(i)
program_information_return_short_name(i) click to toggle source
#

program_information_return_short_name

In the past ProgramInformation was called directly, but because ProgramInformation may fail, it was tedious to trace back what happened where, and why it failed. So the method here was created, on 11.11.2019.

#
# File lib/rbt/installer/misc.rb, line 10503
def program_information_return_short_name(i)
  if i.include? '-'
    ProgramInformation.return_short_name(i)
  else
    i
  end
end
program_information_return_version(i) click to toggle source
#

program_information_return_version

This “substitutes” calls to ProgramInformation.return_version().

#
# File lib/rbt/installer/misc.rb, line 10516
def program_information_return_version(i)
  ProgramInformation.return_version(File.basename(i))
end
program_name?()
program_name_and_program_version?( cookbook_for = cookbook_for? )
program_name_and_version?( cookbook_for = cookbook_for? )
program_path?()
program_to_compile?()
program_uses_an_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
program_uses_cmake?()
Alias for: depends_on_cmake?
program_version()
Alias for: program_version?
program_version?() click to toggle source
#

program_version?

This method will return the program version in use. The default will be to simply use the version stored in the cookbook dataset, but we also allow for the user to supply commandline-flags to use any other program version that he/she desires to use.

#
# File lib/rbt/installer/misc.rb, line 10812
def program_version?
  _ = cookbook_dataset_program_version? # ← Default value.
  # ======================================================================= #
  # The user can override it.
  # ======================================================================= #
  if @internal_hash[:use_this_specific_program_version]
    _ = @internal_hash[:use_this_specific_program_version]
  end
  #_.delete('/') if _ # A bit hackish, since it is a workaround, but necessary for now (Jan 2019).
  # ^^^ the above was disabled as of September 2022. Not sure if it will be
  #     reinstated. We hopefully no longer need it now after the rewrite.
  return _
end
Also aliased as: version?, program_version
purge_all_man_files_in_the_programs_hierarchy() click to toggle source
#

purge_all_man_files_in_the_programs_hierarchy

Invoke this method by issuing something like this:

ry --nomanpage
#
# File lib/rbt/installer/misc.rb, line 7372
def purge_all_man_files_in_the_programs_hierarchy
  target = programs_directory?
  opne "Now purging all man-pages in `#{sdir(target)}`."
  opne '(Note that we will only work on entries pointed at '\
       'with a Current symlink.)'
  Dir[target+'*'].each {|entry|
    entry << '/' unless entry.end_with? '/'
    current = entry + 'Current'
    if File.symlink? current
      # =================================================================== #
      # Ok, the Current → symlink exists, thus we can continue.
      # =================================================================== #
      manpage = "#{File.readlink(current)}/share/man/"
      manpage = rds(manpage)
      if File.exist? manpage and File.directory? manpage
         opne "Now #{tomato('removing')} the directory `#{sdir(manpage)}`."
         remove_directory(manpage) unless manpage.squeeze('/') == '/' # Trivial "safeguard".
      end
    end
  }
end
purge_all_settings_directories() click to toggle source
#

purge_all_settings_directories

#
# File lib/rbt/installer/misc.rb, line 1307
def purge_all_settings_directories
  # ======================================================================= #
  # We need to avoid entries such as:
  #
  #   /home/Programs/Qt/5.14.0/qml/QtQuick/VirtualKeyboard/Settings
  #
  # This explains the .count('/') action in the code below.
  # ======================================================================= #
  all_settings_directories = Dir[programs_dir?+'**/Settings'].select {|entry|
    File.directory?(entry) and
    entry.end_with?('Settings') and
    (entry.count('/') == 4)
  }.sort
  opne 'Next removing '+sfancy(all_settings_directories.size)+' directories.'
  remove_these_directories(all_settings_directories) { :be_verbose }
end
purge_fhs_binaries_of_this_program( i = compile_which_program? ) click to toggle source
#

purge_fhs_binaries_of_this_program

This method will purge binaries that may reside at the /usr/bin/ hierarchy. Be careful when using this - only use it when you are sure that you want this functionality.

Invocation examples:

ry littleutils --purge-fhs-binaries
ry --purge-traditional-binaries-from=xscreensaver
#
# File lib/rbt/installer/misc.rb, line 4018
def purge_fhs_binaries_of_this_program(
    i = compile_which_program?
  )
  if i.nil?
    opne 'Please provide a valid program name to this method.'
    return
  end
  PurgeBinariesOfThisProgram.new(i.downcase)
end
purge_fhs_libraries_of_this_program( i = compile_which_program? ) click to toggle source
#

purge_fhs_libraries_of_this_program

Get rid of all /usr/lib/ libraries of the respective program at hand.

Invocation example:

ry --fhs-purge-libraries=libgc
#
# File lib/rbt/installer/misc.rb, line 8432
def purge_fhs_libraries_of_this_program(
    i = compile_which_program?
  )
  if i.nil?
    opne 'Please provide a valid program name to this method.'
    return
  end
  PurgeLibrariesOfThisProgram.new(i)
end
purge_these_binaries( i = binaries? ) click to toggle source
#

purge_these_binaries

This method can be used to purge binaries.

#
# File lib/rbt/installer/misc.rb, line 8075
def purge_these_binaries(
    i = binaries?
  )
  removed_n_binaries = 0
  opne "Now attempting to remove #{sfancy(i.size.to_s)} binaries:"
  e
  i.each {|this_binary|
    target = "/usr/bin/#{this_binary}"
    ftype = nil
    begin
      ftype = File.ftype(target)
    rescue Errno::ENOENT; end
    if File.exist? target
      e "Deleting the file `#{sfile(target)}` next."
      remove_file(target)
      removed_n_binaries += 1
    else
      if ftype == 'link'
        e "Deleting the stray symlink at `#{sfile(target)}` next."
        remove_symlink(target)
      end
    end
  }
  e
  if removed_n_binaries == 0
    opne 'None of these binaries could be '\
         'found at '+sdir('/usr/bin/')+'.'
  end
end
query_configuration_options( i = compile_this_program? ) click to toggle source
#

query_configuration_options

This method will query the configuration option of a given program.

Invocation example:

ry glibc qco
#
# File lib/rbt/installer/misc.rb, line 14212
def query_configuration_options(
    i = compile_this_program?
  )
  action(:show_configuration_options, i)
  exit_program
end
query_debug_value(i = RBT.debug?) click to toggle source
#

query_debug_value

#
# File lib/rbt/installer/misc.rb, line 13215
def query_debug_value(i = RBT.debug?)
  opne "Will we debug? #{sfancy(yes_no(i))}"
end
query_for(i) click to toggle source
#

query_for

#
# File lib/rbt/installer/misc.rb, line 15503
def query_for(i)
  case i.to_s
  # ======================================================================= #
  # === "Will be extracted towards"
  # ======================================================================= #
  when /^Will(-|_| )?be(-|_| )?extracted(-|_| )?towards:?$/i,
       /^extract(-|_| )?to(-|_| )?this(-|_| )?directory\??$/i,
       /^extract(-|_| )?to\??$/i
    will_be_extracted_towards?
  # ======================================================================= #
  # === "Assumed Operating System:"
  # ======================================================================= #
  when /^Assumed Operating System:?$/i
    operating_system_in_use?
  # ======================================================================= #
  # === "Prefix:"
  # ======================================================================= #
  when /^Prefix:?$/i
    prefix?
  # ======================================================================= #
  # === "Required dependencies on:"
  # ======================================================================= #
  when /^Required(-|_| )?dependencies(-|_| )?on:?$/i
    required_dependencies_on?
  # ======================================================================= #
  # === "Host architecture in use:"
  # ======================================================================= #
  when /^Host(-|_| )?architecture(-|_| )?in(-|_| )?use:?$/i
    host_achiteture_in_use?
  # ======================================================================= #
  # === "CFLAGS in use:"
  # ======================================================================= #
  when /^CFLAGS(-|_| )?in(-|_| )?use:?$/i
    verbose_cflags_in_use? # Use a more verbose variant for the CFLAGs in use.
  # ======================================================================= #
  # === "Build system to be used"
  # ======================================================================= #
  when /^Build(-|_| )?system(-|_| )?to(-|_| )?be(-|_| )?used:?$/i
    build_system_to_be_used?
  # ======================================================================= #
  # === "Use a build directory:"
  # ======================================================================= #
  when /^Use(-|_| )?a(-|_| )?build(-|_| )?directory:?$/i
    use_a_build_directory?
  # ======================================================================= #
  # === "Compiler to be used:"
  # ======================================================================= #
  when /^Compiler(-|_| )?to(-|_| )?be(-|_| )?used:?$/i
    compiler_to_be_used?
  # ======================================================================= #
  # === "Will ccache be used:"
  # ======================================================================= #
  when /^Will(-|_| )?ccache(-|_| )?be(-|_| )?used:?$/i
    will_ccache_be_used?
  else
    # ===================================================================== #
    # Otherwise we will query the cookbook-dataset. This may sometimes
    # lead to problems, so it is better to define every query-related
    # method in the case-when menu above.
    # ===================================================================== #
    cookbook_for?.query_for(i)
  end
end
query_for_configure_options_or_meson_options( i = 'configure-options:' )
query_for_configure_options_or_meson_options_or_cmake_options( i = 'configure-options:' ) click to toggle source
#

query_for_configure_options_or_meson_options_or_cmake_options

Return either cmake or meson or configure options accordingly.

#
# File lib/rbt/installer/misc.rb, line 13934
def query_for_configure_options_or_meson_options_or_cmake_options(
    i = 'configure-options:'
  )
  case i
  # ======================================================================= #
  # === configure options:
  # ======================================================================= #
  when /^configure(-|_| )?options:?$/i
    case build_system?
    when 'cmake'
      return_cmake_configure_options_while_considering_GNU_configure_options
    when 'meson'        
      meson_configure_options?.to_s
    else
      configure_options?
    end
  end
end
rcp(i)
real_prefix?()
Alias for: use_which_prefix?
real_program_name?()
real_short_name?()
rebuild_path() click to toggle source
#

rebuild_path

#
# File lib/rbt/installer/misc.rb, line 8840
def rebuild_path
  cookbook_dataset?.reassemble_program_path
end
register_all_programs() click to toggle source
#

register_all_programs

#
# File lib/rbt/installer/misc.rb, line 13863
def register_all_programs
  get_all_programs.each {|entry| register_program(entry) }
end
register_all_protos_for_compilation() click to toggle source
#

register_all_protos_for_compilation

Invoke this method like so:

ry --protos
#
# File lib/rbt/installer/misc.rb, line 1660
def register_all_protos_for_compilation
  proto_programs = available_programs?.select {|entry|
    entry.include?('proto')
  }
  proto_programs.reject! {|line|
    line.include? 'protobuf'
  }
  # ======================================================================= #
  # Reject those that are .gem files next - but this will only work if
  # the directory with expanded cookbooks is available:
  # ======================================================================= #
  if directory_expanded_cookbooks_exists?
    proto_programs.reject! {|name_of_the_program|
      this_file = directory_expanded_cookbooks+name_of_the_program+'.yml'
      if File.exist? this_file
        dataset = load_yaml(this_file)
        dataset['program_path'].end_with? '.gem'
      else
        e 'No file called '+sfile(this_file)+' was found.'
        nil
      end
    }
  end
  opne "We will next compile all "\
       "#{sfancy(proto_programs.size.to_s)}"\
       " proto-programs."
  set_compile_these_programs(proto_programs)
end
register_configure_line_into_configure_database() click to toggle source
#

register_configure_line_into_configure_database

This method will register the complete configure-line used by the program at hand, into a yaml “database”. This is just a single .yml file that keeps track of all configure options used when compiling a program.

#
# File lib/rbt/installer/misc.rb, line 6312
def register_configure_line_into_configure_database
  compile_this_program = compile_which_program?
  store_this = full_configure_command?.dup
  unless store_this.empty?
    # ===================================================================== #
    # First load up the old "database" if it exists.
    #
    # This is a "global" database, in the sense that it may typically
    # reside at a location like this:
    #
    #   /home/Temp/rbt/configure_command_database.yml
    #
    # Do note that the RBT project will also store this on a per-application
    # basis in the corresponding AppDir directory (under Resources/).
    # Since not every program is compiled via an AppDir, we need both
    # the global database, and a per-app specific entry.
    # ===================================================================== #
    into = RBT.file_configure_database?
    hash = {}
    # ===================================================================== #
    # Load the dataset from the file if it already exists.
    # ===================================================================== #
    if File.exist? into
      hash.update(YAML.load_file(into))
    end
    # ===================================================================== #
    # We do not need to delete any old entry, because the following line
    # will overwrite the old content anyway, if it exists.
    # ===================================================================== #
    hash[compile_this_program] = store_this
    what = YAML.dump(hash)
    opne 'Storing the configure command'
    opne "  #{sfancy(store_this)}"
    opne "into the file `#{sfile(into)}`."
    write_what_into(what, into)
  end
end
register_last_compiled_program( i = compile_which_program? ) click to toggle source
#

register_last_compiled_program

This method will try to store the last compiled program into the file determined via the method call RBT.file_compiled_program().

We will only store if the entry is DIFFERENT to the last one though.

This file is:

$RBT/yaml/last_compiled_program.yml
#
# File lib/rbt/installer/misc.rb, line 14332
def register_last_compiled_program(
    i = compile_which_program?
  )
  unless has_a_problem_occurred?
    unless do_not_compile? and !register_the_last_compiled_program? # Continue only if we do want to compile.
      file = RBT.file_compiled_programs
      base_dir = File.dirname(file)
      mkdir(base_dir) unless Dir.exist? base_dir
      if File.exist?(file) and !File.empty?(file) # Must check whether the file exists first.
        array_dataset = YAML.load_file(file)
      else
        array_dataset = []
      end
      if array_dataset.respond_to? :uniq!
        array_dataset.uniq!
      # else
      #   opne swarn('Some minor problem occurred:')
      end
      unless (array_dataset.last == i) and !array_dataset.empty? # Storing only if it is different.
        opne 'Trying to register the last compiled program '\
             '(`'+springgreen(i)+'`) into the file:'
        opne "  #{sfile(file)}"
        # ================================================================= #
        # Remove any old entries, if they exist.
        # ================================================================= #
        if array_dataset.include? i 
          array_dataset.reject! {|entry| entry == i }
        end
        # ================================================================= #
        # And next, add that entry:
        # ================================================================= #
        array_dataset << i
        what = YAML.dump(array_dataset)
        # ================================================================= #
        # Simply append to the dataset (aka file) at hand.
        # ================================================================= #
        write_what_into(what, file)
      end if array_dataset.respond_to? :last
    end
  end
end
register_required_dependency( name_of_the_program, program_version ) click to toggle source
#

register_required_dependency

#
# File lib/rbt/installer/misc.rb, line 13870
def register_required_dependency(
    name_of_the_program, program_version
  )
  @internal_hash[:array_required_dependencies] << [
    name_of_the_program, program_version
  ]
end
register_sigint() click to toggle source
#

register_sigint

We have to register the siginterrupts, so as to gracefully handle user-interrupts via Ctrl-C.

#
# File lib/rbt/installer/misc.rb, line 2836
def register_sigint
  Signal.trap('SIGINT') {
    do_set_keep_extracted(:be_silent)
    do_not_run_ldconfig
    remove_compiling_is_in_progress
    opne 'Exiting now at once.'
    exit_program
  }
end
register_that_this_program_is_currently_being_compiled( into = RBT.file_status ) click to toggle source
#

register_that_this_program_is_currently_being_compiled

This method will register that a given program is currently being compiled.

#
# File lib/rbt/installer/misc.rb, line 13908
def register_that_this_program_is_currently_being_compiled(
    into = RBT.file_status # ← This may be e. g. "/Depot/Temp/rbt/status.yml".
  )
  dataset = {}
  if File.exist? into
    dataset.merge!(YAML.load_file(into))
  end
  unless dataset.has_key? 'currently_compiling_these_programs'
    dataset['currently_compiling_these_programs'] = []
  end
  dataset['currently_compiling_these_programs'] << compile_this_program?
  what = YAML.dump(dataset)
  # ======================================================================= #
  # We must sure that the base directory exists.
  # ======================================================================= #
  unless File.directory?(File.dirname(into))
    mkdir(File.dirname(into))
  end
  write_what_into(what, into)
end
register_the_last_compiled_program?() click to toggle source
#

register_the_last_compiled_program?

#
# File lib/rbt/installer/misc.rb, line 13849
def register_the_last_compiled_program?
  @internal_hash[:register_the_last_compiled_program]
end
registered_erroneous_libtool_entries?() click to toggle source
#

registered_erroneous_libtool_entries?

#
# File lib/rbt/installer/misc.rb, line 2123
def registered_erroneous_libtool_entries?
  RBT::Errors::MapLineToASpecificError.erroneous_libtool_entries?
end
Also aliased as: erroneous_libtool_entries?
registered_errors?()
Alias for: problem?
remote_url?()
Alias for: url1?
remove_all_temp_directories() click to toggle source
#

remove_all_temp_directories

This method will remove all directories in the /Depot/Temp hierarchy. It was added since it is sometimes easier to just remove all extracted archives via batch-process.

#
# File lib/rbt/installer/misc.rb, line 10094
def remove_all_temp_directories
  _ = rbt_log_dir?
  # ======================================================================= #
  # Select all directories in that directory next:
  # ======================================================================= #
  all_directories_there = Dir["#{_}*"].select {|entry| File.directory? entry }
  opne "All #{sfancy(all_directories_there.size.to_s)}"\
       " directories in the #{sdir(_)} hierarchy will be removed."
  remove_these_directories(all_directories_there)
end
remove_empty_directories( i = return_pwd ) click to toggle source
#

remove_empty_directories

#
# File lib/rbt/installer/misc.rb, line 8313
def remove_empty_directories(
    i = return_pwd
  )
  opne "Now trying to remove all empty directories from the directory "\
       "#{sdir(i)}."
  require 'rbt/utility_scripts/remove_empty_directories.rb'
  RBT.remove_empty_directories(i)
end
remove_extracted_archive( where = :build_anew ) click to toggle source
#

remove_extracted_archive

This method simply removes the extracted archive. If @keep_extracted was set to true we will not run it, but this is decided in another method called consider_removing_extracted_archive().

Note that the invocation of this method must happen last, as otherwise we may run into problems such as:

in `pwd': No such file or directory - getcwd (Errno::ENOENT)

We can not use the string returned by the method extract_to_this_directory? because this will refer to the rbt/ base directory.

#
# File lib/rbt/installer/misc.rb, line 3600
def remove_extracted_archive(
    where = :build_anew
  )
  case where
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default,
       :build_anew
    where = rds(will_be_extracted_towards?)
  end
  if run_simulation? # Run in simulation mode here.
    opne sfancy('We run in simulation mode right now. Normally '\
         'the directory ')
    opne sdir(where)+sfancy('would next be removed.')
  elsif is_a_gem_file?
    # ===================================================================== #
    # Ruby .gem files are no longer considered "removable" since as of
    # 17.06.2020.
    # ===================================================================== #
  elsif where == log_dir?
    opne 'Can not remove '+sdir(log_dir?)+'.'
  else # ================================================================== #
       # We must honour the keep_extracted setting. We also will not
       # remove the log directory.
       # ================================================================== #
    if keep_the_extracted_archive? or (where == RBT.log_directory?)
      # =================================================================== #
      # In this case we do not have to do anything.
      # =================================================================== #
    else
      opne "Removing the extracted archive at `#{sdir(where)}`."
      unless File.directory? where
        _ = 'However had, no such directory exists. Perhaps '\
            'it was'
        opne _
        opne 'already removed, or it has never existed.'
      end
      # =================================================================== #
      # We must check whether the directory exists, before trying to
      # remove it.
      # =================================================================== #
      if File.directory? where
        remove_directory(where)
      else
        # No directory exists there.
      end
    end
  end
end
remove_la_files_after_compilation?()
remove_the_extracted_archive( where = :build_anew )
remove_the_extracted_archive?() click to toggle source
#

remove_the_extracted_archive?

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 166
def remove_the_extracted_archive?
  !keep_the_extracted_archive?
end
remove_this_global_flag(i)
rename_shell( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? )
rename_tab_title?() click to toggle source
#

rename_tab_title?

#
# File lib/rbt/installer/misc.rb, line 13324
def rename_tab_title?
  @internal_hash[:rename_tab_title]
end
Also aliased as: rename_the_terminal?
rename_the_terminal?()
Alias for: rename_tab_title?
report_all_blfs_entries() click to toggle source
#

report_all_blfs_entries

#
# File lib/rbt/installer/misc.rb, line 15150
def report_all_blfs_entries
  RBT::Blfs.new(:run_everything)
end
report_all_programs_that_make_use_of_a_build_directory() click to toggle source
#

report_all_programs_that_make_use_of_a_build_directory

This method can report all programs that make use of a build directory. Note that this presently depends on the existance of the directory expanded_cookbooks.

Usage example:

installer --show-all-programs-that-make-use-of-a-build-directory
#
# File lib/rbt/installer/misc.rb, line 12887
def report_all_programs_that_make_use_of_a_build_directory
  opne 'Trying to determine all programs that use '\
       'a build-directory ...'
  opne 'This may take a moment ...'
  use_this_key = :use_build_directory # It is stored as a Symbol.
  if expanded_directory_exists?
    # ===================================================================== #
    # Find all cookbooks in the expanded-cookbook-directory next:
    # ===================================================================== #
    target = directory_expanded_cookbooks?
    all_files = Dir["#{target}*.yml"]
    all_files.select! {|entry|
      dataset = YAML.load_file(entry)
      dataset[use_this_key] and (dataset[use_this_key] == true)  # Obtain all entries with this key here.
    }
    all_files.map! {|entry|
      File.basename(entry).sub(/\.yml$/,'')
    }
    if all_files.empty?
      opne 'No cookbook recipe makes use of a build directory.'
    else
      opne "The following #{slateblue(all_files.size.to_s)} programs "\
           "make use of a build directory:"
      all_files.each_with_index {|this_program, index| index += 1
        padded_index = index.to_s.rjust(4).ljust(6)
        colourized_and_padded_index = royalblue(padded_index)
        e colourized_and_padded_index+
          lightblue(this_program)
      }
    end
  else
    # ===================================================================== #
    # else notify the user how to create the relevant directory.
    # ===================================================================== #
    opne 'The expanded directory does not exist. You can (re)create it'
    opne 'by issuing:'
    e
    e '  rbt --create-expanded-directory'
    e
  end
end
report_finished_installing_this_program( i = compile_this_program? ) click to toggle source
#

report_finished_installing_this_program

Report that we have finished compiling the program.

#
# File lib/rbt/installer/misc.rb, line 15372
def report_finished_installing_this_program(
    i = compile_this_program?
  )
  unless do_not_compile?
    unless problem? || an_error_has_occurred?
      opne "Finished installing the program `#{sfancy(i)}`."
    end
  end
end
report_n_programs() click to toggle source
#

report_n_programs

Report how many programs (cookbook files) are currently registered in the RBT project.

Commandline-invocation example:

rbt --report-n-programs
#
# File lib/rbt/installer/misc.rb, line 15362
def report_n_programs
  require 'rbt/utility_scripts/report_the_registered_programs.rb'
  RBT.report_the_registered_programs
end
report_rbt_version( optional_shall_we_exit = false ) click to toggle source
#

report_rbt_version

This method will report the version in use by the RBT project.

Invocation examples:

ry --version
rbt version?
#
# File lib/rbt/installer/misc.rb, line 12959
def report_rbt_version(
    optional_shall_we_exit = false
  )
  case optional_shall_we_exit
  when :also_exit,
       :then_exit
    optional_shall_we_exit = true
  end
  # ======================================================================= #
  # We will show the version of the RBT scripts, and we will also
  # display when the project was last updated.
  # ======================================================================= #
  RBT.report_rbt_version(:also_show_when_the_project_was_last_updated)
  exit if optional_shall_we_exit
end
report_size_of_these_programs( i, size_of_the_programs = 0 ) click to toggle source
#

report_size_of_these_programs

This method will report the size of the issued programs.

The programs are to be given as the first argument to this method, ideally as an Array.

#
# File lib/rbt/installer/misc.rb, line 15226
def report_size_of_these_programs(
    i, size_of_the_programs = 0
  )
  if i.is_a? String and i.include?('=')
    i = i.to_s.dup if i.frozen?
    i.gsub!(/--size=/,'')
    i = i.split(',') if i.include? ','
  end
  i = [i] unless i.is_a? Array
  i.each {|entry|
    dataset = self.new(entry)
    unless use_colours?
      dataset.disable_colours
    end
    size = dataset.size?.to_i
    opne "Now working on #{sfancy(entry.rjust(8))}"\
         " (Size: #{size.to_s.rjust(8)} bytes)"
    size_of_the_programs += size
  }
  e
  opne 'The size of the programs '+sfancy(i.join(','))+' is:'
  e
  if Object.const_defined?(:Roebe) and
     Roebe.const_defined?(:HumanReadable)
    size_of_the_programs = Roebe::HumanReadable[size_of_the_programs]
  end
  result = "  #{simp(size_of_the_programs.to_s)}".dup
  result << ' bytes' unless size_of_the_programs.to_s.strip.end_with? 'B'
  opne result
  e
end
report_status()
report_status_information() click to toggle source
#

report_status_information

Invocation example:

rbt --report-status
#
# File lib/rbt/installer/misc.rb, line 10221
def report_status_information
  e
  e 'The source directory is at:                      '+sdir(RBT.source_dir?)
  e 'The temp directory is at:                        '+sdir(RBT.temp_dir?)
  report_where_archives_will_be_extracted_into
  e
end
report_the_amount_of_binaries( i = compile_which_program? ) click to toggle source
#

report_the_amount_of_binaries

Invocation examples:

ry glib --n-binaries?
Installer glib --n-binaries?
#
# File lib/rbt/installer/misc.rb, line 15924
def report_the_amount_of_binaries(
    i = compile_which_program?
  )
  ensure_proper_dataset_for(i) if cookbook_dataset?.nil?
  _ = binaries?
  opne 'The program '+sfancy(i)+' will '\
       'install '+sfancy(_.size.to_s)+' binaries.'
end
report_the_compile_strategies() click to toggle source
#

report_the_compile_strategies

#
# File lib/rbt/installer/misc.rb, line 9257
def report_the_compile_strategies
  require 'rbt/statistics/compile_strategies.rb' # bl $RBT/statistics/compile_strategies.rb
  RBT.report_the_compile_strategies
end
report_the_kde_status() click to toggle source
#

report_the_kde_status

This method will report the “status” of the KDE project, as far as the cookbooks project is concerned.

What is meant here is that this method will simply report the main constants that handle the remote URL to kde projects.

To invoke this method, do this on the commandline:

rbt --report-the-kde-status
#
# File lib/rbt/installer/misc.rb, line 6676
def report_the_kde_status
  require 'rbt/utility_scripts/report_the_kde_status.rb'
  RBT.report_the_kde_status
end
report_where_archives_will_be_extracted_into() click to toggle source
#

report_where_archives_will_be_extracted_into

#
# File lib/rbt/installer/misc.rb, line 1889
def report_where_archives_will_be_extracted_into
  e "Archives will be extracted into this directory: "\
    "#{sdir(extract_to?)}"
end
report_where_we_store_then_exit() click to toggle source
#

report_where_we_store_then_exit

#
# File lib/rbt/installer/misc.rb, line 2260
def report_where_we_store_then_exit
  report_where_we_will_store_logs
  exit_program
end
report_where_we_will_store_logs() click to toggle source
#

report_where_we_will_store_logs

This will ask where we store our BT-Related files. The Config object defines that.

To trigger this, do:

ry --store_where?
#
# File lib/rbt/installer/misc.rb, line 2751
def report_where_we_will_store_logs
  opne "Log-files will be stored into the directory `"\
       "#{sdir(log_dir?)}`."
end
Also aliased as: store_where?
report_whether_a_build_directory_will_be_used_for_this_program() click to toggle source
#

report_whether_a_build_directory_will_be_used_for_this_program

#
# File lib/rbt/installer/build_directory.rb, line 37
def report_whether_a_build_directory_will_be_used_for_this_program
  opne 'Will a '+teal('build directory')+' be used for the program '+
        sfancy(compile_which_program?)+'? '+
        simp(
          verbose_truth(use_build_directory?).delete('.')
        )+'.'
end
report_whether_colours_will_be_used() click to toggle source
#

report_whether_colours_will_be_used

#
# File lib/rbt/installer/misc.rb, line 13505
def report_whether_colours_will_be_used
  e 'Will we use colours: '+
    royalblue(
      verbose_truth?(use_colours?)
    )
end
report_whether_porg_is_available() click to toggle source
#

report_whether_porg_is_available

#
# File lib/rbt/installer/misc.rb, line 10208
def report_whether_porg_is_available
  e rev+'Is porg available? '+
    sfancy(verbose_truth(is_porg_available?))
end
report_whether_this_program_is_included_or_whether_it_is_not( i = program? ) click to toggle source
#

report_whether_this_program_is_included_or_whether_it_is_not

This method will notify the user as to whether the given program passed into this method is registered, as part of the RBT project, or whether it is not.

#
# File lib/rbt/installer/misc.rb, line 2248
def report_whether_this_program_is_included_or_whether_it_is_not(
    i = program?
  )
  e teal("Is #{program} included in the RBT project?: ")+
    verbose_truth(
      is_this_program_included?(i, :be_quiet)
    )
end
Also aliased as: verbose_include?
report_whether_we_are_on_gobolinux() click to toggle source
#

report_whether_we_are_on_gobolinux

To invoke this method, do:

rbt --is-on-gobolinux?
#
# File lib/rbt/installer/misc.rb, line 11567
def report_whether_we_are_on_gobolinux
  opne 'Are we on GoboLinux: '+
        royalblue(
          verbose_truth(is_on_gobolinux?.to_s)
        )
end
report_whether_we_will_use_porg() click to toggle source
#

report_whether_we_will_use_porg

To invoke this method, issue:

ry --use-porg?
#
# File lib/rbt/installer/misc.rb, line 15874
def report_whether_we_will_use_porg
  opne "Will RBT make use of #{teal('porg')}: "\
       "#{royalblue(verbose_truth(use_porg?.to_s))}"
end
report_which_libraries_are_missing() click to toggle source
#

report_which_libraries_are_missing

Report which libraries are missing.

Invocation example:

ry --not-found
#
# File lib/rbt/installer/misc.rb, line 10239
def report_which_libraries_are_missing
   require 'rbt/utility_scripts/not_found_libraries.rb'
   RBT::NotFoundLibraries.new
end
report_which_programs_can_be_compiled_statically() click to toggle source
#

report_which_programs_can_be_compiled_statically

#
# File lib/rbt/installer/misc.rb, line 10283
def report_which_programs_can_be_compiled_statically
  use_this_key = :can_be_compiled_statically
  selection = available_programs?.select {|this_program|
    if does_this_expanded_cookbook_file_exist_for_this_program?(this_program)
      dataset = load_dataset_from_this_expanded_cookbook(this_program)
      _ = dataset[use_this_key]
      (_ == 'yes') or (_.to_s == 'true')
    else
      false
    end
  }
  if selection.empty?
    opne 'No program that can be compiled statically was found.'
    opne 'This is an incorrect result, though. Have you expanded'
    opne 'your local dataset already?'
    opne 'If not, run:'
    e
    e '  rbt --expand-dataset'
    e
  else
    opne 'The following programs can be compiled statically:'
    e
    selection.each_with_index {|this_program, index| index += 1
      e royalblue("  #{index.to_s.rjust(3)}) ")+
        steelblue("#{this_program}")
    }
    e
  end
end
required_dependencies?()
Alias for: required_deps_on?
required_dependencies_on?()
Alias for: required_deps_on?
required_deps()
Alias for: required_deps_on?
required_deps?()
Alias for: required_deps_on?
required_deps_on?() click to toggle source
#

required_deps_on?

#
# File lib/rbt/installer/misc.rb, line 7282
def required_deps_on?
  cookbook_for?.required_deps_on?
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::CompileBase#reset
# File lib/rbt/installer/reset.rb, line 19
def reset
  # ======================================================================= #
  # Note that the super() call will also define the variable
  # @internal_hash properly. Hence why it must come first,
  # as other definitions depend on it.
  # ======================================================================= #
  super()
  # ======================================================================= #
  # First reset the error line.
  # ======================================================================= #
  RBT::Errors::MapLineToASpecificError.reset
  reset_the_internal_hash
  populate_the_internal_hash_with_default_values
  populate_the_internal_hash_with_values_specific_to_class_installer
  infer_the_namespace
  set_cflags { :be_silent } # ← Initialize the CLFAGS here.
  extract_to_default_directory
  disable_colours unless RBT.use_colours?
  # ======================================================================= #
  # === Clear problems
  #
  # Next, prepare the stage for recording-problems. No problems are
  # known initially, on startup. That method call must come after
  # the internal Hash has been created, but before other methods
  # should be called.
  # ======================================================================= #
  clear_problems
  set_program_path(nil) # This should come last within reset().
end
reset_compiled_n_times_counter() click to toggle source
#

reset_compiled_n_times_counter

#
# File lib/rbt/installer/reset.rb, line 67
def reset_compiled_n_times_counter
  @internal_hash[:we_tried_to_compile_this_program_n_times] = 0
end
reset_error_map_line_to_a_specific_error() click to toggle source
#

reset_error_map_line_to_a_specific_error

#
# File lib/rbt/installer/reset.rb, line 60
def reset_error_map_line_to_a_specific_error
  RBT::Errors::MapLineToASpecificError.clear
end
reset_prefix_variables(i = '') click to toggle source
#

reset_prefix_variables

#
# File lib/rbt/installer/reset.rb, line 91
def reset_prefix_variables(i = '')
  case i
  when :unless_already_set_through_the_menu
    # In this case we will not modify the prefix variable.
  else
    set_user_prefix_to_nil
  end
end
reset_the_invariant_dataset_to_the_internal_hash() click to toggle source
#

reset_the_invariant_dataset_to_the_internal_hash (invariant tag)

The variants in this method are, by default, not amenable to user input at all. They are thus only used internally by the code. This is thus the main difference to the other method used to fill up @internal_hash.

The values defined in the method here are mostly done to use default values.

Note that this may not be entirely true, so this method is a bit arbitrary. Still, it is true for other internal entries, such as :have_we_successfully_installed_the_program.

#
# File lib/rbt/installer/reset.rb, line 634
def reset_the_invariant_dataset_to_the_internal_hash
  # ======================================================================= #
  # === :time_compilation
  #
  # Determine whether we shall time the compilation or whether we shall
  # not.
  # ======================================================================= #
  file_time_compilation = FILE_TIME_COMPILATION
  if File.exist? file_time_compilation
    @internal_hash[:time_compilation] = YAML.load_file(file_time_compilation)
    if @internal_hash[:time_compilation]
      @internal_hash[:array_time_compilation] = []
    end
  else
    opnn; no_file_exists_at(file_time_compilation)
  end
  # ======================================================================= #
  # === :original_start_directory
  # ======================================================================= #
  @internal_hash[:original_start_directory] = return_pwd
  # ======================================================================= #
  # === :counter_called_traditional_or_non_traditional_compilation
  #
  # Next, how often we invoked traditional or non-traditional compilation.
  # ======================================================================= #
  @internal_hash[:counter_called_traditional_or_non_traditional_compilation] = 0
  # ======================================================================= #
  # === :do_not_use_special_environment_flags
  #
  # Whether we are allowed to use special ENV flags. By default we are
  # allowed to use special flags, hence why the variable is set to false.
  # ======================================================================= #
  @internal_hash[:do_not_use_special_environment_flags] = false
  # ======================================================================= #
  # === use_gobolinux_symlinkprogram
  #
  # Next, determine whether we will make use of GoboLinux's SymlinkProgram.
  # This will be automatically changed if we are on GoboLinux. For other
  # systems we will prefer to use SymlinkProgram from RBT itself.
  # ======================================================================= #
  @internal_hash[:use_gobolinux_symlinkprogram] = false
  # ======================================================================= #
  # === :append_shell_error_code
  #
  # If this variable is set to true then we will append the shell
  # error code aka ' 2>&1'. This is true by default, so we will
  # append it.
  # ======================================================================= #
  @internal_hash[:append_shell_error_code] = true
  # ======================================================================= #
  # === :has_the_program_been_installed_successfully
  #
  # By default, all programs will have been installed successfully. The
  # next variable keeps track of this.
  # ======================================================================= #
  @internal_hash[:has_the_program_been_installed_successfully] = true
  # ======================================================================= #
  # === :simple_or_complex
  #
  # Determine the dataset to use from the cookbook dataset. This can
  # be :simple or :complex, although at a later time the alias name
  # :use_expanded_dataset was used instead of :complex, as this name
  # is more explicit.
  # ======================================================================= #
  @internal_hash[:simple_or_complex] = :use_expanded_dataset # :simple
  # ======================================================================= #
  # === :last_compiled_program
  # ======================================================================= #
  @internal_hash[:last_compiled_program] = nil  # Define it once at least.
  # ======================================================================= #
  # === :exit_after_a_rubygem_has_been_installed
  # ======================================================================= #
  @internal_hash[:exit_after_a_rubygem_has_been_installed] = false
  # ======================================================================= #
  # === :array_required_dependencies
  #
  # Register any reported dependencies of the target program at hand.
  # ======================================================================= #
  @internal_hash[:array_required_dependencies] = []
  # ======================================================================= #
  # === :may_we_run_ninja
  #
  # By default we can always run ninja again.
  # ======================================================================= #
  @internal_hash[:may_we_run_ninja] = true
  # ======================================================================= #
  # === :make
  #
  # Instantiate a new RBT::Make object next, as our wrapper to 'make'.
  # ======================================================================= #
  @internal_hash[:make] = RBT::Make.new
  # ======================================================================= #
  # === :make_install_stage_was_a_success
  #
  # Whether the "make install" stage was a success. This is true by
  # default and will only become false if an error is encountered.
  # ======================================================================= #
  @internal_hash[:make_install_stage_was_a_success] = true
  # ======================================================================= #
  # === :an_error_has_occurred
  # ======================================================================= #
  @internal_hash[:an_error_has_occurred] = false
  # ======================================================================= #
  # === :try_to_autofix
  # ======================================================================= #
  @internal_hash[:try_to_autofix] = true
  # ======================================================================= #
  # === :try_to_recompile_upon_error
  # ======================================================================= #
  @internal_hash[:try_to_recompile_upon_error] = true
  # ======================================================================= #
  # === :continue_after_make_step
  # ======================================================================= #
  @internal_hash[:continue_after_make_step] = true
  # ======================================================================= #
  # === :have_we_successfully_installed_the_program
  #
  # The next variable keeps track over as to whether we have
  # successfully installed the program or whether we have not.
  # ======================================================================= #
  @internal_hash[:have_we_successfully_installed_the_program] = false
  # ======================================================================= #
  # === :is_an_abbreviation
  #
  # Whether the given input is an abbreviation or not. By default we
  # assume that the user has NOT used an abbreviated term for a real
  # program.
  # ======================================================================= #
  @internal_hash[:is_an_abbreviation] = false
  # ======================================================================= #
  # === :dataset_from_the_file_cookbook_chained_programs
  # ======================================================================= #
  @internal_hash[:dataset_from_the_file_cookbook_chained_programs] =
    YAML.load_file(FILE_COOKBOOK_CHAINED_PROGRAMS)
  # ======================================================================= #
  # === :full_configure_command
  #
  # We have to store the full configure command as well. It is not just
  # for configure but also for cmake, meson and so forth.
  # ======================================================================= #
  @internal_hash[:full_configure_command] = ''.dup
  # ======================================================================= #
  # === :run_make_install
  #
  # By default, we will run "make install". This covers most programs
  # that are to be compiled from source.
  # ======================================================================= #
  @internal_hash[:run_make_install] = true
  # ======================================================================= #
  # === :run_make_command
  #
  # The next variable will be nil by default, so that we can grab the
  # value that the cookbook-dataset is using here.
  # ======================================================================= #
  @internal_hash[:run_make_command] = nil
  # ======================================================================= #
  # === :problem
  #
  # Whether we have encountered a problem or not. Must be reset for
  # any new per-compile cycle run.
  # ======================================================================= #
  @internal_hash[:problem] = false
  # ======================================================================= #
  # === :may_we_initialize_a_new_cookbook_dataset
  #
  # The next variable must be true by default.
  # ======================================================================= #
  @internal_hash[:may_we_initialize_a_new_cookbook_dataset] = true
  # ======================================================================= #
  # === :array_sys_command_string
  #
  # The next variable can keep track of sys-commands that were run.
  # ======================================================================= #
  @internal_hash[:array_sys_command_string] = []
  # ======================================================================= #
  # === :pid
  # ======================================================================= #
  @internal_hash[:pid] = nil
end
reset_the_status_file() click to toggle source
#

reset_the_status_file

This method will clear the status.yml file, aka re-set it to zero.

To invoke this method, do:

rbt --reset-the-status-file
#
# File lib/rbt/installer/reset.rb, line 81
def reset_the_status_file
  this_file = FILE_STATUS
  dataset = {}
  dataset['currently_compiling_these_programs'] = []
  write_what_into(YAML.dump(dataset), this_file)
end
reset_user_definable_variables() click to toggle source
#

reset_user_definable_variables

The variables in this method can be changed by the user lateron. They are thus modifiable by the user via the commandline.

In other words, the user can change these variables and thus toggle the behaviour of RBT::Install. Thus, the user can overrule any setting defined in this method here - this is important to retain for this method, hence why it is documented so extensively.

Many variables in this method will be set to nil initially; that way we can easily find out which values have been modified on the commandline, and which one have not.

#
# File lib/rbt/installer/reset.rb, line 115
def reset_user_definable_variables
  # ======================================================================= #
  # === :prefix
  # ======================================================================= #
  @internal_hash[:prefix] = RBT::Prefix.new(:traditional) # This equals to /usr/.
  # ======================================================================= #
  # The next method call can only happen after the prefix-object
  # was initialized.
  # ======================================================================= #
  set_user_prefix(nil) # ← Purposely defined here, outside of other methods.
  # ======================================================================= #
  # === :keep_the_archive_extracted
  #
  # The keep-extracted setting will lateron be sanitized. The default
  # value will be nil.
  # ======================================================================= #
  @internal_hash[:keep_the_archive_extracted] = nil
  # ======================================================================= #
  # === :keep_la_files
  #
  # The next flag determines whether we will delete .la files or whether
  # we will keep them.
  # ======================================================================= #
  @internal_hash[:keep_la_files] = nil
  # ======================================================================= #
  # === :show_output_from_the_extracter_class
  #
  # If the following variable is set to true then we will show output
  # from class Extracter. This is the class that will handle
  # extracting of an archive. The reason why we have this binary
  # flag (toggle) is because sometimes we do not want to output
  # a LOT of information on the commandline. The user can toggle
  # this behaviour on the commandline.
  # ======================================================================= #
  @internal_hash[:show_output_from_the_extracter_class] = false
  # ======================================================================= #
  # === :symlink_into_usr_lib_dir
  #
  # Determine whether we will symlink the content of lib/ into
  # /usr/lib/. This setting is only honoured if we compile in an
  # appdir-like fashion.
  # ======================================================================= #
  @internal_hash[:symlink_into_usr_lib_dir] = false
  # ======================================================================= #
  # === :build_static
  #
  # The next variable must be defined here. A value of nil specifies
  # that this has not been set via the commandline yet. A value of
  # nil here essentially means a default to false - aka we will not
  # try to compile a program in a static manner.
  # ======================================================================= #
  @internal_hash[:build_static] = nil
  # ======================================================================= #
  # === :check_whether_the_given_input_is_a_file_and_does_exist
  #
  # The next variable, if true, instructs the class to check whether the
  # given input argument(s) do exist as a regular local file. If false
  # this check is skipped.
  # ======================================================================= #
  @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = true
  # ======================================================================= #
  # === :exit_before_make_install
  #
  # Whether we will exit when we reach the "make install" stage.
  # ======================================================================= #
  @internal_hash[:exit_before_make_install] = false
  # ======================================================================= #
  # === :exit_before_make
  #
  # Whether we will exit when we reach the "make" stage.
  # ======================================================================= #
  @internal_hash[:exit_before_make] = false
  # ======================================================================= #
  # Only install the .h header files, if this variable is set to true.
  # ======================================================================= #
  @internal_hash[:install_only_the_headers] = false
  # ======================================================================= #
  # === :we_tried_to_compile_this_program_n_times
  # ======================================================================= #
  @internal_hash[:we_tried_to_compile_this_program_n_times] = 0
  # ======================================================================= #
  # === :sed
  #
  # Whether to apply a sed-operation. Will be nil by default. If the
  # user passes in some special option here, then we know that we
  # have to use this value to overrule any other value for sed.
  # ======================================================================= #
  @internal_hash[:sed] = nil
  # ======================================================================= #
  # === :symlink_headers
  # ======================================================================= #
  @internal_hash[:symlink_headers] = nil
  # ======================================================================= #
  # === :check_for_this_licence
  #
  # If the following variable is not nil, and not false, then this
  # class will check for the given licence matching, before it will
  # compile the program. So, for instance, the user passes the
  # commandline flag for GPLv3 licences. If the software at hand is
  # NOT GPLv3 licenced then it can not be compiled. This is an optional
  # setting - most users won't need this, but purists may want to have
  # such an option, so it has been enabled in September 2022.
  # ======================================================================= #
  @internal_hash[:check_for_this_licence] = nil
  # ======================================================================= #
  # === :shall_we_compile_the_program
  #
  # The next variable can be used to determine whether we will compile
  # a particular program or whether we will not.
  # ======================================================================= #
  @internal_hash[:shall_we_compile_the_program] = true
  # ======================================================================= #
  # === :strip_binaries
  #
  # By default we will not strip the binaries. The configuration
  # setting can change this value though.
  # ======================================================================= #
  @internal_hash[:strip_binaries] = false
  # ======================================================================= #
  # === :extract_to_this_directory_as_specified_by_the_user
  #
  # The next variable can be used to allow the user to determine another
  # directory for where we will extract archives into. Initially set
  # to nil in order to allow distinction to the default extractable
  # directory that is to be used.
  # ======================================================================= #
  @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = nil
  # ======================================================================= #
  # === :extract_where_to
  # ======================================================================= #
  @internal_hash[:extract_where_to] = RBT.log_dir?+'rbt/' # TEMP_DIR_FOR_RBT
  # ======================================================================= #
  # === :extract_the_archive
  #
  # By default we will extract the archive.
  # ======================================================================= #
  @internal_hash[:extract_the_archive] = true
  # ======================================================================= #
  # === :use_a_prefix
  #
  # This entry point allows us to use a prefix variable, e. g for
  # "./configure --prefix=/opt". By default this is enabled (set
  # to true), but a user may wish to disable this too.
  #
  # If you wish to query this value, use the method
  # .do_we_use_any_prefix?.
  # ======================================================================= #
  @internal_hash[:use_a_prefix] = true
  # ======================================================================= #
  # === :is_on_gobolinux
  #
  # Determine whether we are on GoboLinux or whether we are not.
  # ======================================================================= #
  @internal_hash[:is_on_gobolinux] = RBT.are_we_on_gobolinux?
  # ======================================================================= #
  # === :run_configure_script
  #
  # Determine whether we will run the configure script or whether we
  # will not. This is nil initially, so that the user can overrule
  # this in any way he/she sees fit.
  # ======================================================================= #
  @internal_hash[:run_configure_script] = nil
  # ======================================================================= #
  # === :configure_base_directory
  # ======================================================================= #
  @internal_hash[:configure_base_directory] = nil
  # ======================================================================= #
  # === :use_this_build_system
  #
  # Determine which build system is to be used. By default it will be nil.
  # ======================================================================= #
  @internal_hash[:use_this_build_system] = nil
  # ======================================================================= #
  # === :use_autogen
  #
  # Default value for use_autogen will be nil. The user is able to
  # override this from the commandline, which is why this variable
  # will be nil initially.
  # ======================================================================= #
  @internal_hash[:use_autogen] = nil
  # ======================================================================= #
  # === :parameters_to_make
  #
  # The next entry point allows us to pass options/parameters to the
  # "make" binary. The user can overrule this on the commandline.
  #
  # A value of nil is the initialize default state for this variable.
  # ======================================================================= #
  @internal_hash[:parameters_to_make] = nil
  # ======================================================================= #
  # === :rename_tab_title
  #
  # Whether to rename the tab title or whether we will not. This refers
  # to the KDE konsole typically.
  # ======================================================================= #
  if RBT.respond_to? :configuration?
    @internal_hash[:rename_tab_title] = RBT.configuration?.rename_tab_title
  else
    @internal_hash[:rename_tab_title] = true
  end
  # ======================================================================= #
  # === :use_ccache
  #
  # The use_ccache entry has to be persistent.
  # ======================================================================= #
  @internal_hash[:use_ccache] = RBT.configuration?.use_ccache
  # ======================================================================= #
  # === :try_to_determine_which_programs_have_to_be_installed
  # ======================================================================= #
  @internal_hash[:try_to_determine_which_programs_have_to_be_installed] = true
  # ======================================================================= #
  # === :make_use_of_cookbook_aliases
  # ======================================================================= #
  @internal_hash[:make_use_of_cookbook_aliases] = true
  # ======================================================================= #
  # === :do_not_use_special_flags
  #
  # The next variable, false on startup, tells RBT::Installer to
  # retain all environment variables. Sometimes we may want to NOT
  # use the environment variables, which is why this flag exists.
  # ======================================================================= #
  @internal_hash[:do_not_use_special_flags] = false
  # ======================================================================= #
  # === :run_postinstall_actions
  #
  # Determine whether we will run postinstallation steps.
  # ======================================================================= #
  @internal_hash[:run_postinstall_actions] = true
  # ======================================================================= #
  # === :use_autoconf
  # ======================================================================= #
  @internal_hash[:use_autoconf] = false
  # ======================================================================= #
  # === :cd_into_the_rbt_log_directory
  #
  # Whether this class will try to cd into the rbt-log directory.
  # ======================================================================= #
  @internal_hash[:cd_into_the_rbt_log_directory] = true
  # ======================================================================= #
  # === :build_directory
  # ======================================================================= #
  @internal_hash[:build_directory] = BuildDirectory.new { :do_not_run_yet }
  # ======================================================================= #
  # === :use_build_directory
  #
  # Must initialize the build directory to a nil value next. It may
  # be set to a non-nil value lateron.
  # ======================================================================= #
  @internal_hash[:use_build_directory] = nil
  # ======================================================================= #
  # === Show the flexbox
  #
  # Next determine whether we will show the flexbox or whether we will
  # not. This has to be in the method here so that we do not re-set
  # it for each program that is to be compiled/installed.
  # ======================================================================= #
  @internal_hash[:show_the_flexbox] = true
  # ======================================================================= #
  # === :create_appdir_skeleton
  #
  # Whether to create an AppDir skeleton by default.
  # ======================================================================= #
  @internal_hash[:create_appdir_skeleton] = true
  # ======================================================================= #
  # === :use_autoconf
  #
  # Use autoconf or not - by default we will not.
  # ======================================================================= #
  @internal_hash[:use_autoconf] = nil
  # ======================================================================= #
  # === :symlink_glib_schema
  # ======================================================================= #
  @internal_hash[:symlink_glib_schema] = nil
  # ======================================================================= #
  # === :run_simulation
  #
  # Whether we will run in simulation-mode or not. Simulation-mode means
  # that we will not make any real lasting changes. This thus allows a
  # user to predict (and show a summary) what would happen if a
  # program would be installed/compiled.
  # ======================================================================= #
  @internal_hash[:run_simulation] = false
  # ======================================================================= #
  # === :time_compilation
  #
  # Whether to time the compilation procedure or not:
  # ======================================================================= #
  @internal_hash[:time_compilation] = true
  # ======================================================================= #
  # === :honour_check_to_ensure_that_the_program_exists
  #
  # The next variable has to be kept for if we actually do want to
  # check whether a program is included or not. Normally we should
  # check, but there may be situations where you may build up your
  # own functionality - so we need to provide an option that can be
  # toggled by the user. This is why the next variable exists, and
  # is kept at true.
  # ======================================================================= #
  @internal_hash[:honour_check_to_ensure_that_the_program_exists] = true
  # ======================================================================= #
  # === :extract_only
  #
  # If the next variable is set to true, we will exit after we have
  # extracted the archive. We will first initialize it to nil, though,
  # in order to distinguish between the default value and user-supplied
  # values.
  # ======================================================================= #
  @internal_hash[:extract_only] = nil
  # ======================================================================= #
  # === :use_porg
  #
  # Determine whether we will make use of porg.
  # ======================================================================= #
  @internal_hash[:use_porg] = configuration?.use_porg
  # ======================================================================= #
  # === :original_stdout
  #
  # The next variable is a bit unclear - it used to exist to allow for
  # easy redirection, but may no longer be that important. We may have to
  # re-evaluate this at a later time (written at 12.04.2019).
  # ======================================================================= #
  @internal_hash[:original_stdout] = nil
  # ======================================================================= #
  # === :postinstallation
  # ======================================================================= #
  @internal_hash[:postinstallation] = nil
  # ======================================================================= #
  # === :can_we_continue
  #
  # The variable at :can_we_continue is reset during every iteration.
  # It will be true by default.
  # ======================================================================= #
  @internal_hash[:can_we_continue] = true
  # ======================================================================= #
  # === :install_only_binaries
  # ======================================================================= #
  @internal_hash[:install_only_binaries] = false
  # ======================================================================= #
  # === :may_we_download
  # ======================================================================= #
  @internal_hash[:may_we_download] = RBT::TRY_TO_DOWNLOAD_IF_NOT_FOUND
  # ======================================================================= #
  # === :ignore_errors
  #
  # By default we will NOT ignore errors, thus stop when we have noticed
  # an error. This can be overruled by the user on the commandline,
  # through the following value.
  #
  # Since as of November 2022, a new option has been added - this
  # variable will now default to :infer. That way the user can
  # override it on the commandline, and we can call the method
  # cookbook_dataset_ignore_errors? anyway.
  # ======================================================================= #
  @internal_hash[:ignore_errors] = :infer # false
  # ======================================================================= #
  # === :skip_extracting
  #
  # Default value is nil for the next variable. If true then we will
  # NOT extract.
  # ======================================================================= #
  @internal_hash[:skip_extracting] = nil
  # ======================================================================= #
  # === :use_the_internal_sed_wrapper
  #
  # Next, determine whether to use the internal sed-wrapper. No
  # longer true by default since as of February 2018, but perhaps
  # we may re-enable it at some later moment in time.
  # ======================================================================= #
  @internal_hash[:use_the_internal_sed_wrapper] = false
  # ======================================================================= #
  # === @internal_hash[:make_use_of_the_cookbook_aliases]
  #
  # If the following variable is set to true then the RBT project
  # will try to honour the cookbook aliases.
  # ======================================================================= #
  @internal_hash[:make_use_of_the_cookbook_aliases] = true
  # ======================================================================= #
  # The configuration setting can change the above default false-value.
  # ======================================================================= #
  if config?
    @internal_hash[:strip_binaries] = config?.use_strip
  end
  # ======================================================================= #
  # === :compiler_to_use
  #
  # Specify which compiler is to be used. By default we will use GCC,
  # but clang may also be an option. It will be stored as a lowercased
  # Symbol, though, so :gcc would refer to GCC.
  # ======================================================================= #
  @internal_hash[:compiler_to_use] = :gcc
  # ======================================================================= #
  # === Keeping track of the commandline arguments
  #
  # @commandline_arguments are set on startup only once, so they can not
  # be put inside the method initialize_default_values().
  # ======================================================================= #
  @internal_hash[:commandline_arguments] = []
  # ======================================================================= #
  # === :use_meson_configure_options
  #
  # Whether to use meson-configure options or not.
  # ======================================================================= #
  @internal_hash[:use_meson_configure_options] = true
  # ======================================================================= #
  # === :symlink_gir_files
  #
  # This entry point controls whether we will symlink .gir files,
  # in principle.
  # ======================================================================= #
  @internal_hash[:symlink_gir_files] = configuration_setting_for_symlink_gir_files?
  # ======================================================================= #
  # === :register_the_last_compiled_program
  #
  # Whether to register the last compiled program or not.
  # ======================================================================= #
  @internal_hash[:register_the_last_compiled_program] = true
  # ======================================================================= #
  # === :use_this_specific_program_version
  #
  # Use another program version than the default one via this
  # variable.
  # ======================================================================= #
  @internal_hash[:use_this_specific_program_version] = nil
  # ======================================================================= #
  # === :append_this_to_the_configure_options
  #
  # This has been specifically added to allow for the --release flag
  # to work with cmake-based projects.
  # ======================================================================= #
  @internal_hash[:append_this_to_the_configure_options] = nil
  # ======================================================================= #
  # === :try_to_use_configure_options
  #
  # Determine whether we will try to use any declared configure options
  # from the cookbook-yaml file. This is true by default. The reason
  # why the following variable is set to nil initially is so that we
  # can distinguish the situation from when the user did specifically
  # want to disable this functionality, from the commandline. So the
  # nil value does not necessarily mean "false" in this context - it
  # just means that the user did not specify anything specifically.
  # ======================================================================= #
  @internal_hash[:try_to_use_configure_options] = nil
  # ======================================================================= #
  # === :use_opn
  #
  # This entry point determines whether RBT::Compile will make use of
  # opn or whether it will not. By default it will be true; if it is
  # false then we will not show opn in any other class that is called
  # by RBT::Compile.
  # ======================================================================= #
  @internal_hash[:use_opn] = true
  # ======================================================================= #
  # === :user_prefix
  #
  # This prefix can be determined by the user.
  # ======================================================================= #
  @internal_hash[:user_prefix] = nil
  # ======================================================================= #
  # === :extract_only
  # ======================================================================= #
  @internal_hash[:extract_only] = false
  # ======================================================================= #
  # === :configure_options
  #
  # Whether we will use special configure options or not. By default
  # we will not, hence why we initialize the next setting to nil.
  # ======================================================================= #
  @internal_hash[:configure_options] = nil
  # ======================================================================= #
  # === :use_which_system_command
  #
  # There are only two valid settings for this variable:
  #
  #    :ioparser or
  #    :system
  #
  # ======================================================================= #
  @internal_hash[:use_which_system_command] = :ioparser
  # ======================================================================= #
  # === :colourize_parser
  #
  # Add an instance of class RBT::ColourizeParser.
  # ======================================================================= #
  @internal_hash[:colourize_parser] = RBT::ColourizeParser.new
  # ======================================================================= #
  # === :name_for_the_build_directory
  #
  # Use a default build directory. There is another entry that determines
  # whether we will use any build directory at all or not, so it is safe
  # to assign to the variable here - the entry called
  # @internal_hash[:use_build_directory].
  #
  # Since as of April 2021, we will only use the setter-method for this.
  # See the line below the commented line.
  # ======================================================================= #
  set_name_for_the_build_directory(:use_the_default_name) # Set a default name for the build directory.
  # ======================================================================= #
  # The next variable will keep track of class SymlinkProgram. We
  # need to be able to modify its behaviour at "runtime".
  # ======================================================================= #
  set_symlink_program(nil)
  set_use_this_make_command(:default)
end
return_absolute_path_if_in_build_directory() click to toggle source
#

return_absolute_path_if_in_build_directory

#
# File lib/rbt/installer/misc.rb, line 8445
def return_absolute_path_if_in_build_directory
  if use_build_directory? and 
     return_pwd.include?(File.basename(use_this_build_directory?))
    " #{File.absolute_path(return_pwd)}"
  else
    ''
  end
end
return_alias_name_for(i) click to toggle source
#

return_alias_name_for

#
# File lib/rbt/installer/misc.rb, line 13375
def return_alias_name_for(i)
  ::RBT::Cookbooks::Aliases.new(i).result?
end
return_appdir_prefix( use_this_as_the_program_name = program_name? ) click to toggle source
#

return_appdir_prefix

This variant will always use three methods to build the appdir-prefix.

It does not take any input by design.

#
# File lib/rbt/installer/misc.rb, line 14226
def return_appdir_prefix(
    use_this_as_the_program_name = program_name?
  )
  programs_dir?+
  use_this_as_the_program_name.to_s.capitalize.to_s+'/'+
  program_version?.to_s+'/'
end
return_append_this_to_the_configure_options() click to toggle source
#

return_append_this_to_the_configure_options

This method will always at the least return an empty String.

#
# File lib/rbt/installer/misc.rb, line 8367
def return_append_this_to_the_configure_options
  _ = ''
  if @internal_hash[:append_this_to_the_configure_options]
    _ = _.dup if _.frozen?
    _ << @internal_hash[:append_this_to_the_configure_options]
  end
  return _
end
return_blfs_page_of_this_program(i) click to toggle source
#

return_blfs_page_of_this_program

#
# File lib/rbt/installer/misc.rb, line 13415
def return_blfs_page_of_this_program(i)
  RBT.return_blfs_page_of_this_program(i)
end
return_build_systems_priorities( i = RBT.file_build_system_priorities ) click to toggle source
#

return_build_systems_priorities

#
# File lib/rbt/installer/misc.rb, line 3043
def return_build_systems_priorities(
    i = RBT.file_build_system_priorities
  )
  load_yaml(i)
end
return_build_type() click to toggle source
#

return_build_type

#
# File lib/rbt/installer/misc.rb, line 5389
def return_build_type
  return ::RBT.build_type?
end
return_chained_programs() click to toggle source
#

return_chained_programs

#
# File lib/rbt/installer/misc.rb, line 13201
def return_chained_programs 
  RBT.return_chained_programs
end
return_cmake_configure_options_while_considering_GNU_configure_options() click to toggle source
#

return_cmake_configure_options_while_considering_GNU_configure_options

This method will return the cmake_configure_options, or configure options. One day this should be changed to ONLY return the cmake_configure_options, but for the time being we need to retain compatibility to GNU configure options.

#
# File lib/rbt/installer/misc.rb, line 8348
def return_cmake_configure_options_while_considering_GNU_configure_options
  _ = cmake_configure_options?
  unless _
    # ===================================================================== #
    # We default to the configure options for legacy reasons. At
    # some later point we may have to change all cookbook files,
    # but for now we won't.
    # ===================================================================== #
    _ = configure_options?
  end
  _ << return_append_this_to_the_configure_options
  return _.strip.squeeze(' ')
end
return_compile_time_statistics() click to toggle source
#

return_compile_time_statistics

#
# File lib/rbt/installer/misc.rb, line 3188
def return_compile_time_statistics
  _ = RBT.file_storing_the_time_it_took_to_compile_programs
  if File.exist? _
    return YAML.load_file(_)
  end
end
return_dataset_for_this_program( i = compile_which_program? ) click to toggle source
#

return_dataset_for_this_program

This method will be used to return the dataset, that is a new cookbook instance, from the given program at hand.

#
# File lib/rbt/installer/misc.rb, line 8522
def return_dataset_for_this_program(
    i = compile_which_program?
  )
  load_yaml_dataset_for_this_program(i)
end
return_dataset_from_this_remote_blfs_page(i) click to toggle source
#

return_dataset_from_this_remote_blfs_page

#
# File lib/rbt/installer/misc.rb, line 10905
def return_dataset_from_this_remote_blfs_page(i)
  remote_url = RBT.return_blfs_page_of_this_program(i)
  remote_dataset = URI.open(remote_url).read
  return remote_dataset
end
return_default_configure_command() click to toggle source
#

return_default_configure_command

#
# File lib/rbt/installer/misc.rb, line 6364
def return_default_configure_command
  "configure --prefix=#{prefix?}"
end
return_default_hash_to_be_passed_into_colour_make( optional_input = nil ) click to toggle source
#

return_default_hash_to_be_passed_into_colour_make

This method will return a static hash. This can be overruled, though, by providing an argument (another hash) to this method.

#
# File lib/rbt/installer/misc.rb, line 15471
def return_default_hash_to_be_passed_into_colour_make(
    optional_input = nil
  )
  hash = {
    use_this_make_command:            use_which_make_command?,
    append_these_options:             parameters_to_make?,
    run_make:                         run_make?,
    run_make_install:                 run_make_install?,
    use_porg:                         use_porg?,
    program_name_and_program_version: program_name_and_program_version?
  }
  if optional_input
    hash.update(optional_input)
  end
  return hash 
end
return_full_configure_command()
return_games()
return_games_components() click to toggle source
#

return_games_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/installer/misc.rb, line 5709
def return_games_components
  RBT.return_games_components
end
Also aliased as: return_games
return_gem_install_options() click to toggle source
#

return_gem_install_options

#
# File lib/rbt/installer/misc.rb, line 12060
def return_gem_install_options
  _ = "#{yaml_directory?}ruby_gem_install_options.yml"
  if File.exist? _
    YAML.load_file(_).strip
  else
    ''
  end
end
return_hash_for_the_postinstallation_step( optional_rbt_compile_object = nil ) click to toggle source
#

return_hash_for_the_postinstallation_step

This method will return a Hash that can be used as the main initializer for class RBT::PostinstallationStep.

The method accepts an argument (optional). That argument should be an instance of RBT::Installer, if it is provided. If provided we will fetch our information from that instance, rather than from the default internal one.

#
# File lib/rbt/installer/postinstallation.rb, line 223
def return_hash_for_the_postinstallation_step(
    optional_rbt_compile_object = nil
  )
  # ======================================================================= #
  # First we will setup some local variables that will be returned
  # via the Hash.
  # ======================================================================= #
  register_the_program_or_do_not_register_the_program = false
  shall_we_run_fetch_all_m4_macros = true
  shall_we_invoke_symlink_program = false
  shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = false
  if optional_rbt_compile_object
    if optional_rbt_compile_object.continue_after_make_step? and
       optional_rbt_compile_object.make_install_stage_was_a_success? and
       optional_rbt_compile_object.no_error_has_occurred?
      register_the_program_or_do_not_register_the_program = true
    end
    if optional_rbt_compile_object.do_not_symlink?
      shall_we_run_fetch_all_m4_macros = false
    elsif !optional_rbt_compile_object.continue_after_make_step?
      shall_we_run_fetch_all_m4_macros = false
    end
    if optional_rbt_compile_object.continue_after_make_step? and
       optional_rbt_compile_object.make_install_stage_was_a_success?
      # ===================================================================== #
      # if i.include? '-' # Added this as of Jul 2014.
      #   i = i.to_s.delete('-')
      # end # ^^^ Disabled as of Sep 2017. We would have to go about
      # this via some central configuration option in RBT, rather
      # than an ad-hoc hack such as the above.
      # ===================================================================== #
      shall_we_invoke_symlink_program = true
    end unless optional_rbt_compile_object.do_not_symlink?
    if optional_rbt_compile_object.symlink_headers_into_usr_include_hierarchy? and
       optional_rbt_compile_object.uses_an_appdir_prefix? and
       File.directory?(optional_rbt_compile_object.real_prefix?.to_s+'include/') and
       !Dir["#{optional_rbt_compile_object.real_prefix?}include/**.h"].empty?
      shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true
    end
  else
    if continue_after_make_step? and
       make_install_stage_was_a_success? and
       no_error_has_occurred?
      register_the_program_or_do_not_register_the_program = true
    end
    if do_not_symlink?
      shall_we_run_fetch_all_m4_macros = false
    elsif !continue_after_make_step?
      shall_we_run_fetch_all_m4_macros = false
    end
    if continue_after_make_step? and
       make_install_stage_was_a_success?
      # ===================================================================== #
      # if i.include? '-' # Added this as of Jul 2014.
      #   i = i.to_s.delete('-')
      # end # ^^^ Disabled as of Sep 2017. We would have to go about
      # this via some central configuration option in RBT, rather
      # than an ad-hoc hack such as the above.
      # ===================================================================== #
      shall_we_invoke_symlink_program = true
    end unless do_not_symlink?
    if symlink_headers_into_usr_include_hierarchy? and
       uses_an_appdir_prefix? and
       File.directory?(real_prefix?.to_s+'include/') and
       !Dir["#{real_prefix?}include/**.h"].empty?
      shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true
    end
  end
  hash = {
    compile_which_program:            compile_which_program?,
    use_this_prefix:                  real_prefix?.to_s,
    dataset_to_use:                   cookbook_dataset?,
    use_tags:                         use_tags?,
    full_configure_command:           full_configure_command?,
    do_register_the_program:          register_the_program_or_do_not_register_the_program,
    do_run_fetch_all_m4_macros:       shall_we_run_fetch_all_m4_macros,
    shall_we_invoke_symlink_program:  shall_we_invoke_symlink_program,
    install_only_binaries:            install_only_binaries?,
    use_gobolinux_symlinkprogram:     use_gobolinux_symlinkprogram?,
    delete_libtool_files:             delete_libtool_files?,
    symlink_into_usr_lib_dir:         symlink_into_usr_lib_dir?,
    postinstall:                      postinstall?,
    shall_we_symlink_the_header_files_into_the_usr_include_hierarchy: shall_we_symlink_the_header_files_into_the_usr_include_hierarchy
  }
  return hash
end
return_kde5_applications() click to toggle source
#

return_kde5_applications

#
# File lib/rbt/installer/misc.rb, line 6773
def return_kde5_applications
  RBT.return_kde5_applications
end
return_kde5_plasma() click to toggle source
#

return_kde5_plasma

#
# File lib/rbt/installer/misc.rb, line 6758
def return_kde5_plasma
  RBT.return_kde5_plasma
end
return_kde5_porting_aids() click to toggle source
#

return_kde5_porting_aids

#
# File lib/rbt/installer/misc.rb, line 6766
def return_kde5_porting_aids
  RBT.return_kde5_porting_aids
end
Also aliased as: return_porting_aids
return_last_configure_command() click to toggle source
#

return_last_configure_command

#
# File lib/rbt/installer/misc.rb, line 6353
def return_last_configure_command
  hash = compiled_programs? # The full dataset is assigned here.
  last_key = hash.keys.last # Grab the last key.
  dataset = hash[last_key]  # Now we have obtained the dataset.
  full_configure_command = dataset['full_configure_command']
  return full_configure_command
end
return_lxqt_components() click to toggle source
#

return_lxqt_components

This method will conveniently return the Array holding all programs that belong to the LX-QT pool.

#
# File lib/rbt/installer/misc.rb, line 2096
def return_lxqt_components
  RBT.return_lxqt_components
end
return_lxqt_desktop_components()
return_mate_applications()
return_mate_desktop_components() click to toggle source
#

return_mate_desktop_components

This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.

#
# File lib/rbt/installer/misc.rb, line 5699
def return_mate_desktop_components
  RBT.return_mate_desktop_components
end
Also aliased as: return_mate_applications
return_md5(this_file) click to toggle source
#

return_md5

md5sum support via this method. It will make use of the class Md5sum.

#
# File lib/rbt/installer/misc.rb, line 9753
def return_md5(this_file)
  _ = Md5sum.new(this_file, :dont_run_yet) # bl $RUBY_SRC/md5sum/lib/md5sum/md5sum.rb
  return _.return_md5sum(this_file)
end
return_meson_configure_options() click to toggle source
#

return_meson_configure_options

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 122
def return_meson_configure_options
  return_the_appropriate_configure_options(:meson)
end
return_n_processors( file_cpuinfo = FILE_CPUINFO )
return_n_processors_of_this_computer( file_cpuinfo = FILE_CPUINFO ) click to toggle source
#

return_n_processors_of_this_computer

This method will return how many processors this computer has. This can then be used to automatically determine the maximum option given to the “make” binary.

#
# File lib/rbt/installer/misc.rb, line 13080
def return_n_processors_of_this_computer(
    file_cpuinfo = FILE_CPUINFO
  )
  if file_cpuinfo.is_a?(String) and File.exist?(file_cpuinfo)
    selected_dataset = File.readlines(file_cpuinfo).select {|line|
      line.start_with? 'processor'
    }
    selected_dataset.size
  else
    1 # 1 is the minimum number.
  end
end
return_n_programs_available() click to toggle source
#

return_n_programs_available

#
# File lib/rbt/installer/misc.rb, line 7765
def return_n_programs_available
  '  → '+sfancy(n_programs_available?.to_s)+' programs '\
  'registered as of '+simp(today?)+'.'
end
return_non_traditional_prefix( i = compile_which_program?, use_this_program_version = :default )
Alias for: appdir_prefix?
return_path_to_the_archive_of_this_program(i) click to toggle source
#

return_path_to_the_archive_of_this_program

This functionality depends on the expanded cookbooks dataset.

#
# File lib/rbt/installer/misc.rb, line 7294
def return_path_to_the_archive_of_this_program(i)
  dataset_from_expanded_cookbook = return_dataset_from_expanded_cookbook(i)
  dataset_from_expanded_cookbook[:program_path]
end
return_porting_aids()
return_possible_abbreviation_to_this_input(i) click to toggle source
#

return_possible_abbreviation_to_this_input

This method will return an abbreviation to a given input.

#
# File lib/rbt/installer/misc.rb, line 7721
def return_possible_abbreviation_to_this_input(i)
  if will_we_make_use_of_abbreviations?
    # ===================================================================== #
    # If the cookbooks-project already includes the given input at hand
    # then we do not have to do anything else.
    # ===================================================================== #
    is_the_program_included = cookbooks_include_this_program? i
    unless is_the_program_included
      # =================================================================== #
      # We have to do another check, this time including the abbreviations.
      # =================================================================== #
      is_the_program_included = cookbooks_include_this_program?(
        i, :with_abbreviations
      )
      if is_the_program_included
        abbreviation_points_to = abbreviations?[i]
        unless abbreviation_points_to == i
          # =============================================================== #
          # Notify the user that we will "re-write" the original input
          # in this case.
          # =============================================================== #
          opne "#{rev}The given input #{sfancy(i)} could not be "\
               "found, but an abbreviation"
          opne "was found, which is now used as the new name: "\
               "#{mediumspringgreen(abbreviation_points_to)}"
          i = abbreviation_points_to.to_s.delete('_').dup
          set_is_an_abbreviation
          # =============================================================== #
          # We must also set the Hash to sync-back our findings, so that
          # we change input like "ry macro" to "ry marco". We avoid
          # using the setter method because the setter method does a
          # few additional checks as-is.
          # =============================================================== #
          set_handle_this_program(i)
        end
      end
    end
  end
  return i
end
return_program_based_on_this_binary(i) click to toggle source
#

return_program_based_on_this_binary

#
# File lib/rbt/installer/misc.rb, line 8794
def return_program_based_on_this_binary(i)
  RBT::Cookbooks::RegisteredBinaries.search_for_this_program(i) { :be_quiet }
end
return_program_name_then_hyphen_then_the_program_version() click to toggle source
#

return_program_name_then_hyphen_then_the_program_version

#
# File lib/rbt/installer/misc.rb, line 13299
def return_program_name_then_hyphen_then_the_program_version
  "#{compile_which_program?.to_s}-#{program_version?}"
end
return_proper_prefix()
Alias for: use_which_prefix?
return_proper_prefix?()
Alias for: use_which_prefix?
return_random_program() click to toggle source
#

return_random_program

#
# File lib/rbt/installer/misc.rb, line 7995
def return_random_program
  return_available_programs.sample
end
return_relative_path_if_in_build_directory() click to toggle source
#

return_relative_path_if_in_build_directory

#
# File lib/rbt/installer/misc.rb, line 8457
def return_relative_path_if_in_build_directory
  if use_build_directory? and return_pwd.include?(File.basename(use_this_build_directory?))
    ' ..'
  else
    ''
  end
end
return_the_appropriate_configure_options( build_type = return_build_type.to_s ) click to toggle source
#

return_the_appropriate_configure_options

This will return the configure options or meson option or cmake options. The guarantee is that we will return whatever is appropriate.

For now, the method will only consider configure options.

#
# File lib/rbt/installer/misc.rb, line 7632
def return_the_appropriate_configure_options(
    build_type = return_build_type.to_s
  )
  _ = nil # Tiny safeguard.
  build_type = build_type.to_sym unless build_type.is_a? Symbol
  case build_type
  # ======================================================================= #
  # === :meson
  #
  # This is for the meson-configure-options.
  # ======================================================================= #
  when :meson
    _ = meson_configure_options?.to_s
  # ======================================================================= #
  # === :configure
  # ======================================================================= #
  when :configure
    _ = configure_options?.to_s.dup
  # ======================================================================= #
  # === :unknown
  #
  # We currently don't handle this.
  # ======================================================================= #
  when :unknown, :infer, :infer_automatically
    return
  else
    return nil
    #   opne 'Not yet handled: :'+build_type.to_s+'.'
  end
  if _ and !_.empty?
    splitted = _.split("\n").reject {|entry| entry.strip.empty? }
    first = splitted.first
    unless first.start_with?('--')
      splitted.map! {|entry|
        unless entry.start_with? '-'
          entry = "--#{entry}"
        end
        entry
      }
    end
    _ = splitted.join(' ')
  end
  _ = " #{_}" if _
  return _
end
return_the_name_of_the_build_directory()
return_this_plasma_component() click to toggle source
#

return_this_plasma_component

#
# File lib/rbt/installer/misc.rb, line 6648
def return_this_plasma_component
  RBT.return_this_plasma_component
end
return_xfce_components() click to toggle source
#

return_xfce_components

#
# File lib/rbt/installer/misc.rb, line 13150
def return_xfce_components
  RBT.return_xfce_components
end
returned_the_assumed_program_path( i = first_argument? ) click to toggle source
#

returned_the_assumed_program_path

#
# File lib/rbt/installer/misc.rb, line 3999
def returned_the_assumed_program_path(
    i = first_argument?
  )
  return RBT::Cookbooks::SanitizeCookbook.new(i) { @internal_hash[:simple_or_complex] }.program_path?
end
reuse_old_configure_options( use_this_program = compile_which_program? ) click to toggle source
#

reuse_old_configure_options

This method currently works only with the target program being GCC.

Perhaps it may be extended for other programs one day.

Invocation examples:

ry gcc --copy-old-version
ry gcc --use-this-version=7.1.0 --use-old-configure-options
#
# File lib/rbt/installer/misc.rb, line 5929
def reuse_old_configure_options(
    use_this_program = compile_which_program?
  )
  _ = `#{use_this_program} -v #{SHELL_ERROR_CODE}`
  options = _.scan(/^Configured .+/).first.
              sub(/^Configured with:/,'').
              sub(/\.\.\/configure /,''). 
              strip
  opne "Re-using the old configure option, which "\
       "was `#{sfancy(options)}`."
  if options.include? programs_directory?
    # ===================================================================== #
    # Next, replace the oldprefix.
    # ===================================================================== #
    programs_dir = Regexp.quote(programs_directory?)
    if dataset?.nil?
      ensure_that_the_default_dataset_exists_for_this_program(use_this_program)
    end
    if @internal_hash[:use_this_specific_program_version]
      dataset?.set_program_version(@internal_hash[:use_this_specific_program_version])
      dataset?.reassemble_program_path
    end
    regex_to_use = /(--prefix=#{programs_dir}Gcc\/\d{1,2}\.\d{1,2}\.\d{1,2})/
    options.sub!(regex_to_use, '--prefix='+return_appdir_prefix)
    options.squeeze!('/')
    # ===================================================================== #
    # Now, simply use that as configure version.
    # ===================================================================== #
    extract_to_default_directory
    set_configure_base_directory
    cd_to_the_configure_base_directory
    run_preinstall_sed_and_currently_being_compiled
    consider_creating_the_build_directory
    e "These are the #{orange('options')} that will be used:"
    e
    e "  #{simp(options)}"
    e
    set_configure_options(options)
    run_configure_make_and_make_install_with_this_configure_line(options)
    run_all_actions_after_the_make_install_step
    exit_program
  end
end
Also aliased as: use_old_configure_options
rnsymc(i = return_pwd) click to toggle source
#

rnsymc

#
# File lib/rbt/installer/misc.rb, line 7861
def rnsymc(i = return_pwd)
  RBT::SymlinkFromToCurrent.new(i)
end
ruby_setup_config() click to toggle source
#

ruby_setup_config

#
# File lib/rbt/installer/misc.rb, line 10856
def ruby_setup_config
  system 'ruby setup.rb --quiet config'
end
ruby_setup_install() click to toggle source
#

ruby_setup_install

#
# File lib/rbt/installer/misc.rb, line 12089
def ruby_setup_install
  system 'ruby setup.rb --quiet install'
end
ruby_setup_setup() click to toggle source
#

ruby_setup_setup

#
# File lib/rbt/installer/misc.rb, line 11541
def ruby_setup_setup
  system 'ruby setup.rb --quiet setup'
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/installer/run.rb, line 16
def run
  # ======================================================================= #
  # === The log directory must exist
  #
  # We must always ensure that the log_directory exists.
  # ======================================================================= #
  ensure_that_the_log_directory_exists
  menu
  if try_to_determine_which_programs_have_to_be_installed?
    try_do_determine_which_programs_have_to_be_installed
  end
  # ======================================================================= #
  # === Install all specified programs next
  #
  # After the menu() interface has been called, we can proceed
  # to batch-install every program.
  # ======================================================================= #
  do_install_the_programs
  # $stdout = original_stdout? if original_stdout?
  # ^^^ Have to re-think the above.
end
run_cmake_command()
Alias for: run_the_cmake_steps
run_cmake_then_make_then_make_install() click to toggle source
#

run_cmake_then_make_then_make_install

Just a convenience method to run “cmake”, then “make” and then “make install”.

#
# File lib/rbt/installer/misc.rb, line 13566
def run_cmake_then_make_then_make_install
  run_cmake_command
  run_make
  run_make_install
end
run_cmake_then_premake_then_make_then_make_install()
Alias for: run_the_cmake_steps
run_configure( use_this_configure_command = use_this_build_system? )
run_configure?()
run_configure_like_stage()
run_configure_make_and_make_install_with_this_configure_line(i) click to toggle source
#

run_configure_make_and_make_install_with_this_configure_line

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1057
def run_configure_make_and_make_install_with_this_configure_line(i)
  run_configure_via_system(i)
  run_make
  run_make_install
end
run_configure_script?() click to toggle source
#

run_configure_script?

Determine whether we will invoke “./configure” or whether we will not.

#
# File lib/rbt/installer/misc.rb, line 6388
def run_configure_script?
  _ = @internal_hash[:run_configure_script]
  # ======================================================================= #
  # Next, fetch the entry that exists in the cookbook-dataset, and use
  # it in this case.
  # ======================================================================= #
  if _.nil?
    if cookbook_dataset_run_configure_script?.nil?
      _ = true # Safe-guard.
    else
      _ = cookbook_dataset_run_configure_script?
    end
  end
  _
end
Also aliased as: run_configure?
run_configure_then_make_then_make_install( use_this_configure_command = use_this_build_system? )
run_configure_via_system( use_this_configure_command = use_this_build_system? )
run_ldconfig?() click to toggle source
#

run_ldconfig?

#
# File lib/rbt/installer/misc.rb, line 14294
def run_ldconfig?
  RBT.configuration?.run_ldconfig
end
run_make() click to toggle source
#

run_make (make tag, Makefile tag)

This is the wrapper method over “make”.

This method will, in the end, delegate towards RBT.colour_make, which in turn runs the command/binary called “make”.

The specific command that will be used, in this case “make”, can also be a different one, as defined by the respective .yml file for the given program at hand. Not all programs require “make” for their compilation.

The method will also have to ensure that a Makefile-file exists, but only for installation types that do happen to require a Makefile.

Some build systems, such as meson/ninja, may use ‘make’, but may also skip it and do “ninja install” instead.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 944
def run_make
  if exit_before_make?
    opne 'Exiting now as instructed before reaching '\
         'the "'+orange('make')+'" stage.'
    exit_program
  end
  # ======================================================================= #
  # === Determine whether the Makefile has to be modified or not.
  # ======================================================================= #
  if modify_the_makefile?
    opne 'The Makefile will be modified next ('+
         steelblue('PREFIX')+' value will be changed).'
    do_use_this_makefile_here = "#{return_pwd}Makefile"
    # ======================================================================= #
    # Delegate towards RBT::ChangePrefix next.
    # ======================================================================= #
    RBT::ChangePrefix.new(
      use_this_makefile:          do_use_this_makefile_here,
      use_this_as_the_new_prefix: prefix?.to_s.dup
    )
  end
  if run_make?
    # ======================================================================= #
    # "make" is usually used, but we may also make use of "ninja" instead,
    # so we have to pass in this option towards RBT.colour_make.
    # ======================================================================= #
    if run_simulation?
      opne 'We are running a simulation, hence the following command'
      opne 'will not be run:'
      opnfancy "  #{make_command?}"
    else
      # =================================================================== #
      # Clear the old buffer first:
      # =================================================================== #
      reset_error_map_line_to_a_specific_error
      if has_to_be_compiled?
        consider_using_maximum_speed_for_compilation
      end
      # =================================================================== #
      # We will have to make a cd-operation to the configure base directory
      # if run_configure is no/false and if we use a build directory.
      #
      # This, however had, breaks cmake builds, so it was disabled in
      # February 2019. It may have to be changed at a later time
      # anyway.
      # =================================================================== #
      # if !run_configure? and use_build_directory?
      #   cd_to_the_configure_base_directory
      # end
      # =================================================================== #
      # Next consider running pre-make commands - but this must come
      # AFTER running GNU configure and similar build-style runs.
      # =================================================================== #
      consider_running_premake_instructions
      unless installation_steps?.empty?
        installation_steps?.each {|this_step|
          opne "Next doing this step: #{sfancy(this_step)}"
          esystem this_step
        }
      end
      # =================================================================== #
      # Delegate towards RBT.colour_make next:
      # =================================================================== #
      _ = use_which_system_command?
      case _
      # =================================================================== #
      # === :ioparser
      #
      # This is the more sophisticated ioparser variant.
      # =================================================================== #
      when :ioparser,
           :default
        RBT.colour_make {
          return_default_hash_to_be_passed_into_colour_make
        }
      # =================================================================== #
      # === :system
      #
      # This is the simple system-variant.
      # =================================================================== #
      when :system
        cmd = use_this_make_command?.to_s.dup
        hash = return_default_hash_to_be_passed_into_colour_make
        if hash.has_key? :append_these_options
          cmd << hash[:append_these_options].join(' ')
        end
        cmd = cmd.strip.squeeze(' ')
        coloured_and_padded_esystem(cmd)
      else
        e "Unknown system-command: #{steelblue(_.to_s)}"
      end
    end
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
    if automatically_create_package?
      if is_on_slackware?
        # =================================================================== #
        # Create a slackware-package in this case.
        # =================================================================== #
        opne 'Next trying to create a package for `'+royalblue('slackware')+'`.'
        # The following subsection is incomplete. The path could be used
        # to find out whether things are put in their right position.
        # path = create_slackware_description_file
        RBT.run_makepkg_command(compile_which_program?, program_version?)
      end
    end
  end
end
run_make?() click to toggle source
#

run_make?

#
# File lib/rbt/installer/misc.rb, line 3310
def run_make?
  _ = cookbook_dataset_run_make?
  unless @internal_hash[:run_make_command].nil?
    _ = @internal_hash[:run_make_command]
  end
  return _
end
run_make_and_make_install_command()
run_make_command()
Alias for: run_make
run_make_install() click to toggle source
#

run_make_install

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1246
def run_make_install
  
end
run_make_install?() click to toggle source
#

run_make_install?

Query whether we will do the “make install” step or whether we will not. Will return a boolean value (true/false).

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 699
def run_make_install?
  @internal_hash[:run_make_install]
end
run_make_install_command()
Alias for: run_make_install
run_make_then_make_install() click to toggle source
#

run_make_then_make_install

Run “make” and then the “make install” command here.

This method is deliberately very simple.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1551
def run_make_then_make_install
  _ = an_error_has_occurred?
  _ = false unless check_for_errors?
  if _
  else
    run_make_command
    run_make_install_command
  end
end
run_make_then_make_install_command()
run_ninja()
run_postinstall_actions?() click to toggle source
#

run_postinstall_actions?

We will default to the cookbook dataset - but this will be overruled if there is a corresponding entry in the @internal_hash variable.

#
# File lib/rbt/installer/postinstallation.rb, line 151
def run_postinstall_actions?
  _ = cookbook_dataset_postinstall?
  unless @internal_hash[:run_postinstall_actions].nil?
    _ = @internal_hash[:run_postinstall_actions]
  end
  return _
end
Also aliased as: run_postinstall_steps?
run_postinstall_steps?()
run_pre_configure_steps_if_requested_to_do_so() click to toggle source
#

run_pre_configure_steps_if_requested_to_do_so

#
# File lib/rbt/installer/misc.rb, line 15776
def run_pre_configure_steps_if_requested_to_do_so
  _ = pre_configure_steps?
  if _ and !_.empty? and _.is_a?(Array)
    opne "#{rev}Doing a #{steelblue('pre-configure')} step next."
    _.each {|entry|
      # esystem entry
      run_this_system_command_in_a_coloured_and_padded_manner(entry)
    }
  end
end
run_pre_make_commands( array = cookbook_dataset_pre_make_commands? )
run_preinstall_actions() click to toggle source
#

run_preinstall_actions

These actions will be run before anything else, including “./configure”.

An example for such a preinstall action may be the following:

if is_on_32_bit_system?
  sed -r "/ifeq.*CompilerTargetArch/s#i386#i686#g" -i projects/compiler-rt/make/platform/clang_linux.mk
#
# File lib/rbt/installer/misc.rb, line 3869
def run_preinstall_actions
  _ = cookbook_dataset_preinstall?
  unless _.empty?
    # ===================================================================== #
    # Next we have to handle the preinstall-actions. This should
    # typically be an Array (and is guaranteed by class
    # RBT::SanitizeCookbook).
    #
    # We will output what we are doing pre-installation things, but
    # only do so IF we really want to so.
    # ===================================================================== #
    first = _.first
    unless first.start_with?('if ') and (first == 'if is_on_32_bit_system?')
      cliner {
        opne "Doing preinstallation actions next, from the directory "
        opne "`#{sdir(return_pwd)}`:"
      }
    end
    # ===================================================================== #
    # === Handle conditional cases in the preinstall clause next
    # ===================================================================== #
    if first.start_with? 'if ' # Ok, we assume this to be an if-conditional clause.
      case first # case tag
      when 'if is_on_32_bit_system?'
        if is_on_32_bit_system? # Ok, we are on a 32 bit system.
          _.shift
          unless _.empty?
            _ = _.first
            opne 'A pre-installation instruction was found, '\
                 'which will be run next (from the '\
                 'directory '+sdir(sdir_return_pwd)+').'
            opnesystem _
          end
        end
      end
    else
      opnn
      if _.is_a? Array
        _.each {|entry|
          case entry
          # =============================================================== #
          # Note that most of the next steps may be handled by class
          # PostInstall already, such as create_directory().
          # =============================================================== #
          # =============================================================== #
          # === copy_file STATIC_BUSYBOX_CONFIG
          #
          # Handle busybox's static configuration. This is stored
          # in the file called "static_busybox_config.md".
          #
          # On my home system this file is then found here:
          #
          #   $RBT/misc/profiles/static_busybox_config.md
          #
          # =============================================================== #
          when /copy_file STATIC_BUSYBOX_CONFIG$/i
            source_location = "#{DIRECTORY_TO_THE_PROFILES}static_busybox_config.md"
            target_location = "#{cookbooks_dataset_extracted_towards?}.config"
            opne "Copying from #{sfile(source_location)}"
            opne "to #{sfile(target_location)}"
            copy_file(source_location, target_location)
          else
            if entry.end_with?('.new')
              case entry
              # =========================================================== #
              # === Handle ChangeLib64ToLib.new
              # =========================================================== #
              when /ChangeLib64ToLib.new$/
                e "Delegating towards "\
                  "#{steelblue('RBT::ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib')}"\
                  " next:"
                RBT::ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib.new
                next
              end
            end
          end
          e sfancy(entry)
          system(entry)
        }
      else
        e sfancy(_)
        system(_)
      end
    end
  end
end
run_preinstall_sed_and_currently_being_compiled() click to toggle source
#

run_preinstall_sed_and_currently_being_compiled

#
# File lib/rbt/installer/misc.rb, line 14401
def run_preinstall_sed_and_currently_being_compiled
  run_preinstall_actions
  check_for_sed_action
  register_that_this_program_is_currently_being_compiled
end
run_premake_commands( array = cookbook_dataset_pre_make_commands? ) click to toggle source
#

run_premake_commands

Here we try to run the premake commands, in case they exist.

If there are no pre_make_commands, then we will not do anything, as our array will be empty.

This method is normally run from do_compile_this_program(), via a call to its alias name consider_running_premake_instruction().

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 904
def run_premake_commands(
    array = cookbook_dataset_pre_make_commands?
  )
  unless array.empty?
    opne "#{sfancy('Doing pre_make_commands next from ')}"\
         "#{sdir_return_pwd}#{sfancy('.')}"
    array.each { |cmd|
      opnn
      e "In the directory #{sdir_return_pwd}, doing the following command next:"
      e
      e "  #{slateblue(cmd)}"
      e
      e 'next.'
      run_this_system_command_in_a_coloured_and_padded_manner(cmd)
    }
  end
end
run_premake_then_make_then_make_install()
run_python_install( i = 'setup.py' )
run_python_install1( this_file = RBT.file_predefined_installation_instructions ) click to toggle source
#

run_python_install1

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1154
def run_python_install1(
    this_file = RBT.file_predefined_installation_instructions
  )
  dataset = YAML.load_file(this_file)['PINSTALL1']
  if dataset.is_a?(String) and dataset.include?(';')
    dataset.split(';').each {|this_command|
      _ = this_command.strip
      e _
      run_this_sys_command(_)
    }
  end
end
run_python_install2( this_file = RBT.file_predefined_installation_instructions ) click to toggle source
#

run_python_install2

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1170
def run_python_install2(
    this_file = RBT.file_predefined_installation_instructions
  )
  dataset = YAML.load_file(this_file)['PINSTALL2']
  if dataset.is_a?(String) and dataset.include?(';')
    dataset.split(';').each {|this_command|
      _ = this_command.strip
      e _
      run_this_sys_command(_)
    }
  end
end
run_python_installation( i = 'setup.py' ) click to toggle source
#

run_python_installation

You should check whether setup.py exists prior to invoking this method here.

You can also pass in another file, such as configure.py. By default, the method will make use of a file called “setup.py”, though.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1100
def run_python_installation(
    i = 'setup.py'
  )
  if parameters_to_make?.nil?
    _ = cookbook_dataset_make_options?
    if _ and !_.empty?
      i = _
    end
  end
  i = [i].flatten.compact
  # ======================================================================= #
  # We work on an Array here since some make_options entries also
  # specify an Array.
  # ======================================================================= #
  i.each {|do_this_action|
    case do_this_action
    when FILE_SETUP_PY # ← This is equivalent to "setup.py".
      # We could also use RBT::FILE_SETUP_PY.
      if does_a_python_binary_exist?
        colourized_and_padded_esystem "python #{do_this_action} configure"
        colourized_and_padded_esystem "python #{do_this_action} build"
        colourized_and_padded_esystem "python #{do_this_action} install"
      else
        notify_the_user_that_no_binary_python_could_be_found
      end
    else
      run_this_command = "#{do_this_action}".dup
      if run_this_command.start_with?('python') and !run_this_command.include?('/')
        # =================================================================== #
        # This is valid for a command line such as:
        #   "python setup.py config"
        # =================================================================== #
        splitted = run_this_command.split(' ')
        splitted[1].prepend(configure_base_dir?.dup)
        run_this_command = splitted.join(' ')
      end
      unless run_this_command.start_with? 'python'
        run_this_command.prepend('python ')
      end
      if does_a_python_binary_exist?
        colourized_and_padded_esystem run_this_command
      else
        notify_the_user_that_no_binary_python_could_be_found
      end
    end
  }
  consider_changing_the_tab_title(
    :clear, :do_rename
  )
end
Also aliased as: run_python_install
run_scons() click to toggle source
#

run_scons

Invoke this method here only when we wish to use scons in order to install a program.

Scons is python-related, which is why it sits here in this file.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 662
def run_scons
  _ = 'scons'.dup
  if use_build_directory?
    _.prepend('../')
  end
  coloured_and_padded_esystem _
end
Also aliased as: run_scons_based_installation
run_scons_based_installation()
Alias for: run_scons
run_system_or_ioparser_command( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true ) { || ... } click to toggle source
#

run_system_or_ioparser_command (iopen tag)

This method will, by default, try to make use of IO.popen.

The alternatives, system() or backticks, are not as useful, in my opinion. However had, the user can use these others variants as well, since as of July 2020.

The current idea is to work on a line-by-line basis when IO.popen is used, and to also display what is done, so that the user has an idea what is happening.

There is also the possibility to use colours and colourize the input; this allows us to, for example, use specific colours for directories or for files or to indicate failures.

Usage example:

run_this_system_command_in_a_coloured_and_padded_manner(full_configure_command?) { :also_pad_via_cliner }
#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1359
def run_system_or_ioparser_command(
    i,
    use_colours           = use_colours?,
    use_padding           = true,
    show_the_command_used = true,
    &block
  )
  yielded = nil      
  if block_given?
    yielded = yield
  end
  case use_colours
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    use_colours = use_colours?
  end
  use_this_colour = :konsole_dodgerblue # ← dodgerblue
  set_pid(nil) # Reset the PID here.
  # ======================================================================= #
  # === The usere wants to do something with "make" past this point here
  #
  # I still do not quite understand the second argument. Either way,
  # I have determined that this works better.
  #
  #   ffmpeg = IO.popen(cmdline + " #{SHELL_ERROR_CODE}", "w+")
  #
  # ======================================================================= #
  if i and i.start_with?('make')
    unless is_make_available?
      # =================================================================== #
      # We need to inform the user that the "make" binary is not available.
      # =================================================================== #
      opne "The program \"#{sfancy('make')}\" is "\
           "#{swarn('not available')}, at the least not as  "\
           "part of the #{steelblue('$PATH')} variable."
      opne "RBT::Compile thus can not compile anything. You "\
           "may want to check the #{orange('$PATH')} variable."
      do_not_continue_and_do_not_compile(:be_quiet)
      return
    end
  end
  i = i.dup if i.frozen? # Work on a copy, just in case.
  i.strip!
  # ======================================================================= #
  # Next append shell-error-code, which is just ' 2>&1' really.
  # The user can disable this, though, via --do-not-append-no-error,
  # hence the following if-clause.
  # ======================================================================= #
  if append_shell_error_code?
    i << " #{SHELL_ERROR_CODE}" unless i.end_with? " #{SHELL_ERROR_CODE}"
  end
  # ======================================================================= #
  # We have to determine whether we will ultimately run a system()
  # variant or Ioparser
  # ======================================================================= #
  case use_which_system_command?
  # ======================================================================= #
  # === :ioparser
  # ======================================================================= #
  when :ioparser
    if show_the_command_used
      case yielded
      when :also_pad_via_cliner
        if use_colours?
          cliner(use_colour: use_this_colour)
        else
          cliner
        end
      end
      coloured_and_padded_e(i, :default, :inner_padding)
      case yielded
      when :also_pad_via_cliner
        if use_colours?
          cliner(use_colour: use_this_colour)
        else
          cliner
        end
      end
    end
    io_object = IO.popen(i, {:err => [:child, :out]})
    set_pid(io_object.pid)
    io_object.each { |line|
      # =================================================================== #
      # The next line will also display what has happened.
      # =================================================================== #
      parse_this_line_obtained_via_io_popen(line, use_colours)
    }
    io_object.close
    # ======================================================================= #
    # Right now only the io-parser above can handle the sys-command
    # strings.
    # ======================================================================= #
    # Next, we attempt to determine what some of the errors may be and
    # perhaps even how to resolve them.
    # ======================================================================= #
    # Handle "no configure file" next.
    # ======================================================================= #
    if array_sys_command_string? and
       array_sys_command_string?.any? {|line|
        line.include? 'sh: ./configure: No such file or directory'
      }
      problem_is :no_configure_file
    # ======================================================================= #
    # Handle missing headers next.
    # ======================================================================= #
    elsif array_sys_command_string?.any? {|line|
        line.include? 'headers are missing'
      }
      _ = array_sys_command_string?.select {|line|
        line.include? 'headers are missing'
      }
      problem_is _
    end
  # ======================================================================= #
  # === :simple_system
  #
  # This entry point is for simple system() calls.
  # ======================================================================= #
  when :simple_system,
       :system
    if use_padding and show_the_command_used
      case yielded
      when :also_pad_via_cliner
        if use_colours?
          cliner(use_colour: use_this_colour)
        else
          cliner
        end
      end
      coloured_and_padded_esystem "#{cmd}", :default, :inner_padding
      case yielded
      when :also_pad_via_cliner
        if use_colours?
          cliner(use_colour: use_this_colour)
        else
          cliner
        end
      end
    else
      if show_the_command_used
        case yielded
        when :also_pad_via_cliner
          if use_colours?
            cliner(use_colour: use_this_colour)
          else
            cliner
          end
        end
        colourized_and_padded_esystem(cmd)
        case yielded
        # ================================================================= #
        # === :also_pad_via_cliner
        # ================================================================= #
        when :also_pad_via_cliner
          if use_colours?
            cliner(use_colour: use_this_colour)
          else
            cliner
          end
        end
      else
        system(cmd)
      end
    end
  end
end
run_the_cmake_command()
Alias for: run_the_cmake_steps
run_the_cmake_steps() click to toggle source
#

run_the_cmake_steps (cmake tag)

This method will run the corresponding “cmake” command.

It will, after running “cmake”, do the equivalent of:

- premake
- make
- make install
#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 541
def run_the_cmake_steps
  # ======================================================================= #
  # We should check whether cmake exists on the host system or whether
  # it does not.
  # ======================================================================= #
  if cmake_exists?
    cmd = "cmake".dup
    if do_we_use_any_prefix? # Check whether the user wants to use a prefix at all.
      cmd << " -DCMAKE_INSTALL_PREFIX=#{prefix?}"
    end
    cmake_configure_options = cmake_configure_options?
    # ======================================================================= #
    # Append the cmake-configure options next:
    # ====================================================================== #
    if cmake_configure_options and !cmake_configure_options.empty?
      cmd << " #{cmake_configure_options}"
    end
    cmd << ' .'
    if use_build_directory?
      create_the_build_directory_then_cd_into_it { :be_verbose }
      cmd << '.'
    end
    cmd.squeeze!(' ')
    cmd.strip!
    # ======================================================================= #
    # === Check for more than one -DCMAKE_INSTALL_PREFIX entry next
    #
    # This should never be the case, so we will do some quality-control
    # and exit if this is the case so.
    # ======================================================================= #
    scanned_result = cmd.scan(/-DCMAKE_INSTALL_PREFIX=/)
    if scanned_result.size > 1
      # =================================================================== #
      # In this case, something must be wrong. Notify the user about it.
      # That way this can be corrected eventually.
      # =================================================================== #
      opnewarn "There are at the least two definitions of "\
               "#{royalblue('-DCMAKE_INSTALL_PREFIX=')}"
      opnewarn "in the .yml file at hand."
      opnewarn 'At the least one of these entries must be incorrect '\
               'and/or superfluous. Please '
      opnewarn 'correct this logic-problem because RBT can continue to work.'
      e
      e 'See:'
      e
      e "  #{sfancy(_)}"
      e
      exit_program
    end
    # ======================================================================= #
    # Finally the cmake-command has been built up. We can now push it
    # towards the general method that handles output.
    # ======================================================================= #
    reset_error_map_line_to_a_specific_error
    set_full_configure_command(cmd)
    opne 'Next running'
    run_this_system_command_in_a_coloured_and_padded_manner(cmd) # Using this since as of 28.08.2022.
    run_premake_then_make_then_make_install
    # ======================================================================= #
    # Now that the cmake, premake, make, make install was run we scan
    # through the registered problems/errors and act on it, before
    # resetting the error-line again.
    # ======================================================================= #
    run_through_the_registered_problems_registered_errors_and_behaviour_changes
    reset_error_map_line_to_a_specific_error
  else
    # ======================================================================= #
    # The user should be informed that "cmake" could not be found here.
    # ======================================================================= #
    notify_the_user_that_cmake_could_not_be_found
    we_can_not_continue
  end
end
run_the_configure_command( use_this_configure_command = use_this_build_system? ) click to toggle source
#

run_the_configure_command

This method will ultimately run the “./configure” command, with an appropriate prefix to be used.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 373
def run_the_configure_command(
    use_this_configure_command = use_this_build_system?
  )
  # ======================================================================= #
  # First check whether we really want to run the configure script:
  # ======================================================================= #
  return unless run_configure_script?
  # ======================================================================= #
  # === configure_command_to_use
  #
  # Add the configure-command that is to be used next, if this is
  # specified in the cookbook .yml file at hand. For example,
  # 'bc' requires the command './configure.sh' rather than
  # 'configure'.
  # ======================================================================= #
  if cookbook_dataset_configure_command?
    use_this_configure_command = cookbook_dataset_configure_command?.dup
  else # This else-clause is the default.
    case use_this_configure_command
    # ======================================================================= #
    # === :infer_automatically
    # ======================================================================= #
    when :infer_automatically
      use_this_configure_command = return_build_type
    else
      use_this_configure_command = 'configure'
    end
  end
  _ = ''.dup # ← We will start with this here.
  if use_build_directory?
    create_the_build_directory_then_cd_into_it { :be_verbose }
    _.prepend('.')
  end
  # ======================================================================= #
  # === Honour ccache
  #
  # Honour the CCACHE setting, if it has been provided. This must come
  # after we did the _.prepend('.') call.
  # ======================================================================= #
  if use_ccache?
    # ======================================================================= #
    # Find out whether ccache is available or whether it is not. If it
    # is we will use it, while also specifying which compiler to use.
    # ======================================================================= #
    if ccache_is_available?
      if will_gcc_be_used_for_compilation?
        _.prepend 'CC="ccache gcc" ' # In this case prepend it.
      end
    else # It must be available.
      notify_the_user_that_ccache_is_not_available
    end
  end
  # ======================================================================= #
  # The next line exists due to programs such as discount.yml needing
  # a configure-command like: ./configure.sh
  # ======================================================================= #
  _ << '.' # unless use_this_configure_command.start_with?('./')
  # ======================================================================= #
  # Append the configure-base-directory value next. However had, I am
  # not sure whether this is correct in April 2021. We'll comment it
  # out for now; once we know more, we may re-add this again.
  # ======================================================================= #
  # _ << configure_base_directory?.dup
  _ << '/'
  _ << "#{use_this_configure_command}"
  # ======================================================================= #
  # The following _.include? check is valid for e. g. applications
  # such as "lsof".
  # ======================================================================= #
  if do_we_use_any_prefix?
    use_this_prefix = prefix?.to_s
    RBT.set_last_prefix_used(use_this_prefix)
    _ << " --prefix=#{use_this_prefix}" unless _.include? './Configure -n linux'
  end
  # ======================================================================= #
  # The following two checks are necessary, due to two reasons:
  #
  # - The user may not want to append any configure-options in
  #   the first place. Hence, we must check for this via
  #   use_configure_options?.
  #
  # - Second the user may also input a command such as "ry sed-4.5",
  #   and in this case we have to work on an existing file, rather
  #   than on the dataset in the cookbook-yaml file.
  #
  # ======================================================================= #
  if use_configure_options? and cookbooks_for?
    configure_options_to_use = configure_options?
                               # return_the_appropriate_configure_options(
                               # use_this_configure_command
                               # ).to_s.dup.rstrip
                               # ^^^ the above is not needed because we
                               #     know the build type already.
    if configure_options_to_use and !configure_options_to_use.empty?
      # =================================================================== #
      # Finally, append these additional commands to the
      # configure-string:
      # =================================================================== #
      _ << " #{configure_options_to_use}"
    end
  end
  # ======================================================================= #
  # === Handle strange configuration options involving sysconfdir next
  #
  # This must come after we have appended the configure options in use.
  # ======================================================================= #
  if use_appdir_prefix? and _.include?('--sysconfdir=/etc')
    regexp_quoted_old_sysconfdir_prefix = Regexp.quote('--sysconfdir=/etc')
    rewritten_sysconfdir = '--sysconfdir='+rds(use_which_prefix?.to_s+'/etc')
    opne 'An '+salmon('AppDir prefix')+' is used, but also "'+
         royalblue('--sysconfdir=/etc')+'". '\
         'This is not logical.'
    opne 'It is now assumed that the --sysconfdir=/etc is meant to target'
    opne "that #{salmon('AppDir prefix')}, so it will be rewritten to"
    opne "`#{royalblue(rewritten_sysconfdir)}`."
    _.sub!(/#{regexp_quoted_old_sysconfdir_prefix}/, rewritten_sysconfdir)
  end
  _ << " #{return_append_this_to_the_configure_options}"
  _.strip! # Just ensure that there are no trailing ' ' characters.
  # ======================================================================= #
  # === Handle the ERROR_LINE next
  #
  # Next, we will append the ERROR_LINE, but only if the user has
  # not overruled this on the commandline.
  # ======================================================================= #
  if @internal_hash[:append_shell_error_code] and !_.include?(ERROR_LINE)
    _ << " #{ERROR_LINE}"
  end
  # ======================================================================= #
  # The next line is used to turn something like:
  #
  #   "/Depot/Temp/rbt/discount-2.2.3a/./configure.sh"
  #
  # into:
  #
  #   "/Depot/Temp/rbt/discount-2.2.3a/configure.sh"
  #
  # ======================================================================= #
  if _.include?('/./')
    _.sub!(/\/\.\//, '/')
  end
  set_full_configure_command(_.dup.squeeze(' ')) # ← Keep a copy too.
  reset_error_map_line_to_a_specific_error # ← Must come before the sys-command.
  run_this_system_command_in_a_coloured_and_padded_manner(full_configure_command?) { :also_pad_via_cliner }
  run_through_the_registered_problems_registered_errors_and_behaviour_changes
  reset_error_map_line_to_a_specific_error
end
run_the_gnu_configure_steps() click to toggle source
#

run_the_gnu_configure_steps (configure tag)

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 2183
def run_the_gnu_configure_steps
  if shall_we_run_configure?
    run_the_configure_command
  end
  run_make_then_make_install
end
Also aliased as: run_configure_like_stage
run_the_meson_steps() click to toggle source
#

run_the_meson_steps (meson tag)

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 16
def run_the_meson_steps
  # ======================================================================= #
  # considering_creating_the_build_directory
  # ======================================================================= #
  set_configure_command(:meson)
  cmd = 'meson'.dup
  if do_we_use_any_prefix?
    use_this_prefix = use_which_prefix?
    cmd << " --prefix=#{use_this_prefix} --libdir=#{use_this_prefix}"\
           "lib"
  end
  # ======================================================================= #
  # Obtain the meson-configure options next, but only if the user
  # has allowed us to do so.
  # ======================================================================= #
  if use_meson_configure_options?
    meson_configure_options = meson_configure_options?.to_s.strip
    if meson_configure_options and !meson_configure_options.empty?
      # ===================================================================== #
      # Append the meson-configure options in this case.
      # ===================================================================== #
      opne "Making use of the #{royalblue('meson_configure_options')}, "\
           "as specified by the #{slateblue('.yml')} file."
      opne "The working directory is: #{sdir(return_pwd)}"
      cmd << " #{meson_configure_options}"
    end
  end
  # ======================================================================= #
  # Add the build-directory if we make use of a build directory.
  # ======================================================================= #
  if use_build_directory?
    cmd << " #{build_directory?}"
  end
  cmd.squeeze!(' ')
  set_full_configure_command(cmd)
  run_this_system_command_in_a_coloured_and_padded_manner("#{cmd}")
  # ======================================================================= #
  # Before we can run "ninja" we must cd into the build directory,
  # if we use one.
  # ======================================================================= #
  if use_build_directory?
    cd_to_the_build_directory { :be_verbose }
  end
  do_run_ninja_and_then_ninja_install
end
Also aliased as: do_install_via_meson
run_the_perl_steps() click to toggle source
#

run_the_perl_steps (perl tag)

#
# File lib/rbt/installer/misc.rb, line 13530
def run_the_perl_steps
  coloured_and_padded_esystem 'perl Makefile.PL'
  run_make
  run_make_install
end
run_the_python_steps() click to toggle source
#

run_the_python_steps

#
# File lib/rbt/installer/misc.rb, line 3745
def run_the_python_steps
  _ = 'setup.py'
  if File.exist? _
    coloured_and_padded_esystem 'python setup.py configure'
    coloured_and_padded_esystem 'python setup.py build'
    coloured_and_padded_esystem 'python setup.py install'
  else
    e 'Unsure what to do!'
    exit_program
  end
end
run_the_strip_command_on_this_input( i = :pwd ) click to toggle source
#

run_the_strip_command_on_this_input

#
# File lib/rbt/installer/misc.rb, line 15790
def run_the_strip_command_on_this_input(
    i = :pwd
  )
  case i
  when :pwd
    i = Dir['*']
  end
  [i].flatten.compact.each {|this_file|
    strip_command = 'strip '+this_file.lstrip
    esystem strip_command
  }
end
run_this_command( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
run_this_sed_instruction(sed_line)
run_this_sys_command( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
run_this_system_command( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
run_this_system_command_in_a_coloured_and_padded_manner( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
run_through_the_behaviour_changes() click to toggle source
#

run_through_the_behaviour_changes

We run through the module that keeps track of the behaviour changes that out to be run in class RBT::Installer.

#
# File lib/rbt/installer/misc.rb, line 5359
def run_through_the_behaviour_changes
  RBT::Errors::MapLineToASpecificError.behaviour_changes?.each {|do_this_action|
    self.send(do_this_action)
  }
end
run_through_the_erroneous_libtool_entries( i = erroneous_libtool_entries? ) click to toggle source
#

run_through_the_erroneous_libtool_entries

The first argument should be an Array; or an object that is able to respond to :each.

#
# File lib/rbt/installer/misc.rb, line 2106
def run_through_the_erroneous_libtool_entries(
    i = erroneous_libtool_entries?
  ) 
  i.each {|do_this_action|
    if is_on_roebe? and autofix?
      # =================================================================== #
      # Register this erroneous line for now - the fixing part will
      # happen at a later time. Only on roebe-systems for now, though.
      # =================================================================== #
      try_to_autocorrect_this_erroneous_libtool_entry_later(do_this_action)
    end
  }
end
run_through_the_registered_errors() click to toggle source
#

run_through_the_registered_errors

Sync the errors towards class RBT::Installer next.

#
# File lib/rbt/installer/misc.rb, line 5490
def run_through_the_registered_errors
  RBT::Errors::MapLineToASpecificError.registered_errors?.each {|do_this_action|
    error_is do_this_action
  }
end
run_through_the_registered_problems() click to toggle source
#

run_through_the_registered_problems

Sync the problems towards class RBT::Installer next.

#
# File lib/rbt/installer/misc.rb, line 5347
def run_through_the_registered_problems
  RBT::Errors::MapLineToASpecificError.registered_problems?.each {|do_this_action|
    problem_is do_this_action
  }
end
run_through_the_registered_problems_registered_errors_and_behaviour_changes() click to toggle source
#

run_through_the_registered_problems_registered_errors_and_behaviour_changes

#
# File lib/rbt/installer/misc.rb, line 5499
def run_through_the_registered_problems_registered_errors_and_behaviour_changes
  run_through_the_registered_problems
  run_through_the_registered_errors
  run_through_the_behaviour_changes
  run_through_the_erroneous_libtool_entries
  run_through_the_required_dependencies
end
run_through_the_required_dependencies() click to toggle source
#

run_through_the_required_dependencies

We have to sync the dependencies back into class RBT::Installer.

#
# File lib/rbt/installer/misc.rb, line 5370
def run_through_the_required_dependencies
  RBT::Errors::MapLineToASpecificError.required_dependency?.each {|this_array|
    register_required_dependency(this_array.first, this_array.last)
  }
end
run_waf() click to toggle source
#

run_waf (waf tag)

This method can be used to install a project that uses “waf” as its build system.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 1069
def run_waf
  run_pre_make_commands
  _ = './waf'.dup
  if use_build_directory?
    _.prepend(configure_base_directory?)
  end
  opnn; report_working_directory
  # ======================================================================= #
  # Specify which subcommands to use, e. g. 'waf configure' followed by
  # 'waf build' and so forth.
  # ======================================================================= #
  run_these_subcommands = %w(
    configure
    build
    install
  )
  run_these_subcommands.each {|this_subcommand|
    _ = "#{_} #{this_subcommand}"
    run_this_system_command_in_a_coloured_and_padded_manner(_)
  }
end
Also aliased as: run_waf_based_installation
run_waf_based_installation()
Alias for: run_waf
sanitize_cookbook?()
Alias for: cookbook_for?
sanitized_data()
Alias for: cookbook_for?
save_into_compiled_programs( store_into = FILE_COMPILED_PROGRAMS ) click to toggle source
#

save_into_compiled_programs

This method will try to save a lot of useful data into a file called “compiled_programs.yml”.

That way we can try to figure out what happened at any moment in time (hopefully).

The variable full_configure_command will store the full configure command, whereas configure_options only shows the part afterwards, such as which parts to enable or disable and so forth.

This should also store ARCH info and such.

#
# File lib/rbt/installer/misc.rb, line 8820
def save_into_compiled_programs(
    store_into = FILE_COMPILED_PROGRAMS
  )
  what  = ''.dup # Need a non-frozen String.
  what << '# --- '+program_name?+N
  what << program_name?+':'+N
  what << ' CFLAGS: '+cflags?.to_s+N
  what << ' compiled_at: '+today?.to_s+', '+current_hour?+N
  what << ' prefix: '+real_prefix?.to_s+N
  what << ' full_configure_command: '+
          full_configure_command?.to_s+N
  what << ' configure_options: '+configure_options?.to_s+N
  what << ' successfully_compiled: true/false'+N # This line here is obviously a stub.
  what << N # Extra newline - makes reading this file easier.
  append_what_into(what, store_into)
end
scan_source_archive( shall_we_exit = true ) click to toggle source
#

scan_source_archive

Scan the complete source archive.

Invocation example:

ry --scan_source_archive
#
# File lib/rbt/installer/misc.rb, line 7404
def scan_source_archive(
    shall_we_exit = true
  )
  require 'rbt/cookbooks/scan_source_archive.rb'
  opne 'Scanning for source Archives now.'
  RBT::Cookbooks::ScanSourceArchive.new # bl ScanSourceArchive
  exit_program if shall_we_exit
end
scons_file?()
Alias for: scons_file_exists?
scons_file_exists?() click to toggle source
#

scons_file_exists?

#
# File lib/rbt/installer/misc.rb, line 9120
def scons_file_exists?
  File.exist? 'SConstruct'
end
Also aliased as: scons_file?
search_for_tag( this_tag, shall_we_exit = true ) click to toggle source
#

search_for_tag (search tag)

Use this to search for a tag.

Usage examples:

ry htop --tags pdf
ry htop --tags term
#
# File lib/rbt/installer/misc.rb, line 1116
def search_for_tag(
    this_tag,
    shall_we_exit = true
  )
  results = RBT::Cookbooks::SearchForTags.new(this_tag)
  exit_program if shall_we_exit
  return results
end
search_for_this_program?()
sed?() click to toggle source
#

sed?

Query as to whether we will use sed or not.

#
# File lib/rbt/installer/misc.rb, line 9582
def sed?
  _ = cookbook_for?.sed?
  if @internal_hash[:sed].nil?
    # ===================================================================== #
    # In this case we will use the sed-variant given by the cookbooks
    # dataset.
    # ===================================================================== #
  else
    _ = @internal_hash[:sed]
  end
  return _
end
sed_binary_is_available?() click to toggle source
#

sed_binary_is_available?

Determine whether the host-system has the “sed” binary available or whether it has not.

#
# File lib/rbt/installer/misc.rb, line 2389
def sed_binary_is_available?
  result = `sed #{SHELL_ERROR_CODE}`
  result.include? 'Usage:'
end
set_archive_type(i) click to toggle source
#

set_archive_type

#
# File lib/rbt/installer/misc.rb, line 11252
def set_archive_type(i)
  cookbook_for?.set_archive_type(i)
end
set_array_compile_these_programs( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
set_base_dir(i) click to toggle source
#

set_base_dir

#
# File lib/rbt/installer/misc.rb, line 11231
def set_base_dir(i)
  cookbook_for?.set_base_dir = i
end
set_cflags( i = default_cflags?, &block ) click to toggle source
#

set_cflags (cflags tag)

This method will enable you to set i.e. new cflags. This then also allows you to compile some programs in a different manner, such as if you wish to compile that particular program statically.

The default argument to this method will be a copy of ENV.

You can overrule this via a shortcut, if you want to, by passing true as argument, or even better, a Symol such as :static. This will then allow you to perform the static build, if the program at hand allows for this.

-static-libgcc may also be an option here.

The variable LDFLAGS may be important as well.

For instance:

make LDFLAGS=-all-static
#
# File lib/rbt/installer/misc.rb, line 11063
def set_cflags(
    i = default_cflags?,
    &block
  )
  case i # case tag
  # ======================================================================= #
  # === :clear
  # ======================================================================= #
  when :clear
    i = ''
  # ======================================================================= #
  # Enable static builds for the CFLAGS at hand
  # ======================================================================= #
  when :overrule_static_build,
       :static,
       :build_static,
       true
    i = "#{old_cflags?} -static -g"
  end
  # ======================================================================= #
  # Do the actual assignment next.
  # ======================================================================= #
  set_this_env_variable(
    "CFLAGS: #{i}",
    :do_set_these_variables,
    &block
  )
end
set_compile_these_programs( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
set_compile_these_programs_then_batch_compile_them( i, consider_replacing_the_input = :default ) click to toggle source
#

set_compile_these_programs_then_batch_compile_them

This method can be used to start batch-compiling several programs in one go.

#
# File lib/rbt/installer/misc.rb, line 6868
def set_compile_these_programs_then_batch_compile_them(
    i, consider_replacing_the_input = :default
  )
  set_compile_these_programs(i, consider_replacing_the_input) 
  batch_compile_these_programs(i)
end
set_compile_this_program( i, &block )
set_configure_base_dir( i = :default )
set_configure_base_directory( i = :default ) click to toggle source
#

set_configure_base_directory

This setter-method sets the @internal_hash, which is, for example, a directory such as:

/Depot/Temp/htop-1.0.0/

Some projects, such as “xvid” / “xvidcore”, may require a specific subdirectory, though.

Another example may be the program called “nspr”, which requires the following configure base directory:

/Depot/Temp/nspr-4.10.8/nspr/

class RBT::Installer will store this in a separate variable so that it can be queried lateron.

Do note that the cookbook-dataset will also retain the original configure_base_directory.

#
# File lib/rbt/installer/misc.rb, line 2416
def set_configure_base_directory(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = rds(
          "#{extract_to?.to_s}"\
          "#{program_name_and_version?.to_s}/"\
          "#{cookbook_dataset_configure_base_directory?.to_s}"
        )
  end
  i = i.to_s.dup
  i = rds(i) # rds() is used here since as of Feb 2012.
  i << '/' unless i.end_with? '/' # It must always have a trailing '/'.
  i = i.to_s.dup
  @internal_hash[:configure_base_directory] = i # ← Finally, assign it.
end
Also aliased as: set_configure_base_dir
set_configure_command(i)
set_configure_options(i = '') click to toggle source
#

set_configure_options

This will directly modify the cookbook-dataset.

#
# File lib/rbt/installer/misc.rb, line 14061
def set_configure_options(i = '')
  cookbook_for?.configure_options = i
end
set_configure_options=(i)
set_configure_options_on_internal_hash(i) click to toggle source
#

set_configure_options_on_internal_hash

#
# File lib/rbt/installer/misc.rb, line 11367
def set_configure_options_on_internal_hash(i)
  @internal_hash[:configure_options] = i
end
set_cookbook(i)
set_cookbook_dataset(i) click to toggle source
#

set_cookbook_dataset

#
# File lib/rbt/installer/misc.rb, line 7077
def set_cookbook_dataset(i)
  @internal_hash[:cookbook_for] = i
end
Also aliased as: set_cookbook, set_on_ihash
set_cookbook_dataset_program(i) click to toggle source
#

set_cookbook_dataset_program

#
# File lib/rbt/installer/misc.rb, line 7164
def set_cookbook_dataset_program(i)
  cookbooks_for?.set_program(i)
end
set_cookbook_dataset_program_path(i) click to toggle source
#

set_cookbook_dataset_program_path

#
# File lib/rbt/installer/misc.rb, line 11360
def set_cookbook_dataset_program_path(i)
  cookbook_for?.set_program_path(i)
end
set_cookbook_dataset_program_version(i) click to toggle source
#

set_cookbook_dataset_program_version

For this method to work, cookbook_for? must have been instantiated before.

#
# File lib/rbt/installer/misc.rb, line 11210
def set_cookbook_dataset_program_version(i)
  cookbook_for?.set_program_version(i)
end
set_delay_before_continuing(n_seconds) click to toggle source
#

set_delay_before_continuing (sleep tag)

Ensure that the argument passed to us is correct.

#
# File lib/rbt/installer/misc.rb, line 8066
def set_delay_before_continuing(n_seconds)
  sleep(n_seconds.to_i)
end
set_desc(i)
Alias for: set_description
set_description(i) click to toggle source
#

set_description

#
# File lib/rbt/installer/misc.rb, line 14021
def set_description(i)
  cookbook_for?.set_description(i)
end
Also aliased as: set_desc
set_dont_keep_archive( be_verbose = true ) click to toggle source
#

set_dont_keep_archive

Use this method when you don’t want to keep the extracted archive.

#
# File lib/rbt/installer/misc.rb, line 3576
def set_dont_keep_archive(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not keep our extracted archive.'
  end
  @internal_hash[:keep_the_extracted_archive] = false
end
set_env?()
Alias for: set_env_variables?
set_env_variables?() click to toggle source
#

set_env_variables?

Determine whether we have to set any environment variable or not.

#
# File lib/rbt/installer/misc.rb, line 5758
def set_env_variables?
  _ = cookbook_for?
  if _ and _.respond_to?(:set_env_variables?)
    _.set_env_variables?
  else
    false
  end
end
Also aliased as: set_env?
set_extract_to( i = RBT.log_directory?, be_verbose = false )
set_extract_to_this_directory( i = RBT.log_directory?, be_verbose = false ) click to toggle source
#

set_extract_to_this_directory

This method can be used to keep track onto which directory archives will be extracted.

Within RBT, the target is also known as the “homedir” variable.

#
# File lib/rbt/installer/misc.rb, line 11470
def set_extract_to_this_directory(
    i          = RBT.log_directory?,
    be_verbose = false
  )
  case be_verbose
  when :be_verbose
    be_verbose = true
  end
  i = i.to_s
  case i
  # ======================================================================= #
  # === pwd
  # ======================================================================= #
  when 'pwd','homedir'
    i = rds(return_pwd+'/')
  end unless File.exist? i
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  # ======================================================================= #
  # Display some information to the user, if we operate in a verbose manner.
  # ======================================================================= #
  if be_verbose
    opne 'We will use '+sdir(i)+' as our directory into which '\
         'we will extract the source archive into.'
  end
  @internal_hash[:extract_to_this_directory] = i.dup
end
set_extract_to_this_directory_as_specified_by_the_user( i = :random ) click to toggle source
#

set_extract_to_this_directory_as_specified_by_the_user

This method can be used by the user to specify a certain directory.

#
# File lib/rbt/installer/misc.rb, line 5629
def set_extract_to_this_directory_as_specified_by_the_user(
    i = :random
  )
  case i
  when :random
    # ===================================================================== #
    # In this case we will use a random subdirectory, but within the
    # temp directory still.
    # ===================================================================== #
    i = rbt_temp_dir?+return_n_random_characters(10)
  end
  unless i.end_with? '/'
    i = i.dup if i.frozen?
    i << '/'
  end
  @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = i
end
set_extracted_base_directory(i) click to toggle source
#

set_extracted_base_directory

#
# File lib/rbt/installer/misc.rb, line 3657
def set_extracted_base_directory(i)
  @internal_hash[:extracted_base_directory] = i
end
set_full_configure_command(i) click to toggle source
#

set_full_configure_command

#
# File lib/rbt/installer/misc.rb, line 11394
def set_full_configure_command(i)
  i.strip! # ← This is mandatory; may be reconsidered in the future though.
  @internal_hash[:full_configure_command] = i
end
set_handle_this_program( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
set_homedir( i = RBT.log_directory?, be_verbose = false )
set_install_these_programs( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting ) click to toggle source
#

set_install_these_programs

This setter-method will designate which programs are to be installed/compiled.

The format for this will be an Array, such as:

['htop','ruby','php']

Note that this method will remove all ‘-’ tokens from the given input at hand, if the second argument given to this method allows this method to do so.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 30
def set_install_these_programs(
    i                                  = first_argument?,
    consider_replacing_the_given_input = :honour_user_configuration_setting
  )
  i = i.dup if i
  case consider_replacing_the_given_input
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    consider_replacing_the_given_input = true
  # ======================================================================= #
  # === :do_not_replace
  #
  # In this case we may not replace the given input.
  # ======================================================================= #
  when :do_not_replace
    consider_replacing_the_given_input = false
  # ======================================================================= #
  # === :honour_user_configuration_setting
  # ======================================================================= #
  when :honour_user_configuration_setting,
       :honour_user_settings
    if will_we_make_use_of_abbreviations?
      consider_replacing_the_given_input = 
        @internal_hash[:make_use_of_the_cookbook_aliases]
    else
      consider_replacing_the_given_input = false
    end
  end
  # ======================================================================= #
  # We may not replace anything in this case, as otherwise
  # "--lxqt" may become "--lxqtconfig" or just "lxqtconfig"
  # which is not desirable. But sometimes this is useful,
  # so ...
  # ======================================================================= #
  unless is_an_archive?(i)
    _ = i.to_s.dup.downcase.delete('/') # ← Get rid of some unwanted characters. But no longer of '-'.
    _replace_or_dont_replace = :honour_user_settings
    if _.start_with?('--')
      _replace_or_dont_replace = :do_not_replace
      # This is not yet in use ^^^.
    else
      i = remove_archive_at_the_end(File.basename(_))
    end
  end
  # ======================================================================= #
  # Next, look for chained-programs.
  # ======================================================================= #
  _ = dataset_from_the_file_cookbook_chained_programs?
  if _.has_key?(i) and
    !does_include?(i)
    i = _[i]
  end
  # ======================================================================= #
  # Past this point we don't want "--" entries.
  # ======================================================================= #
  i = [i].flatten.compact.reject {|entry|
    entry.start_with? '--'
  }
  i.map! {|entry|
    entry = entry.to_s.dup
    # ======================================================================= #
    # === Handle the possibility of replacing the given input at hand
    #
    # This clause is triggered when the user wishes to replace
    # the given input at hand.
    #
    # Invocation example:
    #
    #   trad libx
    #
    # ======================================================================= #
    if consider_replacing_the_given_input
      # =================================================================== #
      # First, check for .pc files directly. That way we can find the
      # real program at hand; and if not then the .pc suffix will be
      # dropped anyway.
      # =================================================================== #
      if entry.end_with? '.pc'
        _ = RBT.return_the_associated_program_of_this_pkgconfig_file(entry)
        unless _ == entry
          opne 'This .pc file is registered and points to '\
               'the program called '+steelblue(_)+'.'
          opne 'It will be used as input next.'
          entry = _
        end
        entry.delete_suffix!('.pc') if entry.end_with? '.pc'
      end
      entry.delete_suffix!('.yml') if entry.end_with? '.yml'
      entry.chop! if entry.end_with? ':','#' # Get rid of trailing ':' and '#'.
      # entry = entry.delete('-').downcase # All gets downcased. \o/
      # ^^^ removeing '-' can be problematic.
      entry = entry.downcase
      unless File.exist? entry
        if is_an_archive?(entry)
          entry = remove_archive_at_the_end(entry)
          if entry.include?('-') and (entry =~ /\d+/)
            # ============================================================= #
            # Assume entries such as this one here:
            #   mate-panel-1.21.3
            # ============================================================= #
            program_name     = ProgramInformation.return_name(entry)
            _program_version = ProgramInformation.return_version(entry)
            entry = program_name
          end
        end
      end
      entry = File.basename(entry) if entry.include? '/'
      unless RBT.is_this_program_registered?(entry)
        _ = RBT::MapThisInputToThatRegisteredProgram.new(entry) { :be_quiet }
        new_entry = _.return_possible_match
        if new_entry and
          (new_entry.to_s != entry.to_s)
          type = _.type?
          a_or_an = a_or_an?(type)
          opne 'Replacing '+steelblue(entry)+
               ' with '+mediumslateblue(new_entry)+', as '\
               'input. It is '+a_or_an+' '+
               mediumorchid(type.tr('_',' '))+'.'
          entry = new_entry
        end
      end unless entry.to_s.start_with? '--' # Exclude "--flag" options here.
    end
    entry
  }
  # ======================================================================= #
  # We will also initialize the cookbook_dataset for the first program,
  # if possible. We will also delete '.' characters since as of September
  # 2019, as some programs may be called e. g. "ruamel.yaml".
  # This was disabled in September 2022.
  # ======================================================================= #
  # original_first_program = RBT.compile_these_programs?.first.to_s
  # first_program = File.basename(
  #   original_first_program.downcase.delete('/.')
  # )
  # if first_program and RBT.is_this_program_included?(first_program)
  #   # ===================================================================== #
  #   # Set the initial seeds for the programs at hand.
  #   # ===================================================================== #
  #   set_compile_this_program(first_program)
  #   initialize_cookbook_dataset_for(first_program)
  # end
  ::RBT.set_install_these_programs(i) { :remove_underscore }
end
set_install_this_program( i, &block ) click to toggle source
#

set_install_this_program

This method is called set_handle_this_program() in class RBT::Compile.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 708
def set_install_this_program(
    i,
    &block
  )
  return if i and
            i.respond_to?(:start_with?) and
            i.start_with?('--') # Ignore '--' entries.
  if i.is_a? Array # Only consider the first input argument here.
    i = i.first
  end
  i = i.to_s.dup
  # ======================================================================= #
  # === Ad-hox fix libtool files if given to RBT::Install next
  #
  # Invocation example:
  #
  #   rbt libgdk-3.la
  #
  # ======================================================================= #
  if i.respond_to?(:end_with?) and
     i.end_with?('.la') and
    !File.exist?(i)
    do_not_try_to_autofix
    opne "Trying to autocorrect the libtool entry at "\
         "#{royalblue(i)}"
    try_to_autocorrect_this_erroneous_libtool_entry(i)
    return # And "exit" here.
  end
  # ======================================================================= #
  # Enable is-on-gobolinux if a certain .md file exists:
  # ======================================================================= #
  target_file = "#{log_dir?}is_on_gobolinux.md"
  if File.exist?(target_file) and
    !File.empty?(target_file)
    # ======================================================================= #
    # The above file must have been set on a GoboLinux system, when the
    # user did a rbt --auto before (or created the file manually).
    # ======================================================================= #
    enable_is_on_gobolinux
  end
  # ======================================================================= #
  # Keep track of the program we are compiling in the following variable;
  # after all that's the whole point of this method.
  # ======================================================================= #
  i = i.dup # Must be a String.
  @internal_hash[:install_this_program] = i
  return i # Return it here just in case.
end
Also aliased as: set_compile_this_program, set_handle_this_program, set_program_name
set_internal_hash_configure_options(i) click to toggle source
#

set_internal_hash_configure_options

#
# File lib/rbt/installer/misc.rb, line 6300
def set_internal_hash_configure_options(i)
  @internal_hash[:configure_options] = i
end
set_internal_pid(i = nil) click to toggle source
#

set_internal_pid

#
# File lib/rbt/installer/misc.rb, line 11910
def set_internal_pid(i = nil)
  @internal_hash[:pid] = i
end
Also aliased as: set_pid
set_is_an_abbreviation(i = true) click to toggle source
##

set_is_an_abbreviation

#
# File lib/rbt/installer/misc.rb, line 8276
def set_is_an_abbreviation(i = true)
  @internal_hash[:is_an_abbreviation] = i
end
set_keep_extracted(i = true)
set_keep_extracted_archive(i = true)
set_keep_the_extracted_archive(i = true) click to toggle source
#

set_keep_the_extracted_archive

This method will keep the source-archive extracted. Note that this is not the default - by default we will remove the extracted archive.

#
# File lib/rbt/installer/misc.rb, line 3564
def set_keep_the_extracted_archive(i = true)
  @internal_hash[:keep_the_extracted_archive] = i
end
set_license(i) click to toggle source
#

set_license

#
# File lib/rbt/installer/misc.rb, line 11217
def set_license(i)
  cookbook_for?.set_license(i)
end
set_make_command( i = 'make' ) click to toggle source
#

set_make_command

This method can be used to set which make command is to be used.

#
# File lib/rbt/installer/misc.rb, line 3300
def set_make_command(
    i = 'make'
  )
  i = 'make' if i.nil? # Set to the default in this case.
  @internal_hash[:make_command] = i
end
set_make_options(i)
set_name_for_the_build_directory( i = :use_the_default_name, be_verbose = false ) click to toggle source
#

set_name_for_the_build_directory

#
# File lib/rbt/installer/build_directory.rb, line 246
def set_name_for_the_build_directory(
    i          = :use_the_default_name,
    be_verbose = false
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default,
       :use_the_default_name
    i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY
  end
  case be_verbose
  # ======================================================================= #
  # === :report_back
  # ======================================================================= #
  when :report_back
    be_verbose = true
  end
  if be_verbose
   opne "The name of the build directory will be `#{royalblue(i)}`."
  end
  @internal_hash[:name_for_the_build_directory] = i
end
set_on_ihash(i)
set_parameters_to_make(i) click to toggle source
#

set_parameters_to_make

If we have to pass specials options to the program called “make”, then we can do so via this setter-method.

These are additional options that can be given to the program called “make”.

#
# File lib/rbt/installer/misc.rb, line 12597
def set_parameters_to_make(i)
  # ======================================================================= #
  # The parameters must always be kept as an Array.
  # ======================================================================= #
  i = [i].flatten.compact
  @internal_hash[:parameters_to_make] = i # Do not change them to a String via .to_s
end
Also aliased as: set_make_options
set_path(i) click to toggle source
#

set_path

Set the $PATH variable here through this setter-method. This will directly modify ENV[] as is.

#
# File lib/rbt/installer/misc.rb, line 7195
def set_path(i)
  i = i.dup # Better to always .dup it when we set it.
  ENV['PATH'] = i # Must re-enable PATH environment as it was.
end
set_permanently_extract_to( i = nil ) click to toggle source
#

set_permanently_extract_to

This method will permanently set a new directory to which we will extract to.

To invoke this method, do something such as:

ry --permanently_extract_to=/Depot
ry --permanently_extract_to=/opt
ry --permanently_extract_to=$TEMP_DIR
#
# File lib/rbt/installer/misc.rb, line 7103
def set_permanently_extract_to(
    i = nil
  )
  if i
    target = RBT.permanently_set_temp_directory(i)
    opne "The RBT scripts will henceforthwith be extracted "\
         "towards `#{sdir(target)}`."
  else
    opne 'Please provide an argument.'
  end
end
set_pid(i = nil)
Alias for: set_internal_pid
set_postinstall(i)
set_postinstallation(i) click to toggle source
#

set_postinstallation

Note that the postinstallation steps will always be stored as an Array.

#
# File lib/rbt/installer/postinstallation.rb, line 125
def set_postinstallation(i)
  @internal_hash[:postinstallation] = [i].flatten.compact
end
Also aliased as: set_postinstall
set_prefix(i)
Alias for: set_use_this_prefix
set_prefix_to_use( i = :appdir_prefix )
Alias for: set_user_prefix
set_preinstall_action(i) click to toggle source
#

set_preinstall_action

This method can be used to set different pre-install actions.

#
# File lib/rbt/installer/misc.rb, line 11193
def set_preinstall_action(i)
  if i.is_a? String # Strings will become an Array here.
    if    i.include? ','
      i = i.split(',').map(&:strip)
    elsif i.include? ';'
      i = i.split(';').map(&:strip)
    end
  end
  cookbook_for?.preinstall = i
end
set_program_full_name(i = :default) click to toggle source
#

set_program_full_name

#
# File lib/rbt/installer/misc.rb, line 9561
def set_program_full_name(i = :default)
  cookbook_for?.set_program_full_name(i)
end
set_program_name( i, &block )
set_program_name_and_program_version(i) click to toggle source
#

set_program_name_and_program_version

This is simply a wrapper over the corresponding method in the cookbook-object.

#
# File lib/rbt/installer/misc.rb, line 11353
def set_program_name_and_program_version(i)
  cookbook_for?.send(__method__, i)
end
set_program_path(i) click to toggle source
#

set_program_path

This will only modify a value on the @internal_hash.

#
# File lib/rbt/installer/misc.rb, line 11343
def set_program_path(i)
  @internal_hash[:program_path] = i
end
set_program_short_name(i) click to toggle source
#

set_program_short_name

#
# File lib/rbt/installer/misc.rb, line 12797
def set_program_short_name(i)
  cookbook_for?.set_program_short_name(i)
end
set_program_version(i) click to toggle source
#

set_program_version

Use this method to assign to a new program version at hand.

#
# File lib/rbt/installer/misc.rb, line 10002
def set_program_version(i)
  # ======================================================================= #
  # The program version is presently (December 2018) not allowed
  # to include a '/' character - possibly never allowed to have
  # this character. Thus, if we encounter such a character we
  # will apply File.basename() on this input.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i).delete('/')
  end
  i.delete!('/') if i.include? '/'
  # ======================================================================= #
  # Keep track which specific program version we will use.
  # ======================================================================= #
  @internal_hash[:use_this_specific_program_version] = i
  # ======================================================================= #
  # The following code is semi-experimental - we will also sync onto
  # the cookbook dataset object if it exists. We do this primarily
  # so that class Flexbox can show the proper prefix in use.
  # ======================================================================= #
  if cookbook_for?
    cookbook_for?.set_program_version(i)
    if is_this_an_appdir_prefix? cookbook_for?.prefix?
      cookbook_for?.update_appdir_prefix
    end
    if use_appdir_prefix?
      # =================================================================== #
      # We know that we wish to use a special appdir prefix, so use it.
      # =================================================================== #
      set_user_prefix(return_appdir_prefix)
    end
  end
end
set_real_short_name(i)
Alias for: set_short_name
set_really_compile_this_program(i = :qt) click to toggle source
#

set_really_compile_this_program

#
# File lib/rbt/installer/misc.rb, line 6917
def set_really_compile_this_program(i = :qt)
  set_compile_this_program(i)
  set_compile_these_programs(i) if compile_these_programs?.empty?
  initialize_cookbook_dataset
end
set_short_desc(i) click to toggle source
#

set_short_desc

#
# File lib/rbt/installer/misc.rb, line 11224
def set_short_desc(i)
  cookbook_for?.set_short_desc(i)
end
set_short_name(i) click to toggle source
#

set_short_name

#
# File lib/rbt/installer/misc.rb, line 11184
def set_short_name(i)
  cookbook_for?.set_short_name(i)
end
Also aliased as: set_real_short_name
set_skip_extracting( be_verbose = true ) click to toggle source
#

set_skip_extracting

Use this method when we shall skip the extracting phase.

#
# File lib/rbt/installer/extracting_and_archive_related_code.rb, line 27
def set_skip_extracting(
    be_verbose = true
  )
  if be_verbose
    opne 'We will not extract our source, thus we will skip '\
         'extracting the archive.'
  end
  @internal_hash[:skip_extracting] = true
end
Also aliased as: do_not_extract
set_standalone_compilation( program_name_and_program_version = program_name_and_program_version?, be_verbose = true )
set_these_env_variables( hash_or_string, do_which_action = :report_only, be_verbose = true ) { || ... } click to toggle source
#

set_these_env_variables

This method can be used to modify ENV variables.

The first input argument to this method should be the Hash, consisting of the key-value pairs in the form of key being the NAME of the shell variable that is to be modified; and the corresponding value being the new VALUE that you wish to set this variable to.

The third argument to this method determines whether we will output what we do to the user. By default this is true, but sometimes we may want to be able to quietly set these environment variables, such as when we attempt to use clang.

Legitimate usage examples for this method, in ruby, would be:

set_this_env_variable 'CFLAGS = -gcc'
set_this_env_variable 'LIBS: -lpthread'
#
# File lib/rbt/installer/misc.rb, line 10953
def set_these_env_variables(
    hash_or_string, # We allow Hash and String as input. But String must be in a special format.
    do_which_action = :report_only,
    be_verbose      = true
  )
  if block_given?
    yielded = yield
    if yielded.is_a? Symbol
      do_which_action = yielded
    end
  end
  unless @internal_hash[:do_not_use_special_flags]
    case do_which_action
    # ===================================================================== #
    # === :be_quiet
    # ===================================================================== #
    when :be_quiet,
         :be_silent
      be_verbose = false
      # =================================================================== #
      # Also change the do_which_action variable.
      # =================================================================== #
      do_which_action = :do_set_these_variables
    end
    case be_verbose
    # ===================================================================== #
    # === :be_verbose
    # ===================================================================== #
    when :be_verbose
      be_verbose = true
    # ===================================================================== #
    # === :be_quiet
    # ===================================================================== #
    when :be_quiet,
         :be_silent
      be_verbose = false
    end
    # ===================================================================== #
    # === Next, handle Strings
    # ===================================================================== #
    if hash_or_string.is_a? String
      if hash_or_string.include?('=') or
         hash_or_string.include?(':')
        if hash_or_string.include?('=')
          use_this_as_split_token = '='
        elsif hash_or_string.include?(':')
          use_this_as_split_token = ':'
        end
        splitted = hash_or_string.sub(/^export /,'').split(use_this_as_split_token)
        this_key   = splitted.first
        this_value = splitted.last
        hash_or_string = { this_key => this_value } 
      end
    end
    # ===================================================================== #
    # === Next, handle Hashes
    # ===================================================================== #
    hash_or_string.each_pair {|key, value|
      value.strip! if value.is_a? String
      # =================================================================== #
      # Make some exceptions, e. g. for gems.
      # =================================================================== #
      return if cookbook_dataset_has_been_initialized? and is_a_gem?
      if be_verbose and is_compiled? and !extract_only? and not value.to_s.empty?
        # ================================================================= #
        # Notify the user as to the env-value modification. Since as of
        # November 2018 we will no longer use opnn() here.
        # ================================================================= #
        e "  #{sfancy(key)} will be set to the "\
          "value(s): #{lightblue(value.to_s)}"
      end
      if value.is_a? FalseClass or
         value.is_a? TrueClass or
         value.is_a? Integer
        value = value.to_s
      end
      case do_which_action
      when :do_set_these_variables
        # ================================================================= #
        # Next set the value to the environment variable.
        # ================================================================= #
        ENV[key] = value
      end 
    }
  end
end
Also aliased as: set_this_env_variable
set_this_env_variable( hash_or_string, do_which_action = :report_only, be_verbose = true )
set_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? )
set_url(i)
Alias for: set_url1
set_url1(i) click to toggle source
#

set_url1

#
# File lib/rbt/installer/misc.rb, line 11238
def set_url1(i)
  cookbook_for?.set_url1(i)
end
Also aliased as: set_url
set_url2(i) click to toggle source
#

set_url2

#
# File lib/rbt/installer/misc.rb, line 11245
def set_url2(i)
  cookbook_for?.set_url2(i)
end
set_use_these_configure_options(i) click to toggle source
#

set_use_these_configure_options

#
# File lib/rbt/installer/misc.rb, line 6291
def set_use_these_configure_options(i)
  i.tr!(N,' ') if i.include? N
  i.squeeze!(' ')
  @internal_hash[:configure_options] = i
end
Also aliased as: set_configure_options=
set_use_this_build_directory( i = :use_the_default_name, be_verbose = false )
set_use_this_build_system(i) click to toggle source
#

set_use_this_build_system

Consistently use this method when you modify the value at @internal_hash.

We need to ensure that it is a Symbol.

#
# File lib/rbt/installer/misc.rb, line 11379
def set_use_this_build_system(i)
  i = i.to_sym unless i.is_a? Symbol
  @internal_hash[:use_this_build_system] = i
end
set_use_this_configure_command(i) click to toggle source
#

set_use_this_configure_command

#
# File lib/rbt/installer/misc.rb, line 11259
def set_use_this_configure_command(i)
  @internal_hash[:configure_command_to_use] = i.to_s
end
set_use_this_make_command( i = :default ) click to toggle source
#

set_use_this_make_command

This can be used to use another make command, such as “ninja”.

#
# File lib/rbt/installer/misc.rb, line 15435
def set_use_this_make_command(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = :make
  end
  i = i.to_s # It must be a string.
  @internal_hash[:use_this_make_command] = i
end
set_use_this_prefix(i) click to toggle source
#

set_use_this_prefix

This variant will only modify the prefix stored by @prefix.

#
# File lib/rbt/installer/misc.rb, line 1041
def set_use_this_prefix(i)
  prefix?.set_prefix(i) if prefix?
end
Also aliased as: set_prefix
set_use_this_sed_line(i) click to toggle source
#

set_use_this_sed_line

#
# File lib/rbt/installer/misc.rb, line 9598
def set_use_this_sed_line(i)
  @internal_hash[:sed] = i
end
set_user_prefix( i = :appdir_prefix ) click to toggle source
#

set_user_prefix (set_prefix tag, set prefix tag)

This method can be used by the user, to designate another prefix in use for the given program. This will be the target directory into which the program will be installed into.

A specialized class, called RBT::Prefix, will handle the prefix.

#
# File lib/rbt/installer/misc.rb, line 9339
def set_user_prefix(
    i = :appdir_prefix
  )
  # ======================================================================= #
  # We must rewrite the program version in the following case.
  #
  # The input may look like this:
  #
  #  "/Programs/Gobjectintrospection/1.53.4/"
  #
  # ======================================================================= #
  if i and use_this_specific_program_version?
    if i.is_a?(String) and i.include?(programs_directory?)
      use_this_regex = /(\d{1,2}\.?\d{1,2}\.?\d{1,2}\/)$/ # See: http://rubular.com/r/PPb2Y96XfF
      i.sub!(use_this_regex, use_this_specific_program_version?)
      i << '/' unless i.end_with? '/'
    elsif i.is_a?(Symbol)
      i = use_this_specific_program_version?
    end
  end
  if i.is_a? Symbol
    # ===================================================================== #
    # Next, perform some sanitize operations.
    #
    # This clause will handle Symbols such as :app_dir_like or
    # :use_ntrad_prefix_at_a_later_time.
    # ===================================================================== #
    case i.to_s # case tag
    # ===================================================================== #
    # === ULOCAL
    #
    # This refers to the commonly used /usr/local/ directory.
    # ===================================================================== #
    when 'ULOCAL'
      i = '/usr/local/'
    # ===================================================================== #
    # === trad
    # ===================================================================== #
    when /^trad$/
      i = '/usr/'
    # ===================================================================== #
    # === --opt_prefix
    # ===================================================================== #
    when /^-?-?opt(_|-)?prefix$/,
         :opt
      i = '/opt/'
    # ===================================================================== #
    # === non_traditional
    #
    # This entry point has various aliases such as :ntrad.
    # ===================================================================== #
    when /^app(_|-)?dir$/,
         /^app(_|-)?dir(_|-)?like$/,
         /^use(_|-)?appdir(_|-)?prefix$/i,
         /^use(_|-)?ntrad(_|-)?prefix(_|-)?at(_|-)?a(_|-)?later(_|-)?time$/i,
         'non_traditional',
         'gobolinux',
         'ntrad',
         'default',
         'app_dir_like',
         'appdir',
         'return_appdir_path',
         'false',
         'f',
         'appdir_prefix',
         ''
      prefix?.clear_program # Clear it initially.
      prefix?.do_use_appdir_prefix
      if handle_which_program?
        i = return_non_traditional_prefix(handle_which_program?)
      end
      # =================================================================== #
      # Since as of May 2014 we get rid of all '-'
      # =================================================================== #
      i.delete!('-') if i.respond_to?(:include?) and i.include? '-'
    end
    # ===================================================================== #
    # === Convert environment variables, if given, and unfreeze frozen
    #     Strings
    # ===================================================================== #
    if i.is_a?(String)
      # =================================================================== #
      # Unfreeze frozen Strings.
      # =================================================================== #
      if i.is_a? String and i.frozen?
        i = i.dup # "unfreeze" it.
      end
      # =================================================================== #
      # === Handle Strings that start with the ':' character
      #
      # Handle the situation when we input a String that starts with
      # the character ':'. This will be assumed to be a shortcut to
      # an environment variable.
      # =================================================================== #
      if i.start_with?(':')
        # ================================================================= #
        # Next, we must add the proper program_version. This is either the
        # program_version at hand - or it is an ENV variable if it exists.
        # We check for the ENV variable first.
        # ================================================================= #
        this_key = (i.delete(':').upcase+'_PREFIX').dup
        if ENV.has_key? this_key
          # =============================================================== #
          # The environment variables must be UPCASED and have appended
          # the string '_PREFIX'.
          # =============================================================== #
          i = ENV[this_key].dup.to_s
        else
          # =============================================================== #
          # Assume a special prefix variant targetting the /Programs/
          # hierarchy.
          # =============================================================== #
          i = programs_directory?+i.to_s.delete(':').capitalize+'/'
          i << program_version?.dup.to_s
        end
      end
      if i.include?('$')
        i = convert_env_variable(i) # Replace ENV variables here.
        i << '/' unless i.end_with? '/'
      end
      if i.include? '--'
        if i.include? '--prefix=' # Input is assumed to be like '--prefix=/Depot/j'
          i = i.split('=').last # ← Obtain just the last part in this case.
        end
      end
    end
    # ===================================================================== #
    # === Ensure a trailing '/' for directories.
    # ===================================================================== #
    unless i.to_s.end_with? '/' # .to_s to protect against Symbols given.
      i << '/' if File.directory?(i.to_s)
    end
  end
  # ======================================================================= #
  # Next, we must check for post-install actions and modify these,
  # if they exist. We only do so if we have an AppDir-prefix.
  # ======================================================================= #
  if is_an_appdir_prefix?(i.to_s)
    consider_modifying_postinstall
  end
  @internal_hash[:prefix].use_this_as_the_new_prefix = i
end
Also aliased as: set_use_this_prefix, prefix=, set_prefix, set_prefix_to_use
set_user_prefix_to_nil() click to toggle source
#

set_user_prefix_to_nil

#
# File lib/rbt/installer/misc.rb, line 1048
def set_user_prefix_to_nil
  set_user_prefix(nil)
end
shall_we_extract_the_archive?() click to toggle source
#

shall_we_extract_the_archive?

Query method over as to whether RBT will extract the archive or not.

#
# File lib/rbt/installer/misc.rb, line 12154
def shall_we_extract_the_archive?
  @internal_hash[:extract_the_archive]
end
Also aliased as: extract_the_archive?
shall_we_run_configure?()
short_description?() click to toggle source
#

short_description?

#
# File lib/rbt/installer/misc.rb, line 4726
def short_description?
  cookbook_for?.short_description?
end
short_name?()
show_all( show_this_program = search_for_this_program? )
Alias for: show_all_about
show_all_about( show_this_program = search_for_this_program? ) click to toggle source
#

show_all_about

This method will show the full content of a specific .yml file.

To invoke this method, do something like the following:

ry htop show_all
#
# File lib/rbt/installer/misc.rb, line 115
def show_all_about(
    show_this_program = search_for_this_program? # or internal_program_name?
  )
  require 'rbt/utility_scripts/show_all_about.rb'
  RBT::ShowAllAbout.new(show_this_program)
end
Also aliased as: show_all
show_all_about_this_dir( i = return_pwd ) click to toggle source
#

show_all_about_this_dir

#
# File lib/rbt/installer/misc.rb, line 15207
def show_all_about_this_dir(
    i = return_pwd
  )
  _ = File.basename(i)
  _ = program_information_return_short_name(i).delete('-')
  show_all_about(_) # Delegate to that method here.
end
show_all_available_programs() click to toggle source
#

show_all_available_programs

#
# File lib/rbt/installer/misc.rb, line 12869
def show_all_available_programs
  available_programs?.each {|this_program|
    e "- #{this_program}"
  }
end
show_all_binaries_of_this_program( this_program = compile_which_program?, report_how = :one_line_per_program ) click to toggle source
#

show_all_binaries_of_this_program

Use this method to show the registered binaries of the input-argument, the given program at hand. This will display these binaries in one line, as a “Hash”.

Invocation example:

rbt binutils --binaries-as-one-line?
#
# File lib/rbt/installer/misc.rb, line 15111
def show_all_binaries_of_this_program(
    this_program = compile_which_program?,
    report_how   = :one_line_per_program # The only other mode is :report_in_one_line
  )
  case this_program
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    this_program = compile_which_program?
  end
  if dataset?.nil?
    ensure_that_a_dataset_exists_for_this_program(this_program)
  end
  _ = binaries? # Grab the registered binaries here.
  if _.empty?
    opne "No binaries/executables appear to be registered for "\
         "the program `#{sfancy(this_program)}`."
  else
    case report_how
    when :one_line_per_program,
         :default
      e; _.each_with_index {|this_binary, index| index += 1
        index = "  #{slateblue((index.to_s+') ').rjust(5))}"
        e "#{index}#{sfancy(this_binary)}"
      }; e
    else # else we use another mode.
      result = '{'.dup
      result << _.join(',')
      result << '}'
      e result
    end
  end
end
Also aliased as: feedback_all_binaries
show_all_locally_available_programs( slice_n_chunks = 3 ) click to toggle source
#

show_all_locally_available_programs

Invocation example:

rbt --locally-available-programs?
#
# File lib/rbt/installer/misc.rb, line 15324
def show_all_locally_available_programs(
    slice_n_chunks = 3
  )
  programs_dir = programs_dir?
  all_dirs = Dir[programs_dir+'*'].select {|entry| File.directory? entry }
  all_dirs.map! {|entry|
    use_this_regex = /^#{programs_dir}/
    entry = entry.sub(use_this_regex,'')
    entry # .downcase # To downcase or not to downcase.
  }
  n_programs = all_dirs.size.to_s
  opne "The locally available `#{orange(n_programs)}` programs are:"
  sliced = all_dirs.each_slice(slice_n_chunks)
  result = '  '.dup
  sliced.each {|inner_group_array|
    joined = inner_group_array.map {|entry|
      (entry+',').ljust(25)
    }.join
    result << '  '+sfancy(joined.strip).delete(',')+N
  }
  result = result.strip.chop.chomp.strip
  result.sub!(/,\e\[0;37$/, '.') # Reformat it.
  e
  e result
  e
end
show_all_profiles_fitting_to_this_program(i = :gcc) click to toggle source
#

show_all_profiles_fitting_to_this_program

This method can be used to show all profiles fitting to this program, such as gcc.

Invocation example:

ry --show-these-profiles=gcc
#
# File lib/rbt/installer/misc.rb, line 12407
def show_all_profiles_fitting_to_this_program(i = :gcc)
  all_available_profiles = return_files_from_the_profiles_directory
  selection = all_available_profiles.select {|entry|
    File.basename(entry).include? i.to_s
  }
  if selection.empty?
    opne 'No profiles were found for the program '\
         'called '+steelblue(i.to_s)+'.'
  else
    opne "#{rev}The following profiles were found for the program #{sfancy(i)}:"
    e
    selection.each_with_index {|this_file, index| index += 1
      short_name_of_the_file = File.basename(this_file).sub(/.md$/,'')
      colourized_index = royalblue('[')+orangered(index)+royalblue(']')
      e "  #{colourized_index} #{steelblue(short_name_of_the_file)}"
    }
    e
  end
end
show_all_programs_that_have_this_as_dependency(i) click to toggle source
#

show_all_programs_that_have_this_as_dependency(i)

#
# File lib/rbt/installer/misc.rb, line 15891
def show_all_programs_that_have_this_as_dependency(i)
  i = i.to_s.strip
  all_files = Dir["#{expanded_cookbook_directory?}*.yml"]
  all_files.select!.each {|this_file|
    if File.exist?(this_file)
      deps_on = YAML.load_file(this_file)[:required_deps_on]
      deps_on.any? {|a_dependency|
        a_dependency == i
      }
    else
      false
    end
  }
  if all_files.empty?
    opne 'No program has a dependency on '+steelblue(i)+'.'
  else
    opne "The following #{tomato(all_files.size)} programs have "\
         "a dependency on #{steelblue(i)}:"
    e
    all_files.each {|entry| e steelblue("  #{File.basename(entry).delete_suffix('.yml')}") }
    e
  end
end
show_and_store_json_for( this_program = compile_which_program? ) click to toggle source
#

show_and_store_json_for

This method will load the expanded cookbook dataset (a yaml file), and convert this into json, via the .to_json method.

Invocation example:

rbt htop --json
#
# File lib/rbt/installer/misc.rb, line 4114
def show_and_store_json_for(
    this_program = compile_which_program?
  )
  require 'json'
  hash = {}
  opne 'The json dataset for '+steelblue(this_program)+' is:'
  dataset = load_dataset_from_this_expanded_cookbook(this_program)
  hash[this_program.to_sym] = dataset
  e
  pp hash
  e
  opne 'This will be stored into the current directory as well.'
  what = hash.to_json
  # ======================================================================= #
  # Decide where to store the json-file.
  # ======================================================================= #
  into = "#{this_program}.json"
  opne 'Storing into the file `'+sfile(into)+'`.'
  write_what_into(what, into)
end
show_available_aliases() click to toggle source
#

show_available_aliases

To invoke this method, do:

rbt --aliases?
#
# File lib/rbt/installer/misc.rb, line 11786
def show_available_aliases
  _ = RBT.cookbook_aliases?
  opne "The available #{sfancy(_.size.to_s)} aliases are:"
  index = 0
  _.each_pair {|key, value| index += 1
    colourized_index = slateblue((index.to_s+')').rjust(5))
    e colourized_index+' '+sfancy(key.ljust(18))+
      mediumseagreen(' →  ')+simp(value)
  }
end
show_available_batch_compile_options( this_file = RBT.file_cookbook_chained_programs ) click to toggle source
#

show_available_batch_compile_options

#
# File lib/rbt/installer/misc.rb, line 1135
def show_available_batch_compile_options(
    this_file = RBT.file_cookbook_chained_programs
  )
  if File.exist? this_file
    dataset = YAML.load_file(this_file)
    keys = dataset.keys
    opne "These #{teal(keys.size)} entries exist:"; e
    keys.each {|this_entry_point|
      e "  #{sfancy(this_entry_point)}"
    }; e
  else
    opnn; no_such_file_exists(this_file)
  end
end
show_available_headers_of_this_program( i = compile_which_program? ) click to toggle source
#

show_available_headers_of_this_program

This method will show the available headers of the given program at hand.

Invocation example:

ry glibc --headers?
#
# File lib/rbt/installer/misc.rb, line 6846
def show_available_headers_of_this_program(
    i = compile_which_program?
  )
  array_headers = cookbook_dataset_headers?
  if array_headers.empty?
    opne "The program `#{sfancy(i)}` will not install any .h files."
  else
    opne "The program `#{sfancy(i)}` will install these .h files:"
    e
    array_headers.each {|this_header_file|
      e "  #{sfancy(this_header_file)}"
    }
    e
  end
end
show_available_profiles( target_directory = DIRECTORY_RBT_PROFILES ) click to toggle source
#

show_available_profiles

This method will show the available (local) profiles.

To invoke this method try:

rbt --show-available-profiles
#
# File lib/rbt/installer/misc.rb, line 12568
def show_available_profiles(
    target_directory = DIRECTORY_RBT_PROFILES
  )
  available_profiles = return_files_from_the_profiles_directory.map {|entry|
    File.basename(entry).delete_suffix('.md')
  }
  if available_profiles.empty?
    opne "No profiles could be found in the directory "\
         "#{sdir(target_directory)}."
  else
    e "#{rev}The following profiles are available:"
    e
    available_profiles.each_with_index {|entry, index| index += 1
      result = "  #{entry.ljust(45)}# #{seagreen(index.to_s.rjust(2))}"
      e slateblue(result)
    }
    e
  end
end
show_build_systems_priorities() click to toggle source
#

show_build_systems_priorities

Invocation example:

rbt --prioritize?
#
# File lib/rbt/installer/misc.rb, line 10261
def show_build_systems_priorities
  array = return_build_systems_priorities
  e
  e lightgreen(
      'The build system priority is the following '\
      '(first one has higher priority):'
    )
  e
  array.each_with_index {|content, index| index += 1
    e slateblue(("(#{index}) ").rjust(6))+
      orange(content)
  }
  e
  e 'Remember that the per-yaml setting "'+
     steelblue('use_this_build_system')+'" cat'
  e 'overrule this.'
  e
end
show_compile_chain(i) click to toggle source
#

show_compile_chain

Show all members of a particular compile-chain.

Invocation examples:

ry --show-chain=plasma
ry --show-compile-chain-of=kde5_plasma
ry --compile-chain-of=kde5_plasma
ry --view=kde5_plasma
ry --view=xfce
#
# File lib/rbt/installer/misc.rb, line 2826
def show_compile_chain(i)
  ShowCompileChain.of(i)
end
show_compile_time_statistics() click to toggle source
#

show_compile_time_statistics

This method will show compile-time statistics for all the programs that the user has compiled through RBT.

Invocation example:

ry --show-compile-time-statistics
#
# File lib/rbt/installer/misc.rb, line 618
def show_compile_time_statistics
  _ = RBT.file_storing_the_time_it_took_to_compile_programs
  if File.exist? _
    dataset = YAML.load_file(_)
    if dataset.empty?
      opne "The dataset is empty. Have there any programs been "\
           "compiled yet, through #{teal('rbt')}?"
    else
      opne "Showing the compile-time statistics for the "\
           "following #{sfancy(dataset.keys.size.to_s)} programs."
      e
      # =================================================================== #
      # Need to sort this dataset by size still.
      # =================================================================== #
      sorted_longest_compilation_comes_first = dataset.sort_by {|name_of_the_program, n_seconds|
        n_seconds
      }.reverse
      # =================================================================== #
      # Show a little header explaining what this is all about.
      # =================================================================== #
      e gray('-' * 80)
      # Next, properly name the header-entries
      e sfancy('Program name'.ljust(32))+
        simp('Compile time [sec] ')+
        orange('Compile time [min]')+
        mediumslateblue(' Archive file size')+
        mediumseagreen(' #')
      e gray('-' * 80)
      index = 0
      sorted_longest_compilation_comes_first.each {|name_of_the_program, n_seconds| index += 1
        left_padded  = ("#{name_of_the_program.strip}:").ljust(26)
        right_padded_showing_n_seconds = (
          '%.2f' % n_seconds.to_s.strip.to_f
        ).rjust(12)
        right_padded_showing_n_seconds << ' seconds'
        n_minutes = (n_seconds.to_f / 60.0).round(2) # Rounding to 2 is better.
        n_minutes = n_minutes.to_s.ljust(4,'0')
        # ================================================================= #
        # Next count the amount of numbers before the '.' point. If there
        # are at the least two numbers, we will .ljust(5,'0') rather than
        # .ljust(4,'0').
        # ================================================================= #
        if n_minutes.include? '.'
          first_splitted = n_minutes.split('.').first
          if first_splitted.size > 1
            n_minutes = n_minutes.to_s.ljust(5,'0')
          end
        end
        # ================================================================= #
        # The program name may be upcased; since we store only downcased
        # variants for the name of the .yml file at hand, we will also
        # .downcase() on the program name in the following code.
        # ================================================================= #
        archive_size = fast_return_file_size_of_this_program(
          name_of_the_program.downcase.delete('-')
        )
        colourized_file_size = mediumslateblue(
          "#{archive_size.to_s.rjust(10)} Kb"
        )
        result = '  '+sfancy(left_padded)+' '+
          simp(right_padded_showing_n_seconds)+' '+
          orange(
            ('('+n_minutes).rjust(6)+' minutes)'
          )
        result << ' '+colourized_file_size
        result << mediumseagreen(" ##{index}")
        e result
      }
      e
    end
  else
    opne "No file exists at `#{sfile(_)}`."
    opne 'We thus can not show any statistics.'
  end
end
show_components(i) click to toggle source
#

show_components

Invocation example:

ry --show-components=xfce
#
# File lib/rbt/installer/misc.rb, line 15292
def show_components(i)
  i = i.to_s # Just in case.
  chained_programs = return_chained_programs
  if chained_programs.has_key? i
    _ = chained_programs[i]
    e
    e "#{rev}These components belong to #{steelblue(i)}:"
    e
    _.each_with_index {|this_program, index| index += 1
      e lightgreen("  #{index}) ".rjust(6))+
        steelblue(this_program)
    }
    e
  else
    opne 'No component with that name could be found.'
    opne 'Available keys are:'
    e
    e royalblue(
        chained_programs.keys.join(', ').strip.chop
      )
    e
  end
end
show_configuration_options() click to toggle source
#

show_configuration_options

#
# File lib/rbt/installer/misc.rb, line 2341
def show_configuration_options
  ShowConfigurationOptions.new # This is automatically required.
end
show_downloadable_programs( i = available_programs?.sort ) click to toggle source
#

show_downloadable_programs

#
# File lib/rbt/installer/misc.rb, line 13172
def show_downloadable_programs(
    i = available_programs?.sort
  )
  chunked = i.each_slice(5)
  opne 'The following programs can be downloaded:'
  e
  chunked.each {|this_chunk|
    e "  #{slateblue(this_chunk.join(', ').strip.chop)}"
  }
  e
end
show_enable_pkgconfig_symlinking_message() click to toggle source
#

show_enable_pkgconfig_symlinking_message

#
# File lib/rbt/installer/misc.rb, line 1700
def show_enable_pkgconfig_symlinking_message
  opne "Enabling pkgconfig-symlinking of .pc files into `"\
       "#{sdir('/usr/lib/pkgconfig/')}`."
end
show_flexbox( compile_this_program = compile_which_program? )
Alias for: show_the_flexbox
show_flexbox?() click to toggle source
#

show_flexbox?

#
# File lib/rbt/installer/misc.rb, line 5805
def show_flexbox?
  @internal_hash[:show_the_flexbox]
end
show_gobolinux_instructions() click to toggle source
#

show_gobolinux_instructions

To invoke this method do:

rbt --show-gobo-instructions
#
# File lib/rbt/installer/misc.rb, line 1994
def show_gobolinux_instructions
  _ = RUBY_SRC_DIR+'rbt/doc/instructions_for_gobolinux.md'
  if File.exist? _
    e File.read(_)
  else
    opnn; no_file_exists_at(_)
  end
end
show_help_for_this_program( i = '', be_silent = false ) click to toggle source
#

show_help_for_this_program

Use this method if you wish to feedback how to use this class.

#
# File lib/rbt/installer/misc.rb, line 5557
def show_help_for_this_program(
    i         = '',
    be_silent = false
  )
  be_silent = true if be_silent == :be_silent
  e simp(i)+' has these options available:' unless be_silent
  display_standard_help_options # This is stored in help.rb
end
show_how_to_batch_compile() click to toggle source
#

show_how_to_batch_compile

This method will notify the user in how to batch-compile programs via RBT.

Invocation example:

rbt --show_how_to_batch_compile
#
# File lib/rbt/installer/misc.rb, line 2327
def show_how_to_batch_compile
  show_available_batch_compile_options
  e
  e 'In order to batch-compile one of these, issue a command such as:'
  e
  e '  rbt --batch-compile=mate'
  e '  rbt --batch-compile=vid_base'
  e '  rbt --batch-compile=terminals'
  e
end
show_how_to_compile_kde() click to toggle source
#

show_how_to_compile_kde

This method will provide some hints on the commandline as to how to batch-compile the various KDE components.

Invocation example:

rbt --show-how-to-compile-kde
#
# File lib/rbt/installer/misc.rb, line 2307
def show_how_to_compile_kde
  e
  e '  rbt --batch-compile=kde5_foundation'
  e '  rbt --batch-compile=kde5_plasma'
  e '  rbt --batch-compile=kde5_porting_aids'
  e '  rbt --batch-compile=kde5_applications'
  e
end
show_infobox?()
Alias for: show_flexbox?
show_information_about_blfs( use_this_key = :blfs ) click to toggle source
#

show_information_about_blfs

We show some information about BLFS webpages.

To invoke this method, you can issue a command such as this here:

rbt binutils --lfs
#
# File lib/rbt/installer/misc.rb, line 10381
def show_information_about_blfs(
    use_this_key = :blfs
  )
  ensure_that_this_key_has_a_dataset(use_this_key)
  dataset = cookbook_for?
  if dataset.has_key?(use_this_key) and
    !dataset?.blfs?.empty? # .empty? will assume this to be a String.
    url = dataset?.blfs?
    if url.is_a? Array
      url = url.first
    end
    e "Url is: #{sfancy(url)}"
    set_xorg_buffer(url) if is_roebe?
  else
    opne "The program #{royalblue(compile_which_program?)} has no blfs entry."
  end
end
show_installation_procedure_file( this_file = :installation_procedure ) click to toggle source
#

show_installation_procedure_file

Show the content of the file called installation_procedure.yml

To invoke this method, try:

rbt --installation-procedure
#
# File lib/rbt/installer/misc.rb, line 1934
def show_installation_procedure_file(
    this_file = :installation_procedure
  )
  begin
    require 'beautiful_url' unless Object.const_defined? :BeautifulUrl
    if this_file.is_a? Symbol
      this_file = BeautifulUrl[this_file.to_s]
    end
  rescue LoadError; end
  this_file = this_file.first if this_file.is_a? Array
  if File.exist? this_file
    e File.read(this_file)
  else
    opne 'No file called '+sfile(this_file)+' was found.'
  end
end
show_instructions_for_gobolinux() click to toggle source
#

show_instructions_for_gobolinux

#
# File lib/rbt/installer/misc.rb, line 11712
def show_instructions_for_gobolinux
  _ = "#{RUBY_SRC_DIR}rbt/doc/instructions_for_gobolinux.md"
  if File.exist? _
    e File.read(_)
  end
end
show_last_compiled_program( shall_we_exit = false ) click to toggle source
#

show_last_compiled_program

Use this method to show the last compiled program.

#
# File lib/rbt/installer/misc.rb, line 10411
def show_last_compiled_program(
    shall_we_exit = false
  )
  shall_we_exit = true if shall_we_exit == :then_exit
  opne 'The last compiled program was `'+
        sfancy(last_compiled_program?)+'` (as registered'
  opne "in the file #{sfile(RBT.file_compiled_programs)})."
  exit if shall_we_exit
end
show_last_configure_options_then_exit() click to toggle source
#

show_last_configure_options_then_exit

This method will show the last configure option that was used, then it will exit.

Invoke this like so:

rbt lconfigure?
#
# File lib/rbt/installer/misc.rb, line 6185
def show_last_configure_options_then_exit
  show_last_options
  exit_program
end
show_last_options( name_of_the_program = compile_which_program? ) click to toggle source
#

show_last_options

Use this method to show the last configure options that were used in order to compile a program from source.

To grab this, try:

ry htop --last-options
#
# File lib/rbt/installer/misc.rb, line 6225
def show_last_options(
    name_of_the_program = compile_which_program?
  )
  full_configure_command = return_last_configure_command
  if full_configure_command
    opne "The last configure command for "\
         "`#{simp(name_of_the_program)}` was:"
    opne "  #{simp(full_configure_command)}"
  else
    opne "No configure command was used for `#{simp(name_of_the_program)}`."
  end
end
show_last_updated( shall_we_exit = true ) click to toggle source
#

show_last_updated

This method will show the last updated programs.

Invocation example:

ry --last_update
#
# File lib/rbt/installer/misc.rb, line 11173
def show_last_updated(
    shall_we_exit = true
  )
  require 'rbt/cookbooks/show_last_updated.rb'
  RBT::Cookbooks::ShowLastUpdated.new # bl $RUBY_COOKBOOKS/lib/cookbooks/show_last_updated.rb
  exit_program if shall_we_exit
end
show_minimal_gcc_configure_options() click to toggle source
#

show_minimal_gcc_configure_options

#
# File lib/rbt/installer/misc.rb, line 12544
def show_minimal_gcc_configure_options
  _ = directory_rbt_profiles?+'gcc_minimal_but_lots_of_languages_enabled.md'
  if File.exist? _
    dataset = readlines(_).reject {|entry|
      begins_with_a_comment?(entry)
    }.join(N).tr(N,' ').squeeze(' ')
    e
    e "  #{steelblue(dataset)}"
    e
  else
    opnn; no_file_exists_at(_)
  end
end
show_n_largest_local_programs( i = :default ) click to toggle source
#

show_n_largest_local_programs

Show the largest local programs with this method.

Invocation example:

ry --show_highest
#
# File lib/rbt/installer/misc.rb, line 13613
def show_n_largest_local_programs(
    i = :default
  )
  require 'rbt/cookbooks/highest.rb'
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = 50
  end
  RBT::Cookbooks::Highest.new(i)
  exit_program
end
show_output_from_the_extracter_class?() click to toggle source
#

show_output_from_the_extracter_class?

#
# File lib/rbt/installer/misc.rb, line 2652
def show_output_from_the_extracter_class?
  @internal_hash[:show_output_from_the_extracter_class]
end
show_path_to_the_source_directory_yaml_file() click to toggle source
#

show_path_to_the_source_directory_yaml_file

This method will simply show the path to the source_dir.yml file.

Usage example:

rbt --path_to_source_directory?
#
# File lib/rbt/installer/misc.rb, line 15269
def show_path_to_the_source_directory_yaml_file
  _ = RBT.project_yaml_directory?+'configuration/source_dir.yml'
  e sfile(_)
end
show_pc_files_installed_by_this_program( i = compile_which_program? ) click to toggle source
#

show_pc_files_installed_by_this_program

Invocation example:

ry samba --pkgconfig-files?
#
# File lib/rbt/installer/misc.rb, line 15189
def show_pc_files_installed_by_this_program(
    i = compile_which_program?
  )
  _ = pc_files?
  if _.empty?
    opne 'The program '+simp(i)+' will not install any .pc file.'
  else
    opne "The program #{gold(i)} will install "\
         "the following #{sfancy(_.size.to_s)} .pc file(s):"
    e; _.each {|this_pc_file|
      e "  #{sfancy(this_pc_file)}"
    }; e
  end
end
show_programs_with_a_blfs_entry() click to toggle source
#

show_programs_with_a_blfs_entry

Invocation example:

ry --show-all-blfs-entries
#
# File lib/rbt/installer/misc.rb, line 9011
def show_programs_with_a_blfs_entry
  _ = Dir["#{individual_cookbooks_dir?}*.yml"]
  matches = _.select {|file|
    dataset = File.read(file)
    dataset.include? ' blfs:'
  }.map {|entry|
    File.basename(entry).sub(/\.yml$/,'')
  }
  unless matches.empty?
    opne "The following #{sandybrown(matches.size.to_s)} programs "\
         "have a #{sfancy('blfs')} entry:"
    e
    matches.each_with_index {|name_of_the_program, index| index += 1
      index = (index.to_s+') ').rjust(5)
      remote_url = return_blfs_page_of_this_program(name_of_the_program)
      e royalblue(index)+slateblue(name_of_the_program.ljust(24))+
        lightblue(remote_url.to_s)
    }
    e
  end
end
show_programs_with_this_as_dependency(i) click to toggle source
#

show_programs_with_this_as_dependency

Invocation example:

rbt --show-programs-with-this-as-dependency=cmake
#
# File lib/rbt/installer/misc.rb, line 10349
def show_programs_with_this_as_dependency(i)
  use_this_key = :required_deps_on
  e rev+'Next trying to find all programs that depend on '+steelblue(i)+':'
  e
  array_these_programs_depend_on_the_given_input = []
  available_programs?.each {|this_program|
    expanded_cookbook_dataset = return_dataset_from_this_expanded_cookbook(this_program)
    if expanded_cookbook_dataset
      required_deps_on = expanded_cookbook_dataset[use_this_key]
      if required_deps_on.include? i
        array_these_programs_depend_on_the_given_input << this_program
        e " - #{this_program}"
      end
    end
  }
  e
  e "#{rev}A total of "+
    royalblue(array_these_programs_depend_on_the_given_input.size.to_s)+
    rev+' registered programs depend on '+steelblue(i)+'.'
  e
end
show_rbt_intro() click to toggle source
#

show_rbt_intro

Invocation example:

ry --show-rbt-intro
ry --intro
#
# File lib/rbt/installer/misc.rb, line 76
def show_rbt_intro
  e
  e 'Here are some hints to get you started with RBT.'
  e
  e "You can compile a program by issuing #{orange('rbt <name>')}."
  e
  e 'Example:'
  e
  e sfancy('  rbt php')
  e
  e 'You can also compile into a standalone app-dir:'
  e
  e sfancy('  rbt php ntrad')
  e sfancy('  rbt php --app-dir')
  e
  e 'Both variants are synonymous. If in doubt, using the variants'
  e 'that start with '+teal('--')+' is recommended.'
  e
  e 'To speed-up looking for the dataset stored in the various .yml'
  e 'files you can also issue the following command:'
  e
  e sfancy('  rbt --expand')
  e
  e 'This command will expand the dataset into a "sanitized" variant'
  e 'that requires less pre-processing before it can be used for'
  e 'compiling/installing programs from source.'
  e
end
show_registered_gems()
show_registered_keys() click to toggle source
#

show_registered_keys

This delegates towards the Register class.

#
# File lib/rbt/installer/misc.rb, line 1491
def show_registered_keys
  RBT::RegisterProgramFilesIntoYamlDatabase.show_registered_keys
end
show_statistics_about_the_rbt_project() click to toggle source
#

show_statistics_about_the_rbt_project

To invoke this method, do:

rbt --stats?
#
# File lib/rbt/installer/misc.rb, line 9250
def show_statistics_about_the_rbt_project
  RBT::ShowStatistics.new
end
show_success_or_failure_status() click to toggle source
#

show_success_or_failure_status (success tag, failure tag, status tag)

This method will report some things, aka the success or failure status of a program.

#
# File lib/rbt/installer/misc.rb, line 2762
def show_success_or_failure_status
  # ======================================================================= #
  # Report the following only if the program has been installed
  # successfully.
  # ======================================================================= #
  if has_the_program_been_installed_successfully?
    opne "The host system architecture was: "\
         "#{slateblue(host_system?)}"
    if is_a_gem?
      # =================================================================== #
      # If it is a .gem file then we will not report as much information.
      # =================================================================== #
      opne teal('The program ')+
           lightgreen(compile_which_program?)+
           teal(' has been installed successfully.')
    else
      _ = return_full_configure_command
      if _.nil? or _.empty?
        # ================================================================= #
        # This entry-point is specifically for e. g. perl-addons and
        # similar programs.
        # ================================================================= #
        opne teal('The program ')+lightgreen(compile_which_program?)+
             teal(' has been installed successfully.')
      else
        opne teal('The program ')+lightgreen(compile_which_program?)+
             teal(' has been installed successfully, into the prefix')
        opne plum(prefix?.to_s)+
             teal('. The full configure command was:')
        e
        e "  #{slateblue(return_full_configure_command)}"
        e
      end
    end
  else
    # ===================================================================== #
    # Else the program has failed during compilation/installation.
    # ===================================================================== #
    opne crimson(
           return_unicode_warning_symbol_or_empty_string+' The program `'
         )+
         teal(compile_which_program?)+
         crimson(
           '` could not be installed. '+
           return_unicode_warning_symbol_or_empty_string
         )
  end
end
Also aliased as: report_status
show_success_status?()
show_temp_directory() click to toggle source
#

show_temp_directory

To invoke this from the commandline, do:

ry --tempdir?
#
# File lib/rbt/installer/misc.rb, line 2292
def show_temp_directory
  opne "The temporary directory resides at `#{sdir(temp_directory?)}`."
end
show_the_available_gems() click to toggle source
#

show_the_available_gems

To invoke this method from the commandline, try:

rbt --show-registered-gems
#
# File lib/rbt/installer/misc.rb, line 13006
def show_the_available_gems
  e
  opne 'These gems are currently available within the RBT project:'
  e
  RBT.array_all_rubygems.each_with_index {|this_gem, index| index += 1
    e "  #{lightgreen(index.to_s.rjust(4))} #{slateblue(this_gem)}"
  }
  e
end
Also aliased as: show_registered_gems
show_the_available_profiles_for_configure_options() click to toggle source
#

show_the_available_profiles_for_configure_options

#
# File lib/rbt/installer/misc.rb, line 12430
def show_the_available_profiles_for_configure_options
  Dir["#{DIRECTORY_RBT_PROFILES}*.md"].each {|this_profile|
    e '  - '+royalblue(File.basename(this_profile)).sub(/\.md$/,'')
  }
end
show_the_classname?() click to toggle source
#

show_the_classname?

#
# File lib/rbt/installer/misc.rb, line 697
def show_the_classname?
  ::RBT.show_the_classname?
end
show_the_colours_in_use() click to toggle source
#

show_the_colours_in_use

This method will show the colours in use by RBT::Installer.

#
# File lib/rbt/installer/misc.rb, line 155
def show_the_colours_in_use
  _ = RBT.file_colours
  if File.exist? _
    dataset = load_yaml(_)
    opne 'The colours in use are:'
    e
    dataset.each_pair {|name, this_colour|
      e "#{(name+':').ljust(12)} colour in use for this entry "\
        "will be `#{::Colours.send(this_colour, this_colour)}.`"
    }
    e
  else
    opnn; no_file_exists_at(_)
  end
end
show_the_everything_is_finished_message() click to toggle source
#

show_the_everything_is_finished_message

#
# File lib/rbt/installer/misc.rb, line 11863
def show_the_everything_is_finished_message
  opne "Installation of #{steelblue(install_which_program?)} "\
       "has finished."
end
show_the_flexbox( compile_this_program = compile_which_program? ) click to toggle source
#

show_the_flexbox

This will show the flexbox.

The first argument should be the dataset for the program that we are about to install/compile.

#
# File lib/rbt/installer/misc.rb, line 2664
def show_the_flexbox(
    compile_this_program = compile_which_program?
  )
  if show_the_flexbox?
    # =================================================================== #
    # Next determine whether we shall show the required dependencies
    # via the flexbox. Since as of November 2020 this is now the
    # default. At a later point we may disable it again, not sure
    # yet - but I think showing the dependencies is useful for
    # the end user, hence why it is now set to true by default.
    # =================================================================== #
    shall_we_show_the_required_dependencies_via_the_flexbox = always_show_dependencies?
    # =================================================================== #
    # Delegate into AsciiParadise::Flexbox next, if it is available:
    # =================================================================== #
    if Object.const_defined? :AsciiParadise
      e
      AsciiParadise::Flexbox.new(compile_this_program) {{
        show_required_dependencies_on: shall_we_show_the_required_dependencies_via_the_flexbox,
        use_this_dataset:              self, # sanitize_cookbook?
        use_colours:                   use_colours?
      }}.display
      e
    end
  end
end
Also aliased as: show_flexbox
show_the_flexbox?()
Alias for: show_flexbox?
show_the_infobox?()
Alias for: show_flexbox?
show_the_last_configure_option_for_this_program( this_program = compile_which_program? ) click to toggle source
#

show_the_last_configure_option_for_this_program

This method will make use of the file configure_command_database.yml. Obviously, the file has to exist in order for this to work.

Invocation example:

ry attica --show-last-configure-option-for-this-program
#
# File lib/rbt/installer/misc.rb, line 1962
def show_the_last_configure_option_for_this_program(
    this_program = compile_which_program?
  )
  _ = RBT.file_configure_database
  if File.exist? _
    dataset = YAML.load_file(_)
    if dataset.has_key? this_program
      result = dataset[this_program]
      opne "The program #{sfancy(this_program)} has "\
           "been compiled with this command:"
      e
      e "  #{sfancy(result)}" # Display it without opnn.
      e
    else
      opne "The program #{sfancy(this_program)} has not "\
           "been registered/compiled yet."
    end
  else
    opne "No file exists at `#{sfile(_)}` so we can not proceed."
    opne 'Nota bene: You should first compile some programs, before'
    opne 'making use of this method.'
  end
end
show_the_n_last_updated_programs( i = 875 ) click to toggle source
#

show_the_n_last_updated_programs

#
# File lib/rbt/installer/misc.rb, line 15277
def show_the_n_last_updated_programs(
    i = 875
  )
  require 'rbt/cookbooks/show_last_updated.rb'
  RBT::Cookbooks::ShowLastUpdated.new(display_n_programs: i)        
end
show_the_recipes_directory( i = recipes_dir? ) click to toggle source
#

show_the_recipes_directory

#
# File lib/rbt/installer/misc.rb, line 10247
def show_the_recipes_directory(
    i = recipes_dir?
  )
  e sfancy(i) # In $RBT/base/base.rb
end
show_valid_system_tags() click to toggle source
#

show_valid_system_tags

Show the allowed, and thus valid, /System/Tags entries.

To invoke this method, do:

ry --valid-sys-tags?
#
# File lib/rbt/installer/misc.rb, line 2477
def show_valid_system_tags
  _ = RBT.file_allowed_tags  # e. g. at rbt/yaml/specification/allowed_tags.yml
  if File.exist? _
    # ===================================================================== #
    # Since the file exists, we can load up the dataset of it.
    # ===================================================================== #
    dataset_containing_the_allowed_tags = YAML.load_file(_).sort
    opne 'The following '+sfancy(dataset_containing_the_allowed_tags.size.to_s)+' '+
          sdir('/System/Tags/')+' entries are valid:'
    e
    dataset_containing_the_allowed_tags.each_with_index {|tag, index| index += 1
      e mediumvioletred((index.to_s+') ').rjust(4))+
        sfancy(tag)
    }; e
  else
    opne "No file called #{sfile(_)} exists - we thus can not show"
    opne 'any allowed tags.'
  end
end
show_where_the_base_directory_can_be_found() click to toggle source
#

show_where_the_base_directory_can_be_found

To test this method, do:

ry htop base_dir?
#
# File lib/rbt/installer/misc.rb, line 2273
def show_where_the_base_directory_can_be_found
  e
  opne 'The base directory is at: '.ljust(36)+
        sfancy(temp_directory?)
  unless extract_to?.to_s.empty?
    opne "We will extract to this directory:  "\
         "#{sfancy(extract_to?.to_s)}"
  end
  e
end
show_whether_we_are_using_ccache_or_whether_we_are_not() click to toggle source
#

show_whether_we_are_using_ccache_or_whether_we_are_not

To invoke this method from the commandline, try:

ry --use-ccache?
#
# File lib/rbt/installer/misc.rb, line 12279
def show_whether_we_are_using_ccache_or_whether_we_are_not
  _ = use_ccache?
  opne "Will the RBT project make use of ccache? "\
       "#{sfancy(verbose_truth(_))}"
end
show_which_colours_will_be_used( use_this_file = RBT_COLOURS_FILE ) click to toggle source
#

show_which_colours_will_be_used

To show which colours will be used for the RBT project.

#
# File lib/rbt/installer/misc.rb, line 13517
def show_which_colours_will_be_used(
    use_this_file = RBT_COLOURS_FILE
  )
  opne 'These colours will be used:'
  e
  YAML.load_file(use_this_file).each_pair {|key, value|
    e "  #{key.ljust(12)} → #{value}"
  }; e
end
show_which_compiler_will_be_used() click to toggle source
#

show_which_compiler_will_be_used

This method will show which compiler will be used.

Commandline invocation:

rbt --compiler?
#
# File lib/rbt/installer/misc.rb, line 10200
def show_which_compiler_will_be_used
  opne "The compiler that will be used for compiling "\
       "programs is `#{slateblue(use_which_compiler?)}`."
end
show_which_files_will_be_installed( i = compile_which_program? ) click to toggle source
#

show_which_files_will_be_installed

This method will show to the user which files will be installed.

Invocation examples:

ry htop ifiles
ry htop --installed-files
ry ruby --installed-files
#
# File lib/rbt/installer/misc.rb, line 10325
def show_which_files_will_be_installed(
    i = compile_which_program?
  )
  file = static_appdir_prefix?+'yaml/registered_files.yml'
  if File.exist? file
    opne 'The following files will be installed by '\
         'the program `'+simp(i)+'`:'
    dataset = YAML.load_file(file).sort
    e; dataset.each {|entry| e "  #{entry}" }; e
  else
    opne "The file #{sfile('registered_files.yml')}"\
         " could not be found,"
    opne 'thus we can not show which files are installed.'
  end
end
simple_or_complex?() click to toggle source
#

simple_or_complex?

#
# File lib/rbt/installer/misc.rb, line 3959
def simple_or_complex?
  @internal_hash[:simple_or_complex]
end
Also aliased as: type_in_use?
skip_extracting()
Alias for: do_skip_extracting
skip_extracting?() click to toggle source
#

skip_extracting?

Query-method over as to whether we will skip extracting the archive at hand. This can usually only be done when the archive has already been extracted somehow.

#
# File lib/rbt/installer/misc.rb, line 3486
def skip_extracting?
  _ = @internal_hash[:skip_extracting]
  _ == true # This check prohibits nil and false.
end
Also aliased as: skip_extracting_the_archive?
skip_extracting_if_it_is_a_gem_file() click to toggle source
#

skip_extracting_if_it_is_a_gem_file

#
# File lib/rbt/installer/misc.rb, line 10847
def skip_extracting_if_it_is_a_gem_file
  if is_a_gem_file?
    skip_extracting
  end
end
skip_extracting_the_archive?()
Alias for: skip_extracting?
skip_postinstall_actions() click to toggle source
#

skip_postinstall_actions

Whether to skip postinstall actions or whether we don’t.

#
skip_postinstallation_step() click to toggle source
#

skip_postinstallation_step

#
sload()
Alias for: cookbook_for?
snapshot()
sort_configure_options_alphabetically() click to toggle source
#

sort_configure_options_alphabetically (sort tag)

This is simply a convenience method - we will quickly sort the Array of configure-options alphabetically here.

#
# File lib/rbt/installer/misc.rb, line 2890
def sort_configure_options_alphabetically
  _ = configure_options?
  if _.include? ' '
    splitted = _.split(' ')
    sorted = splitted.sort { |a, b|
      a.delete('-') <=> b.delete('-')
    }.reverse
    joined = sorted.join(' ')
    set_configure_options(joined)
  end
end
speed_up_the_compilation() click to toggle source
#

speed_up_the_compilation

We can speed up compilation via the -j option to “make”. Keep in mind that we have to avoid the number “0”, though, as make would complain when this is used.

See:

https://www.math-linux.com/linux/tip-of-the-day/article/speedup-gnu-make-build-and-compilation-process
#
# File lib/rbt/installer/misc.rb, line 9654
def speed_up_the_compilation
  use_n_processors = return_n_processors
  if use_n_processors <= 0
    use_n_processors = 1 # ← 1 is always the minimum. "make -j0" would lead to errors.
  end
  append_parameters_to_make(
    " -j#{use_n_processors}"
  )
end
start_to_compile()
start_to_compile_the_programs()
static_appdir_prefix?( i = compile_which_program?, use_this_program_version = :default )
Alias for: appdir_prefix?
stop_at_make_install_stage() click to toggle source
#

stop_at_make_install_stage

This method will allow us to exit once we reach the make install stage.

#
# File lib/rbt/installer/misc.rb, line 3552
def stop_at_make_install_stage
  do_not_run_make_install
  do_exit_before_make_install
end
stop_at_make_stage() click to toggle source
#

stop_at_make_stage

#
# File lib/rbt/installer/misc.rb, line 3542
def stop_at_make_stage
  do_not_run_make_install
  do_exit_before_make
end
stop_on_error( be_verbose = true ) click to toggle source
#

stop_on_error

Method call to stop if the user wanted to.

#
# File lib/rbt/installer/misc.rb, line 9230
def stop_on_error(
    be_verbose = true
  )
  if be_verbose
    stderr return_opnn, :use_print
    stderr 'We will exit now because this behaviour is enabled'
    stderr return_opnn, :use_print
    stderr "in the configuration file (the entry: #{teal('stop_on_error')})."
  end
  exit_program if stop_on_error?
end
stop_on_error?() click to toggle source
#

stop_on_error?

#
# File lib/rbt/installer/misc.rb, line 10484
def stop_on_error?
  STOP_ON_ERROR
end
store_this_as_last_libtool_file(what) click to toggle source
#

store_this_as_last_libtool_file

We will remove “‘ or unhandled argument” if it is part of the given input at hand.

#
# File lib/rbt/installer/misc.rb, line 14441
def store_this_as_last_libtool_file(what)
  # ======================================================================= #
  # First sanitize the input a little bit:
  # ======================================================================= #
  if what.include? "' or unhandled argument"
    what = what.split(/' or unhandled argument/).first
  end
  unless what.empty?
    base_dir = "#{rbt_log_directory?}libtool/"
    mkdir(base_dir) unless File.directory? base_dir
    into = "#{base_dir}last_faulty_libtool_file.md"
    if is_on_roebe?
      if File.exist?(into) and File.read(into).strip.end_with? what
        # =================================================================== #
        # In this case, we will not store the same result again.
        # =================================================================== #
        return
      end
      opne "Also storing `#{royalblue(what)}` into `#{sfile(into)}`."
    end 
    write_what_into(what, into)
  end
end
store_time_snapshot()
store_where?()
strip_binaries?() click to toggle source
#

strip_binaries?

#
# File lib/rbt/installer/misc.rb, line 1862
def strip_binaries?
  @internal_hash[:strip_binaries]
end
strip_the_binaries_of_this_program(i) click to toggle source
#

strip_the_binaries_of_this_program

Invocation example:

rbt --strip-binaries-of=htop
#
# File lib/rbt/installer/misc.rb, line 1830
def strip_the_binaries_of_this_program(i)
  [i].flatten.compact.each {|this_program|
    binaries_of_this_program = RBT.return_binaries_of_this_program(this_program)
    if binaries_of_this_program.empty?
      opne "The program #{sfancy(this_program)} has no associated binaries."
      opne 'Thus, "strip" can not be run on these binaries.'
    else
      opne 'Now running "strip" on '+
           sfancy(binaries_of_this_program.size.to_s)+
           ' programs:'
      binaries_of_this_program.each {|this_binary|
        run_the_strip_command_on_this_input(this_binary)
      }
    end
  }
end
successfully_compiled?()
suggest_cookbook_for(i) click to toggle source
#

suggest_cookbook_for

#
# File lib/rbt/installer/misc.rb, line 4432
def suggest_cookbook_for(i)
  RBT.suggest_cookbook_for(i)
end
sys_command_string?()
tags()
Alias for: tags?
tags?() click to toggle source
#

tags?

Note that this method will attempt to return an Array.

#
# File lib/rbt/installer/misc.rb, line 14014
def tags?
  cookbook_for?.tags?
end
Also aliased as: tags
the_program_has_failed_to_install() click to toggle source
#

the_program_has_failed_to_install

#
# File lib/rbt/installer/misc.rb, line 10751
def the_program_has_failed_to_install
  @internal_hash[:has_the_program_been_installed_successfully] = false
end
the_program_has_to_be_compiled?()
the_program_is_included() click to toggle source
#

the_program_is_included

#
# File lib/rbt/installer/misc.rb, line 747
def the_program_is_included
  RBT::Installer.the_program_is_included
end
this_computer_has_how_many_processors?( file_cpuinfo = FILE_CPUINFO )
this_program?()
time_snapshot()
time_the_compilation?() click to toggle source
#

time_the_compilation?

#
# File lib/rbt/installer/misc.rb, line 6498
def time_the_compilation?
  @internal_hash[:time_compilation]
end
to_bash()
to_tar_xz(i, &block) click to toggle source
#

to_tar_xz

This method can be used to create a .tar.xz archive.

#
# File lib/rbt/installer/misc.rb, line 5718
def to_tar_xz(i, &block)
  if Object.const_defined? :ToTarXz
    ToTarXz.new(i, &block)
  else
    opne "ToTarXz is not available. It can be installed via: "\
         "#{steelblue('gem install to_tar_xz')}"
  end
end
toggle_debug_value() click to toggle source
#

toggle_debug_value

#
# File lib/rbt/installer/misc.rb, line 5794
def toggle_debug_value
  what = !DEBUG
  into = DEBUG_FILE
  opne 'Now toggling the debug value used for the RBT project into '
  opne "  #{sfile(into)}"
  save_what_into(what, into)
end
toggle_the_debug_value_then_query_the_debug_value() click to toggle source
#

toggle_the_debug_value_then_query_the_debug_value

#
# File lib/rbt/installer/misc.rb, line 5786
def toggle_the_debug_value_then_query_the_debug_value
  toggle_debug_value
  query_debug_value
end
try_do_determine_which_programs_have_to_be_installed() click to toggle source
#

try_do_determine_which_programs_have_to_be_installed

#
# File lib/rbt/installer/misc.rb, line 12239
def try_do_determine_which_programs_have_to_be_installed
  first_argument = first_argument?
  if first_argument.nil? or first_argument.empty?
    opne 'Please provide the name of the program that is '\
         'to be installed.'
  else
    _ = first_argument?
    unless _.start_with?('--')
      if _.include? '@'
        # ================================================================= #
        # In this case we have input such as htop@2.2.3.
        # If this is the case then we will not do any sanitizing at all.
        # ================================================================= #
      else
        # ================================================================= #
        # Now we have to improve on the first argument given. This will try
        # to use all abbreviations, for instance.
        # ================================================================= #
        _ = action(:sanitize_this_program_name, _)
      end
      set_install_these_programs(_)
    end
  end
end
try_to_autocorrect_this_erroneous_libtool_entry(i) click to toggle source
#

try_to_autocorrect_this_erroneous_libtool_entry

This method will delegate towards class RBT::Libtool in order to fix a faulty .la file.

#
# File lib/rbt/installer/misc.rb, line 6445
def try_to_autocorrect_this_erroneous_libtool_entry(i)
  require 'rbt/libtool/class_methods/autocorrect_this_file.rb'
  opne "Now delegating towards class #{slateblue('RBT::Libtool')}"\
       " to attempt to autocorrect the problem:"
  opne "  #{sfancy(i)}"
  RBT::Libtool.autocorrect_this_file(i)
  # ======================================================================= #
  # The next subsection can re-compile again. We do so at maximum
  # 5 times.
  # ======================================================================= #
  if is_on_roebe? and try_to_autofix? and compiled_n_times? < 5
    increment_compiled_counter # Add +1 to the times we have tried to compile.
    clear_problems
    compile_this_program_again(program?)
  end
end
try_to_autocorrect_this_erroneous_libtool_entry_later(i) click to toggle source
#

try_to_autocorrect_this_erroneous_libtool_entry_later

Use this method to register an erroneous libtool entry. It will be fixed at a later time during the regular compile-cycle.

#
# File lib/rbt/installer/misc.rb, line 12762
def try_to_autocorrect_this_erroneous_libtool_entry_later(i)
  # ======================================================================= #
  # Store this faulty .la entry into a local file as well, next. This
  # was added in September 2018.
  # ======================================================================= #
  store_this_as_last_libtool_file(i)
  @internal_hash[:invalid_libtool_archive] = i # This is the libtool-entry that should go away.
  opne 'Note that you can try to correct this error via:'
  e
  e orange('  rbt --fix-libtool-from-file')
  e
end
try_to_autofix?() click to toggle source
#

try_to_autofix?

#
# File lib/rbt/installer/misc.rb, line 3818
def try_to_autofix?
  @internal_hash[:try_to_autofix]
end
Also aliased as: autofix?, use_autofixing?
try_to_automatically_setup_the_rbt_project() click to toggle source
#

try_to_automatically_setup_the_rbt_project

This method could be used to automatically try and setup the project on a default GoboLinux system.

#
# File lib/rbt/installer/misc.rb, line 4442
def try_to_automatically_setup_the_rbt_project
  if RBT.is_this_a_real_gobolinux_system?
    opne 'Found a local GoboLinux system.'
    opne 'Setting up some settings to make use of this as our host system.'
    target_file = log_dir?+'is_on_gobolinux.md'
    write_what_into('1', target_file)
    opne 'This will be stored into the file `'+sfile(target_file)+'`.'
  end
end
try_to_batch_compile_this_stack(i) click to toggle source
#

try_to_batch_compile_this_stack

This method can be used to batch-compile several applications.

Invocation examples:

rbt --batch-compile=autotools
rbt --batch-compile=vid_suite
rbt --batch-compile=mate
rbt --batch-compile=kde5_porting_aids
#
# File lib/rbt/installer/misc.rb, line 8118
def try_to_batch_compile_this_stack(i)
  # ======================================================================= #
  # === Do some sanitizing of the input first.
  # ======================================================================= #
  case i
  # ======================================================================= #
  # === rbt --batch-compile=phonon
  # ======================================================================= #
  when 'phonon',
       /^kde(_|-)?plasma/
    i = 'kde5_plasma'
  # ======================================================================= #
  # === rbt --batch-compile=kde_apps
  # ======================================================================= #
  when /^kde(_|-)?apps/
    i = 'kde5_applications'
  # ======================================================================= #
  # === rbt --batch-compile=protos
  # ======================================================================= #
  when 'protos'
    i = 'xorg_protos'
  end
  case i # case tag
  # ======================================================================= #
  # === rbt --batch-compile=kde5_porting_aids
  # ======================================================================= #
  when /^kde5?(_|-)?porting(_|-)?aids?$/i,
       /^porting(_|-)?aids?$/i
    i = return_kde5_porting_aids
  # ======================================================================= #
  # === rbt --batch-compile=mate
  # ======================================================================= #
  when 'mate',
       /^mate(-|_)?desktop$/
    i = RBT.returned_chained_programs_of_the_mate_desktop
    opne "We will compile all #{sfancy(i.size.to_s)} programs "\
         "of the mate-desktop."
    opne 'These include:'
    e; i.each {|entry|
      e '  - '+sfancy(entry)
    }; e
  else
    hash = return_chained_programs
    i = hash[i]
  end
  if i.is_a? String and i.include? ','
    i = i.split(',').map(&:strip).flatten # Now it should be an Array.
  end
  if i.is_a? Array
    i.map! {|entry| entry.delete('-') }
  end
  return i
end
try_to_compile_these_kde_programs(i) click to toggle source
#

try_to_compile_these_kde_programs

This method has to remain flexible, because the input may be “first=20” or “last=20” and so forth.

Invocation example:

ry --kde1-first=10
#
# File lib/rbt/installer/misc.rb, line 6788
def try_to_compile_these_kde_programs(i)
  if i.frozen?
    i = i.dup
  end
  if i.start_with? '--'
    i.sub!(/^--/,'')
  end
  if i.include? '-'
    these_programs = []
    splitted = i.split('-') # Like: "kde1-first=10"
    last = splitted.last
    first = splitted.first
    case first
    when 'kde1'
      these_programs = return_these_programs(:kde5_foundation)
    when 'kde2'
      these_programs = return_these_programs(:kde5_plasma)
    when 'kde3'
      these_programs = return_these_programs(:kde5_porting_aids)
    when 'kde4'
      these_programs = return_these_programs(:kde5_applications)
    end
    if last # May be like this: "first=10"
      if last.include? 'first='
        n_programs = last.sub(/first=/,'').to_i
        these_programs = these_programs[0 .. (n_programs - 1)]
      end
    end
    set_compile_these_programs(these_programs)
  end
end
try_to_determine_which_programs_have_to_be_installed?() click to toggle source
#

try_to_determine_which_programs_have_to_be_installed?

#
# File lib/rbt/installer/misc.rb, line 11117
def try_to_determine_which_programs_have_to_be_installed?
  @internal_hash[:try_to_determine_which_programs_have_to_be_installed]
end
try_to_extract_this_archive( i = cookbook_dataset_program_path?, extract_to_this_location = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true )
try_to_find_an_alias_to_this_input_unless_the_program_exists(i) click to toggle source
#

try_to_find_an_alias_to_this_input_unless_the_program_exists

This method will either return the original input unmodified; or it will modify the input in such a way that it points to a valid, registered program.

For example, the String “ph” may become “php”.

#
# File lib/rbt/installer/misc.rb, line 4044
def try_to_find_an_alias_to_this_input_unless_the_program_exists(i)
  unless cookbooks_include_this_program? i.downcase
    is_the_program_included = cookbooks_include_this_program?(
      i.downcase, :with_abbreviations
    )
    if is_the_program_included
      i = abbreviations?[i.downcase]
    end
  end
  i
end
try_to_fix_all_shebangs() click to toggle source
#

try_to_fix_all_shebangs

Use this to fix shebangs of the RBT project.

#
# File lib/rbt/installer/misc.rb, line 9129
def try_to_fix_all_shebangs
  begin
    require 'roebe/classes/shebang_fixer.rb'
    cliner {
      opne 'Trying to fix all Shebangs now:'
      entries = Dir["#{base_directory?}**/**.rb"]
      entries.each { |file|
        file = ENV['RBT_DIR'].to_s+'/'+file
        Roebe::ShebangFixer.new(file)
      }
    }
  rescue LoadError
    e 'class Roebe::ShebangFixer is not available.'
  end
end
try_to_give_additional_information_to_the_user_if_the_missing_header_is_registered() click to toggle source
#

try_to_give_additional_information_to_the_user_if_the_missing_header_is_registered

#
# File lib/rbt/installer/misc.rb, line 307
def try_to_give_additional_information_to_the_user_if_the_missing_header_is_registered
  # ======================================================================= #
  # First obtain all errors next:
  # ======================================================================= #
  _ = RBT::Errors::MapLineToASpecificError.all_programs_and_errors?.flatten
  unless _.empty?
    # ===================================================================== #
    # We must scan for errors such as:
    #
    #   ../deps/uvwasi/src/fd_table.c:9:10: fatal error: uv.h: No such file or directory
    #
    # ===================================================================== #
    selection = _.select {|line|
      line.is_a?(String) and
      line.include?('fatal error: ') and
      line.include?('No such file or directory')
    }.uniq
    regex_to_use = / ([A-Za-z]+\.h): /
    scanned = selection.first
    this_header_file_is_missing = nil
    if scanned
      scanned = scanned.scan(regex_to_use)
      this_header_file_is_missing = scanned.flatten.first
    end
    if this_header_file_is_missing
      this_header_file_is_missing.strip!
      # =================================================================== #
      # Now that we have the header file, we will check whether this
      # .h is registered in the RBT "database".
      # =================================================================== #
      if RBT.is_this_partial_header_included?(this_header_file_is_missing)
        match = RBT::Cookbooks.all_headers?.select {|key, value|
          # =============================================================== #
          # Next, we must include the leading / to distinguish between
          # "libuv.yml: - uv.h" and "freerdp.yml: - freerdp2/freerdp/codec/yuv.h"
          # Without the '/' the latter would also be included as a potential
          # match.
          # =============================================================== #
          key.include?(this_header_file_is_missing) and
          !(key =~ /\/[A-Za-z]+#{this_header_file_is_missing}$/)
         }
        if match and !match.empty?
          opne "The .h header file #{steelblue(this_header_file_is_missing)} "\
                "is currently not installed"
          opne "on this system, but it is available as part of the"
          opne "project #{lightblue(match.values.first)}."
          opne "#{tomato('You could consider compiling it via:')}"
          e
          e '  '+lightgreen("rbt #{match.values.first}")
          e
        end
      end
    end
  end
end
try_to_output_how_many_processors_this_computer_has( file_cpuinfo = FILE_CPUINFO ) click to toggle source
#

try_to_output_how_many_processors_this_computer_has

To try this method on the commandline, do:

rbt --n-cores?
#
# File lib/rbt/installer/misc.rb, line 13059
def try_to_output_how_many_processors_this_computer_has(
    file_cpuinfo = FILE_CPUINFO
  )
  if File.exist? file_cpuinfo
    opne 'This computer has '+
         lightseagreen(
           return_n_processors_of_this_computer.to_s+' processors'
         )+'.'
  else
    opne 'Can not determine the number of processors as '
    opne "there is no file at #{sfile(file_cpuinfo)}."
  end
end
try_to_recompile_upon_error?() click to toggle source
#

try_to_recompile_upon_error?

#
# File lib/rbt/installer/misc.rb, line 5228
def try_to_recompile_upon_error?
  @internal_hash[:try_to_recompile_upon_error]
end
try_to_report_the_problem()
try_to_return_a_special_compile_component(i) click to toggle source
#

try_to_return_a_special_compile_component

#
# File lib/rbt/installer/misc.rb, line 6491
def try_to_return_a_special_compile_component(i)
  RBT.try_to_return_a_special_compile_component(i)
end
try_to_show_all_binary_duplicates_of_this_program( i = compile_which_program? ) click to toggle source
#

try_to_show_all_binary_duplicates_of_this_program

Use this method to show which binary duplicates exist for the given input program.

#
# File lib/rbt/installer/misc.rb, line 1258
def try_to_show_all_binary_duplicates_of_this_program(
    i = compile_which_program?
  )
  program_name = i
  if i.nil?
    opne 'A nil value has been found in '+orange(__method__.to_s)+'.'
    pp caller()
  end
  capitalized_program_name = program_name.capitalize
  target = programs_directory?+
           capitalized_program_name+
           program_name.capitalize+'/Current/bin/*'
  opne 'Obtaining all files at `'+sdir(target)+'`.'
  all_binaries = Dir[target]
  all_binaries.select! {|entry|
    File.exist? '/usr/bin/'+File.basename(entry)
  }
  if all_binaries.empty?
    opne 'The '+sdir('/usr/bin/')+' hierarchy does not contain '\
         'any of the binaries'
    opne "belonging to #{sfancy(program_name)}."
  else
    n_duplicates = all_binaries.size.to_s
    opne "Found #{sfancy(n_duplicates)} binary duplicates."
    all_binaries.each {|file|
      e "/usr/bin/#{File.basename(file)}"
    }
  end
end
try_to_show_the_BLFS_content_of_this_program( i = compile_which_program? ) click to toggle source
#

try_to_show_the_BLFS_content_of_this_program

This method can be used to show the BLFS content of a program on the commandline.

The argument to this method should be the program that you wish to display on the commandline here.

Invocation examples:

ry gcc --paste-blfs-page
ry libffi --paste-blfs-page
ry php --paste-blfs-page
#
# File lib/rbt/installer/misc.rb, line 13734
def try_to_show_the_BLFS_content_of_this_program(
    i = compile_which_program?
  )
  # ======================================================================= #
  # First, obtain the remove URL that points to the BLFS page.
  # ======================================================================= #
  remote_url = RBT.return_blfs_page_of_this_program(i)
  into_this_html_file = nil
  if remote_url
    what = ''.dup
    opne "A remote URL has been found, at `#{sfancy(remote_url)}`."
    opne 'We will next display the content of this remote page '\
         'on the commandline.'
    remote_dataset = URI.open(remote_url).read
    opne 'The data was obtained ('+steelblue('Encoding:')+
         ' '+steelblue(remote_dataset.encoding.to_s)+')'
    store_here = "#{log_dir?}blfs_webpages/"
    mkdir(store_here) unless File.directory? store_here
    into_this_html_file = store_here+'blfs_page_for_'+i+'.html'
    opne 'It will be stored into the following file: '
    e
    e "  #{sfile(into_this_html_file)}"
    e
    write_what_into(remote_dataset, into_this_html_file)
    if into_this_html_file and File.exist? into_this_html_file
      remote_dataset = File.read(into_this_html_file, encoding: iso_encoding?)
    end
    opne 'Next, the content of that webpage will be shown as a '+
         gold('STRING')
    opne 'on the commandline, but we will remove all HTML tags.'
    begin
      sanitized_dataset = remote_dataset.gsub(/<\/?[^>]*>/, '')
      sanitized_dataset = sanitized_dataset.split(N).reject {|line|
        line.strip.empty?
      }
    rescue ArgumentError => error
      pp error
    end
    # ===================================================================== #
    # Some HTML entities may have to be re-formatted, for display on the
    # commandline. For example, '&amp;' is actually Ampersand aka '&'
    # token.
    # ===================================================================== #
    if sanitized_dataset.map! {|entry|
      if entry.include? '&amp;'
        entry.gsub!(/&amp;/,'&')
      end
      entry
    }
    end
    cliner {
      sanitized_dataset.each_with_index {|line, index| index += 1
        line = to_unicode(line)
        e steelblue(index.to_s+') ')+
          sfancy(line)
        what << "#{line}\n"
      }
    }
    if is_on_roebe?
      # =================================================================== #
      # On my home systems, we will also save this result into a
      # local file.
      # =================================================================== #
      target_directory = "#{log_dir?}blfs/"
      mkdir(target_directory) unless File.directory? target_directory
      into = "#{target_directory}#{i}.md" # ← Store it as a .md file.
      write_what_into_via_unicode(what, into)
      if into_this_html_file
        opne "This dataset has also been stored into the "\
             "file `#{sfile(into)}`."
      end
    end
    opne "The web-page itself, as a .html page, is "\
         "available at:"
    e
    e "  #{sfile(into_this_html_file)}"
    e 
  else
    opne "No BLFS entry is registered for the program `#{sfancy(i)}`."
  end
end
try_to_use_configure_options?() click to toggle source
#

try_to_use_configure_options?

Query whether we will make use of configure options.

Note that this is true by default.

#
# File lib/rbt/installer/misc.rb, line 13961
def try_to_use_configure_options?
  _ = true # ← True by default.
  unless @internal_hash[:try_to_use_configure_options].nil?
    _ = @internal_hash[:try_to_use_configure_options]
  end
  _
end
Also aliased as: use_configure_options?
try_to_use_the_file_windows_cookbook()
try_to_use_the_file_windows_cookbook?() click to toggle source
#

try_to_use_the_file_windows_cookbook?

#
# File lib/rbt/installer/misc.rb, line 10449
def try_to_use_the_file_windows_cookbook?
  config?.try_to_use_the_file_windows_cookbook
end
try_to_use_this_profile(i) click to toggle source
#

try_to_use_this_profile

The .tr() operation in the method body is valid, because we will only store the filenames in a lowercased variant, such as “gcc_minimal.md” rather than “gcc-minimal.md”.

Usage examples:

ry gcc --profile=gcc_lfs_pass1
ry gcc --profile=gcc_minimal
#
# File lib/rbt/installer/misc.rb, line 12449
def try_to_use_this_profile(i)
  i = i.to_s.dup.tr('-','_')
  if i.start_with? '-' # This is always a mistake, for the time being, so remove it.
    i[/^-+/] = ''
  elsif i.start_with? '_' # This is always a mistake, for the time being, so remove it.
    i[/^_+/] = ''
  end
  case i
  # ======================================================================= #
  # === gcc-minimal-but-lots-of-languages
  #
  # To use this entry point, try:
  #
  #   ry gcc trad --profile=gccp1
  #   ry gcc --ntrad --use-profile-minimal-gcc-but-lots-of-languages
  #
  # ======================================================================= #
  when /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages$/i,
       /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages(-|_)?enabled$/i,
       /^basic(-|_)?gcc(-|_)?but(-|_)?with(-|_)?lots(-|_)?of(-|_)?languages(-|_)?enabled$/i,
       /^-?-?basic(-|_)?gcc$/i,
       /^language(-|_)?rich$/i,
       'gccp1',
       /:?gcc1$/i,
       :basic_gcc,
       :basic_gcc_but_with_lots_of_languages_enabled
    i = 'gcc_minimal_but_lots_of_languages_enabled'
    if no_cookbook_dataset?
      set_really_compile_this_program(:gcc)
    end
  # ======================================================================= #
  # === Use the LFS "recommended" version for GLIBC
  #
  # Invocation example:
  #
  #   ry glibc ntrad --dont-symlink --use-glibc1-profile
  #
  # ======================================================================= #
  when /^default(-|_)?lfs(-|_)?glibc$/i,
       :glibc1
    i = 'default_lfs_glibc'
  # ======================================================================= #
  # === qt
  # ======================================================================= #
  when 'qt'
    if no_cookbook_dataset?
      set_really_compile_this_program(:qt)
    end
  # ======================================================================= #
  # === gcc_lfs_pass_1
  # ======================================================================= #
  when /^gcc(_|-)?lfs(_|-)?pass(_|-)?1$/
    i = 'gcc_lfs_pass1.md'
    if no_cookbook_dataset?
      set_really_compile_this_program(:gcc)
    end
  end
  i = i.dup if i.frozen?
  # ======================================================================= #
  # First we will have to try to find the proper profile:
  # ======================================================================= #
  i << '.md' unless i.end_with? '.md'
  target = "#{DIRECTORY_RBT_PROFILES}#{i}"
  if File.exist? target
    opne 'Making use of the profile found at this location:'
    e
    opne "  #{sfile(target)}"
    e
    # ===================================================================== #
    # The file exists, so we can load it.
    # ===================================================================== #
    dataset = File.readlines(target).reject {|line|
      line.strip.start_with? '#' # Get rid of comments.
    }.join(' ').delete("\n").strip.squeeze(' ')
    clear_old_configure_options
    # ===================================================================== #
    # Store it in the internal hash next:
    # ===================================================================== #
    set_configure_options_on_internal_hash(dataset)
  else
    opnn; no_file_exists_at(target)
    opne 'The current behaviour is that RBT will exit upon such an error -'
    opne 'only existing profiles may be used.'
    e
    e "The #{turquoise('available profiles')} are:"
    e
    show_the_available_profiles_for_configure_options
    e
    exit
  end
end
type_in_use?()
Alias for: simple_or_complex?
uninstall_this_appdir( i = compile_which_program? ) click to toggle source
#

uninstall_this_appdir

Invocation example:

rbt evince --uninstall-appdir
#
# File lib/rbt/installer/misc.rb, line 9773
def uninstall_this_appdir(
    i = compile_which_program?
  )
  opne "Now trying to uninstall the program called `#{teal(i)}`."
  ::RBT::RemoveProgram.new(i)
end
unpin_this_program(i) click to toggle source
#

unpin_this_program

#
# File lib/rbt/installer/misc.rb, line 1335
def unpin_this_program(i)
  ::RBT.unpin_this_program(i)
end
update_all_gems( also_automatically_install_the_updated_gem = ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM ) click to toggle source
#

update_all_gems

This method allows us to update all gems.

To invoke this method from within RBT::Installer, try this:

rbt --update-all-gems

Note that the constant ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM is used to automatically update a thus-downloaded gem.

#
# File lib/rbt/installer/misc.rb, line 11988
def update_all_gems(
    also_automatically_install_the_updated_gem = 
      ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM
  )
  require 'rbt/check_for_updates/check_for_new_release_on_rubygems.rb'
  opne 'Next '+
       royalblue('updating all local gems')+'.'
  RBT.update_all_ruby_gems
  if also_automatically_install_the_updated_gem
    array_to_use = RBT.array_these_ruby_gems_were_updated?
    update_these_rubygems(array_to_use)
  end
end
update_binaries_of_this_program(i) click to toggle source
#

update_binaries_of_this_program

Invocation examples:

rbt --update-binaries-of=poppler
rbt --update-binaries-of=htop
rbt --update-binaries-of=xinelib
#
# File lib/rbt/installer/misc.rb, line 12637
def update_binaries_of_this_program(i)
  these_binaries = RBT.infer_these_binaries_will_be_installed_by(i)
  # ======================================================================= #
  # Now that we have obtained the binaries we can add it to our
  # .yml file. Note that this will always overwrite any other existing
  # entry, so the first step is to get rid of any old entries, before
  # adding the new entries.
  # ======================================================================= #
  path   = find_this_yaml_file(i)
  string = read_file_in_default_encoding(path)
  if is_on_roebe?
    opne 'Creating a backup of the file first.'
    backup_directory_at = log_dir?+'backup/'
    mkdir(backup_directory_at) unless File.directory?(backup_directory_at)
    # ===================================================================== #
    # We will copy the old file, so that we could re-use it if we need to.
    # ===================================================================== #
    opnn; copy_file(
            path,
            backup_directory_at+File.basename(path),
            :be_verbose
          )
  end
  if string.include? ' binaries:'
    if is_on_roebe?
      # =================================================================== #
      # Notify only me on my home system in this case, as most users
      # won't need this information here really.
      # =================================================================== #
      opne "#{tomato('Removing')} the old #{slateblue('binaries:')} "\
           "entries first."
      new_string = ''.dup
      state_is_open = false
      string.split(N).each {|line|
        if line.include? ' binaries:'
          state_is_open = true
        else
          # =============================================================== #
          # Toggle it unless the next line starts with a ' - '.
          # =============================================================== #
          unless line.start_with?(' - ')
            state_is_open = false
          end
        end
        unless state_is_open
          new_string << line << N
        end
      }
      string = new_string # And re-assign it here.
    end
  end
  # ======================================================================= #
  # Ok, now we can find the proper position and simply add the binaries.
  # We will first check for a "homepage:" String; then "url2:" and
  # then "url1:". These are our "anchors".
  # ======================================================================= #
  if these_binaries.empty?
    opne 'Can not store anything because no binaries could be found.'
  else
    append_this_string = ' binaries:'+N+' - '+these_binaries.join(N+' - ')+N
    splitted = string.split(N)
    array = []
    if string.include? ' blfs: '
      splitted.each {|line|
        if line.include? ' blfs: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'configure_options: '
      splitted.each {|line|
        if line.include? ' configure_options: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url2: '
      splitted.each {|line|
        if line.include? ' url2: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    else
      opne 'Can not anchor it as no string '\
           'called '+slateblue('blfs:')+
           ':, '+slateblue('configure_options:')
      opne 'or '+slateblue('url2:')+' could be found.'
    end
    what = array.join.chomp
    # ===================================================================== #
    # Next update the old content.
    # ===================================================================== #
    into = path
    opne 'Next overwriting the file `'+sfile(into)+'`.'
    write_what_into(what, into)
    if is_on_roebe?
      # =================================================================== #
      # Also auto-updating the rbt project.
      # =================================================================== #
      opne 'Since we are on roebe we will also auto-update the '\
           'rbt project next.'
      cd RUBY_SRC_DIR_AT_HOME+'rbt/'
      require 'roebe/toplevel_methods/rinstall2.rb'
      Roebe.rinstall2
    end
  end
end
update_binary_names( also_exit = false ) click to toggle source
#

update_binary_names

To invoke this method, try:

ry htop update_binary_names
ry --update-binary-names
#
# File lib/rbt/installer/misc.rb, line 7983
def update_binary_names(
    also_exit = false
  )
  also_exit = true if also_exit == :then_exit
  require 'rbt/registered/registered_binaries.rb'
  RBT::Cookbooks::RegisteredBinaries.new
  exit_program if also_exit
end
update_dataset( i = install_this_program?, simple_or_complex = simple_or_complex? )
update_kde_apps() click to toggle source
#

update_kde_apps

#
# File lib/rbt/installer/misc.rb, line 6640
def update_kde_apps
  require 'rbt/check_for_updates/update_kde_applications.rb'
  RBT::Cookbooks::UpdateKdeApplications.new
end
update_kde_framework() click to toggle source
#

update_kde_framework

#
# File lib/rbt/installer/misc.rb, line 6697
def update_kde_framework
  unless RBT::Cookbooks.const_defined? :UpdateKdeFramework
    require 'rbt/check_for_updates/update_kde_framework.rb'
  end
  UpdateKdeFramework.new
end
update_kde_plasma() click to toggle source
#

update_kde_plasma

Use this method, as delegation, in order to update the KDE5 plasma components.

#
# File lib/rbt/installer/misc.rb, line 6687
def update_kde_plasma
  unless RBT::Cookbooks.const_defined? :UpdateKdePlasma
    require 'rbt/check_for_updates/update_kde_plasma.rb'
  end
  UpdateKdePlasma.new
end
update_kde_porting_aids() click to toggle source
#

update_kde_porting_aids

To invoke this, try:

rbt --update-kde-porting-aids
#
# File lib/rbt/installer/misc.rb, line 6828
def update_kde_porting_aids
  unless RBT::Cookbooks.const_defined? :UpdateKdePortingAids
    require 'rbt/check_for_updates/update_kde_porting_aids.rb'
  end
  RBT::Cookbooks::UpdateKdePortingAids.new
end
update_libraries_of_this_program(i) click to toggle source
#

update_libraries_of_this_program

Invocation examples:

rbt --update-libraries-of=poppler
rbt --update-libraries-of=htop
rbt --update-libraries-of=xinelib
#
# File lib/rbt/installer/misc.rb, line 3059
def update_libraries_of_this_program(i)
  these_libraries = RBT.infer_these_libraries_will_be_installed_by(i)
  # ======================================================================= #
  # Now that we have obtained the libraries we can add it to our
  # .yml file. Note that this will always overwrite any other existing
  # entry, so the first step is to get rid of any old entries, before
  # adding the new entries.
  # ======================================================================= #
  path   = find_this_yaml_file(i)
  string = read_file_in_default_encoding(path)
  if is_on_roebe?
    opne 'Creating a backup of the file first.'
    backup_directory_at = log_dir?+'backup/'
    mkdir(backup_directory_at) unless File.directory?(backup_directory_at)
    # ===================================================================== #
    # We will copy the old file, so that we could re-use it if we need to.
    # ===================================================================== #
    opnn; copy_file(
            path,
            backup_directory_at+File.basename(path),
            :be_verbose
          )
  end
  if string.include? ' libraries:'
    if is_on_roebe?
      # =================================================================== #
      # Notify only me on my home system in this case, as most users
      # won't need this information here really.
      # =================================================================== #
      opne "#{tomato('Removing')} the old #{slateblue('libraries:')} entries first."
      new_string = ''.dup
      state_is_open = false
      string.split(N).each {|line|
        if line.include? ' libraries:'
          state_is_open = true
        else
          # =============================================================== #
          # Toggle it unless the next line starts with a ' - '.
          # =============================================================== #
          unless line.start_with?(' - ')
            state_is_open = false
          end
        end
        unless state_is_open
          new_string << line << N
        end
      }
      string = new_string # And re-assign it here.
    end
  end
  # ======================================================================= #
  # Ok, now we can find the proper position and simply add the libraries.
  # We will first check for a "homepage:" String; then "url2:" and
  # then "url1:". These are our "anchors".
  # ======================================================================= #
  if these_libraries.empty?
    opne 'Can not store anything because no libraries could be found.'
  else
    append_this_string = ' libraries:'+N+' - '+these_libraries.join(N+' - ')+N
    splitted = string.split(N)
    array = []
    if string.include? ' homepage: '
      splitted.each {|line|
        if line.include? ' homepage: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url2: '
      splitted.each {|line|
        if line.include? ' url2: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    elsif string.include? 'url1: '
      splitted.each {|line|
        if line.include? ' url1: '
          array << line+N+append_this_string
        else
          array << "#{line}#{N}"
        end
      }
    else
      opne 'Can not anchor it as no string '\
           'called '+slateblue('homepage:')+
           ':, '+slateblue('url2:')
      opne 'or '+slateblue('url1:')+' could be found.'
    end
    what = array.join.chomp
    # ===================================================================== #
    # Next update the old content.
    # ===================================================================== #
    into = path
    opne 'Next overwriting the file `'+sfile(into)+'`.'
    write_what_into(what, into)
    if is_on_roebe?
      # =================================================================== #
      # Also auto-updating the rbt project.
      # =================================================================== #
      opne 'Since we are on roebe we will also auto-update the '\
           'rbt project next.'
      cd RUBY_SRC_DIR_AT_HOME+'rbt/'
      require 'roebe/toplevel_methods/rinstall2.rb'
      Roebe.rinstall2
    end
  end
end
update_library_names() click to toggle source
#

update_library_names

To invoke this method, do something like:

ry htop uln
#
# File lib/rbt/installer/misc.rb, line 9839
def update_library_names
  RBT::Cookbooks::RegisteredLibraries.new
end
update_mate_desktop_components() click to toggle source
#

update_mate_desktop_components

Update mate-desktop via this method.

Invocation example:

rbt --update-mate
#
# File lib/rbt/installer/misc.rb, line 266
def update_mate_desktop_components
  unless RBT::Cookbooks.const_defined? :CheckForMateDesktopUpdates
    require 'rbt/check_for_updates/check_for_mate_desktop_updates.rb'
  end
  RBT::Cookbooks::CheckForMateDesktopUpdates.new
end
update_program_full_name() click to toggle source
#

update_program_full_name

#
# File lib/rbt/installer/misc.rb, line 8325
def update_program_full_name
  cookbook_dataset?.update_program_full_name
end
update_program_name() click to toggle source
#

update_program_name

#
# File lib/rbt/installer/misc.rb, line 4565
def update_program_name
  cookbook_for?.update_program_name
end
update_program_path() click to toggle source
#

update_program_path

#
# File lib/rbt/installer/misc.rb, line 8898
def update_program_path
  cookbook_dataset?.update_program_path
end
Also aliased as: assemble_full_path
update_tags() click to toggle source
#

update_tags

This will simply update the tags, by tapping into the Cookbooks project.

#
# File lib/rbt/installer/misc.rb, line 5381
def update_tags
  action(:update_tags)
end
update_these_rubygems( array_to_use = RBT.array_all_rubygems ) click to toggle source
#

update_these_rubygems

This method can be used to specifically update the input-array rubygems.

By default we will feed in all registered rubygems, that is - all .gem files that are registered within the RBT project.

If you want to use another array of programs, pass in the Array of .gem files that you wish to use, into this method.

To invoke this method from the commandline, issue something like this:

rbt --install-all-rubygems
#
# File lib/rbt/installer/misc.rb, line 12031
def update_these_rubygems(
    array_to_use = RBT.array_all_rubygems
  )
  unless array_to_use.empty?
    initialize_default_values
    array_to_use.each {|this_program|
      opne "Now installing the ruby gem called #{slateblue(this_program)}:"
      RBT.install_this_rubygem(this_program)
    }
  end
end
update_this_entry(i) click to toggle source
#

update_this_entry

#
# File lib/rbt/installer/misc.rb, line 14384
def update_this_entry(i)
  require 'rbt/requires/require_class_update_entry.rb'
  RBT::UpdateEntry.new(i)
end
upload_binaries?() click to toggle source
#

upload_binaries?

#
# File lib/rbt/installer/misc.rb, line 12365
def upload_binaries?
  @internal_hash[:upload_binaries]
end
upload_to( upload_this_file = '/Depot/Temp/xchat.desktop', this_url = 'shevegen.square7.ch', optional_cd_into_this_directory = nil ) click to toggle source
#

upload_to

This can be used to upload a RBT file (or any other file) to a remote host, via FTP.

We will make use of the FTP-Paradise project for this.

Usage examples:

ry php upload /tmp/python-3.1.1.recipe
ry php upload
#
# File lib/rbt/installer/misc.rb, line 5661
def upload_to(
    upload_this_file = '/Depot/Temp/xchat.desktop',
    this_url         = 'shevegen.square7.ch',
    optional_cd_into_this_directory = nil
  )
  case this_url
  when :default
    this_url = 'shevegen.square7.ch'
  end
  this_recipe = '/home/Temp/xchat.desktop' if this_recipe.nil?
  ftp = FtpParadise::Connection.new
  ftp.login_name = 'shevegen'
  ftp.password   = ENV['MY_FTP_PASSWORD']
  ftp.url        = this_url
  if optional_cd_into_this_directory
    ftp.change_directory(optional_cd_into_this_directory)
  end
  ftp.upload(upload_this_file)
end
url1()
Alias for: url1?
url1?() click to toggle source
#

url1?

#
# File lib/rbt/installer/misc.rb, line 3736
def url1?
  cookbook_dataset?.url1?
end
Also aliased as: url?, url1, remote_url?
url?()
Alias for: url1?
use_a_build_directory( be_verbose = true )
use_a_build_directory?()
use_a_random_extracted_directory() click to toggle source
#

use_a_random_extracted_directory

Use a random name for the extracted directory. That way we can compile the same program concurrently, for whatever the reason (such as when you want to use different options for the compile-run as such).

Usage example:

ry htop --random-extracted-dir
#
# File lib/rbt/installer/misc.rb, line 7783
def use_a_random_extracted_directory
  # ======================================================================= #
  # First build up the gibberish name.
  # ======================================================================= #
  gibberish_name = ''.dup
  possibilities = ('A'..'Z').to_a+
                  ('a'..'z').to_a+
                  ('0'..'9').to_a
  10.times {
    gibberish_name << possibilities.sample
  }
  gibberish_name << '_' # And the last one is a separator-character.
  # ======================================================================= #
  # Next, create that directory - it must end with the assumed
  # extracted-directory name:
  # ======================================================================= #
  target = rbt_log_directory?+
           gibberish_name+
           program_name_and_program_version?+
           '/'
  set_extract_to_this_directory_as_specified_by_the_user(target)
  do_show_the_infobox
  cd(target)
  extract_what_to(program_path?, target) {{ append_to_the_commandline: '--strip-components=1' }}
  cd(target)
  do_these_logic_steps(
    :consider_creating_the_appdir,
    :consider_applying_a_patch,
    :check_for_sed_action,
    :run_preinstall_actions,
    :register_that_this_program_is_currently_being_compiled,
    :run_pre_configure_steps_if_requested_to_do_so,
    :decide_whether_to_build_statically,
    :decide_whether_to_invoke_autogen,
    :decide_whether_to_invoke_the_autoconf_command,
    :run_configure_like_stage,
    :check_for_common_problems_and_common_errors,
    :consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy,
    :prepare_symlink_program_instance,
    :consider_removing_empty_subdirectories,
    :store_time_snapshot,
    :consider_reporting_the_time_it_took_to_compile_this_program,
    :consider_performing_postinstallation_actions,
    :do_strip_the_compiled_binaries,
    :consider_creating_and_populating_the_pkgconfig_directory,
    :register_configure_line_into_configure_database,
    :consider_symlinking_the_pkgconfig_files,
    :consider_checking_whether_the_compiled_binaries_are_already_registered,
    :consider_running_ldconfig
  )
end
use_a_specific_program_version(i) click to toggle source
#

use_a_specific_program_version

Use this method to set to a specific program version.

Currently we will act on –version= and on –use-version=.

To check the regex, look here:

http://rubular.com/r/Wnq91wy8Nx

To test this, try any of the following:

ry gcc --version=4.5.3.tar.xz
ry gcc --use-version=4.5.3.tar.xz
ry nano --v=2.4.3
ry mesa --use-this-version=mesa-18.2.6
#
# File lib/rbt/installer/misc.rb, line 7884
def use_a_specific_program_version(i)
  i = i.dup
  # ======================================================================= #
  # We don't want file-extensions here.
  # ======================================================================= #
  i = remove_file_extension(i)
  if i.include?('=')
    splitted = i.split('=') # Get the last part, e. g. "11.3.0".
    i = splitted.last
  end
  # ======================================================================= #
  # Now we have e. g. input such as "mesa-18.2.6". Or just
  # "11.3.0". In the latter case we have to modify the input
  # a bit.
  # ======================================================================= #
  if i.include?('-') or i.include?('_')
    set_program_name(
      program_information_return_program_name(i)
    )
    set_program_short_name(
      program_information_return_program_name(i)
    )
    i = program_information_return_version(i).dup
  else
    # Else we will just use it directly as version.
  end
  # ======================================================================= #
  # In the past we used a regex, like shown here:
  #
  #   https://rubular.com/r/Z6LP2FCENzPj
  #
  # But we probably don't have to do so since January 2019.
  # ======================================================================= #
  set_program_version(i)
  opne "Setting to the specific version `#{royalblue(i)}` "\
       "now (for the program #{orange(compile_which_program?)})."
  # ======================================================================= #
  # Set it in the internal Hash - it will be synced lateron, see the
  # file sync.rb for this.
  # ======================================================================= #
  new_target_prefix = rds(
    "#{programs_directory?}/#{compile_which_program?.to_s.capitalize}/#{i}/"
  )
  # ======================================================================= #
  # We will also modify the original program_path.
  # ======================================================================= #
  set_user_prefix(
    new_target_prefix
  )
  unless archive_type?.empty?
    empty_archive_type
  end
  update_program_name
  set_program_full_name(
    cookbooks_program_name?
  )
  update_program_path
  cookbook_dataset?.rebuild_program_path
  # ======================================================================= #
  # We must also change url1 in the cookbook dataset. We will apply
  # a regex for this job - see here: https://rubular.com/r/JZKjmx413E3uXI
  # ======================================================================= #
  use_this_regex = /(\d{1,2}\.\d{1,2}\.\d{1,2})/ 
  cookbook_dataset?.set_url1(
    url1?.gsub(
      use_this_regex,
      ProgramInformation.return_version(program_name_and_program_version?)
    )
  )
end
use_autoconf?() click to toggle source
#

use_autoconf?

This method determines as to whether we will use autoconf or whether we will not. By default the value of @internal_hash is nil. If a user modifies this value from the commandline, to either true or false, then we will use that value; otherwise we will use the value defined in the cookbook-dataset for this particular program at hand.

#
# File lib/rbt/installer/misc.rb, line 7250
def use_autoconf?
  _ = cookbook_use_autoconf? # ← This is the default.
  unless @internal_hash[:use_autoconf].nil?
    _ = @internal_hash[:use_autoconf]
  end
  return _
end
use_autofixing?()
Alias for: try_to_autofix?
use_autogen?() click to toggle source
#

use_autogen?

Query method over as to whether we will use autogen.

#
# File lib/rbt/installer/misc.rb, line 6507
def use_autogen?
  _ = cookbook_dataset_use_autogen? 
  unless @internal_hash[:use_autogen].nil?
    _ = @internal_hash[:use_autogen]
  end
  _
end
use_build_dir?()
use_build_directory( be_verbose = true )
use_build_directory?() click to toggle source
#

use_build_directory?

Query-method over as to whether we will use a build directory or not.

This method will return a Boolean value (true or false).

#
# File lib/rbt/installer/build_directory.rb, line 233
def use_build_directory?
  _ = cookbook_for?.use_build_directory?
  unless @internal_hash[:use_build_directory].nil?
    _ = @internal_hash[:use_build_directory]
  end
  return _
end
use_ccache?() click to toggle source
#

use_ccache?

#
# File lib/rbt/installer/misc.rb, line 12103
def use_ccache?
  @internal_hash[:use_ccache]
end
Also aliased as: will_ccache_be_used?
use_cmake()
Alias for: do_use_cmake
use_configure_as_build_system() click to toggle source
#

use_configure_as_build_system

#
# File lib/rbt/installer/misc.rb, line 11387
def use_configure_as_build_system
  set_use_this_build_system(:configure)
end
use_configure_options?()
use_default_chroot_as_prefix( i = '/Depot/Chroot/' ) click to toggle source
#

use_default_chroot_as_prefix

Here we will use the default chroot as prefix. On my system this defaults to /Depot/Chroot/.

#
# File lib/rbt/installer/misc.rb, line 1084
def use_default_chroot_as_prefix(
    i = '/Depot/Chroot/'
  )
  set_user_prefix(i)
end
use_default_configure_command( i = 'configure' ) click to toggle source
#

use_default_configure_command

This method will hard-set the configure command.

#
# File lib/rbt/installer/misc.rb, line 8334
def use_default_configure_command(
    i = 'configure'
  )
  cookbook_dataset?.configure_command_to_use = i
end
use_glib_schema?()
use_maximum_speed_for_compilation?( use_maximum_speed_for_compilation = config?.use_maximum_speed_for_compilation ) click to toggle source
#

use_maximum_speed_for_compilation?

#
# File lib/rbt/installer/misc.rb, line 1563
def use_maximum_speed_for_compilation?(
    use_maximum_speed_for_compilation = config?.use_maximum_speed_for_compilation
  )
  result = false
  if use_maximum_speed_for_compilation
    result = use_maximum_speed_for_compilation
  end
  return result
end
use_meson_configure_options?() click to toggle source
#

use_meson_configure_options?

#
# File lib/rbt/installer/misc.rb, line 14052
def use_meson_configure_options?
  @internal_hash[:use_meson_configure_options]
end
use_non_traditional_prefix( program_name_and_program_version = program_name_and_program_version?, be_verbose = true )
use_old_configure_options( use_this_program = compile_which_program? )
use_opn?() click to toggle source
#

use_opn?

#
# File lib/rbt/installer/misc.rb, line 7224
def use_opn?
  @internal_hash and # ← Must be guarded a little here.
  @internal_hash[:use_opn] 
end
use_opt_as_prefix() click to toggle source
#

use_opt_as_prefix

#
# File lib/rbt/installer/misc.rb, line 1093
def use_opt_as_prefix
  set_user_prefix('/opt/')
end
use_porg?() click to toggle source
#

use_porg?

#
# File lib/rbt/installer/misc.rb, line 15817
def use_porg?
  @internal_hash[:use_porg]
end
Also aliased as: will_we_use_porg?
use_the_internal_sed_wrapper?() click to toggle source
#

use_the_internal_sed_wrapper?

Whether we will use the internal sed wrapper, aka class SedWrapper.

Since as of February 2018, we will not do so.

You can query this via the commandline like so:

rbt use-the-internal-sed-wrapper?
#
# File lib/rbt/installer/misc.rb, line 11436
def use_the_internal_sed_wrapper?
  @internal_hash[:use_the_internal_sed_wrapper]
end
use_this_as_cookbook( i, check_for_stringent_input = true )
use_this_as_cookbook=( i, check_for_stringent_input = true )
use_this_as_programs_dir( i = programs_directory? ) click to toggle source
#

use_this_as_programs_dir

#
# File lib/rbt/installer/misc.rb, line 4475
def use_this_as_programs_dir(
    i = programs_directory?
  )
  i = convert_end_variable # Sanitize it.
  i << '/' unless i.end_with? '/'
  opne "Assigning a new Programs directory at: #{simp(i)}"
  RBT.configuration?.programs_directory = i
  # ======================================================================= #
  # Next we also must sync towards the main dataset.
  # ======================================================================= #
  cookbook_dataset?.programs_directory = i
  cookbook_dataset?.sanitize_prefix :appdir_path
end
use_this_build_directory( i = :use_the_default_name, be_verbose = false )
use_this_build_directory=( i = :use_the_default_name, be_verbose = false )
use_this_build_directory?() click to toggle source
#

use_this_build_directory?

Ask the dataset for the proper build directory to use.

This may not always be true though.

#
# File lib/rbt/installer/build_directory.rb, line 165
def use_this_build_directory?
  _ = name_for_the_build_directory?
  # _ = _.path?.to_s if _ # Should be equal to: .path?
  # ^^^ uncommented as of April 2021.
  _
end
use_this_build_system?()
use_this_compile_version(i) click to toggle source
#

use_this_compile_version

To try this, do:

ry glib --compile-version=2.16.33_ROEBE
#
# File lib/rbt/installer/misc.rb, line 9153
def use_this_compile_version(i)
  compile_as_appdir(nil, :be_silent)
  set_program_version(i)
  set_use_this_prefix(static_appdir_prefix?)
end
use_this_environment_variable(i) click to toggle source
#

use_this_environment_variable

This method will use a specific environment variable as the new prefix. An example follows next.

To use this, try a command invocation such as:

--use-this-environment-variable=XFCE_PREFIX
--use-this-environment-variable=MATE_DESKTOP_PREFIX
#
# File lib/rbt/installer/misc.rb, line 6575
def use_this_environment_variable(i)
  i = i.to_s.dup # We only want to work on unfrozen Strings.
  if i.include? '--'
    i.gsub!(/--/,'') # Only get rid of '--', not '-'.
  end
  if i.include? '$'
    i.delete!('$')
  end
  if i.include? '='
    i = i.split('=').last
    # ======================================================================= #
    # Now we assume this to be an environment variable.
    # ======================================================================= #
    if ENV.has_key? i
      i = ENV[i]
    end
  else
    i = ENV[i] if ENV.has_key? i
  end
  # ======================================================================= #
  # Finally, set the user-prefix next.
  # ======================================================================= #
  set_user_prefix(i)
end
use_this_make_command?() click to toggle source
#

use_this_make_command?

This is most commonly just “make” - but it may also be “ninja” or another build system.

#
# File lib/rbt/installer/misc.rb, line 15455
def use_this_make_command?
  _ = 'make' # Just some default.
  _ = cookbook_dataset_make_command? if cookbook_dataset_make_command?
  unless @internal_hash[:use_this_make_command].nil?
    _ = @internal_hash[:use_this_make_command]
  end
  return _ # And return it here.
end
Also aliased as: use_which_make_command?
use_this_make_install_command?() click to toggle source
#

use_this_make_install_command?

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 525
def use_this_make_install_command?
  cookbook_dataset?.use_this_make_install_command?
end
use_this_prefix?()
Alias for: use_which_prefix?
use_this_specific_program_version?() click to toggle source
#

use_this_specific_program_version?

#
# File lib/rbt/installer/misc.rb, line 6483
def use_this_specific_program_version?
  @internal_hash[:use_this_specific_program_version]
end
use_traditional_env_path() click to toggle source
#

use_traditional_env_path

This method will “put” /usr/bin/ at the beginning of the path.

It can be invoked from the commandline via:

ry fluxbox --traditional-path
#
# File lib/rbt/installer/misc.rb, line 7210
def use_traditional_env_path
  prepend_env_path_with('/usr/bin/')
end
use_url() click to toggle source
#

use_url

Usage example:

ry ffmpeg use_url
#
# File lib/rbt/installer/misc.rb, line 3379
def use_url
  dataset?.program_name = 'USE_URL' # RBT::Cookbooks::SanitizeCookbook will handle this call.
end
use_utf8_encoding_in_env() click to toggle source
#

use_utf8_encoding_in_env

#
# File lib/rbt/installer/misc.rb, line 9761
def use_utf8_encoding_in_env
  ENV['LC_ALL'] = 'en_US.utf8'
end
use_which_build_directory?()
use_which_build_system?() click to toggle source
#

use_which_build_system?

#
# File lib/rbt/installer/misc.rb, line 563
def use_which_build_system?
  # ======================================================================= #
  # We default to the cookbook dataset when it comes to a specific
  # build system.
  # ======================================================================= #
  _ = cookbookset_dataset_use_which_build_system?
  unless @internal_hash[:use_this_build_system].nil?
    _ = @internal_hash[:use_this_build_system]
  end
  _
end
use_which_compiler?() click to toggle source
#

use_which_compiler?

#
# File lib/rbt/installer/misc.rb, line 3966
def use_which_compiler?
  config?.use_this_compiler
end
Also aliased as: compiler_to_be_used?
use_which_configure_command?() click to toggle source
#

use_which_configure_command?

#
# File lib/rbt/installer/misc.rb, line 13292
def use_which_configure_command?
  @internal_hash[:configure_command_to_use]
end
use_which_make_command?()
use_which_prefix?() click to toggle source
#

use_which_prefix?

This will properly handle the prefix in use. It is the general getter-method which should be used whenever we wish to obtain the prefix in use.

#
# File lib/rbt/installer/misc.rb, line 3498
def use_which_prefix?
  _ = @internal_hash[:prefix]
  if _.do_we_want_to_use_an_appdir_prefix?
    _.use_appdir_prefix_for_this_program(compile_which_program?)
  end
  return _
end
use_which_system_command?() click to toggle source
#

use_which_system_command?

#
# File lib/rbt/installer/misc.rb, line 2463
def use_which_system_command?
  @internal_hash[:use_which_system_command]
end
user_prefix?()
Alias for: use_which_prefix?
uses_an_appdir_prefix?( i = use_which_prefix?.to_s )
Alias for: uses_appdir_prefix?
uses_appdir_prefix?( i = use_which_prefix?.to_s ) click to toggle source
#

uses_appdir_prefix?

This method will return true if the given input is an AppDir-prefix; and false otherwise.

An AppDir prefix is one that may include the programs directory as a String - for example the string “/Programs/” or “/home/Programs/”.

#
# File lib/rbt/installer/misc.rb, line 15692
def uses_appdir_prefix?(
    i = use_which_prefix?.to_s
  )
  return false if i.nil?
  case i
  when 'ntrad', 'appdir', 'appdir_prefix'
    return true
  else
    # ===================================================================== #
    # We may also have to check on the number, e. g.
    # (i.to_s =~ /\d+/) # And "has a number".
    # ===================================================================== #
    return i.include?(programs_directory?)
  end
end
uses_meson?()
uses_the_meson_build_system?() click to toggle source
#

uses_the_meson_build_system?

This method will query whether the meson-build system is used or not.

#
# File lib/rbt/installer/meson_and_ninja_related_code.rb, line 157
def uses_the_meson_build_system?
  use_this_build_system? == 'meson'
end
validate_the_cookbook_aliases() click to toggle source
#

validate_the_cookbook_aliases

#
# File lib/rbt/installer/misc.rb, line 4060
def validate_the_cookbook_aliases
  RBT::Cookbooks::ValidateCookbookAliases.new # bl $RUBY_COOKBOOKS/lib/cookbooks/validate_cookbook_aliases.rb
end
verbose_cflags_in_use?() click to toggle source
#

verbose_cflags_in_use?

#
# File lib/rbt/installer/misc.rb, line 12110
def verbose_cflags_in_use?
  result = cflags_in_use?.to_s
  result = 'No CFLAGS in use.' if result.empty?
  return result
end
verbose_disable_ccache() click to toggle source
#

verbose_disable_ccache

#
# File lib/rbt/installer/misc.rb, line 12172
def verbose_disable_ccache
  opne 'We will not use ccache.'
  disable_ccache
end
verbose_disable_maximum_speed_for_compilation() click to toggle source
#

verbose_disable_maximum_speed_for_compilation

#
# File lib/rbt/installer/misc.rb, line 6059
def verbose_disable_maximum_speed_for_compilation
  opne 'We will not be using maximum speed.'
  configuration?.use_maximum_speed_for_compilation = false
end
verbose_disable_sed() click to toggle source
#

verbose_disable_sed

#
# File lib/rbt/installer/misc.rb, line 11450
def verbose_disable_sed
  opne "We will not use the #{powderblue('internal sed-wrapper')}."
  disable_internal_sed
end
verbose_do_extract_only() click to toggle source
#

verbose_do_extract_only

#
# File lib/rbt/installer/misc.rb, line 12119
def verbose_do_extract_only
  opne 'We will merely extract the archive, then exit.'
  @internal_hash[:extract_only] = true
end
verbose_do_not_strip_the_binaries() click to toggle source
#

verbose_do_not_strip_the_binaries

This will notify the user what we will do, and also toggle the flag that keeps track over as to whether we will run “strip” on the compiled binaries or whether we will not.

#
# File lib/rbt/installer/misc.rb, line 1880
def verbose_do_not_strip_the_binaries
  opne "We will not strip the binaries (in the "\
       "#{sdir('bin/')} subdirectory)."
  do_not_strip_binaries
end
verbose_do_not_use_special_environment_flags() click to toggle source
#

verbose_do_not_use_special_environment_flags

If we do not want to use any ENV variable, this entry point will help us.

#
# File lib/rbt/installer/misc.rb, line 5744
def verbose_do_not_use_special_environment_flags
  opne 'We will not use any '+
       teal('special environmental flag')+' (ENV).'
  path = query_path?
  ENV.clear
  set_path(path) # Must re-enable PATH environment as it was.
  @internal_hash[do_not_use_special_environment_flags] = true
end
verbose_do_not_use_special_flags() click to toggle source
#

verbose_do_not_use_special_flags

#
# File lib/rbt/installer/misc.rb, line 5569
def verbose_do_not_use_special_flags
  opne 'We will not use any special ENV flags, save for PATH.'
  clear_env_variables_but_ensure_the_path_variable_works
end
verbose_enable_glib_schema() click to toggle source
#

verbose_enable_glib_schema

#
# File lib/rbt/installer/misc.rb, line 1613
def verbose_enable_glib_schema
  opne "Enabling #{slateblue('glib-schemata')} next."
  do_use_glib_schema # Enable the glib-schemata here.
end
verbose_enable_porg() click to toggle source
#

verbose_enable_porg

#
# File lib/rbt/installer/misc.rb, line 8019
def verbose_enable_porg
  opne 'We will use the program "'+plum('porg')+
       '" for the "make install" step.'
  enable_porg
end
verbose_enable_static() click to toggle source
#

verbose_enable_static

This method can be used to enable static compilation of the program. The user can tap into this method by issuing –static on the commandline, for instance.

#
# File lib/rbt/installer/misc.rb, line 2909
def verbose_enable_static
  opne "Trying to #{steelblue('compile statically')} (no shared libraries)."
  do_enable_static_compilation
  append_static_onto_the_cflags
end
Also aliased as: enable_static_compilation
verbose_find_all_keys_starting_with(i) click to toggle source
#

verbose_find_all_keys_starting_with

This method will feedback all programs that start with a given (input) letter.

#
# File lib/rbt/installer/misc.rb, line 4420
def verbose_find_all_keys_starting_with(i)
  opne 'Finding all matches starting with the letter `'+
        sfancy(i.delete('*'))+'` now:'
  e
  find_all_keys_starting_with(i)
  e
end
verbose_generate_the_pdf_tutorial() click to toggle source
#

verbose_generate_the_pdf_tutorial

#
# File lib/rbt/installer/misc.rb, line 13405
def verbose_generate_the_pdf_tutorial
  opne 'We will generate a .pdf file next which will contain the'
  opne 'instructions on how to use the RBT project.'
  RBT.generate_pdf_tutorial
end
verbose_guess_the_build_type() click to toggle source
#

verbose_guess_the_build_type

#
# File lib/rbt/installer/misc.rb, line 4031
def verbose_guess_the_build_type
  opne 'The (guessed) build type is `'+slateblue(guess_build_type.to_s)+'`.'
end
verbose_include?( i = program? )
verbose_md5_checking() click to toggle source
#

verbose_md5_checking

Use this method to do md5-checksum checking.

#
# File lib/rbt/installer/misc.rb, line 3200
def verbose_md5_checking
  _ = program_path?
  opne sfancy('The md5sum of `')+simp(program_name?)+
       sfancy('` in `')+sfile(_)+sfancy('` is:')
  opne simp('  '+return_md5(_)) # This method is defined here.
end
verbose_purge_fhs_binaries_of_this_program(i) click to toggle source
#

verbose_purge_fhs_binaries_of_this_program

This method will notify the user as to what will be done, then delegate towards purge_fhs_binaries_of_this_program().

#
# File lib/rbt/installer/misc.rb, line 1345
def verbose_purge_fhs_binaries_of_this_program(i)
  i = [i].flatten.compact
  i.each {|entry|
    entry.downcase!
    opne "Now purging all #{mediumspringgreen('binaries')} of "\
         "the program `#{sfancy(entry)}`, at the #{sdir('/usr/bin/')}"\
         " hierarchy."
    purge_fhs_binaries_of_this_program(entry)
  }
end
verbose_purge_fhs_libraries_of_this_program(i) click to toggle source
#

verbose_purge_fhs_libraries_of_this_program

This method will notify the user as to what will be done, then delegate towards purge_fhs_libraries_of_this_program().

#
# File lib/rbt/installer/misc.rb, line 8412
def verbose_purge_fhs_libraries_of_this_program(i)
  i = RBT.return_alias_program_name_for(i)
  opne "Now purging all #{mediumspringgreen('lib/')} programs "\
       "of `#{sfancy(i)}` at the #{sdir('/usr/lib/')}"\
       " hierarchy."
  purge_fhs_libraries_of_this_program(i)
end
verbose_query_whether_this_program_can_be_compiled_statically( this_program = compile_which_program? ) click to toggle source
#

verbose_query_whether_this_program_can_be_compiled_statically

#
# File lib/rbt/installer/misc.rb, line 2950
def verbose_query_whether_this_program_can_be_compiled_statically(
    this_program = compile_which_program?
  )
  _ = cookbook_dataset?
  opne 'Can the program '+sfancy(this_program)+' be compiled statically: '+
       lightgreen(verbose_truth(_.can_be_compiled_statically?))
end
verbose_query_whether_we_are_on_a_gobolinux_like_system()
verbose_query_whether_we_will_use_the_internal_sed_wrapper( shall_we_exit = :do_not_exit ) click to toggle source
#

verbose_query_whether_we_will_use_the_internal_sed_wrapper

Query whether the internal sed-wrapper will be used.

Invocation example:

rbt --use-the-internal-sed-wrapper?
#
# File lib/rbt/installer/misc.rb, line 11409
def verbose_query_whether_we_will_use_the_internal_sed_wrapper(
    shall_we_exit = :do_not_exit
  )
  if use_the_internal_sed_wrapper?
    opne 'Yes, the internal sed-wrapper will be used ('+
         slateblue('class SedWrapper')+').'
  else
    opne 'No, the internal sed-wrapper will '+
         orange('NOT')+
         ' be used (class SedWrapper).'
  end
  case shall_we_exit
  when :and_exit, :and_then_exit
    exit_program
  end
end
verbose_report_will_we_use_autogen( i = compile_which_program? ) click to toggle source
#

verbose_report_will_we_use_autogen

This method will output, in a verbose manner, whether we will use autogen or whether we will not.

#
# File lib/rbt/installer/misc.rb, line 6521
def verbose_report_will_we_use_autogen(
    i = compile_which_program?
  )
  if cookbook_for?.nil?
    initialize_dataset_for(i)
  end
  will_we_use_autogen = use_autogen?
  if will_we_use_autogen.nil? and cookbook_dataset_use_autogen?
    will_we_use_autogen = true
  end
  if will_we_use_autogen
    opne "Yes, autogen will be used for the "\
         "program `#{sfancy(i)}`."
  else
    opne "No, autogen will #{swarn('NOT')} be used for "\
         "the program #{sfancy(i)}."
  end
end
verbose_skip_extracting() click to toggle source
#

verbose_skip_extracting

#
# File lib/rbt/installer/misc.rb, line 12144
def verbose_skip_extracting
  opne 'The archive will not be extracted.'
  skip_extracting
end
version?()
Alias for: program_version?
waf_file?( this_file = 'waf' )
Alias for: waf_file_exists?
waf_file_exists?( this_file = 'waf' ) click to toggle source
#

waf_file_exists?

This boolean query method will determine whether a waf-file exists.

The input-argument is used primarily so that we can use another target-directory for where the ‘waf’ file may exist.

The method resides in this file here because waf ultimately depends on python.

#
# File lib/rbt/installer/misc.rb, line 3672
def waf_file_exists?(
    this_file = 'waf'
  )
  File.exist? this_file
end
Also aliased as: waf_file?
warning_argument_was_not_found(i) click to toggle source
#

warning_argument_was_not_found

Call this method when an argument was not found.

#
# File lib/rbt/installer/misc.rb, line 9267
def warning_argument_was_not_found(i)
  cliner {
    opnn
    ewarn "Attention: The argument `#{sfancy(i.to_s)}#{swarn('` was not found.')}" 
    opnn
    ewarn 'Have a look at the spelling. Should this argument exist?'
    opne N
    opnn
    ewarn "If you are convinced that this may be a bug or a missing feature,"
    opnn
    ewarn "feel free to report this to the lead developer(s)."
    opne
    report_to_developers
  } # Finish here, so we display a nice coloured line still.
  stop_on_error
end
was_the_configure_run_a_success?()
we_can_not_continue(be_verbose = false) click to toggle source
#

we_can_not_continue

#
# File lib/rbt/installer/misc.rb, line 203
def we_can_not_continue(be_verbose = false)
  case be_verbose
  when :be_quiet
    be_verbose = false
  end
  if be_verbose
    opne 'The RBT scripts can not continue.'
  end
  @internal_hash[:can_we_continue] = false
end
Also aliased as: can_not_continue, do_not_continue
we_can_not_continue_and_we_will_not_run_make_install() click to toggle source
#

we_can_not_continue_and_we_will_not_run_make_install

#
# File lib/rbt/installer/misc.rb, line 6051
def we_can_not_continue_and_we_will_not_run_make_install
  we_can_not_continue
  do_not_run_make_install
end
we_tried_to_compile_this_program_n_times?() click to toggle source
#

we_tried_to_compile_this_program_n_times

#
# File lib/rbt/installer/misc.rb, line 10463
def we_tried_to_compile_this_program_n_times?
  @internal_hash[:we_tried_to_compile_this_program_n_times]
end
Also aliased as: compiled_n_times?
we_will_not_try_to_determine_which_programs_have_to_be_installed() click to toggle source
#

we_will_not_try_to_determine_which_programs_have_to_be_installed

#
# File lib/rbt/installer/misc.rb, line 12267
def we_will_not_try_to_determine_which_programs_have_to_be_installed
  @internal_hash[:try_to_determine_which_programs_have_to_be_installed] = false
end
wget(i)
which_program?()
will_be_extracted_towards?() click to toggle source
#

will_be_extracted_towards?

This method will tell us the full path of the extracted directory for the program at hand.

A trailing ‘/’ is required for the result of this method.

Returns: a String.

#
# File lib/rbt/installer/misc.rb, line 15577
def will_be_extracted_towards?
  "#{log_directory?}#{program_name_and_program_version?}/"
end
will_ccache_be_used?()
Alias for: use_ccache?
will_gcc_be_used_for_compilation?() click to toggle source
#

will_gcc_be_used_for_compilation?

#
# File lib/rbt/installer/misc.rb, line 10456
def will_gcc_be_used_for_compilation?
  use_which_compiler? == 'gcc'
end
will_we_make_use_of_abbreviations?() click to toggle source
#

will_we_make_use_of_abbreviations?

This will tap into the main (toplevel) configuration setting.

#
# File lib/rbt/installer/misc.rb, line 2578
def will_we_make_use_of_abbreviations?
  ::RBT.configuration?.use_abbreviations
end
will_we_use_porg?()
Alias for: use_porg?
yaml_dataset?()
Alias for: cookbook_for?
zero_this_global_flag_file(i) click to toggle source
#

zero_this_global_flag_file

#
# File lib/rbt/installer/misc.rb, line 9846
def zero_this_global_flag_file(i)
  opne "Now resetting all global flags to "\
       "zero again. (File: #{sfile(i)})"
  remove_file(i)
  touch_file(i)
end

Private Instance Methods

run_premake_make_then_make_install() click to toggle source
#

run_premake_make_then_make_install

Issue “premake commands”, then “make” and then “make install” commands.

#
# File lib/rbt/installer/handle_installing_and_compiling_programs.rb, line 685
def run_premake_make_then_make_install
  if run_make?
    run_premake_commands
    run_make_then_make_install
  end
end