tpkg 2.2.3 → 2.2.4

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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/tpkg.rb +48 -15
  3. metadata +4 -4
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('kwalify')
8
- s.version = '2.2.3'
8
+ s.version = '2.2.4'
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'
@@ -40,7 +40,7 @@ require 'tpkg/metadata'
40
40
 
41
41
  class Tpkg
42
42
 
43
- VERSION = '2.2.3'
43
+ VERSION = '2.2.4'
44
44
 
45
45
  GENERIC_ERR = 1
46
46
  POSTINSTALL_ERR = 2
@@ -2474,7 +2474,11 @@ class Tpkg
2474
2474
  def run_external(pkgfile, operation, name, data)
2475
2475
  externalpath = File.join(@external_directory, name)
2476
2476
  if !File.executable?(externalpath)
2477
- raise "External #{externalpath} does not exist or is not executable"
2477
+ if @force
2478
+ warn "External #{externalpath} does not exist or is not executable"
2479
+ else
2480
+ raise "External #{externalpath} does not exist or is not executable"
2481
+ end
2478
2482
  end
2479
2483
  case operation
2480
2484
  when :install
@@ -2489,7 +2493,11 @@ class Tpkg
2489
2493
  # Tell the user which external and package were involved, otherwise
2490
2494
  # failures in externals are very hard to debug
2491
2495
  # FIXME: should we clean up the external request files?
2492
- raise Tpkg.wrap_exception(e, "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message)
2496
+ if @force
2497
+ warn "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message
2498
+ else
2499
+ raise Tpkg.wrap_exception(e, "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message)
2500
+ end
2493
2501
  end
2494
2502
  when :remove
2495
2503
  begin
@@ -2500,7 +2508,11 @@ class Tpkg
2500
2508
  raise "Exit value #{$?.exitstatus}"
2501
2509
  end
2502
2510
  rescue => e
2503
- raise Tpkg.wrap_exception(e, "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message)
2511
+ if @force
2512
+ warn "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message
2513
+ else
2514
+ raise Tpkg.wrap_exception(e, "External #{name} #{operation} for #{File.basename(pkgfile)}: " + e.message)
2515
+ end
2504
2516
  end
2505
2517
  else
2506
2518
  raise "Bug, unknown external operation #{operation}"
@@ -3063,7 +3075,7 @@ class Tpkg
3063
3075
 
3064
3076
  begin
3065
3077
  # Warn the user about non-executable files, as system will just
3066
- # silently fail and exit if that's the case.
3078
+ # silently fail and return if that's the case.
3067
3079
  if !File.executable?(File.join(workdir, 'tpkg', 'preinstall'))
3068
3080
  warn "Warning: preinstall script for #{File.basename(package_file)} is not executable, execution will likely fail"
3069
3081
  end
@@ -3088,7 +3100,7 @@ class Tpkg
3088
3100
 
3089
3101
  begin
3090
3102
  # Warn the user about non-executable files, as system will just
3091
- # silently fail and exit if that's the case.
3103
+ # silently fail and return if that's the case.
3092
3104
  if !File.executable?(File.join(workdir, 'tpkg', 'postinstall'))
3093
3105
  warn "Warning: postinstall script for #{File.basename(package_file)} is not executable, execution will likely fail"
3094
3106
  end
@@ -3125,7 +3137,15 @@ class Tpkg
3125
3137
  begin
3126
3138
  if external[:datafile]
3127
3139
  # Read the file
3128
- external[:data] = IO.read(external[:datafile])
3140
+ begin
3141
+ external[:data] = IO.read(external[:datafile])
3142
+ rescue => e
3143
+ if @force
3144
+ warn "Datafile #{external[:datafile]} for package #{File.basename(metadata[:filename])}: " + e.message
3145
+ else
3146
+ raise Tpkg.wrap_exception(e, "Datafile #{external[:datafile]} for package #{File.basename(metadata[:filename])}: " + e.message)
3147
+ end
3148
+ end
3129
3149
  # Drop the datafile key so that we don't waste time re-reading the
3130
3150
  # datafile again in the future.
3131
3151
  external.delete(:datafile)
@@ -3137,14 +3157,22 @@ class Tpkg
3137
3157
  # warning specifies that it was a datascript and includes the
3138
3158
  # package name.
3139
3159
  if !File.executable?(external[:datascript])
3140
- warn "Warning: datascript for package #{File.basename(metadata[:filename])} is not executable, execution will likely fail"
3160
+ warn "Datascript for package #{File.basename(metadata[:filename])} is not executable, execution will likely fail"
3141
3161
  end
3142
3162
  # Run the script
3143
- IO.popen(external[:datascript]) do |pipe|
3144
- external[:data] = pipe.read
3145
- end
3146
- if !$?.success?
3147
- raise "Datascript #{external[:datascript]} for package #{File.basename(metadata[:filename])} had exit value #{$?.exitstatus}"
3163
+ begin
3164
+ IO.popen(external[:datascript]) do |pipe|
3165
+ external[:data] = pipe.read
3166
+ end
3167
+ if !$?.success?
3168
+ raise "Exit value #{$?.exitstatus}"
3169
+ end
3170
+ rescue => e
3171
+ if @force
3172
+ warn "Datascript #{external[:datascript]} for package #{File.basename(metadata[:filename])}: " + e.message
3173
+ else
3174
+ raise Tpkg.wrap_exception(e, "Datascript #{external[:datascript]} for package #{File.basename(metadata[:filename])}: " + e.message)
3175
+ end
3148
3176
  end
3149
3177
  # Drop the datascript key so that we don't waste time re-running the
3150
3178
  # datascript again in the future.
@@ -4062,7 +4090,7 @@ class Tpkg
4062
4090
  Dir.chdir(File.join(workdir, 'tpkg'))
4063
4091
 
4064
4092
  # Warn the user about non-executable files, as system will just
4065
- # silently fail and exit if that's the case.
4093
+ # silently fail and return if that's the case.
4066
4094
  if !File.executable?(File.join(workdir, 'tpkg', 'preremove'))
4067
4095
  warn "Warning: preremove script for #{File.basename(package_file)} is not executable, execution will likely fail"
4068
4096
  end
@@ -4145,7 +4173,7 @@ class Tpkg
4145
4173
  Dir.chdir(File.join(workdir, 'tpkg'))
4146
4174
 
4147
4175
  # Warn the user about non-executable files, as system will just
4148
- # silently fail and exit if that's the case.
4176
+ # silently fail and return if that's the case.
4149
4177
  if !File.executable?(File.join(workdir, 'tpkg', 'postremove'))
4150
4178
  warn "Warning: postremove script for #{File.basename(package_file)} is not executable, execution will likely fail"
4151
4179
  end
@@ -4357,6 +4385,11 @@ class Tpkg
4357
4385
 
4358
4386
  ordered_init_scripts.each do |init_script|
4359
4387
  installed_path = init_script[:path]
4388
+ # Warn the user about non-executable files, as system will just
4389
+ # silently fail and return if that's the case.
4390
+ if !File.executable?(installed_path)
4391
+ warn "Warning: init script for #{pkg[:metadata][:name]} is not executable, execution will likely fail"
4392
+ end
4360
4393
  system("#{installed_path} #{action}")
4361
4394
  ret_val = INITSCRIPT_ERR if !$?.success?
4362
4395
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tpkg
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 2
9
- - 3
10
- version: 2.2.3
9
+ - 4
10
+ version: 2.2.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Darren Dao
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-20 00:00:00 -08:00
19
+ date: 2011-04-21 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency