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, #otomato, #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_name, #return_program_name_for_gobolinux_systems, #return_program_name_via_program_information, #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, #rpn, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_colours, #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[]

#


6136
6137
6138
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6136

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

.do_not_honour_threshold_valueObject

#

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

#


2603
2604
2605
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2603

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)


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

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

#


4127
4128
4129
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4127

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
#


4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4283

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
#


5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5685

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)


2610
2611
2612
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2610

def self.honour_threshold_value?
  @honour_threshold_value
end

.main_program_entries?Boolean

#

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

#

Returns:

  • (Boolean)


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

def self.main_program_entries?
  ARRAY_MAIN_PROGRAM_ENTRIES
end

.opnn(i = NAMESPACE) ⇒ Object

#

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

#


5662
5663
5664
5665
5666
5667
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5662

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)
#


5634
5635
5636
5637
5638
5639
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5634

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.

#


3212
3213
3214
3215
3216
3217
3218
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3212

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.

#


3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3195

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.

#


3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3142

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.

#


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

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.

#


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

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

#


3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3162

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.

#


3565
3566
3567
3568
3569
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3565

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.

#


2665
2666
2667
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2665

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)


1473
1474
1475
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1473

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)


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

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)


1401
1402
1403
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1401

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

#array_show_these_entries?Boolean

#

array_show_these_entries?

#

Returns:

  • (Boolean)


2655
2656
2657
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2655

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?.

#


3928
3929
3930
3931
3932
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3928

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"
#


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 2994

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

#


2913
2914
2915
2916
2917
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2913

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

Returns:

  • (Boolean)


4812
4813
4814
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4812

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)


1442
1443
1444
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1442

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

#be_complexObject

#

be_complex

#


2874
2875
2876
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2874

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

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

#

binaries?

#

Returns:

  • (Boolean)


1417
1418
1419
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1417

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)


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

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

#build_static?Boolean Also known as: build_static

#

build_static?

#

Returns:

  • (Boolean)


1220
1221
1222
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1220

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.

#


4249
4250
4251
4252
4253
4254
4255
4256
4257
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4249

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)


5131
5132
5133
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5131

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

#check_for_binary_names?Boolean

#

check_for_binary_names?

#

Returns:

  • (Boolean)


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

def check_for_binary_names?
  CHECK_FOR_BINARY_NAMES
end

#check_for_library_names?Boolean

#

check_for_library_names?

#

Returns:

  • (Boolean)


4524
4525
4526
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4524

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.

#


3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3361

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.

#


3890
3891
3892
3893
3894
3895
3896
3897
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3890

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

#


3029
3030
3031
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3029

def clear_configure_options
  set_configure_options nil
end

#clear_yaml_datasetObject

#

clear_yaml_dataset

#


2881
2882
2883
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2881

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)


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

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

#compiler_to_use?Boolean

#

compiler_to_use?

#

Returns:

  • (Boolean)


5138
5139
5140
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5138

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.

#


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

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)


4309
4310
4311
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4309

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)


1235
1236
1237
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1235

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)


1244
1245
1246
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1244

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)


4837
4838
4839
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4837

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

#


2571
2572
2573
2574
2575
2576
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2571

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

#debug?Boolean

#

debug?

#

Returns:

  • (Boolean)


5049
5050
5051
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5049

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.

#


3799
3800
3801
3802
3803
3804
3805
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3799

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.

#


3418
3419
3420
3421
3422
3423
3424
3425
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3418

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)


1346
1347
1348
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1346

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.

#


5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5557

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.

#


3578
3579
3580
3581
3582
3583
3584
3585
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3578

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.

#


3349
3350
3351
3352
3353
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3349

def determine_program_name_and_program_version
  set_program_name_and_program_version(
    :default
  )
end

#determine_the_archive_typeObject

#

determine_the_archive_type

#


3590
3591
3592
3593
3594
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3590

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.

#


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

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

#


3599
3600
3601
3602
3603
3604
3605
3606
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3599

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?

#


3614
3615
3616
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3614

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.

#


564
565
566
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 564

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”.

#


3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3758

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.

#


2935
2936
2937
2938
2939
2940
2941
2942
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
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2935

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

#


3077
3078
3079
3080
3081
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3077

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.

#


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

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.

#


5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5749

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.

#


2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2891

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

#


5502
5503
5504
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5502

def do_not_autogenerate
  @internal_hash[:autogenerate_expanded_dataset] = false
end

#do_not_download?Boolean

#

do_not_download?

#

Returns:

  • (Boolean)


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

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

#


5716
5717
5718
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5716

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

#


4234
4235
4236
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4234

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)


720
721
722
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 720

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.

#


4151
4152
4153
4154
4155
4156
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4151

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.

#


3531
3532
3533
3534
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3531

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)


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

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

#


3511
3512
3513
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3511

def enable_debug
  @internal_hash[:debug] = true
end

#enable_shared?Boolean

#

enable_shared?

#

Returns:

  • (Boolean)


5011
5012
5013
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5011

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

#enable_static?Boolean

#

enable_static?

#

Returns:

  • (Boolean)


5172
5173
5174
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5172

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.

#


3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3821

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)


4531
4532
4533
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4531

def entry_exists?
  File.exist? location?
end

#extra_information?Boolean

#

extra_information?

#

Returns:

  • (Boolean)


1252
1253
1254
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1252

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)


6121
6122
6123
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6121

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)


4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4595

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.

#


3059
3060
3061
3062
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3059

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.

#


3070
3071
3072
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3070

def feedback_description
  e description?
end

#feedback_version(shall_we_exit = true) ⇒ Object

#

feedback_version

This will feedback the program-version.

#


2924
2925
2926
2927
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2924

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)


4629
4630
4631
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4629

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

#


2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2581

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.

#


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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2503

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

#


2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2672

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)


4540
4541
4542
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4540

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

#flatpak_url?Boolean Also known as: flatpak_url

#

flatpak_url?

#

Returns:

  • (Boolean)


5194
5195
5196
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5194

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)


4344
4345
4346
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4344

def found?
  @internal_hash[:found]
end

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

#

gir_files?

#

Returns:

  • (Boolean)


1164
1165
1166
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1164

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

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

#

git_url?

#

Returns:

  • (Boolean)


1368
1369
1370
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1368

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.

#


3542
3543
3544
3545
3546
3547
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3542

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)


4370
4371
4372
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4370

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)


3947
3948
3949
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3947

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)


4797
4798
4799
4800
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4797

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)


1227
1228
1229
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1227

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

#headers?Boolean Also known as: headers

#

headers?

#

Returns:

  • (Boolean)


1425
1426
1427
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1425

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)


5079
5080
5081
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5079

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

#ignore_errors?Boolean

#

ignore_errors?

#

Returns:

  • (Boolean)


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

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

#in_simple_mode?Boolean

#

in_simple_mode?

#

Returns:

  • (Boolean)


4316
4317
4318
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4316

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.

#


3477
3478
3479
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3477

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.

#


2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2823

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)


4916
4917
4918
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4916

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)

#


5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5599

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)


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

def internal_commandline_arguments?
  @internal_hash[:internal_commandline_arguments]
end

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

#

internal_hash_dataset

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)


491
492
493
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 491

def internal_hash_dataset?
  @internal_hash[:dataset]
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)


4517
4518
4519
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4517

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)


3964
3965
3966
3967
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3964

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)


1390
1391
1392
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1390

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)


3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3650

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)


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

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)


908
909
910
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 908

def is_sanitize_cookbook?
  true
end

#is_the_build_system_cmake?Boolean

#

is_the_build_system_cmake?

#

Returns:

  • (Boolean)


4713
4714
4715
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4713

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)


4706
4707
4708
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4706

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)


5186
5187
5188
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5186

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)


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

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)


5058
5059
5060
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5058

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

#libexec?Boolean

#

libexec?

#

Returns:

  • (Boolean)


5145
5146
5147
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5145

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)


5042
5043
5044
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5042

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)


4785
4786
4787
4788
4789
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4785

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

#localstatedir?Boolean

#

localstatedir?

#

Returns:

  • (Boolean)


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

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

#m4_files?Boolean Also known as: m4_files

#

m4_files?

#

Returns:

  • (Boolean)


1312
1313
1314
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1312

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)


4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4397

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)


4584
4585
4586
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4584

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)


5239
5240
5241
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5239

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)


5709
5710
5711
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5709

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)


4856
4857
4858
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4856

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)


3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3275

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)

#


5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5509

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

#


5723
5724
5725
5726
5727
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5723

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

#


5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5732

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)


4805
4806
4807
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4805

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)


5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5336

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)


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

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

#mirror?Boolean

#

mirror?

#

Returns:

  • (Boolean)


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

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)


1150
1151
1152
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1150

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

#n_headers?Boolean

#

n_headers?

#

Returns:

  • (Boolean)


1432
1433
1434
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1432

def n_headers?
  headers?.size
end

#n_libraries?Boolean

#

n_libraries?

#

Returns:

  • (Boolean)


4902
4903
4904
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4902

def n_libraries?
  libraries?.size
end

#n_programs_available?Boolean

#

n_programs_available?

#

Returns:

  • (Boolean)


4302
4303
4304
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4302

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.

#


5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5788

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

#


4161
4162
4163
4164
4165
4166
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4161

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)


4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4656

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)


5025
5026
5027
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5025

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

#original_unmodified_name?Boolean

#

original_unmodified_name?

#

Returns:

  • (Boolean)


4727
4728
4729
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4727

def original_unmodified_name?
  @internal_hash[:original_unmodified_name]
end

#output_main_datasetObject

#

output_main_dataset

#


3484
3485
3486
3487
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3484

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)


4827
4828
4829
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4827

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.

#


2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
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
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2695

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:
  #
  #   [email protected]
  #
  # 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)


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

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

#populate_the_dataset_variable(i = simple_or_complex? ) ⇒ Object

#

populate_the_dataset_variable

#


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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2617

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)


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

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

#pre_configure_steps?Boolean

#

pre_configure_steps?

#

Returns:

  • (Boolean)


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

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)


1354
1355
1356
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1354

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)


5032
5033
5034
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5032

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)


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

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

#preinstall?Boolean

#

preinstall?

#

Returns:

  • (Boolean)


3093
3094
3095
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3093

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

#program?Boolean

#

program?

#

Returns:

  • (Boolean)


4909
4910
4911
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4909

def program?
  first_argument?
end

#program_compile_name?Boolean

#

program_compile_name?

This will be guaranteed to be a String.

#

Returns:

  • (Boolean)


4932
4933
4934
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4932

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)


5208
5209
5210
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5208

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)


5070
5071
5072
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5070

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)


5769
5770
5771
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5769

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)


1276
1277
1278
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1276

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)


5000
5001
5002
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5000

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

#


4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4262

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.

#


6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
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
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6048

def query_for(i)
  _ = i.to_s.dup
  _.chop! if _.end_with? ':'
  case _
  # ======================================================================== #
  # === extract_to?
  # ======================================================================== #
  when /^extract(-|_| )?to\??$/i,
       /^extract(-|_| )?to(-|_| )?which(-|_| )?directory\??$/i,
       /^extract(-|_| )?to(-|_| )?this(-|_| )?directory\??$/i
    extract_to?
  # ======================================================================== #
  # === "Keep the archive extracted"
  # ======================================================================== #
  when /^Keep(-|_| )?the(-|_| )?archive(-|_| )?extracted$/i
    keep_the_archive_extracted?
  # ======================================================================== #
  # === program_name_and_program_version?
  # ======================================================================== #
  when /^program(-|_| )?name(-|_| )?and(-|_| )?program(-|_| )?version\??$/i
    program_name_and_program_version?
  # ======================================================================== #
  # === "Homepage"
  # ======================================================================== #
  when /^Homepage$/i
    homepage_url?
  # ======================================================================== #
  # === "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?
  # ======================================================================== #
  # === "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.

#


3049
3050
3051
3052
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3049

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)


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

def raw_cookbook?
  @internal_hash[:raw_cookbook]
end

#raw_cookbook_dataset?Boolean Also known as: raw_dataset?

#

raw_cookbook_dataset?

#

Returns:

  • (Boolean)


4574
4575
4576
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4574

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)


1349
1350
1351
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1349

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)


1348
1349
1350
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1348

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

#raw_yaml_file?Boolean

#

raw_yaml_file?

#

Returns:

  • (Boolean)


4622
4623
4624
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4622

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.

