Class: RBT::Action::Cookbooks::SanitizeCookbook

Inherits:
RBT::Action show all
Defined in:
lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb,
lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb

Overview

RBT::Action::Cookbooks::SanitizeCookbook

Constant Summary collapse

HOW_TO_INVOKE_THE_PROGRAM =
#

HOW_TO_INVOKE_THE_PROGRAM

#
'scookie'
DEFAULT_PROGRAM_VERSION =
#

DEFAULT_PROGRAM_VERSION

#
'1.0.0'
REPLACE_PLUS_WITH_LONG_NAME =
#

REPLACE_PLUS_WITH_LONG_NAME

If this constant is true then we will replace ‘+’ with ‘plus’ if they are part of a program name.

#
false
ARRAY_ARRAY_ENTRIES =
#

ARRAY_ARRAY_ENTRIES (array tag)

These entries should be kept as an Array at all time. They will all allow us to run .each on them.

In “pure” ruby code, these would all be set to e. g. “xyz = []”, so really just an Array of Arrays.

#
%w(
  blfs
  binaries
  gir_files
  headers
  installation_steps
  libraries
  m4_files
  pkgconfig_files
  postinstall
  pre_configure_steps
  pre_make_commands
  pre_make_install_sed
  required_deps_on
  tags
)
ARRAY_NIL_ENTRIES =
#

ARRAY_NIL_ENTRIES (nil tag)

All entries that are nil by default.

These are entries where a default value is not absolutely necessary.

#
%w(
  short_description
  set_env_variables
  homepage
  meson_configure_options
  cmake_configure_options
  svn_url
  git_url
  program_name_and_program_version
  use_this_build_system
)
ARRAY_TRUE_VALUES =
#

ARRAY_TRUE_VALUES (true tag)

Only a few variables are true for now, by default - prefix, run_ldconfig and has_to_be_compiled at the very least.

#
%w(
  is_an_active_project
  has_to_be_compiled
  may_we_modify_the_configure_options
  prefix
  run_configure
  run_ldconfig
  run_make
)
ARRAY_FALSE_VALUES =
#

ARRAY_FALSE_VALUES (false tag)

This constant collects all values that must be explicitely set to false on startup.

#
%w(
  apply_patch
  autosymlink_lib64
  build_static
  can_be_compiled_statically
  copy_source
  do_not_symlink
  do_not_download
  echo_yes
  enable_shared
  enable_static
  ignore_errors
  keep_extracted
  localstatedir
  mirror
  modify_the_makefile
  override
  run_make_check
  sed
  symlink_glib_schema
  symlink_headers
  symlink_pkgconfig_files
  use_autoconf
  use_autogen
  use_build_directory
  use_glib_schema
  use_this_make_install_command
)
ARRAY_MAIN_PROGRAM_ENTRIES =
#

ARRAY_MAIN_PROGRAM_ENTRIES

We need the following 8 entries defined here, so that we do not forget them lateron.

These are the only entries we care about and describe the most important components of a program.

#
%w(
  archive_type
  base_dir
  program_full_name
  program_name
  program_path
  program_version
  real_short_name
  short_name
)
ARRAY_EMPTY_VALUES =
#

ARRAY_EMPTY_VALUES

All values that will be initialized by default to an empty string, aka ”, have to be registered here.

#
%w(
  program_path
  program_full_name
  configure_options
  configure_base_dir
  configure_command_to_use
  extract_to
  flatpak_url
  licence
  manual_steps
  md5sum
  optional_start_message
  parameters_to_make
  preinstall
  program_compile_name
  program_version
  sha256
  use_this_build_directory
  use_this_make_command
  url1
)

Constants inherited from LeanPrototype

LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LeanPrototype

#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_arguments, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #directory_expanded_cookbooks?, #disable_colours, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_meson_installed?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #is_this_program_included?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #namespace?, #no_directory_exists_at, #no_directory_was_found_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_symlink, #remove_the_first_commandline_argument, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #return_all_archives_from_this_directory, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_information, #return_program_name_for_gobolinux_systems, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no

Constructor Details

#initialize(i = ARGV, run_already = true, &block) ⇒ SanitizeCookbook

#

initialize

#


247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 247

def initialize(
    i           = ARGV,
    run_already = true,
    &block
  )
  reset
  case i
  # ======================================================================= #
  # === :do_not_run_yet
  # ======================================================================= #
  when :do_not_run_yet
    run_already = false
    i = []
  end
  set_commandline_arguments(i)
  # ======================================================================= #
  # === Handle blocks next
  # ======================================================================= #
  if block_given?
    yielded = yield
    # ===================================================================== #
    # === Handle Symbols first
    # ===================================================================== #
    if yielded.is_a? Symbol
      case yielded
      # =================================================================== #
      # === :do_not_instantiate_a_new_raw_cookbook
      # =================================================================== #
      when :do_not_instantiate_a_new_raw_cookbook
        set_simple
        do_not_instantiate_a_new_raw_cookbook
      # =================================================================== #
      # === :do_not_run_yet
      # =================================================================== #
      when :do_not_run_yet,
           :dont_run_yet
        run_already = false
      # =================================================================== #
      # === :be_quiet_and_bypass_menu
      # =================================================================== #
      when :be_quiet_and_bypass_menu,
           :be_quiet
        be_quiet
      # =================================================================== #
      # === fast_and_be_verbose
      # =================================================================== #
      when :fast_and_be_verbose
        be_verbose
        set_simple_or_complex(:complex)
      # =================================================================== #
      # === :be_fast_and_be_quiet
      # =================================================================== #
      when :be_fast_and_be_quiet,
           :complex,
           :use_expanded_dataset,
           :expanded,
           :default
        set_be_quiet
        set_simple_or_complex(:complex)
      # =================================================================== #
      # === :be_fast
      # =================================================================== #
      when :be_fast,
           :fast
        set_simple_or_complex(:complex)
      # =================================================================== #
      # === :simple
      #
      # Note that :return_flat_datastructure is an alias, since as of
      # April 2021.
      # =================================================================== #
      when :simple,
           :simple_cookbook,
           :return_flat_datastructure
        set_simple_or_complex(:simple)
      else
        # ================================================================= #
        # === Handle unknown Symbols
        #
        # This may be disabled one day - not sure yet. For now it will
        # remain, though.
        # ================================================================= #
        if yielded.is_a? Symbol
          orev "Unknown symbol called "\
               "#{sfancy(':')}#{sfancy(yielded.to_s)} #{rev}passed."
          orev 'Showing the very important '+tomato('caller()')+
               "#{rev} backtrace next:"
          e
          cliner; pp caller(); cliner
          e
        end
        set_simple_or_complex(yielded)
      end
    # ===================================================================== #
    # === Handle Hashes next
    # ===================================================================== #
    elsif yielded.is_a? Hash
      # =================================================================== #
      # === :make_use_of_aliases_kept_in_the_file_cookbook_aliases
      # =================================================================== #
      if yielded.has_key? :make_use_of_aliases_kept_in_the_file_cookbook_aliases
        _ = yielded[:make_use_of_aliases_kept_in_the_file_cookbook_aliases]
        set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(_)
      end
      # =================================================================== #
      # === :simple_or_complex
      # =================================================================== #
      if yielded.has_key? :simple_or_complex
        set_simple_or_complex(
          yielded[:simple_or_complex]
        )
      end
    end
  end
  run if run_already
end

Class Method Details

.[](i = ARGV) ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook[]

#


6274
6275
6276
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6274

def self.[](i = ARGV)
  new(i)
end

.do_not_honour_threshold_valueObject

#

RBT::Action::Cookbooks::SanitizeCookbook.do_not_honour_threshold_value

#


2702
2703
2704
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2702

def self.do_not_honour_threshold_value
  @honour_threshold_value = false
end

.does_include?(this_program, optional_value = :default) ⇒ Boolean

#

RBT::Action::Cookbooks::SanitizeCookbook.does_include?

#

Returns:

  • (Boolean)


6149
6150
6151
6152
6153
6154
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6149

def self.does_include?(
    this_program,
    optional_value = :default
  )
  RBT.does_include?(this_program, optional_value)
end

.e(i = '') ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook.e

#


4226
4227
4228
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4226

def self.e(i = '')
  RBT.e(i)
end

.feedback_all_available_formats(i = ::RBT.return_file_specification_of_registered_cookbook_entries) ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook.feedback_all_available_formats

To invoke this method from the commandline, try:

rbt --feedback_all_available_formats
#


4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4459

def self.feedback_all_available_formats(
    i = ::RBT.return_file_specification_of_registered_cookbook_entries
  )
  dataset = YAML.load_file(i)
  dataset.each_pair {|key, value|
    if Object.const_defined? :Colours
      separator = ::RBT.slateblue(': ')
    else
      separator = simp(': ')
    end
    ::RBT.e(
      key.ljust(30)+separator+value.rjust(10)
    )
  }
end

.feedback_format_specification_of(i = 'extract_to') ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook.feedback_format_specification_of

This is the method that will tell us whether an entry in the cookbooks settings is an Array or a String or a Hash or a Boolean value.

Usage example:

RBT::Action::Cookbooks::SanitizeCookbook.feedback_format_specification_of :headers

From the commandline:

rbt --format-specification-of=extract_to
rbt --format-specification-of=extract_to
#


6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6189

def self.feedback_format_specification_of(
    i = 'extract_to'
  )
  i = i.to_s unless i.is_a? String # We need a String here.
  # ======================================================================= #
  # First, load the YAML file that has our dataset.
  # ======================================================================= #
  dataset = YAML.load_file(
    ::RBT.return_file_specification_of_registered_cookbook_entries # We need this method.
  )
  if dataset.has_key? i
    format_type = dataset[i]
    RBT.opnn; e "The format type for the key `#{Colours.simp(i)}` is:"
    e
    e "  #{Colours.sfancy(format_type)}"
    e
  else
    RBT.opnn; e "No format called `#{Colours.simp(i)}` is known."
  end
end

.honour_threshold_value?Boolean

#

RBT::Action::Cookbooks::SanitizeCookbook.honour_threshold_value?

#

Returns:

  • (Boolean)


2709
2710
2711
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2709

def self.honour_threshold_value?
  @honour_threshold_value
end

.main_program_entries?Boolean

#

RBT::Action::Cookbooks::SanitizeCookbook.main_program_entries?

#

Returns:

  • (Boolean)


6159
6160
6161
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6159

def self.main_program_entries?
  ARRAY_MAIN_PROGRAM_ENTRIES
end

.opnn(i = NAMESPACE) ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook.opnn

#


6166
6167
6168
6169
6170
6171
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6166

def self.opnn(i = NAMESPACE)
  if i.is_a? String
    i = { namespace: i }
  end
  Opn.opn(i)
end

.return_dataset(of_this_program = :htop) ⇒ Object

#

RBT::Action::Cookbooks::SanitizeCookbook.return_dataset

This method will return the whole dataset for a given program at hand (if it is registered). You can then use this dataset in other programs.

As input it is preferred to provide a symbol, such as :htop or :lua; a String should work fine as well, though.

Returns: a Hash

Usage examples:

htop_dataset = RBT::Action::Cookbooks::SanitizeCookbook.return_dataset(:htop)
ruby_dataset = RBT::Action::Cookbooks::SanitizeCookbook.return_dataset(:ruby)
#


6138
6139
6140
6141
6142
6143
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6138

def self.return_dataset(
    of_this_program = :htop
  )
  dataset = RBT::Action::Cookbooks::SanitizeCookbook.new(of_this_program).yaml_dataset?
  return dataset
end

Instance Method Details

#add_the_array_entries_to_the_dataset_variable(i = ARRAY_ARRAY_ENTRIES) ⇒ Object

#

add_the_array_entries_to_the_dataset_variable (array tag)

This method will ensure that all specified Array entries are part of the internal yaml dataset when a new class is instantiated.

#


3311
3312
3313
3314
3315
3316
3317
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3311

def add_the_array_entries_to_the_dataset_variable(
    i = ARRAY_ARRAY_ENTRIES
  )
  i.each {|entry|
    set(entry.to_sym, [])
  }
end

#add_the_empty_entries_to_the_dataset_variable(i = ARRAY_EMPTY_VALUES) ⇒ Object

#

add_the_empty_entries_to_the_dataset_variable (empty tag)

We must ensure that the empty values are also properly set to “” on startup, in a mandatory fashion.

#


3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3294

def add_the_empty_entries_to_the_dataset_variable(
    i = ARRAY_EMPTY_VALUES
  )
  i.each {|entry|
    # ===================================================================== #
    # Store the keys as a Symbol.
    # ===================================================================== #
    dataset?[entry.to_sym] = ''
  }
end

#add_the_false_entries_to_the_dataset_variable(i = ARRAY_FALSE_VALUES) ⇒ Object

#

add_the_false_entries_to_the_dataset_variable (false tag)

Here we will set all false values into our main dataset.

We do this only if we do not yet have such a value in our dataset though.

#


3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3241

def add_the_false_entries_to_the_dataset_variable(i = ARRAY_FALSE_VALUES)
  # ======================================================================= #
  # Set the false values to false next.
  # ======================================================================= #
  i.each {|this_false_value|
    if has_key? this_false_value
      # =================================================================== #
      # If that key already exists in the dataset then we have to ensure
      # that it will be a boolean value.
      # =================================================================== #
      sanitize_boolean_value(this_false_value)
    else
      set(this_false_value, false)
    end
  }
end

#add_the_nil_entries_to_the_dataset_variable(i = ARRAY_NIL_ENTRIES) ⇒ Object

#

add_the_nil_entries_to_the_dataset_variable (nil tag)

This will set entries, such as “homepage”, to nil initially.

#


3324
3325
3326
3327
3328
3329
3330
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3324

def add_the_nil_entries_to_the_dataset_variable(
    i = ARRAY_NIL_ENTRIES
  )
  i.each {|entry|
    dataset?[entry.to_sym] = nil
  }
end

#add_the_remaining_entries_to_the_dataset_variableObject

#

add_the_remaining_entries_to_the_dataset_variable

This will add the remaining entries into the main dataset.

These entries will default to an empty String. If you need another default for any of the missing entry then you should modify the corresponding value in the file ‘constants.rb’ and specify to which group it belongs.

#


3227
3228
3229
3230
3231
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3227

def add_the_remaining_entries_to_the_dataset_variable
  registered_cookbook_entries?.each {|key|
    dataset?[key.to_sym] unless has_key? key.to_sym
  }
end

#add_the_true_entries_to_the_dataset_variable(i = ARRAY_TRUE_VALUES) ⇒ Object

#

add_the_true_entries_to_the_dataset_variable

#


3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3261

def add_the_true_entries_to_the_dataset_variable(
    i = ARRAY_TRUE_VALUES
  )
  # ======================================================================= #
  # Set the false values to false next.
  # ======================================================================= #
  i.each {|this_false_value|
    if has_key? this_false_value
      # =================================================================== #
      # If that key already exists in the dataset then we have to ensure
      # that it will be a boolean value.
      # =================================================================== #
      sanitize_then_set_boolean_value(this_false_value)
    else
      set(this_false_value, true)
    end
  }
end

#append_this_to_the_configure_options(i = '') ⇒ Object

#

append_this_to_the_configure_options

This method can be used to append something to the (stored) configure options in use.

#


3664
3665
3666
3667
3668
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3664

def append_this_to_the_configure_options(i = '')
  _ = configure_options?.to_s
  _ << " #{i}"
  set_configure_options(_)
end

#append_to_array_show_these_entries(i) ⇒ Object

#

append_to_array_show_these_entries

Use this method when you wish to append to the main Array keeping track of which entries are to be shown.

#


2764
2765
2766
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2764

def append_to_array_show_these_entries(i)
  array_show_these_entries? << i
end

#apply_patch?Boolean

#

apply_patch?

Query-method as to whether we shall apply a patch or whether we shall not.

#

Returns:

  • (Boolean)


1511
1512
1513
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1511

def apply_patch?
  obtain(__method__.to_s.delete('?').to_sym)
end

#archive_size?Boolean Also known as: size, size?, program_size, program_size?, archive_size, file_size?, file_size

#

archive_size?

This method keeps track of the size of the program tarball in question.

For this to work, we should have initialized the program size at 0.

#

Returns:

  • (Boolean)


5748
5749
5750
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5748

def archive_size?
  obtain(__method__.to_s.delete('?').to_sym)
end

#archive_type?Boolean Also known as: archive?, archive_type, archive_name?

#

archive_type?

Simply query the archive type here. The archive_type is something such as “.tar.gz” or “.tar.bz2”.

#

Returns:

  • (Boolean)


1439
1440
1441
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1439

def archive_type?
  obtain(__method__.to_s.delete('?').to_sym)
end

#array_show_these_entries?Boolean

#

array_show_these_entries?

#

Returns:

  • (Boolean)


2754
2755
2756
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2754

def array_show_these_entries?
  @internal_hash[:array_show_these_entries]
end

#assemble_program_full_name(i = return_default_program_full_name) ⇒ Object Also known as: reassemble_program_full_name, determine_program_full_name

#

assemble_program_full_name

This method will build-up a valid “program_full_name” setting.

In order to achieve this, it will make use of the method called return_default_program_full_name, which itself is a combination of program_name?+archive_type?.

#


4027
4028
4029
4030
4031
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4027

def assemble_program_full_name(
    i = return_default_program_full_name
  )
  set_program_full_name(i)
end

#assemble_the_default_program_name_and_program_version(i = :default) ⇒ Object Also known as: assemble_program_name, update_program_name, attach_program_name_and_program_version, assemble_default_program_name

#

assemble_the_default_program_name_and_program_version

This method will assemble the program_name (6) variable, which is derived directly from:

program_name? and '-' and program_version?

For example it could look like this:

"gnome-mahjongg-5.08"
#


3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3093

