class RBT::Action::SoftwareManager
Public Class Methods
#¶ ↑
RBT::Action::SoftwareManager.display_standard_help_options
¶ ↑
Set the standard help-options only here.
You can view them by issuing this command:
rbt --help
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12188 def self.display_standard_help_options( exit_now = :default ) case exit_now when :default exit_now = false end pad_to_most_right = ' ' * 40 lpad = ' ' middle_pad = 44 # RBT::Action::SoftwareManager.output_namespace? # ← Disabled as of 03.10.2020. e efancy lpad+'The following help subsection describes some of ' efancy lpad+'the available help options for the' efancy lpad+::RBT.steelblue('Compile-Section')+ sfancy(' of the RBT scripts.') e efancy lpad+'The '+ RBT.mediumslateblue('basic ')+ sfancy('command to ')+ RBT.steelblue('compile a program')+ sfancy(' is:') e e e lpad+RBT.gold(' rbt [NAME_OF_THE_PROGRAM]') e lpad+RBT.gold(' rbt python')+RBT.orange(' # ← example input; here we '\ 'would try to compile python') e lpad+RBT.gold(' rbt htop')+RBT.orange(' # ← here, RBT would try to '\ 'compile htop') e lpad+RBT.gold(' rbt php')+RBT.orange(' # ← here, RBT would try to '\ 'compile php') e e efancy lpad+lpad+'-b --build-dir=[] Set a specific build directory' efancy lpad+lpad+'-h --help Display this help subsection here' efancy lpad+' --permanently_extract_to=[] permanently extract the '\ 'archives to another directory' efancy lpad+lpad+'-e --extract_to=[] extract '\ 'the archives to another directory' efancy ' (--homedir= is an alias to this setting)' efancy lpad+lpad+'-k --keep_extracted Keep '\ 'the sourceball extracted (normally the extracted' efancy ' archive is '\ 'removed after compilation)' efancy lpad+' --batch-compile= Batch-compile some '\ 'programs such as batch compiling' e e (' ' * middle_pad)+ RBT.royalblue(" rbt --batch-compile=mate\n") efancy lpad+ ' --dont-use-configure-options Do not use any configure options '\ 'from the .yml file' efancy lpad+lpad+'-n --no-harm Run in simulation mode' efancy lpad+lpad+'-nc --nocolour / --nocolor Disable colours' efancy lpad+ ' --use-old-configure-options Re-use old configure '\ 'options, e. g. from GCC' efancy lpad+lpad+'-sl --sleep<number> Sleep for <number> seconds before continuing' efancy lpad+ ' --permanently-disable-ccache Permanently disable ccache, '\ 'via the commandline' efancy lpad+ ' --disable-ccache Do not use ccache for the current run' efancy lpad+lpad+'-S --no-symlink Do not symlink the AppDir that was compiled' efancy lpad+lpad+'-P --no-postinstall Do not run the postinstall instructions' efancy lpad+ ' --preinstall="sh bootstrap" Run the specified pre-install action' efancy lpad+ ' --use-gobolinux-symlinkprogram Use the GoboLinux SymlinkProgram rather than ' efancy ' '\ 'class RBT::SymlinkProgram, for symlinking' efancy lpad+ ' --use-meson Use the meson build system' efancy lpad+lpad+'-no --no-extract Do not extract tarball '\ 'again (skip extracting the source archive)' efancy lpad+lpad+'-cmake --cmake Use cmake rather than make' efancy lpad+lpad+'-clang --clang Use clang '\ 'rather than the default GCC to compile C/C++ programs' efancy lpad+ ' --create-yaml-file-for=subversion Create a .yml file '\ 'for this program, holding the relevant ' efancy ' '\ 'information for compiling the program from source' efancy ' (Note that this requires the clang '\ 'compiler of LLVM being' efancy ' available, of course.)' efancy lpad+ ' --create-log-directory Create the log directory.' efancy lpad+ ' --paste-blfs-page Fetch and paste remote '\ 'data from the BLFS page of the given program' efancy lpad+lpad+'-slack --slack-desc Create a Slackware slack-desc file' efancy lpad+ ' --purge-traditional-binaries-of=gnupg Purge binaries of this program' efancy lpad+ ' --valid-sys-tags? Show which '+ sdir('/System/Tag')+ sfancy(' entries are valid') efancy lpad+ ' --symlink-headers Symlink all .h files into '\ 'the '+sdir('/usr/include/')+ sfancy(' hierarchy') efancy lpad+ ' --symlink-all-upcased-programs-to-downcased-variants Create '\ 'symlinks' efancy (' ' * (middle_pad-2))+' '\ 'for all upcased program entries under '+ sdir(RBT.programs_dir?)+'.' efancy lpad+ ' --homedir Compile the program into your '\ 'HOME directory such as '+ sdir('/home/name/')+sfancy('.') efancy lpad+lpad+'-ver --verbose Be verbose in the output' efancy lpad+ ' --do-not-use-special-flags Do not use ENV (environmental '\ 'flags) at all.' efancy lpad+ " --update-entry Update a program, such "\ "as via\n" e RBT.royalblue( (' ' * middle_pad)+ " rbt --update-entry "\ "http://ftp.gnu.org/gnu/grep/grep-3.5.tar.xz\n" ) efancy lpad+ ' --edit-file=htop Open the '+ ::Colours.sfile('htop.yml')+ sfancy(' cookbook-file, in order to inspect '\ 'and/or edit it;') efancy ' the '+simp('$EDITOR')+ sfancy(' variable can be used to specify which editor is to be used.') efancy lpad+ " --remove-la-files Remove "\ ".la files of this program (requires the --prefix to include "\ "#{sdir(::RBT.programs_dir?)})" efancy lpad+ ' --suggest-cookbook-for=glib Show a possible '\ 'content of glib.yml file' efancy lpad+lpad+ "-v --version Use a "\ "specific version, such as, for instance:\n" efancy (' ' * middle_pad)+ RBT.royalblue(' rbt bluefish --version=1.0.7') efancy ' '\ 'ignore errors via '+simp('--ignore-errors') e # ======================================================================= # # === Documented help options for the GUI section # ======================================================================= # efancy lpad+gold('[GUI section]') e efancy lpad+ ' --libui start the libui-wrapper for RBT (in '\ 'regards to compiling programs from source)' efancy lpad+ ' --gtk start the ruby-gtk3 interface '\ '(tabbed notebook interface)' if RBT.is_on_gobolinux? # ===================================================================== # # If we are on gobolinux then we also mention how to create # gobolinux-recipes. # ===================================================================== # efancy ' --gobolinux-recipe '\ 'Create a GoboLinux recipe. (The "-" can be omitted.' efancy pad_to_most_right+' A usage example follows next.)' efancy pad_to_most_right+' Usage example: '+ simp('rbt zenity --gobolinux-recipe') end e efancy lpad+'Some shorter commandline options exist for '\ 'toplevel methods:' e efancy lpad+' rbt --download htop # This will download htop into '\ 'the local directory' efancy lpad+' rbt --extract htop # This will extract htop; or '\ 'download and extract it,' efancy lpad+'# should it not exist locally'.rjust(51) e # Need a spacer before we display the next part. e eimp lpad+'Also note that these options can be chained together. '\ 'Abbreviations ' eimp lpad+'can be used as well. The options '+ sfancy('noext nocol')+ simp(' will all work fine, ') eimp lpad+ simp('being equal to ')+ sfancy('--no-extract --nocolor')+simp('.') e eimp lpad+'Abbreviations allow us to have to type less, but '\ 'the longer variants ' eimp lpad+ 'als work, in the event that you wish '\ 'to be more explicit.' e exit if exit_now end
#¶ ↑
RBT::Action::SoftwareManager.is_this_program_included?
¶ ↑
ry --included?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14757 def self.is_this_program_included?( i, be_verbose = :default ) case be_verbose # ======================================================================= # # === :include_abbreviations_and_be_quiet # ======================================================================= # when :include_abbreviations_and_be_quiet be_verbose = false # ======================================================================= # # === :default # ======================================================================= # when :default be_verbose = true # ======================================================================= # # === :be_quiet # ======================================================================= # when :be_quiet, :silent be_verbose = false end if i.is_a? Array i.each {|entry| is_this_program_included?(entry, be_verbose) } else i = i.to_s.dup i.delete!('-') i.delete!('_') # ===================================================================== # # Note that RBT.does_include? tries harder to find a program # than does RBT.is_this_program_included?. # ===================================================================== # is_included = RBT.does_include?(i) if is_included if be_verbose RBT::Action::SoftwareManager.opne "The program `#{RBT.simp(i)}` is included." end @is_included = true else if be_verbose RBT::Action::SoftwareManager.opne "The program `#{RBT.simp(i)}` is "\ "#{RBT.swarn('not')} included." end @is_included = false end end end
#¶ ↑
initialize¶ ↑
The first argument to this method will contain the commandline arguments for class RBT::Action::SoftwareManager
. These are usually the name of the program (or programs) that the uses wishes to compile / install.
So, for instance, “htop” could be passed as the first argument to this method. You can also pass in an Array here, and this class will then attempt to batch-compile these programs.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/initialize.rb, line 27 def initialize( commandline_arguments = ARGV, # ← This should usually be an Array of programs that should be installed. run_already = true, &block ) register_sigint reset if commandline_arguments.is_a?(Array) and commandline_arguments[1] and commandline_arguments[1].is_a?(Symbol) run_already = commandline_arguments[1] # Handle :dont_run early. end if commandline_arguments.is_a?(Array) last = commandline_arguments.last case last # ===================================================================== # # === :do_not_run_yet # ===================================================================== # when :do_not_run_yet run_already = false end end # ======================================================================= # # === Handle Symbols given to the commandline arguments next # # Handle symbols given as first argument next. This should come before # we call set_commandline_arguments(). # ======================================================================= # case commandline_arguments # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet, :do_not_yet_run, :dont_run_yet run_already = false commandline_arguments = [] end # ======================================================================= # # Finally set the commandline arguments here: # ======================================================================= # set_commandline_arguments( commandline_arguments ) # ======================================================================= # # === Handle blocks next # ======================================================================= # if block_given? yielded = yield # ===================================================================== # # Handle Symbols first: # ===================================================================== # if yielded.is_a? Symbol case yielded # =================================================================== # # === :do_not_run_yet # =================================================================== # when :do_not_run_yet, :do_not_run, :dont_run_yet run_already = false # =================================================================== # # === :do_not_check_whether_the_program_exists # =================================================================== # when :do_not_check_whether_the_program_exists do_not_check_whether_the_program_exists # ← This method exists, so use it too. # =================================================================== # # === :use_root_prefix # =================================================================== # when :use_root_prefix do_use_root_prefix end # ===================================================================== # # === Handle Hashes next # ===================================================================== # elsif yielded.is_a? Hash # =================================================================== # # === :run_already # # This entry point should be checked last. # =================================================================== # if yielded.has_key? :run_already case yielded[:run_already] when :do_not_run_yet run_already = false end end # =================================================================== # # === :use_this_prefix # =================================================================== # if yielded.has_key? :use_this_prefix set_use_this_prefix(yielded[:use_this_prefix]) end # =================================================================== # # === :shall_we_check_whether_the_program_exists # =================================================================== # if yielded.has_key? :shall_we_check_whether_the_program_exists case yielded[:shall_we_check_whether_the_program_exists] # ================================================================= # # === nope # # In this case we will not check whether the program exists. # ================================================================= # when :nope, false do_not_check_whether_the_program_exists end end # =================================================================== # # === :prefix # # Handle prefix-related keys first. # =================================================================== # if yielded.has_key? :prefix set_user_prefix(yielded.delete(:prefix)) # ← Set the new prefix via a method call. # =================================================================== # # === :use_this_prefix # =================================================================== # elsif yielded.has_key? :use_this_prefix set_user_prefix(yielded.delete(:use_this_prefix)) # =================================================================== # # === :use_this_as_prefix # =================================================================== # elsif yielded.has_key? :use_this_as_prefix set_user_prefix(yielded.delete(:use_this_as_prefix)) end # =================================================================== # # === :symlink_after_compilation_has_finished # =================================================================== # if yielded.has_key? :symlink_after_compilation_has_finished value = yielded.delete(:symlink_after_compilation_has_finished) if value == false set_do_not_symlink(:be_verbose) # Disable symlinking after compilation. end end # =================================================================== # # Add commandline_arguments if the key is :commandline_arguments # # Such a Hash may have a key like this: # # {:commandline_arguments=>["--dont-use-colours", "ntrad"]} # =================================================================== # if yielded.has_key? :commandline_arguments append_to_the_commandline( yielded.delete(:commandline_arguments) ) end else append_to_the_commandline(yielded) end end # ======================================================================= # # Handle special symbols passed to run_already next: # ======================================================================= # case run_already # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet, :dont_run_yet, :do_not_run_already run_already = false end consider_entering_the_log_directory # This should come before we handle blocks. # ======================================================================= # # Next store the first snapshot, which is the start-mark. This should # come after we handled any block given to this method. # ======================================================================= # time_snapshot run if run_already end
#¶ ↑
RBT::Action::SoftwareManager.opnn
¶ ↑
Use this method when you wish to output the RBT::Action::SoftwareManager
namespace to the user.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14703 def self.opnn( i = { namespace: RBT.namespace?, use_colours: RBT.use_colours? } ) if i.is_a? Hash # ===================================================================== # # === :use_colours # ===================================================================== # unless i.has_key? :use_colours i.update(use_colours: RBT.use_colours?) end end if RBT.show_the_classname? ::RBT.opnn(i) # Delegate to the module_method here. # else # else we will not use Opn at all. end end
Public Instance Methods
#¶ ↑
action_install_only_headers
¶ ↑
This method handles the actual copying of all headers. It must be called at the proper time.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4384 def action_install_only_headers( from_this_directory = "#{extract_to_this_directory?}"\ "#{program_name_and_program_version?}/", be_verbose = be_verbose? ) from_this_directory = from_this_directory.to_s.dup from_this_directory << '/' unless from_this_directory.end_with? '/' _ = ''.dup all_headers = Dir["#{from_this_directory}*.h"] _ = all_headers.join(',')[0..3] unless all_headers.empty? orev "Now copying all found #{steelblue(_.size.to_s)} "\ "#{rev}headers from `#{sdir(from_this_directory)}#{rev}`"\ " to #{sdir('/usr/include/')}#{rev}:" copy_recursively(all_headers, '/usr/include/', be_verbose) if be_verbose orev "The following #{royalblue(_.size.to_s)} #{rev}headers were copied:" e all_headers.each {|entry| e " #{steelblue(entry)} "\ "#{tomato('→')} "\ "#{lightgreen('/usr/include/'+File.basename(entry))} " } e end do_not_continue_after_configure_step do_not_continue_after_make_step be_silent end
#¶ ↑
add_package_user
¶ ↑
This allows you to add a package-user.
Usage example:
ry htop add_package_user
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1137 def add_package_user( name = compile_which_program? ) _ = '/Users/Packages/' cmd_to_run = 'useradd -m -d '+_+name.capitalize+' '+name create_directory _ unless File.directory? _ orev "Adding a new user called `#{simp(name)}#{rev}`:" custom_system cmd_to_run end
#¶ ↑
all_configure_options?¶ ↑
Use this method to show all configure options for a given program.
This means all options available through “./configure –help”.
Invocation example:
ry htop allconfigureoptions?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2345 def all_configure_options? ensure_that_the_main_dataset_exists #_ = extract_to? # TEMP_DIR+File.basename(compile_this_program?) _ = ::RBT.temp_dir?+ program_name_and_program_version? # ======================================================================= # # The target may be empty though. Rescue this case. # ======================================================================= # _ = rbt_log_directory? if _.nil? or _.empty? orev 'Will extract to '+sdir(_)+'. In the event that you need '\ 'to know ' orev 'where the extracted archive resides.' orev "All configure options for "\ "#{simp(compile_this_program?)} will be shown next, "\ "before exiting." set_extract_to(_) consider_extracting_this_program( program_path? ) _ = rbt_log_directory?+program_name_and_version? orev "We will next cd (change directory) into `#{sdir(_)}#{rev}`." cd _, :be_quiet # Now we should be in the proper directory. e RBT::BeautifyConfigureHelpOutput.new # Delegate to this class next. e exit_program end
#¶ ↑
an_error_has_occurred?¶ ↑
Query-method over as to whether an error has occurred.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 620 def an_error_has_occurred? result = @internal_hash[:an_error_has_occurred] ignore_errors = ignore_errors? case ignore_errors # ======================================================================= # # === :infer # ======================================================================= # when :infer ignore_errors = cookbook_dataset_ignore_errors? end result = false if ignore_errors result = false if result.is_a?(Array) and result.empty? return result end
#¶ ↑
append_disable_static_to_the_configure_options
¶ ↑
This method is somewhat similar to the method called append_enable_shared_to_the_configure_options
in that it will also modify the configure options; but it will add “–disable-static” to the configure options.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2902 def append_disable_static_to_the_configure_options append_this_to_the_configure_options(:disable_static) end
#¶ ↑
append_make_options
¶ ↑
This will append parameters issued to “make”. It will also start with a ‘ ’, always.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3410 def append_make_options(i) if i make_object?.append_make_options(i) append_this = i.to_s.dup if parameters_to_make? joined_make_options = parameters_to_make? if joined_make_options.respond_to? :join joined_make_options = joined_make_options.join(' ').strip end unless append_this.include? joined_make_options append_this.prepend(joined_make_options.dup) end end # ======================================================================= # # Prepend a ' ' for some spacing. # ======================================================================= # unless append_this.empty? append_this.prepend(' ') unless append_this.start_with? ' ' set_make_options(append_this) end end end
#¶ ↑
append_these_configure_options
¶ ↑
This method will only append non-nil entries to the extra configure options.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1735 def append_these_configure_options( i = nil ) case i # ======================================================================= # # === :release # ======================================================================= # when :release i = '-DCMAKE_BUILD_TYPE=Release' end if i if @internal_hash[:append_this_to_the_configure_options].nil? # =================================================================== # # In this case we must turn it into a String. # =================================================================== # @internal_hash[:append_this_to_the_configure_options] = ''.dup end @internal_hash[:append_this_to_the_configure_options] << " #{i}" end end
#¶ ↑
append_this_to_full_configure_command
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3563 def append_this_to_full_configure_command(i = ' build') unless i.end_with? ' ' i = i.dup if i.frozen? i << ' ' # Properly pad it here. end i.squeeze!(' ') @internal_hash[:full_configure_command] << i end
#¶ ↑
append_this_to_the_configure_options
¶ ↑
This method can be used to append options to the ./configure line, such as –enable-shared, without having to type the long version. So for example, the Symbol :libdir64 will be expanded to mean –libdir=/usr/lib64. That way the user can get away with typing less on the commandline.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10261 def append_this_to_the_configure_options( i = :enable_bootstrap ) # ======================================================================= # # The following case-when menu could be replaced with generic code # that turns the Symbol-input into the equivalent String e. g. # --disable-something or --enable-something. However had, for the # time being (Dec 2018) I will leave it as it is. In April 2021, # I decided to retain the symbol-as-input approach, since some # symbols get expanded to longer strings than other symbols. # ======================================================================= # case i # ======================================================================= # # === :disable_static # ======================================================================= # when :disable_static i = ' --disable-static' # ======================================================================= # # === :libdir # ======================================================================= # when :libdir i = ' --libdir=/usr/lib' # ======================================================================= # # === :libdir64 # ======================================================================= # when :libdir64 i = ' --libdir=/usr/lib64' # ======================================================================= # # === :enable_shared # ======================================================================= # when :enable_shared i = ' --enable-shared' # ======================================================================= # # === :enable_bootstrap # ======================================================================= # when :enable_bootstrap i = ' --enable-bootstrap' end _ = @internal_hash[:configure_options] _ = ''.dup if _.nil? unless i.start_with? ' ' i = i.dup if i.frozen? i.prepend(' ') end # ======================================================================= # # Next simply append these to the configure options. # ======================================================================= # _ << i @internal_hash[:configure_options] = _ end
#¶ ↑
apply_sed_operation_on
¶ ↑
This method will either use class SedWrapper
, or it will use the sed-binary.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10030 def apply_sed_operation_on(sed_line) if sed_line.is_a? Array sed_line.each {|entry| apply_sed_operation_on(entry) } else if sed_binary_is_available? run_this_system_command_in_a_coloured_and_padded_manner(sed_line) else if use_the_internal_sed_wrapper? # ================================================================= # # In this case, use the SedWrapper as a fallback. # ================================================================= # SedWrapper.new(sed_line) else # ================================================================= # # Else we will default to the system-sed. # ================================================================= # orev 'We can not use the sed line '+ sfancy(sed_line)+' because '\ 'sed is not available' orev ', and no commandline option has been passed to allow '\ 'us to use the sed wrapper.' end end end end
#¶ ↑
archive_type?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13385 def archive_type? if cookbook_dataset? cookbook_dataset?.archive_type? end end
#¶ ↑
array_sys_command_string?¶ ↑
The array is fed in line by line.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1121 def array_sys_command_string? @internal_hash[:array_sys_command_string] end
#¶ ↑
assign_to_the_main_dataset
¶ ↑
This method should be used when we wish to assign to the main dataset at hand. The expected input should be class ::RBT::Cookbooks::SanitizeCookbook. If it is not then this will cause an argument error.
The second argument to this method can be used to control how strict the method shall behave.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6048 def assign_to_the_main_dataset( i, check_for_stringent_input = true ) if check_for_stringent_input unless i.respond_to?(:is_sanitize_cookbook?) raise ArgumentError, 'The method assign_to_the_main_dataset() expects input as '\ 'class RBT::Cookbooks::SanitizeCookbook' end set_on_ihash(:cookbook_dataset, i) end end
#¶ ↑
automatically_infer_program_name_and_program_version_from_this_input
¶ ↑
This method will try to automatically set the program_name and @program_version variables.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 364 def automatically_infer_program_name_and_program_version_from_this_input( i, optional_arguments = nil ) if compile_which_program?.nil? set_program_name( program_information_return_program_real_name(i) ) end if program_version?.nil? set_program_version( program_information_return_program_version(i) ) end case optional_arguments when :overwrite_old_values_should_they_exist set_program_name program_information_return_program_real_name(i) set_program_version program_information_return_program_version(i) end set_program_name_and_program_version( compile_which_program?+'-'+program_version? ) end
#¶ ↑
batch_download_all_source_archives
¶ ↑
For this method we have to delegate towards class Cookbooks::DownloadAllSourceArchives
.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2444 def batch_download_all_source_archives action(:download_all_source_archives) end
#¶ ↑
be_completely_quiet
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14439 def be_completely_quiet @internal_hash[:original_stdout] = $stdout # $stdout = StringIO.new # This is the redirection. $stdout = File.open(IO::NULL, 'w') # This one works better, according to drbrain. end
#¶ ↑
binary?¶ ↑
Wrapper towards answering the question of binary pointing.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 394 def binary?( i = compile_which_program? ) i = i.first if i.is_a? Array i = i.downcase orev "Checking for a binary name called `#{simp(i)}#{rev}` next:" return_program_based_on_this_binary(i) end
#¶ ↑
build_static?¶ ↑
We have to first check the build_static entry of the cookbook dataset, before we query the value of the @internal_hash.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13334 def build_static? _ = cookbook_dataset_build_static? unless @internal_hash[:build_static].nil? _ = @internal_hash[:build_static] end return _ end
#¶ ↑
can_we_continue?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1346 def can_we_continue? result = @internal_hash[:can_we_continue] # if cookbook_dataset?.nil? # initialize_dataset_for(compile_which_program?) # end # ignore_errors = @internal_hash[:ignore_errors] # case ignore_errors # # ======================================================================= # # # === :infer # # ======================================================================= # # when :infer # ignore_errors = cookbook_dataset_ignore_errors? if cookbook_dataset? # end # if ignore_errors # result = true # end return result end
#¶ ↑
cd_to_the_build_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1558 def cd_to_the_build_directory( i = use_this_build_directory? ) cd(i) end
#¶ ↑
cd_to_the_configure_base_directory
¶ ↑
This method can be used to cd into the configure base directory.
It can report what it is doing to, in the verbose variant.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4185 def cd_to_the_configure_base_directory( be_verbose_or_be_quiet = :be_quiet ) target = @internal_hash[:configure_base_directory].dup case be_verbose_or_be_quiet # ======================================================================= # # === :be_quiet # ======================================================================= # when :be_quiet cd target, :be_quiet else opnn; cd target, :be_verbose end end
#¶ ↑
cd_to_the_extracted_archive
¶ ↑
This method can be used to quickly cd to the extracted archive.
This assumes that:
(a) the archive exists (b) the archive has been extracted to its designated target
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14161 def cd_to_the_extracted_archive( to = "#{extract_to_this_directory?}"\ "#{program_name_and_program_version?}" ) target = to cd target end
#¶ ↑
cflags?¶ ↑
Just a convenience wrapper over the CFLAGS environment variable. A getter method, which will tell us the CFLAGS in use of the environment.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13068 def cflags? ENV['CFLAGS'].to_s.dup end
#¶ ↑
check_for_available_versions
¶ ↑
Use this method if you wish to check for available program versions.
Usage examples:
ry bluefish available_versions ry gcc available_versions
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 997 def check_for_available_versions( for_this_program = program? ) action(:CheckForAvailableVersions, for_this_program) { :be_verbose } end
#¶ ↑
check_for_binary_duplicates_in_this_directory
¶ ↑
This method can be used to check for binary duplicates, aka binaries that exist more than once on the given system, in the given (passed) directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8189 def check_for_binary_duplicates_in_this_directory( i = return_pwd ) action(:check_for_duplicate_binaries, i) end
#¶ ↑
check_for_inclusion
¶ ↑
We will check the source directory for program-inclusion.
To invoke this method, try something like this:
ry htop --check_for_inclusion
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11438 def check_for_inclusion RBT::Cookbooks::CheckForInclusion.new # bl $RUBY_COOKBOOKS/lib/cookbooks/check_for_inclusion.rb end
#¶ ↑
check_for_latest
¶ ↑
Method-Wrapper over class LocalCheckForLatest.
Invocation example:
ry --checkforlatest
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11848 def check_for_latest action(:LocalCheckForLatest) # bl $RUBY_COOKBOOKS/lib/cookbooks/local_check_for_latest.rb end
#¶ ↑
check_for_sed_action
(sed tag)¶ ↑
Some programs have a sed-entry. We thus need a method to handle these sed entries.
As of August 2017, we will delegate towards class RBT::SedWrapper to deal with sed-related editing. However had, since as of February 2018, we will use system-sed (the binary called “sed”), if it is available. The reason as to why is because my sed-wrapper is incomplete and buggy.
Perhaps one day class SedWrapper
may work reliably, but for the time being, and as new default, we will not use the SedWrapper
by default.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9621 def check_for_sed_action( _ = sed? # Note that this ought to be an Array. ) if _ and !_.empty? if use_the_internal_sed_wrapper? unless _.empty? notify_the_user_that_we_will_use_sed_from_the_pwd _.each {|sed_line| # Must be an Array. orev 'Next applying the following sed-operation:' apply_sed_operation_on(sed_line) } end else # =================================================================== # # Else we will delegate towards class ApplySedOperations. # =================================================================== # action(:ApplySedOperations, _) end end end
#¶ ↑
check_whether_the_given_input_is_a_file_and_does_exist?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 664 def check_whether_the_given_input_is_a_file_and_does_exist? @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] end
#¶ ↑
clear_configure_options
¶ ↑
This method will clear the old configure options.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1272 def clear_configure_options @internal_hash[:configure_options] = nil if cookbook_dataset? cookbook_dataset?.clear_configure_options end end
#¶ ↑
clear_env
¶ ↑
This method will clear ENV. This may sometimes be necessary to start from a clean state.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9846 def clear_env( be_verbose = true ) if be_verbose orev "Clearing (resetting) the environment variable of "\ "ruby via #{slateblue('ENV.clear()')}#{rev}." end ENV.clear end
#¶ ↑
clear_env_variables_but_ensure_the_path_variable_works
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1175 def clear_env_variables_but_ensure_the_path_variable_works old_path = query_path? clear_env unless old_path.empty? # ===================================================================== # # Set a new PATH here, as otherwise compilation would fail. # ===================================================================== # orev "Note that this will lead to compile-time failures because "\ "#{orange('$PATH')}" orev "would not be set. We will use the old path entry "\ "there as a consequence:" opne sfancy(" #{old_path}") set_path(old_path) end end
#¶ ↑
clear_global_flags
¶ ↑
Clear the global files in use that may be stored in the file global_flags.yml.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13589 def clear_global_flags _ = RBT.file_global_flags if File.exist?(_) and !File.empty?(_) zero_this_global_flag_file(_) end if is_on_roebe? # And on my home system as well. _ = ROEBE_FILE_GLOBAL_FLAGS zero_this_global_flag_file(_) end end
#¶ ↑
cmake_exists?¶ ↑
This method will try to determine whether “cmake” exists on the local computer host or whether it does not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11491 def cmake_exists? result = `cmake #{ERROR_LINE}` !result.include?('cmake: command not found') end
#¶ ↑
cmake_file_exists?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1142 def cmake_file_exists? File.exist? 'CMakeLists.txt' end
#¶ ↑
compile_all_games
¶ ↑
This method can be used to compile all registered games.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3220 def compile_all_games we_will_not_try_to_determine_which_programs_have_to_be_installed compile_all_programs_that_belong_to_this_tag(:game) end
#¶ ↑
compile_all_kde5_plasma_components
¶ ↑
This entry point allows us to compile all the various KDE5 plasma components.
Invocation example:
ry --compile-all-kde5-plasma-components
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1290 def compile_all_kde5_plasma_components(be_verbose = true) _ = return_kde5_plasma be_verbose = false if be_verbose == :be_quiet if be_verbose orev "We will next compile all #{lightgreen(_.size)} "\ "#{rev}KDE5 plasma-components:" end set_compile_these_programs(_) end
#¶ ↑
compile_all_lxqt_components
¶ ↑
This entry point allows us to compile all LxQT components, e. g. for the lxqt-desktop.
To compile all LXQT components, try this on the commandline:
ry --compile-lxqt
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1666 def compile_all_lxqt_components set_array_compile_these_programs( return_lxqt_components, :do_not_replace ) end
#¶ ↑
compile_all_of_gstreamer
¶ ↑
This entry point allows us to compile all of gstreamer.
To invoke this, try something like:
ry --gstreamer1
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2404 def compile_all_of_gstreamer array = %w( gstreamer gstreamerpluginsbase gstpluginsgood gstpluginsbad ) orev 'Now compiling the various '+ steelblue('gstreamer components')+ "#{rev} (#{array.size.to_s} components)." # do_compile_these_programs(array) set_install_these_programs(array) end
#¶ ↑
compile_all_of_kde
¶ ↑
To invoke this method, do:
ry --compile-all-of-kde
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2740 def compile_all_of_kde _ = [] # ======================================================================= # # === The KDE foundation (including extra-cmake-modules) # ======================================================================= # _ << return_these_programs(:kde5_foundation) # ======================================================================= # # === The KDE applications # ======================================================================= # _ << return_kde5_applications # ======================================================================= # # === The KDE plasma stack # ======================================================================= # _ << return_kde5_plasma # ======================================================================= # # === The KDE porting aids # ======================================================================= # _ << return_kde5_porting_aids _.flatten! set_compile_these_programs(_) # ← Set it just in case. end
#¶ ↑
compile_all_of_xfce
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3820 def compile_all_of_xfce _ = return_xfce_components we_will_not_try_to_determine_which_programs_have_to_be_installed set_compile_these_programs(_) orev 'Finished compiling '+steelblue(_.size.to_s)+"#{rev} XFCE components." end
#¶ ↑
compile_all_programs
¶ ↑
This method is a direct approach to compile every program that we have registered, in our database.
This method accepts one argument, which decides whether we will quit afterwards or whether we will not.
Invocation example:
ry --compile_all_programs
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6510 def compile_all_programs( shall_we_exit = true ) case shall_we_exit when :do_exit_afterwards shall_we_exit = true end _ = return_available_programs.shuffle # We shuffle for more "randomness". n_programs = _.size.to_s clear_commandline_options opne sfancy('Compiling all available programs next (by a brute'\ 'force approach - we found ')+ simp(n_programs)+sfancy(' programs):') compile_every_program(_) exit_program if shall_we_exit end
#¶ ↑
compile_all_programs_that_belong_to_this_tag
¶ ↑
Invocation examples:
rbt --compile-this-tag=gnome rbt --compile-this-tag=kde rbt --compile-this-tag=kde5 rbt --compile-this-tag=game
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7394 def compile_all_programs_that_belong_to_this_tag(i) # ======================================================================= # # (1) first obtain all programs that belong to a particular tag # ======================================================================= # these_programs = RBT.return_array_of_this_tag(i) we_will_not_try_to_determine_which_programs_have_to_be_installed orev "Determining all programs that belong to the "\ "tag #{steelblue(i)}#{rev} -" orev "note that this may take a moment or two." # ======================================================================= # # (2) then set to the main array # ======================================================================= # set_compile_these_programs( these_programs ) end
#¶ ↑
compile_all_up_until_konsole
¶ ↑
This method can be used to quickly get to compile konsole - and, prior to that, the programs that KDE Konsole depends on.
Invocation example:
ry --compile-towards-konsole
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5638 def compile_all_up_until_konsole _ = [] _ << return_these_programs(:kde5_foundation) # ← This is fine. _ << :konsole _.flatten! set_compile_these_programs(_) # ← Set it just in case. end
#¶ ↑
compile_gcc_with_only_c_and_cpp
¶ ↑
To invoke this method, try:
ry gcc --only-c-and-cpp
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6616 def compile_gcc_with_only_c_and_cpp initialize_dataset_for(:gcc) clear_configure_options # ===================================================================== # # --disable-multilib is necessary as otherwise it won't work. # ===================================================================== # append_this_to_the_configure_options( '--enable-languages=c,c++ --disable-multilib' ) end
#¶ ↑
compile_into_the_home_directory_as_appdir
¶ ↑
This method will enable compilation into the user’s home directory, via AppDir style.
Invocation example:
ry xwd --homedir
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9595 def compile_into_the_home_directory_as_appdir set_user_prefix("$HOME#{static_appdir_prefix?}") end
#¶ ↑
compile_mate_desktop_components_into_one_standalone_directory
¶ ↑
To invoke this method from the commandline, do:
ry --mate-desktop-into-standalone-dir
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5053 def compile_mate_desktop_components_into_one_standalone_directory _ = return_mate_desktop_components # ======================================================================= # # We currently (Oct 2018) will use a hardcoded path. This may change # at a later point in the future. # ======================================================================= # use_this_prefix = "#{programs_dir?}Mate/1.26/" set_use_this_prefix(use_this_prefix) set_compile_these_programs(_) end
#¶ ↑
compile_mouse_and_keyboard_xorg_server_components
¶ ↑
The input-argument to this method defaults to the components that we wish to compile.
To compile the entries in this method, issue:
ry --compile-mouse-and-keyboard
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10120 def compile_mouse_and_keyboard_xorg_server_components( array_components = %w( xf86-input-evdev xf86-input-joystick xf86-input-libinput xf86-input-synaptics xf86-input-mouse xf86-input-vmmouse xf86-input-wacom ) ) orev "Next compiling "\ "`#{royalblue(array_components.size.to_s)}#{rev}` programs:" set_compile_these_programs(array_components) we_will_not_try_to_determine_which_programs_have_to_be_installed end
#¶ ↑
compile_mouse_components
¶ ↑
This method will compile mouse-related components (on a linux system, aka using the xorg-server).
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4206 def compile_mouse_components compile_mouse_and_keyboard_xorg_server_components( %w( xf86-input-vmmouse xf86-input-mouse ) ) end
#¶ ↑
compile_post_xorg_server_components
¶ ↑
Invocation example for this method:
insta --post-xorg-server
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1838 def compile_post_xorg_server_components _ = RBT.report_post_xorg_server_components orev "Next compiling `#{royalblue(_.size.to_s)}#{rev}` programs:" set_compile_these_programs(_) we_will_not_try_to_determine_which_programs_have_to_be_installed end
#¶ ↑
compile_the_initial_lfs_toolchain
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13603 def compile_the_initial_lfs_toolchain ENV['PATH'] = '/tools/bin:/bin:/usr/bin' orev 'We will next try to install a LFS-like toolchain - aka, similar to' orev 'How the Linux from Scratch system is bootstrapped.' e orev 'In order to do so, certain '+ steelblue('assumptions')+' will have to be made.' e # ======================================================================= # # Next comes the general LFS prefix to use. # ======================================================================= # use_this_prefix = '/home/LFS/' prefix_for_tools = use_this_prefix+'tools' # ======================================================================= # # === tools_lib_path # ======================================================================= # tools_lib_path = prefix_for_tools+'/lib' prefix_for_sources = use_this_prefix+'sources' orev 'The target directory for this boostrapped toolchain will be at:' e e " #{steelblue(use_this_prefix)}" e mkdir(use_this_prefix) mkdir(prefix_for_tools) mkdir(prefix_for_sources) mkdir(tools_lib_path) unless File.symlink? '/tools' run_this_system_command_in_a_coloured_and_padded_manner("ln -sv #{prefix_for_tools} /") end # ======================================================================= # # === Create .bash_profile next: # ======================================================================= # this_file = File.expand_path('~/.bash_profile') unless File.exist? this_file what = <<-EOF exec env -i HOME=$HOME TERM=$TERM PS1=' ' /bin/bash EOF orev 'Next storing into the file `'+sfile(this_file)+rev+'`.' write_what_into(what, this_file) end # ======================================================================= # # === Create .bashrc next: # ======================================================================= # this_file = File.expand_path('~/.bashrc') # ======================================================================= # # Overrule for the LFS user: # ======================================================================= # this_file = File.expand_path('/home/lfs/.bashrc') architecture = `uname -m`.strip # ======================================================================= # # === lfs_target_architecture # # Specify which target architecture is to be used. Oddly enough GCC # seems to be picky about the name chosen here. # ======================================================================= # lfs_target_architecture = "#{architecture}-pc-linux-gnu" unless File.exist? this_file what = "set +h umask 022 LFS=#{use_this_prefix} LC_ALL=POSIX LFS_TGT=#{lfs_target_architecture} PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL LFS_TGT PATH " orev 'Next storing into the file `'+sfile(this_file)+ rev+'`.' write_what_into(what, this_file) end # ======================================================================= # # Next compile binutils, first pass - see also this URL: # # http://www.linuxfromscratch.org/lfs/view/development/chapter05/binutils-pass1.html # # ======================================================================= # _ = RBT::Action::SoftwareManager.new(:binutils) { :do_not_run_yet } _.clear_configure_options _.set_prefix_to_use('/tools') _.do_not_store_the_compile_time use_these_configure_options = <<-EOF --with-sysroot=#{use_this_prefix} --with-lib-path=/tools/lib --target=#{lfs_target_architecture} --disable-nls --disable-werror EOF _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ') _.skip_postinstallation_step _.do_not_register_the_last_compiled_program _.run if is_on_64_bit? cd prefix_for_tools run_this_system_command_in_a_coloured_and_padded_manner 'ln -sv lib /tools/lib64' end # ======================================================================= # # Next prepare GCC # ======================================================================= # cd log_dir? _ = action(:Installer, :gcc) { :do_not_run_yet } extract_what_to( _.cookbook_dataset_program_path?, _.extracted_path? ) target_dir = _.extracted_path?+ remove_archive_from_the_end( File.basename(_.cookbook_dataset_program_path?) ) orev "Changing directory into #{sdir(target_dir)}#{rev} next." cd target_dir path_to_mpfr = return_path_to_the_archive_of_this_program(:mpfr) path_to_gmp = return_path_to_the_archive_of_this_program(:gmp) path_to_mpc = return_path_to_the_archive_of_this_program(:mpc) extract_what_to( path_to_mpfr, return_pwd ) unless File.directory? 'mpfr' opnn; mv remove_archive_from_the_end(File.basename(path_to_mpfr)),'mpfr' end extract_what_to( path_to_gmp, return_pwd ) unless File.directory? 'gmp' opnn; mv remove_archive_from_the_end(File.basename(path_to_gmp)),'gmp' end extract_what_to( path_to_mpc, return_pwd ) unless File.directory? 'mpc' opnn; mv remove_archive_from_the_end(File.basename(path_to_mpc)),'mpc' end what = <<-EOF for file in gcc/config/{linux,i386/linux{,64}}.h do cp -uv $file{,.orig} sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools@g' $file.orig > $file echo ' #undef STANDARD_STARTFILE_PREFIX_1 #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/" #define STANDARD_STARTFILE_PREFIX_2 ""' >> $file touch $file.orig done EOF run_this_system_command_in_a_coloured_and_padded_manner(what) adhoc_fix_gcc _.clear_configure_options _.set_prefix_to_use(prefix_for_tools) _.do_not_store_the_compile_time use_these_configure_options = <<-EOF --target=#{lfs_target_architecture} --with-glibc-version=2.11 --with-sysroot=#{use_this_prefix} --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --enable-languages=c,c++ --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libstdcxx EOF _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ').squeeze(' ') _.skip_postinstallation_step _.do_not_register_the_last_compiled_program _.run # ======================================================================= # # Next install the linux kernel header files: # ======================================================================= # path_to_linux = return_path_to_the_archive_of_this_program(:linux) extract_what_to( path_to_linux, return_pwd ) cd remove_archive_at_the_end(File.basename(path_to_linux)) orev 'We are in the directory '+sdir(return_pwd)+rev+ ' and will run three commands:' run_this_system_command_in_a_coloured_and_padded_manner 'make mrproper' run_this_system_command_in_a_coloured_and_padded_manner 'make headers' run_this_system_command_in_a_coloured_and_padded_manner 'cp -rv usr/include/* /tools/include' # ======================================================================= # # Next glibc: # ======================================================================= # cd log_dir? _ = action(:Installer, :glibc) { :do_not_run_yet } extract_what_to( _.cookbook_dataset_program_path?, _.extracted_path? ) target_dir = _.extracted_path?+ remove_archive_from_the_end( File.basename(_.cookbook_dataset_program_path?) ) orev "Changing directory into #{sdir(target_dir)}#{rev} next." _.clear_configure_options _.set_prefix_to_use(prefix_for_tools) _.do_not_store_the_compile_time use_these_configure_options = <<-EOF --host=#{lfs_target_architecture} --build=$(../scripts/config.guess) --enable-kernel=3.2 --with-headers=/tools/include EOF _.set_internal_hash_configure_options use_these_configure_options.tr("\n", ' ').squeeze(' ') _.skip_postinstallation_step _.do_not_register_the_last_compiled_program _.run # ======================================================================= # # Next install Libstdc++ # ======================================================================= # cd log_dir? _ = action(:Installer, :gcc) { :do_not_run_yet } extract_what_to( _.cookbook_dataset_program_path?, _.extracted_path? ) target_dir = _.extracted_path?+ remove_archive_from_the_end( File.basename(_.cookbook_dataset_program_path?) ) orev "Changing directory into #{sdir(target_dir)}#{rev} next." cd target_dir mkdir 'build' cd 'build' orev 'We are now in the directory '+sdir(target_dir)+rev+'.' ENV['LD_CONFIG_PATH'] = tools_lib_path run_this_system_command_in_a_coloured_and_padded_manner "../libstdc++-v3/configure --host=#{lfs_target_architecture} --prefix=/tools --disable-bootstrap --disable-multilib --disable-nls --disable-libstdcxx-threads --disable-libstdcxx-pch --with-system-zlib --with-newlib --disable-libquadmath --with-gxx-include-dir=/tools/#{lfs_target_architecture}/include/c++/9.2.0".squeeze(' ').tr("\n",' ').squeeze(' ') # ======================================================================= # # This here may lead to problems - in that event, have a look at the # config.log file, as it should show why, for example, link tests # were disabled. --disable-libquadmath should help in that case, # by the way. # ======================================================================= # run_make_command run_make_install_command end
#¶ ↑
compile_the_main_program_including_the_dependencies
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3794 def compile_the_main_program_including_the_dependencies ensure_that_the_main_dataset_exists # ======================================================================= # # Prepend to this chain the known dependencies. # ======================================================================= # _ = compile_these_programs? _.prepend( required_deps_on? ) _.flatten! set_array_compile_these_programs(_) end
#¶ ↑
compile_the_python_addons
¶ ↑
This method can be used to compile all the various python addons.
Invocation example:
installer --python-addons
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1952 def compile_the_python_addons( array = chained_programs?['python_addons'] ) orev "Installing various registered "\ "python-addons (#{array.size.to_s}#{rev}) next." set_compile_these_programs(array) we_will_not_try_to_determine_which_programs_have_to_be_installed end
#¶ ↑
compile_the_ruby_addons
¶ ↑
This method can be used to compile all the various ruby addons.
Invocation example:
ry --ruby-addons
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5938 def compile_the_ruby_addons array = chained_programs?['ruby_addons'].reject {|entry| entry == 'ruby' } orev "Installing various registered ruby-addons "\ "(#{steelblue(array.size.to_s)}#{rev}) next." set_compile_these_programs(array, :do_not_replace) end
#¶ ↑
compile_these_programs?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 861 def compile_these_programs? @internal_hash[:compile_these_programs] end
#¶ ↑
compile_this_existing_file
¶ ↑
This method can be used to compile an existing file.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7059 def compile_this_existing_file( i = first_argument? ) _ = extract_to?.dup extract_this_source_archive(i, _) sanitized_first_argument = remove_archive_at_the_end( return_program_name_hyphen_then_program_version_or_first_argument ) unless _.end_with? sanitized_first_argument _ << sanitized_first_argument end _ = remove_archive_from_the_end(_) orev "Changing directory into #{sdir(_)} #{rev}next." cd _ run_configure run_make_then_make_install end
#¶ ↑
compile_this_program?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1561 def compile_this_program? @internal_hash[:compile_this_program] end
#¶ ↑
compile_xcb_components
¶ ↑
To invoke this method, issue:
ry --compile-xcb-components
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14541 def compile_xcb_components orev "Now compiling the various #{steelblue('xcb components')}#{rev}." # ======================================================================= # # The array should be kept in the correct order - xcbutilrenderutil # must come before xcbutilcursor, for instance. # ======================================================================= # array = %i( xcbproto libxcb xcbutil xcbutilerrors xcbutilimage xcbutilkeysyms xcbutilrenderutil xcbutilcursor xcbutilwm xcbutilxrm ) set_array_compile_these_programs(array) end
#¶ ↑
compile_xfce_components_into_one_standalone_directory
¶ ↑
To invoke this method from the commandline, do:
ry --xfce-into-standalone-dir
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1716 def compile_xfce_components_into_one_standalone_directory _ = return_xfce_components # ======================================================================= # # We currently (Oct 2018) will use a hardcoded path. This may change # at a later point in the future. # ======================================================================= # use_this_prefix = programs_dir?+'Xfce/4.16/' set_use_this_prefix( use_this_prefix ) batch_compile_the_programs(_) end
#¶ ↑
compile_xorg_libraries
¶ ↑
Invocation example for this method:
ry --compile_xorg_libraries
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3304 def compile_xorg_libraries _ = RBT.return_xorg_server_libraries orev "Next compiling `#{royalblue(_.size.to_s)}#{rev}` programs:" set_compile_these_programs(_) end
#¶ ↑
compiled_programs?¶ ↑
This will grab the full dataset of compiled_programs.yml
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1062 def compiled_programs?( from_this_file = file_compiled_programs? ) if File.exist? from_this_file return load_yaml(from_this_file) else orev "The file at #{sfile(from_this_file)} #{rev}does not exist." end end
#¶ ↑
configuration?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1297 def configuration? RBT.configuration? end
#¶ ↑
configure_base_directory?¶ ↑
This should always have a trailing ‘/’ character IF it is defined. class Cookbook
will make sure of that.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13175 def configure_base_directory? _ = @internal_hash[:configure_base_directory] if _.nil? _ = cookbook_dataset_configure_base_directory? end return _ end
#¶ ↑
configure_has_a_higher_priority_than_meson?¶ ↑
This method will return true if “configure” has a higher priority than “meson”. A yaml file keeps track of these priorities.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 313 def configure_has_a_higher_priority_than_meson? ::RBT.configure_has_a_higher_priority_than_meson? end
#¶ ↑
configure_options?¶ ↑
This method will retrieve the configure options. We default to using the configure-options stored in the cookbook dataset, but we can overrule this on the commandline (when we store it onto the @internal_hash).
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1195 def configure_options?( _ = cookbook_dataset_configure_options? ) if @internal_hash[:configure_options] _ = @internal_hash[:configure_options] end return _ end
#¶ ↑
configure_script_exists?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13371 def configure_script_exists? File.exist?('configure') end
#¶ ↑
consider_applying_a_patch
¶ ↑
Check whether we should apply a patch_set or not.
This should happen before we make use of preinstall, and after displaying an optional start message.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1090 def consider_applying_a_patch apply_patch = apply_patch? if apply_patch patchset = apply_patch patchset = [patchset] unless patchset.is_a? Array patchset.flatten.each {|this_patchset| cliner { this_dir = configure_base_directory? opne simp('Trying to ')+ orange('apply a patch')+ simp(' next:')+ simp(' (in ')+ sdir(this_dir)+ simp(')') orev " #{this_patchset}" } # =================================================================== # # (1) Download the patch unless it exists locally. # =================================================================== # unless File.exist? File.basename(this_patchset) orev 'Next trying to download '+steelblue(this_patchset)+"#{rev}." do_download_this_program(this_patchset) end this_command = "patch -Np1 -i #{File.basename(this_patchset)}" orev "Running this command next (from the directory "\ "#{sdir(return_pwd)}#{rev}):" e e "#{sfancy(this_command)}" e # =================================================================== # # (2) Run the patchset. # =================================================================== # custom_system(this_command) # Delegate to Kernel#system. } end end
#¶ ↑
consider_changing_the_tab_title
(shell tag)¶ ↑
Use this method to change the title of a tab in a Terminal like Bash.
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11293 def consider_changing_the_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? ) action(:change_tab_title, [i, shall_we_rename_the_tab_title]) end
#¶ ↑
consider_checking_whether_the_compiled_binaries_are_already_registered
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7509 def consider_checking_whether_the_compiled_binaries_are_already_registered if is_on_roebe? and # ← Only allow this on roebe-systems. is_app_dir? and has_to_be_compiled? and # compiled_successfully? and !prefix?.include?('Toolchain') # Make /home/Programs/Toolchain exempt from this. locally_existing_executables = Dir["#{prefix?}bin/*"].map {|entry| File.basename(entry) } locally_existing_executables << Dir["#{prefix?}sbin/*"].map {|entry| File.basename(entry) } locally_existing_executables.flatten! locally_existing_executables.uniq! registered_binaries = cookbooks_binaries? # ===================================================================== # # Next compare these entries: # ===================================================================== # locally_existing_executables.each {|entry| if registered_binaries.include? entry # In this case all is fine. else compile_this_program = compile_which_program? # ================================================================= # # Else it is a not-registered binary, so report it. # ================================================================= # cliner opne crimson('The entry ')+steelblue(entry)+ crimson(' is not a registered') opne crimson('binary for the program ')+ royalblue(compile_this_program)+ crimson('.') opne olivedrab('^^^ Consider changing this. ^^^') cliner # ================================================================= # # Since as of 09.12.2019 we will also store this result into a # log file. # ================================================================= # what = "#{entry} belongs to the program called "\ "#{rarrow?} #{compile_this_program}" into = "#{log_dir?}these_binaries.yml" orev "Storing "+steelblue(entry)+rev+ "#{rev} into the file "+ sfile(into)+ "#{rev} as well." append_what_into("#{what}#{N}", into) end } end end
#¶ ↑
consider_comparing_the_installed_libraries_versus_the_assumed_libraries
¶ ↑
This method will try to compare the installed libraries in an AppDir with the ones that are registered in the various cookbook .yml files.
This will happen ONLY if we are on a roebe-system; and ONLY if we use an AppDir approach.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4836 def consider_comparing_the_installed_libraries_versus_the_assumed_libraries if is_on_roebe? and is_an_appdir_installation? and has_been_installed_successfully? assumed_libraries = RBT.infer_these_libraries_will_be_installed_by( compile_which_program? ) if assumed_libraries libraries?.each {|this_already_registered_library| # ================================================================= # # The variable this_already_registered_library may be something # like 'libgmodule-2.0.so'. # ================================================================= # if assumed_libraries.any? {|entry| entry.include? this_already_registered_library } else orev "The library "\ "#{orange(this_already_registered_library)}"\ " #{rev}is not registered." orev "Consider #{crimson('updating')}#{rev} it (file: "\ "#{sfile(compile_which_program?+'.yml')}#{rev})." end } end end end
#¶ ↑
consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation
¶ ↑
This method will create a log file that will contain the information about all environment information.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5228 def consider_creating_a_log_file_containing_information_about_the_used_environment_and_time_of_compilation base_dir_to_use = rbt_log_dir?+'log_files/' mkdir(base_dir_to_use) unless File.directory?(base_dir_to_use) # ======================================================================= # # We must designate where we store this information. This will be # stored under log_files/. # ======================================================================= # store_where = base_dir_to_use+ 'environment_information_for_the_program_'+program_name?+'.md' create_log_file = RBT::CreateLogFile.new {{ clear_the_main_hash: true, store_where: store_where, use_environment_flags: true, uses_appdir_prefix: app_dir_prefix?, program_name: program_name? }} if app_dir_prefix? # ===================================================================== # # We will also store into the appdir prefix. # ===================================================================== # create_log_file.do_store_into_the_appdir( prefix?.to_s+'Resources/'+File.basename(store_where) ) end end
#¶ ↑
consider_creating_and_populating_the_pkgconfig_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9160 def consider_creating_and_populating_the_pkgconfig_directory if uses_an_appdir_prefix? action(:create_and_populate_pkgconfig_directory, appdir_prefix?) end end
#¶ ↑
consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3103 def consider_creating_appdir_skeleton_then_consider_running_autoconf_then_run_configure_then_make_then_make_install consider_creating_appdir_skeleton consider_running_autoconf_then_run_configure_then_make_then_make_install end
#¶ ↑
consider_enabling_python2
¶ ↑
This may ensure that we will use python 2.x, primarily due to the meson build system. Right now it only works on roebe-systems though.
It can also be enabled from the commandline, such as by issuing the following command:
rbt --enable-python2
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4882 def consider_enabling_python2( shall_we_enable_python_2 = (on_roebe? and !do_we_use_python3?) ) if shall_we_enable_python_2 # ======================================================================= # # Try to use python version 3 here. # ======================================================================= # if File.directory?(programs_directory?+'Python/') availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry| File.directory? entry }.select {|entries_with_numbers| entries_with_numbers =~ /\d+/ }.select {|entries_that_might_be_python_version_two| entries_that_might_be_python_version_two.include? 'Python/2' } unless availabe_python_versions.empty? use_this_python_version = availabe_python_versions.first action(:ToCurrent, use_this_python_version) return true # Determine that it was a success. end end end false end
#¶ ↑
consider_enabling_python3
¶ ↑
This may ensure that we will use python 3.x, primarily due to the meson build system. Right now it only works on roebe-systems though.
It can also be enabled from the commandline, such as by issuing the following command:
rbt --enable-python3
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3677 def consider_enabling_python3( shall_we_enable_python_3 = (on_roebe? and !do_we_use_python3?) ) if shall_we_enable_python_3 # ======================================================================= # # Try to use python version 3 here. # ======================================================================= # if File.directory?(programs_directory?+'Python/') availabe_python_versions = Dir[programs_directory?+'Python/*'].select {|entry| File.directory? entry }.select {|entries_with_numbers| entries_with_numbers =~ /\d+/ }.select {|entries_that_might_be_python_version_three| entries_that_might_be_python_version_three.include? 'Python/3' } unless availabe_python_versions.empty? use_this_python_version = availabe_python_versions.first action(:ToCurrent, use_this_python_version) return true # Determine that it was a success. end end end false end
#¶ ↑
consider_entering_the_log_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9069 def consider_entering_the_log_directory # ======================================================================= # # cd into the main log directory: # ======================================================================= # if cd_into_the_rbt_log_directory? cd(rbt_log_directory?, :be_quiet) end end
#¶ ↑
consider_making_use_of_cookbook_aliases
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5825 def consider_making_use_of_cookbook_aliases unless make_use_of_cookbook_aliases? == :user_disabled_this_setting_via_the_commandline @internal_hash[:make_use_of_cookbook_aliases] = true end end
#¶ ↑
consider_modifying_postinstall_with_this_prefix
¶ ↑
This method can be used to modify all prefix-targets in the postinstall Array.
We will only modify the program_version
normally here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8960 def consider_modifying_postinstall_with_this_prefix( i = program_version? ) return unless i unless i.start_with? '/' i = i.dup if i.frozen? i.prepend('/') # A bit hackish as a workaround but this works. end # ======================================================================= # # The regex is also stored here: # # https://rubular.com/r/U7J9cbbqUBPI # # ======================================================================= # regex_to_use = /\/(\d{1,2}\.?\d{1,2}\.?\d{0,2})/ cookbook_dataset_postinstallation = cookbook_dataset_postinstallation? if cookbook_dataset_postinstallation set_postinstallation( cookbook_dataset_postinstallation.map {|line| # =================================================================== # # We must use .gsub!() here rather than .sub!() because the # full line may be like this: # # ln -s /Programs/Gtk+/3.24.1/include/gtk-2.0 /Programs/Gtk+/3.24.1/include/gtk # # =================================================================== # line.gsub!(regex_to_use, i) line } ) end end
#¶ ↑
consider_performing_postinstallation_actions
(postinstall tag, post tag)¶ ↑
Postinstall actions are optional - they are done after the “make install” step has finished.
This method here handles postinstall-related actions, like starting a service after compilation has finished, or removing a directory after installation - these sorts of actions.
A song may also be played if the configuration option tells us to do so. (This may give us an audio-cue that compilation has finished. I no longer make use of this, but if others want to, here we go)
We make use of RBT::SymlinkProgram to symlink the AppDir properly, in the event that we compile into AppDirs.
Since as of February 2019, a separate class handles these postinstallation steps.
As a summary and an overview, these are valid postinstall actions:
- Running cleanup actions - Renaming a shell (optional) - Playing a song (when the configuration option told us to do so) - Symlinking files after installation - Copying several files to another location - Deleting any .la files if the user specified so (this is now the default; RBT::Action::SoftwareManager will always try to remove .la files under an AppDir prefix, unless the user has specified otherwise)
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5205 def consider_performing_postinstallation_actions( run_postinstall_actions = run_postinstall_actions? ) # ======================================================================= # # Only run these actions if we actually do run postinstall actions: # ======================================================================= # if run_postinstall_actions and can_we_continue? # ===================================================================== # # Next delegate towards class RBT::PostinstallationStep. # ===================================================================== # RBT::PostinstallationStep.new( return_hash_for_the_postinstallation_step ) {{ use_opn: use_opn? }} end end
#¶ ↑
consider_removing_empty_subdirectories
¶ ↑
We will remove empty subdirectories but only from AppDir-like prefixes.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12152 def consider_removing_empty_subdirectories( prefix = prefix?.to_s # ← This will be like "/Programs/Gcide/0.52/". ) if uses_an_appdir_prefix? subdirectories = Dir[prefix+'*'].select {|entry| File.directory?(entry) and Dir.empty?(entry) } # ===================================================================== # # Since as of December 2022 we will remove only some empty # subdirectories. # ===================================================================== # subdirectories.select! {|entry| RBT::SymlinkFromToCurrent::ARRAY_ALLOWED_SUBDIRECTORIES.include?( File.basename(entry) ) } remove_directories( subdirectories ) consider_removing_the_current_symlink_if_the_directory_is_empty consider_removing_the_settings_directory_if_it_is_empty consider_removing_the_empty_versioned_directory consider_removing_the_empty_base_directory_of_the_program end end
#¶ ↑
consider_removing_the_current_symlink_if_the_directory_is_empty
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 717 def consider_removing_the_current_symlink_if_the_directory_is_empty if uses_an_appdir_prefix? prefix = prefix?.to_s symlink_current = rds( File.dirname(prefix)+'/Current' ) if File.symlink?(symlink_current) and File.directory?(File.readlink(symlink_current)) and Dir.empty?(File.readlink(symlink_current)) delete_this_symlink(symlink_current) end end end
#¶ ↑
consider_removing_the_empty_base_directory_of_the_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11735 def consider_removing_the_empty_base_directory_of_the_program if uses_an_appdir_prefix? and !is_a_gem_file? target = rds( programs_dir?+program_name?.capitalize.delete('-_')+'/' ) if File.directory?(target) and Dir.empty?(target) opne tomato('Removing')+ rev+' the empty directory at `'+ sdir(target)+rev+ '` next.' remove_this_directory(target) end end end
#¶ ↑
consider_removing_the_empty_versioned_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4433 def consider_removing_the_empty_versioned_directory if uses_an_appdir_prefix? prefix = prefix?.to_s if File.directory?(prefix) and Dir.empty?(prefix) and !(prefix == '/') remove_this_directory(prefix) end end end
#¶ ↑
consider_removing_the_old_extracted_directory_if_it_exists
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3361 def consider_removing_the_old_extracted_directory_if_it_exists( i = remove_archive_stuff_from_the_end(will_be_extracted_towards?) ) if File.directory?(i) and i.include?(log_dir?) if i == log_dir? orev "Can not remove #{sdir(i)}#{rev}." else orev "#{steelblue('Removing')}#{rev}"\ " the extracted directory at #{sdir(i)}"\ "#{rev} next." remove_directory(i) end end end
#¶ ↑
consider_removing_the_settings_directory_if_it_is_empty
¶ ↑
This method will attempt to remove the /Settings subdirectory, if it is empty.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4419 def consider_removing_the_settings_directory_if_it_is_empty if uses_an_appdir_prefix? prefix = prefix?.to_s settings_directory = File.dirname(prefix)+'/Settings' if File.directory?(settings_directory) and Dir.empty?(settings_directory) remove_this_directory(settings_directory) end end end
#¶ ↑
consider_reporting_the_cflags_we_will_use
¶ ↑
Notify the user which CFLAGS he is using.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9997 def consider_reporting_the_cflags_we_will_use _ = cflags? unless _.empty? orev "The #{steelblue('CFLAGS')} #{rev}in use are:" e e " #{simp(_)}" e end end
#¶ ↑
consider_reporting_the_time_it_took_to_compile_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1759 def consider_reporting_the_time_it_took_to_compile_this_program if time_the_compilation? # and no_error_has_occurred? program_name = compile_which_program?.to_s # Keep a reference. _ = @internal_hash[:array_time_compilation] # ===================================================================== # # We need the start-time and the end-time, in order to calculate # the difference. # ===================================================================== # start_time = @internal_hash[:array_time_compilation][-2] end_time = @internal_hash[:array_time_compilation][-1] # ===================================================================== # # We must next check that both end time and start time exist, as # otherwise we would run into an error. # ===================================================================== # if start_time and end_time duration = (end_time - start_time) rounded_duration = duration.round(3) in_minutes = (rounded_duration.to_f / 60.0).round(2) if has_to_be_compiled? compiling_or_installing = 'Compiling' else compiling_or_installing = 'Installing' end # =================================================================== # # Notify the user how long it took to compile/install the given # program at hand. # =================================================================== # orev "#{compiling_or_installing} the program `"\ "#{olivedrab(program_name)}"\ "#{rev}` took #{sfancy(rounded_duration.to_s)} #{rev}seconds "\ "(aka #{sfancy(in_minutes)} #{rev}minutes)." # =================================================================== # # Also store this now into a file. # =================================================================== # _ = RBT.file_storing_the_time_it_took_to_compile_programs if File.exist? _ dataset = YAML.load_file(_) else dataset = {} # Use a Hash format. end dataset[program_name] = rounded_duration orev "Also storing this information into the file" orev " #{sfile(_)}" write_what_into(YAML.dump(dataset), _) else orev 'Can not store the time as the variable tracking the time' orev 'is incorrect. It will be displayed next, to aid in debugging:' e pp @internal_hash[:array_time_compilation][-1] e end end end
#¶ ↑
consider_running_autoconf_then_run_configure_then_make_then_make_install
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 660 def consider_running_autoconf_then_run_configure_then_make_then_make_install consider_running_the_pre_configure_steps decide_whether_to_invoke_the_autoconf_command run_configure_then_make_then_make_install end
#¶ ↑
consider_running_the_pre_configure_steps
¶ ↑
This method will perform the pre-configure steps, if they were given at all that is.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1249 def consider_running_the_pre_configure_steps _ = pre_configure_steps? unless _.empty? _.each {|entry| e steelblue('Running the following command next, '\ 'as a pre-configure step') e peru(' (in the directory ')+ sdir(return_pwd)+ peru(')')+ steelblue(':') e e mediumseagreen(" #{entry}") system entry e } end end
#¶ ↑
consider_sanitizing_the_program_path
¶ ↑
This method will only be used when @internal_hash has been set.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3255 def consider_sanitizing_the_program_path if @internal_hash[:use_this_specific_program_version] # ===================================================================== # # The above variable is nil by default, so if it has another value # we can use this. # ===================================================================== # splitted = @internal_hash[:use_this_specific_program_version].split('/') last = splitted.last # ← This will hold the new program version. old_value = cookbook_dataset_program_path?.dup old_version = program_information_return_version(old_value) set_cookbook_dataset_program_version( last ) old_value.sub!(/#{old_version}/, last) set_cookbook_dataset_program( remove_extension( File.basename(old_value) ) ) set_cookbook_dataset_program_path(old_value) end end
#¶ ↑
consider_showing_the_flexbox
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12068 def consider_showing_the_flexbox( compile_this_program = compile_which_program? ) show_flexbox(compile_this_program) if show_flexbox? end
#¶ ↑
consider_storing_a_snapshot
¶ ↑
This method may store the compilation time into an Array.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11463 def consider_storing_a_snapshot if @internal_hash[:time_compilation] @internal_hash[:array_time_compilation] << Time.now end end
#¶ ↑
consider_symlinking_the_pkgconfig_files
¶ ↑
If the cookbook has symlinking_pkgconfig_files set to true, and if the program is compiled, as AppDir, then we will symlink .pc files into /usr/lib/pkgconfig/, if the latter one exists.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5874 def consider_symlinking_the_pkgconfig_files target_dir = '/usr/lib/pkgconfig/' if symlink_pkgconfig_files? and is_appdir_compilation_style? and File.directory?(target_dir) and !do_not_symlink? appdir_target_with_pc_files = "#{return_appdir_prefix}lib/pkgconfig/" # ===================================================================== # # Delegate towards class SymlinkPkgconfigFiles next. # ===================================================================== # SymlinkPkgconfigFiles.new(appdir_target_with_pc_files) end end
#¶ ↑
consider_to_run_ldconfig
(ldconfig tag)¶ ↑
Run ‘ldconfig’ here in this method.
Check whether we are allowed to invoke this method before calling it however.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9316 def consider_to_run_ldconfig return if are_we_on_windows? if continue_after_make_step? # Makes only sense if we are past the make-step. # ===================================================================== # # ruby and python add-ons normally do not require ldconfig, # so we don't have to invoke it. # ===================================================================== # if tags?.include?('ruby') or tags?.include?('python') do_not_run_ldconfig end # ===================================================================== # # Only run it if the config-file tells us to do so and only for # those programs that have to be compiled. # # class RBT::Action::SoftwareManager will, however had, NOT run ldconfig when the # program has failed to install - that is specifically if an # error has occurred. # ===================================================================== # if run_ldconfig? and has_to_be_compiled? and can_we_continue? #and #!a_problem_has_occurred? and # Also check for no problem. #!an_error_has_occurred? # =================================================================== # # Build up the command to run next. # =================================================================== # cmd_to_run = 'ldconfig'.dup # =================================================================== # # We could be verbose, but it is not that useful, so uncomment it. # cmd_to_run << ' -v' # =================================================================== # # Since as of July 2011, we will be quieter and ignore whether # ldconfig exists or not. # =================================================================== # cmd_to_run << " #{SHELL_ERROR_CODE}" # =================================================================== # # Check for superuser privilege next. ldconfig requires the # superuser. # =================================================================== # if is_superuser? orev "Now running `#{sfancy(cmd_to_run)}#{rev}`." # We output the ldconfig command variant here. system cmd_to_run else orev "You are not the superuser so we will not "\ "try to run `#{sfancy(cmd_to_run)}#{rev}`." end end end end
#¶ ↑
consider_uploading_binaries
¶ ↑
This method can be used to upload some binaries.
Invocation example:
ry htop uploadbinaries
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8401 def consider_uploading_binaries( upload_binaries = upload_binaries? ) if upload_binaries orev 'We will next upload any files found in the bin/ subdirectory.' _ = "#{dataset?.prefix}bin/" files = Dir["#{_}*"] if files.empty? orev "No files were found in #{sdir(_)}#{rev}." else upload_to( files, :default, 'bin' ) end end end
#¶ ↑
consider_using_maximum_speed_for_compilation
¶ ↑
This method also has to check whether we will compile the given program at all or whether we will not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3330 def consider_using_maximum_speed_for_compilation if use_maximum_speed_for_compilation? and the_program_has_to_be_compiled? and can_we_continue? orev "The configuration file "\ "#{sfile('use_maximum_speed_for_compilation.yml')}#{rev}"\ " specified" orev "that maximum speed should be used for compilation." orev "This means to pass the #{orange('-j')} #{rev}"\ "option to the program #{slateblue('make')}#{rev}," orev "with the number of processors this computer "+ 'has ('+ steelblue(this_computer_has_how_many_processors?.to_s)+ "#{rev})." speed_up_the_compilation end end
#¶ ↑
consider_using_this_file_for_the_configure_options_that_are_to_be_used
¶ ↑
The argument to this method should be the file that contains the configure-options.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6002 def consider_using_this_file_for_the_configure_options_that_are_to_be_used( this_file ) if File.exist? this_file orev 'Making use of the file '+sfile(this_file)+rev+' for configure-options.' dataset = File.read(this_file).strip.tr("\n", ' ').squeeze(' ') orev 'The options are:' e e sfancy(" #{dataset}") e clear_configure_options @internal_hash[:configure_options] = dataset else opnn; no_file_exists_at(this_file) end end
#¶ ↑
considering_setting_any_special_environment_variable
¶ ↑
This is the method that will be used to determine whether we have to set any special environment variable.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14346 def considering_setting_any_special_environment_variable( be_verbose = true ) _ = set_env_variables? if _ and !extract_only? # If we only extract something, then we don't need to do the rest. if be_verbose orev "Making use of these #{aliceblue('special environment variables')}#{rev}:" e # And an elegant extra line, as of July 2021. end set_these_env_variables( _, :do_set_these_variables, :be_verbose ) e end end
#¶ ↑
convert_to_traditional
¶ ↑
Convert to traditional format via this method here.
Invoke this by doing something like:
ry php ctotrad
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4951 def convert_to_traditional( i = compile_which_program? ) RBT::ConvertToTraditional.new(i) # bl ConvertToTraditional end
#¶ ↑
cookbook_dataset
? (dataset tag)¶ ↑
Keep this query method on top of this file here, ideally.
This method can be used whenever we wish to query the main data structure of the target program at hand.
The dataset variable will typically be an instance of class RBT::Cookbooks::SanitizeCookbook.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 171 def cookbook_dataset? @internal_hash[:cookbook_dataset] end
#¶ ↑
cookbook_dataset_apply_patch?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 883 def cookbook_dataset_apply_patch? cookbook_dataset?.apply_patch? end
#¶ ↑
cookbook_dataset_cmake_configure_options?¶ ↑
This method will return all options used for the “cmake” build system of the program at hand, should cmake be used at all.
If GNU configure is used then this method will not be used.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1042 def cookbook_dataset_cmake_configure_options? cookbook_dataset?.cmake_configure_options? end
#¶ ↑
cookbook_dataset_configure_base_directory?¶ ↑
We ask the cookbook-dataset object for the configure base directory.
Most programs will NOT have such a setting.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1019 def cookbook_dataset_configure_base_directory? cookbook_dataset?.configure_base_directory? end
#¶ ↑
cookbook_dataset_configure_command?¶ ↑
Most programs may use GNU autoconfigure, and thus “configure”, but a few programs such as openssl, require another program name, such as “/config”. This method here will query whether the given program needs such a name. If this is the case then this will be used as name rather than the alternative name “configure”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9740 def cookbook_dataset_configure_command? cookbook_dataset?.configure_command end
#¶ ↑
cookbook_dataset_flatpak_url?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 295 def cookbook_dataset_flatpak_url? cookbook_dataset?.flatpak_url end
#¶ ↑
cookbook_dataset_headers?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 457 def cookbook_dataset_headers? cookbook_dataset?.headers? end
#¶ ↑
cookbook_dataset_keep_extracted?¶ ↑
This method simply wraps over the cookbook_dataset
keep_extracted value.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13424 def cookbook_dataset_keep_extracted? cookbook_dataset?.keep_extracted? end
#¶ ↑
cookbook_dataset_libraries?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 18 def cookbook_dataset_libraries? cookbook_dataset?.libraries? end
#¶ ↑
cookbook_dataset_meson_configure_options?¶ ↑
This method will return all options used for the “meson” build system of the program at hand, should meson be used at all.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1431 def cookbook_dataset_meson_configure_options? cookbook_dataset?.meson_configure_options? end
#¶ ↑
cookbook_dataset_parameters_to_make?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13140 def cookbook_dataset_parameters_to_make? cookbook_dataset?.parameters_to_make? end
#¶ ↑
cookbook_dataset_postinstall?¶ ↑
Query from the cookbook-yaml file at hand whether we will run a postinstall-step or not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1314 def cookbook_dataset_postinstall?( i = cookbook_dataset? ) i and i.postinstall? end
#¶ ↑
cookbook_dataset_prefix?¶ ↑
This method name may be a slight misnomer, since class Prefix
may handle the prefix here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 674 def cookbook_dataset_prefix? if cookbook_dataset? cookbook_dataset?.prefix? else nil end end
#¶ ↑
cookbook_dataset_preinstall?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13548 def cookbook_dataset_preinstall? cookbook_dataset?.preinstall? end
#¶ ↑
cookbook_dataset_program_has_to_be_compiled?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12570 def cookbook_dataset_program_has_to_be_compiled? cookbook_dataset? and cookbook_dataset?.has_to_be_compiled? end
#¶ ↑
cookbook_dataset_program_path?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 442 def cookbook_dataset_program_path?( i = cookbook_dataset? ) if i i.local_path end end
#¶ ↑
cookbook_dataset_run_configure?¶ ↑
The program “manpages” is an example for a program that does not need to run configure.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13211 def cookbook_dataset_run_configure? cookbook_dataset?.run_configure? end
#¶ ↑
cookbook_dataset_set_configure_command
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9761 def cookbook_dataset_set_configure_command(i) case i # ======================================================================= # # === :meson # ======================================================================= # when :meson i = i.to_s end cookbook_dataset?.set_configure_command_to_use(i) end
#¶ ↑
cookbook_dataset_short_name?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 838 def cookbook_dataset_short_name? cookbook_dataset?.short_name?.to_s end
#¶ ↑
cookbook_dataset_use_this_build_system?¶ ↑
Query which build-system is to be used. This will determine how we will install a given program at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13460 def cookbook_dataset_use_this_build_system? cookbook_dataset?.use_which_build_system? end
#¶ ↑
cookbook_installation_steps?¶ ↑
The installation-steps contain the instructions in how to install a given program at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 261 def cookbook_installation_steps? cookbook_dataset?.installation_steps? end
#¶ ↑
cookbook_program_name_and_program_version?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1375 def cookbook_program_name_and_program_version? cookbook_dataset? and cookbook_dataset?.program_name_and_program_version? end
#¶ ↑
cookbook_program_version?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12502 def cookbook_program_version? cookbook_dataset? and cookbook_dataset?.program_version? end
#¶ ↑
cookbooks_binaries?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1497 def cookbooks_binaries? cookbooks_dataset?.binaries? end
#¶ ↑
cookbooks_dataset_configure_options?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1207 def cookbooks_dataset_configure_options? cookbook_dataset?.configure_options? end
#¶ ↑
cookbooks_dataset_use_glib_schema?¶ ↑
Whether our dataset uses glib install schema for some .xml files.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 322 def cookbooks_dataset_use_glib_schema? cookbook_dataset?.use_glib_schema end
#¶ ↑
copy_expanded_directory
¶ ↑
This method will copy the expanded cookbooks directory.
Invocation example:
rbt --copy-expanded-directory
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8810 def copy_expanded_directory source_directory = "#{project_yaml_dir?}expanded_cookbooks/" # ======================================================================= # # Designate the target directory to be used. # ======================================================================= # target_directory = expanded_cookbooks? # This will be e. g. '/home/Temp/rbt/expanded_cookbooks/'. if File.directory? source_directory orev 'Now copying from '+sdir(source_directory) orev "onto #{sdir(target_directory)}#{rev}." mkdir(target_directory) unless File.directory? target_directory # ===================================================================== # # Copy each individual .yml file next: # ===================================================================== # Dir["#{source_directory}*.yml"].each {|this_yaml_file| copy_file(this_yaml_file, target_directory) { :be_verbose } } else orev "No directory exists at `#{sdir(source_directory)}#{rev}`." end end
#¶ ↑
copy_headers_from
¶ ↑
This method will copy the registered headers from the given program at hand.
The first argument to this method is the path to the header files.
Invocation examples:
ry glibc --copy-headers-from=/usr/include ry glibc --copy-headers-to-pwd
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1859 def copy_headers_from(i) unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end to = return_pwd headers = headers? unless headers.empty? headers.each {|this_header| from = "#{i}#{this_header}" if this_header.include? '/' # ================================================================= # # In this case we must create such a subdirectory. # ================================================================= # dirname = File.dirname(this_header) unless File.directory? File.dirname(dirname) mkdir(dirname) end end orev 'Now trying to copy `'+sfile(from)+rev+'` to `'+ sfile(to+this_header)+"#{rev}`." copy_file(from, to+this_header) } end end
#¶ ↑
copy_ruby
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6917 def copy_ruby begin require 'roebe/toplevel_methods/setup.rb' Roebe.copy_setup_file_to_pwd rescue LoadError orev 'The method '+steelblue('Roebe.copy_setup_file_to_pwd()')+ "#{rev} is not available." orev "Please install the #{slateblue('roebe')} project:" e e ' gem install roebe' e end end
#¶ ↑
copy_source_archive_of_this_program_into_the_current_directory
¶ ↑
This method can be used to copy the source archive of the given input program at hand, into the current working directory.
Invocation examples:
ry --copy-source=php ry --copy-source=ruby
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10081 def copy_source_archive_of_this_program_into_the_current_directory(i) _ = load_yaml_dataset_for_this_program(i) stored_where = _.program_path? orev "#{steelblue('=>')} Copying "\ "#{sfile(stored_where)} #{rev}to "\ "#{sdir(return_pwd)}#{mediumpurple(File.basename(stored_where))}" copy_file(stored_where, return_pwd) end
#¶ ↑
copy_these_archives
¶ ↑
This method will copy the selected applications into the current working directory.
To invoke this method from the commandline, try:
rbt --copy-archives=kde5_plasma rbt --copy-archives=ruby
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10637 def copy_these_archives( i = :kde5_plasma ) if i.is_a? String i = i.split(',') if i.include? ',' end case i when :kde5_plasma, 'kde5_plasma' i = return_kde_plasma_components end i = [i].flatten.compact.reject {|entry| entry.strip.empty? }.map {|entry| try_to_find_an_alias_to_this_input_unless_the_program_exists(entry) } if i.empty? orev 'Please provide at the least one argument - the '\ 'directory that is to be copied.' else orev "Now copying #{i.size.to_s} entries into the "\ "local working directory:" i.each {|this_program| target_directory = source_dir?+this_program.downcase+'/' if File.directory? target_directory copy_directory(target_directory, :be_verbose) else orev "No directory exists at "\ "`#{sdir(target_directory)}#{rev}`." end } end end
#¶ ↑
copy_this_yaml_file
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6891 def copy_this_yaml_file( i = compile_which_program?, be_verbose = be_verbose? ) if is_registered? i orev "#{rev}Now copying the .yml file for #{steelblue(i)}" orev "into the current working directory." target_file = cookbook_directory?+i+'.yml' if File.exist? target_file opnn; copy_file(target_file) { :be_verbose } end else orev "Not a registered program: #{i}" end end
#¶ ↑
create_appdir_skeleton
¶ ↑
This method will create an AppDir skeleton, by delegating towards class RBT::Action::CreateAppDirSkeleton.new
, which is a registered action.
We will only do so if the prefix includes the AppDir base directory though. By default, that base directory would hold the value of the $PROGRAMS environment variable - at the least on my system, this defaults to /Programs/. You can change this value if you modify a yaml file though. That yaml file is called “programs_dir.yml” and resides in the yaml/configuration/ subdirectory of the RBT
project.
The method accepts one argument, which is either the program name, or alternatively the full name to the program in question.
Normally, the program name will be defined in the yaml data object, but since you can also overrule this setting in the yaml file, we need an argument here to allow this too.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 147 def create_appdir_skeleton( i = return_proper_prefix, uses_an_appdir_prefix = uses_an_appdir_prefix? ) if uses_an_appdir_prefix # ===================================================================== # # Check for an AppDir prefix next: # ===================================================================== # i = i.to_s.dup if i.include?(programs_dir?) unless i =~ /\d+/ i << program_version? end i << '/' unless i.end_with? '/' end # ===================================================================== # # Next, delegate towards class RBT::CreateAppDirSkeleton. Since as # of 20.01.2020 we will specify which programs should NOT modify # the old symlink, for the new 'Current →' symlink. Otherwise # compilation would fail, e. g. if /usr/bin/make would point to # a not-yet compiled target prefix. # ===================================================================== # # _ = action(:CreateAppDirSkeleton, [i.dup, :dont_run_yet]) {{ _ = action(__method__.to_sym, [i.dup, :dont_run_yet]) {{ use_colours: use_colours?, use_opn: use_opn?, do_not_symlink_these_programs: %i( make gcc binutils ) # ← An exception for these programs. }} _.no_opn unless use_opn? _.run_simulation = run_simulation? _.run end end
#¶ ↑
create_dependencies_file
¶ ↑
This method will create a Gobolinux
dependencies file.
To invoke it, do something like:
ry htop create_dependencies_file
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2800 def create_dependencies_file( create_where = rbt_log_directory?, required_deps_on = required_deps_on? ) action(:CreateDependenciesFile, [create_where, required_deps_on]) end
#¶ ↑
create_description_file
¶ ↑
Creates a Description file, for use in Gobolinux
systems.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4806 def create_description_file(create_where) if create_where.include? programs_directory? create_where = create_where.delete('-') end file_location = create_where+'Resources/Description' remove_file(file_location) if File.exist? file_location # Remove it if it already exists. append_what_into( dataset?.description?, file_location ) end
#¶ ↑
create_shell_scripts
(bash tag bashrc tag)¶ ↑
This method will convert the yaml dataset to bash scripts, so that the bash shell can make use this information as well.
To invoke this method, do something such as this:
ry --bash
To get the array content do this (after sourcing the file):
echo ${programs[*]}
#¶ ↑
cat /System/Settings/bash_programs_rc
#¶ ↑
cd /System/Settings/
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4140 def create_shell_scripts action(:create_bash_scripts) end
#¶ ↑
create_shellscript
(shell tag, script tag)¶ ↑
This is a wrapper over the class GenerateShellscript
.
It will return a string, which contains all the information to create a specific shell script.
The first argument to this method is the name of the program in question.
To invoke this method, do:
ry htop create_shellscript ry php cshell
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5905 def create_shellscript( program = compile_which_program?, save_into_a_file = true, display_result = false ) _ = GenerateShellscript.new( program, save_into_a_file, display_result ) return _.string? end
#¶ ↑
create_standalone_yaml_file
¶ ↑
This will create standalone yaml files.
Usage example:
ry htop --csyf
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4453 def create_standalone_yaml_file require 'rbt/cookbooks/create_cookbook_yaml_file/create_cookbook_yaml_file.rb' cliner { orev 'Dumping all available recipes next.' } store_here = RBT.configuration?.recipes_directory all_programs.each { |this_program| e sfancy("This program is: `")+simp(this_program)+sfancy('`.') initialize_cookbook_dataset_for(this_program) _ = RBT::Cookbooks::CreateCookbookYamlFile.new(this_program, :do_not_run_yet) _.store_where(store_here) _.run } cliner { orev sfancy('Finished dumping all Recipes into ')+ sdir(store_here) orev "#{N}There were: #{sfancy(all_programs.size.to_s)} of them.#{N}" } end
#¶ ↑
create_the_build_directory_then_cd_into_it
¶ ↑
Note that we will only cd into the directory if we actually use a build directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 437 def create_the_build_directory_then_cd_into_it( i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY, &block ) if use_build_directory? # ===================================================================== # # === Handle blocks next # ===================================================================== # if block_given? yielded = yield case yielded # =================================================================== # # === :be_verbose # =================================================================== # when :be_verbose orev "Changing directory into "\ "#{sdir(absolute_path(i))} "\ "#{rev}next," orev "thus honouring the #{steelblue('use-build-directory')} "\ "#{rev}setting." end end create_the_build_directory(i) cd i end end
#¶ ↑
create_yaml_file_for_this_program
¶ ↑
This method will expand a raw cookbook into an expanded cookbook, using the appropriate action.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12439 def create_yaml_file_for_this_program( i = compile_which_program? ) e opnn; action(:expand_this_cookbook, i) e end
#¶ ↑
dataset_from_the_file_cookbook_chained_programs?¶ ↑
This query-method obtains the dataset from the yaml file containing all chained-programs.
The alias-name .chained_programs?() makes accessing this information even simpler.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1169 def dataset_from_the_file_cookbook_chained_programs? @internal_hash[:dataset_from_the_file_cookbook_chained_programs] end
#¶ ↑
dataset_program_name_and_program_version?¶ ↑
This method will always return the program name and the associated program version of any given program, such as:
"htop-2.0.2"
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 241 def dataset_program_name_and_program_version?( cookbook_dataset = cookbook_dataset? ) if cookbook_dataset cookbook_dataset.program_name_and_program_version? # Delegate to cookbook_for? here. else nil end end
#¶ ↑
decide_whether_to_invoke_autogen
¶ ↑
Invoke autogen.sh if specified so, and only if the file autogen.sh actually exists.
There may be some situations where it does not make sense to invoke autogen, such as when the build type specifically tells us to use meson.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6563 def decide_whether_to_invoke_autogen( _ = FILE_AUTOGEN ) if use_autogen? if uses_the_meson_build_system? opne crimson('The value for autogen is set to ')+ royalblue('true')+ crimson(', meaning "do use autogen".') opne crimson('The .yml file specifies to use the meson-build system, though.') opne crimson('Autogen is only useful for GNU configure based system, so') opne crimson('autogen is set to false for this run - thus, not making '\ 'use of autogen.') e opne crimson('If you need autogen, consider changing '\ 'the information in the') opne crimson('.yml file ')+ sfile("#{compile_which_program?}.yml")+ crimson('.') e opne 'Do note that this behaviour may be changed at a later time.' disable_autogen end if File.exist?(_) do_use_autogen # This is the do-action that invokes autogen.sh end end end
#¶ ↑
decide_whether_to_invoke_the_autoconf_command
¶ ↑
Whether to run “autoconf” or whether we will not. Only very few programs will need this.
Note that the invocation of autoconf must happen AFTER the pre-installation step has finished, and after checking whether sed must be used or whether sed is not needed. Afterwards, we can then check whether we will use a build directory, and whether we must use another prefix.
A program that may require this is “bridgeutils”.
Invocation example:
ry bridgeutils
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9466 def decide_whether_to_invoke_the_autoconf_command if use_autoconf? do_invoke_autoconf end end
#¶ ↑
delete¶ ↑
This method is similar to the method .delete() for class Hash. The method here will only return the value, though, and NOT delete anything - while this behaviour is, strictly speaking, not the same as for class Hash, there does not seem to be a big reason as to why the information should be deleted from an instance of class RBT::Action::SoftwareManager
.
In other words: .delete() here is mostly a compatibility method, in order to “fake-simulate” behaviour that a Hash would normally show.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8151 def delete(this_key) case this_key # ======================================================================= # # === :prefix # ======================================================================= # when :prefix prefix?.to_s # ======================================================================= # # === :program_version # ======================================================================= # when :program_version program_version?.to_s # ======================================================================= # # === :description # # This is actually a pointer towards the short description, since # it is used primarily for autogenerating pkgconfig files. # ======================================================================= # when :description short_description?.to_s end end
#¶ ↑
delete_libtool_files?¶ ↑
Query whether we will delete .la files or whether we will not. If we will not, then any installed .la files will be removed.
Note that this will ONLY be honoured if compilation was a success AND we use an AppDir path as prefix - so .la files that are installed under /usr/lib/ will not be removed, ever.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11347 def delete_libtool_files? if @internal_hash[:keep_la_files] !@internal_hash[:keep_la_files] else RBT.configuration?.delete_libtool_files end end
#¶ ↑
depends_on_cmake?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1135 def depends_on_cmake? RBT.depends_on_cmake?(required_deps_on?) end
#¶ ↑
deregistering_from_the_status_file
¶ ↑
De-register the program that we are currently compiling from the status file again.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9672 def deregistering_from_the_status_file( use_this_key = 'currently_compiling_these_programs' ) into = RBT.file_status dataset = {} if File.exist? into dataset.merge!(YAML.load_file(into)) end if dataset.has_key? use_this_key _ = dataset[use_this_key] if _.include? compile_which_program? dataset[use_this_key] = dataset[use_this_key].reject {|line| line == compile_which_program? } what = YAML.dump(dataset) write_what_into(what, into) end end end
#¶ ↑
determine_the_build_system_in_use_and_consider_syncing_this_back_onto_the_cookbook_dataset
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14392 def determine_the_build_system_in_use_and_consider_syncing_this_back_onto_the_cookbook_dataset _ = build_system? case _ # ======================================================================= # # === :infer_automatically # ======================================================================= # when :infer_automatically _ = action(:infer_build_system) end cookbook_dataset?.set_build_system(_) end
#¶ ↑
determine_the_configure_base_directory_to_use
¶ ↑
This method can be used to determine the full path to the configure base directory to be used.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4725 def determine_the_configure_base_directory_to_use( target = extract_to_this_dir?.dup+ yaml_dataset?.program_name_and_program_version?+ '/'+ cookbook_dataset_configure_base_directory?.to_s ) set_configure_base_directory(target) end
#¶ ↑
determine_the_program_path
¶ ↑
This method will determine the (internal) program path that is to be used, that is - the path to finding the program on the local harddisc.
A word about the variable use_this_as_short_name:
Since as of September 2019 we will also remove ‘.’ characters, so that programs such as “ruamel.yaml” can reside in a directory called “ruamelyaml”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3121 def determine_the_program_path use_this_as_short_name = yaml_dataset?.program_short_name?.dup.downcase. delete('-.') use_this_as_short_name.delete!('_') value = source_directory?+ use_this_as_short_name+ '/'+ yaml_dataset?.program_name_and_program_version?+ yaml_dataset?.archive_type? set_program_path(value) end
#¶ ↑
determine_which_compiler_will_be_used
¶ ↑
This method currently will only check if the clang-compiler is used.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10095 def determine_which_compiler_will_be_used case use_which_compiler? when 'clang' do_use_clang_compiler(:be_quiet) end end
#¶ ↑
disable_ccache
¶ ↑
Use this method to temporarily disable ccache, that is - for the current run. If you do not want to use ccache at all, simply set the content of the corresponding .yml file to false.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13399 def disable_ccache @internal_hash[:use_ccache] = false end
#¶ ↑
disable_colours
(colours tag)¶ ↑
Disable colours with this method. This will not be permanent, it will be valid only for the running instance (this object). If you want to permanently disable colours, use:
rbt_config --disable-colours
To use this specific method here, do something like this:
ry htop disablecolours
Remember that you can chain together instructions, so:
ry htop disablecolours ntrad
Would compile in an appdir-like fashion, without using any colours.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10156 def disable_colours( be_verbose = be_verbose? ) RBT.disable_colours # ← Defined in rbt/colours/colours.rb disable_colours # This one is defined in base.rb. if be_verbose orev 'We will not use any colours.' end end
#¶ ↑
disable_md5sum_calculation
¶ ↑
This method here can be used to disable the md5sum calculation altogether.
Invocation example:
ry htop --no-md5sum
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9138 def disable_md5sum_calculation orev 'We will not calculate the md5sum of an archive. This '\ 'should speed up' orev "things a little bit, in particular for very "\ "large files." action(:disable_md5sum_calculation) end
#¶ ↑
disable_opn
¶ ↑
Use this method to stop reporting any program names.
To trigger this, try one of these usage examples:
ry php noopn ry htop nonames
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2053 def disable_opn orev 'We will not use Opn (class name output, aka output-program-name)' RBT.do_not_show_the_classname @internal_hash[:use_opn] = false end
#¶ ↑
disable_static_compilation
¶ ↑
Use this method to disable static compilation.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10224 def disable_static_compilation( be_verbose = :be_verbose ) case be_verbose when :be_verbose be_verbose = true when :do_not_be_verbose be_verbose = false end if be_verbose orev 'Disabling static compilation.' end @internal_hash[:build_static] = false if cflags?.include? '-static' set_cflags(cflags?.dup.sub(/-static/,'')) end end
#¶ ↑
display_postinstall_dataset
¶ ↑
This method will display the postinstall actions that will be done for the given program at hand.
Invocation examples:
ry perl p? ry docbookxsl --display_postinstall ry libraw1394 --postinstallation_steps? ry bash --postinstallation_steps? ry vte --postinstallation_steps? ry lighttpd --postinstallation_steps?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1533 def display_postinstall_dataset result = cookbook_dataset_postinstall? compile_this_program = compile_which_program? compile_this_program = first_argument? if compile_this_program.nil? ensure_proper_dataset_for(compile_this_program) if result.nil? result = cookbook_dataset_postinstall? if result.nil? unless result.empty? orev "The postinstall instructions "\ "for `#{royalblue(program?)}#{rev}` are:" result = [result].flatten.compact # ← We need an Array past this point. e result.each {|entry| # e e " #{yellowgreen(entry)}" # Display with a slight padding. # e } e orev 'Also assigning the above result to the xorg buffer.' set_xorg_buffer(result.join(N)) end if result end
#¶ ↑
display_the_oldest_programs
¶ ↑
This method will report, on the commandline, the oldest programs.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5923 def display_the_oldest_programs require 'rbt/cookbooks/show_last_updated.rb' RBT::Cookbooks::ShowLastUpdated.new('--sort-by-oldest') end
#¶ ↑
do_check_for_binary_duplicates
¶ ↑
If you wish to check for binary-duplicates under /usr/bin/, then this method may be helpful to you.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4963 def do_check_for_binary_duplicates target_dir = :default # ======================================================================= # # The next line of code handles the situation when we are in the # directory /usr/sbin/, and when we are on a roebe-system (aka at home). # ======================================================================= # if is_on_roebe? and (return_pwd == '/usr/sbin/') target_dir = '/usr/sbin/' end array = RBT.array_binary_duplicates(:default, target_dir) if array.empty? target_dir = '/usr/bin/' if target_dir == :default orev "No duplicates appear to exist under the "\ "#{sdir(target_dir)} #{rev}hierarchy." else orev 'The following duplicates were found:' e array.each {|entry| e " #{sfile(entry.ljust(40))}" } end end
#¶ ↑
do_compile_all_available_local_version_of_this_program
¶ ↑
Invocation example:
ry libsigc++ --compile-all-available-local-versions
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 558 def do_compile_all_available_local_version_of_this_program( i = compile_which_program? ) orev "Checking for the locally available versions "\ "of the program #{sfancy(i)} #{rev}next." target_directory = source_dir?+ i.downcase+'/' e orev "We will check at the directory `#{sdir(target_directory)}`." e matches = Dir[target_directory+'*'] if matches.empty? orev 'No result was found at the directory `'+ sdir(target_directory)+"#{rev}`." orev 'This usually indicates that the '\ 'directory does not exist - or is empty.' else matches.each {|entry| orev 'Working on the entry `'+sfancy(entry)+rev+'` next.' entry = remove_archive_at_the_end(entry) basename = File.basename(entry) program_name = program_information_return_program_name(basename) program_version = program_information_return_version(basename) reset set_compile_this_program(program_name) initialize_dataset_for_this_program(program_name) set_program_version(program_version) do_compile_this_program(program_name) { :do_not_initialize_the_dataset } } end end
#¶ ↑
do_compile_all_of_mate
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3810 def do_compile_all_of_mate i = RBT.returned_chained_programs_of_the_mate_desktop orev "We will compile all #{sfancy(i.size.to_s)} #{rev}programs "\ "of the mate-desktop." set_compile_these_programs(i) end
#¶ ↑
do_compile_in_a_non_traditional_way
¶ ↑
We enable Gobolinux-style compilation here, as in AppDir-like compilation.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7722 def do_compile_in_a_non_traditional_way( program_name_and_program_version = program_name_and_program_version?, be_verbose = be_verbose? ) if cookbook_dataset?.nil? load_cookbook_dataset_for(compile_which_program?) end if can_we_continue? case program_name_and_program_version when :be_silent, :be_quiet be_verbose = false program_name_and_program_version = program_name_and_program_version? end case be_verbose when :be_silent, :be_quiet be_verbose = false end if be_verbose orev 'Overruling any potential traditional setting.' end @internal_hash[:counter_called_traditional_or_non_traditional_compilation] += 1 # ensure_that_a_cookbook_object_has_been_instantiated _ = real_prefix?.do_use_appdir_prefix_from_this_input( program_name_and_program_version? ) # set_user_prefix(:ntrad) @internal_hash[:shall_we_use_an_appdir_prefix] = true set_use_this_prefix(_) orev "Enabling #{steelblue('AppDir prefix')}#{rev}." # enable_non_traditional_compilation( # program_name_and_program_version # ) end end
#¶ ↑
do_compile_in_a_traditional_way
¶ ↑
Use this method when you want to use ‘/usr/’ as the main prefix of compilation.
Usage example:
ry php --trad
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5479 def do_compile_in_a_traditional_way( be_verbose = true, can_we_continue = can_we_continue? ) if can_we_continue @internal_hash[:we_tried_to_compile_this_program_n_times] += 1 if be_verbose orev 'Using a "'+sfancy(:traditional)+rev+ '" strategy for compilation '\ '(which means prefix '+sdir('/usr/')+ "#{rev})." end set_user_prefix '/usr/' # Specify a user-prefix here. end end
#¶ ↑
do_compile_in_both_traditional_and_non_traditional_manner
¶ ↑
This method combines both main strategies for compilation - first, into the /usr/ prefix, and then into the appdir prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6983 def do_compile_in_both_traditional_and_non_traditional_manner orev 'We will first compile in the traditional way, and then after that' orev 'we will compile in the non-traditional (appdir) way.' do_compile_in_a_traditional_way # First, compile in a traditional way. @internal_hash[:extra_compilation] = true end
#¶ ↑
do_compile_libstdc_plus_plus
¶ ↑
This method will compile/install libstdc++, which is part of GCC.
To invoke this method try:
ry --install-libstdc++
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5387 def do_compile_libstdc_plus_plus set_compile_these_programs :gcc opne steelblue('libstdc++')+', from GCC, will be installed next.' opne royalblue('1')+') The GCC-archive of GCC will be extracted first.' dataset = return_dataset_for_this_program(compile_which_program?) path = dataset.path? gcc_version = dataset.program_version? if File.exist? path orev 'Extracting '+sfile(path)+' to '+sdir(log_dir?)+'.' extract_what_to(path, log_dir?) # ===================================================================== # # cd into the right target: # ===================================================================== # target = log_dir?+cookbook_dataset_program_name_and_program_version?+'/libstdc++-v3/' orev royalblue('2')+') cd to the target directory at '+sdir(target)+' next.' cd(target) opne royalblue('3')+') create the build directory, then cd into it next.' mkdir 'BUILD_DIRECTORY' cd 'BUILD_DIRECTORY' orev royalblue('4')+') Running configure, then "make", then "make install" next.' # ===================================================================== # # Find out the prefix that we wish to use (required for a cd-action # lateron. # ===================================================================== # use_this_prefix = rds( programs_dir?+'Libstdc++/'+gcc_version+'/' ) cmd = ( '../configure '\ '--prefix='+use_this_prefix+' --disable-multilib --disable-nls --disable-libstdcxx-threads --disable-libstdcxx-pch' ).squeeze(' ').gsub(/\n/,' ').squeeze(' ') e e steelblue(cmd) e run_this_system_command_in_a_coloured_and_padded_manner(cmd) run_make_then_make_install RBT.to_current(use_this_prefix) cd use_this_prefix rnsymc end end
#¶ ↑
do_compile_the_perl_addons
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9431 def do_compile_the_perl_addons( i = chained_programs?['perl_addons'] ) array = i.reject {|entry| entry == 'perl' } orev "Installing various registered perl-addons (#{array.size}) next." set_compile_these_programs(array) we_will_not_try_to_determine_which_programs_have_to_be_installed end
#¶ ↑
do_compile_this_registered_program
(main tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 360 def do_compile_this_registered_program(i) clear_the_original_cookbook_dataset initialize_cookbook_dataset_for(i) # ======================================================================= # # First check if the user wants to ensure a specific licence - this # can only come once the dataset has been initialized: # ======================================================================= # if check_for_this_licence? unless licence? == check_for_this_licence? opne "#{tomato('The licences do not match. ')}#{rev}Expected licence" orev 'was: '+ steelblue( RBT.sanitize_this_licence(check_for_this_licence?) )+", specified licence was: #{steelblue(licence?)}" return end end # ======================================================================= # # === Check whether ccache exists # # Query for the use and availability of ccache. This should come # after any special environment was set. # ======================================================================= # if use_ccache? and !is_ccache_available? notify_the_user_that_ccache_is_not_available end # ======================================================================= # # Next show the infobox: # ======================================================================= # infobox_for(i) local_path = cookbook_dataset?.local_path? notify_the_user_as_to_which_program_will_be_compiled_or_installed_next( i, local_path ) # ======================================================================= # # Must check whether this file also exists next: # ======================================================================= # if File.exist? local_path # ===================================================================== # # First, check whether we have to remove the old, extracted directory: # ===================================================================== # to = "#{extract_to_this_directory?}"\ "#{program_name_and_program_version?}" to = rds(to).dup if File.directory?(to) and !(to == '/') orev 'Removing the old, extracted directory at' orev "`#{sdir(to)}#{rev}` next." remove_directory(to) end orev "Now extracting the archive, at `#{sfile(local_path)}#{rev}`." orev 'The extracted directory will be located at' orev '`'+sfile(to)+"#{rev}`," orev 'if the extraction-step worked properly.' # ===================================================================== # # Extracting the archive next: # ===================================================================== # extract_what_to(local_path, File.dirname(to)) orev lightsalmon('The extraction-step has finished.') if File.directory? to orev "Entering the directory at #{sdir(to)}#{rev} now." cd_to_the_extracted_archive(to) run_the_equivalent_configure_like_stage_for_this_program(i) else orev 'No directory was found at `'+sdir(to)+"#{rev}`." end else opnn; no_file_exists_at(local_path) end end
#¶ ↑
do_create_a_slackware_package
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5855 def do_create_a_slackware_package( i = return_pwd ) require 'rbt/linux/slackware/create_slackware_package.rb' this_program = File.basename(i) if this_program.include? '-' this_program = program_information_return_name(this_program) end RBT::CreateSlackwarePackage.new(this_program) { :do_not_autoinstall } end
#¶ ↑
do_enable_static_compilation
¶ ↑
Enable static compilations.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13348 def do_enable_static_compilation @internal_hash[:build_static] = true end
#¶ ↑
do_extensively_report_the_build_statistics
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7010 def do_extensively_report_the_build_statistics report_the_compile_strategies # ======================================================================= # # Since as of July 2020 we will also show how many files are tracked. # ======================================================================= # action(:show_how_many_files_are_tracked) end
#¶ ↑
do_handle_the_post_installation_steps
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 669 def do_handle_the_post_installation_steps if appdir_prefix? and can_we_continue? _ = appdir_prefix_points_at? orev "Trying to update or create the #{steelblue('Current')}"\ "#{rev} symlink next." action(:ToCurrent, _) # Run ToCurrent here. orev 'Trying to symlink various entries from '+steelblue(_)+rev+' next.' if force_symlinks_when_appdir_prefix_is_used? action(:symlink_from_to_current2, _) # Run SymlinkFromToCurrent here. else action(:symlink_from_to_current, _) # Run SymlinkFromToCurrent here. end consider_to_run_ldconfig end end
#¶ ↑
do_include_clang_for_the_llvm_compilation
¶ ↑
Here we have to do four steps in particular - extract two programs into the extracted directory of LLVM.
The code below is not very elegant and quite hackish; I simply wanted to finish this on the same day as I had this idea, which was on 09.09.2020. At a later point this should be cleaned up.
Invocation examples:
ry llvm --include-clang-for-compilation ry llvm --compile-clang
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6643 def do_include_clang_for_the_llvm_compilation # ======================================================================= # # First, we must extract LLVM. # ======================================================================= # initialize_dataset_for(:llvm) extracted_to = extract(cookbook_dataset_program_path?)+ cookbook_dataset_program_name_and_program_version? cd extracted_to # cd into that directory. initialize_dataset_for(:clang) extract_what_to(cookbook_dataset_program_path?, return_pwd+'tools') rename( 'tools/'+cookbook_dataset_program_name_and_program_version?, 'tools/clang' ) initialize_dataset_for(:compilerrt) extract_what_to(cookbook_dataset_program_path?, return_pwd+'compiler-rt') # ======================================================================= # # First, we must extract LLVM. # ======================================================================= # initialize_dataset_for(:llvm) create_build_directory_then_cd_into_it set_this_env_variable 'CC=gcc' set_this_env_variable 'CXX=g++' # ======================================================================= # # The next cmake-line is a hack - at a later point we should clean this # up. # ======================================================================= # cmd = 'cmake -DCMAKE_INSTALL_PREFIX='+appdir_prefix?(:llvm)+' -DLLVM_ENABLE_FFI=ON -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_LLVM_DYLIB=ON -DLLVM_LINK_LLVM_DYLIB=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_TARGETS_TO_BUILD="host;AMDGPU;BPF" -DLLVM_BUILD_TESTS=ON -Wno-dev -G Ninja ..'.delete(N). squeeze(' ') run_this_system_command_in_a_coloured_and_padded_manner(cmd) do_run_ninja do_run_ninja_install rnsymc(appdir_prefix?(:llvm)) exit_program end
#¶ ↑
do_install_only_the_headers
¶ ↑
This method will only intall the headers of a program. You must call the method action_install_only_headers
() for real action.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14476 def do_install_only_the_headers( of_this_program = compile_these_programs?.first ) do_not_compile do_not_run_configure disable_logging # We dont want to log. orev "Installing only headers for the program `"\ "#{sfancy(of_this_program)}#{rev}` now." @internal_hash[:install_only_the_headers] = true end
#¶ ↑
do_install_these_programs
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 883 def do_install_these_programs( i = compile_which_program? ) [i].flatten.compact.each {|this_program| try_to_install_this_program(this_program) } end
#¶ ↑
do_invoke_autoconf
¶ ↑
This variant invokes autoconf without any additional check.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11107 def do_invoke_autoconf cmd = 'autoconf' # " #{SHELL_ERROR_CODE}" cliner orev "Doing `#{teal(cmd)}#{rev}` in the directory" orev "#{sdir_return_pwd}" orev 'using this command next:' orev N orev sfancy(" #{cmd}") orev N cliner `#{cmd}` end
#¶ ↑
do_keep_la_files
¶ ↑
Use this method if you wish to keep the libtool .la files. This may sometimes be necessary, even though libtool .la files are a fairly bad solution altogether.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 959 def do_keep_la_files @internal_hash[:keep_la_files] = true end
#¶ ↑
do_not_check_whether_the_program_exists
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6910 def do_not_check_whether_the_program_exists @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = false end
#¶ ↑
do_not_compile
¶ ↑
This method can be invoked to set the :continue_after_configure_step entry in the internal hash to false.
If set to false then we will NOT compile a program. Instead, we will run the configure script and quit after having done so.
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14454 def do_not_compile( be_verbose = be_verbose? ) case be_verbose when :be_quiet be_verbose = false end if be_verbose orev 'We will not continue after the '+ steelblue('configure phase')+rev+'.' end @internal_hash[:continue_after_configure_step] = false @internal_hash[:do_not_compile] = true set_do_not_symlink(be_verbose) # So we don't run advanced symlink. end
#¶ ↑
do_not_continue_after_configure_step
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8250 def do_not_continue_after_configure_step @internal_hash[:continue_after_configure_step] = false end
#¶ ↑
do_not_display_the_flexbox
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12054 def do_not_display_the_flexbox @internal_hash[:show_the_flexbox] = false end
#¶ ↑
do_not_run_configure
¶ ↑
Do not run the configure script. Since Jan 2012 we also disable running ldconfig in this method.
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2876 def do_not_run_configure( be_verbose = true ) if be_verbose orev 'We will not compile - or run any configure script.' end do_not_run_the_configure_script do_not_use_ldconfig no_postinstall_actions end
#¶ ↑
do_not_run_configure_script
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2890 def do_not_run_configure_script @internal_hash[:run_configure_script] = false end
#¶ ↑
do_not_run_make_install
¶ ↑
Use this method if you wish to specifically skipping the “make install” step.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 894 def do_not_run_make_install( be_verbose = false ) @internal_hash[:run_make_install] = false if be_verbose orev 'We will not run the "'+slateblue('make install')+ rev+'" command.' end # ======================================================================= # # Running ldconfig seems pointless, so it is also disabled (silently). # ======================================================================= # do_not_use_ldconfig(:do_not_be_verbose) end
#¶ ↑
do_not_strip_binaries
?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 742 def do_not_strip_binaries? !strip_binaries? end
#¶ ↑
do_not_strip_the_binaries
¶ ↑
This is the non-verbose variant to disable stripping of binaries.
If you need the verbose variant, use the method called verbose_do_not_strip_the_binaries
() instead.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3166 def do_not_strip_the_binaries @internal_hash[:strip_binaries] = false end
#¶ ↑
do_not_symlink_header_files
¶ ↑
This will disable symlinking the header files. By default, we will not be verbose and thus do not output anything to the user.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9016 def do_not_symlink_header_files @internal_hash[:symlink_headers] = false end
#¶ ↑
do_not_symlink_in_general_and_also_do_not_symlink_header_files
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8635 def do_not_symlink_in_general_and_also_do_not_symlink_header_files set_do_not_symlink do_not_symlink_header_files end
#¶ ↑
do_not_try_to_autofix
¶ ↑
This method will specifically disable any attempts to try to autofix libtool-related problems. It is currently silent, all of the time.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10013 def do_not_try_to_autofix @internal_hash[:try_to_autofix] = false end
#¶ ↑
do_not_use_a_build_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13284 def do_not_use_a_build_directory(&block) if block_given? yielded = yield case yielded # ===================================================================== # # === :be_verbose # ===================================================================== # when :be_verbose orev 'We will not use a build directory.' end end @internal_hash[:use_build_directory] = false end
#¶ ↑
do_not_use_a_prefix
¶ ↑
Do not use any prefix in general, no matter whether we will use GNU configure, meson/ninja, cmake or any other build system..
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9152 def do_not_use_a_prefix orev 'No '+steelblue('--prefix')+rev+' option will be used.' @internal_hash[:use_a_prefix] = false end
#¶ ↑
do_not_use_any_compile_time_flags
¶ ↑
If you do not want to use any compile-time flags, aka CFLAGS, then you can use this method here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6454 def do_not_use_any_compile_time_flags orev 'Setting compile-time flags ('+ royalblue('CFLAGS')+', '+ royalblue('LDFLAGS')+ ') to empty.' set_cflags('') end
#¶ ↑
do_not_use_any_configure_option
¶ ↑
This option allows us to avoid using any configure option.
Invocation example from the commandline:
ry htop --dont-use-configure-options
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14372 def do_not_use_any_configure_option( be_verbose = be_verbose?, &block ) if block_given? be_verbose = yield end case be_verbose when :be_verbose, true # ===================================================================== # # Be verbose in this case. # ===================================================================== # orev 'No configure options will be used for this run.' end @internal_hash[:try_to_use_configure_options] = false end
#¶ ↑
do_not_use_cookbook_aliases
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8996 def do_not_use_cookbook_aliases( be_verbose = :be_verbose ) case be_verbose # ======================================================================= # # === :be_verbose # ======================================================================= # when :be_verbose, true orev 'Disabling cookbook aliases for this run.' end @internal_hash[:make_use_of_the_cookbook_aliases] = false end
#¶ ↑
do_not_use_ldconfig
¶ ↑
Use only this method when you wish to disable running ldconfig.
To set this, do something like:
ry htop do_not_use_ldconfig
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5805 def do_not_use_ldconfig( be_verbose = be_verbose? ) case be_verbose # ======================================================================= # # === :do_not_be_verbose # ======================================================================= # when :do_not_be_verbose, :be_silent be_verbose = false end if be_verbose opne "#{rev}We will not run `#{teal('ldconfig')}#{rev}`." end RBT.configuration?.run_ldconfig = false end
#¶ ↑
do_not_use_sed
¶ ↑
Disable the use of sed through this method.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13529 def do_not_use_sed( be_verbose = false ) case be_verbose # ======================================================================= # # === :be_verbose # ======================================================================= # when :be_verbose be_verbose = true end if be_verbose orev "We will not be using #{lightgreen('sed')}#{rev}." end @internal_hash[:sed] = false end
#¶ ↑
do_perform_an_intelligent_bootstrap
¶ ↑
Usage example:
rbt --intelligent-bootstrap
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8663 def do_perform_an_intelligent_bootstrap begin require 'environment_information' rescue LoadError; end orev 'Attempting to perform an '+ steelblue('intelligent bootstrap operation next')+"#{rev}." if Object.const_defined? :EnvironmentInformation EnvironmentInformation.initialize array_of_outdated_programs = EnvironmentInformation.return_array_of_outdated_programs # ===================================================================== # # Now that we have these programs, we must sort them based on # filesize. # ===================================================================== # array_of_outdated_programs = array_of_outdated_programs.sort_by {|this_program| result = 1_000_000 # Use a bogus entry here, to sort it towards the bottom. target_yaml_file = ::RBT.path_to_expanded_directory?+this_program.to_s+'.yml' if File.exist? target_yaml_file dataset = YAML.load_file(target_yaml_file) if dataset.has_key? 'archive_size' result = dataset['archive_size'] end end result } array_of_outdated_programs.each {|this_program| orev "Now compiling #{steelblue(this_program)}#{rev}." action(:Installer, this_program) } end end
#¶ ↑
do_perform_simplified_bzip_installation
¶ ↑
Invocation example:
ry --simple-bzip
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4152 def do_perform_simplified_bzip_installation ensure_that_the_cookbook_dataset_exists(:bzip2) _ = cookbook_dataset_manual_steps?.lstrip.split("\n").reject {|line| line.to_s.strip.empty? or line.to_s.start_with?('#') } program_path = program_path? orev 'Extracting the archive at '+sfile(program_path)+"#{rev} next." location = extract_what_to(program_path) { :be_verbose }.extract_to?+ File.basename(program_path) location = remove_archive_from_the_end(location) if File.directory? location cd(location) if _.any? {|line| line.start_with?('Or the AppDir variant') } new_index = _.find_index {|line| line.start_with?('Or the AppDir variant') } _ = _[0, new_index] end _.each {|entry| esystem(entry) { :do_colourize } } end end
#¶ ↑
do_permanently_disable_ccache
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8725 def do_permanently_disable_ccache( into = FILE_CCACHE, what = "false\n" ) write_what_into(what, into) orev "Permanently disabling the use of ccache "\ "(Stored into this file: `#{sfile(into)}#{rev}`)." if is_on_roebe? into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\ "#{File.basename(into)}" write_what_into(what, into) orev "Permanently disabling the use of ccache "\ "(Stored into this file: `#{sfile(into)}#{rev}`)." end end
#¶ ↑
do_permanently_disable_the_colours
¶ ↑
This method can be used to permanently disable the colours.
Invoke this method by issuing:
ry --permanent-no-colours
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4225 def do_permanently_disable_the_colours orev 'Now permanently disabling the colours.' configuration?.use_colours = false what = false into = RBT.file_use_colours write_what_into(what, into) if is_on_roebe? into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+ File.basename(into) orev "Also storing in `#{sfile(into)}#{rev}`." write_what_into(what, into) end end
#¶ ↑
do_permanently_enable_ccache
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7367 def do_permanently_enable_ccache( into = FILE_CCACHE, what = "true\n" ) write_what_into(what, into) orev "Permanently enabling the use of ccache "\ "(Stored into this file: `#{sfile(into)}#{rev}`)." if is_on_roebe? into = "#{RUBY_SRC_DIRECTORY}rbt/lib/rbt/yaml/configuration/"\ "#{File.basename(into)}" write_what_into(what, into) orev "Permanently enabling the use of ccache "\ "(Stored into this file: `#{sfile(into)}#{rev}`)." end end
#¶ ↑
do_permanently_enable_the_colours
¶ ↑
This method can be used to permanently enable the colours.
Invoke this method by issuing:
ry --permanent-enable-colours
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4788 def do_permanently_enable_the_colours orev 'Now permanently enable the colours.' configuration?.use_colours = true into = RBT.file_use_colours write_what_into(false, into) if is_on_roebe? into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+ File.basename(into) orev "Also storing in `#{sfile(into)}#{rev}`." write_what_into(true, into) end end
#¶ ↑
do_permanently_use_clang
¶ ↑
This method will permanently enable clang, the compiler, on a project-wide default.
Invocation example:
ry --do-permanently-use-clang
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9953 def do_permanently_use_clang configuration?.use_this_compiler = :clang configuration?.do_save end
#¶ ↑
do_permanently_use_psych
¶ ↑
Use this method if you wish to permanently use psych, rather than syck.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3284 def do_permanently_use_psych orev 'We will use the psych module for yaml-datasets from now on.' orev 'This will be stored in the file '+sfile(FILE_USE_PSYCH_OR_SYCK) write_what_into(YAML.dump(:psych), FILE_USE_PSYCH_OR_SYCK) if is_on_roebe? write_what_into(YAML.dump(:psych), ROEBE_PATH_TO_COOKBOOKS+'yaml/configuration/'+ File.basename(FILE_USE_PSYCH_OR_SYCK) ) end end
#¶ ↑
do_permanently_use_syck
¶ ↑
Use this method if you wish to permanently use syck, rather than psych.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2259 def do_permanently_use_syck orev 'We will use the syck module for yaml-datasets from now on.' orev "This will be stored in the "\ "file #{sfile(FILE_USE_PSYCH_OR_SYCK)}" write_what_into(YAML.dump(:syck), FILE_USE_PSYCH_OR_SYCK) if is_on_roebe? write_what_into(YAML.dump(:syck), "#{ROEBE_PATH_TO_COOKBOOKS}yaml/configuration/"+ File.basename(FILE_USE_PSYCH_OR_SYCK) ) end end
#¶ ↑
do_remove_the_extracted_archive
¶ ↑
This is the method that will remove the extracted archive again. Only invoke it when we are absolutely certain that the archive has to be extracted.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 539 def do_remove_the_extracted_archive _ = remove_archive_stuff_from_the_end( extract_where_to?+ File.basename(program_path?.to_s) ) if File.directory?(_) and remove_the_extracted_archive? orev "Next, the directory at `#{sdir(_)}#{rev}` will be removed." remove_directory(_) end end
#¶ ↑
do_run_GNU_configure_then_make_then_make_install
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 649 def do_run_GNU_configure_then_make_then_make_install( use_this_configure_command = use_this_build_system? ) run_traditional_GNU_configure run_premake_make_then_make_install end
#¶ ↑
do_set_keep_extracted
¶ ↑
This delegates towards the method set_keep_the_extracted_archive
and may also report to the end-user as to what is being done.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11886 def do_set_keep_extracted( be_verbose = be_verbose? ) case be_verbose # ======================================================================= # # === :be_silent # ======================================================================= # when :be_silent, :be_quiet be_verbose = false end if be_verbose orev 'The extracted directory will not be removed '\ 'after compilation / installation has finished.' end set_keep_the_extracted_archive end
#¶ ↑
do_skip_extracting
¶ ↑
Not every archive has to be extracted. For example, .gem files do not have to be extracted.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7003 def do_skip_extracting @internal_hash[:skip_extracting] = true end
#¶ ↑
do_skip_the_postinstallation_step
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11499 def do_skip_the_postinstallation_step @internal_hash[:run_postinstall_actions] = false end
#¶ ↑
do_store_the_configure_options_that_were_used_into_a_markdown_file
¶ ↑
This method is only invoked for an AppDir program. It will store the configure options, but not the full configure command; for that another .md file is used.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12952 def do_store_the_configure_options_that_were_used_into_a_markdown_file store_this = configure_options?.dup unless store_this.empty? # ===================================================================== # # We will remove some stuff from it before storing: # ===================================================================== # if store_this.include? rbt_temp_dir? store_this.sub!( /#{Regexp.quote(rbt_temp_dir?)}/, '' ) _ = program_name_and_program_version? if store_this.include? _ store_this.sub!(/#{_}/, '.') end end into = "#{prefix?}Resources/configure_options.md" orev "Storing the configure options that were used "\ "into the file:" e e " #{sfile(into)}" e write_what_into("#{store_this}\n", into) end end
#¶ ↑
do_strip_the_compiled_binaries
¶ ↑
This method will strip the compiled binaries, but only if we install them in an AppDir-prefix, that is, a path such as:
/Programs/Htop/2.0.2/ /home/Programs/Htop/2.0.2/
This stripping-operation will be done by the program called “strip”, which is part of the binutils suite.
There are three major ways how to use the strip functionality essentially:
(1) --strip-unneeded (2) --strip-debug (3) --strip-all
“strip –strip-unneeded” will remove all symbols that are not needed for relocation processing.
“strip –strip-debug” will only remove the debugging symbols.
“strip –strip-all” will remove all symbols.
Note that you can also strip the symbol table, from an object file, by using the “-s option” of the strip command.
When I tested different strip variants, in particular –strip-debug and –strip-unneeded, the latter one was producing significantly smaller binary files. When I used –strip-all and compared it to –strip-unneeded, the results were the same - so based on this, I am setting “–strip-unneeded” as the default.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3477 def do_strip_the_compiled_binaries( # ===================================================================== # # Determine which strip-variant to use next: # strip_how = '--strip-debug' # strip_how = '--strip-all' # ===================================================================== # strip_how = '--strip-unneeded' # ← This is the current default. ) # ======================================================================= # # Do not strip the binaries if an error has occurred or if the user # has not enabled this option. # ======================================================================= # return unless can_we_continue? return if an_error_has_occurred? return if do_not_strip_the_binaries? # ======================================================================= # # First, we must determine whether we will use the strip command or # whether we will not. Presently, we will use the strip command if # the user_prefix either includes the programs directory - or if # we use a path that is NOT using /usr as part of its prefix. # # As of January 2019, the above has been changed - we will only use # this if the real prefix includes the programs directory. Any other # prefixes will be ignored. # # As of December 2019, the method also has to check whether # real_prefix? returns a value other than nil (or false). The # reason for this is because RBT::Action::SoftwareManager is able to respond # to --no-prefix again, so this requires more checks. # ======================================================================= # if real_prefix? and real_prefix?.include?(programs_dir?) # or # !real_prefix?.include?('/usr') _ = rds(real_prefix?.to_s+'/bin/') # ===================================================================== # # Next obtain all entries in the bin/ subdirectory there. This may # lead to wrong results, though, as it may also include other files # if we are not careful. # ===================================================================== # all_files_in_the_bin_subdirectory = Dir["#{_}*"] # ===================================================================== # # Since as of 01.02.2019 we will only keep entries that are also # registered under "binaries:" in the corresponding .yml file. # This was specifically done to prevent running strip on e. g. # /usr/bin/* or /root/bin/*. # ===================================================================== # binaries = binaries? all_files_in_the_bin_subdirectory.select! {|entry| binaries.include?(File.basename(entry)) } strip_command = "strip #{strip_how.lstrip}" unless all_files_in_the_bin_subdirectory.empty? how_many = sfancy(all_files_in_the_bin_subdirectory.size.to_s) # =================================================================== # # Notify the user how many executables will be modified # through strip next. # =================================================================== # text = "#{rev}Next running \"#{sfancy(strip_command)}#{rev}\" on".dup if all_files_in_the_bin_subdirectory.size > 1 text << ' all' end text << "#{rev} #{how_many}#{rev}" # Add the number here. if all_files_in_the_bin_subdirectory.size > 1 text << ' binaries.' else text << ' binary.' end # =================================================================== # # Display our findings to the user next: # =================================================================== # orev text all_files_in_the_bin_subdirectory.each {|this_file| # ================================================================= # # The following command will usually run: # "strip --strip-unneeded *" # ================================================================= # cmd = "#{strip_command} #{this_file}" orev " #{sfancy(cmd)}" system(cmd) } end end end
#¶ ↑
do_symlink_appdir_lib_into_usr_lib
¶ ↑
This method will enable the symlinkinkg part from an AppDir path to a /usr/lib/ path.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9304 def do_symlink_appdir_lib_into_usr_lib @internal_hash[:symlink_into_usr_lib_dir] = true end
#¶ ↑
do_the_dependencies_include_this_program?¶ ↑
This method can be used to check whether the dependencies include a given program at hand (the input).
Keep in mind that dependencies can be written in either “name” or “name >= 1.2.3” style. So we also have to check for the second possibility there.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 798 def do_the_dependencies_include_this_program?( i = compile_which_program? ) dependencies = required_dependencies_on? # ======================================================================= # # Simplify the dependencies next. # ======================================================================= # dependencies.map! {|entry| if entry.include?(' >') or entry.include?(' <') entry = entry.split(' ').first.strip end entry } dependencies.include? i end
#¶ ↑
do_these_logic_steps
(logic tag)¶ ↑
This is a “meta”-method - it bundles different logic-steps together.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 757 def do_these_logic_steps(*array) flattened = array.flatten flattened.each {|this_entry| case this_entry # ======================================================================= # # === :consider_applying_a_patch # ======================================================================= # when :consider_applying_a_patch consider_applying_a_patch # ======================================================================= # # === :consider_creating_the_appdir # ======================================================================= # when :consider_creating_the_appdir consider_creating_the_appdir_skeleton else # else assume a method-call as-is. send(this_entry.to_sym) end } end
#¶ ↑
do_upgrade_from_this_file
¶ ↑
This method can be used to read input from a file, in order to determine which programs are to be compiled.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1999 def do_upgrade_from_this_file(i) case i # case tag # ======================================================================= # # === :default # ======================================================================= # when :default, :def i = 'these_programs_can_be_upgraded.yml' end if File.exist? i if i.end_with? '.yml' dataset_to_use = load_yaml(i) else dataset_to_use = File.readlines(i).map {|line| line.strip } end _ = dataset_to_use _ = _.join(', ') if _.is_a? Array orev "We will use this dataset: #{slateblue(_)}#{rev}" set_compile_these_programs(dataset_to_use) else no_file_exists_at(i) end end
#¶ ↑
do_upload_ruby_binary
¶ ↑
To invoke this, try:
ry --upload-ruby-binary
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4088 def do_upload_ruby_binary ensure_that_the_log_directory_exists # ======================================================================= # # Obtain the path to the local ruby version in use: # ======================================================================= # path_to_ruby = "#{programs_dir?}Ruby/" base_directory_to_upload = "#{path_to_ruby}Current" # This is a symlink. ruby_version = File.readlink(base_directory_to_upload) cd log_dir? _ = path_to_ruby+ruby_version+'/' # This is the full, real path. # ======================================================================= # # Next, use tar to create an archive. # ======================================================================= # readelf_command_to_use = "readelf -h #{_}bin/ruby" binary_32_bit_or_64_bit = `#{readelf_command_to_use}` binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.split(N).select {|line| line.include? 'Class:' } binary_32_bit_or_64_bit = binary_32_bit_or_64_bit.to_s.dup binary_32_bit_or_64_bit =~ /(\d+)/ binary_32_bit_or_64_bit = $1.to_s.dup+'-bit' orev "We will put this archive into `#{sdir(return_pwd)}`." name_of_the_ruby_archive = 'ruby-'+ruby_version+'-'+binary_32_bit_or_64_bit+'.tar.xz' _ = 'tar cfJv '+name_of_the_ruby_archive+' '+_ run_this_system_command_in_a_coloured_and_padded_manner(_) _ = (return_pwd+name_of_the_ruby_archive).squeeze '/' if File.exist? _ e 'The file now resides at `'+sfile(_)+'`.' do_binary_upload_of_this_file(_) # Here we finally upload the archive. else e 'Some error appears to have happened - no archive at '+sfile(_) e ' could be found.' end end
#¶ ↑
do_use_a_white_background
¶ ↑
We will silently assume that the user has a white background, and will re-assign to use a green font colour in this case, on KDE Konsole.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7418 def do_use_a_white_background ::Colours.table_colour_methods_to_specific_colour[:simp] = :seagreen end
#¶ ↑
do_use_appdir_prefix
¶ ↑
This method will call do_compile_in_a_non_traditional_way
, but it will always be quiet.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7692 def do_use_appdir_prefix do_compile_in_a_non_traditional_way(:be_quiet) end
#¶ ↑
do_use_autogen
¶ ↑
This invokes the autogen script, by using ‘sh’.
In oldschool shell script code, this means that we will run the following command:
sh autogen.sh
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3772 def do_use_autogen( use_this_cmd = "sh #{FILE_AUTOGEN}" # " #{SHELL_ERROR_CODE}" ) cliner { _ = return_pwd opne simp('Doing `')+sfancy(use_this_cmd)+simp('` from ')+sdir(_) opne simp('using the following command:') opnn; efancy " #{use_this_cmd}" } `#{use_this_cmd}` end
#¶ ↑
do_use_build_directory
¶ ↑
Use this method to specifcally “tell” a program to do use a build directory. For cmake-based projects it is recommended to use a build directory.
Usage example:
ry htop build
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13258 def do_use_build_directory( be_verbose = be_verbose? ) case be_verbose # ======================================================================= # # === :be_verbose # ======================================================================= # when :be_verbose be_verbose = true # ======================================================================= # # === :be_quiet # ======================================================================= # when :be_quiet be_verbose = false end if be_verbose orev 'A build directory will be used.' end @internal_hash[:use_build_directory] = true end
#¶ ↑
do_use_cmake
¶ ↑
If you wish to use cmake, you can do so via this method here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6692 def do_use_cmake orev "We will use #{steelblue('cmake')} #{rev}rather than make." set_use_this_make_command 'cmake' end
#¶ ↑
do_use_gobolinux_symlinkprogram
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10553 def do_use_gobolinux_symlinkprogram(be_verbose = true) if be_verbose orev 'Using the GoboLinux SymlinkProgram rather than '\ 'the internal RBT::SymlinkProgram script.' end @internal_hash[:use_gobolinux_symlinkprogram] = true end
#¶ ↑
do_use_meson
¶ ↑
This method will allow us to use meson. It will, on roebe systems, also try to use Python 3 if it is not the main one in use.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7970 def do_use_meson use_utf8_encoding_in_env set_use_this_configure_command(:meson) set_use_this_build_directory('build') consider_enabling_python3 end
#¶ ↑
do_use_random_build_directory
¶ ↑
This method can be used to use an ad-hoc random build directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 473 def do_use_random_build_directory( be_verbose = true, the_alphabet = ('a'..'z').to_a ) use_this_as_the_new_name = ''.dup n_times = (8 .. 16).to_a.sample n_times.times { use_this_as_the_new_name << the_alphabet.sample } if be_verbose orev "We will use a #{lightgreen('random directory')} #{rev}as "\ "build directory (#{sfancy(use_this_as_the_new_name)}#{rev})." end do_use_build_directory :be_quiet set_name_for_the_build_directory(use_this_as_the_new_name) end
#¶ ↑
do_use_random_version
¶ ↑
Use a random version of a program.
Usage example:
ry gcc --use-random-version
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5035 def do_use_random_version( this_program = compile_which_program? ) cfav = action(:CheckForAvailableVersions, this_program) available_programs = cfav.programs?.map {|entry| File.basename(entry) } _ = available_programs.sample orev "We will use another version (for program #{simp(_)}#{rev})" dataset?.set_complex_program_version(_) # This here sets the new version. end
#¶ ↑
do_use_the_blfs_instructions_for_compiling_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9695 def do_use_the_blfs_instructions_for_compiling_this_program( this_program = compile_which_program? ) require 'rbt/linux/linux_from_scratch/parse_blfs_webpage.rb' _ = return_dataset_from_this_remote_blfs_page(this_program) _ = RBT::Linux::ParseBlfsWebpage.new(_).shell_commands? initialize_dataset_for(this_program) program_path = yaml_dataset?.program_path? if File.exist? program_path extract_what_to(program_path, :default) # ===================================================================== # # Next we must cd to the correct target, before making use of # the BLFS instructions. # ===================================================================== # cd_target = extracted_directory?+program_name_and_program_version? cd cd_target orev "We are in the directory #{sdir(return_pwd)}#{rev}." e orev 'Next, the '+steelblue('BLFS instructions')+ "#{rev} acquired will be run as-is:" e esystem _ else opnn; no_file_exists_at(program_path) end end
#¶ ↑
do_use_the_clang_compiler
¶ ↑
Use this method if you wish to make use of the (LLVM) clang compiler rather than gcc.
Do note that you can also use special arguments or combine clang with ccache, such as shown in the following examples:
export CC='ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv' export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
Invocation example:
ry htop --clang
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9975 def do_use_the_clang_compiler( shall_we_notify_the_user = :notify_the_user ) case shall_we_notify_the_user # ======================================================================= # # === :notify_the_user # ======================================================================= # when :notify_the_user, :and_notify_the_user orev "We will attempt to use (#{teal('LLVM')}) #{slateblue('clang')} "\ "#{rev}to compile the code at hand." end set_this_env_variable 'CC=clang', :be_quiet set_this_env_variable 'CXX=clang++', :be_quiet @internal_hash[:compiler_to_use] = :clang # Keep track of the compiler here. end
#¶ ↑
do_use_the_gcc_compiler
¶ ↑
Use this method if you wish to make use of the GCC compiler.
Invocation example:
ry htop --use-gcc
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4319 def do_use_the_gcc_compiler( shall_we_notify_the_user = :notify_the_user ) case shall_we_notify_the_user # ======================================================================= # # === :notify_the_user # ======================================================================= # when :notify_the_user, :and_notify_the_user orev "We will attempt to use #{teal('gcc')} #{rev}to compile the "\ "code at hand." end set_this_env_variable 'CC=gcc', :be_quiet set_this_env_variable 'CXX=g++', :be_quiet @internal_hash[:compiler_to_use] = :gcc # Keep track of the compiler here. end
#¶ ↑
do_we_use_python3?¶ ↑
This method will return true if we use python version 3 or higher, and false otherwise.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3753 def do_we_use_python3? version = `python -V #{SHELL_ERROR_CODE}`.chomp if version.include? ' ' version = version.split(' ').last end version.start_with? '3' # ← This check has to suffice for now. end
#¶ ↑
does_a_python_binary_exist?¶ ↑
This method will return true if a “python” binary can be found in the PATH variable - and it will return false otherwise.
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11321 def does_a_python_binary_exist? _ = false check_these_directories = query_path? if check_these_directories.is_a?(String) and check_these_directories.include?(':') splitted = check_these_directories.split(':') splitted.each {|this_path| target = rds(this_path+'/python') if File.exist?(target) _ = true end } end _ end
#¶ ↑
does_this_file_exist?¶ ↑
This method checks whether the given-input argument, an assumed path to a file, exists.
The reason why this method exists is because it was necessary to do a “does this file exist” check in other directories rather than the current working directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7439 def does_this_file_exist?( this_file = FILE_SCONS ) this_file = this_file.dup # ← We must always work on a copy. # ======================================================================= # # We have to check whether the cookbook_dataset has been initialized. # If it has not been initialized yet, we will not query whether we # ought to use a build directory or not. # ======================================================================= # if cookbook_dataset? and use_build_directory? this_file.prepend('../') end super(this_file) end
#¶ ↑
download_program
(download tag, download archive, wget tag)¶ ↑
The method ‘download_program` will attempt to download the given program, which is the first argument passed to this method.
An URL is expected as argument here, a String, such as
'https://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz'
An Array can also be used as argument to this method. Internally the method here will make use of an Array, anyway.
For this download-related activity, we will either use a plain system() call to “wget” or we may use a ruby wget-wrapper. On Linux
or BSD-based systems ‘wget’ may be simpler to use. On windows we may have to use a ruby-variant of ‘wget’ instead.
Do note that the method download_program
() will always assume that the first argument given is an Array - that is, an Array of multiple urls. It will download all passed remote programs in a batch-like operation. This allows the user to, for example, download the whole KDE stack, in principle, by simply passing the Array of remote entries that constitute that KDE stack.
Please keep in mind that we will change_directory() in this method too, so you don’t have to call that on your own.
As of 05 September 2014 the method will also honour the “do_not_download” setting, if it was defined. This can be overruled in the arguments passed to this method.
The method here is used primarily to handle downloading of remote files.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8012 def download_program( url_for_program = url1?, may_we_download = may_we_download?, change_to_this_directory = cookbook_dataset_base_dir?, shall_we_update_the_dataset = true ) url_for_program = [url_for_program].flatten.compact # ======================================================================= # # We will handle some special Symbols next: # ======================================================================= # case shall_we_update_the_dataset # ======================================================================= # # === :do_not_update_the_dataset # ======================================================================= # when :do_not_update_the_dataset shall_we_update_the_dataset = false end case may_we_download # ======================================================================= # # === :do_download # ======================================================================= # when :do_download, :we_may_download may_we_download = true end case change_to_this_directory # ======================================================================= # # === :default # ======================================================================= # when :default change_to_this_directory = cookbook_dataset_base_dir? end change_to_this_directory = change_to_this_directory.to_s if is_on_roebe? unless change_to_this_directory.start_with? '/home/x/' this_file = RBT.file_source_directory? if File.exist? this_file if File.read(this_file).start_with? '$' # This is a small safeguard for my home system. orev 'The base directory does not seem to refer to '+ sdir('/home/x/') orev 'as a base. Has the environment been properly set up?' return end else opnn; no_file_exists_at(this_file) end end end url_for_program.each {|use_this_remote_url| if may_we_download url_for_program = use_this_remote_url url_for_program = url1? if url_for_program == :def # ======================================================================= # # Since Jul 2011 we use pure wget for this. Something is odd with # RubyWget and until we have fixed this, plain wget has to be used. # ======================================================================= # use_svn = dataset?.svn_url? # ======================================================================= # # Check whether the base directory exists. # ======================================================================= # if !File.exist?(change_to_this_directory) orev simp('Creating the directory `')+ sdir(change_to_this_directory)+ simp('` next.') create_directory(change_to_this_directory) end # ======================================================================= # # Change into the base directory first, before continuing to try # to download the archive in question. # ======================================================================= # change_directory(change_to_this_directory) # cd into the archive. # ======================================================================= # # Change into the archive. Be verbose about it. # ======================================================================= # cliner { orev "#{simp('Downloading ')}#{sfile(url_for_program)}" orev simp('into the directory ')+sdir(change_to_this_directory)+ simp(' now.') } if url_for_program.to_s.include? 'tar.gz' # overrule here for .tar.gz files. _ = cookbook_dataset? #.data _.set_archive_type('.tar.gz') _.set_program_full_name _.assemble_program_path set_cookbook_dataset( cookbook_dataset?.return_dataset ) end if use_svn.nil? or use_svn.empty? # Assume no SVN was given. bl rubywget do_download_this_program(url_for_program) # RubyWget.new(url_for_program) else # Else, we should use svn perhaps? Hmm or not. if _ do_download_this_program(_) else do_download_this_program(url_for_program) end # RubyWget.new(_) end if shall_we_update_the_dataset # ================================================================= # # We will update the dataset as well. # ================================================================= # yaml_dataset = load_yaml_dataset_for_this_program( program_information_return_name(url_for_program), :return_flat_datastructure ) assign_to_the_main_dataset( yaml_dataset ) end end } end
#¶ ↑
download_the_latest_source_code_of_this_program
¶ ↑
This method can be used to do a git clone checkout.
To try this method, invoke it like this:
ry mpv --git-download
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8300 def download_the_latest_source_code_of_this_program( i = compile_which_program? ) old_directory_content = Dir['*'].select {|entry| File.directory? entry } if compile_which_program?.nil? # Tiny safeguard. initialize_dataset_for(i) end _ = git_url? # Obtain the git-URL. if _.nil? or _.empty? opne tomato('No remote git-URL is known for `'+i.to_s+'`.') opne tomato('Consider adding such an entry to the .yml '\ 'file at hand.') return end # ======================================================================= # # Notify the user that we are about to download a remote package next: # ======================================================================= # orev "Next trying to #{royalblue('download')} #{rev}for #{simp(i)}" orev "from the remote URL #{steelblue(_)}#{rev}." # ======================================================================= # # Invoke the git-command next: # ======================================================================= # e run_this_system_command_in_a_coloured_and_padded_manner("git clone #{_}") e new_directory_content = Dir['*'].select {|entry| File.directory? entry } difference = new_directory_content - old_directory_content unless difference.empty? case difference.size when 1 # =================================================================== # # Currently we only handle one entry here. # =================================================================== # this_directory = difference.first orev 'A directory was found at '+ sdir(absolute_path(this_directory))+rev+'.' new_name = this_directory+'-'+return_current_time orev 'It will be renamed next, to '+sdir(new_name)+"#{rev}." orev 'Finally, it will be made into a .tar.xz file.' rename(this_directory, new_name) to_tar_xz(new_name) file_path = absolute_path(new_name) if is_on_roebe? orev "You may be able to remove the directory at "\ "#{sdir(file_path)}#{rev} now." end return "#{file_path}.tar.xz" # We will actually return the archive file. end end end
#¶ ↑
download_the_remote_documentation_of_the_RBT_project
¶ ↑
This method will download the documentation of the RBT
project for local use.
Usage example:
rbt --download-docu
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14308 def download_the_remote_documentation_of_the_RBT_project( remote_URL = 'https://www.rubydoc.info/gems/rbt/' ) orev "Now downlading from the remote "\ "URL at `#{steelblue(remote_URL)}#{rev}`." dataset = URI.open(remote_URL).read into = absolute_path('rbt_documentation.html') write_what_into(dataset, into) if File.exist? into orev 'Storing into the local file at '+sfile(into)+rev+'.' end end
#¶ ↑
download_this_remote_url_into_that_local_directory
¶ ↑
The first argument should be the remote URL to the program at hand.
The second argument should be a local directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14203 def download_this_remote_url_into_that_local_directory( url = url1?, local_directory = '/home/Temp/downloads/' ) local_directory = local_directory.dup if local_directory.frozen? local_directory << '/' unless local_directory.end_with? '/' unless File.directory? local_directory create_directory(local_directory) { :be_verbose } end cd local_directory # change directory into that target download_program( url, :we_may_download, local_directory, :do_not_update_the_dataset ) end
#¶ ↑
download_using_svn
¶ ↑
Use this method here to download/checkout from svn. In order for this to properly work, you need to define a svn_url in the yaml file for the respective program at hand.
To try out this method, do:
ry dosbox svn
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9386 def download_using_svn( i = compile_which_program? ) dataset = dataset? if dataset.nil? dataset = initialize_dataset_for(i) end _ = "svn co #{dataset.svn_url?}" working_directory = sdir(return_current_pwd) orev "Now trying to use svn to download the source directly "\ "(working directory is: #{steelblue(working_directory)}#{rev}." opnn; print ' ' e _ _result = `#{_}` # We may want to use this return-value at a later time. # ======================================================================= # # === Rename the trunk directory next # ======================================================================= # if File.directory? 'trunk' _ = "#{i}-#{today?}" orev "Now renaming directory `#{sdir('trunk')}#{rev}` to `#{simp(_)}#{rev}`." rename('trunk', _) if Object.const_defined? :ToTarXz orev "#{rev}Now trying to package the directory `#{sdir(_)}#{rev}`." to_tar_xz(_) package_name = Dir["#{_}.tar.xz"] unless package_name.empty? orev 'All should be done now. You can move this .tar.xz '\ 'package ('+simp(package_name.first)+rev+').' end end end end
#¶ ↑
edit_the_yaml_file_via_the_main_editor
¶ ↑
Invocation example:
rbt --edit-file=nano
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12455 def edit_the_yaml_file_via_the_main_editor( this_yaml_file = install_which_program?, use_this_editor = editor_to_use? ) this_yaml_file = this_yaml_file.to_s.dup this_yaml_file = 'nano' if this_yaml_file.empty? _ = nil # Default. # ======================================================================= # # Determine which editor to use next: # ======================================================================= # _ = use_this_editor.to_s.dup+' ' if use_this_editor # ======================================================================= # # Overrule on my home system. # ======================================================================= # if is_on_roebe? or _.nil? _ = "#{editor?} " end unless File.exist? this_yaml_file unless this_yaml_file.include? '/' this_yaml_file = return_location_to_this_programs_yaml_file(this_yaml_file) end end if File.exist? this_yaml_file _ << this_yaml_file else _ << find_this_yaml_file(this_yaml_file) end coloured_esystem _ end
#¶ ↑
either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10061 def either_report_the_total_amount_of_binaries_or_how_many_binaries_this_program_will_install if a_program_has_been_initialized? report_the_amount_of_binaries else action(:report_how_many_binaries_are_registered) end end
#¶ ↑
enable_autogen
¶ ↑
This method will enable autogen.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5836 def enable_autogen( be_verbose = true ) if be_verbose orev 'We will make use of autogen.' end @internal_hash[:use_autogen] = true # Enable the use of autogen in our dataset here. end
#¶ ↑
enable_everything_for_the_current_compilation_run
¶ ↑
Note that currently we will only work on the “–enable*” entries.
Invocation example:
ry ncurses ntrad --enable-everything --dontsymlink
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 792 def enable_everything_for_the_current_compilation_run default_extract_step( use_this_local_path: cookbook_dataset?.program_path? ) cd_to_the_extracted_archive orev 'running ./configure help ...' cmd = './configure --help' result = `#{cmd}` array = result.split(N) # ======================================================================= # # Entries may look like this: # # --enable-symlinks make tic use symbolic links not hard links\n" + # --with-x11-rgb=FILE file containing X11 rgb information (EPREFIX/lib/X11/rgb.txt)\n" + # # ======================================================================= # selection = array.select {|line| splitted = line.split(' ') line.start_with?(' --enable-') and (splitted[0].downcase == splitted[0]) # ← This checks for all-downcase. # ^^^ exclude entries such as "--enable-FEATURE[=ARG]" } selection = selection.map {|entry| entry.split(' ').first.to_s }.join(' ').strip clear_configure_options append_this_to_the_configure_options(selection) end
#¶ ↑
enable_is_on_gobolinux
¶ ↑
This method can be used to default to a GoboLinux behaviour.
We should closely follow the behaviour of GoboLinux via the RBT
scripts, 1:1 - no need to create incompatibilities at this point.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11398 def enable_is_on_gobolinux # ENV['IS_ON_GOBOLINUX'] = '1' # ← Disabled as of 25.09.2018; we probably no longer need to do this. @internal_hash[:is_on_gobolinux] = true use_non_traditional_prefix do_not_symlink_headers do_not_symlink_pkgconfig_files do_use_gobolinux_symlinkprogram # ← Trying this as of Oct 2017. do_not_register_into_the_yaml_database end
#¶ ↑
enable_non_traditional_compilation
¶ ↑
This will essentially switch to app-dir prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4739 def enable_non_traditional_compilation( optional_use_this_as_program_name_and_program_version = program_name_and_program_version? ) if optional_use_this_as_program_name_and_program_version @internal_hash[:prefix].set_program( optional_use_this_as_program_name_and_program_version ) end @internal_hash[:prefix].enable_non_traditional_compilation end
#¶ ↑
enable_simulation
¶ ↑
Enable to run in simulation mode. The first argument is an optional message we give, in which case we will output that message.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 684 def enable_simulation( optional_message = '' ) unless optional_message.empty? opne optional_message end do_run_simulation end
#¶ ↑
ensure_that_a_cookbook_object_has_been_instantiated
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6825 def ensure_that_a_cookbook_object_has_been_instantiated( i = compile_these_programs?.first ) if cookbook_dataset?.nil? initialize_a_new_cookbook_instance(i) end end
#¶ ↑
ensure_that_all_directories_for_rbt_exist
¶ ↑
This is a separate method because we may want to create more than just one directory in the future.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2825 def ensure_that_all_directories_for_rbt_exist ensure_that_the_log_directory_exists end
#¶ ↑
ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10199 def ensure_that_the_configure_options_are_consistent_in_regards_to_static_compilation _ = configure_options?.dup if compile_statically? unless _.include? '--enable-static' _ << ' --enable-static' # Just to be safe. end if _.include?('--enable-static') and not (_.include?('--disable-shared')) _ << ' --disable-shared' unless _.include?('--enable-shared') end if _.include?('--enable-shared') and _.include?('--enable-static') set_configure_options( _.sub(/--enable-shared/, '--disable-shared') ) sort_configure_options_alphabetically end end end
#¶ ↑
ensure_that_the_log_directory_exists
¶ ↑
This method will ensure that the log directory, usually the one at “/Depot/Temp/rbt/”, exists.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12027 def ensure_that_the_log_directory_exists action(:ensure_that_the_log_directory_exists) end
#¶ ↑
ensure_that_the_program_exists
¶ ↑
This method will determine whether this class can continue to run or whether it can not.
We can continue to run if the program exists as part of the cookbooks project. One exception to this rule is when the last character is a ‘*’ token. In this case we assume that he user wants to simply get a list of available programs instead, starting with that specific name, e. g. “e*” should yield a list of all programs starting with the character “e”.
You can try this out by doing:
ry e*
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6738 def ensure_that_the_program_exists( i ) i = i.to_s if honour_check_to_ensure_that_the_program_exists? unless cookbooks_include_this_program?(i) # =================================================================== # # Handle not-registered programs next: # =================================================================== # opne "#{crimson('The program `')}#{seagreen(i)}"\ "#{crimson('` could not be found. It thus can not be compiled')}" opne crimson('and hence, RBT::Action::SoftwareManager can not continue. If this '\ 'file should exist,') opne crimson('it can be found at:') e e " #{sfile(return_location_to_this_programs_yaml_file(i))}" e we_can_not_continue end unless i.end_with? '*' end return can_we_continue? end
#¶ ↑
extract_the_linux_kernel_archive
¶ ↑
To tap into this method from the commandline, do:
ry --extract-linux
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7568 def extract_the_linux_kernel_archive result = initialize_cookbook_dataset_for(:linux) target = result.extract_to? if File.symlink? '/usr/src/linux' delete_symlink('/usr/src/linux') end extract_what_to( result.path?, target, :do_keep_the_old_directory_if_it_exists ) orev "Finished extracting the linux kernel to #{sdir(target)}#{rev}." end
#¶ ↑
extract_to_default_directory
¶ ↑
By default, we will extract to this directory - but the value is lateron refined to the full path instead; so the assignment done here is just so that we have a starting value we can work with.
This method will be called from within the method reset().
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12134 def extract_to_default_directory( i = RBT.log_directory? ) @internal_hash[:extract_to_this_directory] = i end
#¶ ↑
extract_to_this_directory?¶ ↑
This query-method tells us where we will extract (our archive) to.
The temp-directory is initially the same as RBT.rbt_log_directory?.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14176 def extract_to_this_directory? _ = @internal_hash[:extract_to_this_directory] # ======================================================================= # # Allow the user to overrule this value. # ======================================================================= # if @internal_hash[:extract_to_this_directory_as_specified_by_the_user] _ = @internal_hash[:extract_to_this_directory_as_specified_by_the_user] end return _ end
#¶ ↑
extract_to_this_directory_being_one_directory_below?¶ ↑
This points to the base-directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1028 def extract_to_this_directory_being_one_directory_below? _ = extract_to_this_directory?.to_s.dup _ = "#{File.dirname(_)}/" return _ end
#¶ ↑
extract_what_to
(extract tag, extracter tag)¶ ↑
This method will extract the given archive directory, by delegating towards class Extracter. This is done, since as of the year 2024, via action(:extract_what_to).
This method ought to be invoked quite early, logically; the method “consider_extracting_this_program()” may be used to invoke this method.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/extract_related_code.rb, line 24 def extract_what_to( local_path = cookbook_dataset_program_path?, extract_to_this_directory = extract_where_to?, shall_we_report_to_the_user_if_the_archive_does_not_exist = true # This should come last. ) append_to_the_commandline = ''.dup # ======================================================================== # # === Handle Hashes next # ======================================================================== # if local_path.is_a? Hash # ====================================================================== # # === :use_this_local_path # ====================================================================== # if local_path.has_key? :use_this_local_path local_path = local_path.delete(:use_this_local_path) end end local_path = local_path.to_s # Past this point we need a String. if local_path and File.exist?(local_path) if run_simulation? # =================================================================== # # Here we are in simulation-mode: # =================================================================== # orev "We would normally extract `#{sfile(local_path)}#{rev}` "\ "to #{sdir(extract_to_this_directory)} #{rev}next," orev 'but since we run in simulation-mode, we will not '\ 'extract anything.' else _ = "Next trying to extract `#{sfile(local_path)}#{rev}`".dup _ << " #{rev}(but do so silently)" unless show_output_from_the_extracter_class? _ << '.' orev _ # =================================================================== # # Extracting the archive next, via an action - this will be handled # by class Extracter. The second argument is a Hash which will # typically carry a lot of information. This is necessary because # we want to "fine-tune" Extracter at this step. # =================================================================== # action(:extract_what_to, local_path, { extract_to: extract_to_this_directory, # ← Extract to this directory. use_colours: use_colours?, prepend_this_namespace: 'RBT→', # ← Use this modifier. run_simulation: run_simulation?, pad_opn_with_n_tokens: RBT.n_padding_to_use_for_opn?, use_opn: show_the_classname?, be_verbose: show_output_from_the_extracter_class?, append_this_to_the_commandline: append_to_the_commandline, } ) { :be_quiet } # =================================================================== # # Next we will exit if the user told us that he/she is only # interested in extracting the program. # =================================================================== # exit_program if extract_only? return extract_to_this_directory # And return it too, in case downstream code needs it. end else # else the archive at hand does not exist. if shall_we_report_to_the_user_if_the_archive_does_not_exist opne swarn('No file could be found at `')+ sfile(local_path)+swarn('` - thus,') opne swarn('we can not extract anything.') # =================================================================== # # Also set a specific error, so that we won't continue. # =================================================================== # # error_is 'We can not continue. Has the archive '\ # 'been properly extracted?' end no_file_exists_at(local_path) end end
#¶ ↑
extracted_base_directory?¶ ↑
If you need to query the value for the path to the extracted directory, then make use of the method extract_to_this_directory? rather than the method here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1053 def extracted_base_directory? @internal_hash[:extracted_base_directory] end
#¶ ↑
feedback_all_libraries
¶ ↑
Feedback all libraries from a given program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7936 def feedback_all_libraries( from_this_program = program? ) RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_all_libraries(from_this_program) end
#¶ ↑
feedback_all_libraries_and_all_binaries
¶ ↑
Invoke this method by issuing:
ry htop installs_what?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14690 def feedback_all_libraries_and_all_binaries( of_this_program = compile_which_program? ) feedback_all_binaries(of_this_program) feedback_all_libraries(of_this_program) end
#¶ ↑
feedback_all_registered_binaries_of_all_programs
¶ ↑
This method will show, on the commandline, all registered binaries of all the programs together.
Invocation example:
rbt --all-binaries
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8766 def feedback_all_registered_binaries_of_all_programs _ = action(:registered_binaries) orev "These #{royalblue(_.size.to_s)} #{rev}binaries are registered:" e _.each_with_index {|this_binary, index| index += 1 padded_index = (index.to_s+') ').rjust(5) e " #{lightgreen(padded_index)}"\ "#{slateblue(this_binary)}" } e end
#¶ ↑
feedback_configure_options
¶ ↑
To test this method, try something like this:
ry htop configure_options? ry gcc configure_options?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11050 def feedback_configure_options( i = compile_this_program? ) if i.nil? i = work_on_this_program? end orev "The configure options for the program #{sfancy(i)} #{rev}are:" if dataset?.nil? ensure_that_we_have_a_dataset(i) end _ = configure_options? e e " #{sfancy(_)}" e end
#¶ ↑
feedback_default_values_of_the_internal_hash
¶ ↑
Invocation example from the commandline:
ry --feedback-the-default-values-of-the-internal-hash
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5510 def feedback_default_values_of_the_internal_hash dataset = return_default_internal_hash e orev "The following #{lightblue(dataset.keys.size.to_s)} "\ "#{rev}entries are known:" e dataset.each_pair {|key, value| if value.nil? value = 'nil' end e " #{slateblue(key)}: #{lightgreen(value)}" }; e end
#¶ ↑
feedback_dependencies_of_this_program
¶ ↑
Feedback the dependencies of a given program through this method.
Invocation example:
ry pango --feedback_dependencies_of_this_program
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14497 def feedback_dependencies_of_this_program( i = compile_which_program? ) if dataset?.nil? ensure_proper_dataset(i) end dependencies = dataset?.deps_on? if dependencies.nil? no_dependency_was_found_for(i) return end unless dependencies.empty? cliner orev "The following dependencies were found for `#{sfancy(i)}#{rev}`:" e # =================================================================== # # We will next assume that dependencies is an Array. # =================================================================== # dependencies.each {|dep| e " A dependency on: #{olivedrab(dep)}" } e cliner else no_dependency_was_found_for(i) end end
#¶ ↑
feedback_expanded_dependencies_of_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6530 def feedback_expanded_dependencies_of_this_program( i = compile_which_program? ) require 'rbt/misc/reverse_dependencies.rb' e "#{rev}The expanded dependencies for #{steelblue(i)} are:" e RBT::ReverseDependencies.dependencies?(i).each {|entry| e " #{entry}" } e end
#¶ ↑
feedback_extra_description
¶ ↑
To trigger this method, do:
ry php edesc
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14676 def feedback_extra_description( of_this_program = program? ) RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_extra_description(of_this_program) end
#¶ ↑
feedback_last_compiled
¶ ↑
There are several ways how to invoke this method. We thus need to be rather flexible about feedbacking this to the user.
One of the first distinctions will be whether we have a ‘=’ token in the input or whether we do not.
Examples:
rbt --last-compiled? rbt --last-5-compiled? rbt --last-five-compiled? rbt --last-compiled?=5 rbt --last-compiled?=6
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8493 def feedback_last_compiled( i = :all_of_them ) i = i.first if i.is_a? Array # Grab the first entry. # ======================================================================= # # Next, we determine the dataset of which programs have been compiled. # ======================================================================= # dataset = compiled_programs? dataset = dataset.keys if dataset.respond_to? :keys case i when :all_of_them i = dataset.size end unless dataset orev 'No dataset was found in this file: '+ sfile(file_compiled_programs?) return end show_n_programs = 1 # This is the default. if i.to_s =~ /^\d+$/ show_n_programs = i.to_i end if i and i.to_s.include?('=') splitted = i.split('=') show_n_programs = splitted.last.to_i elsif (show_n_programs > 1) # pass through in this case else # Else it does not include a '='. regex_to_use = /--last(-\d+-)compiled\?/ i =~ regex_to_use show_n_programs = $1.to_s.dup.delete('-').to_i if $1 array = HASH_ENGLISH_NUMBERS.keys if array.any? {|entry| i.include? entry } result = array.select {|entry| i.include? entry } result = result.first unless result.empty? # =================================================================== # # Now we must convert this: # =================================================================== # result = HASH_ENGLISH_NUMBERS[result] show_n_programs = result.to_i end end # ======================================================================= # # Narrow our dataset down. # ======================================================================= # if show_n_programs > dataset.size orev 'We have not kept track of that many ('+ sfancy(show_n_programs.to_s)+rev+') registered programs, so' orev "only #{dataset.size.to_s} #{rev}programs will be shown instead." show_n_programs = dataset.size end dataset = dataset.reverse[0 .. (show_n_programs - 1)].reverse e orev "The last #{simp(show_n_programs.to_s)} #{rev}compiled "\ "programs (most recent one comes first) were:" # ======================================================================= # # Now we can report this dataset, which contains our programs. # ======================================================================= # e; dataset.reverse.each {|key| e " #{sfancy(key)}" }; e end
#¶ ↑
feedback_local_base
¶ ↑
Feedback which local base directory is used for a particular program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8385 def feedback_local_base( i = compile_which_program? ) RBT::Cookbooks::DisplayCookbookDataset.feedback_local_base(i) end
#¶ ↑
feedback_local_location
¶ ↑
Invoke this like:
ry htop feedback_local_location
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11957 def feedback_local_location( i = compile_which_program? ) RBT::Cookbooks::DisplayCookbookDataset::Feedback.feedback_local_location(i) end
#¶ ↑
feedback_main_config
¶ ↑
In order to invoke this method, do:
rbt config?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11806 def feedback_main_config orev 'We will show the configuration options set for the '\ 'RBT project next.' e cliner { dataset = RBT.configuration? array = dataset.available_methods? # Delegate to the config. array.each {|entry| value = dataset.send(entry.to_sym) case entry.to_s.strip when 'email' value = crimson(value.to_s.ljust(10)) else value = slateblue(value.to_s.ljust(10)) end key = lightgoldenrodyellow( "#{entry}:".ljust(46) ) e " #{key} #{value}" } } e end
#¶ ↑
feedback_make_options
¶ ↑
To trigger this method, do e. g.:
ry ruby make_opts ry binutils make_opts
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1645 def feedback_make_options( i = compile_which_program? ) _ = cookbook_dataset_make_options? _ = _.first if _.is_a? Array e e royalblue(_) e end
#¶ ↑
feedback_prefix_in_use
?¶ ↑
Use this method to feedback which prefix is in use.
Usage examples:
ry allegro --prefix? ry openmpi --prefix? ry htop prefix?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6474 def feedback_prefix_in_use?( shall_we_exit = true ) program_name = compile_which_program?.dup if cookbook_dataset?.nil? ensure_proper_dataset_for(program_name) end e "#{rev}The prefix in use for #{lightgreen(program_name)} will be:" e " #{sfancy(prefix?)}" exit_program if shall_we_exit end
#¶ ↑
feedback_program_description
¶ ↑
We feedback the description here, by tapping into the method feedback_description
() from class Cookbooks
.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6284 def feedback_program_description( i = program_name? ) e RBT.feedback_description_of(i) e end
#¶ ↑
feedback_sanitize_dataset_version
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11612 def feedback_sanitize_dataset_version( ljust = 35, use_opn = true ) opnn if use_opn e sfancy('RBT::Cookbooks::SanitizeCookbook version: '.ljust(ljust))+ simp(RBT.version?) end
#¶ ↑
feedback_url
¶ ↑
Wrapper around Cookbooks
functionality.
Usage examples:
ry htop url? ry libsigc++ --show-url ry --url-for-these-programs=php,ruby,python,m4,php
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2467 def feedback_url( i = compile_which_program?, shall_the_dataset_be_initialized_anew = false ) case shall_the_dataset_be_initialized_anew # ======================================================================= # # === :initialize_the_dataset_anew # ======================================================================= # when :initialize_the_dataset_anew shall_the_dataset_be_initialized_anew = true end if i.is_a? Array i.each {|entry| feedback_url(entry, shall_the_dataset_be_initialized_anew) } else if i.nil? or shall_the_dataset_be_initialized_anew if shall_the_dataset_be_initialized_anew # No change necessary here. else i = first_argument?.to_s.dup end initialize_dataset_for(i) end action(:url_new, i) end # ======================================================================= # # The next line of code has been commented out on the 21.09.2018: # ======================================================================= # # ::RBT::Cookbooks::DisplayCookbookDataset.feedback_url.feedback_url(compile_which_program?) # ======================================================================= # # The next part may be controversial, as it sets the xorg buffer. # As of May 2014 it was disabled. # ======================================================================= # # result = @cookbooks.feedback_url # set_xorg_buffer(result) # ======================================================================= # end
#¶ ↑
feedback_various_versions
¶ ↑
This actually will only feedback the RBT
version in use, since we have merged the different projects together in September 2018.
To invoke this method, do:
ry htop feedback_version
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12517 def feedback_various_versions( optional_use_opn = true, ljust = 45 ) case optional_use_opn # ======================================================================= # # === :do_not_use_opn # ======================================================================= # when :do_not_use_opn optional_use_opn = false end feedback_rbt_version(ljust, optional_use_opn) end
#¶ ↑
feedback_what_we_are_currently_compiling?¶ ↑
This method will feedback what we are currently compiling.
To invoke this method, do:
rbt --what-are-we-currently-compiling?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 695 def feedback_what_we_are_currently_compiling?( status_file = FILE_STATUS ) if File.exist? status_file dataset = YAML.load_file(status_file) end this_key = 'currently_compiling_these_programs' if dataset.has_key?(this_key) and !dataset[this_key].empty? # This should work because it is an Array. these_programs_are_currently_compiled = dataset[this_key] orev 'The following programs are currently compiled:' e these_programs_are_currently_compiled.each {|this_program| e " #{sfancy(this_program)}" }; e else orev 'No program is being currently compiled.' end end
#¶ ↑
feedback_whether_the_cookbook_will_modify_env_variables
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8421 def feedback_whether_the_cookbook_will_modify_env_variables( compile_this_program = compile_which_program? ) _ = set_env_variables? if is_this_program_registered?(compile_this_program) if _.nil? orev "The program #{sfancy(compile_this_program)} "\ "#{rev}does not set any ENV variable." else orev 'The program '+sfancy(compile_this_program)+ "#{rev} will modify at the least one ENV variable." orev 'Displaying these next:' e set_these_env_variables(_, :report_only) e end else orev 'No program with that name is known.' end end
#¶ ↑
feedback_whether_we_will_strip_or_whether_we_will_not
¶ ↑
Feedback whether we will run the “strip” binary or whether we will not.
Invocation example:
ry --strip?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1896 def feedback_whether_we_will_strip_or_whether_we_will_not _ = strip_binaries? case _ when true orev 'Yes, we will run "'+slateblue('strip')+rev+ '" on the resulting binaries of' orev 'the given program at hand.' when false orev "No, we will #{swarn('NOT')} #{rev}run \"strip\" on the "\ "resulting binaries of" orev 'the given program at hand.' else orev 'Unknown value: '+steelblue(_.class.to_s) end end
#¶ ↑
find_all_keys_starting_with
¶ ↑
This method will find all keys starting with a specific character.
Currently we will always exist when we use this method, so returning something is not hugely important.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14229 def find_all_keys_starting_with( i ) i = i.dup if i.is_a?(String) and i.frozen? i.delete!('*') # Get rid of '*' since we no longer need it past this point. all_matches = all_programs?.select {|key| key =~ /^#{i}/ } e all_matches.sort.join(', ').split(N).map {|entry| ' '+entry }.join(N) e orev "A total of #{royalblue(all_matches.size.to_s)} "\ "#{rev}matches were found." return all_matches end
#¶ ↑
full_configure_command?¶ ↑
The @full_configure_command contains the full configure command that we will use. The advantage in using this is that we can easily copy/paste this at a later time, should we need to do so.
We can also store this into a local file, such as a .md file. In fact, this was the primary reason why it was added.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 657 def full_configure_command? @internal_hash[:full_configure_command] end
#¶ ↑
generate_all_gobolinux_recipes
¶ ↑
This method can be used to auto-generate all GoboLinux recipes.
Invocation example:
ry --generate-all-gobolinux-recipes
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6072 def generate_all_gobolinux_recipes # ======================================================================= # # Must first change into an appropriate directory. # ======================================================================= # target_dir = "#{rbt_log_directory?}gobolinux/" if File.directory? target_dir # ===================================================================== # # Always remove the old directory should it exist. # ===================================================================== # remove_directory(target_dir) end mkdir(target_dir) if File.directory? target_dir opnn; cd target_dir, :be_verbose # ===================================================================== # # Next, create the subdirectories but be silent about it. # ===================================================================== # array = ('a'..'z').to_a # ===================================================================== # # Add two exceptions. # ===================================================================== # array[0,0] = '3' array[0,0] = '0' array.each {|entry| mkdir(entry, :be_quiet) } else orev "The target directory `#{sdir(target_dir)}` does not exist." orev 'Please create it before we can create GoboLinux recipes.' return end available_programs?.each {|this_program| orev "Now generating a GoboLinux recipe for "\ "the program `#{sfancy(this_program)}#{rev}`." create_gobolinux_recipe_for(this_program) } # ======================================================================= # # Now that we have generated all these recipes, let's create a tarball # of the directory. # ======================================================================= # cd rbt_log_directory?, :be_quiet begin require 'totarxz' gobolinux_recipes_archive = "gobolinux-recipes-#{return_current_date}" mv 'gobolinux', gobolinux_recipes_archive to_tar_xz(gobolinux_recipes_archive) target_archive = "#{gobolinux_recipes_archive.dup}.tar.xz" if File.exist? target_archive orev "Everything has been packaged up into `"\ "#{sfancy(target_archive)}` (cwd: #{sdir_return_pwd}#{rev})." # =================================================================== # # Rename the directory again. # =================================================================== # opnn; mv gobolinux_recipes_archive, 'gobolinux' # =================================================================== # # FTP upload if we are on Roebe. # =================================================================== # if is_on_roebe? require 'ftp_paradise' if File.exist? target_archive FtpParadise.upload_this_binary_file(target_archive) else opne 'Can not upload the file '+sfile(target_archive) opne 'as it does not exist.' end # ================================================================= # # Next, connect and upload all the individual directories to # my remote FTP host. # ================================================================= # end # =================================================================== # # Next, upload the individual directories to the remote FTP host. # Unfortunately this has a problem so we have disabled this for now. # =================================================================== # # =========================================================================== # # DISABLED FOR NOW. MUST BE FIXED ONE DAY. # =========================================================================== # if false _ = FtpParadise.new(:shevy) _.remote_mkdir 'gobolinux' _.remote_cd 'gobolinux' opnn; cd 'gobolinux', :be_verbose array.each {|this_directory| _.remote_mkdir(this_directory) _.rcd(this_directory) # ================================================================= # # Ok, we can obtain the local directories and then upload them # all. # ================================================================= # local_target = this_directory+'/*' all_local_directories = Dir[local_target].select {|entry| File.directory? entry } if all_local_directories.empty? orev 'Nothing found under '+sfancy(local_target)+rev+'.' else all_local_directories.each {|this_entry| orev 'Now uploading the directory `'+sdir(this_entry)+rev+'`.' _.upload_this_directory(this_entry) } end _.rcd '..' # Return to the base directory again. } end # end false clause (DEBUG - FIXME!!!) end rescue LoadError orev 'Please install the gem totarxz, in order to create '\ 'a '+orange('.tar.xz')+rev+' archive.' end end
#¶ ↑
generate_gobolinux_recipe
¶ ↑
This will delegate towards Cookbooks
and generate gobolinux recipe for the given program.
Invocation examples:
ry zenity --gobolinux-recipe ry ruby --to-gobo
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13054 def generate_gobolinux_recipe( i = compile_which_program? ) require 'rbt/linux/gobolinux/create_recipe.rb' RBT.create_gobolinux_recipe(i) { :store_in_alphanumeric_subdirectory } end
#¶ ↑
generate_homepage
¶ ↑
Generate a LFS-like homepage, which is part of the RBT
project, within the Cookbooks
namespace.
Invocation example:
ry --generate-homepage
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7960 def generate_homepage action(:generate_homepage) end
#¶ ↑
generate_machomebrew_formula
¶ ↑
This method will generate a (hopefully valid) Homebrew script.
Commandline-invocation example:
ry htop --generate_homebrew_script
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 352 def generate_machomebrew_formula( i = compile_which_program? ) RBT::GenerateMachomebrewFormula.new(i) end
#¶ ↑
generate_new_cookbook
¶ ↑
This method can be used to generate a new cookbook file. It is no longer that useful, but retained mostly for legacy reasons.
To generate a new cookbook, do:
ry htop ---generate_new_cookbook
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2103 def generate_new_cookbook( shall_we_exit = true ) orev 'Will generate a new cookbook file, as instructed.' action(:create_new_cookbook) exit_program if shall_we_exit end
#¶ ↑
generate_shell_completion
¶ ↑
Generates shell completion code. Right now it will only work for Bash.
Invocation example:
ry --generate_shell_completion
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1223 def generate_shell_completion( for_this_shell = :all ) action(:GenerateShellCompletion, for_this_shell) end
#¶ ↑
generate_slack_desc_file_for_this_program
¶ ↑
Trigger like so:
rbt htop --gsc
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3627 def generate_slack_desc_file_for_this_program( i = compile_which_program? ) path_to_this_file = RBT.generate_slackware_description_file(i) return path_to_this_file end
#¶ ↑
get_packages
¶ ↑
Get all packages from the directory /Depot/Packages and compare them to our given request.
I am no longer making heavy use of Packages but perhaps one day I may extend it, so this is one reason why it is kept.
Invoke it like so:
ry php pgk?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3979 def get_packages( this_program = compile_which_program? ) this_program = this_program.first if this_program.is_a? Array packages_dir = packages_directory? # This constant is defined in Configuration.rb orev "Searching for matching packages to `#{simp(this_program)}#{rev}`, "\ "inside of the directory #{sdir(packages_dir)}#{rev}." _ = get_files_from(packages_dir) if _ and !_.empty? result = _.grep(/#{this_program}/i) pp result return result else orev "Unfortunately no match was found in `#{sdir(packages_dir)}#{rev}`." end end
#¶ ↑
guess_build_type
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1075 def guess_build_type RBT.build_type? end
#¶ ↑
handle_the_postinstallation_step
¶ ↑
This will delegate towards class RBT::ToCurrent, to set the Current symlink.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5439 def handle_the_postinstallation_step if uses_appdir_prefix? _ = prefix? orev "Setting a symlink next, for #{steelblue(_)}#{rev}:" # ===================================================================== # # Delegate onto class RBT::ToCurrent next. # ===================================================================== # action(:ToCurrent, _) end end
#¶ ↑
has_key?¶ ↑
This is a substitute method, to enable hash-like behaviour for some keys. Right now (December 2019) this is a hardcoded Array, but in the future the code may be changed - let’s see.
Do note that this method is specifically synced (closely) with class RBT::CreatePkgconfigFile.new
.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 975 def has_key?(i) %i( description prefix program_version ).include? i end
#¶ ↑
honour_check_to_ensure_that_the_program_exists?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 718 def honour_check_to_ensure_that_the_program_exists? @internal_hash[:honour_check_to_ensure_that_the_program_exists] # This is true by default. end
#¶ ↑
increment_compiled_this_program_n_times_counter
¶ ↑
By default this method will increment by +1.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14144 def increment_compiled_this_program_n_times_counter( by_plus_n = 1 ) @internal_hash[:we_tried_to_compile_this_program_n_times] += by_plus_n end
#¶ ↑
infer_information_from_this_archive
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2275 def infer_information_from_this_archive(i) _ = remove_archive_at_the_end( File.basename(i) ) _ = ProgramInformation.new(_) use_this_as_program_name = _.program_name? use_this_as_program_version = _.program_version? # ======================================================================= # # Obtain a dummy-cookbook dataset first. # ======================================================================= # cookbook_dataset = load_yaml_dataset_for_this_program( use_this_as_program_name ) # ======================================================================= # # Update the program_path next: # ======================================================================= # cookbook_dataset.program_path = i set_compile_this_program(use_this_as_program_name) cookbook_dataset.set_program_version(use_this_as_program_version) set_on_ihash(cookbook_dataset) cd :log_dir invoke_extracter( cookbook_dataset.program_path, log_dir?, true ) cd log_dir?+remove_archive_stuff_from_the_end(File.basename(i)) run_configure_like_stage exit_program end
#¶ ↑
initialize_a_new_cookbook_for
¶ ↑
The first argument to this method should be the program that the user wants to wish to compile or install, as a String, such as “php” or “ruby” or something like that.
Since as of January 2018, whenever you need an instance from class RBT::Cookbooks::SanitizeCookbook, this method here should be used.
The reason is simple:
-
This method will do all the required invocations needed to properly instantiate a new
Cookbook
instance.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 546 def initialize_a_new_cookbook_for( i = install_this_program?, simple_or_complex = simple_or_complex? ) # ======================================================================= # # We need to assign the primary cookbook dataset. This will be handled # by class SanitizeCookbook, and will be delegated via RBT.action(). # ======================================================================= # cookbook_dataset = action(:cookbook_dataset, i){{ make_use_of_aliases_kept_in_the_file_cookbook_aliases: make_use_of_cookbook_aliases?, simple_or_complex: simple_or_complex? }} set_cookbook_dataset(cookbook_dataset) # Use the appropriate setter-method here. # ======================================================================= # # Sync the make command to be used at once. # ======================================================================= # if cookbook_dataset_use_this_make_command? set_use_this_make_command( cookbook_dataset_use_this_make_command? ) end return i # Always return the dataset as well here. end
#¶ ↑
install_only_headers?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1421 def install_only_headers? @internal_hash[:install_only_the_headers] end
#¶ ↑
install_palemoon
¶ ↑
To invoke this ad-hoc method, try:
rbt --install-palemoon
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1308 def install_palemoon( path = '/home/x/src/palemoon/palemoon-'\ '28.5.2-64bit.tar.xz' ) if File.exist? path _ = remove_archive_from_the_end( File.basename(path) ).sub(/-64bit$/, '') program_name = program_information_return_name(_) program_version = program_information_return_version(_) target = program_dir?+program_name.capitalize+'/'+program_version+'/' create_app_skeleton(target) cd target extract_to = target extract_what_to(path, extract_to) orev 'Done!' else opnn; no_file_at(path) end end
#¶ ↑
install_ruby_gem
(install gem, gem install, gem tag)¶ ↑
Use this method to install a ruby gem, then exit.
The input argument should be the path towards the .gem file in question.
Right now we will always exit when we use this method, by default. This behaviour can be changed through the variable ‘shall_we_exit’.
Invocation example:
ry /home/x/src/ruby/gems/wirble-0.1.3.gem ry $MY_SRC/ruby/gems/unf-0.0.5.gem ry thor
# ¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6310 def install_ruby_gem( this_gem = program_path?, shall_we_exit = exit_after_a_rubygem_has_been_installed? ) do_not_display_the_flexbox do_not_symlink :be_quiet case this_gem when :default this_gem = program_path? end case shall_we_exit when :then_exit, :do_exit shall_we_exit = true when :do_not_exit shall_we_exit = false end # ======================================================================= # # === Download the gem # # If the path to a gem includes a "http" string, then we will assume # that we will first have to download it. # ======================================================================= # if this_gem and this_gem.include? 'http' go_to_base_dir do_download(this_gem) end # ======================================================================= # # Next, install the gem via a system() call. There are several ways # how to install a gem through, most importantly, with or without # dependency management by gem. # ======================================================================= # _ = ("gem install #{return_gem_install_options} #{this_gem}").squeeze(' ') orev _ system _ exit_program if shall_we_exit end
#¶ ↑
install_the_dependencies_of_this_program
¶ ↑
Invocation example:
ry rails --install-its-dependencies
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 829 def install_the_dependencies_of_this_program( this_program = compile_which_program? ) # ======================================================================= # # First obtain the direct-dependencies of the given program at hand. # ======================================================================= # dependencies = required_deps_on? e orev 'Next, installing the '+orange(dependencies.size.to_s)+ "#{rev} dependencies of the program `#{sfancy(this_program)}`." e orev 'These programs are:' e dependencies.each {|this_entry| e slateblue(" #{this_entry}") } e dependencies.each {|this_entry| install_that_program = true # ===================================================================== # # Consider skipping a few of these programs. # ===================================================================== # case this_entry when 'python' target = "#{programs_directory?}Python/Current/bin/python" if File.exist? target install_that_program = false orev "Skipping python as it is already installed at #{sfancy(target)}." end when 'ruby' target = "#{programs_directory?}Ruby/Current/bin/ruby" if File.exist? target install_that_program = false orev "Skipping ruby as it is already installed at #{sfancy(target)}." end end if install_that_program # =================================================================== # # We ought to not quit after a rubygem has been installed. # =================================================================== # _ = RBT::Action::SoftwareManager.new(this_entry, :do_not_run_yet) _.do_not_exit_after_a_rubygem_has_been_installed _.run end } end
#¶ ↑
install_the_linux_kernel_header_files_via_appdir_prefix
¶ ↑
This method essentially does what is described here:
http://www.linuxfromscratch.org/lfs/view/development/chapter05/linux-headers.html
The main difference is that we will use a proper appdir prefix.
Invocation examples:
ry --install-kernel-headers ry --install-linux-headers
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7712 def install_the_linux_kernel_header_files_via_appdir_prefix install_the_linux_kernel_header_files_via_this_prefix(:appdir_prefix) end
#¶ ↑
install_the_linux_kernel_header_files_via_this_prefix
¶ ↑
The argument to this method is the prefix to be used. For example, the default AppDir prefix on my system for the linux kernel is “/home/Programs/Linux/5.7/”.
This method can also be used to specify a prefix for “home” which refers to the “home directory”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1013 def install_the_linux_kernel_header_files_via_this_prefix( use_this_prefix = :appdir_prefix ) _ = initialize_cookbook_dataset_for(:linux) # ======================================================================= # # Get the local path to the latest linux kernel next. # ======================================================================= # program_path = _.program_path? # ======================================================================= # # Designate which prefix is to be used next: # ======================================================================= # case use_this_prefix when :appdir_prefix, :default use_this_prefix = _.prefix? end extract_to = _.extract_to? extract_what_to(program_path, extract_to) { :keep_the_old_directory_if_it_exists } rcp _.program_name_and_program_version? target = extract_to+_.program_name_and_program_version? opne 'Now changing into the following directory: '+sdir(target) cd target run_this_system_command_in_a_coloured_and_padded_manner 'make mrproper' run_this_system_command_in_a_coloured_and_padded_manner 'make headers' if File.exist? 'usr/include/Makefile' remove_file 'usr/include/Makefile' end orev "We are in the directory #{sdir(target)}#{rev}." orev "Doing a #{steelblue('recursive copy action')}"\ "#{rev} next." cpr('usr/include/', use_this_prefix) orev 'Done! The target was at '+sdir(use_this_prefix+'include/') end
#¶ ↑
install_this_flatpak
¶ ↑
This method can be used to install a flatpak from the official flatpak-URL.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7114 def install_this_flatpak( this_program ) # ======================================================================= # # We must first check whether this program has a flatpak-entry. But # before that, we must initialize the dataset for the given program # at hand. # ======================================================================= # initialize_dataset_for(this_program) if has_flatpak_url? cmd = "flatpak install --user #{flatpak_url?}" e run_this_system_command_in_a_coloured_and_padded_manner(cmd) e else orev "The program #{sfancy(this_program)} #{rev}does "\ "not have a registered flatpak-URL." end end
#¶ ↑
is_a_gem_file?¶ ↑
Query whether we have a .gem file at hand here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10802 def is_a_gem_file?( i = program_path? ) if i i.to_s.end_with? '.gem' end end
#¶ ↑
is_meson_build_type?¶ ↑
This method will return true if we can use meson in the current directory; and false otherwise.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1259 def is_meson_build_type? RBT.build_type? == :meson end
#¶ ↑
is_on_gobolinux
?¶ ↑
Query whether we are on GoboLinux or whether we are not.
In the past this was only a check for an environment variable.
Since we will allow commandline options to change this, we also had to use a proper variable to keep track of this.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 538 def is_on_gobolinux? @internal_hash[:is_on_gobolinux] end
#¶ ↑
is_registered?¶ ↑
Determine whether a given program is registered or whether it is not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 988 def is_registered?(i) return RBT.is_available? i end
#¶ ↑
keep_the_extracted_archive?¶ ↑
This is a query method towards a setting kept in the internal Hash variable.
A boolean value will be returned. This boolean value determines whether the archive will be kept after it was extracted, or whether it will be removed again after it was extracted.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13445 def keep_the_extracted_archive? _ = cookbook_dataset_keep_extracted? # ← The default. unless @internal_hash[:keep_the_archive_extracted].nil? _ = @internal_hash[:keep_the_archive_extracted] end return _ end
#¶ ↑
kill_the_main_pid
¶ ↑
This will kill the process that was spawned via IO.popen. Use with care.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6787 def kill_the_main_pid( main_pid = internal_pid? ) if main_pid begin Process.kill('KILL', main_pid) set_internal_pid(nil) rescue Errno::ESRCH end end end
#¶ ↑
last_system_command_was_a_success?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 545 def last_system_command_was_a_success? $CHILD_STATUS.success? end
#¶ ↑
load_data_from_this_gobolinux_recipe
¶ ↑
This method will allow us to load the dataset from a local GoboLinux recipe, as a drop-in replacement.
The most important setting there will be to use:
url="http://ftp.gnome.org/pub/gnome/sources/GConf/3.2/GConf-3.2.6.tar.xz"
which is part of the file called “Recipe”.
The other settings are also useful but not as important.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7247 def load_data_from_this_gobolinux_recipe(i) i = i.to_s.dup # Always work on a new String-copy anyway. case i when 'Dir.pwd' i = return_pwd end # ======================================================================= # # === Handle GoboLinux Recipes past that point # ======================================================================= # if i.include? '/' the_program_is_included # Enable the fact that the program is "included": # ===================================================================== # # Assume the input to be something like '/Depot/jjjjj/GConf/3.2.6-r3/'. # ===================================================================== # if i.count('/') > 1 # At the least two '/'. splitted = i.split('/') program_name = splitted[-2] program_version = splitted[-1] set_program_name(program_name) initialize_yaml_dataset(program_name, :bypass_check) set_program_version(program_version) chop_off_revision_number set_base_dir(i) # =================================================================== # # The position of the Description file. # =================================================================== # description_file = 'Resources/Description' dataset_from_the_description_file = nil assume_default_archive_type # =================================================================== # # Next, read in the information from the file 'Recipe'. # =================================================================== # this_file = 'Recipe' if File.exist? this_file recipe_dataset = File.read(this_file) use_this_regex = /^url="(.+)"/ use_this_url = recipe_dataset.scan(use_this_regex).flatten.first set_url(use_this_url) set_this_archive(File.basename(use_this_url)) else orev 'Something appears to be incorrect - no file '\ 'called '+sfile(this_file)+rev+' could be found.' exit_program end if File.exist? description_file dataset_from_the_description_file = File.read(description_file) # ================================================================= # # Next, use some regexes to properly interprete the dataset. # ================================================================= # regex_for_url1 = /\[Homepage\] (.+)/ regex_for_license = /\[License\] (.+)/ regex_for_description = /\[Description\] (.+)/ regex_for_short_description = /\[Summary\] (.+)/ _regex_for_name = /\[Name\] (.+)/ # ================================================================= # # Next determine some values here. # ================================================================= # dataset_from_the_description_file =~ regex_for_url1 set_url2($1.to_s.dup) # Here we change the "homepage" URL. dataset_from_the_description_file =~ regex_for_license set_license($1.to_s.dup) dataset_from_the_description_file =~ regex_for_description set_description($1.to_s.dup) dataset_from_the_description_file =~ regex_for_short_description set_short_desc($1.to_s.dup) set_short_name(program_name) # ================================================================= # # The following code is probably no longer needed, but we can # keep it for now - maybe one day we have to use it. # dataset_from_the_description_file =~ regex_for_name # this_program = $1.to_s.dup.downcase # set_this_program(this_program) # ================================================================= # attach_program_name_and_program_version determine_program_full_name # This is like: 'gnome-mahjonng-5.08.tar.xz' assemble_program_path unless File.exist?(File.basename(program_full_name?)) e 'As the program does not exist locally, we will download it from:' e e ' '+sfancy(url?.to_s) e download_this_remote_program(url1) end # ================================================================= # # Now we assume that the program must exist locally. # ================================================================= # opne 'The following information is known about this program:' cliner e main_eight? # Show some more information. cliner target = File.basename(program_full_name?) extract_this_archive(target, return_pwd) new_target = dataset_program_name? opnn; cd new_target, :be_verbose do_use_appdir_prefix(:be_quiet) use_default_configure_command # ================================================================= # # Determine the configure options. # ================================================================= # use_this_regex = /^configure_options=\(([\s\S]+)\)$/ # See: http://rubular.com/r/Zy29SMPvLm set_configure_options( recipe_dataset.scan(use_this_regex).flatten.first ) set_configure_base_dir('') set_use_this_build_directory('') do_not_remove_the_extracted_archive # ================================================================= # # Run "configure" next. # ================================================================= # run_configure_via_system(nil, :do_not_change_the_directory) run_premake_make_then_make_install run_all_actions_after_the_make_install_step end end end end
#¶ ↑
load_last_compiled_program
¶ ↑
This essentially does the following:
x = load_yaml('/Depot/Temp/rbt_logs/last_compiled_programs.yml')
To obtain this information from the commandline, try:
rbt --last-compiled-program?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3074 def load_last_compiled_program( _ = RBT.file_compiled_programs ) if File.exist? _ @internal_hash[:last_compiled_program] = load_yaml(_) result = @internal_hash[:last_compiled_program] # ===================================================================== # # If we store it as an Array, the last compiled program is the # one that comes last in that Array, too. # ===================================================================== # result = result.last if result.is_a? Array # ===================================================================== # # It may include a '#' character, in which case we will treat this # as a comment: # ===================================================================== # if result.include? '#' result = result[0, result.index('#')].strip end return result # ← And return the result here. else orev "No file exists at `#{sfile(_)}#{rev}`." orev 'Thus, we can not load anything.' exit_program end end
#¶ ↑
make_file_exists?¶ ↑
Determine whether a “Makefile” exists or whether it does not exist.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 135 def make_file_exists? File.exist? 'Makefile' end
#¶ ↑
name_for_the_build_directory?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13241 def name_for_the_build_directory? @internal_hash[:name_for_the_build_directory] end
#¶ ↑
notify_the_user_as_to_which_program_will_be_compiled_or_installed_next
¶ ↑
Notify the user which program will be compiled/installed next through this method.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14654 def notify_the_user_as_to_which_program_will_be_compiled_or_installed_next( i = compile_which_program?, local_path = program_path? ) orev "The program `#{steelblue(i)}#{rev}` "\ "will be #{compile_or_install_string?} #{rev}next, in "\ "#{lightgreen(mode?.to_s)} #{rev}mode." orev "The #{steelblue('assumed local path')} #{rev}is:" e e " #{sfile(local_path)}" e orev "The program called #{steelblue(i)}#{rev} will be extracted next." end
#¶ ↑
notify_the_user_that_ccache_is_not_available
¶ ↑
Provide some information to the user about the use of ccache.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10734 def notify_the_user_that_ccache_is_not_available orev swarn('You are trying to use ')+ steelblue('ccache')+ swarn(', as specified by the configuration') opnwarn 'file, but ccache could not be found. '+ tomato('Please install ccache if') opnwarn tomato('you wish to use it.')+ rev+' The URL to the latest source would be:' e efancy " #{RBT.return_url1_of_this_program(:ccache)}" e opnwarn 'If you do not want to use ccache, you can '\ 'disable ccache, via' opnwarn 'either of the following two options:' e efancy ' rbt --permanently-disable-ccache' e efancy ' rbt --disable-ccache # this variant will avoid '\ 'ccache just for this run' e opnwarn 'RBT will now continue without ccache.' end
#¶ ↑
notify_the_user_that_cmake_could_not_be_found
¶ ↑
Do note that this method is solely here for notifying/reporting - it may presently not do anything else but to report to the user.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14019 def notify_the_user_that_cmake_could_not_be_found orev "#{swarn('The program ')}#{sfancy('cmake')} #{swarn('could not')} "\ "#{swarn('be found - thus, ')}#{tomato(compile_which_program?)}" opnewarn 'can not be compiled.' opnewarn 'Consider installing cmake if you wish to compile programs' opnewarn 'that require cmake for their compilation.' end
#¶ ↑
notify_the_user_that_no_binary_python_could_be_found
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4935 def notify_the_user_that_no_binary_python_could_be_found orev 'No binary called "'+gold('python')+ rev+'" could be found. This may' orev 'be resolved by a symlink to e. g. python3.' end
#¶ ↑
notify_the_user_that_porg_is_not_available
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1150 def notify_the_user_that_porg_is_not_available orev 'You are trying to use porg, but porg is not installed.' orev 'Please either install porg - or disable the configuration ' orev "option use_porg in the #{slateblue('configuration setting')}#{rev}." end
#¶ ↑
notify_the_user_that_this_old_directory_will_be_removed_next
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7080 def notify_the_user_that_this_old_directory_will_be_removed_next(i) orev tomato('Removing')+rev+' the '+seagreen('old directory')+rev+ ' at `'+sdir(i)+rev+'`.' end
#¶ ↑
notify_the_user_that_this_program_is_NOT_registered_as_part_of_the_RBT_project
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8354 def notify_the_user_that_this_program_is_NOT_registered_as_part_of_the_RBT_project(this_program) orev "The program #{steelblue(this_program)} #{rev}is #{tomato('not')} "\ "#{rev}registered as part of the RBT project." orev 'Thus, it could not be found and, subsequently, it can not be' orev 'installed or compiled.' end
#¶ ↑
notify_the_user_that_this_program_is_missing
¶ ↑
The first argument to this method should be the program that is missing, such as ‘ruby’ or ‘htop’ or ‘glib’.
The method will also notify the user how to install the program via the RBT
scripts, if this is applicable - aka, if this program is registered.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1971 def notify_the_user_that_this_program_is_missing( i = :jam ) i = i.to_s unless i.is_a? String e; cliner(use_colour: :konsole_slateblue) { e "#{rev}#{sfancy(i)} was not found on your system." e e 'As you are running via the RBT scripts, you can possibly '\ 'install '+simp(i) e 'by issuing the following command:' e e ' '+sfancy("rbt #{i}") e # ===================================================================== # # Extra options can be passed into the block to this method. # ===================================================================== # if block_given? yield end }; e end
#¶ ↑
operating_system_in_use?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11544 def operating_system_in_use?( i = RUBY_PLATFORM ) case i # ======================================================================= # # === linux # ======================================================================= # when /linux$/ # e. g. "x86_64-linux" 'Linux' # ======================================================================= # # === win # ======================================================================= # when /win/, /mingw/ 'Windows' else 'Undetermined (as of yet - please report it upstream)' end end
#¶ ↑
opnn (opnn tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14607 def opnn( optional_i = { namespace: namespace? } ) if use_opn? installer_constant?.opnn(optional_i) end end
#¶ ↑
original_start_directory?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 756 def original_start_directory? @internal_hash[:original_start_directory] end
#¶ ↑
output_all_urls
¶ ↑
This method will output all URLs of every registered program.
Invocation example:
ry --output_all_urls
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9209 def output_all_urls require 'rbt/cookbooks/all_urls/all_urls.rb' dataset = RBT.all_urls(:no_opn).result? # Tap into this method here, without outputting the namespace. dataset = dataset.map {|entry| entry[0] = ' '+(entry[0]+' ').ljust(30) entry.join }.join("\n") store_where = rbt_log_dir?+'all_program_urls.md' File.delete(store_where) if File.exist? store_where # Let's get rid of the old file first. orev "Storing into #{sfile(store_where)}" save_file(dataset, store_where) end
#¶ ↑
package_rbt_scripts
(package tag, release tag)¶ ↑
You can use this method to package the RBT
scripts.
A specialized class will do this for us, class PackageRbtScripts
.
Invocation examples:
ry --package_rbt_scripts ry --release
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8466 def package_rbt_scripts( also_exit = false ) action(:package_rbt_scripts) also_exit = true if also_exit == :then_exit exit_program if also_exit end
#¶ ↑
package_this_appdir
¶ ↑
Invocation example:
ry --package-appdir=htop
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4004 def package_this_appdir(i) target = programs_dir?+i.capitalize+'/Current' if File.exist?(target) and File.symlink?(target) old_pwd = return_pwd initialize_dataset_for(i) cd target use_this_as_the_archive_name = i.downcase+'-'+program_version? to_tar_xz("#{target}*") {{ use_this_archive_name: use_this_as_the_archive_name }} full_target = target+use_this_as_the_archive_name if File.exist? full_target mv(full_target, old_pwd) end end end
#¶ ↑
parameters_to_make?¶ ↑
The aliased method to this method, called make_options?, is mildly discouraged after 12.04.2019. The primary reason for this is that the name parameters_to_make? is more explicit, and thus better in the long run (less confusing).
In September 2022 the alias .make_options?() was commented out.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11365 def parameters_to_make? _ = @internal_hash[:parameters_to_make] if _.nil? _ = cookbook_dataset_parameters_to_make? end return _ # Do not use .to_s here. end
#¶ ↑
permanently_add_this_global_flag
¶ ↑
Use this method in order to permanently add a new global flag, into the file called “global_flags.yml”.
To test this method, try:
ry --add-global-flag=--disable-static
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5265 def permanently_add_this_global_flag(i) i = i.to_s.dup into = RBT.file_global_flags orev "Now appending the flag `#{sfancy(i)}` into the "\ "file `#{sfile(into)}`." old_file_content = ''.dup if File.exist? into old_file_content << File.read(into).strip end old_file_content << " #{i}" what = old_file_content write_what_into(what, into) if is_on_roebe? into = ROEBE_FILE_GLOBAL_FLAGS orev 'Now appending the flag `'+sfancy(i)+rev+ '` into the file `'+sfile(into)+'`.' write_what_into(what, into) end end
#¶ ↑
permanently_disable_porg
¶ ↑
Permanently disable porg via this method.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4756 def permanently_disable_porg if use_porg? orev 'Disabling porg.' if configuration?.respond_to? :use_porg= configuration?.use_porg = false if configuration?.respond_to? :save_config configuration?.save_config else what = false into = FILE_USE_PORG orev "Storing into `#{sfile(into)}#{rev}`." write_what_into(what, into) end else orev 'The configuration-object is not functional - it does not' orev 'respond to the method called .use_porg=' end else orev 'Porg is already disabled.' end end
#¶ ↑
permanently_do_not_rename_the_kde_konsole_tab
¶ ↑
Invocation example:
ry pango --permanently-do-not-rename-tab
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4668 def permanently_do_not_rename_the_kde_konsole_tab orev 'Now permanently disabling the rename-the-kde-konsole-tab feature.' configuration?.rename_tab_title = false into = RBT.file_rename_tab_title write_what_into(false, into) if is_on_roebe? into = RUBY_SRC_DIR_RBT_YAML_AT_HOME+'configuration/'+ File.basename(into) orev "Also storing in `#{sfile(into)}#{rev}`." write_what_into(false, into) end end
#¶ ↑
permanently_enable_is_on_gobolinux
¶ ↑
Use this method to “enable” the GoboLinux file layout.
To call this method from the commandline, do:
ry --permanently-enable-is-on-gobolinux
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2531 def permanently_enable_is_on_gobolinux( be_verbose = :be_verbose ) case be_verbose when :be_verbose be_verbose = true end _ = RBT.file_is_on_gobolinux if File.exist? _ orev "The file at `#{sfile(_)}#{rev}` already exists." else if be_verbose orev "Enabling GoboLinux layout now via the file `#{sfile(_)}#{rev}`." end orev "Now creating the file #{sfile(_)}#{rev}." create_file(_) enable_is_on_gobolinux # And also enable the GoboLinux behaviour. end end
#¶ ↑
permanently_remove_this_global_flag
¶ ↑
Use this method in order to permanently remove a new global flag, into the file called “global_flags.yml”.
To test this method, try:
rbt --remove-global-flag=--disable-static
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12988 def permanently_remove_this_global_flag(i) i = i.to_s.dup into = RBT.file_global_flags old_file_content = ''.dup if File.exist? into old_file_content << File.read(into).strip end if old_file_content.include? i orev 'Now removing the flag `'+sfancy(i)+rev+'` from the '\ 'file `'+sfile(into)+rev+'`.' old_file_content.gsub!(/#{i}/,'') else orev "The flag `#{sfancy(i)}#{rev}` can not be removed from "\ "the file `#{sfile(into)}#{rev}`." orev 'because this file does not have that flag.' end what = old_file_content write_what_into(what, into) if is_on_roebe? into = ROEBE_FILE_GLOBAL_FLAGS orev 'Now removing the flag `'+sfancy(i)+rev+'` from the '\ 'file `'+sfile(into)+rev+'`.' write_what_into(what, into) end end
#¶ ↑
permanently_set_programs_dir
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2078 def permanently_set_programs_dir( what, into = FILE_PROGRAMS_DIRECTORY ) orev 'Storing '+sfancy(what)+rev+' into the file `'+sfile(into)+rev+'`.' write_what_into(what, into) if is_on_roebe? into = RUBY_SRC_DIR_RBT_YAML+'configuration/programs_directory.yml' orev 'Storing '+sfancy(what)+rev+' into the file `'+sfile(into)+rev+ '`.' write_what_into(what, into) end end
#¶ ↑
pkgconfig_files?¶ ↑
Query method over the registered .pc files of a particular program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1098 def pkgconfig_files? cookbook_dataset?.pkgconfig_files? end
#¶ ↑
populate_the_internal_hash_with_values_specific_to_this_class
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/reset.rb, line 38 def populate_the_internal_hash_with_values_specific_to_this_class reset_user_definable_variables reset_the_invariant_dataset_to_the_internal_hash end
#¶ ↑
postinstallation?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13511 def postinstallation? _ = cookbook_dataset_postinstall? # ======================================================================= # # The following part is, as of January 2019, only added when we have # modified this variable through the method set_user_prefix(). The # user can (currently) not modify this variable on his/her own. # ======================================================================= # unless @internal_hash[:postinstallation].nil? _ = @internal_hash[:postinstallation] end return _ # Return the result here. end
#¶ ↑
pre_make_install_sed
?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 567 def pre_make_install_sed? cookbook_dataset?.pre_make_install_sed? end
#¶ ↑
prefix_object?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12595 def prefix_object? @internal_hash[:prefix_object] end
#¶ ↑
prepare_for_gcc
¶ ↑
This method can be used to aid in the preparation of compiling a new GCC from source.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4252 def prepare_for_gcc # ======================================================================= # # === gmp # ======================================================================= # initialize_cookbook_dataset_for(:gmp) cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose } extract_what_to( File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists ) rename( remove_archive_at_the_end( File.basename(cookbook_dataset_program_path?) ), 'gmp' ) # ======================================================================= # # === mpc # ======================================================================= # initialize_cookbook_dataset_for(:mpc) cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose } extract_what_to(File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists) rename( remove_archive_at_the_end( File.basename(cookbook_dataset_program_path?) ), 'mpc' ) # ======================================================================= # # === mpfr # ======================================================================= # initialize_cookbook_dataset_for(:mpfr) cp(cookbook_dataset_program_path?, return_pwd) { :be_verbose } extract_what_to(File.basename(cookbook_dataset_program_path?), return_pwd, :keep_the_old_directory_if_it_exists) rename( remove_archive_at_the_end( File.basename(cookbook_dataset_program_path?) ), 'mpfr' ) end
#¶ ↑
prepare_symlink_program_instance
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1394 def prepare_symlink_program_instance symlink_program = symlink_program? # ======================================================================= # # Assign the prefix to SymlinkProgram next: # ======================================================================= # symlink_program?.set_use_this_program( prefix? ) symlink_program.disable_colours unless use_colours? symlink_program.do_not_symlink = do_not_symlink? # Honour configure option here. symlink_program.use_opn = RBT::Action::SoftwareManager.show_the_classname? # ======================================================================= # # Next, prevent auto-registering into the local yaml database. # This part is already handled via register_program() in # the file postinstall.rb # ======================================================================= # symlink_program.do_not_register_into_the_local_yaml_database end
#¶ ↑
prepend_env_path_with
¶ ↑
This method will effectively prepend to the PATH variable.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14099 def prepend_env_path_with(i = '/usr/bin/') unless i.end_with? ':' i = i.dup if i.frozen? i << ':' end set_path("#{i}#{query_path?}") end
#¶ ↑
program_has_to_be_compiled?¶ ↑
The query-method program_has_to_be_compiled? determines whether our program has to be compiled or whether it does not have to be compiled.
For example, ruby .gem files typically do not have to be compiled, whereas C/C++ projects have to be compiled.
Note that this requires a setting in the .yml file. While it could probably be automatically determined whether a program has to be compiled, for the time being (November 2019) we will simply define this manually.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12559 def program_has_to_be_compiled? cookbook_dataset? and cookbook_dataset_program_has_to_be_compiled? end
#¶ ↑
program_information_return_name
¶ ↑
This method can be used to specifically return the short name of a given input-String. That input-String usually is a remote URL to some program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2150 def program_information_return_name(i) program_information_return_short_name(File.basename(i)) end
#¶ ↑
program_information_return_short_name
¶ ↑
In the past ProgramInformation was called directly, but because ProgramInformation may fail, it was tedious to trace back what happened where, and why it failed. So the method here was created, on 11.11.2019.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2119 def program_information_return_short_name(i) if i.include? '-' ProgramInformation.return_short_name(i) else i end end
#¶ ↑
program_information_return_version
¶ ↑
This “substitutes” calls to ProgramInformation.return_version().
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2132 def program_information_return_version(i) ProgramInformation.return_version(File.basename(i)) end
#¶ ↑
program_version
?¶ ↑
This method will return the program version in use. The default will be to simply use the version stored in the cookbook dataset, but we also allow for the user to supply commandline-flags to use any other program version that he/she desires to use.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1328 def program_version? _ = cookbook_dataset_program_version? # ← Default value. # ======================================================================= # # The user can override it. # ======================================================================= # if @internal_hash[:use_this_specific_program_version] _ = @internal_hash[:use_this_specific_program_version] end #_.delete('/') if _ # A bit hackish, since it is a workaround, but necessary for now (Jan 2019). # ^^^ the above was disabled as of September 2022. Not sure if it will be # reinstated. We hopefully no longer need it now after the rewrite. return _ end
#¶ ↑
purge_all_man_files_in_the_programs_hierarchy
¶ ↑
Invoke this method by issuing something like this:
ry --nomanpage
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5336 def purge_all_man_files_in_the_programs_hierarchy target = programs_directory? orev "Now purging all man-pages in `#{sdir(target)}#{rev}`." orev '(Note that we will only work on entries pointed at '\ 'with a Current symlink.)' Dir[target+'*'].each {|entry| entry << '/' unless entry.end_with? '/' current = entry + 'Current' if File.symlink? current # =================================================================== # # Ok, the Current → symlink exists, thus we can continue. # =================================================================== # manpage = "#{File.readlink(current)}/share/man/" manpage = rds(manpage) if File.exist? manpage and File.directory? manpage orev "Now #{tomato('removing')} #{rev}the "\ "directory `#{sdir(manpage)}#{rev}`." remove_directory(manpage) unless manpage.squeeze('/') == '/' # Trivial "safeguard". end end } end
#¶ ↑
purge_all_settings_directories
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3379 def purge_all_settings_directories # ======================================================================= # # We need to avoid entries such as: # # /home/Programs/Qt/5.14.0/qml/QtQuick/VirtualKeyboard/Settings # # This explains the .count('/') action in the code below. # ======================================================================= # all_settings_directories = Dir[programs_dir?+'**/Settings'].select {|entry| File.directory?(entry) and entry.end_with?('Settings') and (entry.count('/') == 4) }.sort orev 'Next removing '+sfancy(all_settings_directories.size)+' directories.' remove_these_directories(all_settings_directories) { :be_verbose } end
#¶ ↑
purge_fhs_binaries_of_this_program
¶ ↑
This method will purge binaries that may reside at the /usr/bin/ hierarchy. Be careful when using this - only use it when you are sure that you want this functionality.
Invocation examples:
ry littleutils --purge-fhs-binaries ry --purge-traditional-binaries-from=xscreensaver
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5594 def purge_fhs_binaries_of_this_program( i = compile_which_program? ) if i.nil? orev 'Please provide a valid program name to this method.' return end PurgeBinariesOfThisProgram.new(i.downcase) end
#¶ ↑
purge_fhs_libraries_of_this_program
¶ ↑
Get rid of all /usr/lib/ libraries of the respective program at hand.
Invocation example:
ry --fhs-purge-libraries=libgc
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4348 def purge_fhs_libraries_of_this_program( i = compile_which_program? ) if i.nil? orev 'Please provide a valid program name to this method.' return end PurgeLibrariesOfThisProgram.new(i) end
#¶ ↑
purge_these_binaries
¶ ↑
This method can be used to purge binaries.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7635 def purge_these_binaries( i = binaries? ) removed_n_binaries = 0 orev "Now attempting to remove #{sfancy(i.size.to_s)} #{rev}binaries:" e i.each {|this_binary| target = "/usr/bin/#{this_binary}" ftype = nil begin ftype = File.ftype(target) rescue Errno::ENOENT; end if File.exist? target orev "Deleting the file `#{sfile(target)}#{rev}` next." remove_file(target) removed_n_binaries += 1 else if ftype == 'link' orev "Deleting the stray symlink at `#{sfile(target)}#{rev}` next." remove_symlink(target) end end } e if removed_n_binaries == 0 orev "None of these binaries could be "\ "found at #{sdir('/usr/bin/')}#{rev}." end end
#¶ ↑
query_configuration_options
¶ ↑
This method will query the configuration option of a given program.
Invocation example:
ry glibc qco
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9652 def query_configuration_options( i = compile_this_program? ) action(:show_configuration_options, i) exit_program end
#¶ ↑
query_for
¶ ↑
This method is especially important for the external class called Flexbox.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11649 def query_for(i) case i.to_s # ======================================================================= # # === "Will be extracted towards" # ======================================================================= # when /^Will(-|_| )?be(-|_| )?extracted(-|_| )?towards:?$/i, /^extract(-|_| )?to(-|_| )?this(-|_| )?directory\??$/i, /^extract(-|_| )?to\??$/i will_be_extracted_towards? # ======================================================================= # # === "Assumed Operating System:" # ======================================================================= # when /^Assumed Operating System:?$/i operating_system_in_use? # ======================================================================= # # === "Prefix:" # ======================================================================= # when /^Prefix:?$/i prefix? # ======================================================================= # # === "Required dependencies on:" # ======================================================================= # when /^Required(-|_| )?dependencies(-|_| )?on:?$/i required_dependencies_on? # ======================================================================= # # === "Host architecture in use:" # ======================================================================= # when /^Host(-|_| )?architecture(-|_| )?in(-|_| )?use:?$/i host_achiteture_in_use? # ======================================================================= # # === "CFLAGS in use:" # ======================================================================= # when /^CFLAGS(-|_| )?in(-|_| )?use:?$/i verbose_cflags_in_use? # Use a more verbose variant for the CFLAGs in use. # ======================================================================= # # === "Build system to be used" # ======================================================================= # when /^Build(-|_| )?system(-|_| )?to(-|_| )?be(-|_| )?used:?$/i build_system_to_be_used? # ======================================================================= # # === "Use a build directory:" # ======================================================================= # when /^Use(-|_| )?a(-|_| )?build(-|_| )?directory:?$/i use_a_build_directory? # ======================================================================= # # === "Compiler to be used:" # ======================================================================= # when /^Compiler(-|_| )?to(-|_| )?be(-|_| )?used:?$/i compiler_to_be_used? # ======================================================================= # # === "Will ccache be used:" # ======================================================================= # when /^Will(-|_| )?ccache(-|_| )?be(-|_| )?used:?$/i will_ccache_be_used? else # ===================================================================== # # Otherwise we will query the cookbook-dataset. This may sometimes # lead to problems, so it is better to define every query-related # method in the case-when menu above. # ===================================================================== # cookbook_dataset?.query_for(i) end end
#¶ ↑
query_for_configure_options_or_meson_options_or_cmake_options
¶ ↑
Return either cmake or meson or configure options accordingly.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11569 def query_for_configure_options_or_meson_options_or_cmake_options( i = 'configure-options:' ) case i # ======================================================================= # # === configure options: # ======================================================================= # when /^configure(-|_| )?options:?$/i case build_system? when 'cmake' return_cmake_configure_options_while_considering_GNU_configure_options when 'meson' meson_configure_options?.to_s else configure_options? end end end
#¶ ↑
register_all_protos_for_compilation
¶ ↑
Invoke this method like so:
ry --protos
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5719 def register_all_protos_for_compilation proto_programs = available_programs?.select {|entry| entry.include?('proto') } proto_programs.reject! {|line| line.include? 'protobuf' } # ======================================================================= # # Reject those that are .gem files next - but this will only work if # the directory with expanded cookbooks is available: # ======================================================================= # if directory_expanded_cookbooks_exists? proto_programs.reject! {|name_of_the_program| this_file = directory_expanded_cookbooks+name_of_the_program+'.yml' if File.exist? this_file dataset = load_yaml(this_file) dataset['program_path'].end_with? '.gem' else orev 'No file called '+sfile(this_file)+rev+' was found.' nil end } end orev "We will next compile all "\ "#{sfancy(proto_programs.size.to_s)} "\ "#{rev}proto-programs." set_compile_these_programs(proto_programs) end
#¶ ↑
register_configure_line_into_configure_database
¶ ↑
This method will register the complete configure-line used by the program at hand, into a yaml “database”. This is just a single .yml file that keeps track of all configure options used when compiling a program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4497 def register_configure_line_into_configure_database( compile_this_program = compile_which_program?, store_this = full_configure_command?.dup ) unless store_this.empty? # ===================================================================== # # First load up the old "database" if it exists. # # This is a "global" database, in the sense that it may typically # reside at a location like this: # # /home/Temp/rbt/configure_command_database.yml # # Do note that the RBT project will also store this on a per-application # basis in the corresponding AppDir directory (under Resources/). # Since not every program is compiled via an AppDir, we need both # the global database, and a per-app specific entry. # ===================================================================== # into = RBT.file_configure_database? hash = {} # ===================================================================== # # Load the dataset from the file if it already exists. # ===================================================================== # if File.exist? into hash.update(YAML.load_file(into)) end # ===================================================================== # # We do not need to delete any old entry, because the following line # will overwrite the old content anyway, if it exists. # ===================================================================== # hash[compile_this_program] = store_this what = YAML.dump(hash) orev 'Storing the configure command' orev " #{sfancy(store_this)}" orev "into the file `#{sfile(into)}#{rev}`." write_what_into(what, into) end end
#¶ ↑
register_last_compiled_program
¶ ↑
This method will try to store the last compiled program into the file determined via the method call RBT.file_compiled_program().
We will only store if the entry is DIFFERENT to the last one though.
This file is:
$RBT/yaml/last_compiled_program.yml
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7147 def register_last_compiled_program( i = compile_which_program? ) unless has_a_problem_occurred? unless do_not_compile? and !register_the_last_compiled_program? # Continue only if we do want to compile. file = RBT.file_compiled_programs base_dir = File.dirname(file) mkdir(base_dir) unless Dir.exist? base_dir if File.exist?(file) and !File.empty?(file) # Must check whether the file exists first. array_dataset = YAML.load_file(file) else array_dataset = [] end if array_dataset.respond_to? :uniq! array_dataset.uniq! # else # opne swarn('Some minor problem occurred:') end unless (array_dataset.last == i) and !array_dataset.empty? # Storing only if it is different. orev 'Trying to register the last compiled program '\ '(`'+springgreen(i)+ rev+'`) into the file:' opne " #{sfile(file)}" # ================================================================= # # Remove any old entries, if they exist. # ================================================================= # if array_dataset.include? i array_dataset.reject! {|entry| entry == i } end # ================================================================= # # And next, add that entry: # ================================================================= # array_dataset << i what = YAML.dump(array_dataset) # ================================================================= # # Simply append to the dataset (aka file) at hand. # ================================================================= # write_what_into(what, file) end if array_dataset.respond_to? :last end end end
#¶ ↑
register_sigint
¶ ↑
We have to register the siginterrupts, so as to gracefully handle user-interrupts via Ctrl-C.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6805 def register_sigint Signal.trap('SIGINT') { do_set_keep_extracted(:be_silent) do_not_run_ldconfig remove_compiling_is_in_progress orev 'Exiting now at once.' exit_program } end
#¶ ↑
register_that_this_program_is_currently_being_compiled
¶ ↑
This method will register that a given program is currently being compiled.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9084 def register_that_this_program_is_currently_being_compiled( into = RBT.file_status # ← This may be e. g. "/Depot/Temp/rbt/status.yml". ) dataset = {} if File.exist? into dataset.merge!(YAML.load_file(into)) end unless dataset.has_key? 'currently_compiling_these_programs' dataset['currently_compiling_these_programs'] = [] end dataset['currently_compiling_these_programs'] << compile_this_program? what = YAML.dump(dataset) # ======================================================================= # # We must sure that the base directory exists. # ======================================================================= # unless File.directory?(File.dirname(into)) mkdir(File.dirname(into)) end write_what_into(what, into) end
#¶ ↑
remove_all_symlinks
¶ ↑
Delegate to RBT::RemoveAllSymlinks
for this action.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4363 def remove_all_symlinks action(:RemoveAllSymlinks) end
#¶ ↑
remove_all_temp_directories
¶ ↑
This method will remove all directories in the /Depot/Temp hierarchy. It was added since it is sometimes easier to just remove all extracted archives via batch-process.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11195 def remove_all_temp_directories _ = rbt_log_dir? # ======================================================================= # # Select all directories in that directory next: # ======================================================================= # all_directories_there = Dir["#{_}*"].select {|entry| File.directory? entry } orev "All #{sfancy(all_directories_there.size.to_s)} "\ "#{rev}directories in the #{sdir(_)} #{rev}hierarchy will be removed." remove_these_directories(all_directories_there) end
#¶ ↑
rename_tab_title?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1156 def rename_tab_title? @internal_hash[:rename_tab_title] end
#¶ ↑
replace_symlinks
¶ ↑
Delegate towards RBT::ReplaceSymlinks
here. We will work on the current working directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2695 def replace_symlinks( from_where = return_pwd ) RBT::ReplaceSymlinks.new(from_where) # bl $RBT/replace_symlinks.rb end
#¶ ↑
report_all_programs_that_make_use_of_a_build_directory
¶ ↑
This method can report all programs that make use of a build directory. Note that this presently depends on the existance of the directory expanded_cookbooks.
Usage example:
installer --show-all-programs-that-make-use-of-a-build-directory
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2934 def report_all_programs_that_make_use_of_a_build_directory orev 'Trying to determine all programs that use '\ 'a build-directory ...' orev 'This may take a moment ...' use_this_key = :use_build_directory # It is stored as a Symbol. if expanded_directory_exists? # ===================================================================== # # Find all cookbooks in the expanded-cookbook-directory next: # ===================================================================== # target = directory_expanded_cookbooks? all_files = Dir["#{target}*.yml"] all_files.select! {|entry| dataset = YAML.load_file(entry) dataset[use_this_key] and (dataset[use_this_key] == true) # Obtain all entries with this key here. } all_files.map! {|entry| File.basename(entry).sub(/\.yml$/,'') } if all_files.empty? orev 'No cookbook recipe makes use of a build directory.' else orev "The following #{slateblue(all_files.size.to_s)} #{rev}programs "\ "make use of a build directory:" all_files.each_with_index {|this_program, index| index += 1 padded_index = index.to_s.rjust(4).ljust(6) colourized_and_padded_index = royalblue(padded_index) e colourized_and_padded_index+ lightblue(this_program) } end else # ===================================================================== # # else notify the user how to create the relevant directory. # ===================================================================== # orev 'The expanded directory does not exist. You can (re)create it' orev 'by issuing:' e e ' rbt --create-expanded-directory' e end end
#¶ ↑
report_finished_installing_this_program
¶ ↑
Report that we have finished compiling the program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11918 def report_finished_installing_this_program( i = compile_this_program? ) unless do_not_compile? unless problem? || an_error_has_occurred? orev "Finished installing the program `#{sfancy(i)}#{rev}`." end end end
#¶ ↑
report_how_many_registered_cookbook_aliases_are_available
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8445 def report_how_many_registered_cookbook_aliases_are_available( use_this_file = RBT.file_cookbook_aliases? ) orev "There are a total of "\ "#{steelblue(YAML.load_file(use_this_file).keys.size)} "\ "#{rev}cookbook-aliases registered." end
#¶ ↑
report_n_programs
¶ ↑
Report how many programs (cookbook files) are currently registered in the RBT
project.
Commandline-invocation example:
rbt --report-n-programs
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8901 def report_n_programs action(:report_the_registered_programs) end
#¶ ↑
report_rbt_version
¶ ↑
This method will report the version in use by the RBT
project.
Invocation examples:
ry --version ry version?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9887 def report_rbt_version( optional_shall_we_exit = false ) case optional_shall_we_exit when :also_exit, :then_exit optional_shall_we_exit = true end # ======================================================================= # # We will show the version of the RBT scripts, and we will also # display when the project was last updated. # ======================================================================= # RBT.report_rbt_version(:also_show_when_the_project_was_last_updated) exit if optional_shall_we_exit end
#¶ ↑
report_size_of_these_programs
¶ ↑
This method will report the size of the issued programs.
The programs are to be given as the first argument to this method, ideally as an Array.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7201 def report_size_of_these_programs( i, size_of_the_programs = 0 ) if i.is_a? String and i.include?('=') i = i.to_s.dup if i.frozen? i.gsub!(/--size=/,'') i = i.split(',') if i.include? ',' end i = [i] unless i.is_a? Array i.each {|entry| dataset = self.new(entry) unless use_colours? dataset.disable_colours end size = dataset.size?.to_i orev "Now working on #{sfancy(entry.rjust(8))}"\ "#{rev} (Size: #{size.to_s.rjust(8)} bytes)" size_of_the_programs += size } e orev 'The size of the programs '+sfancy(i.join(','))+"#{rev} is:" e if Object.const_defined?(:Roebe) and Roebe.const_defined?(:HumanReadable) size_of_the_programs = Roebe::HumanReadable[size_of_the_programs] end result = " #{simp(size_of_the_programs.to_s)}".dup result << rev+' bytes' unless size_of_the_programs.to_s.strip.end_with? 'B' orev result e end
#¶ ↑
report_status_information
¶ ↑
Invocation example:
ry --report-status
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9559 def report_status_information e e 'The source directory is at: '+ sdir(RBT.source_dir?) e rev+'The temp directory is at: '+ sdir(RBT.temp_dir?) report_where_archives_will_be_extracted_into e end
#¶ ↑
report_the_amount_of_binaries
¶ ↑
Invocation examples:
ry glib --n-binaries? Installer glib --n-binaries?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9029 def report_the_amount_of_binaries( i = compile_which_program? ) ensure_proper_dataset_for(i) if cookbook_dataset?.nil? _ = binaries? orev "The program #{sfancy(i)}#{rev}' will "\ "install #{sfancy(_.size.to_s)}#{rev} binaries." end
#¶ ↑
report_the_kde_status
¶ ↑
This method will report the “status” of the KDE project, as far as the cookbooks project is concerned.
What is meant here is that this method will simply report the main constants that handle the remote URL to kde projects.
To invoke this method, do this on the commandline:
rbt --report-the-kde-status
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5961 def report_the_kde_status require 'rbt/utility_scripts/report_the_kde_status.rb' RBT.report_the_kde_status end
#¶ ↑
report_where_we_will_store_logs
¶ ↑
This will ask where we store our BT-Related files. The Config object defines that.
To trigger this, do:
ry --store_where?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3838 def report_where_we_will_store_logs orev "Log-files will be stored into the directory `"\ "#{sdir(log_dir?)}#{rev}`." end
#¶ ↑
report_whether_a_build_directory_will_be_used_for_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 879 def report_whether_a_build_directory_will_be_used_for_this_program orev 'Will a '+teal('build directory')+rev+ ' be used for the program '+ sfancy(compile_which_program?)+'? '+ simp( verbose_truth(use_build_directory?).delete('.') )+'.' end
#¶ ↑
report_whether_this_program_is_included_or_whether_it_is_not
¶ ↑
This method will notify the user as to whether the given program passed into this method is registered, as part of the RBT
project, or whether it is not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3177 def report_whether_this_program_is_included_or_whether_it_is_not( i = program? ) e teal("Is #{program} included in the RBT project?: ")+ verbose_truth( is_this_program_included?(i, :be_quiet) ) end
#¶ ↑
report_whether_we_are_on_gobolinux
¶ ↑
To invoke this method, do:
rbt --is-on-gobolinux?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2514 def report_whether_we_are_on_gobolinux orev 'Are we on GoboLinux: '+ royalblue( verbose_truth(is_on_gobolinux?.to_s) ) end
#¶ ↑
report_whether_we_will_use_porg
¶ ↑
To invoke this method, issue:
ry --use-porg?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 337 def report_whether_we_will_use_porg orev "Will RBT make use of #{teal('porg')}#{rev}: "\ "#{royalblue(verbose_truth(use_porg?.to_s))}" end
#¶ ↑
report_which_programs_can_be_compiled_statically
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10338 def report_which_programs_can_be_compiled_statically use_this_key = :can_be_compiled_statically selection = available_programs?.select {|this_program| if does_this_expanded_cookbook_file_exist_for_this_program?(this_program) dataset = load_dataset_from_this_expanded_cookbook(this_program) _ = dataset[use_this_key] (_ == 'yes') or (_.to_s == 'true') else false end } if selection.empty? orev 'No program that can be compiled statically was found.' orev 'This is an incorrect result, though. Have you expanded' orev 'your local dataset already?' orev 'If not, run:' e e ' rbt --expand-dataset' e else orev 'The following programs can be compiled statically:' e selection.each_with_index {|this_program, index| index += 1 e royalblue(" #{index.to_s.rjust(3)}) ")+ steelblue("#{this_program}") } e end end
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
RBT::Action#reset
# File lib/rbt/actions/individual_actions/software_manager/reset.rb, line 20 def reset # ======================================================================= # # Note that the super() call will also define the variable # @internal_hash properly. Hence why it must come first, # as other definitions depend on it. # ======================================================================= # super() infer_the_namespace reset_the_invariant_dataset_to_the_internal_hash reset_user_definable_variables extract_to_default_directory disable_colours unless RBT.use_colours? set_program_path(nil) # This should come last within reset(). end
#¶ ↑
reset_the_invariant_dataset_to_the_internal_hash
(invariant tag)¶ ↑
The variants in this method are, by default, not amenable any user input at all. They are thus only used internally by the class.
This is thus the main difference to the other method used to fill up @internal_hash.
The values defined in the method here are mostly done to use default values.
Note that this may not be entirely true, so this method is a bit arbitrary. Still, it is true for other internal entries, such as :have_we_successfully_installed_the_program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/reset.rb, line 59 def reset_the_invariant_dataset_to_the_internal_hash # ======================================================================= # # === :make # # Instantiate a new RBT::Make object next, as our wrapper to 'make'. # ======================================================================= # @internal_hash[:make] = RBT::Make.new # ======================================================================= # # === :make_install_stage_was_a_success # # Whether the "make install" stage was a success. This is true by # default and will only become false if an error is encountered. # ======================================================================= # @internal_hash[:make_install_stage_was_a_success] = true # ======================================================================= # # === :has_the_program_been_installed_successfully # # By default, all programs will have been installed successfully. The # next variable keeps track of this. # ======================================================================= # @internal_hash[:has_the_program_been_installed_successfully] = true # ======================================================================= # # === :may_we_run_ninja # # By default we can always run ninja again. # ======================================================================= # @internal_hash[:may_we_run_ninja] = true # ======================================================================= # # === :may_we_initialize_a_new_cookbook_dataset # # The next variable must be true by default. # ======================================================================= # @internal_hash[:may_we_initialize_a_new_cookbook_dataset] = true # ======================================================================= # # === :pid # ======================================================================= # @internal_hash[:pid] = nil # ======================================================================= # # === use_gobolinux_symlinkprogram # # Next, determine whether we will make use of GoboLinux's SymlinkProgram. # This will be automatically changed if we are on GoboLinux. For other # systems we will prefer to use SymlinkProgram from RBT itself. # ======================================================================= # @internal_hash[:use_gobolinux_symlinkprogram] = false # ======================================================================= # # === :append_shell_error_code # # If this variable is set to true then we will append the shell # error code aka ' 2>&1'. This is true by default, so we will # append it. # ======================================================================= # @internal_hash[:append_shell_error_code] = true # ======================================================================= # # === :run_make_install # # By default, we will run "make install". This covers most programs # that are to be compiled from source. # ======================================================================= # @internal_hash[:run_make_install] = true # ======================================================================= # # === :try_to_recompile_upon_error # ======================================================================= # @internal_hash[:try_to_recompile_upon_error] = true # ======================================================================= # # === :dataset_from_the_file_cookbook_chained_programs # # This will contain a dataset that looks like this: # # "lxqt"=> ["lxqtbuildtools", # "libsysstat", # "qtermwidget", # "liblxqt", # ======================================================================= # @internal_hash[:dataset_from_the_file_cookbook_chained_programs] = YAML.load_file(FILE_COOKBOOK_CHAINED_PROGRAMS) # ======================================================================= # # === :have_we_successfully_installed_the_program # # The next variable keeps track over as to whether we have # successfully installed the program or whether we have not. # # By default we will assume this is not the case so, hence why the # value is false here. # ======================================================================= # @internal_hash[:have_we_successfully_installed_the_program] = false # ======================================================================= # # === :try_to_autofix # ======================================================================= # @internal_hash[:try_to_autofix] = true # ======================================================================= # # === :do_not_use_special_environment_flags # # Whether we are allowed to use special ENV flags. By default we are # allowed to use special flags, hence why the variable is set to false. # ======================================================================= # @internal_hash[:do_not_use_special_environment_flags] = false # ======================================================================= # # === :last_compiled_program # ======================================================================= # @internal_hash[:last_compiled_program] = nil # Define it once at least. # ======================================================================= # # === :exit_after_a_rubygem_has_been_installed # ======================================================================= # @internal_hash[:exit_after_a_rubygem_has_been_installed] = false # ======================================================================= # # === :time_compilation # # Determine whether we shall time the compilation or whether we shall # not. # ======================================================================= # file_time_compilation = FILE_TIME_COMPILATION if File.exist? file_time_compilation @internal_hash[:time_compilation] = YAML.load_file(file_time_compilation) if @internal_hash[:time_compilation] @internal_hash[:array_time_compilation] = [] end else opnn; no_file_exists_at(file_time_compilation) end # ======================================================================= # # === :prefix_object # # The :default_prefix Symbol equals to /usr/. # ======================================================================= # @internal_hash[:prefix_object] = action(:prefix, :default_prefix) # ======================================================================= # # The next method call can only happen after the prefix-object # was already initialized - see the line of code above this comment # section. # ======================================================================= # #set_user_prefix(nil) # ======================================================================= # # === :continue_after_make_step # ======================================================================= # @internal_hash[:continue_after_make_step] = true # ======================================================================= # # === :array_sys_command_string # # The next variable can keep track of sys-commands that were run. # ======================================================================= # @internal_hash[:array_sys_command_string] = [] # ======================================================================= # # === :counter_called_traditional_or_non_traditional_compilation # # Next, how often we invoked traditional or non-traditional compilation. # ======================================================================= # @internal_hash[:counter_called_traditional_or_non_traditional_compilation] = 0 # ======================================================================= # # === :full_configure_command # # We have to store the full configure command as well. It is not just # for configure but also for cmake, meson and so forth. # ======================================================================= # @internal_hash[:full_configure_command] = ''.dup # ======================================================================= # # === :original_start_directory # ======================================================================= # @internal_hash[:original_start_directory] = return_pwd # ======================================================================= # # === :is_an_abbreviation # # Whether the given input is an abbreviation or not. By default we # assume that the user has NOT used an abbreviated term for a real # program. # ======================================================================= # @internal_hash[:is_an_abbreviation] = false # ======================================================================= # # === :array_required_dependencies # # Register any reported dependencies of the target program at hand. # ======================================================================= # @internal_hash[:array_required_dependencies] = [] # ======================================================================= # # === :run_make_command # # The next variable will be nil by default, so that we can grab the # value that the cookbook-dataset is using here. # ======================================================================= # @internal_hash[:run_make_command] = nil # ======================================================================= # # === :compile_these_programs # ======================================================================= # @internal_hash[:compile_these_programs] = [] # ======================================================================= # # === :cookbook_aliases # # This entry is invariant and not amenable to the user modifying its # value. # ======================================================================= # @internal_hash[:cookbook_aliases] = action(:cookbook_aliases) # ======================================================================= # # === :simple_or_complex # # Determine the dataset to use from the cookbook dataset. This can # be :simple or :complex, although at a later time the alias name # :use_expanded_dataset is now in use, instead of :complex, as this # name is more explicit. # ======================================================================= # @internal_hash[:simple_or_complex] = :use_expanded_dataset # :simple end
#¶ ↑
reset_the_status_file
¶ ↑
This method will clear the status.yml file, aka re-set it to zero.
To invoke this method, do:
rbt --reset-the-status-file
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10721 def reset_the_status_file( this_file = FILE_STATUS ) dataset = {} dataset['currently_compiling_these_programs'] = [] write_what_into(YAML.dump(dataset), this_file) end
#¶ ↑
reset_user_definable_variables
¶ ↑
The variables in this method can be changed by the user lateron. They are thus modifiable by the user via the commandline.
In other words, the user can change these variables and thus toggle the behaviour of RBT::Action::SoftwareManager
. Thus, the user can overrule any setting defined in this method here - this is important to retain for this method, hence why it is documented so extensively.
Many variables in this method will be set to nil initially; that way allows us to easily find out which values have been modified via the commandline, and which ones have not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/reset.rb, line 277 def reset_user_definable_variables # ======================================================================= # # === :cookbook_dataset # ======================================================================= # @internal_hash[:cookbook_dataset] = nil # ======================================================================= # # === :install_only_binaries # ======================================================================= # @internal_hash[:install_only_binaries] = false # ======================================================================= # # === :skip_extracting # # Default value is nil for the next variable. If true then we will # NOT extract. # ======================================================================= # @internal_hash[:skip_extracting] = nil # ======================================================================= # # === :time_compilation # # Whether to time the compilation procedure or not: # ======================================================================= # @internal_hash[:time_compilation] = true # ======================================================================= # # === :honour_check_to_ensure_that_the_program_exists # # The next variable has to be kept for if we actually do want to # check whether a program is included or not. Normally we should # check, but there may be situations where you may build up your # own functionality - so we need to provide an option that can be # toggled by the user. This is why the next variable exists, and # is kept at true. # ======================================================================= # @internal_hash[:honour_check_to_ensure_that_the_program_exists] = true # ======================================================================= # # === :check_whether_the_given_input_is_a_file_and_does_exist # # The next variable, if true, instructs the class to check whether the # given input argument(s) do exist as a regular local file. If false # this check is skipped. # ======================================================================= # @internal_hash[:check_whether_the_given_input_is_a_file_and_does_exist] = true # ======================================================================= # # === :run_simulation # # Whether we will run in simulation-mode or not. Simulation-mode means # that we will not make any real lasting changes. This thus allows a # user to predict (and show a summary) what would happen if a # program would be installed/compiled. # ======================================================================= # @internal_hash[:run_simulation] = false # ======================================================================= # # === :exit_before_make_install # # Whether we will exit when we reach the "make install" stage. # ======================================================================= # @internal_hash[:exit_before_make_install] = false # ======================================================================= # # === :exit_before_make # # Whether we will exit when we reach the "make" stage. # ======================================================================= # @internal_hash[:exit_before_make] = false # ======================================================================= # # Only install the .h header files, if this variable is set to true. # ======================================================================= # @internal_hash[:install_only_the_headers] = false # ======================================================================= # # === :we_tried_to_compile_this_program_n_times # ======================================================================= # @internal_hash[:we_tried_to_compile_this_program_n_times] = 0 # ======================================================================= # # === :run_configure_script # # Determine whether we will run the configure script or whether we # will not. This is nil initially, so that the user can overrule # this in any way he/she sees fit. # ======================================================================= # @internal_hash[:run_configure_script] = nil # ======================================================================= # # === :configure_base_directory # ======================================================================= # @internal_hash[:configure_base_directory] = nil # ======================================================================= # # === :use_this_build_system # # Determine which build system is to be used. By default it will be nil. # ======================================================================= # @internal_hash[:use_this_build_system] = nil # ======================================================================= # # === :build_directory # ======================================================================= # @internal_hash[:build_directory] = BuildDirectory.new { :do_not_run_yet } # ======================================================================= # # === :extract_where_to # ======================================================================= # @internal_hash[:extract_where_to] = RBT.log_dir?+'rbt/' # TEMP_DIR_FOR_RBT # ======================================================================= # # === :symlink_into_usr_lib_dir # # Determine whether we will symlink the content of lib/ into # /usr/lib/. This setting is only honoured if we compile in an # appdir-like fashion. # ======================================================================= # @internal_hash[:symlink_into_usr_lib_dir] = false # ======================================================================= # # === :use_autoconf # # Use autoconf or not - by default we will not. # ======================================================================= # @internal_hash[:use_autoconf] = nil # ======================================================================= # # === :symlink_glib_schema # ======================================================================= # @internal_hash[:symlink_glib_schema] = nil # ======================================================================= # # === :parameters_to_make # # The next entry point allows us to pass options/parameters to the # "make" binary. The user can overrule this on the commandline. # # A value of nil is the initialize default state for this variable. # ======================================================================= # @internal_hash[:parameters_to_make] = nil # ======================================================================= # # === :rename_tab_title # # Whether to rename the tab title or whether we will not. This refers # to the KDE konsole typically. # ======================================================================= # if RBT.respond_to? :configuration? @internal_hash[:rename_tab_title] = RBT.configuration?.rename_tab_title else @internal_hash[:rename_tab_title] = true end # ======================================================================= # # === :cd_into_the_rbt_log_directory # # Whether this class will try to cd into the rbt-log directory. # ======================================================================= # @internal_hash[:cd_into_the_rbt_log_directory] = true # ======================================================================= # # === :try_to_determine_which_programs_have_to_be_installed # ======================================================================= # @internal_hash[:try_to_determine_which_programs_have_to_be_installed] = true # ======================================================================= # # === :make_use_of_cookbook_aliases # ======================================================================= # @internal_hash[:make_use_of_cookbook_aliases] = true # ======================================================================= # # === :run_postinstall_actions # # Determine whether we will run postinstallation steps. # ======================================================================= # @internal_hash[:run_postinstall_actions] = true # ======================================================================= # # === :create_appdir_skeleton # # Whether to create an AppDir skeleton by default. # ======================================================================= # @internal_hash[:create_appdir_skeleton] = true # ======================================================================= # # === :shall_we_compile_the_program # # The next variable can be used to determine whether we will compile # a particular program or whether we will not. # ======================================================================= # @internal_hash[:shall_we_compile_the_program] = true # ======================================================================= # # === :use_which_system_command # # There are only two valid settings for this variable: # # :ioparser or # :system # # ======================================================================= # @internal_hash[:use_which_system_command] = :ioparser # ======================================================================= # # === :colourize_parser # # Add an instance of class RBT::ColourizeParser. # ======================================================================= # @internal_hash[:colourize_parser] = RBT::ColourizeParser.new # ======================================================================= # # === :strip_binaries # # By default we will not strip the binaries. The configuration # setting can change this value though. # ======================================================================= # @internal_hash[:strip_binaries] = false # ======================================================================= # # === :use_a_prefix # # This entry point allows us to use a prefix variable, e. g for # "./configure --prefix=/opt". By default this is enabled (set # to true), but a user may wish to disable this too. # # If you wish to query this value, use the method # .do_we_use_any_prefix?. # ======================================================================= # @internal_hash[:use_a_prefix] = true # ======================================================================= # # === :is_on_gobolinux # # Determine whether we are on GoboLinux or whether we are not. # ======================================================================= # @internal_hash[:is_on_gobolinux] = RBT.are_we_on_gobolinux? # ======================================================================= # # === :show_output_from_the_extracter_class # # If the following variable is set to true then we will show output # from class Extracter. This is the class that will handle # extracting of an archive. The reason why we have this binary # flag (toggle) is because sometimes we do not want to output # a LOT of information on the commandline. The user can toggle # this behaviour on the commandline. # ======================================================================= # @internal_hash[:show_output_from_the_extracter_class] = false # ======================================================================= # # === :use_porg # # Determine whether we will make use of porg. # ======================================================================= # @internal_hash[:use_porg] = configuration?.use_porg # ======================================================================= # # === :symlink_headers # ======================================================================= # @internal_hash[:symlink_headers] = nil # ======================================================================= # # === :check_for_this_licence # # If the following variable is not nil, and not false, then this # class will check for the given licence matching, before it will # compile the program at hand. So, for instance, the user passes the # commandline flag for GPLv3 licences. If the software at hand is # NOT GPLv3 licenced then it can not be compiled. This is an optional # setting - most users won't need this, but purists may want to have # such an option, so it has been enabled in September 2022. # ======================================================================= # @internal_hash[:check_for_this_licence] = nil # ======================================================================= # # === :can_we_continue # # The variable at :can_we_continue is reset during every iteration. # It will be true by default. # ======================================================================= # @internal_hash[:can_we_continue] = true # ======================================================================= # # === :original_stdout # # The next variable is a bit unclear - it used to exist to allow for # easy redirection, but may no longer be that important. We may have to # re-evaluate this at a later time (written at 12.04.2019). # ======================================================================= # @internal_hash[:original_stdout] = nil # ======================================================================= # # === :postinstallation # ======================================================================= # @internal_hash[:postinstallation] = nil # ======================================================================= # # === @internal_hash[:make_use_of_the_cookbook_aliases] # # If the following variable is set to true then the RBT project # will try to honour the cookbook aliases. # ======================================================================= # @internal_hash[:make_use_of_the_cookbook_aliases] = true # ======================================================================= # # === :sed # # Whether to apply a sed-operation. Will be nil by default. If the # user passes in some special option here, then we know that we # have to use this value to overrule any other value for sed. # ======================================================================= # @internal_hash[:sed] = nil # ======================================================================= # # === :keep_la_files # # The next flag determines whether we will delete .la files or whether # we will keep them. # ======================================================================= # @internal_hash[:keep_la_files] = nil # ======================================================================= # # === :keep_the_archive_extracted # # The keep-extracted setting will lateron be sanitized. The default # value will be nil. # ======================================================================= # @internal_hash[:keep_the_archive_extracted] = nil # ======================================================================= # # === :may_we_download # ======================================================================= # @internal_hash[:may_we_download] = RBT::TRY_TO_DOWNLOAD_IF_NOT_FOUND # ======================================================================= # # === :ignore_errors # # By default we will NOT ignore errors, thus stop when we have noticed # an error. This can be overruled by the user on the commandline, # through the following value. # # Since as of November 2022, a new option has been added - this # variable will now default to :infer. That way the user can # override it on the commandline, and we can call the method # cookbook_dataset_ignore_errors? anyway. # ======================================================================= # @internal_hash[:ignore_errors] = :infer # false # ======================================================================= # # === :extract_to_this_directory_as_specified_by_the_user # # The next variable can be used to allow the user to determine another # directory for where we will extract archives into. Initially set # to nil in order to allow distinction to the default extractable # directory that is to be used. # ======================================================================= # @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = nil # ======================================================================= # # === :use_autoconf # ======================================================================= # @internal_hash[:use_autoconf] = false # ======================================================================= # # === :extract_the_archive # # By default we will extract the archive, hence the value must be # set to true. # ======================================================================= # @internal_hash[:extract_the_archive] = true # ======================================================================= # # === :do_not_use_special_flags # # The next variable, false on startup, tells RBT::Action::SoftwareManager # to retain all environment variables. Sometimes we may want to NOT # use the environment variables, which is why this flag exists. # ======================================================================= # @internal_hash[:do_not_use_special_flags] = false # ======================================================================= # # === :use_autogen # # Default value for use_autogen will be nil. The user is able to # override this from the commandline, which is why this variable # will be nil initially. # ======================================================================= # @internal_hash[:use_autogen] = nil # ======================================================================= # # === :compiler_to_use # # Specify which compiler is to be used. By default we will use GCC, # but clang may also be an option. It will be stored as a lowercased # Symbol, though, so :gcc would refer to GCC. # ======================================================================= # @internal_hash[:compiler_to_use] = :gcc # ======================================================================= # # === :use_build_directory # # Must initialize the build directory to a nil value next. It may # be set to a non-nil value lateron. # ======================================================================= # @internal_hash[:use_build_directory] = nil # ======================================================================= # # === :name_for_the_build_directory # # Use a default build directory. There is another entry that determines # whether we will use any build directory at all or not, so it is safe # to assign to the variable here - the entry called # @internal_hash[:use_build_directory]. # # Since as of April 2021, we will only use the setter-method for this. # See the next line, right below the commented line. # ======================================================================= # set_name_for_the_build_directory(:use_the_default_name) # Set a default name for the build directory. # ======================================================================= # # === :build_static # # The next variable must be defined here. A value of nil specifies # that this has not been set via the commandline yet. A value of # nil here essentially means a default to false - aka we will not # try to compile a program in a static manner. # ======================================================================= # @internal_hash[:build_static] = nil # ======================================================================= # # === :use_ccache # # The use_ccache entry has to be persistent. # ======================================================================= # @internal_hash[:use_ccache] = RBT.configuration?.use_ccache # ======================================================================= # # === :try_to_use_configure_options # # Determine whether we will try to use any declared configure options # from the cookbook-yaml file. # # The reason why this variable is set to nil initially is so that we # can distinguish the situation from when the user did specifically # want to disable this functionality, via the commandline. So the # nil value does not necessarily mean "false" in this context - it # just means that the user did not specify anything specifically. # ======================================================================= # @internal_hash[:try_to_use_configure_options] = nil # ======================================================================= # # === :extract_only # # If the next variable is set to true, we will exit after we have # extracted the archive. We will first initialize it to nil, though, # in order to distinguish between the default value and user-supplied # values. # ======================================================================= # @internal_hash[:extract_only] = nil # ======================================================================= # # === Show the flexbox # # Next determine whether we will show the flexbox or whether we will # not. This has to be set in the method here so that we do not # re-set it for each program that is to be compiled/installed. # ======================================================================= # @internal_hash[:show_the_flexbox] = true # ======================================================================= # # === :use_this_as_build_directory # ======================================================================= # @internal_hash[:use_this_as_build_directory] = 'BUILD_DIRECTORY' # ======================================================================= # # === :force_symlinks_when_appdir_prefix_is_used # ======================================================================= # if is_on_roebe? @internal_hash[:force_symlinks_when_appdir_prefix_is_used] = true else @internal_hash[:force_symlinks_when_appdir_prefix_is_used] = false end # ======================================================================= # # === :shall_we_use_an_appdir_prefix # # This variable must be set to true if we make use of an AppDir # prefix. # ======================================================================= # @internal_hash[:shall_we_use_an_appdir_prefix] = false # ======================================================================= # # === :use_meson_configure_options # # Whether to use meson-configure options or not. # ======================================================================= # @internal_hash[:use_meson_configure_options] = true # ======================================================================= # # === :symlink_gir_files # # This entry point controls whether we will symlink .gir files, # in principle. # ======================================================================= # @internal_hash[:symlink_gir_files] = configuration_setting_for_symlink_gir_files? # ======================================================================= # # === :register_the_last_compiled_program # # Whether to register the last compiled program or not. # ======================================================================= # @internal_hash[:register_the_last_compiled_program] = true # ======================================================================= # # === :use_this_specific_program_version # # Use another program version than the default one via this # variable. # ======================================================================= # @internal_hash[:use_this_specific_program_version] = nil # ======================================================================= # # === :append_this_to_the_configure_options # # This variant has been specifically added to allow for the --release # flag to work with cmake-based projects. # ======================================================================= # @internal_hash[:append_this_to_the_configure_options] = nil # ======================================================================= # # === :use_opn # # This entry point determines whether RBT::Action::SoftwareManager will make # use of opn or whether it will not. By default it will be true; if it # is false then we will not show opn in any other class that is called # by RBT::Action::SoftwareManagerRBT::Action::SoftwareManagerRBT::Action::SoftwareManager. # ======================================================================= # @internal_hash[:use_opn] = true # ======================================================================= # # === :user_prefix # # This prefix can be determined by the user. # ======================================================================= # @internal_hash[:user_prefix] = nil # ======================================================================= # # === :extract_only # ======================================================================= # @internal_hash[:extract_only] = false # ======================================================================= # # === :configure_options # # Whether we will use special configure options or not. By default # we will not, hence why we initialize the next setting to nil. # ======================================================================= # @internal_hash[:configure_options] = nil # ======================================================================= # # === :use_the_internal_sed_wrapper # # Next, determine whether to use the internal sed-wrapper. No # longer true by default since as of February 2018, but perhaps # we may re-enable it at some later moment in time. # ======================================================================= # @internal_hash[:use_the_internal_sed_wrapper] = false # ======================================================================= # # The configuration setting can change the above default false-value. # ======================================================================= # if config? @internal_hash[:strip_binaries] = config?.use_strip end # ======================================================================= # # The next variable will keep track of class SymlinkProgram. We # need to be able to modify its behaviour at "runtime". # ======================================================================= # set_symlink_program(nil) set_use_this_make_command(nil) end
#¶ ↑
return_absolute_path_if_in_build_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2810 def return_absolute_path_if_in_build_directory if use_build_directory? and return_pwd.include?(File.basename(use_this_build_directory?)) " #{absolute_path(return_pwd)}" else '' end end
#¶ ↑
return_appdir_prefix
¶ ↑
This variant will always use three methods to build the appdir-prefix.
It does not take any input by design.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3641 def return_appdir_prefix( use_this_as_the_program_name = program_name? ) programs_dir?+ use_this_as_the_program_name.to_s.capitalize.to_s+'/'+ program_version?.to_s+'/' end
#¶ ↑
return_append_this_to_the_configure_options
¶ ↑
This method will always at the least return an empty String.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 622 def return_append_this_to_the_configure_options( append_this_to_the_configure_options = append_this_to_the_configure_options? ) _ = '' if append_this_to_the_configure_options _ = _.dup if _.frozen? _ << append_this_to_the_configure_options end return _ end
#¶ ↑
return_cmake_configure_options_while_considering_GNU_configure_options
¶ ↑
This method will return the cmake_configure_options, or configure options. One day this should be changed to ONLY return the cmake_configure_options, but for the time being we need to retain compatibility to GNU configure options.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 204 def return_cmake_configure_options_while_considering_GNU_configure_options _ = cmake_configure_options? unless _ # ===================================================================== # # We default to the configure options for legacy reasons. At # some later point we may have to change all cookbook files, # but for now we won't. # ===================================================================== # _ = configure_options? end _ << return_append_this_to_the_configure_options return _.strip.squeeze(' ') end
#¶ ↑
return_dataset_for_this_program
¶ ↑
This method will be used to return the dataset, that is a new cookbook instance, from the given program at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4303 def return_dataset_for_this_program( i = compile_which_program? ) load_yaml_dataset_for_this_program(i) end
#¶ ↑
return_dataset_from_this_remote_blfs_page
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9725 def return_dataset_from_this_remote_blfs_page(i) remote_url = action(:return_blfs_page_of_this_program, i) remote_dataset = URI.open(remote_url).read return remote_dataset end
#¶ ↑
return_default_hash_to_be_passed_into_colour_make
¶ ↑
This method will return a static hash. This can be overruled, though, by providing an argument (another hash) to this method.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 152 def return_default_hash_to_be_passed_into_colour_make( optional_input = nil ) hash = { use_this_make_command: use_which_make_command?, append_these_options: parameters_to_make?, run_make: run_make?, run_make_install: run_make_install?, use_porg: use_porg?, program_name_and_program_version: program_name_and_program_version? } if optional_input hash.update(optional_input) end return hash end
#¶ ↑
return_games_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 606 def return_games_components RBT.return_games_components end
#¶ ↑
return_hash_for_the_postinstallation_step
¶ ↑
This method will return a Hash that can be used as the main initializer for class RBT::PostinstallationStep
.
The method accepts an argument (optional). That argument should be an instance of RBT::Action::SoftwareManager
, if it is provided. If provided we will fetch our information from that instance, rather than from the default internal one.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12841 def return_hash_for_the_postinstallation_step( optional_rbt_compile_object = nil ) # ======================================================================= # # First we will setup some local variables that will be returned # via the Hash. # ======================================================================= # register_the_program_or_do_not_register_the_program = false shall_we_run_fetch_all_m4_macros = true shall_we_invoke_symlink_program = false shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = false if optional_rbt_compile_object if optional_rbt_compile_object.continue_after_make_step? and optional_rbt_compile_object.make_install_stage_was_a_success? and optional_rbt_compile_object.no_error_has_occurred? register_the_program_or_do_not_register_the_program = true end if optional_rbt_compile_object.do_not_symlink? shall_we_run_fetch_all_m4_macros = false elsif !optional_rbt_compile_object.continue_after_make_step? shall_we_run_fetch_all_m4_macros = false end if optional_rbt_compile_object.continue_after_make_step? and optional_rbt_compile_object.make_install_stage_was_a_success? # ===================================================================== # # if i.include? '-' # Added this as of Jul 2014. # i = i.to_s.delete('-') # end # ^^^ Disabled as of Sep 2017. We would have to go about # this via some central configuration option in RBT, rather # than an ad-hoc hack such as the above. # ===================================================================== # shall_we_invoke_symlink_program = true end unless optional_rbt_compile_object.do_not_symlink? if optional_rbt_compile_object.symlink_headers_into_usr_include_hierarchy? and optional_rbt_compile_object.uses_an_appdir_prefix? and File.directory?(optional_rbt_compile_object.real_prefix?.to_s+'include/') and !Dir["#{optional_rbt_compile_object.real_prefix?}include/**.h"].empty? shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true end else if continue_after_make_step? and make_install_stage_was_a_success? and no_error_has_occurred? register_the_program_or_do_not_register_the_program = true end if do_not_symlink? shall_we_run_fetch_all_m4_macros = false elsif !continue_after_make_step? shall_we_run_fetch_all_m4_macros = false end if continue_after_make_step? and make_install_stage_was_a_success? # ===================================================================== # # if i.include? '-' # Added this as of Jul 2014. # i = i.to_s.delete('-') # end # ^^^ Disabled as of Sep 2017. We would have to go about # this via some central configuration option in RBT, rather # than an ad-hoc hack such as the above. # ===================================================================== # shall_we_invoke_symlink_program = true end unless do_not_symlink? if symlink_headers_into_usr_include_hierarchy? and uses_an_appdir_prefix? and File.directory?(real_prefix?.to_s+'include/') and !Dir["#{real_prefix?}include/**.h"].empty? shall_we_symlink_the_header_files_into_the_usr_include_hierarchy = true end end hash = { compile_which_program: compile_which_program?, use_this_prefix: real_prefix?.to_s, dataset_to_use: cookbook_dataset?, use_tags: use_tags?, full_configure_command: full_configure_command?, do_register_the_program: register_the_program_or_do_not_register_the_program, do_run_fetch_all_m4_macros: shall_we_run_fetch_all_m4_macros, shall_we_invoke_symlink_program: shall_we_invoke_symlink_program, install_only_binaries: install_only_binaries?, use_gobolinux_symlinkprogram: use_gobolinux_symlinkprogram?, delete_libtool_files: delete_libtool_files?, symlink_into_usr_lib_dir: symlink_into_usr_lib_dir?, postinstall: postinstall?, shall_we_symlink_the_header_files_into_the_usr_include_hierarchy: shall_we_symlink_the_header_files_into_the_usr_include_hierarchy } return hash end
#¶ ↑
return_kde5_porting_aids
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5992 def return_kde5_porting_aids RBT.return_kde5_porting_aids end
#¶ ↑
return_last_configure_command
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 734 def return_last_configure_command( hash = compiled_programs? # The full dataset is assigned here. ) last_key = hash.keys.last # Grab the last key. dataset = hash[last_key] # Now we have obtained the dataset. full_configure_command = dataset['full_configure_command'] return full_configure_command end
#¶ ↑
return_lxqt_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the LX-QT pool.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1918 def return_lxqt_components RBT.return_lxqt_components end
#¶ ↑
return_mate_desktop_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 596 def return_mate_desktop_components RBT.return_mate_desktop_components end
#¶ ↑
return_md5
¶ ↑
md5sum support via this method. It will make use of the class Md5sum.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9059 def return_md5( this_file ) _ = Md5sum.new(this_file, :dont_run_yet) # bl $RUBY_SRC/md5sum/lib/md5sum/md5sum.rb return _.return_md5sum(this_file) end
#¶ ↑
return_n_processors_of_this_computer
¶ ↑
This method will return how many processors this computer has. This can then be used to automatically determine the maximum option given to the “make” binary.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8708 def return_n_processors_of_this_computer( file_cpuinfo = FILE_CPUINFO ) if file_cpuinfo.is_a?(String) and File.exist?(file_cpuinfo) selected_dataset = File.readlines(file_cpuinfo).select {|line| line.start_with? 'processor' } selected_dataset.size else 1 # 1 is the minimum number. end end
#¶ ↑
return_non_traditional_prefix
(appdir prefix)¶ ↑
This method will return the (assumed) AppDir prefix for a given program at hand.
The program version must be set before calling this method. If the program_version
? has not been defined properly then the method here may return an incorrect result.
This method MUST be guaranteed to return a trailing ‘/’ character.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 69 def return_non_traditional_prefix( i = compile_which_program?, use_this_program_version = :default ) if cookbook_dataset?.nil? # ===================================================================== # # We do the next method primarily so that we can find # a proper program version. # ===================================================================== # initialize_cookbook_dataset_for(i) end case use_this_program_version when :default use_this_program_version = program_version? when nil initialize_cookbook_dataset_for(i) end # ======================================================================= # # We need a safeguard next, as the program version may be nil. # ======================================================================= # if use_this_program_version.nil? use_this_program_version = cookbook_dataset_program_version? end result = rds( programs_directory?.to_s+ i.to_s.capitalize.to_s+ '/'+ use_this_program_version.to_s+'/' ) # ======================================================================= # # === Handle GoboLinux next # ======================================================================= # if is_on_gobolinux? # ===================================================================== # # If we are on GoboLinux, then we have to honour the other variant # called program_compile_name? instead. # ===================================================================== # result = rds( programs_directory?.to_s+ program_compile_name?.to_s+'/'+ # This line is specific to GoboLinux. use_this_program_version.to_s+'/' ) end return result end
#¶ ↑
return_path_to_the_archive_of_this_program
¶ ↑
This functionality depends on the expanded cookbooks dataset.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6491 def return_path_to_the_archive_of_this_program(i) dataset_from_expanded_cookbook = return_dataset_from_expanded_cookbook(i) dataset_from_expanded_cookbook[:program_path] end
#¶ ↑
return_possible_abbreviation_to_this_input
¶ ↑
This method will return an abbreviation to a given input.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1350 def return_possible_abbreviation_to_this_input(i) if will_we_make_use_of_abbreviations? # ===================================================================== # # If the cookbooks-project already includes the given input at hand # then we do not have to do anything else. # ===================================================================== # is_the_program_included = cookbooks_include_this_program? i unless is_the_program_included # =================================================================== # # We have to do another check, this time including the abbreviations. # =================================================================== # is_the_program_included = cookbooks_include_this_program?( i, :with_abbreviations ) if is_the_program_included abbreviation_points_to = abbreviations?[i] unless abbreviation_points_to == i # =============================================================== # # Notify the user that we will "re-write" the original input # in this case. # =============================================================== # orev "The given input #{sfancy(i)} #{rev}could not be "\ "found, but an abbreviation" orev "was found, which is now used as the new name: "\ "#{mediumspringgreen(abbreviation_points_to)}" i = abbreviation_points_to.to_s.delete('_').dup set_is_an_abbreviation # =============================================================== # # We must also set the Hash to sync-back our findings, so that # we change input like "ry macro" to "ry marco". We avoid # using the setter method because the setter method does a # few additional checks as-is. # =============================================================== # set_handle_this_program(i) end end end end return i end
#¶ ↑
reuse_old_configure_options
¶ ↑
This method currently works only with the target program being GCC.
Perhaps it may be extended for other programs one day.
Invocation examples:
ry gcc --copy-old-version ry gcc --use-this-version=7.1.0 --use-old-configure-options
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5537 def reuse_old_configure_options( use_this_program = compile_which_program? ) _ = `#{use_this_program} -v #{SHELL_ERROR_CODE}` options = _.scan(/^Configured .+/).first. sub(/^Configured with:/,''). sub(/\.\.\/configure /,''). strip orev "Re-using the old configure option, which "\ "was `#{sfancy(options)}#{rev}`." if options.include? programs_directory? # ===================================================================== # # Next, replace the oldprefix. # ===================================================================== # programs_dir = Regexp.quote(programs_directory?) if dataset?.nil? ensure_that_the_default_dataset_exists_for_this_program(use_this_program) end if @internal_hash[:use_this_specific_program_version] dataset?.set_program_version(@internal_hash[:use_this_specific_program_version]) dataset?.reassemble_program_path end regex_to_use = /(--prefix=#{programs_dir}Gcc\/\d{1,2}\.\d{1,2}\.\d{1,2})/ options.sub!(regex_to_use, '--prefix='+return_appdir_prefix) options.squeeze!('/') # ===================================================================== # # Now, simply use that as configure version. # ===================================================================== # extract_to_default_directory set_configure_base_directory cd_to_the_configure_base_directory run_preinstall_sed_and_currently_being_compiled consider_creating_the_build_directory orev "These are the #{orange('options')} that will be used:" e e " #{simp(options)}" e set_configure_options(options) run_configure_make_and_make_install_with_this_configure_line(options) run_all_actions_after_the_make_install_step exit_program end end
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 780 def run determine_the_real_commandline_arguments( commandline_arguments?.select {|entry| entry.start_with?('--') } ) _ = first_non_hyphened_argument? if _ set_compile_this_program(_) set_cflags { :be_silent } # ← Initialize the CLFAGS here. end menu(real_commandline_arguments?) # ======================================================================= # # === The log directory must exist # # We must always ensure that the log_directory exists. # ======================================================================= # ensure_that_the_log_directory_exists if _ and !_.empty? set_compile_these_programs(compile_which_program?) do_install_these_programs(compile_which_program?) else orev 'Please supply an argument to this action.' end end
#¶ ↑
run_cmake_configure_step
(cmake tag)¶ ↑
This method essentially does something like:
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
Then it will perform:
- premake - make - make install
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 67 def run_cmake_configure_step( use_this_as_build_directory = use_this_as_build_directory? ) # ======================================================================= # # We should check whether cmake exists on the host system or whether # it does not. # ======================================================================= # if cmake_exists? _ = 'cmake'.dup # ===================================================================== # # Add the prefix next, if the user wants to use a prefix at all: # ===================================================================== # if do_we_use_any_prefix? # Check whether the user wants to use a prefix at all. _ << " -DCMAKE_INSTALL_PREFIX=#{prefix?}" end # ===================================================================== # # Obtain the cmake-configure options next and append them: # ===================================================================== # configure_options = cmake_configure_options? if configure_options and !configure_options.empty? _ << " #{configure_options}" end _ << ' .' if use_this_as_build_directory and do_we_use_a_build_directory? # Most cmake-based projects require a build-directory. create_the_build_directory_then_cd_into_it(use_this_as_build_directory) { :be_verbose } _ << '.' end _.squeeze!(' ') _.strip! # ======================================================================= # # === Check for more than one -DCMAKE_INSTALL_PREFIX entry next # # This should never be the case, so we will do some quality-control # and exit if this is the case so. # ======================================================================= # scanned_result = _.scan(/-DCMAKE_INSTALL_PREFIX=/) if scanned_result.size > 1 # More than one. # =================================================================== # # In this case, something must be wrong. Notify the user about it. # That way this can be corrected eventually. # =================================================================== # opnewarn "There are at the least two definitions of "\ "#{royalblue('-DCMAKE_INSTALL_PREFIX=')}" opnewarn "in the .yml file at hand." opnewarn 'At the least one of these entries must be incorrect '\ 'and/or superfluous. Consider ' opnewarn 'correcting this logic-problem before RBT can '\ 'continue.' e e 'See:' e e " #{sfancy(_)}" e exit_program end # ======================================================================= # # Finally the cmake-command has been built up. We can now push it # towards the general method that handles output. # ======================================================================= # # reset_error_map_line_to_a_specific_error set_full_configure_command(_) cmake_object = action(:run_cmake, :do_not_run_yet) { :colourized_and_padded } cmake_object.set_full_configure_line(_) cmake_object.verbose_run_the_actual_system_command else # ======================================================================= # # The user should be informed that "cmake" could not be found here. # ======================================================================= # notify_the_user_that_cmake_could_not_be_found we_can_not_continue end end
#¶ ↑
run_cmake_then_make_then_make_install
¶ ↑
Just a convenience method to run “cmake”, then “make” and then “make install”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 37 def run_cmake_then_make_then_make_install run_cmake_configure_step run_premake_then_make_then_make_install # run_make # run_make_install # opne "#{rev}Next running" # run_this_system_command_in_a_coloured_and_padded_manner(cmd) # Using this since as of 28.08.2022. # ======================================================================= # # Now that the cmake, premake, make, make install was run we scan # through the registered problems/errors and act on it, before # resetting the error-line again. # ======================================================================= # # run_through_the_registered_problems_registered_errors_and_behaviour_changes # reset_error_map_line_to_a_specific_error end
#¶ ↑
run_configure_script?¶ ↑
Determine whether we will invoke “./configure” or whether we will not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13189 def run_configure_script? _ = @internal_hash[:run_configure_script] # ======================================================================= # # Next, fetch the entry that exists in the cookbook-dataset, and use # it in this case. # ======================================================================= # if _.nil? if cookbook_dataset_run_configure_script?.nil? _ = true # Safe-guard. else _ = cookbook_dataset_run_configure_script? end end _ end
#¶ ↑
run_configure_via_action
(configure tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7097 def run_configure_via_action options = ''.dup known_options = RBT.return_configure_options_of_this_program(which_program?) if known_options and !known_options.empty? options << known_options end use_these_options = "--prefix=#{prefix?} #{options}".rstrip action(:run_configure, use_these_options) { :colourized_and_padded } e end
#¶ ↑
run_make
(make tag)¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 21 def run_make( parameters_to_make = parameters_to_make? ) if run_make? and can_we_continue? _ = 'make -j$(nproc)'.dup # This variant uses the n CPU core variant. _ << " #{parameters_to_make}" unless parameters_to_make.empty? colourized_and_padded_esystem(_) end end
#¶ ↑
run_make_install
(make install tag)¶ ↑
This method will ultimately default to run:
make install
Note that some programs do not use “make install” and instead use something such as “ninja install”.
The method here thus has to remain somewhat flexible, in order to install such programs as well.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 181 def run_make_install # ======================================================================= # # Do not try to compile via make, if it does not have to be compiled. # ======================================================================= # return unless has_to_be_compiled? return unless can_we_continue? # ======================================================================= # # Next check for pre-make-install sed instructions: # ======================================================================= # unless pre_make_install_sed.empty? pre_make_install_sed.each {|sed_instruction| run_this_sed_instruction(sed_instruction) } end if exit_before_make_install? orev 'Exiting now as instructed before reaching '\ 'the "'+orange('make install')+rev+'" stage.' exit_program end # ======================================================================= # # === Check whether we may run make install or whether we may not. # ======================================================================= # if run_make_install? # ===================================================================== # # Clear the old buffer keeping track of our errors first: # ===================================================================== # # reset_error_map_line_to_a_specific_error use_this_make_command = use_this_make_command? if use_this_make_install_command? # =================================================================== # # In this case we will use that make-install command instead. # =================================================================== # use_this_make_command = use_this_make_install_command? end use_this_make_command = use_this_make_command.dup # ===================================================================== # # Check for porg next: # ===================================================================== # use_porg = false if use_porg? # The user is trying to make use of porg here. if porg_is_available? use_porg = true else # =================================================================== # # Notify the user that porg is NOT available. We will continue # anyway, though. # =================================================================== # notify_the_user_that_porg_is_not_available end end _ = "#{use_this_make_command} install" # ======================================================================= # # If the user uses stow then the following clause is entered. # ======================================================================= # opnn if use_stow? RBT.colour_make_install { return_default_hash_to_be_passed_into_colour_make( append: " DESTDIR=/stow/#{compile_which_program?} install", porg: use_porg, use_this_make_command: use_this_make_command, pad_the_output: true, run_make: false ) } else # This is the default variant. RBT.colour_make_install { return_default_hash_to_be_passed_into_colour_make( porg: use_porg, use_this_make_command: use_this_make_command, pad_the_output: true, run_make: false ) } end # run_through_the_registered_problems_registered_errors_and_behaviour_changes # reset_error_map_line_to_a_specific_error # if an_error_has_occurred? # # =================================================================== # # # Register that this step led to an error in this case. # # =================================================================== # # @internal_hash[:make_install_stage_was_a_success] = false # end # colourized_and_padded_esystem(_) # ^^^ this should be used in a padded variant. end end
#¶ ↑
run_make_install
?¶ ↑
Query whether we will do the “make install” step or whether we will not. Will return a boolean value (true/false).
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 728 def run_make_install? @internal_hash[:run_make_install] end
#¶ ↑
run_make_then_make_install
¶ ↑
Run “make” and then the “make install” command here.
This method is deliberately very simple.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14582 def run_make_then_make_install # _ = an_error_has_occurred? # _ = false unless check_for_errors? # if _ # else # run_make_then_make_install_via_action run_make_command run_make_install_command # end end
#¶ ↑
run_meson_configure_step
(meson tag)¶ ↑
This method essentially does something like:
meson --prefix=/usr --libdir=/usr/lib BUILD_DIRECTORY
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 496 def run_meson_configure_step( use_this_as_build_directory = use_this_as_build_directory? ) # ======================================================================= # # Obtain the configure options for meson next: # ======================================================================= # if is_meson_installed? configure_options = meson_configure_options? action(:run_meson_configure_step, { prefix_to_use: prefix?, configure_options: configure_options, use_this_as_build_directory: use_this_as_build_directory }) { :colourized_and_padded } else orev steelblue('Meson')+rev+' is unavailable. Consider installing it.' end end
#¶ ↑
run_ninja
(ninja tag)¶ ↑
This method will simply run “ninja”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 604 def run_ninja # reset_error_map_line_to_a_specific_error cd use_this_as_build_directory? if do_we_use_a_build_directory? orev "Proceeding to run the command "+ mediumpurple('ninja')+"#{rev} next, from the" orev "working directory #{sdir(return_pwd)}#{rev}:" _ = 'ninja' colourized_and_padded_esystem(_) # run_this_system_command_in_a_coloured_and_padded_manner 'ninja' # run_through_the_registered_problems_registered_errors_and_behaviour_changes # reset_error_map_line_to_a_specific_error end
#¶ ↑
run_postinstall_actions?¶ ↑
We will default to the cookbook dataset - but this will be overruled if there is a corresponding entry in the @internal_hash variable.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10398 def run_postinstall_actions? _ = cookbook_dataset_postinstall? unless @internal_hash[:run_postinstall_actions].nil? _ = @internal_hash[:run_postinstall_actions] end return _ end
#¶ ↑
run_pre_configure_steps_if_requested_to_do_so
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2383 def run_pre_configure_steps_if_requested_to_do_so _ = pre_configure_steps? if _ and !_.empty? and _.is_a?(Array) orev "Doing a #{steelblue('pre-configure')} #{rev}step next." _.each {|entry| # esystem entry run_this_system_command_in_a_coloured_and_padded_manner(entry) } end end
#¶ ↑
run_preinstall_actions
¶ ↑
These actions will be run before anything else, including “./configure”.
An example for such a preinstall action may be the following:
if is_on_32_bit_system? sed -r "/ifeq.*CompilerTargetArch/s#i386#i686#g" -i projects/compiler-rt/make/platform/clang_linux.mk
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2602 def run_preinstall_actions _ = cookbook_dataset_preinstall? unless _.empty? # ===================================================================== # # Next we have to handle the preinstall-actions. This should # typically be an Array (and is guaranteed by class # RBT::SanitizeCookbook). # # We will output what we are doing pre-installation things, but # only do so IF we really want to so. # ===================================================================== # first = _.first unless first.start_with?('if ') and (first == 'if is_on_32_bit_system?') cliner { orev "Doing preinstallation actions next, from the directory" orev "`#{sdir(return_pwd)}#{rev}`:" } end # ===================================================================== # # === Handle conditional cases in the preinstall clause next # ===================================================================== # if first.start_with? 'if ' # Ok, we assume this to be an if-conditional clause. case first # case tag when 'if is_on_32_bit_system?' if is_on_32_bit_system? # Ok, we are on a 32 bit system. _.shift unless _.empty? _ = _.first orev 'A pre-installation instruction was found, '\ 'which will be run next (from the '\ 'directory '+sdir(sdir_return_pwd)+"#{rev})." opnesystem _ end end end else opnn if _.is_a? Array _.each {|entry| case entry # =============================================================== # # Note that most of the next steps may be handled by class # PostInstall already, such as create_directory(). # =============================================================== # # =============================================================== # # === copy_file STATIC_BUSYBOX_CONFIG # # Handle busybox's static configuration. This is stored # in the file called "static_busybox_config.md". # # On my home system this file is then found here: # # $RBT/misc/profiles/static_busybox_config.md # # =============================================================== # when /copy_file STATIC_BUSYBOX_CONFIG$/i source_location = "#{DIRECTORY_TO_THE_PROFILES}static_busybox_config.md" target_location = "#{cookbooks_dataset_extracted_towards?}.config" orev "Copying from #{sfile(source_location)}" orev "to #{sfile(target_location)}" copy_file(source_location, target_location) else if entry.end_with?('.new') case entry # =========================================================== # # === Handle ChangeLib64ToLib.new # =========================================================== # when /ChangeLib64ToLib.new$/ e "#{rev}Delegating towards "\ "#{steelblue('RBT::ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib')} "\ "next:" RBT::ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib.new next end end end e sfancy(entry) system(entry) } else e sfancy(_) system(_) end end end end
#¶ ↑
run_premake_commands
¶ ↑
Here we try to run the premake commands, in case they exist.
If there are no pre_make_commands, then we will not do anything, as our array will be empty.
This method is normally run from do_compile_this_program(), via a call to its alias name consider_running_premake_instruction().
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14627 def run_premake_commands( array = cookbook_dataset_pre_make_commands? ) unless array.empty? orev "#{sfancy('Doing pre_make_commands next from ')}"\ "#{sdir_return_pwd}#{sfancy('.')}" array.each { |cmd| opnn e "#{rev}In the directory #{sdir_return_pwd}#{rev}, doing "\ "the following command next:" e e " #{slateblue(cmd)}" e e "#{rev}next." # run_this_system_command_in_a_coloured_and_padded_manner(cmd) colourized_and_padded_esystem(cmd) } end end
#¶ ↑
run_python_install1
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1332 def run_python_install1( this_file = RBT.file_predefined_installation_instructions ) dataset = YAML.load_file(this_file)['PINSTALL1'] if dataset.is_a?(String) and dataset.include?(';') dataset.split(';').each {|this_command| _ = this_command.strip e _ run_this_sys_command(_) } end end
#¶ ↑
run_python_install2
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1159 def run_python_install2( this_file = RBT.file_predefined_installation_instructions ) dataset = YAML.load_file(this_file)['PINSTALL2'] if dataset.is_a?(String) and dataset.include?(';') dataset.split(';').each {|this_command| _ = this_command.strip e _ run_this_sys_command(_) } end end
#¶ ↑
run_python_installation
¶ ↑
You should check whether setup.py exists prior to invoking this method here.
You can also pass in another file, such as configure.py. By default, the method will make use of a file called “setup.py”, though.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10427 def run_python_installation( i = 'setup.py' ) if parameters_to_make?.nil? _ = cookbook_dataset_make_options? if _ and !_.empty? i = _ end end i = [i].flatten.compact # ======================================================================= # # We work on an Array here since some make_options entries also # specify an Array. # ======================================================================= # i.each {|do_this_action| case do_this_action when FILE_SETUP_PY # ← This is equivalent to "setup.py". # We could also use RBT::FILE_SETUP_PY. if does_a_python_binary_exist? colourized_and_padded_esystem "python #{do_this_action} configure" colourized_and_padded_esystem "python #{do_this_action} build" colourized_and_padded_esystem "python #{do_this_action} install" else notify_the_user_that_no_binary_python_could_be_found end else run_this_command = "#{do_this_action}".dup if run_this_command.start_with?('python') and !run_this_command.include?('/') # =================================================================== # # This is valid for a command line such as: # "python setup.py config" # =================================================================== # splitted = run_this_command.split(' ') splitted[1].prepend(configure_base_dir?.dup) run_this_command = splitted.join(' ') end unless run_this_command.start_with? 'python' run_this_command.prepend('python ') end if does_a_python_binary_exist? colourized_and_padded_esystem run_this_command else notify_the_user_that_no_binary_python_could_be_found end end } consider_changing_the_tab_title( :clear, :do_rename ) end
#¶ ↑
run_scons
¶ ↑
Invoke this method here only when we wish to use scons in order to install a program.
Scons
is python-related, which is why it sits here in this file.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9046 def run_scons _ = 'scons'.dup if use_build_directory? _.prepend('../') end coloured_and_padded_esystem _ end
#¶ ↑
run_the_equivalent_configure_like_stage_for_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 282 def run_the_equivalent_configure_like_stage_for_this_program( i = compile_which_program? ) orev "The #{lightgreen('configure-like stage')}"\ "#{rev} for #{steelblue(i)}#{rev} will now be invoked." # ======================================================================= # # Next register that we are compiling a program. This should come # before we consider building the program statically. # ======================================================================= # register_that_this_program_is_currently_being_compiled # ======================================================================= # # We must next determine which configure command is to be used: # ======================================================================= # configure_command_to_use = configure_command_to_use? # ======================================================================= # # Here we have to do a decision: either we make use of the # use_this_build_system specified value, or we have to infer the # build system. Either way we begin this by quering the # use_this_build_system value. # ======================================================================= # use_this_build_system = use_which_build_system? # This will always be a Symbol. case use_this_build_system # ======================================================================= # # === :configure # ======================================================================= # when :configure consider_running_autoconf do_run_GNU_configure_then_make_then_make_install # ======================================================================= # # === :perl # # Invocation example: # # ry archivezip # # ======================================================================= # when :perl run_the_perl_steps # ======================================================================= # # === :cmake # ======================================================================= # when :cmake run_cmake_then_make_then_make_install # ======================================================================= # # === :meson # ======================================================================= # when :meson run_meson_configure_step run_ninja run_ninja_install # ======================================================================= # # === :Python # ======================================================================= # when :Python, :python # Can be capitalized or not. run_python_installation # ======================================================================= # # === :Makefile # ======================================================================= # when :Makefile run_make run_make_install # ======================================================================= # # === :scons # ======================================================================= # when :scons run_scons else orev tomato('Not registered build-system type: ')+ steelblue(use_this_build_system.to_sym) orev 'No way to proceed, thus stopping now.' return end do_handle_the_post_installation_steps end
#¶ ↑
run_the_python_steps
¶ ↑
Note that run_python_install
is usually better than this method here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10483 def run_the_python_steps( _ = 'setup.py' ) if File.exist? _ coloured_and_padded_esystem 'python setup.py configure' coloured_and_padded_esystem 'python setup.py build' coloured_and_padded_esystem 'python setup.py install' else orev 'Unsure what to do!' exit_program end end
#¶ ↑
run_the_strip_command_on_this_input
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 258 def run_the_strip_command_on_this_input( i = :pwd ) case i when :pwd i = Dir['*'] end [i].flatten.compact.each {|this_file| strip_command = 'strip '+this_file.lstrip esystem strip_command } end
#¶ ↑
run_through_the_erroneous_libtool_entries
¶ ↑
The first argument should be an Array; or an object that is able to respond to :each.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1928 def run_through_the_erroneous_libtool_entries( i = erroneous_libtool_entries? ) i.each {|do_this_action| if is_on_roebe? and autofix? # =================================================================== # # Register this erroneous line for now - the fixing part will # happen at a later time. Only on roebe-systems for now, though. # =================================================================== # try_to_autocorrect_this_erroneous_libtool_entry_later(do_this_action) end } end
#¶ ↑
run_traditional_GNU_configure
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 636 def run_traditional_GNU_configure _ = './configure --prefix='+prefix?.dup configure_options = configure_options? if configure_options and !configure_options.empty? _ << " #{configure_options}" end colourized_and_padded_esystem(_) end
#¶ ↑
run_waf
(waf tag)¶ ↑
This method can be used to install a project that uses “waf” as its build system.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8861 def run_waf run_pre_make_commands _ = './waf'.dup if use_build_directory? _.prepend(configure_base_directory?) end opnn; report_working_directory # ======================================================================= # # Specify which subcommands to use, e. g. 'waf configure' followed by # 'waf build' and so forth. # ======================================================================= # run_these_subcommands = %w( configure build install ) run_these_subcommands.each {|this_subcommand| _ = "#{_} #{this_subcommand}" run_this_system_command_in_a_coloured_and_padded_manner(_) } end
#¶ ↑
save_into_compiled_programs
¶ ↑
This method will try to save a lot of useful data into a file called “compiled_programs.yml”.
That way we can try to figure out what happened at any moment in time (hopefully).
The variable full_configure_command will store the full configure command, whereas configure_options only shows the part afterwards, such as which parts to enable or disable and so forth.
This should also store ARCH info and such.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10533 def save_into_compiled_programs( store_into = FILE_COMPILED_PROGRAMS ) what = ''.dup # Need a non-frozen String. what << '# --- '+program_name?+N what << program_name?+':'+N what << ' CFLAGS: '+cflags?.to_s+N what << ' compiled_at: '+today?.to_s+', '+current_hour?+N what << ' prefix: '+real_prefix?.to_s+N what << ' full_configure_command: '+ full_configure_command?.to_s+N what << ' configure_options: '+configure_options?.to_s+N what << ' successfully_compiled: true/false'+N # This line here is obviously a stub. what << N # Extra newline - makes reading this file easier. append_what_into(what, store_into) end
#¶ ↑
scan_source_archive
¶ ↑
Scan the complete source archive.
Invocation example:
ry --scan_source_archive
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6029 def scan_source_archive( shall_we_exit = true ) opne 'Scanning for source Archives now.' action(:ScanSourceArchive) exit_program if shall_we_exit end
#¶ ↑
scons_file_exists?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 203 def scons_file_exists? File.exist? 'SConstruct' end
#¶ ↑
search_for_tag
(search tag)¶ ↑
Use this to search for a tag.
Usage examples:
ry htop --tags pdf ry htop --tags term
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 238 def search_for_tag( this_tag, shall_we_exit = true ) results = action(:SearchForTags, this_tag) exit_program if shall_we_exit return results end
#¶ ↑
sed?¶ ↑
Query as to whether we will use sed or not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 362 def sed? _ = cookbook_dataset?.sed? if @internal_hash[:sed].nil? # ===================================================================== # # In this case we will use the sed-variant given by the cookbooks # dataset. # ===================================================================== # else _ = @internal_hash[:sed] end return _ end
#¶ ↑
sed_binary_is_available?¶ ↑
Determine whether the host-system has the “sed” binary available or whether it has not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 125 def sed_binary_is_available? result = `sed #{SHELL_ERROR_CODE}` result.include? 'Usage:' end
#¶ ↑
set_cflags
(cflags tag)¶ ↑
This method will enable you to set i.e. new cflags. This then also allows you to compile some programs in a different manner, such as if you wish to compile that particular program statically.
The default argument to this method will be a copy of ENV.
You can overrule this via a shortcut, if you want to, by passing true as argument, or even better, a Symol such as :static. This will then allow you to perform the static build, if the program at hand allows for this.
-static-libgcc may also be an option here.
The variable LDFLAGS may be important as well.
For instance:
make LDFLAGS=-all-static
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10949 def set_cflags( i = default_cflags?, &block ) case i # case tag # ======================================================================= # # === :clear # ======================================================================= # when :clear i = '' # ======================================================================= # # Enable static builds for the CFLAGS at hand # ======================================================================= # when :overrule_static_build, :static, :build_static, true i = "#{old_cflags?} -static -g" end # ======================================================================= # # Do the actual assignment next. # ======================================================================= # set_this_env_variable( "CFLAGS: #{i}", :do_set_these_variables, &block ) end
#¶ ↑
set_compile_these_programs
¶ ↑
This variant will always be an Array.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 921 def set_compile_these_programs(i) @internal_hash[:compile_these_programs] << [i].flatten.compact @internal_hash[:compile_these_programs].flatten! end
#¶ ↑
set_compile_these_programs_then_batch_compile_them
¶ ↑
This method can be used to start batch-compiling several programs in one go.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 909 def set_compile_these_programs_then_batch_compile_them( i, consider_replacing_the_input = :default ) set_compile_these_programs(i, consider_replacing_the_input) batch_compile_these_programs(i) end
#¶ ↑
set_compile_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 809 def set_compile_this_program(i = nil) if i # ===================================================================== # # === Handle * # # First we will handle the '*' substring, in any given argument. # # We will show to the user what programs exist that start with # this name. # # To trigger this method, do: # # ry a* # ry e* # # ===================================================================== # if i.respond_to?(:include?) and i.include?('*') verbose_find_all_keys_starting_with(i) exit_program end # ===================================================================== # # We need to sanitize the given input a little bit next: # ===================================================================== # i = i.to_s.delete_suffix( File.extname(i) ).delete('-'). downcase if i.end_with?(':') i = i.dup if i.frozen? i.chop! end i = i.to_sym # ===================================================================== # # === Check whether the given input is a registered program # ===================================================================== # if is_this_program_part_of_the_RBT_project?(i.to_s) # ===================================================================== # # === else we may have found an alias name # ===================================================================== # elsif make_use_of_the_cookbook_aliases? and cookbook_aliases?.include?(i.to_s) new_name = RBT.find_cookbook_alias_for(i) orev "An alias was found for the given input "+ "#{steelblue(i)}#{rev}." orev "This alias will next be used, via the derived "\ "name being #{steelblue(new_name)}#{rev}." i = new_name # ===================================================================== # # === else if we can map an input to a registered program # ===================================================================== # elsif (new_name = action(:map_this_input_to_that_registered_program, i)) and (i != new_name) and !new_name.nil? orev steelblue(i)+rev+' was not found, but another match was found' orev 'called '+steelblue(new_name)+rev+', which is now used.' i = new_name # ===================================================================== # # === else we have found nothing, so report to the user # ===================================================================== # else orev tomato('Unfortunately the program called ')+ steelblue(i)+ tomato(' is not') orev tomato('registered as part of the RBT project.') i = nil end @internal_hash[:compile_this_program] = i end end
#¶ ↑
set_configure_base_directory
¶ ↑
This setter-method sets the @internal_hash, which is, for example, a directory such as:
/Depot/Temp/htop-1.0.0/
Some projects, such as “xvid” / “xvidcore”, may require a specific subdirectory, though.
Another example may be the program called “nspr”, which requires the following configure base directory:
/Depot/Temp/nspr-4.10.8/nspr/
class RBT::Action::SoftwareManager
will store this in a separate variable so that it can be queried lateron.
Do note that the cookbook-dataset will also retain the original configure_base_directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6859 def set_configure_base_directory( i = :default ) case i # ======================================================================= # # === :default # ======================================================================= # when :default i = rds( "#{extract_to?.to_s}"\ "#{program_name_and_version?.to_s}/"\ "#{cookbook_dataset_configure_base_directory?.to_s}" ) end i = i.to_s.dup i = rds(i) # rds() is used here since as of Feb 2012. i << '/' unless i.end_with? '/' # It must always have a trailing '/'. i = i.to_s.dup @internal_hash[:configure_base_directory] = i # ← Finally, assign it. end
#¶ ↑
set_cookbook_dataset_program_version
¶ ↑
For this method to work, cookbook_dataset
? must have been instantiated before.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8600 def set_cookbook_dataset_program_version(i) cookbook_dataset?.set_program_version(i) end
#¶ ↑
set_description
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10315 def set_description(i) cookbook_dataset?.set_description(i) end
#¶ ↑
set_do_not_symlink
¶ ↑
Do not symlink after “make install” stage. This prevents the symlinking-step from e. g. /Programs/Htop/1.2.0/ into the /Systemd/Index/ hierarchy.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 497 def set_do_not_symlink( be_verbose = true ) if block_given? yielded = yield case yielded when :be_verbose be_verbose = true end end case be_verbose # ======================================================================= # # === :be_verbose # ======================================================================= # when :be_verbose be_verbose = true # ======================================================================= # # === :be_quiet # ======================================================================= # when :be_quiet be_verbose = false end if be_verbose orev 'We will not symlink after compilation has finished.' end @internal_hash[:do_not_symlink] = true end
#¶ ↑
set_dont_keep_archive
¶ ↑
Use this method when you don’t want to keep the extracted archive.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11871 def set_dont_keep_archive( be_verbose = true ) if be_verbose orev 'We will not keep our extracted archive.' end @internal_hash[:keep_the_extracted_archive] = false end
#¶ ↑
set_env_variables?¶ ↑
Determine whether we have to set any environment variable or not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 144 def set_env_variables? _ = cookbook_dataset? if _ and _.respond_to?(:set_env_variables?) _.set_env_variables? else false end end
#¶ ↑
set_extract_to_this_directory
¶ ↑
This method can be used to keep track onto which directory archives will be extracted.
Within RBT
, the target is also known as the “homedir” variable.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10986 def set_extract_to_this_directory( i = RBT.log_directory?, be_verbose = false ) case be_verbose when :be_verbose be_verbose = true end i = i.to_s case i # ======================================================================= # # === pwd # ======================================================================= # when 'pwd','homedir' i = rds(return_pwd+'/') end unless File.exist? i unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end # ======================================================================= # # Display some information to the user, if we operate in a verbose manner. # ======================================================================= # if be_verbose orev 'We will use '+sdir(i)+' as our directory into which '\ 'we will extract the source archive into.' end @internal_hash[:extract_to_this_directory] = i.dup end
#¶ ↑
set_extract_to_this_directory_as_specified_by_the_user
¶ ↑
This method can be used by the user to specify a certain directory.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11023 def set_extract_to_this_directory_as_specified_by_the_user( i = :random ) case i when :random # ===================================================================== # # In this case we will use a random subdirectory, but within the # temp directory still. # ===================================================================== # i = rbt_temp_dir?+return_n_random_characters(10) end unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end @internal_hash[:extract_to_this_directory_as_specified_by_the_user] = i end
#¶ ↑
set_internal_pid
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9287 def set_internal_pid(i = nil) @internal_hash[:pid] = i end
#¶ ↑
set_keep_the_extracted_archive
¶ ↑
This method will keep the source-archive extracted. Note that this is not the default - by default we will remove the extracted archive.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11859 def set_keep_the_extracted_archive(i = true) @internal_hash[:keep_the_extracted_archive] = i end
#¶ ↑
set_make_command
¶ ↑
This method can be used to set which make command is to be used.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9804 def set_make_command( i = 'make' ) i = 'make' if i.nil? # Set to the default in this case. @internal_hash[:make_command] = i end
#¶ ↑
set_name_for_the_build_directory
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13301 def set_name_for_the_build_directory( i = :use_the_default_name, be_verbose = false ) case i # ======================================================================= # # === :default # ======================================================================= # when :default, :use_the_default_name i = DEFAULT_NAME_FOR_THE_BUILD_DIRECTORY end case be_verbose # ======================================================================= # # === :report_back # ======================================================================= # when :report_back be_verbose = true end if be_verbose orev "The name of the build directory will be `#{royalblue(i)}#{rev}`." end @internal_hash[:name_for_the_build_directory] = i end
#¶ ↑
set_on_ihash
¶ ↑
The second argument is the dataset that you wish to use.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 521 def set_on_ihash( which_key_to_use = :cookbook_dataset, which_dataset_value_to_use ) @internal_hash[which_key_to_use] = which_dataset_value_to_use end
#¶ ↑
set_parameters_to_make
¶ ↑
If we have to pass specials options to the program called “make”, then we can do so via this setter-method.
These are additional options that can be given to the program called “make”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4598 def set_parameters_to_make(i) # ======================================================================= # # The parameters must always be kept as an Array. # ======================================================================= # i = [i].flatten.compact @internal_hash[:parameters_to_make] = i # Do not change them to a String via .to_s end
#¶ ↑
set_path
¶ ↑
Set the $PATH variable here through this setter-method. This will directly modify ENV[] as is.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14113 def set_path(i) i = i.dup # Better to always .dup it when we set it. ENV['PATH'] = i # Must re-enable PATH environment as it was. end
#¶ ↑
set_permanently_extract_to
¶ ↑
This method will permanently set a new directory to which we will extract to.
To invoke this method, do something such as:
ry --permanently_extract_to=/Depot ry --permanently_extract_to=/opt ry --permanently_extract_to=$TEMP_DIR
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9505 def set_permanently_extract_to( i = nil ) if i target = RBT.permanently_set_temp_directory(i) orev "The RBT scripts will henceforthwith be extracted "\ "towards `#{sdir(target)}#{rev}`." else orev 'Please provide an argument.' end end
#¶ ↑
set_pkgconfig_symlink
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2704 def set_pkgconfig_symlink( i = true ) case i # Sanitize yes/no values. when 'yes','y' i = true when 'no','n' i = false end if block_given? case yielded # === :be_verbose when :be_verbose if i == true show_enable_pkgconfig_symlinking_message else orev "Disabling pkgconfig-symlinking of .pc files "\ "into `#{sdir('/usr/lib/pkgconfig/')}#{rev}`." end end end if cookbook_dataset? cookbook_dataset?.symlink_pkgconfig_files = i else orev 'No cookbook-dataset object could be found.' end end
#¶ ↑
set_postinstallation
¶ ↑
Note that the postinstallation steps will always be stored as an Array.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7671 def set_postinstallation(i) @internal_hash[:postinstallation] = [i].flatten.compact end
#¶ ↑
set_preinstall_action
¶ ↑
This method can be used to set different pre-install actions.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 913 def set_preinstall_action(i) if i.is_a? String # Strings will become an Array here. if i.include? ',' i = i.split(',').map(&:strip) elsif i.include? ';' i = i.split(';').map(&:strip) end end cookbook_dataset?.preinstall = i end
#¶ ↑
set_program_version
¶ ↑
Use this method to assign to a new program version at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4991 def set_program_version(i) # ======================================================================= # # The program version is presently (December 2018) not allowed # to include a '/' character - possibly never allowed to have # this character. Thus, if we encounter such a character we # will apply File.basename() on this input. # ======================================================================= # if i.include? '/' i = File.basename(i).delete('/') end i.delete!('/') if i.include? '/' # ======================================================================= # # Keep track which specific program version we will use. # ======================================================================= # @internal_hash[:use_this_specific_program_version] = i # ======================================================================= # # The following code is semi-experimental - we will also sync onto # the cookbook dataset object if it exists. We do this primarily # so that class Flexbox can show the proper prefix in use. # ======================================================================= # if cookbook_dataset? cookbook_dataset?.set_program_version(i) if is_this_an_appdir_prefix? cookbook_dataset?.prefix? cookbook_dataset?.update_appdir_prefix end if use_appdir_prefix? # =================================================================== # # We know that we wish to use a special appdir prefix, so use it. # =================================================================== # set_user_prefix(return_appdir_prefix) end end end
#¶ ↑
set_short_name
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9906 def set_short_name(i) cookbook_dataset?.set_short_name(i) end
#¶ ↑
set_skip_extracting
¶ ↑
Use this method when we shall skip the extracting phase.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 758 def set_skip_extracting( be_verbose = true ) if be_verbose orev 'We will not extract our source, thus we will skip '\ 'extracting the archive.' end @internal_hash[:skip_extracting] = true end
#¶ ↑
set_symlink_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14051 def set_symlink_program( compile_this_program = compile_which_program?, use_this_program_version = program_version? ) # ======================================================================= # # We will delegate towards class RBT::SymlinkFromToCurrent next. # ======================================================================= # _ = RBT::SymlinkFromToCurrent.new( [ # Pass an Array here. compile_this_program, use_this_program_version ], :do_not_run_yet ) {{ use_opn: use_opn? }} @internal_hash[:symlink_program] = _ end
#¶ ↑
set_these_env_variables
¶ ↑
This method can be used to modify ENV variables.
The first input argument to this method should be the Hash, consisting of the key-value pairs in the form of key being the NAME of the shell variable that is to be modified; and the corresponding value being the new VALUE that you wish to set this variable to.
The third argument to this method determines whether we will output what we do to the user. By default this is true, but sometimes we may want to be able to quietly set these environment variables, such as when we attempt to use clang.
Legitimate usage examples for this method, in ruby, would be:
set_this_env_variable 'CFLAGS = -gcc' set_this_env_variable 'LIBS: -lpthread'
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10838 def set_these_env_variables( hash_or_string, # We allow Hash and String as input. But String must be in a special format. do_which_action = :report_only, be_verbose = true, &block ) if block_given? yielded = yield if yielded.is_a? Symbol do_which_action = yielded end end unless @internal_hash[:do_not_use_special_flags] case do_which_action # ===================================================================== # # === :be_quiet # ===================================================================== # when :be_quiet, :be_silent be_verbose = false # =================================================================== # # Also change the do_which_action variable. # =================================================================== # do_which_action = :do_set_these_variables end case be_verbose # ===================================================================== # # === :be_verbose # ===================================================================== # when :be_verbose be_verbose = true # ===================================================================== # # === :be_quiet # ===================================================================== # when :be_quiet, :be_silent be_verbose = false end # ===================================================================== # # === Next, handle Strings # ===================================================================== # if hash_or_string.is_a? String if hash_or_string.include?('=') or hash_or_string.include?(':') if hash_or_string.include?('=') use_this_as_split_token = '=' elsif hash_or_string.include?(':') use_this_as_split_token = ':' end splitted = hash_or_string.sub(/^export /,'').split(use_this_as_split_token) this_key = splitted.first this_value = splitted.last hash_or_string = { this_key => this_value } end end # ===================================================================== # # === Next, handle Hashes # ===================================================================== # hash_or_string.each_pair {|key, value| value.strip! if value.is_a? String # =================================================================== # # Make some exceptions, e. g. for gems. # =================================================================== # return if cookbook_dataset_has_been_initialized? and is_a_gem? if be_verbose and is_compiled? and !extract_only? and not value.to_s.empty? # ================================================================= # # Notify the user as to the env-value modification. Since as of # November 2018 we will no longer use opnn() here. # ================================================================= # e " #{sfancy(key)} #{rev}will be set to the "\ "value(s): #{lightblue(value.to_s)}#{rev}" end if value.is_a? FalseClass or value.is_a? TrueClass or value.is_a? Integer value = value.to_s end case do_which_action when :do_set_these_variables # ================================================================= # # Next set the value to the environment variable. # ================================================================= # ENV[key] = value end } end end
#¶ ↑
set_url1
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13104 def set_url1(i) cookbook_dataset?.set_url1(i) end
#¶ ↑
set_use_these_configure_options
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1504 def set_use_these_configure_options(i) i.tr!(N,' ') if i.include? N i.squeeze!(' ') @internal_hash[:configure_options] = i end
#¶ ↑
set_use_this_build_system
¶ ↑
Consistently use this method when you modify the value at @internal_hash.
We need to ensure that it is a Symbol.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2984 def set_use_this_build_system(i) i = i.to_sym unless i.is_a? Symbol @internal_hash[:use_this_build_system] = i end
#¶ ↑
set_use_this_make_command
¶ ↑
This can be used to use another make command, such as “ninja”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 306 def set_use_this_make_command( i = :default ) case i # ======================================================================= # # === :default # ======================================================================= # when :default i = :make end i = i.to_s # It must be a string. @internal_hash[:use_this_make_command] = i end
#¶ ↑
set_use_this_prefix
¶ ↑
This variant will only modify the prefix stored by @prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 121 def set_use_this_prefix(i) prefix?.set_prefix(i) if prefix? end
#¶ ↑
set_user_prefix
(set_prefix
tag, set prefix tag)¶ ↑
This method can be used by the user, to designate another prefix in use for the given program. This will be the target directory into which the program will be installed into.
A specialized class, called RBT::Prefix
, will handle the prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7773 def set_user_prefix( i = :appdir_prefix ) # ======================================================================= # # We must rewrite the program version in the following case. # # The input may look like this: # # "/Programs/Gobjectintrospection/1.53.4/" # # ======================================================================= # if i and use_this_specific_program_version? if i.is_a?(String) and i.include?(programs_directory?) use_this_regex = /(\d{1,2}\.?\d{1,2}\.?\d{1,2}\/)$/ # See: http://rubular.com/r/PPb2Y96XfF i.sub!(use_this_regex, use_this_specific_program_version?) i << '/' unless i.end_with? '/' elsif i.is_a?(Symbol) i = use_this_specific_program_version? end end if i.is_a? Symbol # ===================================================================== # # Next, perform some sanitize operations. # # This clause will handle Symbols such as :app_dir_like or # :use_ntrad_prefix_at_a_later_time. # ===================================================================== # case i.to_s # case tag # ===================================================================== # # === ULOCAL # # This refers to the commonly used /usr/local/ directory. # ===================================================================== # when 'ULOCAL' i = '/usr/local/' # ===================================================================== # # === trad # ===================================================================== # when /^trad$/ i = '/usr/' # ===================================================================== # # === --opt_prefix # ===================================================================== # when /^-?-?opt(_|-)?prefix$/, :opt i = '/opt/' # ===================================================================== # # === non_traditional # # This entry point has various aliases such as :ntrad. # ===================================================================== # when /^app(_|-)?dir$/, /^app(_|-)?dir(_|-)?like$/, /^use(_|-)?appdir(_|-)?prefix$/i, /^use(_|-)?ntrad(_|-)?prefix(_|-)?at(_|-)?a(_|-)?later(_|-)?time$/i, 'non_traditional', 'gobolinux', 'ntrad', 'default', 'app_dir_like', 'appdir', 'return_appdir_path', 'false', 'f', 'appdir_prefix', '' prefix?.clear_program # Clear it initially. prefix?.do_use_appdir_prefix if handle_which_program? i = return_non_traditional_prefix(handle_which_program?) end # =================================================================== # # Since as of May 2014 we get rid of all '-' # =================================================================== # i.delete!('-') if i.respond_to?(:include?) and i.include? '-' end # ===================================================================== # # === Convert environment variables, if given, and unfreeze frozen # Strings # ===================================================================== # if i.is_a?(String) # =================================================================== # # Unfreeze frozen Strings. # =================================================================== # if i.is_a? String and i.frozen? i = i.dup # "unfreeze" it. end # =================================================================== # # === Handle Strings that start with the ':' character # # Handle the situation when we input a String that starts with # the character ':'. This will be assumed to be a shortcut to # an environment variable. # =================================================================== # if i.start_with?(':') # ================================================================= # # Next, we must add the proper program_version. This is either the # program_version at hand - or it is an ENV variable if it exists. # We check for the ENV variable first. # ================================================================= # this_key = (i.delete(':').upcase+'_PREFIX').dup if ENV.has_key? this_key # =============================================================== # # The environment variables must be UPCASED and have appended # the string '_PREFIX'. # =============================================================== # i = ENV[this_key].dup.to_s else # =============================================================== # # Assume a special prefix variant targetting the /Programs/ # hierarchy. # =============================================================== # i = programs_directory?+i.to_s.delete(':').capitalize+'/' i << program_version?.dup.to_s end end if i.include?('$') i = convert_env_variable(i) # Replace ENV variables here. i << '/' unless i.end_with? '/' end if i.include? '--' if i.include? '--prefix=' # Input is assumed to be like '--prefix=/Depot/j' i = i.split('=').last # ← Obtain just the last part in this case. end end end # ===================================================================== # # === Ensure a trailing '/' for directories. # ===================================================================== # unless i.to_s.end_with? '/' # .to_s to protect against Symbols given. i << '/' if File.directory?(i.to_s) end end # ======================================================================= # # Next, we must check for post-install actions and modify these, # if they exist. We only do so if we have an AppDir-prefix. # ======================================================================= # if is_an_appdir_prefix?(i.to_s) consider_modifying_postinstall end prefix_object?.use_this_as_the_new_prefix = i end
#¶ ↑
shall_we_extract_the_archive?¶ ↑
Query method over as to whether RBT
will extract the archive or not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1008 def shall_we_extract_the_archive? @internal_hash[:extract_the_archive] end
#¶ ↑
shall_we_use_an_appdir_prefix?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12588 def shall_we_use_an_appdir_prefix? @internal_hash[:shall_we_use_an_appdir_prefix] end
#¶ ↑
show_all_about
¶ ↑
This method will show the full content of a specific .yml file.
To invoke this method, do something like the following:
ry htop show_all
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4483 def show_all_about( show_this_program = search_for_this_program? # or internal_program_name? ) action(:ShowAllAbout, show_this_program) end
#¶ ↑
show_all_binaries_of_this_program
¶ ↑
Use this method to show the registered binaries of the input-argument, the given program at hand. This will display these binaries in one line, as a “Hash”.
Invocation example:
ry binutils --binaries-as-one-line?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10582 def show_all_binaries_of_this_program( this_program = compile_which_program?, report_how = :one_line_per_program # The only other mode is :report_in_one_line ) case this_program # ======================================================================= # # === :default # ======================================================================= # when :default this_program = compile_which_program? end if dataset?.nil? ensure_that_a_dataset_exists_for_this_program(this_program) end _ = binaries? # Grab the registered binaries here. if _.empty? orev "No binaries/executables appear to be registered for "\ "the program `#{sfancy(this_program)}#{rev}`." else case report_how when :one_line_per_program, :default e; _.each_with_index {|this_binary, index| index += 1 index = " #{slateblue((index.to_s+') ').rjust(5))}" e "#{index}#{sfancy(this_binary)}" }; e else # else we use another mode. result = '{'.dup result << _.join(',') result << '}' e result end end end
#¶ ↑
show_all_locally_available_programs
¶ ↑
Invocation example:
rbt --locally-available-programs?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6190 def show_all_locally_available_programs( slice_n_chunks = 3 ) programs_dir = programs_dir? all_dirs = Dir[programs_dir+'*'].select {|entry| File.directory? entry } all_dirs.map! {|entry| use_this_regex = /^#{programs_dir}/ entry = entry.sub(use_this_regex,'') entry # .downcase # To downcase or not to downcase. } n_programs = all_dirs.size.to_s orev "The locally available `#{orange(n_programs)}#{rev}` programs are:" sliced = all_dirs.each_slice(slice_n_chunks) result = ' '.dup sliced.each {|inner_group_array| joined = inner_group_array.map {|entry| (entry+',').ljust(25) }.join result << ' '+sfancy(joined.strip).delete(',')+N } result = result.strip.chop.chomp.strip result.sub!(/,\e\[0;37$/, '.') # Reformat it. e e result e end
#¶ ↑
show_all_profiles_fitting_to_this_program
¶ ↑
This method can be used to show all profiles fitting to this program, such as gcc.
Invocation example:
ry --show-these-profiles=gcc
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5665 def show_all_profiles_fitting_to_this_program(i = :gcc) all_available_profiles = return_files_from_the_profiles_directory selection = all_available_profiles.select {|entry| File.basename(entry).include? i.to_s } if selection.empty? orev "No profiles were found for the program "\ "called #{steelblue(i.to_s)}#{rev}." else orev "The following profiles were found for the "\ "program #{sfancy(i)}#{rev}:" e selection.each_with_index {|this_file, index| index += 1 short_name_of_the_file = File.basename(this_file).sub(/.md$/,'') colourized_index = royalblue('[')+orangered(index)+royalblue(']') e " #{rev}#{colourized_index} #{steelblue(short_name_of_the_file)}" } e end end
#¶ ↑
show_all_programs_that_have_this_as_dependency
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13482 def show_all_programs_that_have_this_as_dependency(i) i = i.to_s.strip all_files = Dir["#{expanded_cookbook_directory?}*.yml"] all_files.select!.each {|this_file| if File.exist?(this_file) deps_on = YAML.load_file(this_file)[:required_deps_on] deps_on.any? {|a_dependency| a_dependency == i } else false end } if all_files.empty? orev "No program has a dependency on #{steelblue(i)}#{rev}." else orev "The following #{tomato(all_files.size)} #{rev}programs "\ "have a dependency on #{steelblue(i)}#{rev}:" e all_files.each {|entry| e steelblue(" #{File.basename(entry).delete_suffix('.yml')}") } e end end
#¶ ↑
show_and_store_json_for
¶ ↑
This method will load the expanded cookbook dataset (a yaml file), and convert this into json, via the .to_json method.
Invocation example:
rbt htop --json
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7591 def show_and_store_json_for( this_program = compile_which_program? ) require 'json' hash = {} orev 'The json dataset for '+steelblue(this_program)+"#{rev} is:" dataset = load_dataset_from_this_expanded_cookbook(this_program) hash[this_program.to_sym] = dataset e pp hash e orev 'This will be stored into the current directory as well.' what = hash.to_json # ======================================================================= # # Decide where to store the json-file. # ======================================================================= # into = "#{this_program}.json" orev "Storing into the file `#{sfile(into)}#{rev}`." write_what_into(what, into) end
#¶ ↑
show_available_aliases
¶ ↑
To invoke this method, do:
rbt --aliases?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2426 def show_available_aliases( _ = RBT.cookbook_aliases? ) orev "The available #{sfancy(_.size.to_s)} #{rev}aliases are:" index = 0 _.each_pair {|key, value| index += 1 colourized_index = slateblue((index.to_s+')').rjust(5)) e colourized_index+' '+sfancy(key.ljust(18))+ mediumseagreen(' → ')+simp(value) } end
#¶ ↑
show_available_batch_compile_options
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5453 def show_available_batch_compile_options( this_file = RBT.file_cookbook_chained_programs ) if File.exist? this_file dataset = YAML.load_file(this_file) keys = dataset.keys orev "These #{teal(keys.size)} #{rev}entries exist:"; e keys.each {|this_entry_point| e " #{sfancy(this_entry_point)}" }; e else opnn; no_such_file_exists(this_file) end end
#¶ ↑
show_available_headers_of_this_program
¶ ↑
This method will show the available headers of the given program at hand.
Invocation example:
ry glibc --headers?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9528 def show_available_headers_of_this_program( i = compile_which_program? ) array_headers = cookbook_dataset_headers? if array_headers.empty? orev "The program `#{sfancy(i)}#{rev}` will not install any .h files." else orev "The program `#{sfancy(i)}#{rev}` will install these .h files:" e array_headers.each {|this_header_file| e " #{sfancy(this_header_file)}" } e end end
#¶ ↑
show_available_profiles
¶ ↑
This method will show the available (local) profiles.
To invoke this method try:
rbt --show-available-profiles
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4616 def show_available_profiles( target_directory = DIRECTORY_RBT_PROFILES ) available_profiles = return_files_from_the_profiles_directory.map {|entry| File.basename(entry).delete_suffix('.md') } if available_profiles.empty? orev "No profiles could be found in the directory "\ "#{sdir(target_directory)}#{rev}." else orev "The following profiles are available:" e available_profiles.each_with_index {|entry, index| index += 1 result = " #{entry.ljust(45)}# #{seagreen(index.to_s.rjust(2))}#{rev}" e slateblue(result) } e end end
#¶ ↑
show_build_systems_priorities
¶ ↑
Invocation example:
rbt --prioritize?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10692 def show_build_systems_priorities array = return_build_systems_priorities e e lightgreen( 'The build system priority is the following '\ '(first one has higher priority):' ) e array.each_with_index {|content, index| index += 1 e slateblue(("(#{index}) ").rjust(6))+ orange(content) } e e rev+'Remember that the per-yaml setting "'+ steelblue('use_this_build_system')+'" cat' e 'overrule this.' e end
#¶ ↑
show_compile_chain
¶ ↑
Show all members of a particular compile-chain.
Invocation examples:
ry --show-chain=plasma ry --show-compile-chain-of=kde5_plasma ry --compile-chain-of=kde5_plasma ry --view=kde5_plasma ry --view=xfce
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13028 def show_compile_chain(i) action(:ShowCompileChain, i) end
#¶ ↑
show_compile_time_statistics
¶ ↑
This method will show compile-time statistics for all the programs that the user has compiled through RBT
.
Invocation example:
ry --show-compile-time-statistics
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8651 def show_compile_time_statistics action(:show_compile_time_statistics) end
#¶ ↑
show_components
¶ ↑
Invocation example:
ry --show-components=xfce
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7482 def show_components(i) i = i.to_s # Just in case. chained_programs = return_chained_programs if chained_programs.has_key? i _ = chained_programs[i] e e "#{rev}These components belong to #{steelblue(i)}:" e _.each_with_index {|this_program, index| index += 1 e lightgreen(" #{index}) ".rjust(6))+ steelblue(this_program) } e else orev 'No component with that name could be found.' orev 'Available keys are:' e e royalblue( chained_programs.keys.join(', ').strip.chop ) e end end
#¶ ↑
show_downloadable_programs
¶ ↑
Invocation example:
ry --show-downloadable-programs
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12039 def show_downloadable_programs( i = available_programs?.sort ) chunked = i.each_slice(5) orev 'The following programs can be downloaded:' e chunked.each {|this_chunk| e " #{slateblue(this_chunk.join(', ').strip.chop)}" } e end
#¶ ↑
show_gobolinux_instructions
¶ ↑
To invoke this method do:
rbt --show-gobo-instructions
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1821 def show_gobolinux_instructions _ = RUBY_SRC_DIR+'rbt/doc/instructions_for_gobolinux.md' if File.exist? _ e File.read(_) else no_file_exists_at(_) end end
#¶ ↑
show_help_for_this_program
¶ ↑
Use this method if you wish to feedback how to use this class.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8746 def show_help_for_this_program( i = '', be_silent = false ) be_silent = true if be_silent == :be_silent e "#{simp(i)}#{rev} has these options available:" unless be_silent display_standard_help_options # This is stored in help.rb end
#¶ ↑
show_how_to_batch_compile
¶ ↑
This method will notify the user in how to batch-compile programs via RBT
.
Invocation example:
rbt --show_how_to_batch_compile
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 660 def show_how_to_batch_compile show_available_batch_compile_options e e 'In order to batch-compile one of these, issue a command such as:' e e ' rbt --batch-compile=mate' e ' rbt --batch-compile=vid_base' e ' rbt --batch-compile=terminals' e end
#¶ ↑
show_how_to_compile_kde
¶ ↑
This method will provide some hints on the commandline as to how to batch-compile the various KDE components.
Invocation example:
rbt --show-how-to-compile-kde
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8372 def show_how_to_compile_kde e e ' rbt --batch-compile=kde5_foundation' e ' rbt --batch-compile=kde5_plasma' e ' rbt --batch-compile=kde5_porting_aids' e ' rbt --batch-compile=kde5_applications' e end
#¶ ↑
show_information_about_blfs
¶ ↑
We show some information about BLFS webpages.
To invoke this method, you can issue a command such as this here:
rbt binutils --lfs
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3026 def show_information_about_blfs( use_this_key = :blfs ) ensure_that_this_key_has_a_dataset(use_this_key) dataset = cookbook_dataset? if dataset.has_key?(use_this_key) and !dataset?.blfs?.empty? # .empty? will assume this to be a String. url = dataset?.blfs? if url.is_a? Array url = url.first end e "Url is: #{sfancy(url)}" set_xorg_buffer(url) if is_roebe? else orev "The program #{royalblue(compile_which_program?)} "\ "#{rev}has no blfs entry." end end
#¶ ↑
show_installation_procedure_file
¶ ↑
Show the content of the file called installation_procedure.yml
To invoke this method, try:
rbt --installation-procedure
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12658 def show_installation_procedure_file( this_file = :installation_procedure ) begin require 'beautiful_url' unless Object.const_defined? :BeautifulUrl if this_file.is_a? Symbol this_file = BeautifulUrl[this_file.to_s] end rescue LoadError; end this_file = this_file.first if this_file.is_a? Array if File.exist? this_file e orev 'Making use of the file at' orev '`'+sfile(this_file)+rev+'`:' e e File.read(this_file) else orev "No file called #{sfile(this_file)}#{rev} was found." end end
#¶ ↑
show_last_compiled_program
¶ ↑
Use this method to show the last compiled program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2218 def show_last_compiled_program( shall_we_exit = false ) shall_we_exit = true if shall_we_exit == :then_exit orev 'The last compiled program was `'+ sfancy(last_compiled_program?)+"#{rev}` (as registered" orev "in the file #{sfile(RBT.file_compiled_programs)}#{rev})." exit if shall_we_exit end
#¶ ↑
show_last_configure_options_then_exit
¶ ↑
This method will show the last configure option that was used, then it will exit.
Invoke this like so:
rbt lconfigure?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2865 def show_last_configure_options_then_exit show_last_options exit_program end
#¶ ↑
show_last_options
¶ ↑
Use this method to show the last configure options that were used in order to compile a program from source.
To grab this, try:
ry htop --last-options
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 635 def show_last_options( name_of_the_program = compile_which_program? ) full_configure_command = return_last_configure_command if full_configure_command orev "The last configure command for "\ "`#{simp(name_of_the_program)}#{rev}` was:" orev " #{simp(full_configure_command)}" else orev "No configure command was used "\ "for `#{simp(name_of_the_program)}#{rev}`." end end
#¶ ↑
show_last_updated
¶ ↑
This method will show the last updated programs.
Invocation example:
ry --last_update
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3610 def show_last_updated( shall_we_exit = true ) require 'rbt/cookbooks/show_last_updated.rb' RBT::Cookbooks::ShowLastUpdated.new # bl $RUBY_COOKBOOKS/lib/cookbooks/show_last_updated.rb exit_program if shall_we_exit end
#¶ ↑
show_minimal_gcc_configure_options
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4639 def show_minimal_gcc_configure_options _ = directory_rbt_profiles?+'gcc_minimal_but_lots_of_languages_enabled.md' if File.exist? _ dataset = readlines(_).reject {|entry| begins_with_a_comment?(entry) }.join(N).tr(N,' ').squeeze(' ') e e " #{steelblue(dataset)}" e else opnn; no_file_exists_at(_) end end
#¶ ↑
show_n_largest_local_programs
¶ ↑
Show the largest local programs with this method.
Invocation example:
ry --show_highest
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3235 def show_n_largest_local_programs( i = :default ) case i # ======================================================================= # # === :default # ======================================================================= # when :default i = 50 end action(:highest, i) exit_program end
#¶ ↑
show_path_to_the_source_directory_yaml_file
¶ ↑
This method will simply show the path to the source_dir.yml file.
Usage example:
rbt --path_to_source_directory?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11528 def show_path_to_the_source_directory_yaml_file _ = project_yaml_directory?+'configuration/source_dir.yml' e sfile(_) end
#¶ ↑
show_pc_files_installed_by_this_program
¶ ↑
Invocation example:
ry samba --pkgconfig-files?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5768 def show_pc_files_installed_by_this_program( i = compile_which_program? ) _ = pc_files? if _.empty? orev 'The program '+simp(i)+rev+' will not install any .pc file.' else orev "The program #{gold(i)} #{rev}will install "\ "the following #{sfancy(_.size.to_s)} #{rev}.pc file(s):" e; _.each {|this_pc_file| e " #{sfancy(this_pc_file)}" }; e end end
#¶ ↑
show_programs_with_a_blfs_entry
¶ ↑
Invocation example:
ry --show-all-blfs-entries
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 279 def show_programs_with_a_blfs_entry _ = Dir["#{individual_cookbooks_dir?}*.yml"] matches = _.select {|file| dataset = File.read(file) dataset.include? ' blfs:' }.map {|entry| File.basename(entry).sub(/\.yml$/,'') } unless matches.empty? orev "The following #{sandybrown(matches.size.to_s)} #{rev}programs "\ "have a #{sfancy('blfs')} #{rev}entry:" e matches.each_with_index {|name_of_the_program, index| index += 1 index = (index.to_s+') ').rjust(5) remote_url = return_blfs_page_of_this_program(name_of_the_program) e royalblue(index)+slateblue(name_of_the_program.ljust(24))+ lightblue(remote_url.to_s) } e end end
#¶ ↑
show_programs_with_this_as_dependency
¶ ↑
Invocation example:
ry --show-programs-with-this-as-dependency=cmake
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3724 def show_programs_with_this_as_dependency(i) use_this_key = :required_deps_on e "#{rev}Next trying to find all programs that depend on #{steelblue(i)}"\ "#{rev}:" e array_these_programs_depend_on_the_given_input = [] available_programs?.each {|this_program| expanded_cookbook_dataset = return_dataset_from_this_expanded_cookbook(this_program) if expanded_cookbook_dataset required_deps_on = expanded_cookbook_dataset[use_this_key] if required_deps_on.include? i array_these_programs_depend_on_the_given_input << this_program e " - #{this_program}" end end } e e "#{rev}A total of "+ royalblue(array_these_programs_depend_on_the_given_input.size.to_s)+ rev+' registered programs depend on '+steelblue(i)+'.' e end
#¶ ↑
show_rbt_intro
¶ ↑
Invocation example:
ry --show-rbt-intro ry --intro
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4690 def show_rbt_intro e e 'Here are some hints to get you started with RBT.' e e "You can compile a program by issuing #{orange('rbt <name>')}." e e 'Example:' e e sfancy(' rbt php') e e 'You can also compile into a standalone app-dir:' e e sfancy(' rbt php ntrad') e sfancy(' rbt php --app-dir') e e 'Both variants are synonymous. If in doubt, using the variants' e 'that start with '+teal('--')+' is recommended.' e e 'To speed-up looking for the dataset stored in the various .yml' e 'files you can also issue the following command:' e e sfancy(' rbt --expand') e e 'This command will expand the dataset into a "sanitized" variant' e 'that requires less pre-processing before it can be used for' e 'compiling/installing programs from source.' e end
#¶ ↑
show_registered_keys
¶ ↑
This delegates towards the Register class.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12580 def show_registered_keys require 'rbt/utility_scripts/register_program_files_into_global_database.rb' RBT::RegisterProgramFilesIntoGlobalDatabase.show_registered_keys end
#¶ ↑
show_success_or_failure_status
(success tag, failure tag, status tag)¶ ↑
This method will report some things, aka the success or failure status of a program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14248 def show_success_or_failure_status # ======================================================================= # # Report the following only if the program has been installed # successfully. # ======================================================================= # if has_the_program_been_installed_successfully? orev "The host system architecture was: "\ "#{slateblue(host_system?)}" if is_a_gem? # =================================================================== # # If it is a .gem file then we will not report as much information. # =================================================================== # opne teal('The program ')+ lightgreen(compile_which_program?)+ teal(' has been installed successfully.') else _ = return_full_configure_command if _.nil? or _.empty? # ================================================================= # # This entry-point is specifically for e. g. perl-addons and # similar programs. # ================================================================= # opne teal('The program ')+lightgreen(compile_which_program?)+ teal(' has been installed successfully.') else opne teal('The program ')+lightgreen(compile_which_program?)+ teal(' has been installed successfully, into the prefix') opne plum(prefix?.to_s)+ teal('. The full configure command was:') e e " #{slateblue(return_full_configure_command)}" e end end else # ===================================================================== # # Else the program has failed during compilation/installation. # ===================================================================== # opne crimson( return_unicode_warning_symbol_or_empty_string+' The program `' )+ teal(compile_which_program?)+ crimson( '` could not be installed. '+ return_unicode_warning_symbol_or_empty_string ) end end
#¶ ↑
show_the_available_gems
¶ ↑
To invoke this method from the commandline, try:
rbt --show-registered-gems
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14329 def show_the_available_gems( i = RBT.array_all_rubygems ) e orev 'These gems are currently available within the RBT project:' e i.each_with_index {|this_gem, index| index += 1 e " #{lightgreen(index.to_s.rjust(4))} #{slateblue(this_gem)}" } e end
#¶ ↑
show_the_available_profiles_for_configure_options
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5689 def show_the_available_profiles_for_configure_options Dir["#{DIRECTORY_RBT_PROFILES}*.md"].each {|this_profile| e "#{rev} - #{royalblue(File.basename(this_profile)).delete_suffix('.md')}" } end
#¶ ↑
show_the_colours_in_use
¶ ↑
This method will show the colours in use by RBT::Action::SoftwareManager
.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11933 def show_the_colours_in_use _ = RBT.file_colours if File.exist? _ dataset = load_yaml(_) orev "The colours in use are:" e dataset.each_pair {|name, this_colour| e "#{(name+':').ljust(12)} colour in use for this entry "\ "will be `#{::Colours.send(this_colour, this_colour)}.`" } e else opnn; no_file_exists_at(_) end end
#¶ ↑
show_the_flexbox
¶ ↑
This will show the flexbox.
The first argument should be the dataset for the program that we are about to install/compile.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12092 def show_the_flexbox( compile_this_program = compile_which_program? ) if show_the_flexbox? # =================================================================== # # Next determine whether we shall show the required dependencies # via the flexbox. Since as of November 2020 this is now the # default. At a later point we may disable it again, not sure # yet - but I think showing the dependencies is useful for # the end user, hence why it is now set to true by default. # =================================================================== # shall_we_show_the_required_dependencies_via_the_flexbox = always_show_dependencies? # =================================================================== # # Delegate into AsciiParadise::Flexbox next, if it is available: # =================================================================== # e action(:Flexbox, compile_this_program) {{ show_required_dependencies_on: shall_we_show_the_required_dependencies_via_the_flexbox, use_this_dataset: self, # sanitize_cookbook? use_colours: use_colours? }}.display e end end
#¶ ↑
show_the_last_configure_option_for_this_program
¶ ↑
This method will make use of the file configure_command_database.yml. Obviously, the file has to exist in order for this to work.
Invocation example:
ry attica --show-last-configure-option-for-this-program
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1684 def show_the_last_configure_option_for_this_program( this_program = compile_which_program? ) _ = RBT.file_configure_database if File.exist? _ dataset = YAML.load_file(_) if dataset.has_key? this_program result = dataset[this_program] orev "The program #{sfancy(this_program)} #{rev}has "\ "been compiled with this command:" e e " #{sfancy(result)}" # Display it without opnn. e else orev "The program #{sfancy(this_program)} #{rev}has not "\ "been registered/compiled yet." end else orev "No file exists at `#{sfile(_)}#{rev}` so we can not proceed." orev 'Nota bene: You should first compile some programs, before' orev 'making use of this method.' end end
#¶ ↑
show_where_the_base_directory_can_be_found
¶ ↑
To test this method, do:
ry htop base_dir?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2314 def show_where_the_base_directory_can_be_found e orev 'The base directory is at: '.ljust(36)+ sfancy(temp_directory?) unless extract_to?.to_s.empty? orev "We will extract to this directory: "\ "#{sfancy(extract_to?.to_s)}" end e end
#¶ ↑
show_whether_we_are_using_ccache_or_whether_we_are_not
¶ ↑
To invoke this method from the commandline, try:
ry --use-ccache?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12539 def show_whether_we_are_using_ccache_or_whether_we_are_not _ = use_ccache? orev "Will the RBT project make use of ccache? "\ "#{sfancy(verbose_truth(_))}" end
#¶ ↑
show_which_colours_will_be_used
¶ ↑
To show which colours will be used for the RBT
project.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11125 def show_which_colours_will_be_used( use_this_file = RBT_COLOURS_FILE ) orev 'These colours will be used:' e YAML.load_file(use_this_file).each_pair {|key, value| e " #{key.ljust(12)} → #{value}" }; e end
#¶ ↑
show_which_compiler_will_be_used
¶ ↑
This method will show which compiler will be used.
Commandline
invocation:
ry --compiler?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9579 def show_which_compiler_will_be_used orev "The compiler that will be used for compiling "\ "programs is `#{slateblue(use_which_compiler?)}#{rev}`." end
#¶ ↑
show_which_files_will_be_installed
¶ ↑
This method will show to the user which files will be installed.
Invocation examples:
ry htop ifiles ry htop --installed-files ry ruby --installed-files
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 7030 def show_which_files_will_be_installed( i = compile_which_program? ) file = static_appdir_prefix?+'yaml/registered_files.yml' if File.exist? file orev 'The following files will be installed by '\ 'the program `'+simp(i)+rev+'`:' dataset = YAML.load_file(file).sort e; dataset.each {|entry| e " #{entry}" }; e else orev "The file #{sfile('registered_files.yml')}"\ " #{rev}could not be found," orev 'thus we can not show which files are installed.' end end
#¶ ↑
simple_or_complex?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14000 def simple_or_complex? @internal_hash[:simple_or_complex] end
#¶ ↑
skip_extracting
?¶ ↑
Query-method over as to whether we will skip extracting the archive at hand. This can usually only be done when the archive has already been extracted somehow.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 589 def skip_extracting? _ = @internal_hash[:skip_extracting] _ == true # This check prohibits nil and false. end
#¶ ↑
sort_configure_options_alphabetically
(sort tag)¶ ↑
This is simply a convenience method - we will quickly sort the Array of configure-options alphabetically here.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5365 def sort_configure_options_alphabetically _ = configure_options? if _.include? ' ' splitted = _.split(' ') sorted = splitted.sort { |a, b| a.delete('-') <=> b.delete('-') }.reverse joined = sorted.join(' ') set_configure_options(joined) end end
#¶ ↑
speed_up_the_compilation
¶ ↑
We can speed up compilation via the -j option to “make”. Keep in mind that we have to avoid the number “0”, though, as make would complain when this is used.
See:
https://www.math-linux.com/linux/tip-of-the-day/article/speedup-gnu-make-build-and-compilation-process
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3198 def speed_up_the_compilation use_n_processors = return_n_processors if use_n_processors <= 0 use_n_processors = 1 # ← 1 is always the minimum. "make -j0" would lead to errors. end append_parameters_to_make( " -j#{use_n_processors}" ) end
#¶ ↑
store_this_as_last_libtool_file
¶ ↑
We will remove “‘ or unhandled argument” if it is part of the given input at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11969 def store_this_as_last_libtool_file(what) # ======================================================================= # # First sanitize the input a little bit: # ======================================================================= # if what.include? "' or unhandled argument" what = what.split(/' or unhandled argument/).first end unless what.empty? base_dir = "#{rbt_log_directory?}libtool/" mkdir(base_dir) unless File.directory? base_dir into = "#{base_dir}last_faulty_libtool_file.md" if is_on_roebe? if File.exist?(into) and File.read(into).strip.end_with? what # =================================================================== # # In this case, we will not store the same result again. # =================================================================== # return end orev "Also storing `#{royalblue(what)}#{rev}` "\ "into `#{sfile(into)}#{rev}`." end write_what_into(what, into) end end
#¶ ↑
strip_the_binaries_of_this_program
¶ ↑
Invocation example:
rbt --strip-binaries-of=htop
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3141 def strip_the_binaries_of_this_program(i) [i].flatten.compact.each {|this_program| binaries_of_this_program = RBT.return_binaries_of_this_program(this_program) if binaries_of_this_program.empty? orev "The program #{sfancy(this_program)} #{rev}has no associated binaries." orev 'Thus, "strip" can not be run on these binaries.' else orev 'Now running "strip" on '+ sfancy(binaries_of_this_program.size.to_s)+ "#{rev} programs:" binaries_of_this_program.each {|this_binary| run_the_strip_command_on_this_input(this_binary) } end } end
#¶ ↑
symlink_all_programs
¶ ↑
Use this method to symlink all programs in the $PROGRAMS directory.
Usage example to trigger this method:
ry htop symlink_all_programs
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6236 def symlink_all_programs( may_we_symlink = !do_not_symlink? ) case may_we_symlink # ======================================================================= # # === :do_it # ======================================================================= # when :do_it may_we_symlink = true end # ======================================================================= # # @do_not_symlink = dataset?.do_not_symlink? if dataset?.do_not_symlink? # ======================================================================= # if may_we_symlink require 'rbt/utility_scripts/symlink_all_programs.rb' _ = RBT::SymlinkAllPrograms.new # bl $RBT/utility_scripts/symlink_all_programs.rb orev "We have finished symlinking all programs in "\ "#{sdir(_.programs_directory?)}#{rev}." end end
#¶ ↑
symlink_glib_schema
¶ ↑
The default prefix, aka the first input argument, should be fine for this class.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14034 def symlink_glib_schema( prefix_where_the_schema_files_reside = program_dir?+ internal_program_name?.capitalize+ '/Current/share/glib-2.0/schemas/' ) if File.directory? prefix_where_the_schema_files_reside RBT::SymlinkGlibSchema.new(prefix_where_the_schema_files_reside) { :do_not_report_when_anything_is_missing } end end
#¶ ↑
symlink_headers?¶ ↑
Use this method if you need to find out whether we shall symlink the .h files into the “/usr/include/” hierarchy or whether we should not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1515 def symlink_headers? _ = cookbook_dataset_symlink_headers? unless @internal_hash[:symlink_headers].nil? _ = @internal_hash[:symlink_headers] end _ end
#¶ ↑
symlink_the_available_gir_files_into_this_target_directory
¶ ↑
This is the “action” method, that is the method that will symlink all .gir files into the given target directory at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1484 def symlink_the_available_gir_files_into_this_target_directory( target_directory = :default_target ) case target_directory when :default_target target_directory = '/usr/share/gir-1.0/' end gir_files?.each {|this_file| original_and_existing_gir_file = "#{prefix?}share/gir-1.0/#{this_file}" target_file = "#{target_directory}#{this_file}" if File.exist?(target_file) and target_file.end_with?('.gir') delete_file(target_file) end symlink(original_and_existing_gir_file, target_file) } end
#¶ ↑
to_tar_xz
¶ ↑
This method can be used to create a .tar.xz archive.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 615 def to_tar_xz(i, &block) if Object.const_defined? :ToTarXz ToTarXz.new(i, &block) else orev "ToTarXz is not available. It can be installed via: "\ "#{steelblue('gem install to_tar_xz')}" end end
#¶ ↑
try_do_determine_which_programs_have_to_be_installed
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2172 def try_do_determine_which_programs_have_to_be_installed( first_argument = first_argument? ) if first_argument.nil? or first_argument.empty? orev 'Please provide the name of the program that is '\ 'to be installed.' else _ = first_argument? unless _.start_with?('--') if _.include? '@' # ================================================================= # # In this case we have input such as htop@2.2.3. # If this is the case then we will not do any sanitizing at all. # ================================================================= # else # ================================================================= # # Now we have to improve on the first argument given. This will try # to use all abbreviations, for instance. # ================================================================= # _ = action(:sanitize_this_program_name, _) end set_install_these_programs(_) end end end
#¶ ↑
try_to_autocorrect_this_erroneous_libtool_entry
¶ ↑
This method will delegate towards class RBT::Libtool
in order to fix a faulty .la file.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5610 def try_to_autocorrect_this_erroneous_libtool_entry(i) require 'rbt/libtool/class_methods/autocorrect_this_file.rb' orev "Now delegating towards class #{slateblue('RBT::Libtool')}#{rev} "\ "to attempt to autocorrect the problem:" orev " #{sfancy(i)}" RBT::Libtool.autocorrect_this_file(i) # ======================================================================= # # The next subsection can re-compile again. We do so at maximum # 5 times. # ======================================================================= # if is_on_roebe? and try_to_autofix? and compiled_n_times? < 5 increment_compiled_counter # Add +1 to the times we have tried to compile. clear_problems compile_this_program_again(program?) end end
#¶ ↑
try_to_autocorrect_this_erroneous_libtool_entry_later
¶ ↑
Use this method to register an erroneous libtool entry. It will be fixed at a later time during the regular compile-cycle.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12420 def try_to_autocorrect_this_erroneous_libtool_entry_later(i) # ======================================================================= # # Store this faulty .la entry into a local file as well, next. This # was added in September 2018. # ======================================================================= # store_this_as_last_libtool_file(i) @internal_hash[:invalid_libtool_archive] = i # This is the libtool-entry that should go away. orev 'Note that you can try to correct this error via:' e e orange(' rbt --fix-libtool-from-file') e end
#¶ ↑
try_to_autofix?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13118 def try_to_autofix? @internal_hash[:try_to_autofix] end
#¶ ↑
try_to_automatically_setup_the_rbt_project
¶ ↑
This method could be used to automatically try and setup the project on a default GoboLinux system.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8922 def try_to_automatically_setup_the_rbt_project if RBT.is_this_a_real_gobolinux_system? orev 'Found a local GoboLinux system.' orev 'Setting up some settings to make use of this as our host system.' target_file = log_dir?+'is_on_gobolinux.md' write_what_into('1', target_file) orev 'This will be stored into the file `'+sfile(target_file)+ rev+'`.' end end
#¶ ↑
try_to_batch_compile_this_stack
¶ ↑
This method can be used to batch-compile several applications.
Invocation examples:
rbt --batch-compile=autotools rbt --batch-compile=vid_suite rbt --batch-compile=mate rbt --batch-compile=kde5_porting_aids
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 698 def try_to_batch_compile_this_stack(i) # ======================================================================= # # === Do some sanitizing of the input first. # ======================================================================= # case i # ======================================================================= # # === rbt --batch-compile=phonon # ======================================================================= # when 'phonon', /^kde(_|-)?plasma/ i = 'kde5_plasma' # ======================================================================= # # === rbt --batch-compile=kde_apps # ======================================================================= # when /^kde(_|-)?apps/ i = 'kde5_applications' # ======================================================================= # # === rbt --batch-compile=protos # ======================================================================= # when 'protos' i = 'xorg_protos' end case i # case tag # ======================================================================= # # === rbt --batch-compile=kde5_porting_aids # ======================================================================= # when /^kde5?(_|-)?porting(_|-)?aids?$/i, /^porting(_|-)?aids?$/i i = return_kde5_porting_aids # ======================================================================= # # === rbt --batch-compile=mate # ======================================================================= # when 'mate', /^mate(-|_)?desktop$/ i = RBT.returned_chained_programs_of_the_mate_desktop opne "We will compile all #{sfancy(i.size.to_s)} programs "\ "of the mate-desktop." opne 'These include:' e; i.each {|entry| e ' - '+sfancy(entry) }; e else hash = return_chained_programs i = hash[i] end if i.is_a? String and i.include? ',' i = i.split(',').map(&:strip).flatten # Now it should be an Array. end if i.is_a? Array i.map! {|entry| entry.delete('-') } end return i end
#¶ ↑
try_to_compile_these_kde_programs
¶ ↑
This method has to remain flexible, because the input may be “first=20” or “last=20” and so forth.
Invocation example:
ry --kde1-first=10
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5296 def try_to_compile_these_kde_programs(i) if i.frozen? i = i.dup end if i.start_with? '--' i.sub!(/^--/,'') end if i.include? '-' these_programs = [] splitted = i.split('-') # Like: "kde1-first=10" last = splitted.last first = splitted.first case first when 'kde1' these_programs = return_these_programs(:kde5_foundation) when 'kde2' these_programs = return_these_programs(:kde5_plasma) when 'kde3' these_programs = return_these_programs(:kde5_porting_aids) when 'kde4' these_programs = return_these_programs(:kde5_applications) end if last # May be like this: "first=10" if last.include? 'first=' n_programs = last.sub(/first=/,'').to_i these_programs = these_programs[0 .. (n_programs - 1)] end end set_compile_these_programs(these_programs) end end
#¶ ↑
try_to_find_an_alias_to_this_input_unless_the_program_exists
¶ ↑
This method will either return the original input unmodified; or it will modify the input in such a way that it points to a valid, registered program.
For example, the String “ph” may become “php”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 702 def try_to_find_an_alias_to_this_input_unless_the_program_exists(i) unless cookbooks_include_this_program? i.downcase is_the_program_included = cookbooks_include_this_program?( i.downcase, :with_abbreviations ) if is_the_program_included i = abbreviations?[i.downcase] end end return i end
#¶ ↑
try_to_fix_all_shebangs
¶ ↑
Use this to fix shebangs of the RBT
project.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1052 def try_to_fix_all_shebangs begin require 'roebe/classes/shebang_fixer.rb' cliner { orev 'Trying to fix all Shebangs now:' entries = Dir["#{base_directory?}**/**.rb"] entries.each { |file| file = ENV['RBT_DIR'].to_s+'/'+file Roebe::ShebangFixer.new(file) } } rescue LoadError orev 'class Roebe::ShebangFixer is not available.' end end
#¶ ↑
try_to_install_this_program
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 895 def try_to_install_this_program( i = compile_which_program? ) return if i.nil? reset_the_cookbook_dataset # Start from a clean state here. do_compile_this_registered_program(i) end
#¶ ↑
try_to_output_how_many_processors_this_computer_has
¶ ↑
To try this method on the commandline, do:
ry --n-cores?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8786 def try_to_output_how_many_processors_this_computer_has( file_cpuinfo = FILE_CPUINFO ) if File.exist? file_cpuinfo orev 'This computer has '+ lightseagreen( "#{return_n_processors_of_this_computer} processors" )+"#{rev}." else orev 'Can not determine the number of processors as ' orev "there is no file at #{sfile(file_cpuinfo)}#{rev}." end end
#¶ ↑
try_to_show_all_binary_duplicates_of_this_program
¶ ↑
Use this method to show which binary duplicates exist for the given input program.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8201 def try_to_show_all_binary_duplicates_of_this_program( i = compile_which_program? ) program_name = i if i.nil? orev 'A nil value has been found in '+orange(__method__.to_s)+rev+'.' pp caller() end capitalized_program_name = program_name.capitalize target = programs_directory?+ capitalized_program_name+ program_name.capitalize+'/Current/bin/*' orev 'Obtaining all files at `'+sdir(target)+rev+'`.' all_binaries = Dir[target] all_binaries.select! {|entry| File.exist? '/usr/bin/'+File.basename(entry) } if all_binaries.empty? orev 'The '+sdir('/usr/bin/')+ rev+' hierarchy does not contain '\ 'any of the binaries' orev "belonging to #{sfancy(program_name)}#{rev}." else n_duplicates = all_binaries.size.to_s orev "Found #{sfancy(n_duplicates)} #{rev}binary duplicates." all_binaries.each {|file| e sfile("/usr/bin/#{File.basename(file)}") } end end
#¶ ↑
try_to_show_the_BLFS_content_of_this_program
¶ ↑
This method can be used to show the BLFS content of a program on the commandline.
The argument to this method should be the program that you wish to display on the commandline here.
Invocation examples:
ry gcc --paste-blfs-page ry libffi --paste-blfs-page ry php --paste-blfs-page
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6364 def try_to_show_the_BLFS_content_of_this_program( i = compile_which_program? ) # ======================================================================= # # First, obtain the remove URL that points to the BLFS page. # ======================================================================= # remote_url = RBT.return_blfs_page_of_this_program(i) into_this_html_file = nil if remote_url what = ''.dup orev "A remote URL has been found, at `#{sfancy(remote_url)}#{rev}`." orev 'We will next display the content of this remote page '\ 'on the commandline.' remote_dataset = URI.open(remote_url).read orev 'The data was obtained ('+steelblue('Encoding:')+ ' '+steelblue(remote_dataset.encoding.to_s)+ steelblue(')') store_here = "#{log_dir?}blfs_webpages/" mkdir(store_here) unless File.directory? store_here into_this_html_file = "#{store_here}blfs_page_for_#{i}.html" orev 'It will be stored into the following file: ' e e " #{sfile(into_this_html_file)}" e write_what_into(remote_dataset, into_this_html_file) if into_this_html_file and File.exist? into_this_html_file remote_dataset = File.read(into_this_html_file, encoding: iso_encoding?) end orev 'Next, the content of that webpage will be shown as a '+ gold('STRING') orev 'on the commandline, but we will remove all HTML tags.' begin sanitized_dataset = remote_dataset.gsub(/<\/?[^>]*>/, '') sanitized_dataset = sanitized_dataset.split(N).reject {|line| line.strip.empty? } rescue ArgumentError => error pp error end # ===================================================================== # # Some HTML entities may have to be re-formatted, for display on the # commandline. For example, '&' is actually Ampersand aka '&' # token. # ===================================================================== # if sanitized_dataset.map! {|entry| if entry.include? '&' entry.gsub!(/&/,'&') end entry } end cliner { sanitized_dataset.each_with_index {|line, index| index += 1 line = to_unicode(line) e steelblue(index.to_s+') ')+ sfancy(line) what << "#{line}\n" } } if is_on_roebe? # =================================================================== # # On my home systems, we will also save this result into a # local file. # =================================================================== # target_directory = "#{log_dir?}blfs/" mkdir(target_directory) unless File.directory? target_directory into = "#{target_directory}#{i}.md" # ← Store it as a .md file. write_what_into_via_unicode(what, into) if into_this_html_file orev "This dataset has also been stored into the "\ "file `#{sfile(into)}#{rev}`." end end orev "The web-page itself, as a .html page, is "\ "available at:" e e " #{sfile(into_this_html_file)}" e else orev "No BLFS entry is registered for "\ "the program `#{sfancy(i)}#{rev}`." end end
#¶ ↑
try_to_use_configure_options?¶ ↑
Query whether we will make use of configure options.
Note that this is true by default.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12606 def try_to_use_configure_options? _ = true # ← True by default. unless @internal_hash[:try_to_use_configure_options].nil? _ = @internal_hash[:try_to_use_configure_options] end _ end
#¶ ↑
try_to_use_the_file_windows_cookbook
?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 1414 def try_to_use_the_file_windows_cookbook? config?.try_to_use_the_file_windows_cookbook end
#¶ ↑
try_to_use_this_profile
¶ ↑
The .tr() operation in the method body is valid, because we will only store the filenames in a lowercased variant, such as “gcc_minimal.md” rather than “gcc-minimal.md”.
Usage examples:
ry gcc --profile=gcc_lfs_pass1 ry gcc --profile=gcc_minimal
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13888 def try_to_use_this_profile(i) i = i.to_s.dup.tr('-','_') if i.start_with? '-' # This is always a mistake, for the time being, so remove it. i[/^-+/] = '' elsif i.start_with? '_' # This is always a mistake, for the time being, so remove it. i[/^_+/] = '' end case i # ======================================================================= # # === gcc-minimal-but-lots-of-languages # # To use this entry point, try: # # ry gcc trad --profile=gccp1 # ry gcc --ntrad --use-profile-minimal-gcc-but-lots-of-languages # # ======================================================================= # when /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages$/i, /^gcc(-|_)?minimal(-|_)?but(-|_)?lots(-|_)?of(-|_)?languages(-|_)?enabled$/i, /^basic(-|_)?gcc(-|_)?but(-|_)?with(-|_)?lots(-|_)?of(-|_)?languages(-|_)?enabled$/i, /^-?-?basic(-|_)?gcc$/i, /^language(-|_)?rich$/i, 'gccp1', /:?gcc1$/i, :basic_gcc, :basic_gcc_but_with_lots_of_languages_enabled i = 'gcc_minimal_but_lots_of_languages_enabled' if no_cookbook_dataset? set_really_compile_this_program(:gcc) end # ======================================================================= # # === Use the LFS "recommended" version for GLIBC # # Invocation example: # # ry glibc ntrad --dont-symlink --use-glibc1-profile # # ======================================================================= # when /^default(-|_)?lfs(-|_)?glibc$/i, :glibc1 i = 'default_lfs_glibc' # ======================================================================= # # === qt # ======================================================================= # when 'qt' if no_cookbook_dataset? set_really_compile_this_program(:qt) end # ======================================================================= # # === gcc_lfs_pass_1 # ======================================================================= # when /^gcc(_|-)?lfs(_|-)?pass(_|-)?1$/ i = 'gcc_lfs_pass1.md' if no_cookbook_dataset? set_really_compile_this_program(:gcc) end end i = i.dup if i.frozen? # ======================================================================= # # First we will have to try to find the proper profile: # ======================================================================= # i << '.md' unless i.end_with? '.md' target = "#{DIRECTORY_RBT_PROFILES}#{i}" if File.exist? target orev 'Making use of the profile found at this location:' e orev " #{sfile(target)}" e # ===================================================================== # # The file exists, so we can load it. # ===================================================================== # dataset = File.readlines(target).reject {|line| line.strip.start_with? '#' # Get rid of comments. }.join(' ').delete("\n").strip.squeeze(' ') clear_old_configure_options # ===================================================================== # # Store it in the internal hash next: # ===================================================================== # set_configure_options_on_internal_hash(dataset) else opnn; no_file_exists_at(target) orev 'The current behaviour is that RBT will exit upon such an error -' orev 'only existing profiles may be used.' e e "The #{turquoise('available profiles')} #{rev}are:" e show_the_available_profiles_for_configure_options e exit end end
#¶ ↑
uninstall_this_appdir
¶ ↑
Invocation example:
rbt evince --uninstall-appdir
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11088 def uninstall_this_appdir( i = compile_which_program? ) orev "Now trying to uninstall the program called `#{teal(i)}#{rev}`." action(:RemoveProgram, i) end
#¶ ↑
update_all_gems
¶ ↑
This method allows us to update all gems.
To invoke this method from within RBT::Action::SoftwareManager
, try this:
rbt --update-all-gems
Note that the constant ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM is used to automatically update a thus-downloaded gem.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9922 def update_all_gems( also_automatically_install_the_updated_gem = ALSO_AUTOMATICALLY_INSTALL_THE_UPDATED_GEM ) require 'rbt/check_for_updates/check_for_new_release_on_rubygems.rb' orev "Next #{royalblue('updating all local gems')}." RBT.update_all_ruby_gems if also_automatically_install_the_updated_gem array_to_use = RBT.array_these_ruby_gems_were_updated? update_these_rubygems(array_to_use) end end
#¶ ↑
update_binaries_of_this_program
¶ ↑
Invocation examples:
rbt --update-binaries-of=poppler rbt --update-binaries-of=htop rbt --update-binaries-of=xinelib
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12718 def update_binaries_of_this_program(i) these_binaries = RBT.infer_these_binaries_will_be_installed_by(i) # ======================================================================= # # Now that we have obtained the binaries we can add it to our # .yml file. Note that this will always overwrite any other existing # entry, so the first step is to get rid of any old entries, before # adding the new entries. # ======================================================================= # path = find_this_yaml_file(i) string = read_file_in_default_encoding(path) if is_on_roebe? orev 'Creating a backup of the file first.' backup_directory_at = "#{log_dir?}backup/" mkdir(backup_directory_at) unless File.directory?(backup_directory_at) # ===================================================================== # # We will copy the old file, so that we could re-use it if we need to. # ===================================================================== # opnn; copy_file( path, backup_directory_at+File.basename(path), :be_verbose ) end if string.include? ' binaries:' if is_on_roebe? # =================================================================== # # Notify only me on my home system in this case, as most users # won't need this information here really. # =================================================================== # orev "#{tomato('Removing')} #{rev}the old #{slateblue('binaries:')} "\ "#{rev}entries first." new_string = ''.dup state_is_open = false string.split(N).each {|line| if line.include? ' binaries:' state_is_open = true else # =============================================================== # # Toggle it unless the next line starts with a ' - '. # =============================================================== # unless line.start_with?(' - ') state_is_open = false end end unless state_is_open new_string << line << N end } string = new_string # And re-assign it here. end end # ======================================================================= # # Ok, now we can find the proper position and simply add the binaries. # We will first check for a "homepage:" String; then "url2:" and # then "url1:". These are our "anchors". # ======================================================================= # if these_binaries.empty? orev 'Can not store anything because no binaries could be found.' else append_this_string = ' binaries:'+N+' - '+these_binaries.join(N+' - ')+N splitted = string.split(N) array = [] if string.include? ' blfs: ' splitted.each {|line| if line.include? ' blfs: ' array << line+N+append_this_string else array << "#{line}#{N}" end } elsif string.include? 'configure_options: ' splitted.each {|line| if line.include? ' configure_options: ' array << line+N+append_this_string else array << "#{line}#{N}" end } elsif string.include? 'url2: ' splitted.each {|line| if line.include? ' url2: ' array << line+N+append_this_string else array << "#{line}#{N}" end } else orev 'Can not anchor it as no string '\ 'called '+slateblue('blfs:')+ rev+':, '+slateblue('configure_options:') orev 'or '+slateblue('url2:')+rev+' could be found.' end what = array.join.chomp # ===================================================================== # # Next update the old content. # ===================================================================== # into = path orev 'Next overwriting the file `'+sfile(into)+rev+'`.' write_what_into(what, into) if is_on_roebe? # =================================================================== # # Also auto-updating the rbt project. # =================================================================== # orev 'Since we are on roebe we will also auto-update the '\ 'rbt project next.' cd RUBY_SRC_DIR_AT_HOME+'rbt/' require 'roebe/toplevel_methods/rinstall2.rb' Roebe.rinstall2 end end end
#¶ ↑
update_binary_names
¶ ↑
To invoke this method, try:
ry htop update_binary_names ry --update-binary-names
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4923 def update_binary_names( also_exit = false ) also_exit = true if also_exit == :then_exit require 'rbt/registered/registered_binaries.rb' RBT::Cookbooks::RegisteredBinaries.new exit_program if also_exit end
#¶ ↑
update_kde_plasma
¶ ↑
Use this method, as delegation, in order to update the KDE5 plasma components.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5972 def update_kde_plasma unless RBT::Cookbooks.const_defined? :UpdateKdePlasma require 'rbt/check_for_updates/update_kde_plasma.rb' end UpdateKdePlasma.new end
#¶ ↑
update_libraries_of_this_program
¶ ↑
Invocation examples:
rbt --update-libraries-of=poppler rbt --update-libraries-of=htop rbt --update-libraries-of=xinelib
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3853 def update_libraries_of_this_program(i) these_libraries = RBT.infer_these_libraries_will_be_installed_by(i) # ======================================================================= # # Now that we have obtained the libraries we can add it to our # .yml file. Note that this will always overwrite any other existing # entry, so the first step is to get rid of any old entries, before # adding the new entries. # ======================================================================= # path = find_this_yaml_file(i) string = read_file_in_default_encoding(path) if is_on_roebe? orev 'Creating a backup of the file first.' backup_directory_at = log_dir?+'backup/' mkdir(backup_directory_at) unless File.directory?(backup_directory_at) # ===================================================================== # # We will copy the old file, so that we could re-use it if we need to. # ===================================================================== # opnn; copy_file( path, backup_directory_at+File.basename(path), :be_verbose ) end if string.include? ' libraries:' if is_on_roebe? # =================================================================== # # Notify only me on my home system in this case, as most users # won't need this information here really. # =================================================================== # orev "#{tomato('Removing')} #{rev}the old "\ "#{slateblue('libraries:')} #{rev}entries first." new_string = ''.dup state_is_open = false string.split(N).each {|line| if line.include? ' libraries:' state_is_open = true else # =============================================================== # # Toggle it unless the next line starts with a ' - '. # =============================================================== # unless line.start_with?(' - ') state_is_open = false end end unless state_is_open new_string << line << N end } string = new_string # And re-assign it here. end end # ======================================================================= # # Ok, now we can find the proper position and simply add the libraries. # We will first check for a "homepage:" String; then "url2:" and # then "url1:". These are our "anchors". # ======================================================================= # if these_libraries.empty? orev 'Can not store anything because no libraries could be found.' else append_this_string = ' libraries:'+N+' - '+these_libraries.join(N+' - ')+N splitted = string.split(N) array = [] if string.include? ' homepage: ' splitted.each {|line| if line.include? ' homepage: ' array << line+N+append_this_string else array << "#{line}#{N}" end } elsif string.include? 'url2: ' splitted.each {|line| if line.include? ' url2: ' array << line+N+append_this_string else array << "#{line}#{N}" end } elsif string.include? 'url1: ' splitted.each {|line| if line.include? ' url1: ' array << line+N+append_this_string else array << "#{line}#{N}" end } else orev 'Can not anchor it as no string '\ 'called '+slateblue('homepage:')+ rev+':, '+slateblue('url2:') orev 'or '+slateblue('url1:')+rev+' could be found.' end what = array.join.chomp # ===================================================================== # # Next update the old content. # ===================================================================== # into = path orev 'Next overwriting the file `'+sfile(into)+"#{rev}`." write_what_into(what, into) if is_on_roebe? # =================================================================== # # Also auto-updating the rbt project. # =================================================================== # orev "Since we are on roebe we will also auto-update the "\ "rbt project next." cd "#{RUBY_SRC_DIR_AT_HOME}rbt/" require 'roebe/toplevel_methods/rinstall2.rb' Roebe.rinstall2 end end end
#¶ ↑
update_program_path
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6604 def update_program_path cookbook_dataset?.update_program_path end
#¶ ↑
update_these_rubygems
¶ ↑
This method can be used to specifically update the input-array rubygems.
By default we will feed in all registered rubygems, that is - all .gem files that are registered within the RBT
project.
If you want to use another array of programs, pass in the Array of .gem files that you wish to use, into this method.
To invoke this method from the commandline, issue something like this:
rbt --install-all-rubygems
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8581 def update_these_rubygems( array_to_use = RBT.array_all_rubygems ) unless array_to_use.empty? initialize_default_values array_to_use.each {|this_program| orev "Now installing the ruby gem "\ "called #{slateblue(this_program)}#{rev}:" RBT.install_this_rubygem(this_program) } end end
#¶ ↑
upload_to
¶ ↑
This can be used to upload a RBT
file (or any other file) to a remote host, via FTP.
We will make use of the FTP-Paradise project for this.
Usage examples:
ry php upload /tmp/python-3.1.1.recipe ry php upload
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6957 def upload_to( upload_this_file = '/Depot/Temp/xchat.desktop', this_url = 'shevegen.square7.ch', optional_cd_into_this_directory = nil ) case this_url when :default this_url = 'shevegen.square7.ch' end this_recipe = '/home/Temp/xchat.desktop' if this_recipe.nil? ftp = FtpParadise::Connection.new ftp.login_name = 'shevegen' ftp.password = ENV['MY_FTP_PASSWORD'] ftp.url = this_url if optional_cd_into_this_directory ftp.change_directory(optional_cd_into_this_directory) end ftp.upload(upload_this_file) end
#¶ ↑
use_a_random_extracted_directory
¶ ↑
Use a random name for the extracted directory. That way we can compile the same program concurrently, for whatever the reason (such as when you want to use different options for the compile-run as such).
Usage example:
ry htop --random-extracted-dir
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1426 def use_a_random_extracted_directory # ======================================================================= # # First build up the gibberish name. # ======================================================================= # gibberish_name = ''.dup possibilities = ('A'..'Z').to_a+ ('a'..'z').to_a+ ('0'..'9').to_a 10.times { gibberish_name << possibilities.sample } gibberish_name << '_' # And the last one is a separator-character. # ======================================================================= # # Next, create that directory - it must end with the assumed # extracted-directory name: # ======================================================================= # target = rbt_log_directory?+ gibberish_name+ program_name_and_program_version?+ '/' set_extract_to_this_directory_as_specified_by_the_user(target) do_show_the_infobox cd(target) extract_what_to(program_path?, target) {{ append_to_the_commandline: '--strip-components=1' }} cd(target) do_these_logic_steps( :consider_creating_the_appdir, :consider_applying_a_patch, :check_for_sed_action, :run_preinstall_actions, :register_that_this_program_is_currently_being_compiled, :run_pre_configure_steps_if_requested_to_do_so, :decide_whether_to_build_statically, :decide_whether_to_invoke_autogen, :decide_whether_to_invoke_the_autoconf_command, :run_configure_like_stage, :check_for_common_problems_and_common_errors, :consider_symlinking_glib_schema_files_into_the_usr_share_hierarchy, :prepare_symlink_program_instance, :consider_removing_empty_subdirectories, :store_time_snapshot, :consider_reporting_the_time_it_took_to_compile_this_program, :consider_performing_postinstallation_actions, :do_strip_the_compiled_binaries, :consider_creating_and_populating_the_pkgconfig_directory, :register_configure_line_into_configure_database, :consider_symlinking_the_pkgconfig_files, :consider_checking_whether_the_compiled_binaries_are_already_registered, :consider_running_ldconfig ) end
#¶ ↑
use_a_specific_program_version
¶ ↑
Use this method to set to a specific program version.
Currently we will act on –version= and on –use-version=.
To check the regex, look here:
http://rubular.com/r/Wnq91wy8Nx
To test this, try any of the following:
ry gcc --version=4.5.3.tar.xz ry gcc --use-version=4.5.3.tar.xz ry nano --v=2.4.3 ry mesa --use-this-version=mesa-18.2.6
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 5090 def use_a_specific_program_version(i) i = i.dup if compile_which_program?.nil? set_compile_this_program( first_non_hyphened_argument_from_the_commandline_arguments ) initialize_cookbook_dataset end # ======================================================================= # # We don't want file-extensions here. # ======================================================================= # i = remove_file_extension(i) if i.include?('=') splitted = i.split('=') # Get the last part, e. g. "11.3.0". i = splitted.last end # ======================================================================= # # Now we have e. g. input such as "mesa-18.2.6". Or just # "11.3.0". In the latter case we have to modify the input # a bit. # ======================================================================= # if i.include?('-') or i.include?('_') set_program_name( program_information_return_program_name(i) ) set_program_short_name( program_information_return_program_name(i) ) i = program_information_return_version(i).dup else # Else we will just use it directly as version. end # ======================================================================= # # In the past we used a regex, like shown here: # # https://rubular.com/r/Z6LP2FCENzPj # # But we probably don't have to do so since January 2019. # ======================================================================= # set_program_version(i) orev "Setting to the specific version `#{royalblue(i)}#{rev}` "\ "now (for the program #{orange(compile_which_program?)}#{rev})." # ======================================================================= # # Set it in the internal Hash - it will be synced lateron, see the # file sync.rb for this. # ======================================================================= # new_target_prefix = rds( "#{programs_directory?}/#{compile_which_program?.to_s.capitalize}/#{i}/" ) # ======================================================================= # # We will also modify the original program_path. # ======================================================================= # set_user_prefix( new_target_prefix ) if archive_type? unless archive_type?.empty? empty_archive_type end else set_archive_type('.tar.xz') # Assume a default here. end update_program_name set_program_full_name( cookbooks_program_name? ) update_program_path cookbook_dataset?.rebuild_program_path # ======================================================================= # # We must also change url1 in the cookbook dataset. We will apply # a regex for this job - see here: https://rubular.com/r/JZKjmx413E3uXI # ======================================================================= # use_this_regex = /(\d{1,2}\.\d{1,2}\.\d{1,2})/ cookbook_dataset?.set_url1( url1?.gsub( use_this_regex, ProgramInformation.return_version(program_name_and_program_version?) ) ) end
#¶ ↑
use_autoconf?¶ ↑
This method determines as to whether we will use autoconf or whether we will not. By default the value of @internal_hash is nil. If a user modifies this value from the commandline, to either true or false, then we will use that value; otherwise we will use the value defined in the cookbook-dataset for this particular program at hand.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 9484 def use_autoconf? _ = cookbook_use_autoconf? # ← This is the default. unless @internal_hash[:use_autoconf].nil? _ = @internal_hash[:use_autoconf] end return _ end
#¶ ↑
use_autogen?¶ ↑
Query method over as to whether we will use autogen.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 914 def use_autogen? _ = cookbook_dataset_use_autogen? unless @internal_hash[:use_autogen].nil? _ = @internal_hash[:use_autogen] end _ end
#¶ ↑
use_build_directory
?¶ ↑
Query-method over as to whether we will use a build directory or not.
This method will return a Boolean value (true or false).
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14411 def use_build_directory? _ = cookbook_dataset?.use_build_directory? unless @internal_hash[:use_build_directory].nil? _ = @internal_hash[:use_build_directory] end return _ end
#¶ ↑
use_ccache?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13406 def use_ccache? @internal_hash[:use_ccache] end
#¶ ↑
use_maximum_speed_for_compilation?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12691 def use_maximum_speed_for_compilation?( use_maximum_speed_for_compilation = config?.use_maximum_speed_for_compilation ) result = false if use_maximum_speed_for_compilation result = use_maximum_speed_for_compilation end return result end
#¶ ↑
use_porg?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 217 def use_porg? @internal_hash[:use_porg] end
#¶ ↑
use_the_internal_sed_wrapper?¶ ↑
Whether we will use the internal sed wrapper, aka class SedWrapper
.
Since as of February 2018, we will not do so.
You can query this via the commandline like so:
rbt use-the-internal-sed-wrapper?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 784 def use_the_internal_sed_wrapper? @internal_hash[:use_the_internal_sed_wrapper] end
#¶ ↑
use_this_as_programs_dir
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11376 def use_this_as_programs_dir( i = programs_directory? ) i = convert_end_variable # Sanitize it. i << '/' unless i.end_with? '/' orev "Assigning a new Programs directory at: #{simp(i)}" RBT.configuration?.programs_directory = i # ======================================================================= # # Next we also must sync towards the main dataset. # ======================================================================= # cookbook_dataset?.programs_directory = i cookbook_dataset?.sanitize_prefix :appdir_path end
#¶ ↑
use_this_build_directory
?¶ ↑
Ask the dataset for the proper build directory to use.
This may not always be true though.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 13559 def use_this_build_directory? _ = name_for_the_build_directory? # _ = _.path?.to_s if _ # Should be equal to: .path? # ^^^ uncommented as of April 2021. _ end
#¶ ↑
use_this_compile_version
¶ ↑
To try this, do:
ry glib --compile-version=2.16.33_ROEBE
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 1076 def use_this_compile_version(i) compile_as_appdir(nil, :be_silent) set_program_version(i) set_use_this_prefix(static_appdir_prefix?) end
#¶ ↑
use_this_environment_variable
¶ ↑
This method will use a specific environment variable as the new prefix. An example follows next.
To use this, try a command invocation such as:
--use-this-environment-variable=XFCE_PREFIX --use-this-environment-variable=MATE_DESKTOP_PREFIX
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4033 def use_this_environment_variable(i) i = i.to_s.dup # We only want to work on unfrozen Strings. if i.include? '--' i.gsub!(/--/,'') # Only get rid of '--', not '-'. end if i.include? '$' i.delete!('$') end if i.include? '=' i = i.split('=').last # ======================================================================= # # Now we assume this to be an environment variable. # ======================================================================= # if ENV.has_key? i i = ENV[i] end else i = ENV[i] if ENV.has_key? i end # ======================================================================= # # Finally, set the user-prefix next. # ======================================================================= # set_user_prefix(i) end
#¶ ↑
use_this_make_command?¶ ↑
This is most commonly just “make” - but it may also be “ninja” or another build system.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 66 def use_this_make_command?( this_make_command_is_to_be_used_if_set = @internal_hash[:use_this_make_command] ) _ = 'make' # Set this as the default. _ = cookbook_dataset_make_command? if cookbook_dataset_make_command? unless this_make_command_is_to_be_used_if_set.nil? _ = this_make_command_is_to_be_used_if_set unless this_make_command_is_to_be_used_if_set.empty? end return _ # And return it here. end
#¶ ↑
use_traditional_env_path
¶ ↑
This method will “put” /usr/bin/ at the beginning of the path.
It can be invoked from the commandline via:
ry fluxbox --traditional-path
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14128 def use_traditional_env_path prepend_env_path_with('/usr/bin/') end
#¶ ↑
use_which_build_system?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 951 def use_which_build_system? # ======================================================================= # # We default to the cookbook dataset when it comes to a specific # build system. # ======================================================================= # _ = cookbookset_dataset_use_which_build_system? unless @internal_hash[:use_this_build_system].nil? _ = @internal_hash[:use_this_build_system] end return _.to_sym end
#¶ ↑
use_which_compiler?¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 925 def use_which_compiler? config?.use_this_compiler end
#¶ ↑
use_which_prefix?¶ ↑
This will properly handle the prefix in use. It is the general getter-method which should be used whenever we wish to obtain the prefix in use.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 478 def use_which_prefix? _ = prefix_object? # .prefix? # @internal_hash[:prefix] if _.do_we_want_to_use_an_appdir_prefix? _.use_appdir_prefix_for_this_program(compile_which_program?) end return _ end
#¶ ↑
uses_appdir_prefix?¶ ↑
This method will return true if the given input is an AppDir-prefix; and false otherwise.
An AppDir prefix is one that may include the programs directory as a String - for example the string “/Programs/” or “/home/Programs/”.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 95 def uses_appdir_prefix?( i = use_which_prefix?.to_s ) return false if i.nil? case i when 'ntrad', 'appdir', 'appdir_prefix' return true else # ===================================================================== # # We may also have to check on the number, e. g. # (i.to_s =~ /\d+/) # And "has a number". # ===================================================================== # return i.include?(programs_directory?) end end
#¶ ↑
uses_the_meson_build_system?¶ ↑
This method will query whether the meson-build system is used or not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11594 def uses_the_meson_build_system? use_this_build_system?.to_sym == :meson end
#¶ ↑
verbose_do_not_strip_the_binaries
¶ ↑
This will notify the user what we will do, and also toggle the flag that keeps track over as to whether we will run “strip” on the compiled binaries or whether we will not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2036 def verbose_do_not_strip_the_binaries orev "We will not strip the binaries (in the "\ "#{sdir('bin/')} #{rev}subdirectory)." do_not_strip_binaries end
#¶ ↑
verbose_do_not_use_special_environment_flags
¶ ↑
If we do not want to use any ENV variable, this entry point will help us.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 930 def verbose_do_not_use_special_environment_flags orev "We will not use any #{teal('special environmental flag')}"\ "#{rev} (ENV)." path = query_path? ENV.clear set_path(path) # Must re-enable PATH environment as it was. @internal_hash[do_not_use_special_environment_flags] = true end
#¶ ↑
verbose_do_symlink_headers_into_usr_include_hierarchy
¶ ↑
This method can be called from the commandline. As a consequence, we must modify the @internal_hash rather than the dataset stored in the cookbooks.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6264 def verbose_do_symlink_headers_into_usr_include_hierarchy orev 'We will try to symlink '+orange('.h')+' files into '\ 'the '+sdir('/usr/include/')+ "#{rev} hierarchy." @internal_hash[:symlink_headers] = true end
#¶ ↑
verbose_enable_static
¶ ↑
This method can be used to enable static compilation of the program. The user can tap into this method by issuing –static on the commandline, for instance.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 10189 def verbose_enable_static orev "Trying to #{steelblue('compile statically')} "\ "#{rev}(no shared libraries)." do_enable_static_compilation append_static_onto_the_cflags end
#¶ ↑
verbose_find_all_keys_starting_with
¶ ↑
This method will feedback all programs that start with a given (input) letter.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 6767 def verbose_find_all_keys_starting_with(i) orev "Finding all matches starting with the letter `"\ "#{sfancy(i.delete('*'))}#{rev}` now:" e find_all_keys_starting_with(i) e end
#¶ ↑
verbose_generate_the_pdf_tutorial
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11422 def verbose_generate_the_pdf_tutorial orev 'We will generate a .pdf file next which will contain the' orev 'instructions on how to use the RBT project.' RBT.generate_pdf_tutorial end
#¶ ↑
verbose_md5_checking
¶ ↑
Use this method to do md5-checksum checking.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 944 def verbose_md5_checking( _ = program_path? ) opne sfancy('The md5sum of `')+simp(program_name?)+ sfancy('` in `')+sfile(_)+sfancy('` is:') orev simp(' '+return_md5(_)) # This method is defined here. end
#¶ ↑
verbose_purge_fhs_binaries_of_this_program
¶ ↑
This method will notify the user as to what will be done, then delegate towards purge_fhs_binaries_of_this_program
().
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 11177 def verbose_purge_fhs_binaries_of_this_program(i) i = [i].flatten.compact i.each {|entry| entry.downcase! orev "Now purging all #{mediumspringgreen('binaries')} #{rev}of "\ "the program `#{sfancy(entry)}#{rev}`, at the #{sdir('/usr/bin/')}"\ " #{rev}hierarchy." purge_fhs_binaries_of_this_program(entry) } end
#¶ ↑
verbose_purge_fhs_libraries_of_this_program
¶ ↑
This method will notify the user as to what will be done, then delegate towards purge_fhs_libraries_of_this_program
().
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 4572 def verbose_purge_fhs_libraries_of_this_program(i) i = RBT.return_alias_program_name_for(i) orev "Now purging all #{mediumspringgreen('lib/')} #{rev}programs "\ "of `#{sfancy(i)}#{rev}` at the #{sdir('/usr/lib/')}"\ " #{rev}hierarchy." purge_fhs_libraries_of_this_program(i) end
#¶ ↑
verbose_query_whether_this_program_can_be_compiled_statically
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 12639 def verbose_query_whether_this_program_can_be_compiled_statically( this_program = compile_which_program? ) _ = cookbook_dataset? orev 'Can the program '+sfancy(this_program)+rev+ ' be compiled statically: '+ lightgreen(verbose_truth(_.can_be_compiled_statically?)) end
#¶ ↑
verbose_query_whether_we_will_use_the_internal_sed_wrapper
¶ ↑
Query whether the internal sed-wrapper will be used.
Invocation example:
rbt --use-the-internal-sed-wrapper?
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 3582 def verbose_query_whether_we_will_use_the_internal_sed_wrapper( shall_we_exit = :do_not_exit ) if use_the_internal_sed_wrapper? orev 'Yes, the internal sed-wrapper will be used ('+ slateblue('class SedWrapper')+ rev+').' else orev 'No, the internal sed-wrapper will '+ orange('NOT')+ rev+' be used (class SedWrapper).' end case shall_we_exit when :and_exit, :and_then_exit exit_program end end
#¶ ↑
verbose_report_will_we_use_autogen
¶ ↑
This method will output, in a verbose manner, whether we will use autogen or whether we will not.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2835 def verbose_report_will_we_use_autogen( i = compile_which_program? ) if cookbook_dataset?.nil? initialize_dataset_for(i) end will_we_use_autogen = use_autogen? if will_we_use_autogen.nil? and cookbook_dataset_use_autogen? will_we_use_autogen = true end if will_we_use_autogen orev "Yes, autogen will be used for the "\ "program `#{sfancy(i)}#{rev}`." else orev "No, autogen will #{swarn('NOT')} #{rev}be used "\ "for the program #{sfancy(i)}#{rev}." end end
#¶ ↑
waf_file_exists?¶ ↑
This boolean query method will determine whether a waf-file exists.
The input-argument is used primarily so that we can use another target-directory for where the ‘waf’ file may exist.
The method resides in this file here because waf ultimately depends on python.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 8849 def waf_file_exists?( this_file = 'waf' ) File.exist? this_file end
#¶ ↑
warning_argument_was_not_found
¶ ↑
Call this method when an argument was not found.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 422 def warning_argument_was_not_found(i) print rev cliner opnn ewarn "Attention: The specified commandline argument" e e " #{sfancy(i.to_s)}" e opnn ewarn 'was NOT found.' opnn ewarn 'Have a look at the spelling. Should this '\ 'commandline argument exist?' orev N opnn ewarn "If you are convinced that this may be a bug or a "\ "missing feature that" opnn ewarn 'should be supported by RBT, feel free to' opnn ewarn 'report this to the lead developer(s).' opne report_to_developers e cliner # Finish here, so we display a nice coloured line still. # stop_on_error exit_program end
#¶ ↑
we_can_not_continue
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/logic_related_code.rb, line 467 def we_can_not_continue( be_verbose = be_verbose? ) case be_verbose when :be_quiet be_verbose = false end if be_verbose orev "The RBT scripts can not continue." end set_can_we_continue(false) end
#¶ ↑
we_tried_to_compile_this_program_n_times¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2909 def we_tried_to_compile_this_program_n_times? @internal_hash[:we_tried_to_compile_this_program_n_times] end
#¶ ↑
we_will_not_try_to_determine_which_programs_have_to_be_installed
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 2201 def we_will_not_try_to_determine_which_programs_have_to_be_installed @internal_hash[:try_to_determine_which_programs_have_to_be_installed] = false end
#¶ ↑
will_be_extracted_towards?¶ ↑
This method will tell us the full path of the extracted directory for the program at hand.
A trailing ‘/’ is required for the result of this method.
Returns: a String.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 517 def will_be_extracted_towards? "#{log_directory?}#{program_name_and_program_version?}/" end
#¶ ↑
work_on_which_program?¶ ↑
This method is a bit different to the method called install_which_programs? in that it will always return the first element of the Array, whereas the other method mentioned will yield an Array.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/query_related_methods.rb, line 999 def work_on_which_program? ::RBT.install_which_programs?.first end
Private Instance Methods
#¶ ↑
run_premake_make_then_make_install
¶ ↑
Issue “premake commands”, then “make” and then “make install” commands.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14567 def run_premake_make_then_make_install if run_make? run_premake_commands run_make_then_make_install end end