#


2809
2810
2811
2812
2813
2814
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2809

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

#


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

def rebuild_program_full_name
  set_program_full_name(:default)
end
#
#

Returns:

  • (Boolean)


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

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)


1449
1450
1451
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1449

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.

#


1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1978

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.

#


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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2844

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)


5158
5159
5160
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5158

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

#


626
627
628
629
630
631
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 626

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?
#


5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5112

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.

#


4612
4613
4614
4615
4616
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4612

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?

#


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

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'
#


4466
4467
4468
4469
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4466

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

#


4481
4482
4483
4484
4485
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4481

def return_first_dot_as_hyphen_from_this_url(
    i = url1?
  )
  return ::RBT.return_first_dot_as_hyphen_from_this_url(i)
end

#return_first_underscore_as_hyphen_from_this_url(i = url1? ) ⇒ Object

#

return_first_underscore_as_hyphen_from_this_url

#


4451
4452
4453
4454
4455
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4451

def return_first_underscore_as_hyphen_from_this_url(
    i = url1?
  )
  return ::RBT.return_first_underscore_as_hyphen_from_this_url(i)
end

#return_middle_part_of_the_program_version(program_version = program_version? ) ⇒ Object

#

return_middle_part_of_the_program_version

#


4353
4354
4355
4356
4357
4358
4359
4360
4361
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4353

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_information_version?(i) ⇒ Boolean

#

return_program_information_version?

#

Returns:

  • (Boolean)


1667
1668
1669
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1667

def return_program_information_version?(i)
  return ::ProgramInformation.version_of?(i)
end

#return_program_name_from_the_raw_cookbookObject

#

return_program_name_from_the_raw_cookbook

#


4696
4697
4698
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4696

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

#


4720
4721
4722
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4720

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.

#


3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3390

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.

#


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

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, use_this_dataset = internal_hash_dataset? ) ⇒ 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'
#


518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 518

def return_sanitized_program_name_and_program_version(
    i                = program_name_and_program_version?.dup,
    use_this_dataset = internal_hash_dataset?
  )
  # ======================================================================== #
  # Delegate towards a toplevel-method next:
  # ======================================================================== #
  i = RBT.sanitize_url_entry(i, use_this_dataset)
  # ======================================================================== #
  # 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
  # ======================================================================== #
  # 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_the_proper_src_dir(i = short_name?) ) ⇒ Object

#

return_the_proper_src_dir

#


1649
1650
1651
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1649

def return_the_proper_src_dir(i = short_name?)
  "#{src_dir?}#{i.to_s.downcase.delete('-_.')}/" # This was guess_base_dir.
end

#return_url_replace_underscore(i = url?) ) ⇒ Object

#

return_url_replace_underscore

#


4474
4475
4476
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4474

def return_url_replace_underscore(i = url?)
  return ::RBT.return_url_replace_underscore(i)
end

#return_version_from_url1(use_this_URL = url1? ) ⇒ Object

#

return_version_from_url1

This will return the inferred version from the url1 entry.

#


4759
4760
4761
4762
4763
4764
4765
4766
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4759

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)

#


6129
6130
6131
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6129

def run
  find_this_program
end

#run_configure?Boolean

#

run_configure

#

Returns:

  • (Boolean)


5089
5090
5091
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5089

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

#run_make?Boolean Also known as: run_make

#

run_make?

#

Returns:

  • (Boolean)


1157
1158
1159
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1157

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

#


1325
1326
1327
1328
1329
1330
1331
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1325

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

#


1254
1255
1256
1257
1258
1259
1260
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1254

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

#


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

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.

#


1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1161

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

#


1292
1293
1294
1295
1296
1297
1298
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1292

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

#


1243
1244
1245
1246
1247
1248
1249
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1243

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

#


1303
1304
1305
1306
1307
1308
1309
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1303

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

#sanitize_manual_stepsObject

#

sanitize_manual_steps

#


1432
1433
1434
1435
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1432

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

#


1377
1378
1379
1380
1381
1382
1383
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1377

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

#


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

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

#


1388
1389
1390
1391
1392
1393
1394
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1388

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.

#


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

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

#


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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1674

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(_, internal_hash_dataset?)
  unless _.nil?
    set_program_name_and_program_version(_)
    # ===================================================================== #
    # Progam name may still be wrong here, though.
    # ===================================================================== #
    new_program_name = return_program_name_via_program_information(
      program_name_and_program_version?
    )
    set_program_name(new_program_name)
    set_short_name(
      return_program_information_short_name(_)
    )
    new_program_version = return_program_information_version?(
      program_name_and_program_version?
    )
    set_program_version(new_program_version)
    new_base_dir = return_the_proper_src_dir(program_name?)
    set_base_dir(new_base_dir) # Assign a new base-dir value here.
    set_program_path(:reassemble)
  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

#


1656
1657
1658
1659
1660
1661
1662
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1656

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

#


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

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


1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1440

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


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

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.

#


1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
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
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1498

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.

#


1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1460

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 /.

#


1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
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_related_code.rb', line 1721

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.

#


1424
1425
1426
1427
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1424

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.

#


1638
1639
1640
1641
1642
1643
1644
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1638

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

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

#

sanitize_url2

#


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

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

#


1314
1315
1316
1317
1318
1319
1320
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1314

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.

#


1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_related_code.rb', line 1621

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)


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

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)


4685
4686
4687
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4685

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.

#


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
4222
4223
4224
4225
4226
4227
4228
4229
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4178

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)

#


636
637
638
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 636

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”

#


1088
1089
1090
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1088

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

#set_apply_patch(i = nil) ⇒ Object

#

set_apply_patch

#


1809
1810
1811
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1809

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.

#


1802
1803
1804
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1802

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’

#


1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1036

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

#


1904
1905
1906
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1904

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


1743
1744
1745
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1743

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.

#


5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
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
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5850

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

#


1687
1688
1689
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1687

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

#set_blfs(i) ⇒ Object

#

set_blfs

#


1722
1723
1724
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1722

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

#set_build_static(i) ⇒ Object

#

set_build_static

#


1137
1138
1139
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1137

def set_build_static(i)
  set(:build_static, i)
end

#set_can_be_compiled_statically(i) ⇒ Object

#

set_can_be_compiled_statically

#


1095
1096
1097
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1095

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

#


949
950
951
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 949

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.

#


1875
1876
1877
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1875

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”.

#


5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5376

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

#


1708
1709
1710
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1708

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.

#


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

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

#


1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1854

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

#


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

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.

#


699
700
701
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 699

def set_description(i)
  set(:description, i)
end

#set_do_not_download(i) ⇒ Object

#

set_do_not_download

#


1123
1124
1125
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1123

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().

#


1537
1538
1539
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1537

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

#


1130
1131
1132
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1130

def set_echo_yes(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_enable_shared(i) ⇒ Object

#

set_enable_shared

#


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

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

#


1680
1681
1682
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1680

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)


1211
1212
1213
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1211

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

#set_extra_information(i) ⇒ Object

#

set_extra_information

#


1949
1950
1951
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1949

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.

#


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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1637

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

#


1568
1569
1570
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1568

def set_flatpak_url(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_gir_files(i) ⇒ Object

#

set_gir_files

#


619
620
621
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 619

def set_gir_files(i)
  set(:gir_files, i)
end

#set_git_url(i) ⇒ Object

#

set_git_url

#


689
690
691
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 689

def set_git_url(i)
  set(:git_url, i)
end

#set_has_to_be_compiled(i = true) ⇒ Object

#

set_has_to_be_compiled

#


1715
1716
1717
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1715

def set_has_to_be_compiled(i = true)
  set(:has_to_be_compiled, i)
end

#set_headers(i) ⇒ Object

#

set_headers

#


675
676
677
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 675

def set_headers(i)
  set(:headers, i)
end

#set_homepage(i = nil) ⇒ Object

#

set_homepage

#


935
936
937
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 935

def set_homepage(i = nil)
  set(:homepage, i)
end

#set_installation_steps(i) ⇒ Object

#

set_installation_steps

#


668
669
670
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 668

def set_installation_steps(i)
  set(:installation_steps, i)
end

#set_internal_commandline_arguments(i = ARGV) ⇒ Object

#

set_internal_commandline_arguments

#


1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1956

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.

#


5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5432

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

#


1109
1110
1111
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1109

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

#


1932
1933
1934
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1932

def set_keep_extracted(i)
  set(:keep_extracted, i)
end

#set_last_update(i) ⇒ Object

#

set_last_update

#


598
599
600
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 598

def set_last_update(i)
  set(:last_update, i)
end

#set_libexec(i) ⇒ Object Also known as: libexec=

#

set_libexec

#


1544
1545
1546
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1544

def set_libexec(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_libraries(i) ⇒ Object

#

set_libraries

#


1694
1695
1696
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1694

def set_libraries(i)
  set(:libraries, i)
end

#set_licence(i) ⇒ Object Also known as: set_license

#

set_licence

#


682
683
684
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 682

def set_licence(i)
  set(:licence, i)
end

#set_localstatedir(i) ⇒ Object

#

set_localstatedir

#


1551
1552
1553
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1551

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

#


1558
1559
1560
1561
1562
1563
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1558

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

#


1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1889

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

#


605
606
607
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 605

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

#


1589
1590
1591
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1589

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

#


1925
1926
1927
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1925

def set_md5sum(i)
  set(:md5sum, i)
end

#set_meson_configure_options(i) ⇒ Object Also known as: meson_configure_options=

#

set_meson_configure_options

#


942
943
944
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 942

def set_meson_configure_options(i)
  set(:meson_configure_options, i)
end

#set_mirror(i) ⇒ Object

#

set_mirror

#


1575
1576
1577
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1575

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

#


727
728
729
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 727

def set_modify_the_makefile(i)
  set(:modify_the_makefile, i)
end

#set_original_unmodified_name(i) ⇒ Object

#

set_original_unmodified_name

#


956
957
958
959
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 956

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

#


1882
1883
1884
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1882

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.

#


708
709
710
711
712
713
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 708

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

#


1016
1017
1018
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1016

def set_postinstall(i)
  set(:postinstall, i)
end

#set_pre_configure_steps(i) ⇒ Object

#

set_pre_configure_steps

#


1102
1103
1104
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1102

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

#


1918
1919
1920
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1918

def set_pre_make_commands(i)
  set(:pre_make_commands, i)
end

#set_preinstall(i) ⇒ Object Also known as: preinstall=

#

set_preinstall

#


612
613
614
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 612

def set_preinstall(i)
  set(:preinstall, i)
end

#set_program_compile_name(i) ⇒ Object

#

set_program_compile_name

#


1911
1912
1913
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1911

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?

#


1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1825

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.

#


6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 6005

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
  # === :assemble
  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.
  # === FIRST_UNDERSCORE_IS_HYPHEN
  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.

#


5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5817

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.

#


984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 984

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,
       :reassemble
    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.

#


5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5457

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/’.

#


1620
1621
1622
1623
1624
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1620

def set_programs_dir(
    i = '/Programs/'
  )
  @internal_hash[:programs_dir] = i
end

#set_raw_cookbook(i) ⇒ Object

#

set_raw_cookbook

#


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

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.

#


1847
1848
1849
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1847

def set_required_deps_on(i)
  set(:required_deps_on, i)
end

#set_run_configure(i) ⇒ Object

#

set_run_configure

#


1736
1737
1738
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1736

def set_run_configure(i)
  set(:run_configure, i)
end

#set_run_make(i) ⇒ Object

#

set_run_make

#


1757
1758
1759
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1757

def set_run_make(i)
  set(:run_make, i)
end

#set_sed(i) ⇒ Object Also known as: sed=

#

set_sed

#


1771
1772
1773
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1771

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.

#


753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
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
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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 753

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

#


3086
3087
3088
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3086

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.

#


1941
1942
1943
1944
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1941

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.

#


5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5943

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

#


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

def set_simple
  set_simple_or_complex(:simple)
end

#set_simple_or_complex(i = :default) ⇒ Object

#

set_simple_or_complex

#


5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5273

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

#


1729
1730
1731
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1729

def set_skip_configure(i)
  set_run_configure(!i)
end

#set_svn_url(i) ⇒ Object

#

set_svn_url

#


1603
1604
1605
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1603

def set_svn_url(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end
#
#


1582
1583
1584
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1582

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.

#


1781
1782
1783
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1781

def set_symlink_headers(i = true)
  set(:symlink_headers, i)
end
#
#


3107
3108
3109
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3107

def set_symlink_pkgconfig_files(i = true)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#set_tags(i) ⇒ Object

#

set_tags

#


1701
1702
1703
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1701

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.

#


576
577
578
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 576

def set_url1(i)
  set(:url1, i)
end

#set_url2(i) ⇒ Object

#

set_url2

#


583
584
585
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 583

def set_url2(i)
  set(:url2, i)
end

#set_use_autoconf(i) ⇒ Object

#

set_use_autoconf

#


1596
1597
1598
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1596

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

#


590
591
592
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 590

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

#


1525
1526
1527
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1525

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

#


1788
1789
1790
1791
1792
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1788

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

#


661
662
663
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 661

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.

#


919
920
921
922
923
924
925
926
927
928
929
930
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 919

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

#


898
899
900
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 898

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

#


1764
1765
1766
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1764

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

#


1750
1751
1752
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1750

def set_use_this_make_install_command(i)
  set(:use_this_make_install_command, i)
end

#set_wikipedia(i) ⇒ Object

#

set_wikipedia

#


1610
1611
1612
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1610

def set_wikipedia(i)
  set(__method__.to_s.delete_prefix('set_').to_sym, i)
end

#sha256?Boolean Also known as: sha256sum?

#

sha256?

#

Returns:

  • (Boolean)


3100
3101
3102
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3100

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)


4499
4500
4501
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4499

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)


4952
4953
4954
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4952

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)