def assemble_the_default_program_name_and_program_version(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = program_name?+
        token?+
        program_version?
  end
  set_program_name_and_program_version(i)
end

#assume_default_archive_type(i = DEFAULT_ARCHIVE_TYPE) ⇒ Object

#

assume_default_archive_type

#


3012
3013
3014
3015
3016
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3012

def assume_default_archive_type(
    i = DEFAULT_ARCHIVE_TYPE
  )
  set_archive_type(i)
end
#
#

Returns:

  • (Boolean)


5203
5204
5205
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5203

def autosymlink_lib64?
  obtain __method__.to_s.delete('?').to_sym
end

#base_dir?Boolean Also known as: base_dir

#

base_dir?

This is entry (5), a simple query method. It will give us back the base directory of our program in question, such as ‘/home/x/src/htop/’.

#

Returns:

  • (Boolean)


1480
1481
1482
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1480

def base_dir?
  obtain(__method__.to_s.delete('?').to_sym)
end

#be_complexObject

#

be_complex

#


2973
2974
2975
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2973

def be_complex
  @internal_hash[:simple_or_complex] = :complex
end

#binaries?Boolean Also known as: binaries, bin?

#

binaries?

#

Returns:

  • (Boolean)


1455
1456
1457
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1455

def binaries?
  obtain(__method__.to_s.delete('?').to_sym)
end

#blfs?Boolean

#

blfs? (blfs tag)

The “Beyond linux from scratch” variable will be returned here, should it exist.

#

Returns:

  • (Boolean)


5626
5627
5628
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5626

def blfs?
  obtain __method__.to_s.delete('?').to_sym
end

#build_static?Boolean Also known as: build_static

#

build_static?

#

Returns:

  • (Boolean)


1248
1249
1250
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1248

def build_static?
  obtain(__method__.to_s.delete('?').to_sym)
end

#calculate_archive_size(i = program_path? ) ⇒ Object

#

calculate_archive_size

This method can be used to determine the size of the target archive in question. The corresponding entry will be set in the main Hash, called ‘archive_size’.

In order for this to work, we need the content of program_path defined before, however. Whenever we set program_path, we can re-calculate the filesize anew.

#


4425
4426
4427
4428
4429
4430
4431
4432
4433
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4425

def calculate_archive_size(
    i = program_path?
  )
  set_archive_size(0) # First set it to 0 always, as default.
  if found_result? and File.exist?(i.to_s)
    size = File.size?(i.to_s)
    set_archive_size(size)
  end
end

#can_be_compiled_statically?Boolean

#

can_be_compiled_statically?

#

Returns:

  • (Boolean)


5538
5539
5540
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5538

def can_be_compiled_statically?
  obtain __method__.to_s.delete('?').to_sym
end

#check_for_binary_names?Boolean

#

check_for_binary_names?

#

Returns:

  • (Boolean)


4886
4887
4888
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4886

def check_for_binary_names?
  CHECK_FOR_BINARY_NAMES
end

#check_for_library_names?Boolean

#

check_for_library_names?

#

Returns:

  • (Boolean)


4904
4905
4906
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4904

def check_for_library_names?
  CHECK_FOR_LIBRARY_NAMES
end

#check_for_outdated_entries(_ = dataset? ) ⇒ Object

#

check_for_outdated_entries

This method will check for outdated/obsolete entries and notify the user about this. Tha way we can get rid of such obsolete entries.

#


3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3460

def check_for_outdated_entries(
    _ = dataset?
  )
  use_this_key = 'github'
  if !_.has_key?(use_this_key) and _.has_key?(use_this_key.to_sym)
    use_this_key = use_this_key.to_sym
  end
  if _.has_key?(use_this_key) and
    !_[use_this_key].nil? and
    !_[use_this_key].empty?
    opne crimson('This file contains an obsolete entry called ')+
         royalblue('github')
    opne crimson('This entry could be replaced with the '\
         'entry called ')+
         steelblue('git_url')+
         crimson('.')
    opne crimson('It should be possible to get rid of this entry in ')+
         crimson('the yaml file ')
    e
    e "  #{sfile(yaml_file?)}"
    e
  end
end

#chop_off_revision_numberObject

#

chop_off_revision_number

This method will check if a program version ends with a String such as “-r8”. If so then this part will be chopped off.

Usually this trailing part denotes an internal revision rather than an external program version.

#


3989
3990
3991
3992
3993
3994
3995
3996
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3989

def chop_off_revision_number
  _ = program_version?
  use_this_regex = /(-r\d{1,2})$/
  if _ =~ use_this_regex
    _.sub!(use_this_regex,'')
    set_program_version(_)
  end
end

#clear_configure_optionsObject Also known as: clear

#

clear_configure_options

#


3128
3129
3130
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3128

def clear_configure_options
  set_configure_options nil
end

#clear_yaml_datasetObject

#

clear_yaml_dataset

#


2980
2981
2982
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2980

def clear_yaml_dataset
  cookbook_dataset?.clear
end

#cmake_configure_options?Boolean Also known as: cmake_configure_options, cmake_options?

#

cmake_configure_options?

#

Returns:

  • (Boolean)


1539
1540
1541
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1539

def cmake_configure_options?
  obtain(__method__.to_s.delete('?').to_sym)
end

#compiler_to_use?Boolean

#

compiler_to_use?

#

Returns:

  • (Boolean)


5545
5546
5547
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5545

def compiler_to_use?
  obtain __method__.to_s.delete('?').to_sym
end

#completely_infer_the_program_name_and_the_program_version_from_this_input(i) ⇒ Object

#

completely_infer_the_program_name_and_the_program_version_from_this_input

This will honour macros in program_name_and_program_version.

#


3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3593

def completely_infer_the_program_name_and_the_program_version_from_this_input(i)
  set_program_name_and_program_version(
    return_sanitized_program_name_and_program_version(
      i
    )
  )
  set_program_name(
    ProgramInformation.return_name(program_name_and_program_version?).dup
  )
  set_program_version(
    ProgramInformation.return_version(program_name_and_program_version?).dup
  )
end

#complex_mode?Boolean

#

complex_mode?

#

Returns:

  • (Boolean)


4507
4508
4509
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4507

def complex_mode?
  @internal_hash[:simple_or_complex] == :complex
end

#configure_base_dir?Boolean Also known as: configure_base_directory?

#

configure_base_dir?

#

Returns:

  • (Boolean)


1263
1264
1265
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1263

def configure_base_dir?
  obtain(__method__.to_s.delete('?').to_sym)
end

#configure_command_to_use?Boolean Also known as: configure_command, configure_command?

#

configure_command_to_use?

The specific configure command that we will use.

#

Returns:

  • (Boolean)


1272
1273
1274
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1272

def configure_command_to_use?
  obtain(__method__.to_s.delete('?').to_sym)
end

#configure_options?Boolean Also known as: configuration_options, configuration_options?, configure_options

#

configure_options?

Convenience method to query the configuration options available.

#

Returns:

  • (Boolean)


5228
5229
5230
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5228

def configure_options?
  obtain __method__.to_s.delete('?').to_sym
end

#copy_the_data_from_the_raw_cookbook_onto_the_main_hashObject

#

copy_the_data_from_the_raw_cookbook_onto_the_main_hash

#


2670
2671
2672
2673
2674
2675
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2670

def copy_the_data_from_the_raw_cookbook_onto_the_main_hash
  hash = dataset?
  raw_cookbook_dataset?.each_pair {|key, value|
    hash[key] = value # Only copy, do not modify anything.
  }
end

#dataset_of_the_program?Boolean Also known as: dataset?, dataset, internal_dataset?, hash?, return_hash, main_dataset?, yaml_dataset?, return_dataset, cookbook_dataset?, cookbook?

#

dataset_of_the_program?

Note that specifically the method hash? should return the FULL, sanitized dataset, because other programs may rely on that dataset, and because this information may then easily be dumped into a local .yml file as well.

#

Returns:

  • (Boolean)


4490
4491
4492
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4490

def dataset_of_the_program?
  @internal_hash[:dataset]
end

#debug?Boolean

#

debug?

#

Returns:

  • (Boolean)


5456
5457
5458
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5456

def debug?
  @internal_hash[:debug]
end

#decompose_program_name(i = program_name? ) ⇒ Object

#

decompose_program_name

This method will set short_name and program_version, by making use of the content stored in program_name? by default.

#


3898
3899
3900
3901
3902
3903
3904
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3898

def decompose_program_name(
    i = program_name?
  )
  _ = ::ProgramInformation.return_short_name_and_program_version(i)
  set_short_name(_.short_name?, :propagate_towards_real_short_name)
  set_program_version(_.program_version?)
end

#deduce_everything_from_the_program_name_and_program_version_downwards(i = program_name_and_program_version? ) ⇒ Object

#

deduce_everything_from_the_program_name_and_program_version_downwards

This method will deduce - and set - everything starting from the program_name_and_program_version entry downwards.

It will NOT set other aggregate methods, such as set_program_path(). The reason for this is that this method here shall work downwards what it can deduce on its own, without depending on other methods.

#


3517
3518
3519
3520
3521
3522
3523
3524
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3517

def deduce_everything_from_the_program_name_and_program_version_downwards(
    i = program_name_and_program_version?
  )
  program_information = ProgramInformation.new(i)
  set_short_name(program_information.short_name?)
  set_program_name(program_information.program_name?)
  set_program_version(program_information.program_version?)
end

#description?(wrap_result = wrap_result? ) ⇒ Boolean Also known as: desc?, description_of?

#

description? (description tag)

The description value of a program will be returned via this method.

#

Returns:

  • (Boolean)


1374
1375
1376
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1374

def description?
  obtain(__method__.to_s.delete('?').to_sym)
end

#determine_all_relevant_values_for_the_dataset_variableObject

#

determine_all_relevant_values_for_the_dataset_variable

This method will copy some important values from the raw-cookbook to the main @dataset variable.

#


6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6061

def determine_all_relevant_values_for_the_dataset_variable
  # ======================================================================= #
  # Some variables are still missing, such as program_path. The
  # specification does not include these, but we need them for
  # class RBT::Compile, so add these next.
  #
  # Perhaps in the future we may also add these variables, but for
  # the time being, these variables have to be defined next.
  # ======================================================================= #
  dataset?[:program_path] = base_dir?.to_s+
                            program_name_and_program_version?.to_s+
                            archive_type?.to_s
  if dataset?[:program_path].nil?
    dataset?[:program_path] = raw_cookbook?.program_path?
  end
  if dataset?[:program_version].nil?
    dataset?[:program_version]   = return_program_version_from_the_raw_cookbook
  end
  if dataset?[:program_full_name].nil?
    dataset?[:program_full_name] = return_default_program_full_name
  end
  if dataset?[:program_name].nil?
    dataset?[:program_name]      = return_program_name_from_the_raw_cookbook
  end
  if dataset?[:program_name_and_program_version].nil?
    dataset?[:program_name_and_program_version] = raw_cookbook?.program_name_and_program_version?
  end
  if dataset?[:keep_extracted].nil?
    set_keep_extracted(raw_cookbook?.keep_extracted?)
  end
end

#determine_everythingObject

#

determine_everything (determine tag)

This method will essentially determine all the other dependent variables, and set them onto the main (internal) dataset - the cookbook dataset.

#


3677
3678
3679
3680
3681
3682
3683
3684
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3677

def determine_everything
  determine_the_program_name_and_the_program_version_from_url1_while_respecting_existing_values
  determine_the_base_dir
  determine_the_archive_type
  determine_the_full_program_name
  determine_the_full_program_path
  determine_the_file_size # ← can happen only after the program path was determined.
end

#determine_program_name_and_program_versionObject

#

determine_program_name_and_program_version

This method will automatically determine the program name and the program version, based on two other settings in the main cookbook-dataset. This means that this method will ONLY succeed if these two settings have been determined PRIOR to invoking this method here.

#


3448
3449
3450
3451
3452
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3448

def determine_program_name_and_program_version
  set_program_name_and_program_version(
    :default
  )
end

#determine_the_archive_typeObject

#

determine_the_archive_type

#


3689
3690
3691
3692
3693
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3689

def determine_the_archive_type
  set_archive_type(
    dataset[:archive_type]
  )
end

#determine_the_base_dirObject

#

determine_the_base_dir

This is like ‘/home/x/src/gnomemahjongg/’, so combining src_dir?+short_name?. We will use :default, though, as argument to set_base_dir() since that already does the above for us.

#


3725
3726
3727
3728
3729
3730
3731
3732
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3725

def determine_the_base_dir
  if short_name?.nil?
    if program_name?
      set_short_name(program_name?)
    end
  end
  set_base_dir(:default)
end

#determine_the_file_sizeObject

#

determine_the_file_size

#


3698
3699
3700
3701
3702
3703
3704
3705
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3698

def determine_the_file_size
  result = 0
  _ = program_path?
  if File.exist? _
    result = File.size(_)
  end
  set_archive_size(result)
end

#determine_the_full_program_nameObject

#

determine_the_full_program_name

program_full_name is like ‘gnome-mahjonng-5.08.tar.xz’, so this is program_name_and_program_version?+archive_type?

#


3713
3714
3715
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3713

def determine_the_full_program_name
  set_program_full_name(:default)
end

#determine_the_full_program_pathObject Also known as: determine_the_program_path, rebuild_program_path, determine_the_path

#

determine_the_full_program_path

This refers to program_path, which may look like ‘/home/x/src/gnomemahjongg/gnome-mahjonng-5.08.tar.xz’.

In other words, it combines base_dir?+program_full_name?.

In June 2020 this was changed, to more adjust towards the needs of class RBT::Compile.

#


494
495
496
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 494

def determine_the_full_program_path
  set_program_path(:try_to_rebuild_it_from_smaller_components)
end

#determine_the_program_name_and_the_program_version(i = ) ⇒ Object

#

determine_the_program_name_and_the_program_version

This method will determine:

(1) the "program_name"
(2) the "program_version"

setting.

We will not use .downcase because some program names may include upcased characters, such as “libX11”.

#


3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3857

def determine_the_program_name_and_the_program_version(
    i = dataset?[:url1]
  )
  if ihash?.has_key?(:program_name)
    # ===================================================================== #
    # If we already have set a program_name value, and this one includes
    # a '-' character, then we assume here that the original cookbook
    # file already contains a "foobar-1.0" entry, which we will simply
    # use next.
    # ===================================================================== #
    if ihash?[:program_name].include? '-'
      i = ihash?[:program_name]
    end
  end
  # ======================================================================= #
  # First, if the input contains a '/' then we split towards the last
  # part.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  i = remove_archive_at_the_end(i) # Get rid of e. g. '.tar.xz'
  if i.include? '-'
    program_name    = ProgramInformation.return_name(i)
    program_version = ProgramInformation.return_version(i)
  else
    program_name    = i.dup
    program_version = DEFAULT_PROGRAM_VERSION
  end
  set_program_name(program_name)
  set_program_version(program_version)
  set_program_name_and_program_version(:default)
  set_short_name(program_name)
end

#determine_the_program_name_and_the_program_version_from_url1(url1 = url1? ) ⇒ Object Also known as: determine_the_program_name_and_the_program_version_from_url1_while_respecting_existing_values

#

determine_the_program_name_and_the_program_version_from_url1

Do note that this method will respect program_name_and_program_version entries.

#


3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3034

def determine_the_program_name_and_the_program_version_from_url1(
    url1 = url1?
  )
  i = remove_archive_from_the_end(
    File.basename(url1)
  ).dup
  _ = program_name_and_program_version?
  if _ and _.is_a?(String) and !_.empty?
    # ===================================================================== #
    # This clause is entered when the .yml file at hand has both an
    # url1 entry but also a specific program_name_and_program_version
    # entry. In this case we simply grab the
    # program_name_and_program_version entry instead.
    # ===================================================================== #
    i = _
  end
  if i.include?(token?)
    completely_infer_the_program_name_and_the_program_version_from_this_input(i)
  elsif i.include?(opposite_token?)
    set_separator_token(opposite_token?)
    completely_infer_the_program_name_and_the_program_version_from_this_input(i)
  else
    if is_a_github_url? and (i =~ /^v\d+/)
      require 'rbt/toplevel_methods/return_program_name_and_program_version_from_this_github_url.rb'
      i = RBT.return_program_name_and_program_version_from_this_github_url(url1?)
    end
    # ===================================================================== #
    # Alright - we have not found a separator token, such as '-' or
    # '_'. What to do in such a case?
    # One strategy is to notify the user about it, but this does not
    # really resolve the issue at hand. Since as of 27.05.2020
    # I decided to "fake-simulate" the proper program name and program
    # version based on ProgramInformation. That also means that the
    # old notification was disabled, but it will be kept in the source
    # code here, in the event that we may wish to re-attach it one day.
    # ===================================================================== #
    completely_infer_the_program_name_and_the_program_version_from_this_input(
      ProgramInformation.return_name(i)+
      '-'+
      ProgramInformation.return_version(i)
    )
    # opne 'No separator token found: '+steelblue(token?.to_s)
    # opne tomato('The URL was: ')+steelblue(url1)
  end
end

#determine_which_program_is_sought(_ = first_argument? ) ⇒ Object

#

determine_which_program_is_sought

#


3176
3177
3178
3179
3180
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3176

def determine_which_program_is_sought(
    _ = first_argument?
  )
  set_seek_this_program(_)
end

#do_change_to_appdir_layoutObject

#

do_change_to_appdir_layout

You can use this method to change to the AppDir layout.

#


3787
3788
3789
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3787

def do_change_to_appdir_layout
  sanitize_prefix(:return_appdir_path)
end

#do_convert_the_dataset(url1 = :default, url2 = :default) ⇒ Object

#

do_convert_the_dataset

This method will convert the raw-dataset into the sanitized dataset.

#


6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6253

def do_convert_the_dataset(
    url1 = :default,
    url2 = :default
  )
  set_archive_type
  parse_url1_and_set_all_associated_values(url1)
  check_for_outdated_entries(dataset?)
  sanitize_everything(url1, url2)
  determine_all_relevant_values_for_the_dataset_variable
end

#do_extract(i = program_path? ) ⇒ Object

#

do_extract

You can use this method, if you have class Extracter available, to force class Extracter to extract this program.

#


2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2990

def do_extract(
    i = program_path?
  )
  begin
    require 'extracter' unless Object.const_defined? :Extracter
  rescue LoadError; end
  if Object.const_defined? :Extracter
    # ======================================================================= #
    # Ok, extracter is available so we can continue.
    # ======================================================================= #
    Extracter.new(i?).extracted_path? # Specify the path.
  else
    opne 'class Extracter is not available. Consider installing it via:'
    e
    opne orange('  gem install extracter')
    e
  end
end

#do_not_autogenerateObject

#

do_not_autogenerate

#


6006
6007
6008
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6006

def do_not_autogenerate
  @internal_hash[:autogenerate_expanded_dataset] = false
end

#do_not_download?Boolean

#

do_not_download?

#

Returns:

  • (Boolean)


1501
1502
1503
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1501

def do_not_download?
  obtain(__method__.to_s.delete('?').to_sym)
end

#do_not_instantiate_a_new_raw_cookbookObject

#

do_not_instantiate_a_new_raw_cookbook

#


6220
6221
6222
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6220

def do_not_instantiate_a_new_raw_cookbook
  @internal_hash[:may_we_instantiate_a_new_raw_cookbook] = false
end

#do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliasesObject

#

do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliases

#


4410
4411
4412
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4410

def do_not_make_use_of_aliases_kept_in_the_file_cookbook_aliases
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = false
end

#do_not_symlink?Boolean

#

Reader method over whether we will not symlink.

#

Returns:

  • (Boolean)


650
651
652
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 650

def do_not_symlink?
  obtain __method__.to_s.delete('?').to_sym
end

#do_show_full_descriptionObject

#

do_show_full_description

This method will allow us to show the full description of a given program.

#


4327
4328
4329
4330
4331
4332
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4327

def do_show_full_description
  # ======================================================================= #
  # The following method-call will toggle the proper behaviour.
  # ======================================================================= #
  RBT::Action::Cookbooks::SanitizeCookbook.do_not_honour_threshold_value
end

#do_use_this_program_version(i = '1.52.1') ⇒ Object Also known as: use_this_program_version, do_use_this_version=

#

do_use_this_program_version

Use this method specifically to set (and use) another program version.

The difference towards set_program_version is that we will also re-assemble the default program path.

#


3630
3631
3632
3633
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3630

def do_use_this_program_version(i = '1.52.1')
  set_program_version(i)
  reassemble_program_path
end

#does_include?(this_program, honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases? ) ⇒ Boolean

#

does_include?

#

Returns:

  • (Boolean)


5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5018

def does_include?(
    this_program,
    honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases?
  )
  # ======================================================================= #
  # Delegate towards the toplevel-method next.
  # ======================================================================= #
  ::RBT.does_include?(
    this_program, honour_aliases
  )
end

#enable_debugObject

#

enable_debug

#


3610
3611
3612
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3610

def enable_debug
  @internal_hash[:debug] = true
end

#enable_shared?Boolean

#

enable_shared?

#

Returns:

  • (Boolean)


5418
5419
5420
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5418

def enable_shared?
  obtain __method__.to_s.delete('?').to_sym
end

#enable_static?Boolean

#

enable_static?

#

Returns:

  • (Boolean)


5579
5580
5581
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5579

def enable_static?
  obtain __method__.to_s.delete('?').to_sym
end

#ensure_that_this_hash_has_only_valid_keys(i = raw_cookbook.hash?) ⇒ Object

#

ensure_that_this_hash_has_only_valid_keys

The input to this method must be a Hash.

This method will ensure that the given Hash has only valid keys.

In the past, we could use it to convert it into Symbols but this is no longer in use. We now make no further modifications to the original dataset.

If all keys are valid then we won’t have to notify the user about it at all.

#


3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3920

def ensure_that_this_hash_has_only_valid_keys(
    i = raw_cookbook.hash?
  )
  registered_cookbook_entries = registered_cookbook_entries?
  # ======================================================================= #
  # Check whether all is fine with the raw-dataset.
  # ======================================================================= #
  if i.nil?
    cliner
    opne sfancy('nil')+' was passed into the method '+
         orange('ensure_that_this_hash_has_only_valid_keys()')
    opne steelblue('This can not be right. Program name was: ')+
         sfancy(program_name?.to_s)+'.'
    pp caller()
    pp self
    cliner
  else
    i.each_pair {|key, value|
      key = key.to_s # We will only deal with Strings past this point.
      case key
      # =================================================================== #
      # === Add some ad-hoc exceptions next
      # =================================================================== #
      when 'program_full_name','md5sum', # Ad-hoc exceptions.
           'program_name',
           'program_path',
           'program_version',
           'set_env_variables'
        next
      end
      unless registered_cookbook_entries.include?(key)
        seek_this_yaml_file = "#{seek_this_program?}"
        seek_this_yaml_file << '.yml' unless seek_this_yaml_file.end_with? '.yml'
        opne "#{swarn('Warning')}#{rev} - the cookbook-file for `"\
             "#{sfancy(seek_this_yaml_file)}#{rev}`"
        opne "(path: #{sfile(raw_cookbook?.file?)}#{rev})"
        opne "#{rev}contains a key that was #{swarn('NOT')} #{rev}"\
             "registered. The name of that"
        opne "#{rev}(invalid / ignored) key is: `#{sfancy(key.to_s)}#{rev}`."
        opne "#{rev}This is defined in the file "\
             "#{Colours.sfile('registered_cookbook_entries.yml')}"
        # ================================================================= #
        # Next, also try to find a name that is similar.
        # ================================================================= #
        if registered_cookbook_entries.any? {|entry|
            entry.include? key.to_s
          }
          select_this_entry = registered_cookbook_entries.select {|entry|
            entry.include? key.to_s
          }.first
          opne "#{rev}Did you mean this entry instead? "\
               "#{sfancy(select_this_entry)}"  
        end
        opne 'This is currently discouraged.'
        # exit
      end
    }
  end
end

#entry_exists?Boolean

#

entry_exists?

#

Returns:

  • (Boolean)


4911
4912
4913
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4911

def entry_exists?
  File.exist? location?
end

#extra_information?Boolean

#

extra_information?

#

Returns:

  • (Boolean)


1280
1281
1282
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1280

def extra_information?
  obtain(__method__.to_s.delete('?').to_sym)
end

#extract_to?Boolean Also known as: will_be_extracted_towards?

#

extract_to?

This must return a String.

#

Returns:

  • (Boolean)


1420
1421
1422
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1420

def extract_to?
  obtain(__method__.to_s.delete('?').to_sym)
end

#extracted_towards?Boolean Also known as: extract_towards?

#

extracted_towards?

Determine where the archive will be extracted towards. This will also specifically include the name of the program at hand and the corresponding version, such as ‘gnome-mahjonng-5.08’.

#

Returns:

  • (Boolean)


4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4975

def extracted_towards?
  # ======================================================================= #
  # We include the program name and the program version.
  # ======================================================================= #
  result = "#{extract_to?}#{program_name_and_program_version?}"
  unless result.end_with? '/'
    result = result.dup if result.frozen?
    result << '/'
  end
  return result
end

#feedback_available_cookbooks(i = available_programs?) ) ⇒ Object

#

feedback_available_cookbooks

Feedback which cookbooks are available.

#


3158
3159
3160
3161
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3158

def feedback_available_cookbooks(i = available_programs?)
  e 'These cookbooks are available:'; print '  '
  e i.join(', ')
end

#feedback_descriptionObject

#

feedback_description

Use this method if you wish to feedback the description of a given program at hand.

#


3169
3170
3171
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3169

def feedback_description
  e description?
end

#feedback_version(shall_we_exit = true) ⇒ Object

#

feedback_version

This will feedback the program-version.

#


3023
3024
3025
3026
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3023

def feedback_version(shall_we_exit = true)
  opne "The current RBT-Version is: #{RBT.version?}"
  exit if shall_we_exit
end

#file?Boolean Also known as: file, which_file?, raw_cookbook_file?

#

file?

#

Returns:

  • (Boolean)


5009
5010
5011
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5009

def file?
  raw_cookbook?.file?
end

#find_in_the_raw_cookbook(i = search_for_this_program?, , raw_cookbook = raw_cookbook? ) ⇒ Object Also known as: load_yaml_dataset_from_this_file

#

find_in_the_raw_cookbook

#


2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2680

def find_in_the_raw_cookbook(
    i            = search_for_this_program?,
    raw_cookbook = raw_cookbook?
  )
  if debug?
    opne "#{rev}Loading the dataset from the file "\
         "`#{sfile(raw_cookbook?.file?)}#{rev}`."
  end
  if raw_cookbook
    result = raw_cookbook.find(i)
    return result
  end
end

#find_this_program(i = first? ) ⇒ Object Also known as: assign_and_run, assign, initialize_yaml_dataset, update_with_this_program, update, query, set_dataset, find, find_this_program_and_then_set_the_internal_cookbook_dataset

#

find_this_program (find tag)

This method will also keep track which program we are trying to find.

Note that .find() is an alias to this method.

#


2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2602

def find_this_program(
    i = first?
  )
  determine_which_program_is_sought(i)               # (1) seek this new program
  if may_we_instantiate_a_new_raw_cookbook?
    instantiate_raw_cookbook(i)                      # (2) finally, instantiate a new raw cookbook
  end
  populate_the_dataset_variable                      # (4) initialize the main hash properly
  if raw_cookbook?
    if in_simple_mode?                               # (5) in this case, sync a lot of stuff.
      # =================================================================== #
      # We use this method call because the program we are trying to find
      # may have been modified, such as from "x11" to "libx11".
      # =================================================================== #
      find_in_the_raw_cookbook(seek_this_program?)
      ensure_that_this_hash_has_only_valid_keys(
        raw_cookbook?.dataset?
      )
      # =================================================================== #
      # :archive_type can be set early because we can scan for the real
      # value lateron anyway.
      # =================================================================== #
      dataset?[:archive_type] = '.tar.xz'              # (6) archive_type
      # =================================================================== #
      # In this case we have to do additional parsing. However had, when
      # the .yml file contains a set-entry called program_name_and_program_version
      # then this entry will be used rather than using url1.
      # =================================================================== #
      _ = program_name_and_program_version?
      if _ and _.is_a?(String) and !_.empty?
        _ = ::RBT.sanitize_url1_entry(_, dataset?.merge(url1: raw_cookbook?.url1?)).dup
        # ================================================================= #
        # In this case program_name_and_program_version exists, so we will
        # set these parts first.
        # ================================================================= #
        set_program_name_and_program_version(_)
        deduce_everything_from_the_program_name_and_program_version_downwards
        set_program_full_name(:default)
        set_short_name(:default)
        set_base_dir(:default)
        set_program_path(:default)
        set_program_version(:infer_from_the_program_name_and_program_version)
      else
        parse_url1_and_set_all_associated_values
      end
      check_for_outdated_entries(dataset?)
      sanitize_everything                              # (7) sanitize everything
      determine_all_relevant_values_for_the_dataset_variable
    else
      # =================================================================== #
      # else we are in complex-mode.
      # =================================================================== #
      copy_the_data_from_the_raw_cookbook_onto_the_main_hash
    end
  end
end

#find_this_program_and_then_set_the_internal_cookbook_dataset_then_determine_everything(compile_this_program = first_argument? ) ⇒ Object Also known as: metafind, meta_find

#

find_this_program_and_then_set_the_internal_cookbook_dataset_then_determine_everything

#


2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2771

def find_this_program_and_then_set_the_internal_cookbook_dataset_then_determine_everything(
    compile_this_program = first_argument?
  )
  if does_include?(compile_this_program)
    the_program_was_found # The program was found - so continue.
    find_this_program_and_then_set_the_internal_cookbook_dataset(
      compile_this_program
    )
    determine_everything
  else
    this_program_was_not_found(compile_this_program)
  end
end

#first_url?Boolean

#

first_url?

Returns the first url. Should be used if you want to access URLs.

#

Returns:

  • (Boolean)


4920
4921
4922
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4920

def first_url?
  dataset?.remote_urls.empty? ? '' : dataset?.remote_urls.first  
end

#flatpak_url?Boolean Also known as: flatpak_url

#

flatpak_url?

#

Returns:

  • (Boolean)


5601
5602
5603
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5601

def flatpak_url?
  obtain __method__.to_s.delete('?').to_sym
end

#found?Boolean Also known as: program_is_included?, found_result?, program_was_found?

#

found?

Query method to determine whether the search term (the program we are seeking) is included or whether it is not.

Returns a boolean.

#

Returns:

  • (Boolean)


4542
4543
4544
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4542

def found?
  @internal_hash[:found]
end

#gir_files?Boolean Also known as: girfiles?, gir_files

#

gir_files?

#

Returns:

  • (Boolean)


1192
1193
1194
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1192

def gir_files?
  obtain(__method__.to_s.delete('?').to_sym)
end

#git_url?Boolean Also known as: giturl?, git_URL?

#

git_url?

#

Returns:

  • (Boolean)


1396
1397
1398
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1396

def git_url?
  obtain(__method__.to_s.delete('?').to_sym)
end

#guess_short_name(i = program_name? ) ⇒ Object

#

guess_short_name

This method can be used to guess the short name of a program.

#


3641
3642
3643
3644
3645
3646
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3641

def guess_short_name(
    i = program_name?
  )
  _ = ::ProgramInformation.return_short_name(i)
  set_short_name(_)
end

#has_a_dependency_on_meson?Boolean

#

has_a_dependency_on_meson?

This method will return a boolean value, indicating whether the given program at hand has a dependency on the build system called meson or whether it has not.

#

Returns:

  • (Boolean)


4568
4569
4570
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4568

def has_a_dependency_on_meson?
  required_deps_on? and required_deps_on?.include?('meson')
end

#has_key?(i = :blfs) ⇒ Boolean

#

has_key?

This query method will delegate towards the yaml dataset, whether it has a given key or whether it does not.

The key should ideally be a Symbol - keep this in mind.

Since as of April 2021 there will be no modifications made; the input argument will be the key. Prior to that we converted it to a String via .to_s.

#

Returns:

  • (Boolean)


4046
4047
4048
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4046

def has_key?(i = :blfs)
  dataset?.has_key?(i)
end

#has_tags?Boolean

#

has_tags?

This method will return true or false depending on whether the given program at hand has any tags registered at all, or whether it has not.

#

Returns:

  • (Boolean)


5188
5189
5190
5191
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5188

def has_tags?
  return false if tags?.empty?
  return true
end

#has_to_be_compiled?Boolean Also known as: has_to_be_compiled, does_the_program_have_to_be_compiled?

#

has_to_be_compiled?

#

Returns:

  • (Boolean)


1255
1256
1257
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1255

def has_to_be_compiled?
  obtain(__method__.to_s.delete('?').to_sym)
end

#headers?Boolean Also known as: headers

#

headers?

#

Returns:

  • (Boolean)


1463
1464
1465
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1463

def headers?
  obtain(__method__.to_s.delete('?').to_sym)
end

#homepage?Boolean Also known as: return_homepage, remote_homepage?, homepage, homepage_url?

#

homepage?

#

Returns:

  • (Boolean)


5486
5487
5488
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5486

def homepage?
  obtain __method__.to_s.delete('?').to_sym
end

#ignore_errors?Boolean

#

ignore_errors?

#

Returns:

  • (Boolean)


1518
1519
1520
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1518

def ignore_errors?
  obtain(__method__.to_s.delete('?').to_sym)
end

#in_simple_mode?Boolean

#

in_simple_mode?

#

Returns:

  • (Boolean)


4514
4515
4516
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4514

def in_simple_mode?
  @internal_hash[:simple_or_complex] == :simple
end

#infer_the_short_nameObject

#

infer_the_short_name

This will simply assume the default short name.

#


3576
3577
3578
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3576

def infer_the_short_name
  set_short_name(:default)
end

#initialize_the_internal_hashObject Also known as: reset_the_internal_hash

#

initialize_the_internal_hash

#


380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 380

def initialize_the_internal_hash
  # ======================================================================= #
  # === @internal_hash
  #
  # The internal hash contains lots of entries that are important for
  # this class to work properly.
  #
  # Since as of August we inherit the "parent" Hash, so we don't
  # re-assign it here.
  # ======================================================================= #
  # @internal_hash = {}
  # ======================================================================= #
  # === :dataset
  #
  # This entry will contain the dataset that refers to the program at
  # hand. If you want to clear it then you can use the method
  # .reset_the_dataset().
  # ======================================================================= #
  @internal_hash[:dataset] = nil
  # ======================================================================= #
  # === :original_unmodified_name
  #
  # This variable will keep track of which program we are searching for.
  # ======================================================================= #
  @internal_hash[:original_unmodified_name] = nil
  # ======================================================================= #
  # === raw_cookbook
  #
  # This is initially set to nil, simply to not forget it.
  # ======================================================================= #
  @internal_hash[:raw_cookbook] = nil
  # ======================================================================= #
  # === :use_this_connective_token
  #
  # Some programs, such as artemis, have a '_' rather than a '-'. So
  # we need to be able to keep track of this as well. The default is
  # '-' though.
  # ======================================================================= #
  @internal_hash[:use_this_connective_token] = '-'
  # ======================================================================= #
  # === :wrap_result
  #
  # By default, we will word-wrap too long text lines.
  # ======================================================================= #
  @internal_hash[:wrap_result] = true
  # ======================================================================= #
  # === :replace_plus_with_long_name
  # ======================================================================= #
  @internal_hash[:replace_plus_with_long_name] = REPLACE_PLUS_WITH_LONG_NAME
  # ======================================================================= #
  # === :try_to_truncate_too_long_output
  # ======================================================================= #
  @internal_hash[:try_to_truncate_too_long_output] = true
  # ======================================================================= #
  # === :seek_this_program
  # ======================================================================= #
  @internal_hash[:seek_this_program] = nil
  # ======================================================================= #
  # === :found
  #
  # This variable keeps track as to whether the input has been found
  # or not.
  # ======================================================================= #
  @internal_hash[:found] = false
  # ======================================================================= #
  # === :autogenerate_expanded_dataset
  # ======================================================================= #
  @internal_hash[:autogenerate_expanded_dataset] = false
  # ======================================================================= #
  # === :make_use_of_aliases_kept_in_the_file_cookbook_aliases
  #
  # Next, determine whether to use cookbook-internal aliases or whether
  # we shall not.
  # ======================================================================= #
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = true
  # ======================================================================= #
  # === :shall_we_display_the_md5sum
  # ======================================================================= #
  @internal_hash[:shall_we_display_the_md5sum] = RBT.display_md5sum?
  # ======================================================================= #
  # === :report_how_many_programs_are_registered
  # ======================================================================= #
  @internal_hash[:report_how_many_programs_are_registered] = false
  # ======================================================================= #
  # === :array_show_these_entries
  # ======================================================================= #
  @internal_hash[:array_show_these_entries] = []
  # ======================================================================= #
  # === :may_we_instantiate_a_new_raw_cookbook
  #
  # This variable can be used to instantiate a new raw-cookbook. This
  # is the default behaviour, but sometimes we may not want to do so,
  # and instead supply our own dataset, which is why this variable
  # exists.
  # ======================================================================= #
  @internal_hash[:may_we_instantiate_a_new_raw_cookbook] = true
  # ======================================================================= #
  # === :simple_or_complex
  # ======================================================================= #
  # @internal_hash[:simple_or_complex] = :simple
  set_simple_or_complex(:default) # Set it once on startup.
end

#initialize_the_main_hash_with_default_valuesObject Also known as: populate_the_dataset_variable_with_default_values

#

initialize_the_main_hash_with_default_values

This method is necessary so that our main hash contains all necessary values initially.

#


2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2922

def initialize_the_main_hash_with_default_values
  reset_the_dataset # This will make @internal_hash[:dataset] an empty Hash.
  # ======================================================================= #
  # Add the emptry-entries to the dataset next:
  # ======================================================================= #
  add_the_empty_entries_to_the_dataset_variable
  add_the_nil_entries_to_the_dataset_variable
  add_the_array_entries_to_the_dataset_variable
  add_the_true_entries_to_the_dataset_variable
  add_the_false_entries_to_the_dataset_variable
  # ======================================================================= #
  # Last but not least, add the remaining entries to the dataset variable.
  # ======================================================================= #
  add_the_remaining_entries_to_the_dataset_variable
end

#installation_steps?Boolean

#

installation_steps?

#

Returns:

  • (Boolean)


5307
5308
5309
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5307

def installation_steps?
  obtain __method__.to_s.delete('?').to_sym
end

#instantiate_raw_cookbook(i = seek_this_program? ) ⇒ Object Also known as: initialize_raw_cookbook

#

instantiate_raw_cookbook (raw tag)

#


6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6103

def instantiate_raw_cookbook(
    i = seek_this_program?
  )
  # ===================================================================== #
  # We also have to sync the variable @simple_or_complex down onto the
  # raw-cookbooks loader.
  # ===================================================================== #
  # @internal_hash[:raw_cookbook] = RBT.raw_cookbook(i) { simple_or_complex? }
  @internal_hash[:raw_cookbook] = action(
    :raw_cookbook,
    i,
    {
      autogenerate_expanded_dataset: @internal_hash[:autogenerate_expanded_dataset]
    }
  ) { simple_or_complex? }
end

#internal_commandline_arguments?Boolean

#

internal_commandline_arguments?

#

Returns:

  • (Boolean)


4870
4871
4872
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4870

def internal_commandline_arguments?
  @internal_hash[:internal_commandline_arguments]
end

#is_a_boolean_configuration_value?(i) ⇒ Boolean

#

is_a_boolean_configuration_value?

Query method to determine whether the input is a boolean configuration value. For example, the String “use_glib_schema”, would be a boolean configuration value and thus this method would return true.

#

Returns:

  • (Boolean)


4897
4898
4899
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4897

def is_a_boolean_configuration_value?(i)
  ( ARRAY_FALSE_VALUES + ARRAY_TRUE_VALUES ).flatten.include? i
end

#is_a_game?Boolean

#

is_a_game?

This method will simply return true if the program in question is a game, and false if it is not a game. That way we can quickly find out whether the input is a game or whether it is not.

Usage example:

ProgramInformation.return_name @program_name
ProgramInformation.return_name 'supertux-0.1.1'
#

Returns:

  • (Boolean)


4063
4064
4065
4066
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4063

def is_a_game?
  return true if tags?.to_s.include? 'game'
  return false # Else return false here.
end

#is_an_active_project?Boolean Also known as: active_project, active_project?

#

is_an_active_project?

#

Returns:

  • (Boolean)


1428
1429
1430
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1428

def is_an_active_project?
  obtain(__method__.to_s.delete('?').to_sym)
end

#is_another_archive_used_locally?(i = archive_type? ) ⇒ Boolean

#

is_another_archive_used_locally?

This method depends on program_path? having been properly set BEFORE the method is invoked.

The method will return true or false.

#

Returns:

  • (Boolean)


3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3749

def is_another_archive_used_locally?(
    i = archive_type?
  )
  result = false
  program_path = program_path?
  if program_path
    unless File.exist?(program_path)
      target = base_dir?+program_name_and_program_version?+'*'
      entries = Dir[target]
      if entries.nil? or 
         entries.first.nil? or
         entries.first.include?(archive_type?)
        e 'An error happened. The target was:'
        e
        e tomato(target)
        e
        e 'The program at hand was assumed to be '+steelblue(i)+' and'
        e 'the program_path was assumed to be: '+lightgreen(program_path.to_s)
        if is_on_roebe? and !target.end_with?('-*')
          # =============================================================== #
          # This here looks like so: '/home/x/src/-*'
          # palemoon may show this error.
          # =============================================================== #
          exit
        end
      else
        result = true
      end
    end
  end
  return result
end

#is_included?Boolean

#

does_include?

#

is_included?

Returns:

  • (Boolean)


5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5028

def does_include?(
    this_program,
    honour_aliases = make_use_of_aliases_kept_in_the_file_cookbook_aliases?
  )
  # ======================================================================= #
  # Delegate towards the toplevel-method next.
  # ======================================================================= #
  ::RBT.does_include?(
    this_program, honour_aliases
  )
end

#is_sanitize_cookbook?Boolean

#

is_sanitize_cookbook?

More elegant way to state that this class is indeed SanitizeCookbook.

#

Returns:

  • (Boolean)


937
938
939
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 937

def is_sanitize_cookbook?
  true
end

#is_the_build_system_cmake?Boolean

#

is_the_build_system_cmake?

#

Returns:

  • (Boolean)


5104
5105
5106
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5104

def is_the_build_system_cmake?
  use_this_build_system? == 'cmake'
end

#is_the_build_system_meson?Boolean

#

is_the_build_system_meson?

Query-method to determine whether the build system makes use of meson or whether it does not.

#

Returns:

  • (Boolean)


5097
5098
5099
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5097

def is_the_build_system_meson?
  use_this_build_system? == 'meson'
end

#keep_extracted?Boolean Also known as: keep_extracted, keep_the_archive_extracted?

#

keep_extracted?

#

Returns:

  • (Boolean)


5593
5594
5595
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5593

def keep_extracted?
  obtain __method__.to_s.delete('?').to_sym
end

#last_update?Boolean Also known as: last_update

#

last_update?

The last_update tag keeps track over as to when that particular program was last updated.

#

Returns:

  • (Boolean)


1333
1334
1335
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1333

def last_update?
  obtain(__method__.to_s.delete('?').to_sym)
end

#last_url?Boolean

#

last_url?

Returns the last url. Should be used if you want to access URLs.

#

Returns:

  • (Boolean)


5465
5466
5467
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5465

def last_url?
  dataset?.remote_urls.empty? ? '' : dataset?.remote_urls.last  
end

#libexec?Boolean

#

libexec?

#

Returns:

  • (Boolean)


5552
5553
5554
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5552

def libexec?
  obtain __method__.to_s.delete('?').to_sym
end

#libraries?Boolean

#

libraries?

Return the given libraries that will be installed by the given program at hand.

#

Returns:

  • (Boolean)


5449
5450
5451
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5449

def libraries?
  obtain __method__.to_s.delete('?').to_sym
end

#licence?Boolean Also known as: license?

#

licence?

This is the query method over licence.

Do note that while the specification allows for both a String value, or an Array value alternatively, it only really makes sense to assume that tag to be a String.

The reason why an Array is used as an alternative is twofold:

(1) That way we can also respect programs that have more than
    one licence.
(2) It may sometimes be more convenient to use an Array in the
    corresponding .yml file.
#

Returns:

  • (Boolean)


5176
5177
5178
5179
5180
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5176

def licence?
  _ = obtain(__method__.to_s.delete('?').to_sym).to_s
  _ = _.first if _.is_a? Array
  return _
end

#localstatedir?Boolean

#

localstatedir?

#

Returns:

  • (Boolean)


5586
5587
5588
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5586

def localstatedir?
  obtain __method__.to_s.delete('?').to_sym
end

#m4_files?Boolean Also known as: m4_files

#

m4_files?

#

Returns:

  • (Boolean)


1340
1341
1342
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1340

def m4_files?
  obtain(:m4_files)
end

#main_seven?(use_padded_output = true) ⇒ Boolean Also known as: all_seven, return_the_seven

#

main_seven?

This method will return the main 7 entries that are the most important ones for any given program at hand.

#

Returns:

  • (Boolean)


4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4595

def main_seven?(
    use_padded_output = true
  )
  _ = ''.dup
  one   = 'short_name: '.dup
  two   = 'program_version: '.dup
  three = 'archive_type: '.dup
  four  = 'base_dir: '.dup
  five  = 'program_name: '.dup
  six   = 'program_full_name: '.dup
  seven = 'program_path: '.dup
  # ======================================================================= #
  # Next make sure to pad the output, if the user requested this.
  # ======================================================================= #
  if use_padded_output
    n_ljust = 19
    one   = one.ljust(n_ljust)
    two   = two.ljust(n_ljust)
    three = three.ljust(n_ljust)
    four  = four.ljust(n_ljust)
    five  = five.ljust(n_ljust)
    six   = six.ljust(n_ljust)
    seven = seven.ljust(n_ljust)
  end
  _ << "#{one}#{short_name?}#{N}"
  _ << "#{two}#{program_version?}#{N}"
  _ << "#{three}#{archive_type?}#{N}"
  _ << "#{four}#{base_dir?}#{N}"
  _ << "#{five}#{program_name?}#{N}"
  _ << "#{six}#{program_full_name?}#{N}"
  _ << "#{seven}#{program_path?}#{N}"
  return _
end

#make_use_of_aliases_kept_in_the_file_cookbook_aliases?Boolean Also known as: make_use_of_cookbook_aliases?

#

make_use_of_aliases_kept_in_the_file_cookbook_aliases?

This method can be used to query whether we will make use of aliases kept in the cookbook_aliases.yml file or whether we will not.

#

Returns:

  • (Boolean)


4964
4965
4966
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4964

def make_use_of_aliases_kept_in_the_file_cookbook_aliases?
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases]
end

