This file is indexed.

/usr/lib/ruby/1.9.1/tk/package.rb is in libtcltk-ruby1.9.1 1.9.3.0-1ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#
# tk/package.rb : package command
#
require 'tk'

module TkPackage
  include TkCore
  extend TkPackage

  TkCommandNames = ['package'.freeze].freeze

  def add_path(path)
    Tk::AUTO_PATH.value = Tk::AUTO_PATH.to_a << path
  end

  def forget(package)
    tk_call('package', 'forget', package)
    nil
  end

  def if_needed(pkg, ver, *arg, &b)
    size = arg.size

    if size==0 && !b
      # proc info
      procedure(tk_call('package', 'ifneeded', pkg, ver))

    elsif size==0 && b
      # set proc
      cmd = proc(&b)
      tk_call('package', 'ifneeded', pkg, ver, cmd)
      cmd

    elsif size==1 && !b
      # set proc
      cmd = arg[0]
      if cmd
        tk_call('package', 'ifneeded', pkg, ver, cmd)
        cmd
      else
        # remove proc
        tk_call('package', 'ifneeded', pkg, ver, '')
        nil
      end

    else
      fail ArgumentError, 'too many arguments'
    end
  end

  def names
    tk_split_simplelist(tk_call('package', 'names'))
  end

  def provide(package, version=nil)
    if version
      tk_call('package', 'provide', package, version)
    end
    if (ret = tk_call('package', 'provide', package)) == ''
      nil
    else
      ret
    end
  end

  def present(package, version=None)
    begin
      tk_call('package', 'present', package, version)
    rescue => e
      fail e.class, 'TkPackage ' << e.message
    end
  end

  def present_exact(package, version)
    begin
      tk_call('package', 'present', '-exact', package, version)
    rescue => e
      fail e.class, 'TkPackage ' << e.message
    end
  end

  def require(package, version=None)
    begin
      tk_call('package', 'require', package, version)
    rescue => e
      fail e.class, 'TkPackage ' << e.message
    end
  end

  def require_exact(package, version)
    begin
      tk_call('package', 'require', '-exact', package, version)
    rescue => e
      fail e.class, 'TkPackage ' << e.message
    end
  end

  def unknown_proc(*arg, &b)
    size = arg.size

    if size==0 && !b
      # proc info
      procedure(tk_call('package', 'unknown'))

    elsif size==0 && b
      # set proc
      cmd = proc(&b)
      tk_call('package', 'unknown', cmd)
      cmd

    elsif size==1 && !b
      # set proc
      cmd = arg[0]
      if cmd
        tk_call('package', 'unknown', cmd)
        cmd
      else
        # remove proc
        tk_call('package', 'unknown', '')
        nil
      end

    else
      fail ArgumentError, 'too many arguments'
    end
  end

  def versions(package)
    tk_split_simplelist(tk_call('package', 'versions', package))
  end

  def vcompare(version1, version2)
    number(tk_call('package', 'vcompare', version1, version2))
  end

  def vsatisfies(version1, version2)
    bool(tk_call('package', 'vsatisfies', version1, version2))
  end

  def prefer(setting = None)
    tk_call('package', 'prefer', setting)
  end
end