4977
4978
4979
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4977

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
#


3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3983

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

#


4141
4142
4143
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4141

def show_n_programs_available
  e return_n_programs_available
end

#show_tagsObject

#

show_tags

#


4134
4135
4136
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4134

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)

#


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
2271
2272
2273
2274
2275
2276
2277
2278
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
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 2180

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)


4670
4671
4672
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4670

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)


4380
4381
4382
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4380

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.

#


3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3432

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.

#


3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3705

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)


1295
1296
1297
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1295

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

Returns:

  • (Boolean)


1195
1196
1197
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1195

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

Returns:

  • (Boolean)


3184
3185
3186
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3184

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

Returns:

  • (Boolean)


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

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

#tags?Boolean Also known as: return_tags, tags

#

tags?

#

Returns:

  • (Boolean)


4939
4940
4941
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4939

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.

#


3468
3469
3470
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3468

def the_program_is_included
  @internal_hash[:found] = true
end

#this_program_was_not_found(i) ⇒ Object

#

this_program_was_not_found

#


3036
3037
3038
3039
3040
3041
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3036

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

#


3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3329

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/’.

#


3909
3910
3911
3912
3913
3914
3915
3916
3917
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3909

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?

#


3736
3737
3738
3739
3740
3741
3742
3743
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3736

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

#


3552
3553
3554
3555
3556
3557
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3552

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

#


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

def update_appdir_prefix
  set_prefix(:appdir)
end

#update_kde_applicationsObject

#

update_kde_applications

#


3236
3237
3238
3239
3240
3241
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3236

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

#


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

def update_program_path
  set_program_path(:default)
end

#update_yaml_dataset(i) ⇒ Object

#

update_yaml_dataset

#


3638
3639
3640
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3638

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)


1182
1183
1184
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1182

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

#url2?Boolean

#

url2?

#

Returns:

  • (Boolean)


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

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

#url3?Boolean Also known as: url3

#

url3?

#

Returns:

  • (Boolean)


4923
4924
4925
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4923

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)


4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4742

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)


1202
1203
1204
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1202

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

#use_autogen?Boolean Also known as: use_autogen

#

use_autogen?

#

Returns:

  • (Boolean)


1326
1327
1328
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1326

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)


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

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)


5018
5019
5020
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 5018

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)


1509
1510
1511
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1509

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)


1490
1491
1492
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1490

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)


3518
3519
3520
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 3518

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)


4819
4820
4821
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4819

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)


4849
4850
4851
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4849

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

#use_this_program_nameObject

#

use_this_program_name

#


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

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)


1319
1320
1321
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 1319

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)


4387
4388
4389
# File 'lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb', line 4387

def wrap_result?
  @internal_hash[:wrap_result]
end