#manual_steps?Boolean

#

manual_steps?

#

Returns:

  • (Boolean)


5646
5647
5648
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5646

def manual_steps?
  obtain __method__.to_s.delete('?').to_sym
end

#may_we_instantiate_a_new_raw_cookbook?Boolean

#

may_we_instantiate_a_new_raw_cookbook?

#

Returns:

  • (Boolean)


6213
6214
6215
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6213

def may_we_instantiate_a_new_raw_cookbook?
  @internal_hash[:may_we_instantiate_a_new_raw_cookbook]
end

#may_we_modify_the_configure_options?Boolean Also known as: may_we_modify_the_configure_options

#

may_we_modify_the_configure_options?

#

Returns:

  • (Boolean)


5247
5248
5249
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5247

def may_we_modify_the_configure_options?
  obtain __method__.to_s.delete('?').to_sym
end

#md5sum?(use_this_path = program_path? ) ⇒ Boolean Also known as: md5sum

#

md5sum?

Conditionally use md5sum.

This method must accomodate three different possibilities:

(1) We have generated a .yml file in a special directory. We
    will preferentially use that one, if it exists. This requires
    of the user to have generated these values already. If the
    user did so then we will use these values rather than
    calculate them anew again. The advantage of this way is 
    that it will significantly speed up the process.

(2) IF we do not have such a file as described in (1), then we will
    first try to use the ruby Md5sum class, specifically its Md5sum[]
    class method. Note that the ruby Md5sum class is fairly slow for
    large programs, which is why option (1) is the default since as
    of April 2016.

(3) The other two options (1) and (2) not being available, we will
    try to use the unix coreutils "md5sum" instead, which is a 
    binary, and should be pretty fast.

Note that as of May 2016, we also make available a way to AVOID calculating the md5sum at all. Not everyone will need the md5sum information after all.

#

Returns:

  • (Boolean)


3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3374

def md5sum?(
    use_this_path = program_path?
  )
  # ======================================================================= #
  # === Try to use yaml files first
  #
  # The expanded directory on my system will be here:
  #
  #   /Depot/Temp/CookbookDirectory/expanded_cookbooks/
  #
  # ======================================================================= #
  if File.directory?(RBT.base_dir_to_store_expanded_cookbooks?) and
     File.exist?(use_this_path.to_s) and
     use_this_path.end_with?('.yml')
     begin
       dataset = YAML.load_file(use_this_path)
       return dataset['md5sum'].to_s
     rescue ArgumentError => error
       opne 'An error happened for the path `'+sfile(use_this_path)+
            '`. We will exit as a consequence.'
       pp error
       exit
     end
  # ======================================================================= #
  # === Use the pure ruby way next
  # ======================================================================= #
  elsif Object.const_defined? :Md5sum
    Md5sum[use_this_path].md5sum? # Calculate it anew via Md5sum[].
  # ======================================================================= #
  # === Try to use md5sum binary directly next
  #
  # This entry point depends on a binary that is part of the
  # coreutils package.
  # ======================================================================= #
  elsif (result = `md5sum bogus 2>&1`) and
        !result.include?('command not found')
    if File.directory? use_this_path # A workaround for now.
      return '0'
    else
      # =================================================================== #
      # Delegate to the system tool here, part of coreutils.
      # =================================================================== #
      result = `md5sum #{use_this_path}`.split(' ').first
      result.strip! if result
      return result
    end
  else
    '0' # Return 0 then. But that should not ever happen.
  end
end
#

menu (menu tag)

#


6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6013

def menu(
    i = commandline_arguments_with_leading_hyphens
  )
  if i.is_a? Array
    i.each {|entry| menu(entry) }
  elsif i.is_a? Hash
    # ===================================================================== #
    # === Handle Hashes passed to menu() here
    # ===================================================================== #
    i.each_pair {|key, value|
      case key
      # =================================================================== #
      # === :autogenerate_expanded_dataset
      # =================================================================== #
      when :autogenerate_expanded_dataset
        case value
        when true
          @internal_hash[:autogenerate_expanded_dataset] = true
        when false
          @internal_hash[:autogenerate_expanded_dataset] = false
        end
      end 
    }
  else
    case i
    # ===================================================================== #
    # === --no-colours
    # ===================================================================== #
    when /^-?-?no(-|_)?colou?rs$/i
      disable_colours
    # ===================================================================== #
    # === --simple
    #
    # --raw is an alias to this entry point.
    # ===================================================================== #
    when /^-?-?simple$/i,
         /^-?-?raw$/i
      set_simple_or_complex(:simple)
    end
  end
end

#merge_in_the_dataset_derived_from_the_raw_cookbook(dataset = raw_cookbook_dataset? ) ⇒ Object

#

merge_in_the_dataset_derived_from_the_raw_cookbook

#


6227
6228
6229
6230
6231
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6227

def merge_in_the_dataset_derived_from_the_raw_cookbook(
    dataset = raw_cookbook_dataset?
  )
  merge_in_this_dataset(dataset)
end

#merge_in_this_dataset(dataset) ⇒ Object

#

merge_in_this_dataset

#


6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6236

def merge_in_this_dataset(dataset)
  # ======================================================================= #
  # Next "copy" the dataset onto the main Hash.
  # ======================================================================= #
  if dataset
    dataset.each_pair {|key, value|
      key = key.to_sym
      @internal_hash[:dataset][key] = value
    }
  end
end

#meson_configure_options?Boolean Also known as: meson_configure_options

#

meson_configure_options?

#

Returns:

  • (Boolean)


5196
5197
5198
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5196

def meson_configure_options?
  obtain __method__.to_s.delete('?').to_sym
end

#meson_or_cmake_or_configure_options?(optional_use_this_build_system = nil) ⇒ Boolean

#

meson_or_cmake_or_configure_options?

This is similar to the method called .meson_or_configure_options?() but we will also check whether cmake is in use.

The optional argument must be a Symbol. If provided then this method will simply return the corresponding configure-options.

#

Returns:

  • (Boolean)


5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5824

def meson_or_cmake_or_configure_options?(
    optional_use_this_build_system = nil
  )
  if optional_use_this_build_system
    case optional_use_this_build_system
    # ===================================================================== #
    # === :meson
    # ===================================================================== #
    when :meson
      meson_configure_options?
    # ===================================================================== #
    # === :cmake
    # ===================================================================== #
    when :cmake
      cmake_configure_options?
    # ===================================================================== #
    # === :configure
    # ===================================================================== #
    when :configure
      configure_options?
    end
  else
    if is_the_build_system_meson?
      meson_configure_options?
    elsif is_the_build_system_cmake?
      cmake_configure_options?
    else
      configure_options?
    end
  end
end

#meson_or_configure_options?Boolean Also known as: configure_options_or_meson_options?

#

meson_or_configure_options?

This method will either return the meson-configure options or the GNU configure options. The checks are in order, so first we will check for meson, and then default to configure if meson is NOT used.

#

Returns:

  • (Boolean)


4638
4639
4640
4641
4642
4643
4644
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4638

def meson_or_configure_options?
  if is_the_build_system_meson?
    meson_configure_options?
  else
    configure_options?
  end
end

#mirror?Boolean

#

mirror?

#

Returns:

  • (Boolean)


1494
1495
1496
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1494

def mirror?
  obtain(__method__.to_s.delete('?').to_sym)
end

#modify_the_makefile?Boolean Also known as: modify_the_makefile

#

modify_the_makefile?

This method will query whether RBT will modify the Makefile at hand or whether it will not. Some Makefiles have hardcoded paths which do not respect the given –prefix variant, not even DESTDIR, as far as I know. Hence, for these .yml files, we need to have a way to modify that Makefile and correct it.

#

Returns:

  • (Boolean)


1178
1179
1180
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1178

def modify_the_makefile?
  obtain(__method__.to_s.delete('?').to_sym)
end

#n_headers?Boolean

#

n_headers?

#

Returns:

  • (Boolean)


1470
1471
1472
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1470

def n_headers?
  headers?.size
end

#n_libraries?Boolean

#

n_libraries?

#

Returns:

  • (Boolean)


5293
5294
5295
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5293

def n_libraries?
  libraries?.size
end

#n_programs_available?Boolean

#

n_programs_available?

#

Returns:

  • (Boolean)


4478
4479
4480
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4478

def n_programs_available?
  RBT.n_programs?
end

#obtain(this_key) ⇒ Object Also known as: o, get_value_of

#

obtain (obtain tag, o tag)

This getter-method can be used to obtain elements from the main yaml dataset, which is stored in:

@internal_hash[:dataset]

The main reason why a method is used here is because the keys can be either Symbols or Strings. If we ever wish to change to another format, we can do so thanks to the flexibility of this setup.

#


5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5672

def obtain(this_key)
  result = nil
  # ======================================================================= #
  # Next, we need to decide whether we use a Symbol, or a String.
  # ======================================================================= #
  unless this_key.is_a? Symbol
    this_key = this_key.to_sym if complex_mode?
  end
  dataset = dataset?
  if dataset
    if dataset.has_key? this_key
      result = dataset[this_key] # [] is better than .fetch() here.
    # elsif raw_cookbook_dataset?.has_key?(what.to_s)
    #  result = raw_cookbook_dataset?[what.to_s]
    #else
      # e rev+'DEBUG: TODO, remove me -> No key called '+
      # steelblue(this_key.to_s)+' (class: '+this_key.class.to_s+
      # ') could be found.'
    end
  end
  return result
end

#opnnObject

#

opnn

#


4337
4338
4339
4340
4341
4342
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4337

def opnn
  super(
    namespace:   namespace?,
    use_colours: RBT.use_colours?
  )
end

#opposite_token?(i = ) ⇒ Boolean

#

opposite_token?

This method will return the “opposite” token, e. g. ‘_’ is the “opposite to ‘-’ and vice versa.

#

Returns:

  • (Boolean)


5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5047

def opposite_token?(
    i = @internal_hash[:use_this_connective_token]
  )
  case i
  when '-'
    '_'
  when '_'
    '-'
  end
end

#optional_start_message?Boolean Also known as: optional_start_message

#

optional_start_message

#

Returns:

  • (Boolean)


5432
5433
5434
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5432

def optional_start_message?
  obtain __method__.to_s.delete('?').to_sym
end

#original_unmodified_name?Boolean

#

original_unmodified_name?

#

Returns:

  • (Boolean)


5118
5119
5120
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5118

def original_unmodified_name?
  @internal_hash[:original_unmodified_name]
end

#output_main_datasetObject

#

output_main_dataset

#


3583
3584
3585
3586
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3583

def output_main_dataset
  do_not_use_colours
  pp yaml_dataset?
end

#parameters_to_make?Boolean Also known as: make_options, make_options?

#

parameters_to_make?

#

Returns:

  • (Boolean)


5218
5219
5220
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5218

def parameters_to_make?
  obtain __method__.to_s.delete('?').to_sym
end

#parse_url1_and_set_all_associated_values(url1 = raw_cookbook?.url1?) ⇒ Object Also known as: guess_entries_based_on_the_first_url

#

parse_url1_and_set_all_associated_values

We will make various changes depending on the url1 entry.

If this entry exists, various data points will be set on the main dataset of this class.

#


2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2794

def parse_url1_and_set_all_associated_values(
    url1 = raw_cookbook?.url1?
  )
  # ======================================================================= #
  # url1 may look like this:
  #
  #  https://www.python.org/ftp/python/3.9.4/Python-3.9.4.tgz
  #
  # ======================================================================= #
  if url1
    # ===================================================================== #
    # Fix .js files.
    # ===================================================================== #
    if url1.end_with? '.js'
      set_archive('.js')
    elsif url1.end_with? '.gem'
      set_archive(url1)
    end
    if url1.include? '%2B' # This means '+'.
      url1.gsub!(/%2B/,'+')
    end
    if url1.include? '-trunk'
      url1 = remove_file_extension(url1)
    end
    if url1.include? '-release.tar'
      url1 = chop_off_archive(url1)
      url1.sub!(/-release/,'')
    end
    # ===================================================================== #
    # === Handle github URLs next
    #
    # Next, check if it is a github url and if it may not have a
    # "-" and if it consists only of numbers; in this case we know
    # we have to determine the program name in a different manner.
    # ===================================================================== #
    if is_github_url?(url1) and
       !File.basename(url1).include?('-')  and
       (url1 =~ /\d{0,2}\.\d{0,2}\.?\d{0,2}/)
       # ================================================================== #
       # In this case we will re-write this URL; and also modify the
       # variable called url1.
       #
       # The current content of url1 may be a String such as:
       #
       #   'https://github.com/opencv/opencv/archive/3.4.5.tar.gz'
       #
       # ================================================================== #
       use_this_regex =
         /\/v?(\d{0,2}\.\d{0,2}\.?\d{0,2})\./ # See: https://rubular.com/r/dvCdVJWbtUhJaJ
       # ================================================================== #
       # We must use the unmodified input-name here because that name may
       # still include '-' characters, which may be important for some
       # programs. Unfortunately this is not always available, such as
       # for:
       #
       #   https://github.com/kdave/btrfs-progs/archive/refs/tags/v5.11.1.tar.gz
       #
       # Thus, we will default to original_unmodified_name?, but we
       # will try to determine whether the "/"-splitted third part
       # contains a '-' character. If so then this name is used
       # instead. The explanation can be seen by the text
       # given above.
       # ================================================================== #
       replacement_name = original_unmodified_name?.to_s.dup
       if url1.include? '/'
         splitted = url1.split('/')
         if splitted[4] and splitted[4].include?('-')
           replacement_name = splitted[4]
         end
       end
       url1.sub!(
         use_this_regex,
         '/'+replacement_name+'-\1.'
       )
    end
  end
  # ======================================================================= #
  # Note that url1 may also be invalid, such as by having this as
  # content:
  #
  #   cmake@3.22.4
  #
  # In this case we will simply rewrite this towards cmake-3.22.4.
  # ======================================================================= #
  if url1 and url1.include?('@')
    url1.tr!('@','-')
  end
  if url1
    url1 = remove_archive_at_the_end(File.basename(url1))
  end
  program_information = ProgramInformation.new(url1)
  set_short_name(program_information.short_name?)                                   # (1) short_name, such as 'gnomemahjongg'
  set_program_name(program_information.program_name?)                               # (2) program_name, such as 'gnome-mahjongg'
  set_program_version(program_information.program_version?)                         # (3) program_version
  set_program_name_and_program_version("#{program_name?}-#{program_version?}")      # (4) program_name_and_program_version
  set_program_full_name(program_name_and_program_version?+archive_type?)            # (6) program_full_name, such as 'gnome-mahjonng-5.08.tar.xz'
  set_base_dir(:default)                                                            # (7) base_dir
  _ = base_dir?.to_s+
      program_name?.to_s+'-'+
      program_version?.to_s+
      archive_type?.to_s
  set_program_path(_)                                                               # (8) program_path
  unless File.exist? _
    try_to_find_another_local_file(_)
    set_program_path
  end
end

#pkgconfig_files?Boolean Also known as: pkgconfig_files

#

pkgconfig_files?

#

Returns:

  • (Boolean)


1411
1412
1413
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1411

def pkgconfig_files?
  obtain(__method__.to_s.delete('?').to_sym)
end

#populate_the_dataset_variable(i = simple_or_complex? ) ⇒ Object

#

populate_the_dataset_variable

#


2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2716

def populate_the_dataset_variable(
    i = simple_or_complex?
  )
  initialize_the_main_hash_with_default_values # First, fill the dataset with default values.
  case i
  # ======================================================================= #
  # === :simple
  #
  # If we make use of the simple dataset then we do not have to sync the
  # value back onto RawCookbook.
  # ======================================================================= #
  when :simple
    # ===================================================================== #
    # In this case we have to do sanitizing stuff.
    # ===================================================================== #
    merge_in_the_dataset_derived_from_the_raw_cookbook # must come after we instantiated the raw cookbook
  # ======================================================================= #
  # === :complex
  #
  # In this case we can simply query from the raw-cookbook dataset.
  # ======================================================================= #
  when :complex
    raw_cookbook?.set_complex # Pass the info to the raw-cookbook as well.
    allowed_cookbook_entries?.each {|this_entry|
      _ = ("#{this_entry.to_s}?").to_sym
      if raw_cookbook?.respond_to? _
        dataset?[this_entry.to_sym] = raw_cookbook?.send(_)
      else
        # e '  Notice: the object does not respond to '+steelblue(_)+'.'
      end
    }
    determine_all_relevant_values_for_the_dataset_variable
  end
end

#postinstall?Boolean Also known as: postinstallation?

#

postinstall?

#

Returns:

  • (Boolean)


1361
1362
1363
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1361

def postinstall?
  obtain(__method__.to_s.delete('?').to_sym)
end

#pre_configure_steps?Boolean

#

pre_configure_steps?

#

Returns:

  • (Boolean)


1404
1405
1406
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1404

def pre_configure_steps?
  obtain(__method__.to_s.delete('?').to_sym)
end

#pre_make_commands?Boolean Also known as: pre_make_commands

#

pre_make_commands?

#

Returns:

  • (Boolean)


1382
1383
1384
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1382

def pre_make_commands?
  obtain(__method__.to_s.delete('?').to_sym)
end

#pre_make_install_sed?Boolean Also known as: pre_make_install_sed

#

pre_make_install_sed?

#

Returns:

  • (Boolean)


5439
5440
5441
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5439

def pre_make_install_sed?
  obtain __method__.to_s.delete('?').to_sym
end

#prefix?Boolean Also known as: prefix, prefix_to_use?

#

prefix?

Query the prefix in use by our sought program.

#

Returns:

  • (Boolean)


5655
5656
5657
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5655

def prefix?
  obtain __method__.to_s.delete('?').to_sym
end

#preinstall?Boolean

#

preinstall?

#

Returns:

  • (Boolean)


3192
3193
3194
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3192

def preinstall?
  obtain(__method__.to_s.delete('?').to_sym)
end

#program?Boolean

#

program?

#

Returns:

  • (Boolean)


5300
5301
5302
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5300

def program?
  first_argument?
end

#program_compile_name?Boolean

#

program_compile_name?

This will be guaranteed to be a String.

#

Returns:

  • (Boolean)


5323
5324
5325
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5323

def program_compile_name?
  obtain(__method__.to_s.delete('?').to_sym).to_s
end

#program_full_name?Boolean Also known as: program_full_name, full_program_name?

#

program_full_name?

This entry will have everything except the leading PATH.

For instance:

"gpm-1.20.1.tar.xz"
#

Returns:

  • (Boolean)


5615
5616
5617
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5615

def program_full_name?
  obtain __method__.to_s.delete('?').to_sym
end

#program_name?Boolean Also known as: name_and_version?, pname?, program_name

#

program_name?

This method is a reader-method over e. g. ‘gnome-mahjongg’.

It does NOT have the version of the program included, which is a different behaviour enabled during May 2020.

#

Returns:

  • (Boolean)


5477
5478
5479
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5477

def program_name?
  obtain __method__.to_s.delete('?').to_sym
end

#program_name_and_program_version?Boolean Also known as: program_name_and_program_version, program_name_and_version?, program_name_and_the_program_version?, return_program_name_and_program_version

#

program_name_and_program_version?

Note that the connective token in use is usually ‘-’, but there are programs such as ‘artemis_v16.0.11.jar’ that have no ‘-’ at all whatsoever. To also honour such programs, we have to use this connective token - it will be re-defined towards ‘_’ specifically for programs that have no ‘-’ token, such as artemis.

#

Returns:

  • (Boolean)


5336
5337
5338
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5336

def program_name_and_program_version?
  obtain __method__.to_s.delete('?').to_sym
end

#program_path?Boolean Also known as: local_url?, full_path, full_path?, location?, can_be_found_where?, stored_where?, program_path, path?, path, ppath?, full_program_path?, local_path?, local_path

#

program_path?

This method will return the ‘program_path’ value, through the reader method obtain().

The program_path variable has the FULL path to the archive in question, for instance:

/home/x/src/gnomemahjonng/gnome-mahjonng-5.08.tar.xz
/home/x/src/gpm/gpm-1.20.1.tar.bz2
/home/x/src/gambas3/gambas3-3.10.0.tar.xz
base_dir? ^^^^^^^^^ program_full_name? ^^^

It consists of base_dir?+program_full_name?.

Do note that the program_path value is the most important entry, as ALL the other information can be derived from the information stored in this variable alone.

#

Returns:

  • (Boolean)


1304
1305
1306
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1304

def program_path?
  obtain(__method__.to_s.delete('?').to_sym)
end

#program_version?Boolean Also known as: version, version?, pversion?, program_version, return_program_version

#

program_version?

This method must always return a String.

We use it to query the program version of the specific program at hand.

For instance, if the program name is “python-2.4” then this method will return the version string part, i.e. “2.4”.

#

Returns:

  • (Boolean)


5407
5408
5409
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5407

def program_version?
  obtain __method__.to_s.delete('?').to_sym
end

#properly_pad_and_colourize_this_help_option(key_to_invoke_the_method, text_that_is_to_be_displayed) ⇒ Object

#

properly_pad_and_colourize_this_help_option

#


4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4438

def properly_pad_and_colourize_this_help_option(
    key_to_invoke_the_method,
    text_that_is_to_be_displayed
  )
  left_padding = '  ' # A bit of left-padding here.
  n_left_pad_value  = 38
  n_left_pad_value -= key_to_invoke_the_method.size
  left_padding+HOW_TO_INVOKE_THE_PROGRAM+
               skyblue(' '+key_to_invoke_the_method)+
               (' ' * n_left_pad_value)+' # '+
               text_that_is_to_be_displayed
end

#query_for(i) ⇒ Object

#

query_for

This method is a more general query-method for certain data stored in the Cookbook class.

For example: the input String ‘Compiling this program:’ will yield the name of the program that the cookbook class currently holds.

The primary use case is for the Flexbox class.

#


4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4248

