ruaur 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruaur/aur.rb +56 -25
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33778e9a175425e6693fc707f094213f91d18b2e
|
4
|
+
data.tar.gz: 0727ea32f56645ce63872907fa80bc05c894b94d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23d06561f9a60c22976dc0624b1b1a628d62b0a06359759994c5d5a4135e3f282bcf593c95188ffdbd3c922931bf1899a3f493a25090945e38c8926e8184e04a
|
7
|
+
data.tar.gz: f18bc12a12834c74aec99b00d9f990085bdd3a9eb0beefe1ed1c52bc312f02e1809a20ff51e25544dc04c038673b1757fbf9d0dda2e1cfd1d60ad891840142bf
|
data/lib/ruaur/aur.rb
CHANGED
@@ -37,10 +37,13 @@ class RuAUR::AUR
|
|
37
37
|
end
|
38
38
|
private :compile
|
39
39
|
|
40
|
-
def download(package)
|
40
|
+
def download(package, status = true)
|
41
41
|
FileUtils.rm_f(Dir["#{package.name}.tar.gz*"])
|
42
42
|
|
43
|
-
|
43
|
+
if (status)
|
44
|
+
puts hilight_status("Downloading #{package.name}...")
|
45
|
+
end
|
46
|
+
|
44
47
|
tarball(package.name, package.url, "#{package.name}.tar.gz")
|
45
48
|
|
46
49
|
tgz = Pathname.new("#{package.name}.tar.gz").expand_path
|
@@ -85,10 +88,13 @@ class RuAUR::AUR
|
|
85
88
|
end
|
86
89
|
private :edit_pkgbuild
|
87
90
|
|
88
|
-
def extract(package)
|
91
|
+
def extract(package, status = true)
|
89
92
|
FileUtils.rm_rf(package.name)
|
90
93
|
|
91
|
-
|
94
|
+
if (status)
|
95
|
+
puts hilight_status("Extracting #{package.name}...")
|
96
|
+
end
|
97
|
+
|
92
98
|
File.open("#{package.name}.tar.gz", "rb") do |tgz|
|
93
99
|
tar = Zlib::GzipReader.new(tgz)
|
94
100
|
Minitar.unpack(tar, ".")
|
@@ -122,6 +128,27 @@ class RuAUR::AUR
|
|
122
128
|
end
|
123
129
|
private :find_upgrades
|
124
130
|
|
131
|
+
def get_dependencies(package)
|
132
|
+
deps = Array.new
|
133
|
+
Dir.chdir("#{@cache}/#{package.name}") do
|
134
|
+
pkgbuild = File.read("PKGBUILD")
|
135
|
+
pkgbuild.match(/^depends\=\(([^\)]+)\)/m) do |match|
|
136
|
+
match.captures.each do |cap|
|
137
|
+
cap.gsub(/\n/, " ").scan(/[^' ]+/) do |scan|
|
138
|
+
# Strip version info and skip any deps that
|
139
|
+
# are variables, for now
|
140
|
+
# FIXME maybe find way to evaluate variable
|
141
|
+
# value
|
142
|
+
dep = scan.gsub(/(\<|\=|\>).*$/, "")
|
143
|
+
next if (dep.start_with?("$"))
|
144
|
+
deps.push(dep)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
return deps
|
150
|
+
end
|
151
|
+
|
125
152
|
def hilight_dependency(dependency)
|
126
153
|
return dependency if (!RuAUR.hilight?)
|
127
154
|
return dependency.light_magenta
|
@@ -207,26 +234,15 @@ class RuAUR::AUR
|
|
207
234
|
end
|
208
235
|
|
209
236
|
def install_dependencies(package, noconfirm)
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
if (!@installed.has_key?(dep))
|
221
|
-
puts hilight_dependency(
|
222
|
-
"Installing dependency: #{dep}"
|
223
|
-
)
|
224
|
-
if (@pacman.exist?(dep))
|
225
|
-
@pacman.install(dep, noconfirm)
|
226
|
-
else
|
227
|
-
install(dep, noconfirm)
|
228
|
-
end
|
229
|
-
end
|
237
|
+
get_dependencies(package).each do |dep|
|
238
|
+
if (!@installed.has_key?(dep))
|
239
|
+
puts hilight_dependency(
|
240
|
+
"Installing dependency: #{dep}"
|
241
|
+
)
|
242
|
+
if (@pacman.exist?(dep))
|
243
|
+
@pacman.install(dep, noconfirm)
|
244
|
+
else
|
245
|
+
install(dep, noconfirm)
|
230
246
|
end
|
231
247
|
end
|
232
248
|
end
|
@@ -269,7 +285,7 @@ class RuAUR::AUR
|
|
269
285
|
if (!json.empty?)
|
270
286
|
results[pkg_name] = json["Version"]
|
271
287
|
if (info)
|
272
|
-
max =
|
288
|
+
max = 12 # Length of "Dependencies"
|
273
289
|
json.each do |k, v|
|
274
290
|
max = k.length if (max < k.length)
|
275
291
|
end
|
@@ -279,10 +295,25 @@ class RuAUR::AUR
|
|
279
295
|
filler = Array.new(max - k.length + 2, " ").join
|
280
296
|
out.push("#{k}#{filler}: #{v}")
|
281
297
|
end
|
298
|
+
|
299
|
+
Dir.chdir(@cache) do
|
300
|
+
download(package, false)
|
301
|
+
extract(package, false)
|
302
|
+
end
|
303
|
+
|
304
|
+
deps = get_dependencies(package)
|
305
|
+
filler = Array.new(max - 10, " ").join
|
306
|
+
out.push("Dependencies#{filler}: #{deps.join(" ")}")
|
307
|
+
|
282
308
|
results[pkg_name] = out.join("\n")
|
283
309
|
end
|
284
310
|
end
|
285
311
|
|
312
|
+
# Clean up
|
313
|
+
Dir.chdir(@cache) do
|
314
|
+
FileUtils.rm_rf(Dir["#{package.name}*"])
|
315
|
+
end
|
316
|
+
|
286
317
|
return results
|
287
318
|
end
|
288
319
|
|