ruaur 1.1.2 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83cbf04615a1414be0c3404f7aa1c962a5b3590401eab9c4b3cf25017a8ab4ca
4
- data.tar.gz: bd321ac45942fe11f8aa789cbbeb00668e7c6eaa716b54f33bf7a78e6e3677e2
3
+ metadata.gz: 9e474910ffaa637774171bc17f605acad0fd8783e18413136df7e056902f381e
4
+ data.tar.gz: a8d72cbbc230066eb3fe37f715ebfa64d96266cbfd6b916f53a36bdf69fa80c7
5
5
  SHA512:
6
- metadata.gz: 530dce80035de54be309892c47fcad31f51111ff3625431a1d5c244e9b1034a8547166f295a81d9ae77d734e04284983210e12e14aa31185a93b53b6315af08b
7
- data.tar.gz: 9469c51d712c9248354852369f92769d8ab6b4437af81cb086b2068762a60f1346099bf7afa3af3f814e7e85c0b5c4d97f50e946e850c55571e5e57bd0ea13b5
6
+ metadata.gz: 738d440ec561e5fea8cfeefe282feffc01ca178b3a7050b62d23b9e9a9b4c97238e7570b49231673761df56f8f86df78fa3c0482bf9a1f9bd0c22da6029dc485
7
+ data.tar.gz: 9751eb31cd8bb56e3707b2a40d23b8a292e3de2fbb4a0e460b8a1226307c2cf62cc41027ff4178495515ff5dc2e9b7a5d58539ca7eb31c5a7f6156edaae17ca6
data/bin/ruaur CHANGED
@@ -30,7 +30,7 @@ def parse(args)
30
30
  opts.on("", "OPTIONS")
31
31
 
32
32
  opts.on("-h", "--help", "Display this help message") do
33
- puts opts
33
+ puts(opts)
34
34
  exit
35
35
  end
36
36
 
@@ -46,9 +46,9 @@ def parse(args)
46
46
  options["verbose"] = true
47
47
  end
48
48
 
49
- opts.on("--version", "Show version") do
49
+ opts.on("-V", "--version", "Show version") do
50
50
  __FILE__.match(/ruaur-(\d+\.\d+\.\d+)/) do |m|
51
- puts m[1]
51
+ puts("ruaur version #{m[1]}")
52
52
  end
53
53
  exit RuAURExit::GOOD
54
54
  end
@@ -57,7 +57,7 @@ def parse(args)
57
57
 
58
58
  opts.on("-Q", "--query", "Query the package database") do
59
59
  if (options["operation"])
60
- puts opts
60
+ puts(opts)
61
61
  exit RuAURExit::MULTIPLE_OPERATIONS
62
62
  end
63
63
  options["operation"] = RuAUR::Operation::Query
@@ -65,7 +65,7 @@ def parse(args)
65
65
 
66
66
  opts.on("-R", "--remove", "Remove package(s)") do
67
67
  if (options["operation"])
68
- puts opts
68
+ puts(opts)
69
69
  exit RuAURExit::MULTIPLE_OPERATIONS
70
70
  end
71
71
  options["operation"] = RuAUR::Operation::Remove
@@ -73,7 +73,7 @@ def parse(args)
73
73
 
74
74
  opts.on("-S", "--sync", "Synchronize package(s)") do
75
75
  if (options["operation"])
76
- puts opts
76
+ puts(opts)
77
77
  exit RuAURExit::MULTIPLE_OPERATIONS
78
78
  end
79
79
  options["operation"] = RuAUR::Operation::Sync
@@ -147,25 +147,25 @@ def parse(args)
147
147
  begin
148
148
  parser.parse!
149
149
  rescue OptionParser::InvalidOption => e
150
- puts e.message
151
- puts parser
150
+ puts(e.message)
151
+ puts(parser)
152
152
  exit RuAURExit::INVALID_OPTION
153
153
  rescue OptionParser::InvalidArgument => e
154
- puts e.message
155
- puts parser
154
+ puts(e.message)
155
+ puts(parser)
156
156
  exit RuAURExit::INVALID_ARGUMENT
157
157
  rescue OptionParser::MissingArgument => e
158
- puts e.message
159
- puts parser
158
+ puts(e.message)
159
+ puts(parser)
160
160
  exit RuAURExit::MISSING_ARGUMENT