def query_for(i)
  _ = i.to_s.dup
  _.chop! if _.end_with? ':'
  case _
  # ======================================================================= #
  # === "Homepage"
  # ======================================================================= #
  when /^Homepage$/i
    homepage_url?
  # ======================================================================= #
  # === program_name_and_program_version?
  # ======================================================================= #
  when /^program(-|_| )?name(-|_| )?and(-|_| )?program(-|_| )?version\??$/i
    program_name_and_program_version?
  # ======================================================================= #
  # === extract_to?
  # ======================================================================= #
  when /^extract(-|_| )?to\??$/i
    extract_to?
  # ======================================================================= #
  # === "Build system to be used:"
  # ======================================================================= #
  when /^Build(-|_| )?system(-|_| )?to(-|_| )?be(-|_| )?used$/i
    use_this_build_system?
  # ======================================================================= #
  # === "configure options"
  # ======================================================================= #
  when /^configure(-|_| )?options\??$/i
    configure_options?
  # ======================================================================= #
  # === "URL to the source archive"
  # ======================================================================= #
  when /^URL(-|_| )?to(-|_| )?the(-|_| )?source(-|_| )?archive$/i
    url_to_the_source_archive?
  # ======================================================================= #
  # === "Keep the archive extracted"
  # ======================================================================= #
  when /^Keep(-|_| )?the(-|_| )?archive(-|_| )?extracted$/i
    keep_the_archive_extracted?
  # ======================================================================= #
  # === "Program path"
  # ======================================================================= #
  when /^Program(-|_| )?path$/i
    program_path?
  # ======================================================================= #
  # === "Program version"
  # ======================================================================= #
  when /^Program(-|_| )?version$/i
    program_version?
  # ======================================================================= #
  # === "Compiling this program"
  # ======================================================================= #
  when /^Compiling(-|_| )?this(-|_| )?program$/i,
       /^Installing(-|_| )?this(-|_| )?program$/i,
       /^Extracting(-|_| )?this(-|_| )?program$/i
    short_name?
  # ======================================================================= #
  # === "Prefix"
  # ======================================================================= #
  when /^Prefix$/i
    prefix?
  else
    e crimson("Unhandled input to #{__method__}: #{_}")
  end
end

#quiet_downObject

#

quiet_down

This method will cause the cookbook to be silent and not report how many programs are registered.

#


3148
3149
3150
3151
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3148

def quiet_down
  set_be_silent # This is defined in the parent class.
  @internal_hash[:report_how_many_programs_are_registered] = false
end

#raw_cookbook?Boolean

#

raw_cookbook?

#

Returns:

  • (Boolean)


4947
4948
4949
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4947

def raw_cookbook?
  @internal_hash[:raw_cookbook]
end

#raw_cookbook_dataset?Boolean Also known as: raw_dataset?

#

raw_cookbook_dataset?

#

Returns:

  • (Boolean)


4954
4955
4956
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4954

def raw_cookbook_dataset?
  @internal_hash[:raw_cookbook] and raw_cookbook?.dataset?
end

#raw_descriptionBoolean

#

description?

In the past raw_description? was guaranteed to return the unmodified description, including newlines.

During the rewrite in April 2021, this no longer seemed necessary, as the sanitization-logic was changed.

#

raw_description

Returns:

  • (Boolean)


1377
1378
1379
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1377

def description?
  obtain(__method__.to_s.delete('?').to_sym)
end

#raw_description?Boolean

#

description?

In the past raw_description? was guaranteed to return the unmodified description, including newlines.

During the rewrite in April 2021, this no longer seemed necessary, as the sanitization-logic was changed.

#

raw_description?

Returns:

  • (Boolean)


1376
1377
1378
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1376

def description?
  obtain(__method__.to_s.delete('?').to_sym)
end

#raw_yaml_file?Boolean

#

raw_yaml_file?

#

Returns:

  • (Boolean)


5002
5003
5004
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5002

def raw_yaml_file?
  raw_cookbook?.yaml_file?
end

#reassemble_the_program_path(i = return_default_program_path) ⇒ Object Also known as: assemble_program_path, reassemble_program_path

#

reassemble_the_program_path

This method will always ultimate attempt to set the program path, if possible.

#


2908
2909
2910
2911
2912
2913
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2908

def reassemble_the_program_path(
    i = return_default_program_path
  )
  assemble_the_default_program_name_and_program_version # Assign to something such as: "gnome-mahjongg-0.1.3"
  set_program_path(i)
end

#rebuild_program_full_nameObject Also known as: update_program_full_name

#

rebuild_program_full_name

#


3114
3115
3116
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3114

def rebuild_program_full_name
  set_program_full_name(:default)
end
#
#

Returns:

  • (Boolean)


5261
5262
5263
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5261

def recommended_deps_on?
  obtain __method__.to_s.delete('?').to_sym
end

#replace_plus_with_long_name?Boolean

#

replace_plus_with_long_name?

#

Returns:

  • (Boolean)


1487
1488
1489
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1487

def replace_plus_with_long_name?
  @internal_hash[:replace_plus_with_long_name]
end

#reportObject Also known as: feedback, feedback_colourized_result, print_hash, display_all, full_report

#

report

This is just a general-purpose method that will output some values.

It will output useful information about a program.

For a full report system, use the specialized class DisplayCookbookDataset.

#


2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2077

def report
  program_name = seek_which_program?
  return if program_name.to_s.empty?
  array_show_these_entries?.clear
  append_to_array_show_these_entries(:mode_in_use)
  # ======================================================================= #
  # === short_description
  # ======================================================================= #
  unless short_description?.empty?
    append_to_array_show_these_entries(:short_description)
  end if short_description?
  # ======================================================================= #
  # Add a bunch of symbols to the main array here.
  # ======================================================================= #
  append_to_array_show_these_entries(%i( description ))
  unless extra_information?.empty?
    append_to_array_show_these_entries(:extra_information)
  end if extra_information?
  append_to_array_show_these_entries(%i(
    program_path
    base_dir
    program_full_name
    program_name_and_program_version
    program_version
    archive_type
    short_name
    program_name
    url1
    url2
  ))
  # ======================================================================= #
  # === Show the main homepage if it exists
  # ======================================================================= #
  if homepage?
    append_to_array_show_these_entries(:homepage)
  end
  if flatpak_url? and !flatpak_url?.empty?
    append_to_array_show_these_entries(:flatpak_url)
  end
  # ======================================================================= #
  # Unless the pkgconfig_files Array is empty, we will display the
  # .pc files of the given program.
  # ======================================================================= #
  if pkgconfig_files?
    unless pkgconfig_files?.empty?
      append_to_array_show_these_entries(:pkgconfig_files)
    end
  end
  # ======================================================================= #
  # === Display installation_steps if they are not empty
  # ======================================================================= #
  if installation_steps? and !installation_steps?.empty?
    append_to_array_show_these_entries(:installation_steps)
  end
  # ======================================================================= #
  # === Display the configure command to use next
  # ======================================================================= #
  if configure_command_to_use?
    unless configure_command_to_use?.empty?
      unless configure_command_to_use? == 'configure'
        append_to_array_show_these_entries(:configure_command_to_use)
      end
    end
  end
  # ======================================================================= #
  # === Add the .gir-files, if they exist
  # ======================================================================= #
  if gir_files?
    unless gir_files?.empty?
      append_to_array_show_these_entries(:gir_files)
    end
  end
  if program_compile_name? and !program_compile_name?.empty?
    append_to_array_show_these_entries(:program_compile_name)
  end
  # ======================================================================= #
  # === Add the headers, if they exist
  # ======================================================================= #
  if headers?
    unless headers?.empty?
      append_to_array_show_these_entries(:headers)
    end
  end
  if binaries?
    append_to_array_show_these_entries(:binaries) unless binaries?.empty?
  end
  if libraries?
    append_to_array_show_these_entries(:libraries) unless libraries?.empty?
  end
  append_to_array_show_these_entries(%i( prefix ))
  if configure_base_dir? and !configure_base_dir?.to_s.empty?
    append_to_array_show_these_entries(:configure_base_dir)
  end
  append_to_array_show_these_entries(
    %i(
      extract_to
      configure_options
      meson_configure_options
      md5sum
      file_size
      keep_extracted
    )
  )
  if build_static? == true
    append_to_array_show_these_entries(:build_static)
  end
  unless use_this_make_command?.to_s == 'make'
    append_to_array_show_these_entries(:use_this_make_command)
  end
  if sed? and sed?.is_a?(Array) and !sed?.empty?
    append_to_array_show_these_entries(:sed)
  end
  append_to_array_show_these_entries(:do_not_download) if do_not_download?
  append_to_array_show_these_entries(:apply_patch)     if apply_patch?
  if deps?
    append_to_array_show_these_entries(:required_deps_on) unless deps?.empty?
  end
  if make_options?
    unless make_options?.empty? # Only show the make_options if they are not empty.
      append_to_array_show_these_entries(:make_options)
    end
  end
  append_to_array_show_these_entries(:enable_shared) # if enable_shared?
  if preinstall?
    append_to_array_show_these_entries(:preinstall) unless preinstall?.empty?
  end
  if postinstall?
    append_to_array_show_these_entries(:postinstall) unless postinstall?.empty?
  end
  append_to_array_show_these_entries(:tags)                unless tags?.empty?
  append_to_array_show_these_entries(:svn_url)             if svn_url? and !svn_url?.empty?
  append_to_array_show_these_entries(:git_url)             if git_url? and !git_url?.empty?
  append_to_array_show_these_entries(:pre_make_commands)   unless pre_make_commands?.empty?
  append_to_array_show_these_entries(:use_build_directory) if use_build_directory?
  append_to_array_show_these_entries(:manual_steps)        if manual_steps? and !manual_steps?.empty?
  append_to_array_show_these_entries(:licence) # ← Mandatory entry.
  # ======================================================================= #
  # === use_this_build_system will always be shown
  # ======================================================================= #
  append_to_array_show_these_entries(:use_this_build_system) # ← Mandatory entry.
  # ======================================================================= #
  # === Use autogen will always be shown.
  # ======================================================================= #
  append_to_array_show_these_entries(:use_autogen)
  append_to_array_show_these_entries(:has_to_be_compiled)
  append_to_array_show_these_entries(:last_update)
  append_to_array_show_these_entries(:do_not_symlink) if do_not_symlink?
  append_to_array_show_these_entries(:md5sum)         if show_md5sum?
  append_to_array_show_these_entries(:use_this_make_install_command) if use_this_make_install_command?
  # ======================================================================= #
  # Show whether we will run "configure" or whether we will not:
  # ======================================================================= #
  append_to_array_show_these_entries(:run_configure)  if run_configure?
  # ======================================================================= #
  # Display the BLFS entry fairly close to the bottom.
  # ======================================================================= #
  append_to_array_show_these_entries(:blfs)           unless blfs?.empty?
  # ======================================================================= #
  # Next, display it with a coloured "border".
  # ======================================================================= #
  use_this_colour_or_no_colour = :lightblue
  unless use_colours?
    use_this_colour_or_no_colour = :do_not_use_colours
  end
  array_show_these_entries?.flatten!
  array_display_these_entries = array_show_these_entries?
  cliner(use_this_colour_or_no_colour) {
    e "#{rev}Feedbacking all about the program "\
      "`#{mediumslateblue(program_name)}#{rev}`, "\
      "#{rev}taken from the file"
    e "`#{sfile(which_file?)}#{rev}`."
    e
    # ===================================================================== #
    # Next, use a dedicated method to display all the individual
    # components:
    # ===================================================================== #
    show_this_dataset_containing_which_entries_should_be_displayed(
      array_display_these_entries
    )
    # ===================================================================== #
    # Show important URLs next.
    # ===================================================================== #
    if urls?.first
      e; e '  Important URLs:'
      _ = urls?.map {|entry| entry.to_s.chomp }.reject {|x| x.empty?}
      if _
        e; _.each_with_index {|line, index|
          e "#{grey('    (')}#{seagreen(index+1).to_s}#{grey(') ')}#{grey(line)}"
        }; e
      end
    end
  }
  e
end

#report_binary_or_library_program_name(i, new_program_name, binary_or_library = 'binary') ⇒ Object

#

report_binary_or_library_program_name

Only call this method when we have found an alias.

#


2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2943

def report_binary_or_library_program_name(
    i,
    new_program_name,
    binary_or_library = 'binary'
  )
  if i and !i.empty?
    case binary_or_library
    # ===================================================================== #
    # === :binary
    # ===================================================================== #
    when :binary
      binary_or_library = 'binary'
    # ===================================================================== #
    # === :library
    # ===================================================================== #
    when :library
      binary_or_library = 'library'
    end
    opne '`'+simp(i)+rev+'` was found as name of a '+
         simp(binary_or_library)+rev+' file.'
    opne 'We will now assume that you want to get this '\
         'whole package instead and will'
    opne 'thus set the name to this program now, which belongs to '\
         'the package `'+sfancy(new_program_name)+rev+'`.'+N
  end
end

#required_deps_on?Boolean Also known as: program_dependencies_on, deps_on?, dependencies_on?, return_dependencies, required_deps?, dependencies?, required_dependencies_on?, deps?

#

required_deps_on?

This method will list the required dependencies of a given program and returns them, at least those that are defined in the ‘required_deps_on:’ entry of the respective yaml file.

Please keep in mind that our dependencies must be kept in Array form.

#

Returns:

  • (Boolean)


5565
5566
5567
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5565

def required_deps_on?
  obtain __method__.to_s.delete('?').to_sym
end

#resetObject

#

reset (reset tag)

#


367
368
369
370
371
372
373
374
375
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 367

def reset
  super()
  infer_the_namespace
  initialize_the_internal_hash
  # ======================================================================= #
  # === :use_colours
  # ======================================================================= #
  set_use_colours
end

#reset_the_datasetObject

#

reset_the_dataset

#


556
557
558
559
560
561
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 556

def reset_the_dataset
  # ======================================================================= #
  # === :dataset
  # ======================================================================= #
  @internal_hash[:dataset] = {}
end

#return_appdir_prefix(programs_dir_to_use = programs_dir?, , short_name_to_use = short_name?.capitalize, program_version_to_use = program_version? ) ⇒ Object Also known as: return_appdir_path, build_appdir_path

#

return_appdir_prefix

This method will return an App-Dir like path of the given program at hand, such as “ffmpeg” or “php”.

It is typically called from within the method called .sanitize_the_prefix(). In other words, whenever we need to sanitize the prefix passed this method will be called.

This method requires that short_name? and program_version? were already defined prior to its invocation.

The appdir components would be like this:

/home//Programs/Ruby/2.4.1/
programs_dir?+short_name?.capitalize+'/'+program_version?
#


5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5519

def return_appdir_prefix(
    programs_dir_to_use    = programs_dir?, 
    short_name_to_use      = short_name?.capitalize,
    program_version_to_use = program_version?
  )
  _ = programs_dir_to_use.dup
  if are_we_on_gobolinux?
    _ << program_compile_name?.dup
  else
    _ << short_name_to_use.dup
  end
  _ << "/#{program_version_to_use.dup}/"
  return _
end

#return_default_location_of_this_cookbook(i = search_which_program? ) ⇒ Object Also known as: return_default_location, yaml_file?

#

return_default_location_of_this_cookbook

This will use the default location based on the search_term.

#


4992
4993
4994
4995
4996
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4992

def return_default_location_of_this_cookbook(
    i = search_which_program?
  )
  "#{individual_cookbooks_directory?}#{i}.yml"
end

#return_default_program_full_name(i = program_name_and_program_version?.to_s+ archive_type?.to_s) ⇒ Object Also known as: return_program_full_name

#

return_default_program_full_name

program_full_name (entry 6) is something like:

'gnome-mahjonng-5.08.tar.xz'

so this is program_name_and_program_version?+archive_type?

#


4527
4528
4529
4530
4531
4532
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4527

def return_default_program_full_name(
    i = program_name_and_program_version?.to_s+
        archive_type?.to_s
  )
  return i
end

#return_default_program_pathObject Also known as: return_program_path

#

return_default_program_path

This is entry number (8), program_path, which will look like:

'/home/x/src/gnomemahjongg/gnome-mahjonng-5.08.tar.xz' # base_dir?+program_full_name?
'/home/x/src/gnomemahjongg/' + 'gnome-mahjonng-5.08.tar.xz'
#


4667
4668
4669
4670
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4667

def return_default_program_path
  base_dir?+
  program_full_name?
end

#return_first_dot_as_hyphen_from_this_url(i = url1?) ) ⇒ Object

#

return_first_dot_as_hyphen_from_this_url

#


4861
4862
4863
4864
4865
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4861

def return_first_dot_as_hyphen_from_this_url(i = url1?)
  new_url = File.basename(i).dup # Obtain the URL here.
  new_url.sub!(/\./,'-') # This replaces only the first '.' found.
  return new_url
end

#return_first_underscore_as_hyphen_and_other_undscores_as_dots(i = url?) ) ⇒ Object

#

return_first_underscore_as_hyphen_and_other_undscores_as_dots

This method exists specifically for input such as ‘boost_1_61_0’.

#


5035
5036
5037
5038
5039
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5035

def return_first_underscore_as_hyphen_and_other_undscores_as_dots(i = url?)
  i = return_first_underscore_as_hyphen_from_this_url(i).dup
  i.tr!('_','.')
  return i
end

#return_first_underscore_as_hyphen_from_this_url(i = url1? ) ⇒ Object

#

return_first_underscore_as_hyphen_from_this_url

#


4649
4650
4651
4652
4653
4654
4655
4656
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4649

def return_first_underscore_as_hyphen_from_this_url(
    i = url1?
  )
  new_url = File.basename(i).dup # Obtain the URL here.
  new_url.sub!(/_/,'-') # This replaces only the first '_' found.
  new_url = remove_archive_from_the_end(new_url)
  return new_url
end

#return_middle_part_of_the_program_version(program_version = program_version? ) ⇒ Object

#

return_middle_part_of_the_program_version

#


4551
4552
4553
4554
4555
4556
4557
4558
4559
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4551

def return_middle_part_of_the_program_version(
    program_version = program_version?
  )
  result = program_version.dup
  if result.include? '.'
    result = result.split('.')[1]
  end
  return result
end

#return_program_name_from_the_raw_cookbookObject

#

return_program_name_from_the_raw_cookbook

#


5087
5088
5089
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5087

def return_program_name_from_the_raw_cookbook
  raw_cookbook?.program_name?
end

#return_program_version_from_the_raw_cookbookObject

#

return_program_version_from_the_raw_cookbook

#


5111
5112
5113
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5111

def return_program_version_from_the_raw_cookbook
  raw_cookbook?.program_version?
end

#return_proper_type_for(i = :required_deps_on) ⇒ Object

#

return_proper_type

This will return the proper default time, such as [] or ” and so forth.

#


3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3489

def return_proper_type_for(i = :required_deps_on)
  file = ::RBT.file_specification_of_registered_cookbook_entries
  if File.exist? file
    _ = YAML.load_file(file)
    if _.include? i.to_s
      assumed_type = _[i.to_s]
      case assumed_type
      when 'Array'
        return []
      else
        e tomato('Unhandled type: ')+
          steelblue(assumed_type.to_s)
      end
    end
  end
  return nil
end

#return_sanitize_url1(i = url1? ) ⇒ Object

#

return_sanitize_url1

This can be considered almost equaly to the old “sanitize_url1” method.

#


4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4929

def return_sanitize_url1(
    i = url1?
  )
  i = i.dup
  # ======================================================================= #
  # === Handle "llvm-10.0.0.src.tar.xz" and similar cases next
  # ======================================================================= #
  if i
    i.sub!(/\.src\./,'')          if i.include?  '.src.' # For doxygen.yml
    i.sub!(/-src/,'')             if i.include?  '-src' # For zatacka.yml
    i.delete_suffix!('/download') if i.end_with? '/download'
  end
  return i
end

#return_sanitized_program_name_and_program_version(i = program_name_and_program_version?.dup, url = url1?.dup) ⇒ Object

#

return_sanitized_program_name_and_program_version

This method will also get rid of archives.

A full program_name_and_program_version would be something like:

'gnome-mahjonng-5.08'

 (2) program_name                      like 'gnome-mahjongg'
#


4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4685

def return_sanitized_program_name_and_program_version(
    i   = program_name_and_program_version?.dup,
    url = url1?.dup
  )
  case i # case tag
  # ======================================================================= #
  # === USE_URL_DOWNCASE
  #
  # Use the URL as program name but downcase it.
  # ======================================================================= #
  when 'USE_URL_DOWNCASE',
       'USE_DOWNCASED'
    i = File.basename(url.downcase)
  # ======================================================================= #
  # === FIRST_UNDERSCORE_AS_HYPHEN
  #
  # This will convert input such as 'boost_1_61_0' into 'boost-1_61_0'.
  # ======================================================================= #
  when 'FIRST_UNDERSCORE_AS_HYPHEN',
       'FIRST_UNDERSCORE_IS_HYPHEN',
       'USE_URL_REPLACE_UNDERSCORE'
    i = return_first_underscore_as_hyphen_from_this_url(url)
  # ======================================================================= #
  # === PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET
  #
  # This entry point has been specifically added for the program "brotli",
  # but also other programs that would fall into that scheme.
  #
  # Brotli has an URL like this:
  #
  #   https://github.com/google/brotli/archive/v1.0.7/brotli-v1.0.7.tar.gz
  #
  # The annoying part is the very last 'v'. If you extract this archive
  # then the resulting directory name is "brotli-1.0.7", so the folks
  # who packaged this archive evidently are very clueless. But even
  # aside from this, the issue is that the RBT project may have to guess
  # and infer the correct program version, which should not include the
  # 'v' character anyway. The following when-entry ensures precisely
  # this: all alphabet-characters will be dropped from the program
  # version.
  #
  # This entry point has been added on 30.11.2019.
  #
  # Note that PROGRAM_VERSION is not exactly the same, since it will
  # ONLY modify the program version; it will NOT change the name of
  # the program at hand.
  #
  # Keep in mind that the input may be incomplete, such as in the
  # String "ninja-PROGRAM_VERSION".
  # ======================================================================= #
  when /^PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET$/,
       /^PROGRAM_VERSION$/,
       /-PROGRAM_VERSION$/
    program_version = program_version?
    if program_version.nil? or program_version.empty?
      _ = remove_archive_from_the_end(File.basename(url1?.dup))
      _.delete!('a-z')
      _[0,1] = '' if _.start_with? '-'
      program_version = _
    end
    if    i.include? 'PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET'
      use_this_as_program_short_name = program_short_name?
      if use_this_as_program_short_name.nil? or
         use_this_as_program_short_name.empty?
        use_this_as_program_short_name = ProgramInformation.return_short_name(
          remove_archive_from_the_end(
            File.basename(url1?.dup)
          )
        )
      end
      i.sub!(/PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET/,
        use_this_as_program_short_name+'-'+program_version)
    elsif i.include? 'PROGRAM_VERSION'
      i.sub!(/PROGRAM_VERSION/, program_version)
    end
    i.squeeze!('.')
  # ======================================================================= #
  # === USE_URL_LAST_HYPHEN_IS_DOT
  #
  # This entry point will convert the last hyphen, aka '-', into a '.'
  # dot. The input may be 'ImageMagick-7.0.8-27' and it will then
  # become 'ImageMagick-7.0.8.27'.
  # ======================================================================= #
  when /^USE_URL_LAST_HYPHEN_IS_DOT$/
    _ = File.basename(url1?)
    i = remove_archive_from_the_end(_)
    i = i.reverse.sub(/-/,'.').reverse
  # ======================================================================= #
  # === FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS
  #
  # This is due to boost again - apparnetly the boost developers make
  # use of a very strange packaging schemata.
  #
  # So this entry point will convert input such as 'boost_1_61_0' into
  # 'boost-1.61.0'.
  # ======================================================================= #
  when 'FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS'
    i = return_first_underscore_as_hyphen_and_other_undscores_as_dots(url)
  # ======================================================================= #
  # === FIRST_DOT_AS_HYPHEN
  #
  # The following case is for input such as "sendmail.5.2.18"
  # which should become "sendmail-5.2.18".
  #
  # We only manipulate the last part though, so if we have input that
  # contains a '/', we assume that this is a path and split it up.
  # This is the reason why we will use File.basename()
  # ======================================================================= #
  when 'FIRST_DOT_AS_HYPHEN'
    i = return_first_dot_as_hyphen_from_this_url(url)
  # ======================================================================= #
  # === URL_REPLACE_UNDERSCORE
  #
  # This entry point handles the case when the input has '_' characters
  # in the String. If this is the case then all '_' will be replaced
  # via '-' characters.
  # ======================================================================= #
  when 'URL_REPLACE_UNDERSCORE',
       'URL_CONVERT_UNDERSCORE',
       'USE_URL_SANITIZED',
       'REPLACE_UNDERSCORES',
       'USE_URL_MIDDLE_HYPHENS'
    i = return_url_replace_underscore(url)
  # ======================================================================= #
  # === USE_URL
  #
  # Simply use the URL as-is, for the program name.
  # ======================================================================= #
  when 'USE_URL'
    i = url
  else
    # ===================================================================== #
    # Handle github-specific links next.
    # ===================================================================== #
    if i and
       is_github_url? and
       i.start_with?('v-') and
       (i =~ /v-\d{0,2}.\d{1,2}.\d{1,2}/) # See: http://rubular.com/r/tWF7ikLZiw
      # =================================================================== #
      # Ok, we now know that the input is something like 'v-1.11.0'.
      # We must thus sanitize several parts of the dataset.
      # =================================================================== #
      if short_name? == 'v' # ← This must evidently be replaced then.
        set_short_name(
          search_for_this_program?.dup #, :also_set_other_names
        )
        set_program_name
        set_base_dir
        i = program_name?
      end
    end
  end
  # ======================================================================= #
  # Get rid of any .tar.xz or similar archive end here.
  # ======================================================================= #
  i = remove_archive_from_the_end(i)
  return i # We must return something.
end

#return_url_replace_underscore(i = url?) ) ⇒ Object

#

return_url_replace_underscore

#


4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4847

def return_url_replace_underscore(i = url?)
  _ = File.basename(i).dup
  if _.include? '_'
    _.tr!('_','-') # Replace all '_' with '-'.
  elsif _.include? '.' # Else replace just the first '.'.
    _.sub!('.','-')
  end
  _ = remove_file_extension(_)
  return _
end

#return_version_from_url1(use_this_URL = url1? ) ⇒ Object

#

return_version_from_url1

This will return the inferred version from the url1 entry.

#


5150
5151
5152
5153
5154
5155
5156
5157
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5150

def return_version_from_url1(
    use_this_URL = url1?
  )
  _ = remove_archive_at_the_end(
    File.basename(use_this_URL)
  )
  program_information_return_version(_)
end

#runObject

#

run (run tag)

#


6267
6268
6269
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6267

def run
  find_this_program
end

#run_configure?Boolean

#

run_configure

#

Returns:

  • (Boolean)


5496
5497
5498
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5496

def run_configure?
  obtain __method__.to_s.delete('?').to_sym
end

#run_make?Boolean Also known as: run_make

#

run_make?

#

Returns:

  • (Boolean)


1185
1186
1187
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1185

def run_make?
  obtain(__method__.to_s.delete('?').to_sym)
end

#sanitize_autogenObject

#

sanitize_autogen

#


538
539
540
541
542
543
544
545
546
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 538

def sanitize_autogen
  _ = raw_cookbook?.use_autogen?
  if _.nil?
    _ = use_autogen?
  end
  set_use_autogen(
    to_bool(_)
  )
end
#
#


761
762
763
764
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 761

def sanitize_autosymlink_lib64
  _ = raw_cookbook?.autosymlink_lib64?
  set_autosymlink_lib64(_)
end

#sanitize_base_dirObject

#

sanitize_base_dir

#


276
277
278
279
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 276

def sanitize_base_dir
  _ = base_dir?.to_s
  set_base_dir(_)
end

#sanitize_blfs_entryObject Also known as: sanitize_BLFS_entry

#

sanitize_blfs_entry

This will be only synced if we actually have an entry.

The BLFS entry must be guaranteed to be an Array.

#


997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 997

def sanitize_blfs_entry
  _ = raw_cookbook?.blfs?
  if _
    unless _.is_a? Array
      if _.nil?
        _ = []
      elsif _.empty?
        _ = [] # Empty Array then.
      else
        _ = [_]
      end
    end
    set_blfs(_)
  else # Set it to be an empty Array by default, in this case.
    set_blfs []
  end
end

#sanitize_build_staticObject

#

sanitize_build_static

#


1339
1340
1341
1342
1343
1344
1345
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1339

def sanitize_build_static
  _ = raw_cookbook?.build_static?
  if _.nil?
    _ = build_static?
  end
  set_build_static(to_bool(_))
end

#sanitize_can_be_compiled_staticallyObject

#

sanitize_can_be_compiled_statically

#


769
770
771
772
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 769

def sanitize_can_be_compiled_statically
  _ = raw_cookbook?.can_be_compiled_statically?
  set_can_be_compiled_statically(to_bool(_))
