class OBSOLETE

Public Instance Methods

batch_compile_the_programs()
batch_compile_these_programs()
compile_every_program()
compile_this=( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
compile_this_program( this_program )
compile_this_program?()
compile_this_program_again()
compile_which_program?()
consider_creating_the_build_directory()
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/actions/individual_actions/installer/aggregate.rb, line 857
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_removing_extracted_archive( where = :build_anew )
consider_removing_the_extracted_archive( where = :build_anew )
consider_removing_the_extracted_directory( where = :build_anew )
considering_running_make_command_via_system()
Alias for: run_make
custom_system( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
determine_which_programs_to_compile( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
do_compile_these_programs()
do_compile_this_program( this_program )
do_initiate_batch_compilation()
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::Action::Installer.

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 2007
def do_install_the_programs
  do_install_these_programs
end
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::Action::Installer.

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

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 14
def do_install_this_program(
    this_program
  )
  return unless can_we_continue? # This should come first.
  # ======================================================================= #
  # 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.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)
    notify_the_user_that_this_program_is_NOT_registered_as_part_of_the_RBT_project(this_program)
    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.
    # ===================================================================== #
    # First handle '@' if it was given as input:
    # ===================================================================== #
    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 "#{rev}No archive exists at `#{sfile(program_path)}#{rev}`."
      opne "#{rev}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.'
      if is_on_roebe?
        opne crimson("As we are on a roebe-system we will also show the caller next:")
        e
        pp caller()
        e
      end
      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 "#{rev}The current working directory is now #{sdir(return_pwd)}#{rev}."
      # =================================================================== #
      # === (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
      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
      # ===================================================================== #
      # 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 "#{rev}No archive exists at #{sfile(program_path)}#{rev}."
    end
    # ===================================================================== #
    # consider_changing_the_tab_title :clear
    # ===================================================================== #
    action(:rename_konsole_tab, :clear) if rename_the_terminal?
  else
    opne "#{steelblue(this_program)} #{rev}is not included in the RBT database."
  end
end
do_install_via_meson()
Alias for: run_the_meson_steps
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/actions/individual_actions/installer/aggregate.rb, line 1644
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 "#{rev}No file called #{sfile(this_file)} #{rev}could be "\
           "found in the directory"
      opne "#{sdir(return_pwd)}#{rev} - thus, the build tool called"
      opne "#{orange('ninja')} #{rev}can not be run."
      # =================================================================== #
      # Register this error as well:
      # =================================================================== #
      error_is :could_not_find_file_called_build_ninja
    end
  end
end
Also aliased as: run_ninja, ninja_install, ninjait
do_run_ninja_install() click to toggle source
#

do_run_ninja_install

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 1470
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
find_the_corresponding_install_method_and_proceed_from_there() click to toggle source
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 1218
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
  # ======================================================================= #
  # === 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')
  # ======================================================================= #
  # === :perl
  # ======================================================================= #
  when :perl
    run_the_perl_steps
  # ======================================================================= #
  # === :ruby
  # ======================================================================= #
  when :ruby
    colourized_and_padded_esystem 'ruby setup.rb'
  # ======================================================================= #
  # === :meson
  # ======================================================================= #
  when :meson
    run_the_meson_steps
  # ======================================================================= #
  # === waf
  # ======================================================================= #
  when :waf
    run_waf_based_installation
  # ======================================================================= #
  # === :cmake
  # ======================================================================= #
  when :cmake
    run_the_cmake_steps
  # ======================================================================= #
  # === :python
  # ======================================================================= #
  when :python
    run_the_python_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::Action::SoftwareManager.
  # ======================================================================= #
  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.
    # ======================================================================= #
    _ = action(:infer_build_system)
    opne "#{gold('Guessing the build-type next ...')} #{rev}the build "\
         "type is: #{slateblue(_.to_s)}" # In the past we also displayed a leading ':' here.
    if _.nil?
      _ = :inferring_the_build_system_did_not_work
    else
      _ = _.to_sym
    end
    # ======================================================================= #
    # The next clause was added in June 2023 - it will force me to add
    # all missing build-types to the .yml file at hand.
    # ======================================================================= #
    if is_on_roebe?
      opne tomato('Since as of June 2023 the build-system has to be determined')
      opne tomato('Please modify the .yml file at hand for the ')+
           tomato('program ')+sfancy(program_name?)+tomato('.')
      opne tomato('Exiting now.')
      exit
    end
    case _
    # ======================================================================= #
    # === :meson
    # ======================================================================= #
    when :meson
      run_the_meson_steps
    # ======================================================================= #
    # === :python
    # ======================================================================= #
    when :python
      run_the_python_steps
    # ======================================================================= #
    # === :ruby
    # ======================================================================= #
    when :ruby
      colourized_and_padded_esystem 'ruby setup.rb'
    # ======================================================================= #
    # === :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
      elsif configure_command_to_use and !configure_command_to_use.empty?
        esystem(configure_command_to_use)
      else
        opne tomato('Not yet implemented or understood: ')+
             lightgreen(
               _.to_s
             )+' [Directory: '+sdir(return_pwd)+']'
      end
    end
  else
    opne "#{steelblue('Not implemented:')} #{_}"
  end
end
Also aliased as: run_configure_like_stage
first_arg()
handle_this_program?()
handle_which_program?()
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/actions/individual_actions/installer/aggregate.rb, line 1534
def install_this_program?
  @internal_hash[:install_this_program]
end
install_which_program?()
internal_program_name?()
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/actions/individual_actions/installer/aggregate.rb, line 1864
def invoke_extracter(
    i                                   = program_path?,
    extract_to_this_directory           = extract_where_to?,
    keep_the_old_directory_if_it_exists = false
  )
  
  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
  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::Action::SoftwareManager 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
  end
end
name?()
name_of_program?()
ninja_install()
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/actions/individual_actions/installer/aggregate.rb, line 1558
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 rev+'The '+crimson('above error message')+rev+
         ' 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
program?()
program_name?()
program_to_compile?()
real_program_name?()
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/actions/individual_actions/installer/aggregate.rb, line 603
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.
    orev sfancy('We run in simulation mode right now. Normally '\
         'the directory ')
    orev 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?
    orev 'Can not remove '+sdir(log_dir?)+rev+'.'
  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
      orev "Removing the extracted archive at `#{sdir(where)}`."
      unless File.directory? where
        _ = 'However had, no such directory exists. Perhaps it was'
        orev _
        orev '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_the_extracted_archive( where = :build_anew )
reset() click to toggle source
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 582
def reset
  populate_the_internal_hash_with_default_values
  populate_the_internal_hash_with_values_specific_to_this_class
  infer_the_namespace # Must come after the populate-calls above.
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/actions/individual_actions/installer/aggregate.rb, line 1421
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
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 1973
def run
  set_work_on_this_program(first?)
  menu # Delegate into the menu here.
  if try_to_determine_which_programs_have_to_be_installed?
    # ===================================================================== #
    # This should come after we called menu() already.
    # ===================================================================== #
    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_configure( use_this_configure_command = use_this_build_system? )
run_configure_like_stage()
run_configure_via_system( use_this_configure_command = use_this_build_system? )
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/actions/individual_actions/installer/aggregate.rb, line 1748
def run_make
  if exit_before_make?
    opne "#{rev}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 rev+'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 "#{rev}We are running a simulation, hence the following command"
      opne "#{rev}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 rev+'Next trying to create a package for `'+
             royalblue('slackware')+rev+'`.'
        # 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_command()
Alias for: run_make
run_ninja()
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/actions/individual_actions/installer/aggregate.rb, line 678
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.
      # =================================================================== #
      orev "The program \"#{sfancy('make')}\" #{rev}is "\
           "#{swarn('not available')}#{rev}, at the least not as  "\
           "part of the #{steelblue('$PATH')} #{rev}variable."
      orev "RBT::Action::SoftwareManager 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_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/actions/individual_actions/installer/aggregate.rb, line 901
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 cookbook_dataset?
    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/actions/individual_actions/installer/aggregate.rb, line 1632
def run_the_gnu_configure_steps
  if shall_we_run_configure?
    run_the_configure_command
  end
  run_make_then_make_install
end
run_the_meson_steps() click to toggle source
#

run_the_meson_steps (meson tag)

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 1480
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.
      # ===================================================================== #
      orev "Making use of the #{royalblue('meson_configure_options')}#{rev}, "\
           "#{rev}as specified by the #{slateblue('.yml')} #{rev}file."
      orev "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_this_command( i, use_colours = use_colours?, use_padding = true, show_the_command_used = true, &block )
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 )
search_for_this_program?()
set_array_compile_these_programs( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
set_compile_these_programs( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
set_compile_this_program( i, &block )
set_handle_this_program( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
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/actions/individual_actions/installer/aggregate.rb, line 1064
def set_install_these_programs(
    i                                  = first_argument?,
    consider_replacing_the_given_input = :honour_user_configuration_setting
  )
  if i.nil? or i.empty?
    i = DEFAULT_PROGRAM
  end
  i = i.dup if i and i.is_a?(String) and i.frozen?
  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)
        _ = action(:MapThisInputToThatRegisteredProgram, 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 "#{rev}Replacing #{steelblue(entry)}"+
               rev+' with '+mediumslateblue(new_entry)+rev+
               ", as input. It is #{a_or_an} #{rev}"+
               mediumorchid(type.tr('_',' '))+"#{rev}."
          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::Action::SoftwareManager.

#
# File lib/rbt/actions/individual_actions/installer/aggregate.rb, line 1677
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::Action::SoftwareManager 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 "#{rev}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_program_name( i, &block )
set_work_on_this_program( i = first_argument?, consider_replacing_the_given_input = :honour_user_configuration_setting )
start_to_compile()
start_to_compile_the_programs()
this_program?()
which_program?()