161
161
  rescue OptionParser::AmbiguousOption => e
162
- puts e.message
163
- puts parser
162
+ puts(e.message)
163
+ puts(parser)
164
164
  exit RuAURExit::AMBIGUOUS_ARGUMENT
165
165
  end
166
166
 
167
167
  if (!RuAUR::validate_options(options))
168
- puts parser
168
+ puts(parser)
169
169
  exit RuAURExit::INVALID_OPERATION
170
170
  end
171
171
 
@@ -186,7 +186,7 @@ begin
186
186
  ruaur.remove(options["packages"], options["options"])
187
187
  when RuAUR::Operation::Sync
188
188
  ret = ruaur.sync(options["packages"], options["options"])
189
- puts ret if (ret)
189
+ puts(ret) if (ret)
190
190
  end
191
191
  rescue Interrupt
192
192
  # ^C
@@ -195,23 +195,30 @@ rescue Errno::EPIPE
195
195
  # Do nothing. This can happen if piping to another program such as
196
196
  # less. Usually if less is closed before we're done with STDOUT.
197
197
  rescue RuAUR::Error => e
198
- puts e.message
198
+ puts(e.message)
199
199
  exit RuAURExit::EXCEPTION
200
200
  rescue Exception => e
201
+ $stderr.puts(
202
+ [
203
+ "Oops! Looks like an error has occured! If the error",
204
+ "persists, file a bug at:"
205
+ ].join(" ").wrap
206
+ )
201
207
  $stderr.puts
202
- $stderr.puts "Oops! Looks like an error has occured! If the " \
203
- "error persists, file a bug at:"
208
+ $stderr.puts(" https://gitlab.com/mjwhitta/ruaur/issues")
204
209
  $stderr.puts
205
- $stderr.puts " https://gitlab.com/mjwhitta/ruaur/issues"
210
+ $stderr.puts(
211
+ [
212
+ "Maybe the message below will help. If not, you can use",
213
+ "the --verbose flag to get a backtrace."
214
+ ].join(" ").wrap
215
+ )
206
216
  $stderr.puts
207
- $stderr.puts "Maybe the message below will help. If not, you " \
208
- "can use the --verbose flag to get"
209
- $stderr.puts "a backtrace."
210
217
 
211
- $stderr.puts e.message.white.on_red
218
+ $stderr.puts(e.message.white.on_red)
212
219
  if (options["verbose"])
213
220
  e.backtrace.each do |line|
214
- $stderr.puts line.light_yellow
221
+ $stderr.puts(line.light_yellow)
215
222
  end
216
223
  end
217
224
  exit RuAURExit::EXCEPTION
data/lib/ruaur.rb CHANGED
@@ -79,19 +79,19 @@ class RuAUR
79
79
  owns = options.include?(RuAUR::Options::Owns)
80
80
 
81
81
  if (owns)
82
- puts @pacman.query_owns(pkg_names.join(" "))
82
+ puts(@pacman.query_owns(pkg_names.join(" ")))
83
83
  else
84
84
  pkg_names.each do |pkg_name|
85
85
  results = @pacman.query(pkg_name, info)
86
86
  results.each do |name, details|
87
87
  print "#{name} " if (!info)
88
- puts details
88
+ puts(details)
89
89
  puts if (info)
90
90
  end
91
91
  results = @aur.query(pkg_name, info)
92
92
  results.each do |name, details|
93
93
  print "#{name} " if (!info)
94
- puts details
94
+ puts(details)
95
95
  puts if (info)
96
96
  end
97
97
  end
data/lib/ruaur/aur.rb CHANGED
@@ -9,20 +9,23 @@ require "zlib"
9
9
 
10
10
  class RuAUR::AUR
11
11
  def clean
12
- puts hilight_status("Cleaning AUR cache...")
12
+ puts(hilight_status("Cleaning AUR cache..."))
13
13
  Dir.chdir(@cache) do
14
14
  FileUtils.rm_rf(Dir["*"])
15
15
  end
16
16
  end
17
17
 
18
- def compile(package)
19
- puts hilight_status("Compiling #{package.name}...")
18
+ def compile(package, noconfirm = false)
19
+ puts(hilight_status("Compiling #{package.name}..."))
20
+
21
+ cmd = "makepkg -rs"
22
+ cmd = "makepkg --noconfirm -rs" if (noconfirm)
20
23
 
21
24
  if (Process.uid == 0)
22
25
  system("chown -R nobody:nobody .")
23
- system("su -s /bin/sh nobody -c \"makepkg -sr\"")
26
+ system("su -s /bin/sh nobody -c \"#{cmd}\"")
24
27
  else
25
- system("makepkg -sr")
28
+ system(cmd)
26
29
  end
27
30
 
28
31
  tar = "#{package.name}*.pkg.tar"
@@ -41,7 +44,7 @@ class RuAUR::AUR
41
44
  FileUtils.rm_f(Dir["#{package.name}.tar.gz*"])
42
45
 
43
46
  if (status)
44
- puts hilight_status("Downloading #{package.name}...")
47
+ puts(hilight_status("Downloading #{package.name}..."))
45
48
  end
46
49
 
47
50
  tarball(package.name, package.url, "#{package.name}.tar.gz")
@@ -94,7 +97,7 @@ class RuAUR::AUR
94
97
  FileUtils.rm_rf(package.name)
95
98
 
96
99
  if (status)
97
- puts hilight_status("Extracting #{package.name}...")
100
+ puts(hilight_status("Extracting #{package.name}..."))
98
101
  end
99
102
 
100
103
  File.open("#{package.name}.tar.gz", "rb") do |tgz|
@@ -111,7 +114,7 @@ class RuAUR::AUR
111
114
  private :extract
112
115
 
113
116
  def find_upgrades
114
- puts hilight_status("Checking for AUR updates...")
117
+ puts(hilight_status("Checking for AUR updates..."))
115
118
 
116
119
  upgrades = Hash.new
117
120
  multiinfo(@installed.keys).each do |package|
@@ -132,15 +135,19 @@ class RuAUR::AUR
132
135
 
133
136
  def get_dependencies(package)
134
137
  deps = Array.new
138
+ keep = false
135
139
  Dir.chdir("#{@cache}/#{package.name}") do
136
140
  system("chown -R nobody:nobody .") if (Process.uid == 0)
137
141
  cmd = "su -s /bin/sh nobody -c \"makepkg --printsrcinfo\""
138
142
  cmd = "makepkg --printsrcinfo" if (Process.uid != 0)
139
143
  %x(#{cmd}).each_line do |line|
144
+ line.match(/^\s*pkg(base|name)\s*\=\s*(.+)/) do |m|
145
+ keep = (m[2] == package.name)
146
+ end
140
147
  line.match(
141
148
  /^\s*depends(_i686|_x86_64)?\s*\=\s*([^>=:]+)/
142
149
  ) do |m|
143
- deps.push(m[2].strip)
150
+ deps.push(m[2].strip) if (keep)
144
151
  end
145
152
  end
146
153
  end
@@ -213,7 +220,7 @@ class RuAUR::AUR
213
220
  @installed.include?(pkg_name) &&
214
221
  !package.newer?(@installed[pkg_name])
215
222
  )
216
- puts hilight_installed("Already installed: #{pkg_name}")
223
+ puts(hilight_installed("Already installed: #{pkg_name}"))
217
224
  return
218
225
  end
219
226
 
@@ -225,7 +232,7 @@ class RuAUR::AUR
225
232
  Dir.chdir("#{@cache}/#{package.name}") do
226
233
  return if (edit_pkgbuild(package, noconfirm))
227
234
  install_dependencies(package, noconfirm)
228
- compiled = compile(package)
235
+ compiled = compile(package, noconfirm)
229
236
  @pacman.install_local(compiled, noconfirm)
230
237
  end
231
238
 
@@ -235,8 +242,10 @@ class RuAUR::AUR
235
242
  def install_dependencies(package, noconfirm)
236
243
  get_dependencies(package).each do |dep|
237
244
  if (!@installed.has_key?(dep))