end

#sanitize_cmake_configure_optionsObject

#

sanitize_cmake_configure_options

This method is similar to the method that will sanitize the configure options, but it is only valid for cmake, not for GNU autoconfigure.

A similar method exists for meson-configure-options by the way.

#


442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 442

def sanitize_cmake_configure_options
  _ = cmake_configure_options?
  if _.nil?
    if raw_cookbook?.cmake_configure_options?
      _ = raw_cookbook?.cmake_configure_options?
    end
  end
  if _ and !_.empty?
    _ = _.to_s.strip
    # ===================================================================== #
    # We will assume this to be a comment, so we have to remove these
    # comments.
    # ===================================================================== #
    if _.include? ' # '
      _ = remove_comments_from_each_line(_)
    end
    _.tr!(N,' ')
    _.strip!
    set_cmake_configure_options(_)
  end
end

#sanitize_configure_base_dirObject

#

sanitize_configure_base_dir

We must ensure that this variable has a trailing / character.

There are several reasons for this, but one important reason is that class RBT::Compile will do a calculation based on the amount of ‘/’ in the configure_base_dir string. So if we have one more or less ‘/’, the calculation’s result will vary - thus, we must ensure that the ‘/’ is trailing here.

#


292
293
294
295
296
297
298
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 292

def sanitize_configure_base_dir
  _ = raw_cookbook?.configure_base_dir?
  if _.nil?
    _ = configure_base_dir?
  end
  set_configure_base_dir(rds("#{_}/"))
end

#sanitize_configure_command_to_useObject Also known as: sanitize_configure_command

#

sanitize_configure_command_to_use

#


740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 740

def sanitize_configure_command_to_use
  _ = configure_command_to_use?
  if _ and _.empty?
    _ = raw_cookbook?.configure_command_to_use?.to_s # It must be a String.
  end
  if _
    if _.empty? and deps_on? and deps_on?.include?('waf')
      _ = 'waf'
    end
    if _.empty?
      _ = 'configure' # set default, reset every time.
    else
      _ = convert_global_env(_) if _.include? '$'
    end
    set_configure_command_to_use(_)
  end
end

#sanitize_configure_optionsObject

#

sanitize_configure_options (configure tag)

Work on the configure options, i.e. @dataset.

Note that this depends on program_version? having been set properly.

Some options should not be sanitized, such as “-Wno-dev -G Ninja ..” in applications that use the cmake build system, e. g. LLVM.

#


183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 183

