packo 0.0.1.alpha.1 → 0.0.1.alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/packo +13 -2
- data/lib/packo.rb +16 -52
- data/lib/packo/cli.rb +9 -3
- data/lib/packo/cli/base.rb +65 -66
- data/lib/packo/cli/build.rb +124 -128
- data/lib/packo/cli/files.rb +7 -7
- data/lib/packo/cli/repository.rb +40 -26
- data/lib/packo/do.rb +106 -73
- data/lib/packo/environment.rb +2 -2
- data/lib/packo/extensions.rb +20 -6
- data/lib/packo/host.rb +10 -0
- data/lib/packo/models.rb +8 -2
- data/lib/packo/models/repository.rb +17 -14
- data/lib/packo/package.rb +9 -3
- data/lib/packo/profile.rb +2 -2
- data/lib/packo/rbuild.rb +0 -2
- data/lib/packo/rbuild/behaviors/default.rb +3 -2
- data/lib/packo/rbuild/{modules/misc/fetching.rb → behaviors/python.rb} +8 -3
- data/lib/packo/rbuild/modules.rb +2 -3
- data/lib/packo/rbuild/modules/building.rb +5 -2
- data/lib/packo/rbuild/modules/building/autotools.rb +11 -11
- data/lib/packo/rbuild/modules/building/rake.rb +71 -7
- data/lib/packo/rbuild/modules/building/scons.rb +128 -0
- data/lib/packo/rbuild/modules/{misc/fetcher.rb → fetcher.rb} +5 -5
- data/lib/packo/rbuild/modules/fetching.rb +29 -0
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/git.rb +15 -9
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/github.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/gnu.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/mercurial.rb +11 -7
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/sourceforge.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/fetching → fetching}/subversion.rb +23 -5
- data/lib/packo/rbuild/modules/misc.rb +0 -8
- data/lib/packo/rbuild/modules/packager.rb +63 -0
- data/lib/packo/rbuild/modules/packaging.rb +2 -0
- data/lib/packo/rbuild/modules/packaging/pko.rb +24 -44
- data/lib/packo/rbuild/modules/{misc/unpacker.rb → unpacker.rb} +2 -2
- data/lib/packo/rbuild/modules/{misc/unpacking.rb → unpacking.rb} +6 -4
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/lzma.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/tar.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/xz.rb +1 -1
- data/lib/packo/rbuild/modules/{misc/unpacking → unpacking}/zip.rb +1 -1
- data/lib/packo/rbuild/package.rb +17 -8
- data/lib/packo/repository.rb +1 -1
- data/lib/packo/repository/virtual.rb +16 -0
- data/lib/packo/utils.rb +106 -0
- data/lib/packo/version.rb +1 -1
- metadata +39 -25
- data/lib/packo/rbuild/modules/misc/fetching/wget.rb +0 -57
data/lib/packo/cli/files.rb
CHANGED
@@ -61,7 +61,7 @@ class Files < Thor
|
|
61
61
|
require 'packo/models'
|
62
62
|
|
63
63
|
package = Models.search_installed(name).first
|
64
|
-
root =
|
64
|
+
root = Path.new(package.destination || '/')
|
65
65
|
|
66
66
|
if !package
|
67
67
|
fatal "No package matches #{name}"
|
@@ -70,9 +70,9 @@ class Files < Thor
|
|
70
70
|
|
71
71
|
package.model.contents.each {|content| content.check!
|
72
72
|
case content.type
|
73
|
-
when :dir; puts "--- #{(root + content.path)
|
74
|
-
when :sym; puts ">>> #{(root + content.path)
|
75
|
-
when :obj; puts ">>> #{(root + content.path)
|
73
|
+
when :dir; puts "--- #{Path.clean(root + content.path)}"
|
74
|
+
when :sym; puts ">>> #{Path.clean(root + content.path)} -> #{content.meta}".cyan.bold
|
75
|
+
when :obj; puts ">>> #{Path.clean(root + content.path)}".bold
|
76
76
|
end
|
77
77
|
}
|
78
78
|
end
|
@@ -82,7 +82,7 @@ class Files < Thor
|
|
82
82
|
def belongs (file)
|
83
83
|
require 'packo/models'
|
84
84
|
|
85
|
-
path =
|
85
|
+
path = Path.new(file).realpath.to_s
|
86
86
|
path[0] = ''
|
87
87
|
|
88
88
|
if content = Models::InstalledPackage::Content.first(path: path)
|
@@ -119,7 +119,7 @@ class Files < Thor
|
|
119
119
|
print "\n"
|
120
120
|
|
121
121
|
package.model.contents.each {|content|
|
122
|
-
path =
|
122
|
+
path = Path.clean((package.model.destination || '/') + content.path[1, content.path.length])
|
123
123
|
|
124
124
|
case content.type
|
125
125
|
when :dir
|
@@ -137,7 +137,7 @@ class Files < Thor
|
|
137
137
|
end
|
138
138
|
|
139
139
|
when :obj
|
140
|
-
if content.meta != (
|
140
|
+
if content.meta != (Packo.digest(path) rescue nil)
|
141
141
|
puts "#{'FAIL ' if System.env[:NO_COLORS]}>>> #{path}".red
|
142
142
|
else
|
143
143
|
puts "#{'OK ' if System.env[:NO_COLORS]}>>> #{path}".green
|
data/lib/packo/cli/repository.rb
CHANGED
@@ -37,6 +37,7 @@ class Repository < Thor
|
|
37
37
|
|
38
38
|
desc 'add URI...', 'Add repositories'
|
39
39
|
map '-a' => :add
|
40
|
+
method_option :ignore, type: :boolean, default: true, aliases: '-i', desc: 'Do not add the packages of a virtual repository to the index'
|
40
41
|
def add (*uris)
|
41
42
|
uris.each {|uri|
|
42
43
|
uri = URI.parse(uri)
|
@@ -139,7 +140,11 @@ class Repository < Thor
|
|
139
140
|
|
140
141
|
begin
|
141
142
|
Models.transaction {
|
142
|
-
|
143
|
+
if type == :virtual && options[:ignore]
|
144
|
+
_add type, name, uri, path, false
|
145
|
+
else
|
146
|
+
_add type, name, uri, path
|
147
|
+
end
|
143
148
|
}
|
144
149
|
|
145
150
|
CLI.info "Added #{type}/#{name}"
|
@@ -151,7 +156,6 @@ class Repository < Thor
|
|
151
156
|
}
|
152
157
|
end
|
153
158
|
|
154
|
-
|
155
159
|
desc 'delete REPOSITORY...', 'Delete installed repositories'
|
156
160
|
map '-d' => :delete, '-R' => :delete
|
157
161
|
def delete (*names)
|
@@ -178,9 +182,11 @@ class Repository < Thor
|
|
178
182
|
begin
|
179
183
|
repositories.each {|repository|
|
180
184
|
Models.transaction {
|
185
|
+
path = repository.path
|
186
|
+
|
181
187
|
_delete(repository.type, repository.name)
|
182
188
|
|
183
|
-
FileUtils.rm_rf
|
189
|
+
FileUtils.rm_rf path, secure: true
|
184
190
|
}
|
185
191
|
}
|
186
192
|
rescue Exception => e
|
@@ -191,11 +197,14 @@ class Repository < Thor
|
|
191
197
|
}
|
192
198
|
end
|
193
199
|
|
194
|
-
desc 'update', 'Update installed repositories'
|
200
|
+
desc 'update [REPOSITORY...]', 'Update installed repositories'
|
195
201
|
map '-u' => :update
|
196
202
|
method_option :force, type: :boolean, default: false, aliases: '-f', desc: 'Force the update'
|
197
|
-
|
203
|
+
method_option :ignore, type: :boolean, default: true, aliases: '-i', desc: 'Do not add the packages of a virtual repository to the index'
|
204
|
+
def update (*repositories)
|
198
205
|
Models::Repository.all.each {|repository|
|
206
|
+
next if !repositories.empty? && !repositories.member?(Packo::Repository.wrap(repository).to_s)
|
207
|
+
|
199
208
|
updated = false
|
200
209
|
|
201
210
|
type = repository.type
|
@@ -223,6 +232,13 @@ class Repository < Thor
|
|
223
232
|
end
|
224
233
|
|
225
234
|
when :virtual
|
235
|
+
if (content = open(uri).read != File.read(path)) || options[:force]
|
236
|
+
_delete(:virtual, name)
|
237
|
+
File.write(path, content)
|
238
|
+
_add(:vitual, name, uri, path, !options[:ignore])
|
239
|
+
|
240
|
+
update = true
|
241
|
+
end
|
226
242
|
end
|
227
243
|
}
|
228
244
|
|
@@ -251,7 +267,9 @@ class Repository < Thor
|
|
251
267
|
print "#{"#{packages.first.tags}/" unless packages.first.tags.empty?}#{packages.first.name.bold}"
|
252
268
|
|
253
269
|
print ' ('
|
254
|
-
print packages.
|
270
|
+
print packages.sort {|a, b|
|
271
|
+
a.version <=> b.version
|
272
|
+
}.map {|package|
|
255
273
|
"#{package.version.to_s.red}" + (package.slot ? "%#{package.slot.to_s.blue.bold}" : '')
|
256
274
|
}.join(', ')
|
257
275
|
print ')'
|
@@ -261,7 +279,9 @@ class Repository < Thor
|
|
261
279
|
else
|
262
280
|
print "#{packages.first.tags}/#{packages.first.name.bold} ("
|
263
281
|
|
264
|
-
print packages.
|
282
|
+
print packages.sort {|a, b|
|
283
|
+
a.version <=> b.version
|
284
|
+
}.map {|package|
|
265
285
|
"#{package.version.to_s.red}" + (package.slot ? "%#{package.slot.to_s.blue.bold}" : '')
|
266
286
|
}.join(', ')
|
267
287
|
|
@@ -403,19 +423,11 @@ class Repository < Thor
|
|
403
423
|
puts repository.URI
|
404
424
|
end
|
405
425
|
|
406
|
-
desc 'rehash REPOSITORY...', 'Rehash the repository caches'
|
407
|
-
def rehash (*
|
408
|
-
|
409
|
-
|
410
|
-
if names.empty?
|
411
|
-
repositories << Models::Repository.all
|
412
|
-
else
|
413
|
-
names.each {|name|
|
414
|
-
repositories << Models::Repository.all(name: name)
|
415
|
-
}
|
416
|
-
end
|
426
|
+
desc 'rehash [REPOSITORY...]', 'Rehash the repository caches'
|
427
|
+
def rehash (*repositories)
|
428
|
+
Models::Repository.all.each {|repository|
|
429
|
+
next if !repositories.empty? && !repositories.member?(Packo::Repository.wrap(repository).to_s)
|
417
430
|
|
418
|
-
repositories.flatten.compact.each {|repository|
|
419
431
|
type = repository.type
|
420
432
|
name = repository.name
|
421
433
|
uri = repository.uri
|
@@ -475,7 +487,7 @@ class Repository < Thor
|
|
475
487
|
)
|
476
488
|
|
477
489
|
build.xpath('.//digest').each {|node| node.remove}
|
478
|
-
build.add_child dom.create_element('digest',
|
490
|
+
build.add_child dom.create_element('digest', Packo.digest(pko))
|
479
491
|
|
480
492
|
FileUtils.mkpath "#{options[:output]}/#{dom.root['name']}/#{package.tags.to_s(true)}"
|
481
493
|
FileUtils.mv pko, "#{options[:output]}/#{dom.root['name']}/#{package.tags.to_s(true)}"
|
@@ -508,14 +520,16 @@ class Repository < Thor
|
|
508
520
|
}
|
509
521
|
end
|
510
522
|
|
511
|
-
def _add (type, name, uri, path)
|
512
|
-
Helpers::Repository.wrap(Models::Repository.create(
|
523
|
+
def _add (type, name, uri, path, populate=true)
|
524
|
+
repo = Helpers::Repository.wrap(Models::Repository.create(
|
513
525
|
type: type,
|
514
526
|
name: name,
|
515
527
|
|
516
528
|
uri: uri,
|
517
529
|
path: path
|
518
|
-
))
|
530
|
+
))
|
531
|
+
|
532
|
+
repo.populate if populate
|
519
533
|
end
|
520
534
|
|
521
535
|
def _delete (type, name)
|
@@ -544,12 +558,12 @@ class Repository < Thor
|
|
544
558
|
end
|
545
559
|
|
546
560
|
def _update (path)
|
547
|
-
|
561
|
+
done = false
|
548
562
|
|
549
563
|
old = Dir.pwd; Dir.chdir(path)
|
550
564
|
|
551
|
-
if !
|
552
|
-
|
565
|
+
if !done && (`git reset --hard`) && (`git pull`.strip != 'Already up-to-date.' rescue nil)
|
566
|
+
done = true
|
553
567
|
end
|
554
568
|
|
555
569
|
Dir.chdir(old)
|
data/lib/packo/do.rb
CHANGED
@@ -17,16 +17,11 @@
|
|
17
17
|
# along with packo. If not, see <http://www.gnu.org/licenses/>.
|
18
18
|
#++
|
19
19
|
|
20
|
-
require '
|
21
|
-
require 'digest/sha1'
|
20
|
+
require 'packo/utils'
|
22
21
|
|
23
22
|
module Packo
|
24
23
|
|
25
24
|
class Do
|
26
|
-
def self.digest (path)
|
27
|
-
Digest::SHA1.hexdigest(File.read(path))
|
28
|
-
end
|
29
|
-
|
30
25
|
def self.cd (path=nil)
|
31
26
|
if block_given?
|
32
27
|
tmp = Dir.pwd
|
@@ -52,12 +47,14 @@ class Do
|
|
52
47
|
files.flatten!
|
53
48
|
files.compact!
|
54
49
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
else
|
50
|
+
type = (path.first.is_a?(Symbol) ? path.shift : :f).to_s
|
51
|
+
|
52
|
+
if type.include?('r')
|
59
53
|
Do.dir(to)
|
60
|
-
FileUtils.cp_r(files, to)
|
54
|
+
FileUtils.cp_r(files, to, :force => type.include?('f'))
|
55
|
+
else
|
56
|
+
Do.dir(File.dirname(to))
|
57
|
+
FileUtils.cp(files, to, :force => type.include?('f'))
|
61
58
|
end
|
62
59
|
end
|
63
60
|
|
@@ -74,17 +71,25 @@ class Do
|
|
74
71
|
end
|
75
72
|
end
|
76
73
|
|
77
|
-
def self.rm (*
|
78
|
-
|
79
|
-
|
74
|
+
def self.rm (*files)
|
75
|
+
files.flatten!
|
76
|
+
files.compact!
|
77
|
+
|
78
|
+
type = (files.first.is_a?(Symbol) ? files.shift : :f).to_s
|
79
|
+
|
80
|
+
files.each {|file|
|
81
|
+
next unless File.exists?(file)
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
+
case type
|
84
|
+
when /r/
|
85
|
+
FileUtils.rm_r(file, :force => type.include?('f'), :secure => true)
|
83
86
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
87
|
+
else
|
88
|
+
if File.directory?(file)
|
89
|
+
Dir.delete(file) rescue nil
|
90
|
+
else
|
91
|
+
FileUtils.rm(file, :force => type.include?('f')) rescue nil
|
92
|
+
end
|
88
93
|
end
|
89
94
|
}
|
90
95
|
end
|
@@ -103,7 +108,7 @@ class Do
|
|
103
108
|
content = File.read(file)
|
104
109
|
|
105
110
|
seds.each {|(regexp, sub)|
|
106
|
-
content.gsub!(regexp, sub
|
111
|
+
content.gsub!(regexp, sub.to_s)
|
107
112
|
}
|
108
113
|
|
109
114
|
File.write(file, content)
|
@@ -114,7 +119,6 @@ class Do
|
|
114
119
|
def initialize (package)
|
115
120
|
@package = package
|
116
121
|
|
117
|
-
@relative = '/usr'
|
118
122
|
@opts = nil
|
119
123
|
@verbose = true
|
120
124
|
end
|
@@ -124,7 +128,7 @@ class Do
|
|
124
128
|
def not_verbose!; @verbose = false end
|
125
129
|
|
126
130
|
def root
|
127
|
-
|
131
|
+
@root || package.distdir
|
128
132
|
end
|
129
133
|
|
130
134
|
def root= (path)
|
@@ -134,7 +138,7 @@ class Do
|
|
134
138
|
def into (path)
|
135
139
|
tmp, @relative = @relative, path
|
136
140
|
|
137
|
-
Do.dir root
|
141
|
+
Do.dir "#{root}/#{@relative}"
|
138
142
|
|
139
143
|
yield
|
140
144
|
|
@@ -143,15 +147,10 @@ class Do
|
|
143
147
|
|
144
148
|
def opts (value)
|
145
149
|
tmp, @opts = @opts, value
|
150
|
+
|
146
151
|
yield
|
147
|
-
@opts = tmp
|
148
|
-
end
|
149
152
|
|
150
|
-
|
151
|
-
files.map {|file| Dir.glob(file)}.flatten.each {|file|
|
152
|
-
FileUtils.cp_r file, "#{root}/#{File.basename(file)}", preserve: true, verbose: @verbose
|
153
|
-
FileUtils.chmod @opts || 0644, "#{root}/#{File.basename(file)}", verbose: @verbose
|
154
|
-
}
|
153
|
+
@opts = tmp
|
155
154
|
end
|
156
155
|
|
157
156
|
def dir (path)
|
@@ -159,91 +158,125 @@ class Do
|
|
159
158
|
FileUtils.chmod @opts || 0755, "#{root}/#{path}", verbose: @verbose
|
160
159
|
end
|
161
160
|
|
162
|
-
def
|
163
|
-
|
161
|
+
def ins (*files)
|
162
|
+
files.map {|file|
|
163
|
+
file.is_a?(Array) ? [file] : Dir.glob(file)
|
164
|
+
}.flatten(1).each {|(file, name)|
|
165
|
+
path = Path.clean("#{root}/#{@relative || 'usr'}/#{File.basename(name || file)}")
|
164
166
|
|
165
|
-
|
166
|
-
FileUtils.
|
167
|
-
FileUtils.chmod @opts || 0755, "#{root}/bin/#{File.basename(name || file)}", verbose: @verbose
|
167
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
168
|
+
FileUtils.chmod @opts || 0644, path, verbose: @verbose
|
168
169
|
}
|
169
170
|
end
|
170
171
|
|
171
|
-
def
|
172
|
-
|
172
|
+
def bin (*bins)
|
173
|
+
bins.map {|bin|
|
174
|
+
bin.is_a?(Array) ? [bin] : Dir.glob(bin)
|
175
|
+
}.flatten(1).each {|(file, name)|
|
176
|
+
path = Path.clean("#{root}/#{@relative || '/'}/bin/#{File.basename(name || file)}")
|
177
|
+
|
178
|
+
FileUtils.mkpath File.dirname(path)
|
179
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
180
|
+
FileUtils.chmod @opts || 0755, path, verbose: @verbose
|
181
|
+
}
|
182
|
+
end
|
173
183
|
|
174
|
-
|
175
|
-
|
176
|
-
|
184
|
+
def sbin (*sbins)
|
185
|
+
sbins.map {|sbin|
|
186
|
+
sbin.is_a?(Array) ? [sbin] : Dir.glob(sbin)
|
187
|
+
}.flatten(1).each {|(file, name)|
|
188
|
+
path = Path.clean("#{root}/#{@relative || '/'}/sbin/#{File.basename(name || file)}")
|
189
|
+
|
190
|
+
FileUtils.mkpath File.dirname(path)
|
191
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
192
|
+
FileUtils.chmod @opts || 0755, path, verbose: @verbose
|
177
193
|
}
|
178
194
|
end
|
179
195
|
|
180
196
|
def lib (*libs)
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
197
|
+
libs.map {|lib|
|
198
|
+
lib.is_a?(Array) ? [lib] : Dir.glob(lib)
|
199
|
+
}.flatten(1).each {|(file, name)|
|
200
|
+
path = Path.clean("#{root}/#{@relative || '/usr'}/lib/#{File.basename(name || file)}")
|
201
|
+
|
202
|
+
FileUtils.mkpath File.dirname(path)
|
203
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
204
|
+
FileUtils.chmod @opts || (file.match(/\.a(\.|$)/) ? 0644 : 0755), path, verbose: @verbose
|
186
205
|
}
|
187
206
|
end
|
188
207
|
|
189
208
|
def doc (*docs)
|
190
209
|
into("/usr/share/doc/#{package.name}-#{package.version}") {
|
191
|
-
docs.map {|doc|
|
192
|
-
|
193
|
-
|
210
|
+
docs.map {|doc|
|
211
|
+
doc.is_a?(Array) ? [doc] : Dir.glob(doc)
|
212
|
+
}.flatten(1).each {|(file, name)|
|
213
|
+
path = "#{root}/#{@relative}/#{File.basename(name || file)}"
|
214
|
+
|
215
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
216
|
+
FileUtils.chmod @opts || 0644, path, verbose: @verbose
|
194
217
|
}
|
195
218
|
}
|
196
219
|
end
|
197
220
|
|
198
221
|
def html (*htmls)
|
199
222
|
into("/usr/share/doc/#{package.name}-#{package.version}/html") {
|
200
|
-
htmls.map {|html|
|
201
|
-
|
202
|
-
|
223
|
+
htmls.map {|html|
|
224
|
+
html.is_a?(Array) ? [html] : Dir.glob(html)
|
225
|
+
}.flatten(1).each {|(file, name)|
|
226
|
+
path = "#{root}/#{@relative}/#{File.basename(name || file)}"
|
227
|
+
|
228
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
229
|
+
FileUtils.chmod @opts || 0644, path, verbose: @verbose
|
203
230
|
}
|
204
231
|
}
|
205
232
|
end
|
206
233
|
|
207
234
|
def man (*mans)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
235
|
+
into("/usr/share/man/man#{man[-1]}") {
|
236
|
+
mans.map {|man|
|
237
|
+
man.is_a?(Array) ? [man] : Dir.glob(man)
|
238
|
+
}.flatten(1).each {|(file, name)|
|
239
|
+
path = "#{root}/#{@relative}/#{File.basename(name || file)}"
|
240
|
+
|
241
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
242
|
+
FileUtils.chmod @opts || 0644, path, verbose: @verbose
|
212
243
|
}
|
213
244
|
}
|
214
245
|
end
|
215
246
|
|
216
247
|
def info (*infos)
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
248
|
+
into("/usr/share/info/#{info[-1]}") {
|
249
|
+
infos.map {|info|
|
250
|
+
info.is_a?(Array) ? [info] : Dir.glob(info)
|
251
|
+
}.flatten(1).each {|(file, name)|
|
252
|
+
path = "#{root}/#{@relative}/#{File.basename(name || file)}"
|
253
|
+
|
254
|
+
FileUtils.cp_r file, path, preserve: true, verbose: @verbose
|
255
|
+
Packo.sh 'gzip', '-9', path, silent: !@verbose rescue nil
|
256
|
+
FileUtils.chmod @opts || 0644, path, verbose: @verbose
|
222
257
|
}
|
223
258
|
}
|
224
259
|
end
|
225
260
|
|
226
261
|
def sym (link, to)
|
227
|
-
|
228
|
-
|
262
|
+
path = Path.clean("#{root}/#{@relative}/#{to}")
|
263
|
+
|
264
|
+
FileUtils.mkpath File.dirname(path)
|
265
|
+
FileUtils.ln_sf link, path, verbose: @verbose
|
229
266
|
end
|
230
267
|
|
231
268
|
def hard (link, to)
|
232
|
-
|
233
|
-
|
269
|
+
path = Path.clean("#{root}/#{@relative}/#{to}")
|
270
|
+
|
271
|
+
FileUtils.mkpath File.dirname(path)
|
272
|
+
FileUtils.ln_f link, path, verbose: @verbose
|
234
273
|
end
|
235
274
|
|
236
275
|
def own (user, group, *files)
|
237
|
-
|
238
|
-
|
239
|
-
FileUtils.cp_r info, "#{root}/#{File.basename(info)}", preserve: true, verbose: @verbose
|
240
|
-
Packo.sh 'gzip', '-9', "#{root}/#{File.basename(info)}", silent: !@verbose rescue nil
|
241
|
-
FileUtils.chmod @opts || 0644, "#{root}/#{File.basename(info)}", verbose: @verbose
|
242
|
-
}
|
276
|
+
files.flatten.compact.each {|file|
|
277
|
+
FileUtils.chown user, group, files, :verbose => @verbose
|
243
278
|
}
|
244
279
|
end
|
245
|
-
|
246
|
-
# TODO: wrappers
|
247
280
|
end
|
248
281
|
|
249
282
|
end
|