238
- puts hilight_dependency(
239
- "Installing dependency: #{dep}"
245
+ puts(
246
+ hilight_dependency(
247
+ "Installing dependency: #{dep}"
248
+ )
240
249
  )
241
250
  if (@pacman.exist?(dep))
242
251
  @pacman.install(dep, noconfirm)
@@ -379,8 +388,8 @@ class RuAUR::AUR
379
388
  find_upgrades.each do |pkg_name, versions|
380
389
  old, new = versions
381
390
 
382
- puts hilight_status("Upgrading #{pkg_name}...")
383
- puts hilight_upgrade(old, new)
391
+ puts(hilight_status("Upgrading #{pkg_name}..."))
392
+ puts(hilight_upgrade(old, new))
384
393
  install(pkg_name, noconfirm)
385
394
  end
386
395
  end
data/lib/ruaur/pacman.rb CHANGED
@@ -4,13 +4,13 @@ require "shellwords"
4
4
 
5
5
  class RuAUR::Pacman
6
6
  def clean(noconfirm = false)
7
- puts hilight_status("Cleaning pacman cache...")
7
+ puts(hilight_status("Cleaning pacman cache..."))
8
8
  system("sudo #{@pac_cmd} -Sc") if (!noconfirm)
9
9
  system("sudo #{@pac_cmd} -Sc --noconfirm") if (noconfirm)
10
10
  end
11
11
 
12
12
  def download(pkg_name, noconfirm = false)
13
- puts hilight_status("Downloading #{pkg_name}...")
13
+ puts(hilight_status("Downloading #{pkg_name}..."))
14
14
  if (!noconfirm)
15
15
  system("sudo #{@pac_cmd} -Sw #{pkg_name}")
16
16
  else
@@ -50,11 +50,11 @@ class RuAUR::Pacman
50
50
 
51
51
  def install(pkg_name, noconfirm = false)
52
52
  if (@installed.include?(pkg_name))
53
- puts hilight_installed("Already installed: #{pkg_name}")
53
+ puts(hilight_installed("Already installed: #{pkg_name}"))
54
54
  return
55
55
  end
56
56
 
57
- puts hilight_status("Installing #{pkg_name}...")
57
+ puts(hilight_status("Installing #{pkg_name}..."))
58
58
  if (!noconfirm)
59
59
  system("sudo #{@pac_cmd} -S #{pkg_name} --needed")
60
60
  else
@@ -67,7 +67,7 @@ class RuAUR::Pacman
67
67
  end
68
68
 
69
69
  def install_local(pkgs, noconfirm = false)
70
- puts hilight_status("Installing compiled packages...")
70
+ puts(hilight_status("Installing compiled packages..."))
71
71
  xzs = pkgs.join(" ")
72
72
  if (!noconfirm)
73
73
  system("sudo #{@pac_cmd} -U #{xzs}")
@@ -109,7 +109,7 @@ class RuAUR::Pacman
109
109
  end
110
110
 
111
111
  def remove(pkg_names, nosave = false)
112
- puts hilight_status("Removing #{pkg_names.join(" ")}...")
112
+ puts(hilight_status("Removing #{pkg_names.join(" ")}..."))
113
113
  if (!nosave)
114
114
  system("sudo #{@pac_cmd} -Rs #{pkg_names.join(" ")}")
115
115
  else
@@ -158,7 +158,7 @@ class RuAUR::Pacman
158
158
  end
159
159
 
160
160
  def upgrade(noconfirm = false)
161
- puts hilight_status("Updating...")
161
+ puts(hilight_status("Updating..."))
162
162
  system("sudo #{@pac_cmd} -Syyu") if (!noconfirm)
163
163
  system("sudo #{@pac_cmd} -Syyu --noconfirm") if (noconfirm)
164
164
  end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruaur
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Whittaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-26 00:00:00.000000000 Z
11
+ date: 2020-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: 13.0.0
20
17
  - - "~>"
21
18
  - !ruby/object:Gem::Version
22
19
  version: '13.0'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 13.0.0
23
23
  type: :development
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: 13.0.0
30
27
  - - "~>"
31
28
  - !ruby/object:Gem::Version
32
29
  version: '13.0'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 13.0.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: hilighter
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -54,22 +54,22 @@ dependencies:
54
54
  name: minitar
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- version: 0.9.0
60
57
  - - "~>"
61
58
  - !ruby/object:Gem::Version
62
59
  version: '0.9'
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: 0.9.0
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 0.9.0
70
67
  - - "~>"
71
68
  - !ruby/object:Gem::Version
72
69
  version: '0.9'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 0.9.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: scoobydoo
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -154,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  - !ruby/object:Gem::Version
155
155
  version: '0'
156
156
  requirements: []
157
- rubygems_version: 3.0.6
157
+ rubygems_version: 3.1.2
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Can search and install packages for Arch Linux