tpkg 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/bin/cpan2tpkg +1 -1
- data/bin/tpkg +55 -17
- data/lib/tpkg.rb +1 -1
- data/lib/tpkg/deployer.rb +3 -1
- metadata +2 -2
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ spec = Gem::Specification.new do |s|
|
|
5
5
|
s.add_dependency('facter')
|
6
6
|
s.add_dependency('net-ssh')
|
7
7
|
s.add_dependency('ddao-kwalify')
|
8
|
-
s.version = '2.
|
8
|
+
s.version = '2.2.0'
|
9
9
|
s.authors = ['Darren Dao', 'Jason Heiss']
|
10
10
|
s.email = 'tpkg-users@lists.sourceforge.net'
|
11
11
|
s.homepage = 'http://tpkg.sourceforge.net'
|
data/bin/cpan2tpkg
CHANGED
data/bin/tpkg
CHANGED
@@ -4,7 +4,6 @@
|
|
4
4
|
##############################################################################
|
5
5
|
|
6
6
|
# Ensure we can find tpkg.rb
|
7
|
-
#$:.unshift File.dirname(__FILE__)
|
8
7
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
9
8
|
|
10
9
|
require 'optparse'
|
@@ -37,8 +36,11 @@ require 'tpkg'
|
|
37
36
|
def rerun_with_sudo_if_necessary
|
38
37
|
if Process.euid != 0 && @sudo
|
39
38
|
warn "Executing with sudo"
|
39
|
+
# Depending on how sudo is configured it might remove TPKG_HOME from the
|
40
|
+
# environment. As such we set the base as a command line option to ensure
|
41
|
+
# it survives the sudo process.
|
40
42
|
if ENV['TPKG_HOME']
|
41
|
-
exec('sudo', '
|
43
|
+
exec('sudo', $0, '--base', ENV['TPKG_HOME'], *ARGV)
|
42
44
|
else
|
43
45
|
exec('sudo', $0, *ARGV)
|
44
46
|
end
|
@@ -230,8 +232,11 @@ end
|
|
230
232
|
opts.on('--qconf', "Display tpkg's configuration settings") do |opt|
|
231
233
|
@action = :query_conf
|
232
234
|
end
|
235
|
+
opts.on('--base', '=BASE', 'Base directory for tpkg operations') do |opt|
|
236
|
+
@tpkg_options[:base] = opt
|
237
|
+
end
|
233
238
|
opts.on('--source', '=NAME', 'Sources where packages are located', Array) do |opt|
|
234
|
-
@tpkg_options[
|
239
|
+
@tpkg_options[:sources] = opt
|
235
240
|
end
|
236
241
|
opts.on('--download', '=PACKAGES', 'Download one or more packages', Array) do |opt|
|
237
242
|
@action = :download
|
@@ -275,6 +280,9 @@ opts.on('--compress', '=[TYPE]', 'Compress files when making packages') do |opt|
|
|
275
280
|
@compress = opt
|
276
281
|
end
|
277
282
|
end
|
283
|
+
opts.on('--test-root TESTDIR', 'For use by the test suite only.') do |opt|
|
284
|
+
@tpkg_options[:file_system_root] = opt
|
285
|
+
end
|
278
286
|
opts.on('--debug', 'Print lots of messages about what tpkg is doing') do |opt|
|
279
287
|
@debug = opt
|
280
288
|
Tpkg::set_debug(@debug)
|
@@ -307,11 +315,32 @@ end
|
|
307
315
|
#
|
308
316
|
|
309
317
|
def instantiate_tpkg(options = {})
|
310
|
-
base =
|
311
|
-
sources = options[
|
318
|
+
base = options[:base]
|
319
|
+
sources = options[:sources] || []
|
312
320
|
report_server = nil
|
313
321
|
|
314
|
-
|
322
|
+
# base can come from four possible places. They take precedence in this
|
323
|
+
# order:
|
324
|
+
# - command line option
|
325
|
+
# - TPKG_HOME environment variable
|
326
|
+
# - config file
|
327
|
+
# - Tpkg::DEFAULT_BASE
|
328
|
+
|
329
|
+
if ENV['TPKG_HOME']
|
330
|
+
if !base
|
331
|
+
base = ENV['TPKG_HOME']
|
332
|
+
# Warn the user, as this could potentially be confusing
|
333
|
+
# if they don't realize there's an environment variable set.
|
334
|
+
warn "Using base '#{base}' base from $TPKG_HOME"
|
335
|
+
else
|
336
|
+
warn "Ignoring TPKG_HOME" if @debug
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
# FIXME: Move config file parsing to tpkg.rb
|
341
|
+
# http://sourceforge.net/apps/trac/tpkg/ticket/28
|
342
|
+
fsroot = options[:file_system_root] ? options[:file_system_root] : ''
|
343
|
+
[File.join(fsroot, Tpkg::DEFAULT_CONFIGDIR, 'tpkg.conf'), File.join(fsroot, ENV['HOME'], ".tpkg.conf")].each do |configfile|
|
315
344
|
if File.exist?(configfile)
|
316
345
|
IO.foreach(configfile) do |line|
|
317
346
|
line.chomp!
|
@@ -320,11 +349,15 @@ def instantiate_tpkg(options = {})
|
|
320
349
|
line.strip! # Remove leading/trailing whitespace
|
321
350
|
key, value = line.split(/\s*=\s*/, 2)
|
322
351
|
if key == 'base'
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
352
|
+
if !base
|
353
|
+
# Warn the user, as this could potentially be confusing
|
354
|
+
# if they don't realize there's a config file lying
|
355
|
+
# around
|
356
|
+
base = value
|
357
|
+
warn "Using base #{base} from #{configfile}"
|
358
|
+
else
|
359
|
+
warn "Ignoring 'base' option in #{@configfile}" if @debug
|
360
|
+
end
|
328
361
|
elsif key == 'source'
|
329
362
|
sources << value
|
330
363
|
puts "Loaded source #{value} from #{configfile}" if (@debug)
|
@@ -336,11 +369,8 @@ def instantiate_tpkg(options = {})
|
|
336
369
|
end
|
337
370
|
end
|
338
371
|
|
339
|
-
if
|
340
|
-
base =
|
341
|
-
# Warn the user, as this could potentially be confusing
|
342
|
-
# if they don't realize there's an environment variable set.
|
343
|
-
warn "Using base '#{base}' base from $TPKG_HOME"
|
372
|
+
if !base
|
373
|
+
base = Tpkg::DEFAULT_BASE
|
344
374
|
end
|
345
375
|
|
346
376
|
if !@sudo
|
@@ -359,7 +389,15 @@ def instantiate_tpkg(options = {})
|
|
359
389
|
end
|
360
390
|
end
|
361
391
|
|
362
|
-
|
392
|
+
# FIXME: This is ugly. We would set the appropriate things in options and
|
393
|
+
# call Tpkg.new(options)
|
394
|
+
tpkg = Tpkg.new(:file_system_root => options[:file_system_root],
|
395
|
+
:base => base,
|
396
|
+
:sources => sources,
|
397
|
+
:report_server => report_server,
|
398
|
+
:lockforce => @lockforce,
|
399
|
+
:force => @force,
|
400
|
+
:sudo => @sudo)
|
363
401
|
end
|
364
402
|
|
365
403
|
passphrase_callback = lambda do | package |
|
data/lib/tpkg.rb
CHANGED
data/lib/tpkg/deployer.rb
CHANGED
@@ -165,7 +165,9 @@ class Deployer
|
|
165
165
|
params = deploy_params.join(" ")
|
166
166
|
cmd = nil
|
167
167
|
if ENV['TPKG_HOME']
|
168
|
-
|
168
|
+
# Preserve TPKG_HOME when deploying to remote systems so that users can
|
169
|
+
# perform operations against different tpkg base directories.
|
170
|
+
cmd = "tpkg #{params} --base #{ENV['TPKG_HOME']} -n"
|
169
171
|
else
|
170
172
|
cmd = "tpkg #{params} -n"
|
171
173
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tpkg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren Dao
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-01-
|
13
|
+
date: 2011-01-10 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|