def sanitize_configure_options
  # ======================================================================= #
  # We must first check if we are allowed to modify the configure options
  # at all. Some programs, such as openssl, will not allow such
  # modification due to their strange way how they mix different
  # configure-options.
  #
  # There are some exceptions to this, though. Newlines for example
  # can always be removed.
  # ======================================================================= #
  _ = raw_cookbook?.configure_options?.to_s.strip # We don't want newlines.
  if may_we_modify_the_configure_options?
    # ===================================================================== #
    # Get rid of multi-blanks next.
    # ===================================================================== #
    if _
      # =================================================================== #
      # We will assume this to be a comment, so we have to remove these
      # comments.
      # =================================================================== #
      if _.include? ' # '
        _ = remove_comments_from_each_line(_)
      end
      _.squeeze!('/')
      _.gsub!(/#{N}/,' ')
    end
    # ===================================================================== #
    # Treat 'VERSION' as a macro, for expansion.
    # ===================================================================== #
    if _.include? 'PROGRAM_VERSION'
      _.gsub!(/PROGRAM_VERSION/, program_version?.to_s) if _
    elsif _.include? 'VERSION'
      _.gsub!(/VERSION/, program_version?.to_s) if _
    end
    # ===================================================================== #
    # Treat 'CURRENT' as a macro, for expansion.
    # ===================================================================== #
    if _.include? 'CURRENT'
      _.gsub!(/CURRENT/, program_version?.to_s) if _
    end
    # ===================================================================== #
    # === NAME_OF_THE_DISTRIBUTION
    # ===================================================================== #
    if _.include? 'NAME_OF_THE_DISTRIBUTION'
      name = load_yaml(
        "#{project_yaml_directory?}configuration/name_of_the_distribution.yml"
      )
      _.gsub!(/NAME_OF_THE_DISTRIBUTION/, name)
    end
    unless _.empty?
      # =================================================================== #
      # Finally, run through the configure options. If they start with
      # the Strings "enable" or "disable", with or without, we prepend --
      # if this is not yet the case.
      #
      # Since as of September 2011, we will always prepend --, unless
      # the first character already is a '-' (this is done to 
      # =================================================================== #
      splitted = _.split(' ')
      _ = splitted.map {|configure_option|
        # If configure_option =~ /^disable|enable|with|without/
        # ================================================================= #
        # Only add when not yet first char is NOT a '-'.
        # ================================================================= #
        unless configure_option.start_with?('-') or
               configure_option.start_with?('$') or
               configure_option.start_with?('.')
          unless (configure_option == 'Ninja') and
                 splitted.include?('-G') # For cmake variants like: "-G Ninja"
            configure_option.prepend('--')
          end
        end
        # end
        configure_option
      }.join(' ')
    end
    # ===================================================================== #
    # Try to handle $ input.
    # ===================================================================== #
    if _.include? '$'
      unless Object.const_defined? :ConvertGlobalEnv
        require 'convert_global_env'
      end
      _ = ConvertGlobalEnv.convert(_)
    end
  end
  _.tr!(N, ' ') # Replace all newlines again.
  set_configure_options(_) # Last but not least, reassign.
end

#sanitize_configure_options_explainedObject

#

sanitize_configure_options_explained

#


349
350
351
352
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 349

def sanitize_configure_options_explained
  _ = raw_cookbook?.configure_options_explained?.to_s
  set_configure_options_explained(_)
end

#sanitize_descriptionObject

#

sanitize_description (description tag, desc tag)

Get rid of trailing newlines in our description, and apply some other operations.

#


694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 694

def sanitize_description
  _ = description?.to_s.chomp
  _.chop! if _.end_with? '"' # Get rid of leading and trailing ".
  _[0,1] = '' if _.start_with? '"'
  # ======================================================================= #
  # Some macros have to be expanded before we invoke substitute_macros().
  # SELF_NAME is such an example.
  # ======================================================================= #
  if _.include? 'SELF_NAME'
    _.gsub!(/SELF_NAME/, short_name?)
  end
  _ = substitute_macros(_)
  begin # Replace newlines with ' ' characters.
    _ = _.gsub(/#{N}/,' ').squeeze(' ')
  rescue Exception => error
    cliner {
      opne 'An error happened for the description:'
      pp @_
      pp error
    }
  end
  # ======================================================================= #
  # Next, if this is empty, but short_description? is not, then
  # simply copy-paste the content of short_description? onto
  # the main program description.
  # ======================================================================= #
  if _.to_s.empty? and !short_description?.to_s.strip.empty?
    _ = short_description?.dup
  end
  set_description(_)
end

#sanitize_do_not_downloadObject

#

sanitize_do_not_download

#


1268
1269
1270
1271
1272
1273
1274
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1268

def sanitize_do_not_download
  _ = raw_cookbook?.do_not_download?
  if _.nil?
    _ = do_not_download?
  end
  set_do_not_download(to_bool(_))
end
#
#


1066
1067
1068
1069
1070
1071
1072
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1066

def sanitize_do_not_symlink
  _ = raw_cookbook?.do_not_symlink?.to_s
  if _ and _.empty?
    _ = do_not_symlink?.to_s
  end
  set_do_not_symlink(to_bool(_))
end

#sanitize_echo_yesObject

#

sanitize_echo_yes

#


519
520
521
522
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 519

def sanitize_echo_yes
  _ = raw_cookbook?.echo_yes?.to_s
  set_echo_yes(to_bool(_))
end

#sanitize_enable_sharedObject

#

sanitize_enable_shared

#


1295
1296
1297
1298
1299
1300
1301
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1295

def sanitize_enable_shared
  _ = raw_cookbook?.enable_shared?.to_s
  if _ and _.empty?
    _ = enable_shared?.to_s
  end
  set_enable_shared(to_bool(_))
end

#sanitize_enable_staticObject

#

sanitize_enable_static

#


357
358
359
360
361
362
363
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 357

def sanitize_enable_static
  _ = raw_cookbook?.enable_static?.to_s
  if _ and _.empty?
    _ = enable_static?.to_s
  end
  set_do_not_symlink(to_bool(_))
end

#sanitize_env_variablesObject Also known as: sanitize_set_env_variables

#

sanitize_env_variables

This will sanitize ENV variables. The ENV variables must be a Hash at all times.

#


150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 150

def sanitize_env_variables
  # ======================================================================= #
  # Sync it first.
  # ======================================================================= #
  dataset?[:set_env_variables] = raw_cookbook?.set_env_variables?
  _ = set_env_variables?
  if _ and _.is_a? Array # Must also check for nil.
    # ===================================================================== #
    # If it is an Array, then it must be wrong, so correct this here
    # silently. We need a Hash, as specified in the specification.
    # ===================================================================== #
    hash = {}
    _.each {|inner_hash|
      if inner_hash.is_a? Hash
        key   = inner_hash.keys.first
        value = inner_hash.values.first
        hash[key] = value
      end
    }
    dataset?[:set_env_variables] = hash
  end 
end

#sanitize_everything(url1 = raw_cookbook?.url1?, url2 = raw_cookbook?.url2?) ⇒ Object Also known as: sync_everything

#

sanitize_everything (sanitize tag, sanitize everything tag, sync tag, sani tag)

This is the method that will sanitize the whole internal dataset, which is typically derived from a yaml-based dataset, via class RawCookbook.

Some entries have to come in a specific order, since they depend on prior values that were already set correctly.

#


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 26

def sanitize_everything(
    url1 = raw_cookbook?.url1?,
    url2 = raw_cookbook?.url2?
  )
  sanitize_url1(url1) # This must come before we sync program-name-and-program-version.
  sanitize_url2(url2)
  sanitize_program_name_and_program_version # The program name and program version should come quite early.
  sanitize_homepage
  sanitize_wikipedia
  sanitize_md5sum
  sanitize_required_deps_on
  sanitize_BLFS_entry
  sanitize_short_name
  sanitize_description
  sanitize_extra_information
  sanitize_last_update_entry
  sanitize_env_variables
  sanitize_has_to_be_compiled
  sanitize_short_description
  sanitize_pre_configure_steps
  sanitize_is_an_active_project
  sanitize_build_static
  sanitize_can_be_compiled_statically
  sanitize_keep_extracted
  sanitize_program_version
  sanitize_apply_patch
  # ======================================================================= #
  # === Sanitize the Prefix
  #
  # The prefix setting can only be sanitized after the program_version
  # has been sanitized, since the actual prefix may depend on the
  # program version in use, such as for AppDirs.
  # ======================================================================= #
  sanitize_the_prefix # Must come BEFORE we sanitize the post-installation steps.
  # ======================================================================= #
  # === Clean up post-install related activities
  #
  # The clean-up of post-install related activities should only be
  # called after the prefix was already defined, since a few
  # internal-parts of the method sync_postinstall
  # may need to know the real prefix in use.
  # ======================================================================= #
  sanitize_postinstall
  sanitize_sed_entry
  sanitize_the_binaries
  sanitize_the_headers
  sanitize_symlink_headers
  sanitize_the_libraries
  sanitize_configure_command_to_use
  sanitize_configure_options
  sanitize_configure_options_explained
  sanitize_may_we_modify_the_configure_options
  sanitize_cmake_configure_options
  sanitize_meson_configure_options
  sanitize_installation_steps
  sanitize_gir_files
  sanitize_tags
  sanitize_licence
  sanitize_autogen
  sanitize_use_autoconf
  sanitize_pre_make_commands
  sanitize_parameters_to_make
  sanitize_preinstall
  sanitize_git_url
  sanitize_use_this_make_command
  sanitize_use_this_program_name_on_gobolinux
  sanitize_pkgconfig_files
  sanitize_symlink_pkgconfig_files
  sanitize_symlink_headers
  sanitize_run_configure
  sanitize_autosymlink_lib64
  sanitize_do_not_symlink
  sanitize_echo_yes
  sanitize_enable_shared
  sanitize_enable_static
  sanitize_flatpak_url
  sanitize_libexec
  sanitize_m4_files
  sanitize_mirror
  sanitize_symlink_glib_schema
  sanitize_use_this_make_install_command
  sanitize_configure_base_dir
  sanitize_base_dir
  sanitize_svn_url
  sanitize_use_build_directory
  sanitize_use_this_build_directory
  sanitize_use_this_build_system
  sanitize_localstatedir
  sanitize_do_not_download
  sanitize_modify_the_makefile
  sanitize_manual_steps
  sanitize_sha256
  # ======================================================================= #
  # Last but not least, find out the file size of the program in question.
  # ======================================================================= #
  calculate_archive_size
  calculate_md5sum if shall_we_display_the_md5sum?
end

#sanitize_extra_informationObject

#

sanitize_extra_information

We must not lose information from the original dataset, in regards to extra_information.

#


336
337
338
339
340
341
342
343
344
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 336

def sanitize_extra_information
  _ = raw_cookbook?.extra_information?
  if _
    _.chomp!  if _.respond_to? :chomp!
    _.rstrip! if _.respond_to? :rstrip!
    _ = word_wrap(_) if use_word_wrap?
    set_extra_information(_)
  end
end

#sanitize_flatpak_urlObject

#

sanitize_flatpak_url

#


818
819
820
821
822
823
824
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 818

def sanitize_flatpak_url
  _ = raw_cookbook?.flatpak_url?.to_s
  if _ and _.empty?
    _ = flatpak_url?.to_s
  end
  set_flatpak_url(_)
end

#sanitize_gir_filesObject

#

sanitize_gir_files

#


729
730
731
732
733
734
735
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 729

def sanitize_gir_files
  _ = gir_files?
  if _.empty?
    _ = raw_cookbook?.gir_files? if raw_cookbook?.gir_files?
  end
  set_gir_files(_)
end

#sanitize_git_urlObject

#

sanitize_git_url

#


389
390
391
392
393
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 389

def sanitize_git_url
  _ = git_url?
  _ = raw_cookbook?.git_url? if _.nil?
  set_git_url(_) if _
end

#sanitize_has_to_be_compiledObject

#

sanitize_has_to_be_compiled

#


648
649
650
651
652
653
654
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 648

def sanitize_has_to_be_compiled
  _ = raw_cookbook?.has_to_be_compiled?
  if _.nil? or (_.is_a?(String) and _.empty?) # Empty Strings will be "sanitized" here.
    _ = has_to_be_compiled?
  end
  set_has_to_be_compiled(to_bool(_))
end

#sanitize_homepageObject

#

sanitize_homepage

#


890
891
892
893
894
895
896
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 890

def sanitize_homepage
  _ = raw_cookbook?.homepage?
  unless _.is_a? String # Make sure we have a String.
    _ = _.to_s
  end
  set_homepage(_)
end

#sanitize_installation_stepsObject

#

sanitize_installation_steps

Installation steps are steps that we have to perform in order to get different programs to install on a given computer system.

Special macros can be used as part of the installation steps.

For instance:

MY_PROGRAMS/Procps/PROGRAM_VERSION

Will be expanded to whatever value MY_PROGRAMS was set to; usually it is, or should be, pointing towards “/Programs/” or “/home/Programs/”.

Do note that this means that the value for MY_PROGRAMS must exist, otherwise this can not possibly work. Of course you can omit using macros and just hardcode values there anyway; the macros only exist to make it simpler to handle different programs.

Another example for macro-conversion would be the String ‘RINSTALL1’, which will become expanded into the following three actions:

ruby install.rb config
ruby install.rb setup
ruby install.rb install

The latter expansions are part of the file:

predefined_installation_instructions.yml

So, if you want to add new macros, you can do so by modifying that very yaml file.

Keep in mind that the installation steps are stored as Array at all times.

#


1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1175

def sanitize_installation_steps
  _ = installation_steps?
  if _ and _.empty?
    if raw_cookbook?.installation_steps? and
      !raw_cookbook?.installation_steps?.empty?
      _ = raw_cookbook?.installation_steps?
    end
  end
  unless _.is_a? Array
    _ = [_].flatten.compact # ← .compact to avoid retaining nil values.
  end
  if _.empty?
    _ << 'make' # ← This is the hardcoded default value at all times.
  end
  # ======================================================================= #
  # bl $RBT/yaml/predefined_installation_instructions.yml
  # ======================================================================= #
  dataset = load_yaml(
    file_predefined_installation_instructions?
  )
  _.map! {|entry|
    if dataset.has_key? entry
      entry = dataset[entry]
      if entry.is_a? String
        # ================================================================= #
        # The String may look like this:
        #
        #   copy_ruby; ruby setup.rb config; ruby setup.rb setup; ruby setup.rb install
        #
        # ================================================================= #
        if entry.include? ';'
          entry = entry.split(';').map(&:strip)
        end
      end
    end
  }
  _.flatten!
  _.compact!
  _.reject!(&:empty?)
  # ========================================================================= #
  # Past this point here we have an Array.
  # ========================================================================= #
  unless _.empty?
    _.map! {|line|
      line = line.dup if line.frozen?
      line.strip!
      # =================================================================== #
      # Next, replace all ',' with ';' characters.
      # =================================================================== #
      line.tr!(',',';') if line.include? ','
      if Object.const_defined? :ConvertGlobalEnv
        line = ConvertGlobalEnv[line] if line.include? '$'
      end
      # =================================================================== #
      # === Replace the predefined installation instruction next
      # =================================================================== #
      if predefined_installation_instructions?.include? line
        line = predefined_installation_instructions?[line]
      end
      if line.include? 'VERSION'
        # ================================================================= #
        # Need to set @program_version first, hence we update some stuff.
        # ================================================================= #
        set_program_name(program_name?) # This equals, for example, to "gnome-mahjonng-5.08"
        if line.include? 'PROGRAM_VERSION' 
          line.gsub!(/PROGRAM_VERSION/, program_version?) if program_version?
        elsif line.include? 'VERSION'
          line.gsub!(/VERSION/, program_version?) if program_version?
        end
      end
      line = line.split(';') if line.include? ';' # This may turn it into an Array.
      line
    }
  end
  _.flatten!
  _.map!(&:strip)
  set_installation_steps(_)
end

#sanitize_is_an_active_projectObject

#

sanitize_is_an_active_project

#


1306
1307
1308
1309
1310
1311
1312
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1306

def sanitize_is_an_active_project
  _ = raw_cookbook?.is_an_active_project?
  if _.nil?
    _ = is_an_active_project?
  end
  set_is_an_active_project(to_bool(_))
end

#sanitize_keep_extractedObject

#

sanitize_keep_extracted

#


1077
1078
1079
1080
1081
1082
1083
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1077

def sanitize_keep_extracted
  _ = raw_cookbook?.keep_extracted?.to_s
  if _ and _.empty?
    _ = keep_extracted?.to_s
  end
  set_keep_extracted(to_bool(_))
end

#sanitize_last_updateObject Also known as: sanitize_last_update_entry

#

sanitize_last_update

The only sanitize-operation we do here is if it is an valid date, such as “32 Aug 2017”.

#


832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 832

def sanitize_last_update
  _ = last_update?
  if _ and _.include? ' '
    splitted = _.split(' ')
    day = splitted.first # Fetch the day-entry.
    if day.to_i > 31
      opne swarn('The last_update entry for ')+
           steelblue(program_name?)+
           swarn(' is wrong (too high).')
      opne swarn('Please correct this entry.')
      opne swarn('The faulty entry currently looks like this:')
      e
      e "  #{_}"
      e
      # =================================================================== #
      # We could exit here but this is mostly an annoyance rather than
      # a bug, so we continue. As of April 2021, we will exit.
      # =================================================================== #
      exit
    end
  elsif _ and (_.count('.') == 2) # Input such as '24.09.2017'
    splitted = _.split('.')
    splitted[1] = return_month_based_on_this_number(splitted[1])[0,3] # This is the month but only the first 3 characters.
    _ = splitted.join(' ')
    set_last_update(_)
  end
end

#sanitize_libexecObject

#

sanitize_libexec

#


1088
1089
1090
1091
1092
1093
1094
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1088

def sanitize_libexec
  _ = raw_cookbook?.libexec?
  if _ and _.empty?
    _ = libexec?
  end
  set_libexec(_)
end

#sanitize_licenceObject

#

sanitize_licence

Empty license should default to “unknown” license. This method will ensure that this is the case.

#


1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1021

def sanitize_licence
  _ = licence?
  begin
    if _.nil? or _.empty?
      _ = 'unknown'
    else
      if _.is_a?(String) and _.include?(',') # ← In this case, turn it into an Array.
        _ = _.split(',').map(&:strip)
      else
        _ = 'unknown' if _.nil? or _.empty?
      end
    end
    set_licence(_)
  rescue Exception => error
    opne 'An error happened in sanitize_licence().'
    pp data?
    pp error
    pp error.class
    opne 'Exiting now - this error (in sanitize_licence()) '\
         'should be fixed though.'
    exit
  end
end

#sanitize_localstatedirObject

#

sanitize_localstatedir

#


1257
1258
1259
1260
1261
1262
1263
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1257

def sanitize_localstatedir
  _ = raw_cookbook?.localstatedir?.to_s
  if _ and _.empty?
    _ = localstatedir?.to_s
  end
  set_localstatedir(to_bool(_))
end

#sanitize_m4_filesObject

#

sanitize_m4_files

#


1317
1318
1319
1320
1321
1322
1323
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1317

def sanitize_m4_files
  _ = raw_cookbook?.m4_files?
  if _ and _.empty?
    _ = m4_files?
  end
  set_m4_files(_)
end

#sanitize_manual_stepsObject

#

sanitize_manual_steps

#


1446
1447
1448
1449
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1446

def sanitize_manual_steps
  _ = raw_cookbook?.manual_steps?
  set_manual_steps(_)
end

#sanitize_may_we_modify_the_configure_optionsObject

#

sanitize_may_we_modify_the_configure_options

#


1391
1392
1393
1394
1395
1396
1397
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1391

def sanitize_may_we_modify_the_configure_options
  _ = raw_cookbook?.may_we_modify_the_configure_options?.to_s
  if _ and _.empty?
    _ = may_we_modify_the_configure_options?.to_s
  end
  set_may_we_modify_the_configure_options(to_bool(_))
end

#sanitize_md5sumObject Also known as: sanitize_md5sum_value

#

sanitize_md5sum

#


1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1413

def sanitize_md5sum
  _ = raw_cookbook?.md5sum?
  if _.nil?
    _ = md5sum?
    if _.nil?
      _ = `md5sum #{program_path?}` if File.exist? program_path?
    end
  end
  set_md5sum(_)
end

#sanitize_meson_configure_optionsObject

#

sanitize_meson_configure_options

This method is similar to the method sanitize_configure_options() but it is only valid for meson, not for GNU autoconfigure.

The configure options for meson must be kept as a String, at all times.

#


472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 472

def sanitize_meson_configure_options
  _ = raw_cookbook?.meson_configure_options?
  _ = meson_configure_options? unless meson_configure_options?.nil?
  # ======================================================================= #
  # We sanitize it a bit, if the option exists.
  # ======================================================================= #
  if _
    _ = _.to_s.strip
    # ===================================================================== #
    # We will assume this to be a comment, so we have to remove these
    # comments.
    # ===================================================================== #
    if _.include? ' # '
      _ = remove_comments_from_each_line(_)
    end
    if _.include? N
      _.tr!(N,' ')
    end
    _.strip!
    _.squeeze!(' ')
    set_meson_configure_options(_)
  end
end

#sanitize_mirrorObject

#

sanitize_mirror

#


863
864
865
866
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 863

def sanitize_mirror
  _ = raw_cookbook?.mirror?.to_s
  set_mirror(_)
end

#sanitize_modify_the_makefileObject

#

sanitize_modify_the_makefile

#


1402
1403
1404
1405
1406
1407
1408
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1402

def sanitize_modify_the_makefile
  _ = raw_cookbook?.modify_the_makefile?
  if _.nil? or ( _.is_a?(String) and _.empty? )
    _ = false # This is the default value.
  end
  set_modify_the_makefile(to_bool(_))
end

#sanitize_parameters_to_makeObject Also known as: sanitize_make_options

#

sanitize_parameters_to_make

This method will sanitize the parameters that can be given to the program called “make” (on the commandline). “make” is typically invoked for a given program.

#


1283
1284
1285
1286
1287
1288
1289
1290
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1283

def sanitize_parameters_to_make
  _ = parameters_to_make?
  if _ and _.empty?
     _ = raw_cookbook?.parameters_to_make?
  end
  _ = [_].flatten.compact.reject {|entry| entry.is_a?(String) and entry.empty? }
  set_parameters_to_make(_)
end

#sanitize_pkgconfig_filesObject

#

sanitize_pkgconfig_files

#


508
509
510
511
512
513
514
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 508

def sanitize_pkgconfig_files
  _ = pkgconfig_files?
  if _ and _.empty?
    _ = raw_cookbook?.pkgconfig_files? if raw_cookbook?.pkgconfig_files?
  end
  set_pkgconfig_files(_)
end

#sanitize_postinstallObject

#

sanitize_postinstall

This will sanitize the postinstall stuff, by assigning to the respective entry in the main Hash.

Note that we have to invoke this method only after short_name and program_version was set, because one entry requires this specifically.

As of 20.09.2014, the specification requires that postinstall must be an Array at all times.

Invocation example:

scookie libraw1394
#


566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 566

def sanitize_postinstall
  _ = [postinstall?].flatten.compact # Get rid of nil values.
  if _ and _.is_a?(Array) and _.empty?
    _ = raw_cookbook_dataset?['postinstall']
  end
  if _.is_a? Array
    _.map! {|entry| substitute_macros(entry) }
  end
  # ===================================================================== #
  # Turn it into an Array for sure:
  # ===================================================================== #
  _ = [_].flatten.compact
  # ===================================================================== #
  # Sanitize the @postinstall variable next.
  # ===================================================================== #
  if _.is_a? Array
    point_to_binaries    = sysbin_directory?
    point_to_libraries   = syslib_directory?
    point_to_includes    = sysinclude_directory?
    point_to_program_dir = program_directory?
    _.map! {|entry|
      if entry.include? 'UNIVERSAL_BINARY_DIR'
        entry.gsub!(/UNIVERSAL_BINARY_DIR/,  point_to_binaries)
      end
      entry.gsub!(/UNIVERSAL_BINARIES_DIR/,  point_to_binaries)
      entry.sub!(/UBD/,                      point_to_binaries)
      entry.gsub!(/UNIVERSAL_LIBRARIES_DIR/, point_to_libraries)
      entry.sub!(/ULD/,                      point_to_libraries)
      entry.gsub!(/UNIVERSAL_INCLUDE_DIR/,   point_to_includes)
      entry.gsub!(/PROGRAM_DIR/,             point_to_program_dir)
      entry.gsub!(/PROGRAMS_DIR/,            point_to_program_dir)
      entry.gsub!(/,cp/,                     ',copy_file')
      # ================================================================= #
      # Handle the MIDDLE_VERSION macro next. This one is, for
      # python, the value "8", from version "3.8.3" - thus the
      # middle part.
      # ================================================================= #
      if entry.include? 'MIDDLE_VERSION'
        entry.sub!(/MIDDLE_VERSION/, return_middle_part_of_the_program_version)
      end
      entry.strip! # Strip it.
      entry = rds(entry) # Replace // with // here.
      entry
    }
    set_postinstall _ # Reassign.
  end
  unless postinstall?.is_a? Array
    _ = rds(postinstall?)
    _ = _.split(',') if _.include? ','
    set_postinstall [_].flatten
  end
end

#sanitize_pre_configure_stepsObject

#

sanitize_pre_configure_steps

#


499
500
501
502
503
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 499

def sanitize_pre_configure_steps
  _ = pre_configure_steps?
  _ = raw_cookbook?.pre_configure_steps? if _ and _.empty?
  set_pre_configure_steps(_) if _
end

#sanitize_pre_make_commandsObject

#

sanitize_pre_make_commands

We must keep the pre_make_commands in Array format. The method here will make sure of this.

We can only invoke this after having set program_version before, because some macro-substitutions require the program version to be properly set before the make-commands can be sanitized.

#


666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 666

def sanitize_pre_make_commands
  _ = pre_make_commands?
  if _.empty?
    _ = raw_cookbook?.pre_make_commands?
  end
  _.compact! if _.is_a? Array # Get rid of nil values.
  case _ # Do a bit free-form sanitizing next.
  when 'handle configure.py'
    _ = 'python configure.py'
  end
  array = []
  if _
    unless _.empty?
      _ = substitute_macros(_)
      array << _
    end
  end
  array.flatten!
  array.compact!
  set_pre_make_commands(array) # Turn it into an Array here.
end

#sanitize_preinstallObject

#

sanitize_preinstall

#


412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 412

def sanitize_preinstall
  _ = preinstall?
  if _ and _.empty?
    _ = raw_cookbook?.preinstall?
  end
  if _.is_a?(String) and (_.count(N) > 1)
    _ = _.split(N)
  end
  if _.nil? # Safeguard to ensure Array.
    set_preinstall []
  else
    _ = [_] if _.is_a? String
    if _.is_a? Array
      _.compact!
      _.map!(&:strip)
      _.reject! {|entry| entry.empty? } # Weed out empty entries.
      _.flatten!
    end
    set_preinstall _
  end
end

#sanitize_program_name_and_program_versionObject

#

sanitize_program_name_and_program_version

#


1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1107

def sanitize_program_name_and_program_version
  _ = raw_cookbook?.program_name_and_program_version?
  if _.nil?
    _ = program_name_and_program_version?
  end
  _ = return_sanitized_program_name_and_program_version(_, url1?)
  unless _.nil?
    set_program_name_and_program_version(_)
  end
end

#sanitize_program_pathObject Also known as: rebuild_path

#

sanitize_program_path

#


140
141
142
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 140

def sanitize_program_path
  reassemble_program_path
end

#sanitize_program_versionObject

#

sanitize_program_version

#


1730
1731
1732
1733
1734
1735
1736
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1730

def sanitize_program_version
  _ = raw_cookbook?.program_version?
  if _.nil? or (_ and _.empty?)
    _ = program_version?.to_s
  end
  set_program_version(_)
end

#sanitize_required_deps_onObject Also known as: sanitize_required_deps

#

sanitize_required_deps_on

The entry required_deps_on will be sanitized here - it must be an Array at all times.

#


904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 904

def sanitize_required_deps_on
  _ = raw_cookbook?.required_deps_on?
  if _.nil?
    _ = return_proper_type_for(:required_deps_on)
  end
  if _.is_a? String # Input such as 'perl cmake'. Has to become an Array.
    if _.include? ' '
      unless _.include?('>') or _.include?('<') # But not when we have comparison-operators.
        _ = _.split(' ')
      end
    end
  end
  array = []
  _ = [_].flatten.compact # Must be an Array.
  _.map! {|entry|
    if entry.include? ','
      entry = entry.split(',').map(&:strip)
    end 
    entry
  } unless _.empty?
  array << _
  array.flatten!
  array.compact!
  # ======================================================================= #
  # At this point the entry is a sanitized Array. But the cookbook
  # file may still have made a mistake, such as when an entry
  # was accidentally listed twice. (I had this problem in Feb
  # 2017, which was why I added the following code.)
  # So we need to check whether the entries are all unique - and
  # if they are not, we will notify the user that something may
  # be wrong with the yaml file in question.
  # ======================================================================= #
  if array.uniq.size != array.size
    path = RBT.individual_cookbooks_dir?+
           program?+
           '.yml'
    non_unique_entries = array.uniq.map { |e|
      [array.count(e), e]
    }.select {| c, _ | c > 1 }.sort.reverse.first.last
    unless non_unique_entries.is_a? Array
      non_unique_entries = [non_unique_entries] # We need an Array.
    end
    opnwarn('There may be one (or several) duplicate dependencies '\
           'listed in the yaml file.')
    opne swarn('  Path: ')+sfile(path)
    opne swarn('Here are the duplicate entries:')
    non_unique_entries.each {|duplicate_entry|
      e "  #{simp(duplicate_entry)}"
    }
    e swarn('If you wish to check for that on your own, have a look at the')
    e swarn('yaml file at `')+sfile(path)+swarn('`.')
    e swarn('Check the "required_deps_on:" entry of the .yml file.')
  end
  set_required_deps_on(array)
end

#sanitize_run_configureObject

#

sanitize_run_configure

#


1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1350

def sanitize_run_configure
  _ = raw_cookbook?.run_configure?
  if _.nil?
    _ = run_configure?
  end
  if _ and _.is_a?(String) and _.empty?
    _ = run_configure?.to_s
  end
  _ = to_bool(_)
  _ = false if _.nil?
  set_run_configure(_)
end

#sanitize_sed_entryObject Also known as: try_to_sanitize_the_sed_entry

#

sanitize_sed_entry (sed tag)

The sed entry allows us to make some very simple replacements in files.

We will guarantee that this setting will be an Array.

#


967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 967

def sanitize_sed_entry
  # ======================================================================= #
  # Only sanitize the sed entry if we have that key.
  # ======================================================================= #
  if has_key? :sed
    raw_data = raw_cookbook_dataset?
    _ = sed?
    if (_ == false) and raw_data.has_key?('sed')
      _ = raw_data['sed']
    end
    if _
      _ = _.split(N) if _.is_a? String
      if _
        # ================================================================= #
        # We need an Array past this point.
        # ================================================================= #
        _ = [_].compact # We don't want to store nil values here.
        set_sed(_)
      end
    end
  end
end

#sanitize_sha256(i = program_path? ) ⇒ Object

#

sanitize_sha256

#


128
129
130
131
132
133
134
135
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 128

def sanitize_sha256(
    i = program_path?
  )
  if File.file?(i) # The file ought to exist.
    _ = RBT.shasum(i)
    set_sha256(_)
  end
end

#sanitize_short_descriptionObject

#

sanitize_short_description

Right now this method will only get rid of newlines and do a .strip() call.

#


1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1051

def sanitize_short_description
  short_description = short_description?
  if short_description.nil?
    short_description = raw_cookbook?.short_description?
  end
  if short_description and short_description.include? N
    set_short_description(
      short_description.to_s.delete(N).strip
    )
  end
end

#sanitize_short_nameObject

#

sanitize_short_name

#


879
880
881
882
883
884
885
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 879

def sanitize_short_name
  _ = raw_cookbook?.short_name?
  if _.nil?
    _ = short_name?
  end
  set_short_name(_)
end

#sanitize_svn_urlObject

#

sanitize_svn_url

#


527
528
529
530
531
532
533
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 527

def sanitize_svn_url
  _ = svn_url?
  if _.nil?
    _ = raw_cookbook?.svn_url?
  end
  set_svn_url(_.to_s)
end
#
#


303
304
305
306
307
308
309
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 303

def sanitize_symlink_glib_schema
  _ = raw_cookbook?.symlink_glib_schema?.to_s
  if _ and _.empty?
    _ = symlink_glib_schema?.to_s
  end
  set_symlink_glib_schema(to_bool(_))
end
#
#


1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1454

def sanitize_symlink_headers
  _ = raw_cookbook?.symlink_headers?
  if _.nil?
    _ = symlink_headers?
  end
  case _
  when 't'
    _ = 'yes'
  when 'f'
    _ = 'no'
  end
  set_symlink_headers(_)
end
#
#


1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1121

def sanitize_symlink_pkgconfig_files
  _ = raw_cookbook?.symlink_pkgconfig_files?
  if _.nil?
    _ = symlink_pkgconfig_files?
  end
  case _
  when 't'
    _ = 'yes'
  when 'f'
    _ = 'no'
  else
    _ = to_bool(_)
  end
  set_symlink_pkgconfig_files()
end

#sanitize_tagsObject

#

sanitize_tags

Keep in mind that the tags must always be in Array format.

We will update the tags entry through this method here.

#


1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1592

def sanitize_tags
  _ = tags?
  if _ and _.empty? and
     raw_cookbook?.tags? and
    !raw_cookbook?.tags?.empty?
    _ = raw_cookbook?.tags?
  end
  if _.nil?
    set_tags [] # In this case it will be an empty Array.
    return
  end
  # ======================================================================= #
  # Clean up the Array next.
  # ======================================================================= #
  if _.is_a? Array
    _.map! {|line|
      if line
        begin
          line.tr!(' ','_')
          line.strip!
        rescue Exception => error
          opne 'Something went wrong with the variable (called '+steelblue(line)+').'
          opne 'The whole dataset was:'
          e
          pp _
          e
          e 'The program was:'
          e
          e steelblue("  #{program_name?}")
          e
          e 'The error was (of class '+error.class.to_s+'):'
          pp error
        end
      end
      line
    }
  end
  dataset_containing_the_specification_of_registered_cookbook_entries =
    file_specification_of_registered_cookbook_entries
  format = dataset_containing_the_specification_of_registered_cookbook_entries['tags']
  unless _.class.to_s == format
    case format
    when 'Array'
      if _.is_a? String
        if _.include? ','
          _ = _.split(',').map(&:strip)
        end
      end 
      _ = [_].compact.flatten # Convert the String into an Array here and remove nil values.
    end
  end
  if _.is_a? Array
    # ===================================================================== #
    # Before we do anything else, we will apply a .map-strip and a 
    # exchange of all ' ' with '_' operation:
    # ===================================================================== #
    _.map! {|line|
      if line
        line.tr!(' ','_')
        line.strip!
      end
      line
    }
    first = _.first
    if first
      if first.include? ' ' # We have a situation such as this one here: ["video gnome"]
        first = first.split(' ')
        _ = first
      elsif first.is_a?(String) and first.include?(',') # Some entries may have something like:  ruby,gnome  in the yaml file, we check for these here.
        first = first.split(',')
        _ = first
      end
    end
  end
  # ======================================================================= #
  # Since as of Feb 2017, we will also ensure that the tags that are
  # in use, conform to our specification at hand. If not then we will
  # notify the user, and exit.
  # ======================================================================= #
  allowed_tags = load_yaml(RBT.file_allowed_tags)
  allowed_tags.map! {|line|
    line.tr(' ','_').strip
  }
  _.each {|this_tag| # Iterate through to find improper tags.
    if this_tag.to_s.empty? or # Empty tags are skipped as well.
       allowed_tags.include?(this_tag)
    else
      this_program = short_name?
      e
      e "#{rev}The specified tag called `#{simp(this_tag)}` for the program "\
        "#{sfancy(this_program.downcase)}"\
        " has not"
      e 'been registered in the file:'
      e
      e "  `#{sfile(RBT.file_allowed_tags)}`."
      e
      e 'This is currently '+violet('disallowed')+'.'
      e
      e 'The faulty entry must be corrected. So either the cookbook file '
      e 'in question should be modified, or the tag should be added'
      e "to the registry of allowed tags in the specification "\
        "file. (#{sfile('allowed_tags.yml')})"
      e
      if is_on_roebe?
        open_in_editor(
          this_program.downcase.delete('-')
        )
      end
      # =================================================================== #
      # No longer exit as of November 2013.
      # And in April 2021 we will exit again.
      # =================================================================== #
      exit # And exit here.
    end
  }
  set_tags(_) # Finally set the Array that has our tags.
end

#sanitize_the_binariesObject Also known as: sanitize_binaries

#

sanitize_the_binaries (binaries tag)

This method will sanitize the binaries entry.

The binaries must be kept in Array format at all times.

#


626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 626

def sanitize_the_binaries
  _ = raw_cookbook?.binaries?
  _ = [] if _.nil?
  if _ and !_.empty?
    if _.is_a?(String) and !_.empty?
      _ = _.split(',')
    elsif _.is_a? String
      _ = [_]
    end
    if _.is_a? Array
      if _.first.include? ',' # Assume that we must split then.
        _.map! {|entry| entry.split(',') }
      end if _.first
    end
  end
  _ = _.flatten.compact.map(&:strip)
  set_binaries(_)
end

#sanitize_the_headersObject Also known as: sanitize_headers

#

sanitize_the_headers (headers tag)

The headers entry must be kept as an Array at all times, according to the specification.

#


1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1474

def sanitize_the_headers
  _ = headers?
  if _ and _.is_a?(Array) and _.empty?
    _ = raw_cookbook_dataset?['headers']
  end
  if _.is_a? Array
    if _.first.include? ','
      _ = _.first.split(',')
    end if _.first
  end
  if _.is_a? String
    _ = _.to_s.strip
    _ = _.split(',') if _.include? ','
    _ = nil if _.empty?
  end
  _ = [_].flatten.compact
  # ======================================================================= #
  # The individual entries may have a newline or an empty String at
  # the beginning. The next line of code ensures that we will get
  # rid of these.
  # ======================================================================= #
  _.map! {|entry| entry.delete(N).strip }
  # ======================================================================= #
  # Must keep it sorted, since as of July 2017. It is easier to 
  # keep track of these entries on the commandline when they
  # are sorted.
  # ======================================================================= #
  _.sort!
  set_headers(_)
end

#sanitize_the_librariesObject Also known as: sanitize_libraries

#

sanitize_the_libraries

This sanitizes the libraries entry, @_.

We must keep this entry in Array format.

#


781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 781

def sanitize_the_libraries
  _ = raw_cookbook?.libraries?
  unless _.is_a? Array
    _ = [_].compact
  end
  # ======================================================================= #
  # Next, we will assume something such as:
  #   ["libdevkit-power-gobject.{so,a},libupower-glib.{so,a}"] 
  # ======================================================================= #
  unless _.empty? # safeguard against nil entries.
    if _ and _.first and _.first.include?('}') and _.first.include?('{')
      splitted = _.first.split(/\},/)
      splitted.map! {|entry|
        entry =~ REGEX_TO_SANITIZE_LIBRARIES
        [$1+'.'+$2, $1+'.'+$3]
      }
      splitted.flatten!
      _ = splitted
    end
  end
  if _.is_a? Array
    if _.first.include? ','
      _ = _.first.split(',')
      _.map!(&:strip) # It should not include empty whitespace.
      # =================================================================== #
      # Some libraries may have components such as foo{so.a}
      # We need to split these up into foo.so and foo.a.
      # =================================================================== #
    end if _.first
  end
  new_value = [_].flatten.compact
  set_libraries(new_value)
end

#sanitize_the_prefixObject Also known as: sanitize_prefix

#

sanitize_the_prefix (sanitize prefix tag)

The value for the prefix of the program at hand will be sanitized here, in this method.

The prefix must be a String at all times according to the specification.

Since as of May 2013, we will never use a shortcut anymore, we will always store the full, absolute path to our entry.

“false” as value, is an indication of using the path to an AppDir.

For example, a value of false would be interpreted like /Programs/Htop/2.0.0 - in other words, a proper appdir.

The –prefix is always a directory, so as of Jan 2014 this method will append a / to this unless the last character is already a /.

#


1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1524

def sanitize_the_prefix
  # ======================================================================= #
  # General way to overrule the prefix setting in this case.
  # ======================================================================= #
  if COMPILE_EVERYTHING_INTO_STANDALONE_DIRECTORY
    old_prefix = 't'
  else
    # ===================================================================== #
    # We need to use .to_s because the prefix can be a boolean value as
    # well, such as true or false.
    # ===================================================================== #
    old_prefix = prefix?.to_s.dup
  end
  # ======================================================================= #
  # As of January 2014, we will pass the String through the macro-check,
  # which has to be done because our string may include PROGRAM_NAME
  # as a prefix.
  # ======================================================================= #
  old_prefix = substitute_macros(old_prefix).dup
  case old_prefix
  # ======================================================================= #
  # === traditional
  # ======================================================================= #
  when 't',
       'true',
       'yes',
       'y',
       'traditional'
    set_internal_prefix('/usr/')
  # ======================================================================= #
  # === non-traditional
  # ======================================================================= #
  when 'f',
       'false',
       'no',
       'AppDir',
       'return_appdir_path',
       'appdir_path'
    # ===================================================================== #
    # This must use an appdir prefix.
    # ===================================================================== #
    set_internal_prefix(return_appdir_prefix.dup) # ← This is the AppDir variant.
  else
    old_prefix = old_prefix.dup
    # ===================================================================== #
    # Append '/' unless we already have a trailing '/'.
    # ===================================================================== #
    old_prefix << '/' unless old_prefix.end_with? '/'
    old_prefix.sub!(/ULOCAL/,'/usr/local') if old_prefix.include? 'ULOCAL' # ULOCAL gets expanded to /usr/local
    old_prefix.sub!(/ULOC/,  '/usr/local') if old_prefix.include? 'ULOC'   # same counts for ULOC
    # ======================================================================= #
    # We used to delete '-' here in the past, but as of September 2017
    # this is no longer the case. Some programs may have a '-' as part
    # of the program version, and it may be better to include this
    # rather than remove it.
    # ======================================================================= #
    # old_prefix.delete!('-') if _.include? '-'
    set_internal_prefix(old_prefix)
  end
end

#sanitize_then_set_boolean_value(i) ⇒ Object Also known as: sanitize_boolean_value

#

sanitize_then_set_boolean_value

This method will turn ‘t’ into true and ‘f’ into false.

#


1438
1439
1440
1441
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1438

def sanitize_then_set_boolean_value(i)
  _ = obtain(i)
  set(i, to_bool(_))
end

#sanitize_url1(i = raw_cookbook?.url1?) ⇒ Object

#

sanitize_url1

We will chop off some parts of the URL.

#


1743
1744
1745
1746
1747
1748
1749
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1743

def sanitize_url1(
    i = raw_cookbook?.url1?
  )
  set_url1(
    return_sanitize_url1(i)
  )
end

#sanitize_url2(url2 = raw_cookbook?.url2?) ⇒ Object

#

sanitize_url2

#


1427
1428
1429
1430
1431
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1427

def sanitize_url2(
    url2 = raw_cookbook?.url2?
  ) 
  dataset?[:url2] = url2
end

#sanitize_use_autoconfObject

#

sanitize_use_autoconf

#


368
369
370
371
372
373
374
375
376
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 368

def sanitize_use_autoconf
  _ = raw_cookbook?.use_autoconf?
  if _ and _.is_a?(String) and _.empty?
    _ = use_autoconf?.to_s
  end
  _ = to_bool(_)
  _ = false if _.nil?
  set_use_autoconf(_)
end

#sanitize_use_build_directoryObject

#

sanitize_use_build_directory

#


1328
1329
1330
1331
1332
1333
1334
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1328

def sanitize_use_build_directory
  _ = raw_cookbook?.use_build_directory?
  if _.nil?
    _ = use_build_directory?
  end
  set_use_build_directory(_)
end

#sanitize_use_this_build_directoryObject

#

sanitize_use_this_build_directory

#


871
872
873
874
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 871

def sanitize_use_this_build_directory
  _ = raw_cookbook?.use_this_build_directory?
  set_use_this_build_directory(_)
end

#sanitize_use_this_build_systemObject

#

sanitize_use_this_build_system

The build_system entry must always be a String.

#


1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1715

def sanitize_use_this_build_system
  _ = use_this_build_system?
  _ = '' if _.nil?
  if _ and _.is_a?(String) and _.empty?
    # ===================================================================== #
    # Must set a new default value in this case.
    # ===================================================================== #
    _ = :default # This means to infer the build system in use.
  end
  set_use_this_build_system(_)
end

#sanitize_use_this_make_commandObject

#

sanitize_use_this_make_command

This will default to whatever is stored in the configuration file.

Should be ‘make’ usually, but could be “cmake” or another make-like command.

#


319
320
321
322
323
324
325
326
327
328
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 319

def sanitize_use_this_make_command
  _ = use_this_make_command?
  if _ and _.empty?
    _ = raw_cookbook?.use_this_make_command?
    if _.nil? or _.empty?
      _ = MAKE_COMMAND_TO_USE # MAKE_COMMAND_TO_USE is defined in constants.rb
    end
  end
  set_use_this_make_command(_)
end

#sanitize_use_this_make_install_commandObject

#

sanitize_use_this_make_install_command

#


1099
1100
1101
1102
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1099

def sanitize_use_this_make_install_command
  _ = raw_cookbook?.use_this_make_install_command?
  set_use_this_make_install_command(_)
end

#sanitize_use_this_program_name_on_gobolinux(are_we_on_gobolinux = are_we_on_gobolinux? ) ⇒ Object Also known as: sanitize_program_compile_name

#

sanitize_use_this_program_name_on_gobolinux

#


398
399
400
401
402
403
404
405
406
407
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 398

def sanitize_use_this_program_name_on_gobolinux(
    are_we_on_gobolinux = are_we_on_gobolinux?
  )
  _ = program_compile_name?
  if are_we_on_gobolinux and
    !use_this_program_name_on_gobolinux?.to_s.empty?
    _ = use_this_program_name_on_gobolinux?.to_s
    set_program_compile_name(_) # Will always be at the least an empty String.
  end
end

#sanitize_wikipediaObject

#

sanitize_wikipedia

#


381
382
383
384
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 381

def sanitize_wikipedia
  _ = raw_cookbook?.wikipedia?
  set_wikipedia(_)
end

#sed?Boolean

#

sed?

#

Returns:

  • (Boolean)


5254
5255
5256
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5254

def sed?
  obtain __method__.to_s.delete('?').to_sym
end

#seek_this_program?Boolean Also known as: seek_which_program, seek_which_program?, which_program?, search_for_this_program?, search_which_program?

#

seek_this_program? (seek tag)

This method will tell us as for which program we will search.

Do note that this is NOT the same as program_name? or short_name?, because the latter two may contain upcased characters, such as for “libX11”, whereas the variable here is ALWAYS downcased.

#

Returns:

  • (Boolean)


5076
5077
5078
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5076

def seek_this_program?
  @internal_hash[:seek_this_program]
end

#send_this_method_and_sanitize_arrays(i, limit_the_result = false) ⇒ Object

#

send_this_method_and_sanitize_arrays

The second argument can be used to “limit the result”, e. g. to show only n elements (from an Array, typically).

It is used in particular to not display too many elements, as these may overflow on the screen (commandline output) - but the user can override this behaviour, via –do-not-truncate.

#


4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4354

def send_this_method_and_sanitize_arrays(
    i, limit_the_result = false
  )
  result = send(i)
  # ======================================================================= #
  # The following clause will be entered if there are too many entries
  # for the given field - in particular header-files, binaries and
  # libraries.
  # ======================================================================= #
  if @internal_hash[:try_to_truncate_too_long_output] and
     limit_the_result and
     (result.size > limit_the_result) # Check for more elements here.
    # ===================================================================== #
    # === Handle "headers?" next
    # ===================================================================== #
    if i.to_s.include?('headers?')
      if limit_the_result
        append_this = ' ... → TRUNCATED '+
                      (result.size - limit_the_result).to_s+
                      ' more .h header files'
        result = result[0 .. (limit_the_result - 1)]
        result << append_this
      end
    # ===================================================================== #
    # === Handle "libraries?" next
    # ===================================================================== #
    elsif i.to_s.include?('libraries?')
      if limit_the_result
        append_this = ' ... → TRUNCATED '+
                      (result.size - limit_the_result).to_s+
                      ' more library files'
        result = result[0 .. (limit_the_result - 1)]
        result << append_this
      end
    # ===================================================================== #
    # === Handle "binaries?" next
    # ===================================================================== #
    elsif i.to_s.include?('binaries?')
      if limit_the_result
        append_this = ' ... → TRUNCATED '+
                      (result.size - limit_the_result).to_s+
                      ' more binaries/executables'
        result = result[0 .. (limit_the_result - 1)]
        result << append_this
      end
    end
  end
  if result.is_a? Array
    result = '['+result.join(',')+']' unless result.compact.empty?
  end
  return result
end

#set(key, value) ⇒ Object Also known as: set_in_yaml_dataset, set_in_dataset, set_in_main_hash, update_entries, update_entry, []=

#

set (set tag, setter tag)

#


566
567
568
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 566

def set(key, value)
  dataset?[key.to_sym] = value
end

#set_active_project(i = true) ⇒ Object

#

set_active_project

The default assumption is that all projects are actively maintained. If this assumption is incorrect then it has to be registered in the particular .yml file, via an entry such as: “active_project: no”

#


1116
1117
1118
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1116

def set_active_project(i = true)
  set(:active_project, i)
end

#set_apply_patch(i = nil) ⇒ Object

#

set_apply_patch

#


1908
1909
1910
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1908

def set_apply_patch(i = nil)
  set(:apply_patch, i)
end

#set_archive_size(i = 0) ⇒ Object Also known as: set_size

#

set_archive_size

The archive size, that is, how large the archive is - in bytes.

The archive size will default to 0 on startup or when no argument is passed to it.

#


1901
1902
1903
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1901

def set_archive_size(i = 0)
  set(:archive_size, i)
end

#set_archive_type(i = DEFAULT_ARCHIVE_TYPE) ⇒ Object Also known as: set_archive, set_archive_format, set_this_archive, archive_type=

#

set_archive_type (archive tag, 4 tag)

This method will set the ‘archive_type’ of a given program at hand.

It is entry number (5), and may typically look like ‘.tar.xz’, in a program like ‘gnome-mahjonng-5.08.tar.xz’.

Typically, archives will be kept in the .tar.xz format locally, or rather whatever the value of the DEFAULT_ARCHIVE_TYPE specifies.

We need this part when we wish to assemble the program_full_name setting lateron, at entry number (6), which would then look like this: ‘gnome-mahjonng-5.08.tar.xz’

#


1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1064

def set_archive_type(
    i = DEFAULT_ARCHIVE_TYPE
  )
  case i
  when :infer_from_url1
    i = File.basename(url1)
  when nil,
       :default,
       'default'
    i = DEFAULT_ARCHIVE_TYPE # Safeguard.
  when :tar_xz
    i = TARXZ
  end
  i = i.to_s.dup.downcase # Keep it downcased as well, and in String format.
  # ======================================================================= #
  # === Get rid of '/'
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  # ======================================================================= #
  # Do some sanitizing next.
  # ======================================================================= #
  i.sub!(/\.source$/,'') if i.include? '.source'
  # ======================================================================= #
  # If the input includes a '-' token, then something can not be right.
  # ======================================================================= #
  if i.include? '-'
    i = i[(i.rindex('-')+1)..-1]
  # ======================================================================= #
  # Same for input containing '_'.
  # ======================================================================= #
  elsif i.include? '_'
    i = i[(i.rindex('_')+1)..-1]
  end
  if i == 'guess'
    i = File.basename(url?)
  end
  i = archive_type_of?(i) # This method must have registered all archive-types.
  set(:archive_type, i)
end

#set_autoconf(i) ⇒ Object Also known as: use_autoconf=

#

set_autoconf

#


2003
2004
2005
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2003

def set_autoconf(i)
  set(:use_autoconf, i)
end
#
#


1842
1843
1844
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1842

def set_autosymlink_lib64(i)
  set(:autosymlink_lib64, i)
end

#set_base_dir(i = :default) ⇒ Object Also known as: try_to_guess_the_base_dir, determine_base_directory, determine_base_dir, set_base_dir=, base_dir=

#

set_base_dir (base_dir tag, base dir tag, 7 tag)

This is (7), the base_dir.

It will be equivalent to a String such as “/home/x/src/gnomemahjongg/” or “/home/x/src/file/”.

It constitutes of:

- src_dir?
- short_name?
- '/'

The short_name? will be used as name for the archive at hand, but it will always be downcased - see the .downcase variant.

If the input is :guess_base_dir then this means that the method will try to guess the base directory in use.

#


674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 674

def set_base_dir(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  #
  # This clause can be entered via:
  #
  #   set_base_dir(:default)
  #
  # Note that the base_dir entry is not allowed to have any '.'
  # characters.
  # ======================================================================= #
  when :default,
       :guess_base_dir,
       :guess
    i = "#{src_dir?}".dup
    unless base_dir?.nil?
      i << base_dir?
      i << '/' unless i.end_with?('/')
    else
      i << "#{short_name?.to_s.downcase.delete('.')}/" # This was guess_base_dir.
    end
  end
  if i
    i = i.dup if i.frozen?
    # ===================================================================== #
    # Assume that a path starting with ./ is never correct.
    # ===================================================================== #
    if i.start_with? './'
      i[0,2] = source_dir?
    end
    # ===================================================================== #
    # === Handle + tokens
    #
    # Some directory names may include a '+' character, such as is the
    # case with gtk+. There are several ways how to deal with this, but
    # if we have a certain configuration option set, then we will
    # replace '+' with long name, which is 'plus'. I personally no 
    # longer use this - my directory names will also include a '+'
    # character as a consequence.
    # ===================================================================== #
    if i.include? '+'
      i.gsub!(/\+/, 'plus') if replace_plus_with_long_name?
    end
    # ===================================================================== #
    # === Delete _ from the name of the directory as well
    #
    # The following code was added as of January 2014.
    #
    # While programs can have names such as 'e_dbus', the directory
    # name itself is not allowed to contain any '_' token. It
    # looks visually odd otherwise.
    # ===================================================================== #
    i.delete!('_') if i.include? '_'
    # ===================================================================== #
    # We don't want any '-' in the base_dir name either, so away with them.
    # ===================================================================== #
    i.delete!('-') if i.include? '-'
    # ===================================================================== #
    # === Append /
    #
    # It is the correct way to ensure that the last char is a /. The
    # reason is: directories contain a '/' as part of their name.
    # ===================================================================== #
    i << '/' unless i.end_with? '/'
  end
  # ======================================================================= #
  # Remove double slashes
  # ======================================================================= #
  i = rds(i)
  dataset?[:base_dir] = i
end

#set_binaries(i) ⇒ Object

#

set_binaries

#


1786
1787
1788
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1786

def set_binaries(i)
  set(:binaries, i)
end

#set_blfs(i) ⇒ Object

#

set_blfs

#


1821
1822
1823
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1821

def set_blfs(i)
  set(:blfs, i)
end

#set_build_static(i) ⇒ Object

#

set_build_static

#


1165
1166
1167
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1165

def set_build_static(i)
  set(:build_static, i)
end

#set_can_be_compiled_statically(i) ⇒ Object

#

set_can_be_compiled_statically

#


1123
1124
1125
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1123

def set_can_be_compiled_statically(i)
  set(:can_be_compiled_statically, i)
end

#set_cmake_configure_options(i) ⇒ Object Also known as: cmake_configure_options=

#

set_cmake_configure_options

#


978
979
980
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 978

def set_cmake_configure_options(i)
  set(:cmake_configure_options, i)
end

#set_compiler_to_use(i = :gcc) ⇒ Object Also known as: compiler_to_use=

#

set_compiler_to_use

Do note that this method is normally not used by default; it primarily exists so that downstream code in RBT::Compile can keep track of which compiler is used, e. g. :gcc or :clang and similar variants.

#


1974
1975
1976
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1974

def set_compiler_to_use(i = :gcc)
  set(:compiler_to_use, i)
end

#set_complex_program_version(i, be_verbose = true) ⇒ Object

#

set_complex_program_version

The purpose of this method is to allow the user to overrule the respective settings, at run-time.

That way, you can change e. g. “glib-2.24” to “glib-2.25”.

#


5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5864

def set_complex_program_version(
    i,
    be_verbose = true
  )
  case be_verbose
  # ======================================================================= #
  # === :be_quiet
  # ======================================================================= #
  when :be_quiet, :be_silent
    be_verbose = false
  end
  i = i.dup if i.frozen?
  # ======================================================================= #
  # Add a '=' to make it easier to know what we want to modify. This
  # will NOT happen if the input includes a '@', though.
  # ======================================================================= #
  i.prepend '=' unless i.include?('=') or i.include?('@')
  # ======================================================================= #
  # Next, we fetch a specific version. We assume this to be the last part
  # of the command given, which must include a '=' character. Since as
  # of September 2022 a '@' is permissive as well.
  # ======================================================================= #
  if i.include? '='
    new_version = i.split('=').last
  elsif i.include? '@'
    new_version = i.split('@').last
  end
  # ======================================================================= #
  # Chop off archive-extension since we don't need these.
  # ======================================================================= #
  new_version = remove_file_extension(new_version)
  if be_verbose
    opne "Setting a new version: #{simp(new_version)}"
  end
  set_program_version(new_version, :propagate_the_change) # The second argument will propagate the change, by cascading downwards.
  update_prefix :bypass_check
end

#set_configure_base_dir(i) ⇒ Object

#

set_configure_base_dir

#


1807
1808
1809
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1807

def set_configure_base_dir(i)
  set(:configure_base_dir, i)
end

#set_configure_command_to_use(i = :configure) ⇒ Object Also known as: configure_command=, set_configure_command

#

set_configure_command_to_use

The configure command will usually be configure, but it may also be cmake or waf or something like that.

#


581
582
583
584
585
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 581

def set_configure_command_to_use(
    i = :configure
  )
  set(:configure_command_to_use, i)
end

#set_configure_options(i) ⇒ Object Also known as: configure_options=

#

set_configure_options

#


1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1953

def set_configure_options(i)
  # ======================================================================= #
  # Since as of September 2017, the input is no longer allowed to have
  # any newlines. This is explicitely mentioned here in the event that
  # we may have to revert this decision one day.
  # ======================================================================= #
  if i and i.include?(N)
    i = i.dup if i.frozen?
    i.delete!(N)
    i.squeeze!(' ') # And also get rid of '  ' variants.
  end
  set(:configure_options, i)
end

#set_configure_options_explained(i) ⇒ Object

#

set_configure_options_explained

#


1144
1145
1146
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1144

def set_configure_options_explained(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_description(i) ⇒ Object

#

set_description

Note that we will always STORE the full description - it is only the actual display that will be truncated.

#


629
630
631
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 629

def set_description(i)
  set(:description, i)
end

#set_do_not_download(i) ⇒ Object

#

set_do_not_download

#


1151
1152
1153
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1151

def set_do_not_download(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end
#

The alias “do_not_symlink” is an emplicit set_do_not_symlink() call with the argument true. If this is changed, we would also have to create a new method to specifically enable the behaviour desired by do_not_symlink().

#


1575
1576
1577
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1575

def set_do_not_symlink(i = true)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_echo_yes(i) ⇒ Object

#

set_echo_yes

#


1158
1159
1160
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1158

def set_echo_yes(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_enable_shared(i) ⇒ Object

#

set_enable_shared

#


1556
1557
1558
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1556

def set_enable_shared(i)
  set(to_bool(__method__.to_s.delete_prefix('set_')), i)
end

#set_env_variables(i) ⇒ Object Also known as: set_env_variable

#

set_env_variables

#


1718
1719
1720
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1718

def set_env_variables(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_env_variables?Boolean Also known as: env_variables?

#

set_env_variables?

Query the environment variables that this cookbook may set.

#

Returns:

  • (Boolean)


1239
1240
1241
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1239

def set_env_variables?
  obtain(__method__.to_s.delete('?').to_sym)
end

#set_extra_information(i) ⇒ Object

#

set_extra_information

#


2048
2049
2050
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2048

def set_extra_information(i)
  set(:extra_information, i)
end

#set_extract_to(i = :use_extract_to_or_the_default_rbt_log_directory_otherwise) ⇒ Object Also known as: extract_to=, sync_extract_to_onto_the_main_hash

#

set_extract_to

Consistently use this method when you wish to use the extract_to variable.

This variable must ALWAYS keep the location of where to extract a package to lateron.

Values set in the corresponding .yml file are able to overrule this.

#


1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1675

def set_extract_to(
    i = :use_extract_to_or_the_default_rbt_log_directory_otherwise
  )
  case i
  # ======================================================================= #
  # === :use_extract_to_or_the_default_rbt_log_directory_otherwise
  # ======================================================================= #
  when :use_extract_to_or_the_default_rbt_log_directory_otherwise
    if extract_to?.to_s.empty?
      i = rbt_log_directory?
    else
      i = extract_to? # This is for e. g. "linux.yml" which has an extract_to: entry.
    end
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default,
       nil
    i = rbt_log_directory?
  end
  i = i.dup # We don't want to keep a tainted reference.
  # ======================================================================= #
  # Ensure that we have a proper default value if the input was ''.
  # ======================================================================= #
  i = extract_to? if i.to_s.empty?
  # ======================================================================= #
  # Try to get an ENV variable here, if ENV is part of @extract_to.
  # ======================================================================= #
  if i.include? 'ENV'
    match = i.gsub(/ENV\['/,'').gsub(/'\]/,'') # contains the ENV variable
    i = ENV[match].dup
  end
  # ======================================================================= #
  # append / if the last character is not '/'
  # ======================================================================= #
  i << '/' unless i.end_with? '/'
  set(:extract_to, i)
end

#set_flatpak_url(i) ⇒ Object Also known as: flatpak_url=

#

set_flatpak_url

#


1606
1607
1608
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1606

def set_flatpak_url(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_gir_files(i) ⇒ Object

#

set_gir_files

#


549
550
551
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 549

def set_gir_files(i)
  set(:gir_files, i)
end

#set_git_url(i) ⇒ Object

#

set_git_url

#


619
620
621
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 619

def set_git_url(i)
  set(:git_url, i)
end

#set_has_to_be_compiled(i = true) ⇒ Object

#

set_has_to_be_compiled

#


1814
1815
1816
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1814

def set_has_to_be_compiled(i = true)
  set(:has_to_be_compiled, i)
end

#set_headers(i) ⇒ Object

#

set_headers

#


605
606
607
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 605

def set_headers(i)
  set(:headers, i)
end

#set_homepage(i = nil) ⇒ Object

#

set_homepage

#


964
965
966
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 964

def set_homepage(i = nil)
  set(:homepage, i)
end

#set_installation_steps(i) ⇒ Object

#

set_installation_steps

#


598
599
600
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 598

def set_installation_steps(i)
  set(:installation_steps, i)
end

#set_internal_commandline_arguments(i = ARGV) ⇒ Object

#

set_internal_commandline_arguments

#


2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2055

def set_internal_commandline_arguments(
    i = ARGV
  )
  # ======================================================================= #
  # === :internal_commandline_arguments
  #
  # Keep track of the commandline arguments in the main Hash of this
  # class.
  # ======================================================================= #
  @internal_hash[:internal_commandline_arguments] = [i].flatten.compact
end

#set_internal_prefix(i = '/usr/', bypass_check = :no_longer_available) ⇒ Object Also known as: set_prefix, prefix=, prefix_to_use=, update_prefix

#

set_internal_prefix

Use this method to set towards a specific prefix, such as ‘/usr/’.

This is then the option that will be passed into scripts such as ‘configure’ or cmake-based systems.

This setter method is NOT allowed to modify the given input.

#


5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5936

def set_internal_prefix(
    i            = '/usr/',
    bypass_check = :no_longer_available # false
  )
  if i.is_a? Symbol
    i = '/usr/'
  end
  @internal_hash[:dataset][:prefix] = i
  # Or use set(:prefix, i).
end

#set_is_an_active_project(i) ⇒ Object

#

set_is_an_active_project

#


1137
1138
1139
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1137

def set_is_an_active_project(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_keep_extracted(i) ⇒ Object Also known as: keep_extracted=

#

set_keep_extracted

#


2031
2032
2033
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2031

def set_keep_extracted(i)
  set(:keep_extracted, i)
end

#set_last_update(i) ⇒ Object

#

set_last_update

#


528
529
530
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 528

def set_last_update(i)
  set(:last_update, i)
end

#set_libexec(i) ⇒ Object Also known as: libexec=

#

set_libexec

#


1582
1583
1584
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1582

def set_libexec(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_libraries(i) ⇒ Object

#

set_libraries

#


1793
1794
1795
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1793

def set_libraries(i)
  set(:libraries, i)
end

#set_licence(i) ⇒ Object Also known as: set_license

#

set_licence

#


612
613
614
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 612

def set_licence(i)
  set(:licence, i)
end

#set_localstatedir(i) ⇒ Object

#

set_localstatedir

#


1589
1590
1591
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1589

def set_localstatedir(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_m4_files(i) ⇒ Object Also known as: m4_files=

#

set_m4_files

#


1596
1597
1598
1599
1600
1601
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1596

def set_m4_files(i)
  unless i.is_a? Array
    i = [i].compact
  end
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(i) ⇒ Object

#

set_make_use_of_aliases_kept_in_the_file_cookbook_aliases

#


1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1988

def set_make_use_of_aliases_kept_in_the_file_cookbook_aliases(i)
  case i
  # ======================================================================= #
  # === :nope
  # ======================================================================= #
  when :nope,
       :user_disabled_this_setting_via_the_commandline
    i = false
  end
  @internal_hash[:make_use_of_aliases_kept_in_the_file_cookbook_aliases] = i
end

#set_manual_steps(i) ⇒ Object

#

set_manual_steps

#


535
536
537
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 535

def set_manual_steps(i)
  set(:manual_steps, i)
end

#set_may_we_modify_the_configure_options(i) ⇒ Object

#

set_may_we_modify_the_configure_options

#


1627
1628
1629
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1627

def set_may_we_modify_the_configure_options(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_md5sum(i) ⇒ Object

#

set_md5sum

#


2024
2025
2026
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2024

def set_md5sum(i)
  set(:md5sum, i)
end

#set_meson_configure_options(i) ⇒ Object Also known as: meson_configure_options=

#

set_meson_configure_options

#


971
972
973
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 971

def set_meson_configure_options(i)
  set(:meson_configure_options, i)
end

#set_mirror(i) ⇒ Object

#

set_mirror

#


1613
1614
1615
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1613

def set_mirror(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_modify_the_makefile(i) ⇒ Object

#

set_modify_the_makefile

#


756
757
758
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 756

def set_modify_the_makefile(i)
  set(:modify_the_makefile, i)
end

#set_original_unmodified_name(i) ⇒ Object

#

set_original_unmodified_name

#


985
986
987
988
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 985

def set_original_unmodified_name(i)
  i = i.dup if i # We work on a copy, though.
  @internal_hash[:original_unmodified_name] = i
end

#set_parameters_to_make(i) ⇒ Object Also known as: set_make_options

#

set_parameters_to_make

#


1981
1982
1983
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1981

def set_parameters_to_make(i)
  set(:parameters_to_make, i)
end

#set_pkgconfig_files(i) ⇒ Object Also known as: pkgconfig_files=

#

set_pkgconfig_files

Do note that this entry must be kept as an Array at all times.

#


638
639
640
641
642
643
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 638

def set_pkgconfig_files(i)
  unless i.is_a? Array
    i = [i].compact
  end
  set(:pkgconfig_files, i)
end

#set_postinstall(i) ⇒ Object Also known as: set_postinstallation, postinstallation=

#

set_postinstall

#


1044
1045
1046
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1044

def set_postinstall(i)
  set(:postinstall, i)
end

#set_pre_configure_steps(i) ⇒ Object

#

set_pre_configure_steps

#


1130
1131
1132
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1130

def set_pre_configure_steps(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_pre_make_commands(i) ⇒ Object

#

set_pre_make_commands

#


2017
2018
2019
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2017

def set_pre_make_commands(i)
  set(:pre_make_commands, i)
end

#set_preinstall(i) ⇒ Object Also known as: preinstall=

#

set_preinstall

#


542
543
544
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 542

def set_preinstall(i)
  set(:preinstall, i)
end

#set_program_compile_name(i) ⇒ Object

#

set_program_compile_name

#


2010
2011
2012
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2010

def set_program_compile_name(i)
  set(:program_compile_name, i)
end

#set_program_full_name(i = :default) ⇒ Object Also known as: build_program_full_name

#

set_program_full_name

This is entry (6) program_full_name, a combination of the two other values called program_name_and_program_version?+archive_type?.

The program_full_name variable thus looks like this:

gnome-mahjonng-5.08.tar.xz

It consists of program_name_and_program_version?+archive_type?

#


1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1924

def set_program_full_name(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = "#{program_name_and_program_version?}"\
        "#{archive_type?}"
  end
  set(:program_full_name, i)
end

#set_program_name(i = :default) ⇒ Object Also known as: set_program, program_name=

#

set_program_name (entry number 2)

This is entry number (2), the setter for the program name.

The program name of a program might be something such as this:

gnome-mahjonng
file

A ‘-’ is usually required as separator for a proper “program_name” entry, about at the least in 99.5% of the programs out there in the wild. They usually include a ‘-’ as part of the program name.

Note that there are some weird exceptions, such as “boost_1_59_0”.

Consistently use this and ONLY this method when modifying the ‘program_name’ entry in the main dataset.

Some other programs require to have a ‘_’ as part of the program name.

This can lead to problems such as for those programs that have a _ as part of their name. A good example is the name “e_dbus”, which includes includes a ‘_’ token as part of its name.

In Jan 2014, I realized that eliminating ‘_’ is too much of a hassle, so I disabled it in this method. I will retain the explanation above though, in the event that future programmers - or future me - may encounter similar problems.

#


1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1753

def set_program_name(
    i = :default
  )
  if i.is_a? Array
    i = i.first
  end
  case i
  when :default
    i = return_sanitize_url1(url1?.to_s.dup)
  when 'URL_REPLACE_UNDERSCORE'
    i = url1?.to_s.dup
  when :assemble, :guess # Then we assemble it for these two conditions.
    i = assemble_program_name # In these cases, we will try to guess the name.
  when 'FIRST_UNDERSCORE_IS_HYPHEN'
    e 'UNHANDLED - Reonsider.'
    exit
  end
  i = i.to_s.dup
  i = remove_archive_at_the_end(i)
  # ======================================================================= #
  # A program name never has a '/'.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  i = remove_file_extension(i) if i.include? '.' # ← Added this as of Nov 2013.
  set(:program_name, i)
end

#set_program_name_and_program_version(i = :default) ⇒ Object Also known as: update_program_name_and_program_version

#

set_program_name_and_program_version

This is entry number (4), combining program_name and program_version.

#


5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5907

def set_program_name_and_program_version(
    i = :default
  )
  case i
  # === :default
  when :default
    i = "#{program_name?}#{connective_token?}#{program_version?}"
  end
  set(:program_name_and_program_version, i)
end

#set_program_path(i = :default) ⇒ Object Also known as: program_path=

#

set_program_path (8 tag)

This is (8) program_path, which may look like this:

'/home/x/src/gnomemahjongg/gnome-mahjonng-5.08.tar.xz'
'/home/x/src/file/file-5.08.tar.xz'

So essentially, the program_path is composed of these two elements:

- base_dir?
- program_full_name?

In other words, this combines (7) + (6), the two main components, or shown one after the other:

(7) base_dir,          such as: "/home/x/src/file/"
(6) program_full_name, such as: "file-5.08.tar.xz" (so
    this is program_name_and_program_version?+archive_type?)

It is the most important entry, containing everything - which is the major goal for the class here.

#


1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1013

def set_program_path(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = base_dir?.to_s+
        program_full_name?
  # ======================================================================= #
  # === :try_to_rebuild_it_from_smaller_components
  #
  # This is similar to :default but will rebuild from slightly
  # smaller components.
  # ======================================================================= #
  when :try_to_rebuild_it_from_smaller_components
    archive_type = archive_type?
    if archive_type and archive_type.empty?
      archive_type = '.tar.xz'
    end
    i = base_dir?+
        program_name_and_program_version?+
        archive_type
  end
  set(:program_path, i)
end

#set_program_version(i = program_version?, , propagate_the_change = true) ⇒ Object Also known as: set_program_version=, set_version, use_this_version=

#

set_program_version (version tag)

This is entry number (3), the program version of our program at hand.

An example for this would be ‘5.08’, for instance.

As of January 2019, this method will also eliminate all ‘/’ from the input, if found. A proper program version does not have this character.

#


5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5961

def set_program_version(
    i                    = program_version?,
    propagate_the_change = true
  )
  case i
  # ======================================================================= #
  # === INFER_THE_VERSION
  # ======================================================================= #
  when /INFER_THE_VERSION/ # Match this one exactly.
    _ = url1? # This may be: https://github.com/FluidSynth/fluidsynth/archive/refs/tags/v2.3.1.tar.gz
    if _.include?('/')
      _ = File.basename(_)
    end
    i = remove_archive_at_the_end(_).delete('v')
  # ======================================================================= #
  # === :infer_from_the_program_name_and_program_version
  # ======================================================================= #
  when :infer_from_the_program_name_and_program_version
    i = ProgramInformation.return_version(
      program_name_and_program_version?
    )
  end
  i = i.to_s.dup # Work on a copy.
  i.delete!('/')        if i.include? '/'
  i.gsub!(/\.src/,'')   if i.include? '.src'
  i.gsub!(/_src/,'')    if i.include? '_src'
  i.sub!(/-source$/,'') if i.include? '-source'
  i.sub!(/-Source/,'')  if i.include? '-Source'
  i = chop_off_archive(i)
  i = remove_file_suffix(i) # Added this as of January 2014.
  if i.include? '#' # This is an illegal character as of April 2014.
    i = i[0, i.index('#')]
  end
  set(:program_version, i)
  if propagate_the_change
    update_program_name_and_program_version
    update_the_program_path
  end
end

#set_programs_dir(i = '/Programs/') ⇒ Object Also known as: programs_dir=

#

set_programs_dir

This method can be used to designate another directory for the programs to be stored, other than ‘/Programs/’.

#


1658
1659
1660
1661
1662
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1658

def set_programs_dir(
    i = '/Programs/'
  )
  @internal_hash[:programs_dir] = i
end

#set_raw_cookbook(i) ⇒ Object

#

set_raw_cookbook

#


6096
6097
6098
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6096

def set_raw_cookbook(i)
  @internal_hash[:raw_cookbook] = i
end

#set_required_deps_on(i) ⇒ Object

#

set_required_deps_on

Set the required dependencies for a program through this method.

Note that this method will not do any sanitizing - you have to sanitize the input on your own prior to calling this method.

#


1946
1947
1948
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1946

def set_required_deps_on(i)
  set(:required_deps_on, i)
end

#set_run_configure(i) ⇒ Object

#

set_run_configure

#


1835
1836
1837
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1835

def set_run_configure(i)
  set(:run_configure, i)
end

#set_run_make(i) ⇒ Object

#

set_run_make

#


1856
1857
1858
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1856

def set_run_make(i)
  set(:run_make, i)
end

#set_sed(i) ⇒ Object Also known as: sed=

#

set_sed

#


1870
1871
1872
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1870

def set_sed(i)
  set(:sed, i)
end

#set_seek_this_program(i = :default) ⇒ Object Also known as: seek_this_program, seek, set_search_term, set_search_for_this_program

#

set_seek_this_program

This method should be used to designate which program is to be sought.

The method is allowed to modify the given input.

The search-string should always be a String.

Keep in mind that the input to this method may also be in the form of a String such as “php.yml”. In that case, we have to get rid of the trailing ‘.yml’ part.

Additionally, do note that the input could be a binary name or a library name. In these two cases, we may overrule the input provided but this can be configured via some settings.

Since as of September 2012, aliases can overrule this setting. This, however had, may lead to problems, such as “make” suddenly becoming “makeinfo” rather than being kept as make.

#


782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 782

def set_seek_this_program(
    i = :default
  )
  i = i.keys.first if i.is_a? Hash
  if i.is_a? Array
    # ===================================================================== #
    # Flatten the Array first, before using only the first entry.
    # ===================================================================== #
    i = i.flatten.first
  end
  case i
  when nil, ''
    i = DEFAULT_ENTRY
  end
  i = i.to_s.dup
  set_original_unmodified_name(i)
  # ======================================================================= #
  # Clean-up the input a bit next.
  # ======================================================================= #
  if    i.end_with? '.yml'
    i.delete_suffix!('.yml')
  elsif i.end_with? '.pc'
    i.delete_suffix!('.pc')
  end
  i.downcase! # Work on a reference copy that is also downcased.
  i.delete!('-') if i.include? '-'
  i.delete!('_') if i.include? '_'
  # ======================================================================= #
  # Neither '-' nor '_' are allowed as input past this point.
  # ======================================================================= #
  if i.include? '.'
    i.sub!(/#{File.extname(i)}/,'')
  end
  # ======================================================================= #
  # === Chop off trailing '/' next
  #
  # Next, this method may chop off trailing '/' characters.
  #
  # A trailing '/' is assumed to have been a typo, since it evidently
  # can not be the name of an existing program. Nobody will call a
  # file or input program something such as 'libgweather/'.
  # ======================================================================= #
  i.chop! if i.end_with? '/'
  all_binaries  = all_binaries?
  all_libraries = all_libraries?
  i = File.basename(i) if i.include? '/'
  # ======================================================================= #
  # === Handle possible binary names next
  #
  # Here we will check for binary names of programs, but only if the input
  # has not yet been found as regular name of a registered program at
  # hand. As this is not always needed anyway, we will use various checks
  # to make sure that we really want to find a binary name.
  #
  # In order to test this, try:
  #
  #   cookbooks2 xmlif
  #   ry xmlif
  #
  # ======================================================================= #
  if !does_include?(i) and
     check_for_binary_names? and
     all_binaries.has_key?(i) and
     (i != all_binaries[i]) and
     (!i.empty?)
    new_name = all_binaries[i]
    report_binary_or_library_program_name(i, new_name, :binary)
    i = new_name
  # ======================================================================= #
  # === Check for library names
  #
  # Similar reasoning applies to this entry point, as to the one above
  # for binary names.
  # ======================================================================= #
  elsif !does_include?(i) and check_for_library_names? and
     all_libraries.has_key?(i) and (i != all_libraries[i])
    new_name = all_libraries[i]
    report_binary_or_library_program_name(i, new_name, :library)
    i = new_name
  end
  # ======================================================================= #
  # Query whether the program is included or whether it is not. If
  # it is not included, but is included if 'lib' is put before it,
  # then we will use that as name instead.
  # ======================================================================= #
  unless does_include?(i)
    if does_include?("lib#{i}")
      i.prepend('lib')
    end
  end
  if (does_include?(i, :do_not_check_for_aliases) == false) and
     does_include?(i)
    # ===================================================================== #
    # In this case we will assume it is an alias, such as 'ecm'.
    # ===================================================================== #
    available_aliases = YAML.load_file(RBT.file_cookbook_aliases)
    i = available_aliases[i]
    opne "An alias was found. It will be used now. (Name: #{steelblue(i)})."
  end
  # ======================================================================= #
  # === Next check for entries that lack a leading 'lib' entry
  #
  # If they do, and a program with the same name can be found,
  # it will be used as input instead.
  #
  # An example for this would be the input "x11" which would
  # become "libx11" due to the following code.
  # ======================================================================= #
  unless does_include?(i, :do_not_check_for_aliases)
    if does_include?("lib#{i}", :do_not_check_for_aliases)
      opne "The given input #{sfancy(i)} is not included "\
           "but #{sfancy('lib'+i)} is."
      opne 'Thus using this as the new input next.'
      i.prepend('lib')
    end
    # ===================================================================== #
    # === Check for Abbreviations if the key was not found
    # ===================================================================== #
    unless i.empty?
      # =================================================================== #
      # Ok, we did not find anything, so check for abbreviations.
      # =================================================================== #
      available_programs = available_programs?
      require 'abbrev' unless Object.const_defined? :Abbrev
      abbrevs = Abbrev.abbrev(available_programs)
      if abbrevs.has_key? i
        # ================================================================= #
        # Ok, this means that our key is included.
        # ================================================================= #
        i = abbrevs.fetch(i)
      end
    end
  end
  if is_this_program_included? i
    the_program_was_found
  end
  @internal_hash[:seek_this_program] = i
end

#set_sha256(i) ⇒ Object

#

set_sha256

#


3185
3186
3187
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3185

def set_sha256(i)
  set(:sha256, i)
end

#set_short_description(i = nil) ⇒ Object Also known as: set_short_desc

#

set_short_description

The short_description entry should not end with a newline.

#


2040
2041
2042
2043
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2040

def set_short_description(i = nil)
  i.chomp! if i # We do not want trailing newlines.
  set(:short_description, i)
end

#set_short_name(i = program_name? # 1 tag ) ⇒ Object Also known as: set_real_short_name, determine_real_short_name, set_program_short_name, set_real_program_name=

#

set_short_name

This is entry number (1), the setter for the short name of the program. It will set the short_name entry in the main cookbook dataset.

The ‘short_name’ variable is NOT allowed to include the ‘-’ character.

Valid input to this method could be something like:

"xfce4-dev-tools"

We must delete all ‘-’ if they occur.

#


5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5710

def set_short_name(
    i = program_name? # 1 tag
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = program_name?.dup
  end
  i = i.to_s.dup # ← This must come after checking for Symbols.
  i.downcase!
  i.delete!('-') if i.include? '-'
  # ======================================================================= #
  # If the input includes .tar, check it further.
  # ======================================================================= #
  if i and i.include?('.tar')
    i = ::ProgramInformation.return_short_name(i)
  end
  # ======================================================================= #
  # === Eliminate '/' if they are found.
  # ======================================================================= #
  if i.include? '/'
    i = File.basename(i)
  end
  dataset?[:short_name] = i
end

#set_simpleObject

#

set_simple

#


5811
5812
5813
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5811

def set_simple
  set_simple_or_complex(:simple)
end

#set_simple_or_complex(i = :default) ⇒ Object

#

set_simple_or_complex

#


5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5761

def set_simple_or_complex(
    i = :default
  )
  # ======================================================================= #
  # === @simple_or_complex
  #
  # This can be :simple or :complex. The value for :default will be
  # :complex. 
  # ======================================================================= #
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default,
       nil
    i = :complex
  # ======================================================================= #
  # === :use_expanded_dataset
  # ======================================================================= #
  when :use_expanded_dataset,
       :expanded,
       :fast,
       :complex
    i = :complex
  # ======================================================================= #
  # === :fast_and_be_verbose
  # ======================================================================= #
  when :fast_and_be_verbose
    i = :complex
    set_be_verbose
  # ======================================================================= #
  # === :simple
  # ======================================================================= #
  when :simple,
       :simple_cookbook
    i = :simple
  # ======================================================================= #
  # === :expanded
  # ======================================================================= #
  else
    pp caller()
    e 'Unknown: '+i.to_s+' ('+i.class.to_s+')  - please fix this.'
    exit
  end
  @internal_hash[:simple_or_complex] = i
end

#set_skip_configure(i) ⇒ Object

#

set_skip_configure

#


1828
1829
1830
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1828

def set_skip_configure(i)
  set_run_configure(!i)
end

#set_svn_url(i) ⇒ Object

#

set_svn_url

#


1641
1642
1643
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1641

def set_svn_url(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end
#
#


1620
1621
1622
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1620

def set_symlink_glib_schema(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end
#

If we want to symlink the headers, this is the setter-method that should be called.

#


1880
1881
1882
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1880

def set_symlink_headers(i = true)
  set(:symlink_headers, i)
end
#
#


3206
3207
3208
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3206

def set_symlink_pkgconfig_files(i = true)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_tags(i) ⇒ Object

#

set_tags

#


1800
1801
1802
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1800

def set_tags(i)
  set(:tags, i)
end

#set_url1(i) ⇒ Object

#

set_url1

This method will not do any sanitize-action on its own. It will be a pure setter-method.

#


506
507
508
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 506

def set_url1(i)
  set(:url1, i)
end

#set_url2(i) ⇒ Object

#

set_url2

#


513
514
515
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 513

def set_url2(i)
  set(:url2, i)
end

#set_use_autoconf(i) ⇒ Object

#

set_use_autoconf

#


1634
1635
1636
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1634

def set_use_autoconf(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_use_autogen(i = true) ⇒ Object Also known as: use_autogen=

#

use_autogen

#


520
521
522
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 520

def set_use_autogen(i = true)
  set(:use_autogen, i)
end

#set_use_build_directory(i) ⇒ Object Also known as: use_build_directory=

#

set_use_build_directory

#


1563
1564
1565
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1563

def set_use_build_directory(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_use_glib_schema(i = nil) ⇒ Object Also known as: use_glib_schema=

#

set_use_glib_schema

#


1887
1888
1889
1890
1891
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1887

def set_use_glib_schema(i = nil)
  if i
    set(:use_glib_schema, i)
  end
end

#set_use_this_build_directory(i) ⇒ Object Also known as: use_this_build_directory=

#

set_use_this_build_directory

#


591
592
593
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 591

def set_use_this_build_directory(i)
  set(:use_this_build_directory, i)
end

#set_use_this_build_system(i = :default) ⇒ Object Also known as: set_build_system

#

set_use_this_build_system

This method will set the build-system that should be used for the given program at hand. By default we will infer automatically, with the default being set to the Symbol called :infer_automatically.

#


948
949
950
951
952
953
954
955
956
957
958
959
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 948

def set_use_this_build_system(
    i = :default
  )
  case i
  # ======================================================================= #
  # === :default
  # ======================================================================= #
  when :default
    i = :infer_automatically
  end
  set(:use_this_build_system, i)
end

#set_use_this_connective_token(i = '-') ⇒ Object Also known as: use_default_connective_token_again, set_separator_token

#

set_use_this_connective_token

#


927
928
929
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 927

def set_use_this_connective_token(i = '-')
  @internal_hash[:use_this_connective_token] = i
end

#set_use_this_make_command(i) ⇒ Object Also known as: use_this_make_command=

#

set_use_this_make_command

#


1863
1864
1865
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1863

def set_use_this_make_command(i)
  set(:use_this_make_command, i)
end

#set_use_this_make_install_command(i) ⇒ Object Also known as: use_this_make_install_command=

#

set_use_this_make_install_command

#


1849
1850
1851
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1849

def set_use_this_make_install_command(i)
  set(:use_this_make_install_command, i)
end

#set_wikipedia(i) ⇒ Object

#

set_wikipedia

#


1648
1649
1650
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1648

def set_wikipedia(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#sha256?Boolean Also known as: sha256sum?

#

sha256?

#

Returns:

  • (Boolean)


3199
3200
3201
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3199

def sha256?
  obtain(__method__.to_s.delete('?').to_sym)
end

#shall_we_display_the_md5sum?Boolean Also known as: display_md5sum?

#

shall_we_display_the_md5sum?

Query whether we shall display the md5sum or whether we shall not.

#

Returns:

  • (Boolean)


4879
4880
4881
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4879

def shall_we_display_the_md5sum?
  dataset?[:shall_we_display_the_md5sum]
end

#short_description?Boolean Also known as: short_desc?, return_short_description

#

short_description?

This method will obtain the short description of a given program.

Not every program will have a short description, but it is recommended that all programs SHOULD have a short description.

#

Returns:

  • (Boolean)


5359
5360
5361
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5359

def short_description?
  obtain __method__.to_s.delete('?').to_sym
end

#short_name?Boolean Also known as: real_short_name?, rshort?, program_short_name?, short_program_name?, shortname?, short_name, sname?, name, name?

#

short_name?

Reader method for short_name.

This method will query the short name of the program we are trying to find.

For example, this method will return the program name without the version, such as:

"ruby" (which is part of the program_name "ruby-2.2.0")

This method must always return a String, even if it is an empty String.

Characters such as ‘-’ are NOT allowed to be part of the short_name variable. The corresponding setter-method will make sure of this.

#

Returns:

  • (Boolean)


5384
5385
5386
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5384

def short_name?
  obtain __method__.to_s.delete('?').to_sym
end

#show_helpObject

#

show_help (help tag)

To invoke this particular method, try:

cookbook --help

To invoke individual entries, do:

cookbook nprograms?
cookbook --overview
cookbook --version
#


4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4082

def show_help
  left_padding = '  ' # A bit of left-padding here.
  n_space_characters = 50
  how_to_invoke_the_program = HOW_TO_INVOKE_THE_PROGRAM
  opne 'This class can feedback information about any '\
       'specific program.'
  e
  # ======================================================================= #
  # === Common usage examples
  # ======================================================================= #
  e 'Common usage examples:'
  e
  e left_padding+how_to_invoke_the_program+' ruby'
  e left_padding+how_to_invoke_the_program+' htop'
  e left_padding+how_to_invoke_the_program+' m4'
  e
  # ======================================================================= #
  # === Advanced Options
  # ======================================================================= #
  e 'Advanced options:'
  e
  e properly_pad_and_colourize_this_help_option('nprograms?',
      'show how many programs are registered in the cookbooks-collection'
    )
  e properly_pad_and_colourize_this_help_option('--aliases?',
      'show all available aliases to the registered cookbooks-programs'
    )
  e properly_pad_and_colourize_this_help_option('--available_programs?',
      'show all available programs'
    )
  e properly_pad_and_colourize_this_help_option('--batch-download-all-source-archives',
      'batch-download all source archives (optionally select for specific tags)'
    )
  e properly_pad_and_colourize_this_help_option('--overview',
      'give us an overview over all programs in the utility_scripts directory,'
    )
  e (' ' * n_space_characters)+'# of the cookbooks project'
  e properly_pad_and_colourize_this_help_option('--format=[name]',
      'feedback the format type of this entry,'
    )
  e (' ' * n_space_characters)+'# such as via '+simp('cookbook --format=postinstall')
  e properly_pad_and_colourize_this_help_option('--expand',
      'to expand the short yaml dataset into'
    )
  e properly_pad_and_colourize_this_help_option('--expand=PROGRAM_NAME',
      'to expand an individual program, such as python or ruby'
    )
  # ======================================================================= #
  # === --n-registered-binaries?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--n-registered-binaries?',
      'to report how many registered binaries are available'
    )
  # ======================================================================= #
  # === --show-all-about=PROGRAM_NAME
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--show-all-about=PROGRAM_NAME',
      'to show all about the given program at hand'
    )
  e properly_pad_and_colourize_this_help_option('--permanently-disable-colours',
      'to permanently disable all colour output by the Cookbooks project'
    )
  e properly_pad_and_colourize_this_help_option('--update-kde-plasma',
      'batch-update (that is, download) all KDE5 components of KDE Plasma'
    )
  e (' ' * n_space_characters)+'# a long dataset; --initialize is an alias to this action'
  e properly_pad_and_colourize_this_help_option('--create-programs-version-html-file',
      'create and upload a .html file containing all '\
      'program_name-program_versions'
    )
  e (' ' * n_space_characters)+'# entries. This is primarily meant for my home system.'
  # ======================================================================= #
  # === --allowed_tags?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--allowed_tags?',
     'show a list of all allowed tags in the '+simp('tags: subsection')+
     ' of a cookbook-yaml file'
    )
  # ======================================================================= #
  # === --generate_version_file
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--generate_version_file',
      'to generate a programs-version yaml file'
    )
  # ======================================================================= #
  # === --use-psych
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--use-psych',
      'to use psych for the yaml files'
    )
  # ======================================================================= #
  # === --use-syck
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--use-syck',
      'to use syck for the yaml files'
    )
  # ======================================================================= #
  # === --create-html-page-for-these-programs=
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--create-html-page-for-these-programs=',
      'to generate a .html page for the given programs; separate '\
      'the input via'
    )
  e (' ' * n_space_characters)+'# "'+sfancy(',')+'" such as in '+
    simp('=ruby,python,php')
  # ======================================================================= #
  # === --n_binaries?
  # ======================================================================= #
  e properly_pad_and_colourize_this_help_option('--n_binaries?',
      'tell us how many binaries/executables are tracked '\
      'in all cookbook-yaml files'
    )
  e properly_pad_and_colourize_this_help_option('--publish',
      'publish the list of all program versions of the cookbooks project'
    )
  e properly_pad_and_colourize_this_help_option('--total-size?',
      'show the total size of all locally available archives'
    )
  e properly_pad_and_colourize_this_help_option('--tutorial',
      'do show the short tutorial how the Cookbooks project may be used'
    )
  e properly_pad_and_colourize_this_help_option('--update-tags',
      'do update the tags defined in the various cookbooks'
    )
  e properly_pad_and_colourize_this_help_option('--validate-entries',
      'validate all Cookbook entries'
    )
  e properly_pad_and_colourize_this_help_option('--version',
      'feedback the current version of the Cookbooks gem'
    )
  e properly_pad_and_colourize_this_help_option('--set_source_dir=/tmp',
      'permanently set a new source dir (aka where all '\
      'archives are kept locally)'
    )
  e properly_pad_and_colourize_this_help_option('--set_temp_dir=/tmp',
      'permanently change the yaml file to set a '\
      'new temp directory'
    )
  e
end

#show_n_programs_availableObject

#

show_n_programs_available

#


4317
4318
4319
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4317

def show_n_programs_available
  e return_n_programs_available
end

#show_tagsObject

#

show_tags

#


4233
4234
4235
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4233

def show_tags
  e return_tags
end

#show_this_dataset_containing_which_entries_should_be_displayed(i = array_show_these_entries? ) ⇒ Object Also known as: show_this_array

#

show_this_dataset_containing_which_entries_should_be_displayed (display tag)

#


2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2279

def show_this_dataset_containing_which_entries_should_be_displayed(
    i = array_show_these_entries?
  )
  # ======================================================================= #
  # Determine the threshold value to use for this display.
  # ======================================================================= #
  threshold_value = 68
  left_pad = '  '
  ljust_value = 43
  i.each {|this_entry|
    case this_entry # case tag
    # ===================================================================== #
    # === extra_information
    # ===================================================================== #
    when :extra_information
      # =================================================================== #
      # === Handle extra_information
      #
      # Next, limit the size for extra_description. We do not want to show
      # too much here.
      # =================================================================== #
      result = send_this_method_and_sanitize_arrays("#{this_entry}?").to_s
      if self.class.honour_threshold_value?
        if (result.size > threshold_value)
          result = result[0, result.index("\n")].delete('"')+' [...]'
        end
      end
      result.chomp!
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkslateblue(result.lstrip)
    # ===================================================================== #
    # === description
    #
    # Handle the description entry here.
    # ===================================================================== #
    when :description
      result = description?.chomp.rstrip
      if (result.size > threshold_value)
        result = result.tr("\n",' ')[0..(threshold_value-2)]+' [...]'
      end
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        limegreen(result.lstrip)+rev
    # ===================================================================== #
    # === program_version
    #
    # Feedback the program-version at hand.
    # ===================================================================== #
    when :program_version
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        springgreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === :use_this_build_system
    # ===================================================================== #
    when :use_this_build_system
      result = send_this_method_and_sanitize_arrays("#{this_entry}?").to_s.dup
      result.prepend(':') if result == 'infer_automatically'
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumpurple(result)
    # ===================================================================== #
    # === homepage
    #
    # Colourize the homepage properly.
    # ===================================================================== #
    when :homepage
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkseagreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === flatpak_url
    # ===================================================================== #
    when :flatpak_url
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumseagreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)+rev
    # ===================================================================== #
    # === .gir files
    #
    # This entry point can be used to display the .gir files, if they
    # exist.
    # ===================================================================== #
    when :gir_files
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkseagreen(
          send_this_method_and_sanitize_arrays("#{this_entry}?")
        )
    # ===================================================================== #
    # === extract_to
    # ===================================================================== #
    when :extract_to
      result = send_this_method_and_sanitize_arrays("#{this_entry}?").to_s
      unless result.empty?
        e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
          cornflowerblue(result)
      end
    # ===================================================================== #
    # === program_name
    # ===================================================================== #
    when :program_name
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumslateblue(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === blfs
    # ===================================================================== #
    when :blfs
      result = send_this_method_and_sanitize_arrays("#{this_entry}?")
      result = result.flatten.first if result.is_a? Array
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkseagreen(result.to_s.delete('[]')) # .to_s to avoid nil values.
    # ===================================================================== #
    # === short_name
    #
    # Is steelblue.
    # ===================================================================== #
    when :short_name
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        steelblue(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === use_autogen
    # ===================================================================== #
    when :use_autogen
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        cadetblue(
          yes_or_no(
            send_this_method_and_sanitize_arrays("#{this_entry}?").to_s
          )
        )
    # ===================================================================== #
    # === headers
    #
    # This entry point can be used to display the headers.
    # ===================================================================== #
    when :headers
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkseagreen(
          send_this_method_and_sanitize_arrays(this_entry.to_s+'?', 5) # ← Limit to 5 by default.
        )
    # ===================================================================== #
    # === binaries
    #
    # This entry point can be used to display the binaries.
    # ===================================================================== #
    when :binaries
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(
          send_this_method_and_sanitize_arrays(this_entry.to_s+'?', 5) # ← Limit to 5 by default.
        )
    # ===================================================================== #
    # === libraries
    #
    # This entry point can be used to display the libraries.
    # ===================================================================== #
    when :libraries
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(
          send_this_method_and_sanitize_arrays(this_entry.to_s+'?', 5) # ← Limit to 5 by default.
        )
    # ===================================================================== #
    # === sed
    # ===================================================================== #
    when :sed
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumturquoise(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === short_description
    # ===================================================================== #
    when :short_description
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumturquoise(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === run_configure
    # ===================================================================== #
    when :run_configure
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        olivedrab(
          yes_or_no(send_this_method_and_sanitize_arrays("#{this_entry}?")).to_s
        )
    # ===================================================================== #
    # === has_to_be_compiled
    # ===================================================================== #
    when :has_to_be_compiled
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        steelblue(
          yes_or_no(send_this_method_and_sanitize_arrays("#{this_entry}?")).to_s
        )
    # ===================================================================== #
    # === skip_configure
    # ===================================================================== #
    when :skip_configure
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumorchid(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === archive_size
    # ===================================================================== #
    when :archive_size,
         :file_size,
         :program_size # colourize program_size.
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumorchid(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === program_compile_name
    # ===================================================================== #
    when :program_compile_name
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        mediumslateblue(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === program_path
    # ===================================================================== #
    when :program_path
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        orange(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === configure_options
    # ===================================================================== #
    when :configure_options
      unless configure_options?.empty?
        e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
          mediumseagreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)+rev
      end
    # ===================================================================== #
    # === meson_configure_options
    # ===================================================================== #
    when :meson_configure_options
      if meson_configure_options?
        unless meson_configure_options.empty?
          e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
            mediumseagreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)+rev
        end
      end
    # ===================================================================== #
    # === do_not_symlink
    # ===================================================================== #
    when :do_not_symlink
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        lightslategray(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === keep_extracted
    # ===================================================================== #
    when :keep_extracted
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
       seagreen(
         yes_or_no(
           send_this_method_and_sanitize_arrays("#{this_entry}?").to_s
         )
       )
    # ===================================================================== #
    # === prefix
    # ===================================================================== #
    when :prefix
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        darkseagreen(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === url1
    # ===================================================================== #
    when :url1,:url2,:url3,:url4,:url5
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sandybrown(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === pkgconfig_files
    # ===================================================================== #
    when :pkgconfig_files
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        deepskyblue(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === md5sum
    # ===================================================================== #
    when :md5sum
      if show_md5sum?
        e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
          sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?"))
      end
    # ===================================================================== #
    # === remote_url
    # ===================================================================== #
    when :remote_url
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === program_full_name
    # ===================================================================== #
    when :program_full_name
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === base_dir
    # ===================================================================== #
    when :base_dir
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === archive_type
    # ===================================================================== #
    when :archive_type
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?"))
    # ===================================================================== #
    # === last_update
    # ===================================================================== #
    when :last_update
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        cornflowerblue(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    # ===================================================================== #
    # === mode
    # ===================================================================== #
    when :mode, :mode_in_use
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        cornflowerblue(send_this_method_and_sanitize_arrays("#{this_entry}?").to_s)
    else # else tag
         # ================================================================ #
         # Note that sfancy() is the default colour used here for the
         # else clause.
         # ================================================================ #
      e "#{rev}#{left_pad}#{this_entry}: ".ljust(ljust_value)+
        sfancy(send_this_method_and_sanitize_arrays("#{this_entry}?")).to_s
    end
  }
end

#simple_or_complex?Boolean Also known as: mode?, mode_in_use?, type?

#

simple_or_complex?

#

Returns:

  • (Boolean)


5061
5062
5063
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5061

def simple_or_complex?
  @internal_hash[:simple_or_complex]
end

#skip_configure?Boolean Also known as: skip_configure

#

skip_configure?

Query-method over as to whether we will skip configure or whether we will not.

#

Returns:

  • (Boolean)


4578
4579
4580
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4578

def skip_configure?
  !run_configure?
end

#sort_by_archive_priority(i) ⇒ Object

#

sort_by_archive_priority

This method will sort the archive format based on priorities.

#


3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3531

def sort_by_archive_priority(i)
  array_priority = %w(
    .xz
    .bz2
    .gz
    .lz
    .gem
    .js
  )
  begin
    selection = i.select {|entry|
      entry.include?('.') and is_an_archive?(entry)
    }
    i = selection.sort_by {|entry|
      extname = File.extname(entry)
      if array_priority.include? extname
        entry = array_priority.index(extname)
      end
      entry
    }
  rescue ArgumentError => error
    opne 'An error occurred in the method '+
         slateblue(__method__.to_s)+'. (Line: '+royalblue(__LINE__)+')'
    pp i
    pp error
    exit
  end
  return i
end

#substitute_macros(input) ⇒ Object

#

substitute_macros

Do “macro” expansion through this method.

This method will sanitize some special variables, which are assumes to be “macros” - that is, to be substituted with another value.

Right now this is only used for kernel variable, PROGRAM_NAME, PNAME, NAME, KERNEL_V and PROGRAM_VERSION but maybe someone else wants to do more macro processing, so we will keep this bundled here together.

#


3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3804

def substitute_macros(input)
  if input.is_a? Array
    input.map {|entry| substitute_macros(entry) } # Recursive call.
  else
    i = input.to_s.dup # Work on a new copy here.
    if i.include? 'PROGRAM_VERSION'
      i.gsub!(/PROGRAM_VERSION/, program_version?)
    end
    if i.include? 'PNAME'
      i.gsub!(/PNAME/,           short_name?)
    elsif i.include? 'NAME'
      i.gsub!(/NAME/,            short_name?)
    elsif i.include? 'PROGRAM_NAME'
      i.gsub!(/PROGRAM_NAME/,    short_name?)
    end
    if ENV['KERNEL_V'] && i.include?('KERNEL_V')
      i.gsub!(/#{i}/, ENV['KERNEL_V'])
    end
    i
  end
end

#svn_url?Boolean

#

svn_url?

#

Returns:

  • (Boolean)


1323
1324
1325
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1323

def svn_url?
  obtain(__method__.to_s.delete('?').to_sym)
end
#
#

Returns:

  • (Boolean)


1223
1224
1225
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1223

def symlink_glib_schema?
  obtain(__method__.to_s.delete('?').to_sym)
end
#
#

Returns:

  • (Boolean)


3283
3284
3285
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3283

def symlink_headers?
  obtain(__method__.to_s.delete('?').to_sym)
end
#
#

Returns:

  • (Boolean)


3213
3214
3215
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3213

def symlink_pkgconfig_files?
  obtain(__method__.to_s.delete('?').to_sym)
end

#tags?Boolean Also known as: return_tags, tags

#

tags?

#

Returns:

  • (Boolean)


5346
5347
5348
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5346

def tags?
  obtain __method__.to_s.delete('?').to_sym
end

#the_program_is_includedObject Also known as: the_program_was_found

#

the_program_is_included

This method will set-toggle that the program we are looking for, is included; aka that it was found.

#


3567
3568
3569
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3567

def the_program_is_included
  @internal_hash[:found] = true
end

#this_program_was_not_found(i) ⇒ Object

#

this_program_was_not_found

#


3135
3136
3137
3138
3139
3140
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3135

def this_program_was_not_found(i)
  unless i.to_s.empty?
    orev "The program #{steelblue(i.to_s)} #{rev}does "\
         "#{tomato('not')} #{rev}appear to be registered."
  end
end

#try_to_find_another_local_file(i) ⇒ Object

#

try_to_find_another_local_file

#


3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3428

def try_to_find_another_local_file(i)
  without_file_extension = remove_file_extension_from(i)
  array = action(:return_alternative_archive, without_file_extension)
  if array and !array.empty?
    first_element = array.first
    if File.exist? first_element
      set_archive(first_element)
    end
  end
end

#try_to_guess_the_archive_typeObject

#

try_to_guess_the_archive_type

This method will try to guess the archive type, e. g. .tar.xz or .tar.gz of a given program at hand, based on which files may exist locally already.

Note that program_name may look like ‘gnome-mahjongg’ and base_dir may look like ‘/home/x/src/gnomemahjongg/’.

#


4008
4009
4010
4011
4012
4013
4014
4015
4016
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4008

def try_to_guess_the_archive_type
  target = "#{base_dir?}#{program_name?}*"
  files = Dir[target]
  unless files.empty?
    first = files.first
    # And use the first variant here.
    set_archive(return_archive_type(first))
  end # else we won't set it
end

#try_to_guess_the_program_path_based_on_the_program_name_and_program_version(_ = base_dir?+ program_full_name? ) ⇒ Object

#

try_to_guess_the_program_path_based_on_the_program_name_and_program_version

This will build program_path, which is:

‘/home/x/src/gnomemahjongg/gnome-mahjonng-5.08.tar.xz’

aka base_dir?+program_full_name?

#


3835
3836
3837
3838
3839
3840
3841
3842
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3835

def try_to_guess_the_program_path_based_on_the_program_name_and_program_version(
    _ = base_dir?+
        program_full_name?
  )
  if File.exist? _
    set_program_path(_)
  end
end

#try_to_guess_the_program_version(i = program_name? ) ⇒ Object

#

try_to_guess_the_program_version

#


3651
3652
3653
3654
3655
3656
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3651

def try_to_guess_the_program_version(
    i = program_name?
  )
  _program_name, program_version = ProgramInformation.new(i).return_name_and_version
  set_program_version(program_version)
end

#update_appdir_prefixObject

#

update_appdir_prefix

#


3121
3122
3123
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3121

def update_appdir_prefix
  set_prefix(:appdir)
end

#update_kde_applicationsObject

#

update_kde_applications

#


3335
3336
3337
3338
3339
3340
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3335

def update_kde_applications
  unless RBT::Cookbooks.const_defined? :UpdateKdeApplications
    require 'rbt/check_for_updates/update_kde_applications.rb'
  end
  UpdateKdeApplications.new
end

#update_program_pathObject Also known as: assemble_full_path, update_the_program_path

#

update_program_path

#


5921
5922
5923
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5921

def update_program_path
  set_program_path(:default)
end

#update_yaml_dataset(i) ⇒ Object

#

update_yaml_dataset

#


3737
3738
3739
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3737

def update_yaml_dataset(i)
  dataset?.update(i)
end

#url1?Boolean Also known as: main_url, remote_url, main_url?, url1, url?, remote_url?, url_to_the_source_archive?

#

url1?

This method will “hold” the “most” important URL of a program, which is the entry called url1.

Every entry of our cookbooks must have this entry available.

Usage example to query the value of url1?:

puts RBT::Action::Cookbooks::SanitizeCookbook.new('htop').url1?
#

Returns:

  • (Boolean)


1210
1211
1212
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1210

def url1?
  obtain(__method__.to_s.delete('?').to_sym)
end

#url2?Boolean

#

url2?

#

Returns:

  • (Boolean)


1448
1449
1450
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1448

def url2?
  obtain(__method__.to_s.delete('?').to_sym)
end

#url3?Boolean Also known as: url3

#

url3?

#

Returns:

  • (Boolean)


5314
5315
5316
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5314

def url3?
  obtain __method__.to_s.delete('?').to_sym
end

#urls?Boolean Also known as: remote_urls, remote_urls?

#

urls?

This method is an “aggregate-method”; it will return all available URLs in Array format.

We only support 5 URLs at max right now, though.

Since as of July 2012 this method will not return empty values, as they are useless anyway.

#

Returns:

  • (Boolean)


5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5133

def urls?
  # ======================================================================= #
  # Build our Array that will hold all 5 URLs.
  # ======================================================================= #
  array = %w( url1 url2 url3 url4 url5 )
  _ = dataset?.values_at(*array) # We require the * here.
  _.compact!
  _.reject!(&:empty?) # We don't want empty entries, hence we filter them away.
  return _
end

#use_autoconf?Boolean

#

use_autoconf?

#

Returns:

  • (Boolean)


1230
1231
1232
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1230

def use_autoconf?
  obtain(__method__.to_s.delete('?').to_sym)
end

#use_autogen?Boolean Also known as: use_autogen

#

use_autogen?

#

Returns:

  • (Boolean)


1354
1355
1356
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1354

def use_autogen?
  obtain(__method__.to_s.delete('?').to_sym)
end

#use_build_directory?Boolean Also known as: use_build_dir?, use_build_directory, use_a_build_directory, use_a_build_directory?

#

use_build_directory?

Query whether a build directory will be used for the given program at hand.

#

Returns:

  • (Boolean)


5636
5637
5638
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5636

def use_build_directory?
  obtain __method__.to_s.delete('?').to_sym
end

#use_glib_schema?Boolean Also known as: use_glib_schema

#

use_glib_schema?

#

Returns:

  • (Boolean)


5425
5426
5427
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5425

def use_glib_schema?
  obtain __method__.to_s.delete('?').to_sym
end

#use_this_build_directory?Boolean Also known as: build_dir?, use_this_build_directory, name_of_the_build_directory?

#

use_this_build_directory?

#

Returns:

  • (Boolean)


1547
1548
1549
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1547

def use_this_build_directory?
  obtain(__method__.to_s.delete('?').to_sym)
end

#use_this_build_system?Boolean Also known as: use_this_build_system, use_which_build_system?, build_system?, build_system_to_be_used?, build_system_in_use?

#

use_this_build_system?

This method will query as to which build-system will be used for the given program at hand.

#

Returns:

  • (Boolean)


1528
1529
1530
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1528

def use_this_build_system?
  obtain(__method__.to_s.delete('?').to_sym)
end

#use_this_connective_token?Boolean Also known as: connective_token?, token?

#

use_this_connective_token?

#

Returns:

  • (Boolean)


3617
3618
3619
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3617

def use_this_connective_token?
  @internal_hash[:use_this_connective_token]
end

#use_this_make_command?Boolean Also known as: use_this_make_command, use_which_make_command?

#

use_this_make_command?

#

Returns:

  • (Boolean)


5210
5211
5212
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5210

def use_this_make_command?
  obtain __method__.to_s.delete('?').to_sym
end

#use_this_make_install_command?Boolean

#

use_this_make_install_command?

Which variant of “make install” we will use, if we will use a different variant that is.

#

Returns:

  • (Boolean)


5240
5241
5242
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5240

def use_this_make_install_command?
  obtain __method__.to_s.delete('?').to_sym
end

#use_this_program_nameObject

#

use_this_program_name

#


1389
1390
1391
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1389

def use_this_program_name
  obtain(__method__.to_s.delete('?').to_sym)
end

#use_this_program_name_on_gobolinux?Boolean

#

use_this_program_name_on_gobolinux?

#

Returns:

  • (Boolean)


1347
1348
1349
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1347

def use_this_program_name_on_gobolinux?
  obtain(__method__.to_s.delete('?').to_sym)
end

#wrap_result?Boolean Also known as: use_word_wrap?

#

wrap_result?

#

Returns:

  • (Boolean)


4585
4586
4587
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4585

def wrap_result?
  @internal_hash[:wrap_result]
end