-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaur-deps
executable file
·53 lines (39 loc) · 1.15 KB
/
aur-deps
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
#!/usr/bin/env ruby
require 'epitools'
if ARGV.size < 1
puts "------------------------------------------------------------"
puts " aur-deps"
puts "------------------------------------------------------------"
puts " List all the pacman packages that a binary needs."
puts
puts "Usage:"
puts " aur-deps <binary>"
exit
end
for arg in ARGV
puts "-----------------------------------------------"
puts " Package dependencies for <11>#{arg}</11>:".colorize
puts "-----------------------------------------------"
ldd = `ldd #{arg}`
if ldd[/not a dynamic executable/]
puts " Not a dynamic executable.".light_red
puts
next
end
for line in ldd.nice_lines
line.strip!
if line =~ /(\S+) => not found/
puts "<14>#{$1} <12>not found".colorize
elsif line =~ /(\S+) => (\S+)/
libname, lib = $1, $2
owner = `pacman -Qo "#{lib}" 2>&1`
if owner =~ /is owned by (\S+) (\S+)/
package, version = $1, $2
puts "<10>#{package} <2>#{version} <8>(<9>#{libname}<8>)".colorize
else
puts "<14>#{libname} <12>not in pacman database".colorize
end
end
end
puts
end