class Cookbooks::Convert_PKGBUILD

Constants

ARRAY_ENTRIES_WITHOUT_CORRESPONDING_VERSIONS
#

The following entries have no corresponding version.

epoch is an integer value, specific to Arch Linux, representing what 'lifetime' to compare version numbers against. This value allows overrides of the normal version comparison rules for packages that have inconsistent version numbering, require a downgrade, change numbering schemes, etc. By default, packages are assumed to have an epoch value of 0. Do not use this unless you know what you are doing.

  • arch is an array of architectures that the PKGBUILD file is known

to build and work on. Currently, it should contain i686 or x86_64 or any for architecture-independent packages.

#
DEFAULT_FILE
#

DEFAULT_FILE

#
H
HASH_MAP_PKGBUILD_VARIABLE_TO_COOKBOOK_ENTRY
#

HASH_MAP_PKGBUILD_VARIABLE_TO_COOKBOOK_ENTRY

Use a mapping, to map from PKGBUILD variables to our Cookbook entries.

#

Public Class Methods

new( this_pkgbuild = DEFAULT_FILE, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 64
def initialize(
    this_pkgbuild = DEFAULT_FILE,
    run_already   = true
  )
  super()
  reset
  read_data_from(this_pkgbuild)
  run if run_already
end

Public Instance Methods

hash()
Alias for: hash?
hash?() click to toggle source
#

hash?

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 134
def hash?
  @hash
end
Also aliased as: hash
process_data() click to toggle source
#

#process_data

We work through @data here.

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 96
  def process_data
    @data.each { |line|
      case line
      when /^(pkgname)/, /^(pkgver)/, /^(pkgdesc)/,
           /^(url)/,/^(license)/,/^(depends)/,
           /^(makedepends)/
        @hash[ H[$1] ] = split(line)
      end
    }
    _ = Cookbooks::Cookbook.new(@hash['program_name']) { :bypass_menu }
    _.clear(false)
    _.merge(@hash)
    _.set_archive_type('.tar.gz') # hardcoded for now.
pp _
pp "STILL NOT FINISHED. SORRY."
  end
read_data_from(i = DEFAULT_FILE) click to toggle source
#

#read_data_from

Sets @data variable.

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 87
def read_data_from(i = DEFAULT_FILE)
  @data = File.readlines(i).map(&:chomp)
end
remove_parens(i) click to toggle source
#

#remove_parens

This method will turn something like ('FOO') into 'FOO'

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 118
def remove_parens(i)
  i.delete('()')
end
reset() click to toggle source
#

reset

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 77
def reset
  @query = nil
  @hash = {}
end
run() click to toggle source
#

run

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 141
def run
  process_data
end
split(i) click to toggle source
#

split

Easier to use this method to split at = characters found.

#
# File lib/cookbooks/utility_scripts/convert_pkgbuild.rb, line 127
def split(i)
  i.split('=')[1]
end