Ubuntu Pastebin

Paste from a at Fri, 24 Apr 2015 11:02:52 +0000

Download as text
 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
#!/usr/bin/env ruby

require 'ostruct'
require 'optparse'

options = OpenStruct.new
OptionParser.new do |opts|
  opts.banner = "Usage: #{opts.program_name} [options]"

  opts.on('-v VERSION', '--version VERSION',
          'Library upstream version') do |v|
    options.version = v
  end

  opts.on('-e INPUTFILE', '-i INPUTFILE', '--input INPUTFILE',
          'Library file to symbolize') do |v|
    options.input = v
  end

  opts.on('-p PACKAGE', '--package PACKAGE',
          'Package name of the package containing the library (defaults to' \
          ' autodetermined)') do |v|
    options.package = v
  end

  opts.on('-O OUTPUTFILE', '-o OUTPUTFILE', '--output OUTPUTFILE',
          'File to dump symbol table to (defaults to symbols.amd64)') do |v|
    options.output = v
  end

  opts.on('-s SYMBOLSFILE', '--symbols SYMBOLSFILE',
          'Final symbols file to write to (defaults to autodetermined)') do |v|
    options.symbolsfile = v
  end
end.parse!

options.input = ARGV.shift if !options.input && !ARGV.empty?

fail 'Need argument: version' unless options.version
fail 'Need argument: input' unless options.input

options.output = 'symbols.amd64' unless options.output

unless options.package
  base = File.basename(options.input)
  parts = base.split('.so.')
  name = parts.first
  version = parts.last
  version = version.split('.').first # Get major version
  hyphen = ''
  begin
    # Check if the last character of the name is a number, and if so inject
    # a hyphen as per regular naming policy.
    hyphen = '-' unless Integer(name[-1]).nil?
  rescue ArgumentError
    hyphen = '' # NaN, continue with no hyphen
  end
  options.package = "#{name}#{hyphen}#{version}".downcase
end

unless options.symbolsfile
  # Find debian dir and construct a symbols file path
  dir = nil
  if File.basename(Dir.pwd) == 'debian'
    dir = Dir.pwd
  else # Otherwise get the first suitable debian/ dir we can find.
    dir = Dir.glob('**/debian').first
    dir = "#{Dir.pwd}/#{dir}"
  end
  options.symbolsfile = "#{dir}/#{options.package}.symbols"
end

puts `pkgkde-gensymbols -p#{options.package} -v#{options.version} -O#{options.output} -e#{options.input}`
puts `pkgkde-symbolshelper create -o #{options.symbolsfile} -v #{options.version} #{options.output}`
File.delete(options.output)
Download as text