boxgrinder-build 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ v0.6.4
2
+
3
+ * [BGBUILD-98] Use hashery gem
4
+ * [BGBUILD-99] Timeout exception is not catched on non-EC2 platfrom in GuestFSHelper
5
+ * [BGBUILD-92] Enable --trace switch by default
6
+ * [BGBUILD-91] Log exceptions to log file
1
7
 
2
8
  v0.6.3
3
9
 
@@ -14,7 +20,7 @@ v0.6.1
14
20
  v0.6.0
15
21
 
16
22
  * [BGBUILD-52] Wrong post section inheritance
17
- * [BGBUILD-46] Allow building 32 bit images on 64 bit arch
23
+ * [BGBUILD-46] Allow building 32 bit image s on 64 bit arch
18
24
 
19
25
  v0.5.1
20
26
 
data/Manifest CHANGED
@@ -1,30 +0,0 @@
1
- CHANGELOG
2
- LICENSE
3
- Manifest
4
- README
5
- Rakefile
6
- bin/boxgrinder-build
7
- boxgrinder-build.gemspec
8
- lib/boxgrinder-build/appliance.rb
9
- lib/boxgrinder-build/helpers/appliance-customize-helper.rb
10
- lib/boxgrinder-build/helpers/augeas-helper.rb
11
- lib/boxgrinder-build/helpers/guestfs-helper.rb
12
- lib/boxgrinder-build/helpers/image-helper.rb
13
- lib/boxgrinder-build/helpers/linux-helper.rb
14
- lib/boxgrinder-build/helpers/package-helper.rb
15
- lib/boxgrinder-build/helpers/plugin-helper.rb
16
- lib/boxgrinder-build/managers/plugin-manager.rb
17
- lib/boxgrinder-build/plugins/base-plugin.rb
18
- rubygem-boxgrinder-build.spec
19
- spec/Rakefile
20
- spec/appliance-spec.rb
21
- spec/helpers/appliance-customize-helper-spec.rb
22
- spec/helpers/augeas-helper-spec.rb
23
- spec/helpers/guestfs-helper-spec.rb
24
- spec/helpers/image-helper-spec.rb
25
- spec/helpers/linux-helper-spec.rb
26
- spec/helpers/package-helper-spec.rb
27
- spec/helpers/plugin-helper-spec.rb
28
- spec/managers/plugin-manager-spec.rb
29
- spec/plugins/base-plugin-spec.rb
30
- spec/rspec/src/appliances/jeos-f13.appl
data/Rakefile CHANGED
@@ -19,6 +19,7 @@
19
19
  require 'rubygems'
20
20
  require 'spec/rake/spectask'
21
21
  require 'echoe'
22
+ require 'rbconfig'
22
23
 
23
24
  Echoe.new("boxgrinder-build") do |p|
24
25
  p.project = "BoxGrinder Build"
@@ -26,7 +27,7 @@ Echoe.new("boxgrinder-build") do |p|
26
27
  p.summary = "A tool for creating appliances from simple plain text files for various virtual environments."
27
28
  p.url = "http://www.jboss.org/boxgrinder"
28
29
  p.email = "info@boxgrinder.org"
29
- p.runtime_dependencies = ["commander ~>4.0.3", "boxgrinder-core ~>0.1.2"]
30
+ p.runtime_dependencies = ["commander ~>4.0.3", "boxgrinder-core ~>0.1.3"]
30
31
  end
31
32
 
32
33
  desc "Run all tests"
@@ -48,32 +49,23 @@ Spec::Rake::SpecTask.new('spec:coverage') do |t|
48
49
  t.verbose = true
49
50
  end
50
51
 
51
- topdir = "#{Dir.pwd}/pkg/rpmbuild"
52
- directory "#{topdir}/SOURCES"
53
-
54
- task 'gem:copy' => [:clean, :manifest, :gem, 'rpm:topdir'] do
55
- Dir["**/pkg/*.gem"].each { |gem| FileUtils.cp(gem, "#{topdir}/SOURCES", :verbose => true) }
56
- end
57
-
58
- task 'rpm:topdir' do
59
- FileUtils.mkdir_p(["#{topdir}/SOURCES", "#{topdir}/RPMS", "#{topdir}/BUILD", "#{topdir}/SPECS", "#{topdir}/SRPMS"], :verbose => true)
60
- end
61
-
62
52
  desc "Create RPM"
63
- task 'rpm' => ['gem:copy'] do
53
+ task :rpm, :target, :version, :arch, :needs => ['clean', 'gem'] do |t, args|
54
+ target = args[:target] || 'fedora'
55
+ version = args[:version] || 'rawhide'
56
+ arch = args[:arch] || RbConfig::CONFIG['host_cpu']
57
+
64
58
  Dir["**/rubygem-*.spec"].each do |spec|
65
- `rpmbuild --define '_topdir #{topdir}' -ba #{spec}`
59
+ `mock -v -r #{target}-#{version}-#{arch} --buildsrpm --sources pkg/*.gem --spec #{spec} --resultdir pkg/`
60
+ exit 1 unless $? == 0
61
+ `mock -v -r #{target}-#{version}-#{arch} --rebuild pkg/*.rpm --resultdir pkg/`
66
62
  exit 1 unless $? == 0
67
63
  end
68
64
  end
69
65
 
70
66
  desc "Install RPM"
71
- task 'rpm:install' => ['rpm'] do
72
- puts "sudo yum -y remove rubygem-boxgrinder-build"
67
+ task 'rpm:install' => [:rpm] do
73
68
  system "sudo yum -y remove rubygem-boxgrinder-build"
69
+ system "sudo yum -y localinstall --nogpgcheck pkg/*.rpm"
74
70
  exit 1 unless $? == 0
75
-
76
- puts "sudo yum -y --nogpgcheck localinstall #{topdir}/RPMS/noarch/*.rpm"
77
- system "sudo yum -y --nogpgcheck localinstall #{topdir}/RPMS/noarch/*.rpm"
78
- exit 1 unless $? == 0
79
- end
71
+ end
data/bin/boxgrinder-build CHANGED
@@ -30,8 +30,23 @@ end
30
30
 
31
31
  require 'commander/import'
32
32
 
33
+ module Commander
34
+ class Runner
35
+ def run!
36
+ require_program :version, :description
37
+ trap('INT') { abort program(:int_message) } if program(:int_message)
38
+ trap('INT') { program(:int_block).call } if program(:int_block)
39
+ global_option('-h', '--help', 'Display help documentation') { command(:help).run *@args[1..-1]; return }
40
+ global_option('-v', '--version', 'Display version information') { say version; return }
41
+ parse_global_options
42
+ remove_global_options options, @args
43
+ run_active_command
44
+ end
45
+ end
46
+ end
47
+
33
48
  program :name, 'BoxGrinder Build'
34
- program :version, '0.6.3'
49
+ program :version, '0.6.4'
35
50
  program :description, "A tool for building VM images from simple definition files."
36
51
  program :help, 'Homepage', 'http://www.jboss.org/boxgrinder/build.html'
37
52
  program :help, 'Documentation', 'http://community.jboss.org/docs/DOC-14358'
@@ -40,8 +55,8 @@ default_command :build
40
55
 
41
56
  $log_level = :info
42
57
 
43
- global_option('-V', '--verbose', TrueClass, "Prints debug information while building. Default: false.") { $log_level = :debug}
44
- global_option('-W', '--very-verbose', TrueClass, "Prints trace information while building. Default: false.") { $log_level = :trace}
58
+ global_option('-V', '--verbose', TrueClass, "Prints debug information while building. Default: false.") { $log_level = :debug }
59
+ global_option('-W', '--very-verbose', TrueClass, "Prints trace information while building. Default: false.") { $log_level = :trace }
45
60
 
46
61
  module BoxGrinder
47
62
  command :build do |c|
@@ -49,27 +64,28 @@ module BoxGrinder
49
64
  c.description = 'Creates an image from selected appliance definition for selected platform.'
50
65
  c.examples = "boxgrinder-build test.appl -p vmware\nboxgrinder-build test.appl -p ec2 -d ami\nboxgrinder-build test.appl -d sftp"
51
66
 
67
+ force = false
68
+
52
69
  c.option '-p STRING', '--platform STRING', String, "The type of platform. Default: none." # Valid types are: #{PlatformPluginManager.instance.plugins.keys.join(', ')}. Default: none."
53
70
  c.option '-d STRING', '--delivery STRING', String, "The delivery type for selected image. Default: none." # Valid types are: #{DeliveryPluginManager.instance.types.keys.join(', ')}. Default: none."
54
- c.option '-f STRING', '--force', TrueClass, "Force image creation - removes all previous builds for selected appliance. Default: false."
71
+ c.option('-f', '--force', "Force image creation - removes all previous builds for selected appliance.") { force = true }
55
72
  c.option '-l STRING', '--plugins STRING', String, "Comma separated list of plugins. Default: default plugins will be available."
56
73
 
57
74
  c.action do |args, options|
58
75
  options.default :platform => :none
59
76
  options.default :delivery => :none
60
- options.default :force => false
61
77
 
78
+ options.force = force
62
79
  options.name = program(:name)
63
80
  options.version = program(:version)
64
-
65
81
  options.platform = options.platform.to_s.downcase.to_sym
66
82
  options.delivery = options.delivery.to_s.downcase.to_sym
67
83
 
68
84
  appliance_definition_file = args.shift or raise("You need to specify appliance definition file. Run 'boxgrinder-build -h' for more info")
69
85
 
70
- raise "Appliance definition file '#{appliance_definition_file}' could not be found" unless File.exists?( appliance_definition_file )
86
+ raise "Appliance definition file '#{appliance_definition_file}' could not be found" unless File.exists?(appliance_definition_file)
71
87
 
72
- Appliance.new( appliance_definition_file, :options => options, :log => LogHelper.new( :threshold => $log_level ) ).create
88
+ Appliance.new(appliance_definition_file, :options => options, :log => LogHelper.new(:threshold => $log_level)).create
73
89
  end
74
90
  end
75
91
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{boxgrinder-build}
5
- s.version = "0.6.3"
5
+ s.version = "0.6.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Marek Goldmann"]
9
- s.date = %q{2010-11-11}
9
+ s.date = %q{2010-11-23}
10
10
  s.default_executable = %q{boxgrinder-build}
11
11
  s.description = %q{A tool for creating appliances from simple plain text files for various virtual environments.}
12
12
  s.email = %q{info@boxgrinder.org}
@@ -26,13 +26,13 @@ Gem::Specification.new do |s|
26
26
 
27
27
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
28
  s.add_runtime_dependency(%q<commander>, ["~> 4.0.3"])
29
- s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.1.2"])
29
+ s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.1.3"])
30
30
  else
31
31
  s.add_dependency(%q<commander>, ["~> 4.0.3"])
32
- s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.2"])
32
+ s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.3"])
33
33
  end
34
34
  else
35
35
  s.add_dependency(%q<commander>, ["~> 4.0.3"])
36
- s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.2"])
36
+ s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.3"])
37
37
  end
38
38
  end
@@ -27,7 +27,7 @@ require 'boxgrinder-core/validators/appliance-config-validator'
27
27
  module BoxGrinder
28
28
  class Appliance
29
29
 
30
- def initialize( appliance_definition_file, options = {} )
30
+ def initialize(appliance_definition_file, options = {})
31
31
  @config = Config.new
32
32
  @appliance_definition_file = appliance_definition_file
33
33
  @log = options[:log] || Logger.new(STDOUT)
@@ -39,17 +39,17 @@ module BoxGrinder
39
39
  end
40
40
 
41
41
  def read_and_validate_definition
42
- appliance_configs, appliance_config = ApplianceHelper.new( :log => @log ).read_definitions( @appliance_definition_file )
43
- appliance_config_helper = ApplianceConfigHelper.new( appliance_configs )
42
+ appliance_configs, appliance_config = ApplianceHelper.new(:log => @log).read_definitions(@appliance_definition_file)
43
+ appliance_config_helper = ApplianceConfigHelper.new(appliance_configs)
44
44
 
45
45
  @appliance_config = appliance_config_helper.merge(appliance_config.clone.init_arch).initialize_paths
46
46
 
47
- ApplianceConfigValidator.new( @appliance_config ).validate
47
+ ApplianceConfigValidator.new(@appliance_config).validate
48
48
  end
49
49
 
50
50
  def remove_old_builds
51
51
  @log.info "Removing previous builds for #{@appliance_config.name} appliance..."
52
- FileUtils.rm_rf( @appliance_config.path.build )
52
+ FileUtils.rm_rf(@appliance_config.path.build)
53
53
  @log.debug "Previous builds removed."
54
54
  end
55
55
 
@@ -57,38 +57,41 @@ module BoxGrinder
57
57
  @log.info "Building '#{@appliance_config.name}' appliance for #{@appliance_config.hardware.arch} architecture."
58
58
 
59
59
  base_plugin_output = execute_os_plugin
60
- platform_plugin_output = execute_platform_plugin( base_plugin_output )
60
+ platform_plugin_output = execute_platform_plugin(base_plugin_output)
61
61
 
62
- execute_delivery_plugin( platform_plugin_output )
62
+ execute_delivery_plugin(platform_plugin_output)
63
63
  end
64
64
 
65
65
  def create
66
- PluginHelper.new( :options => @options, :log => @log ).load_plugins
67
-
68
- read_and_validate_definition
69
- remove_old_builds if @options.force
70
- execute_plugin_chain
66
+ begin
67
+ PluginHelper.new(:options => @options, :log => @log).load_plugins
68
+ read_and_validate_definition
69
+ remove_old_builds if @options.force
70
+ execute_plugin_chain
71
+ rescue
72
+ @log.fatal $!
73
+ end
71
74
  end
72
75
 
73
76
  def execute_os_plugin
74
77
  raise "No operating system plugins installed. Install one or more operating system plugin. See http://community.jboss.org/docs/DOC-15081 and http://community.jboss.org/docs/DOC-15214 for more info" if PluginManager.instance.plugins[:os].empty?
75
78
 
76
- os_plugin, os_plugin_info = PluginManager.instance.initialize_plugin(:os, @appliance_config.os.name.to_sym )
77
- os_plugin.init( @config, @appliance_config, :log => @log, :plugin_info => os_plugin_info )
79
+ os_plugin, os_plugin_info = PluginManager.instance.initialize_plugin(:os, @appliance_config.os.name.to_sym)
80
+ os_plugin.init(@config, @appliance_config, :log => @log, :plugin_info => os_plugin_info)
78
81
 
79
82
  if os_plugin.deliverables_exists?
80
83
  @log.info "Deliverables for #{os_plugin_info[:name]} operating system plugin exists, skipping."
81
- return { :deliverables => os_plugin.deliverables }
84
+ return {:deliverables => os_plugin.deliverables}
82
85
  end
83
86
 
84
87
  @log.debug "Executing operating system plugin for #{@appliance_config.os.name}..."
85
88
  os_plugin.run
86
89
  @log.debug "Operating system plugin executed."
87
90
 
88
- { :deliverables => os_plugin.deliverables, :plugin_info => os_plugin_info }
91
+ {:deliverables => os_plugin.deliverables, :plugin_info => os_plugin_info}
89
92
  end
90
93
 
91
- def execute_platform_plugin( previous_plugin_output )
94
+ def execute_platform_plugin(previous_plugin_output)
92
95
  if @options.platform == :none or @options.platform == nil
93
96
  @log.debug "No platform selected, skipping platform conversion."
94
97
  return previous_plugin_output
@@ -96,22 +99,22 @@ module BoxGrinder
96
99
 
97
100
  raise "No platform plugins installed. Install one or more platform plugin. See http://community.jboss.org/docs/DOC-15081 and http://community.jboss.org/docs/DOC-15214 for more info" if PluginManager.instance.plugins[:platform].empty?
98
101
 
99
- platform_plugin, platform_plugin_info = PluginManager.instance.initialize_plugin(:platform, @options.platform )
100
- platform_plugin.init( @config, @appliance_config, :log => @log, :plugin_info => platform_plugin_info, :previous_plugin_info => previous_plugin_output[:plugin_info], :previous_deliverables => previous_plugin_output[:deliverables] )
102
+ platform_plugin, platform_plugin_info = PluginManager.instance.initialize_plugin(:platform, @options.platform)
103
+ platform_plugin.init(@config, @appliance_config, :log => @log, :plugin_info => platform_plugin_info, :previous_plugin_info => previous_plugin_output[:plugin_info], :previous_deliverables => previous_plugin_output[:deliverables])
101
104
 
102
105
  if platform_plugin.deliverables_exists?
103
106
  @log.info "Deliverables for #{platform_plugin_info[:name]} platform plugin exists, skipping."
104
- return { :deliverables => platform_plugin.deliverables, :plugin_info => platform_plugin_info }
107
+ return {:deliverables => platform_plugin.deliverables, :plugin_info => platform_plugin_info}
105
108
  end
106
109
 
107
110
  @log.debug "Executing platform plugin for #{@options.platform}..."
108
111
  platform_plugin.run
109
112
  @log.debug "Platform plugin executed."
110
113
 
111
- { :deliverables => platform_plugin.deliverables, :plugin_info => platform_plugin_info }
114
+ {:deliverables => platform_plugin.deliverables, :plugin_info => platform_plugin_info}
112
115
  end
113
116
 
114
- def execute_delivery_plugin( previous_plugin_output )
117
+ def execute_delivery_plugin(previous_plugin_output)
115
118
  if @options.delivery == :none or @options.delivery == nil
116
119
  @log.debug "No delivery method selected, skipping delivering."
117
120
  return
@@ -119,9 +122,9 @@ module BoxGrinder
119
122
 
120
123
  raise "No delivery plugins installed. Install one or more delivery plugin. See http://community.jboss.org/docs/DOC-15081 and http://community.jboss.org/docs/DOC-15214 for more info" if PluginManager.instance.plugins[:delivery].empty?
121
124
 
122
- delivery_plugin, delivery_plugin_info = PluginManager.instance.initialize_plugin(:delivery, @options.delivery )
123
- delivery_plugin.init( @config, @appliance_config, :log => @log, :plugin_info => delivery_plugin_info, :previous_plugin_info => previous_plugin_output[:plugin_info], :previous_deliverables => previous_plugin_output[:deliverables] )
124
- delivery_plugin.run( @options.delivery )
125
+ delivery_plugin, delivery_plugin_info = PluginManager.instance.initialize_plugin(:delivery, @options.delivery)
126
+ delivery_plugin.init(@config, @appliance_config, :log => @log, :plugin_info => delivery_plugin_info, :previous_plugin_info => previous_plugin_output[:plugin_info], :previous_deliverables => previous_plugin_output[:deliverables])
127
+ delivery_plugin.run(@options.delivery)
125
128
  end
126
129
  end
127
130
  end
@@ -95,7 +95,7 @@ module BoxGrinder
95
95
  begin
96
96
  open('http://169.254.169.254/1.0/meta-data/local-ipv4')
97
97
  ec2 = true
98
- rescue
98
+ rescue Exception
99
99
  ec2 = false
100
100
  end
101
101
 
@@ -16,11 +16,12 @@
16
16
  # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
17
17
  # 02110-1301 USA, or see the FSF site: http://www.fsf.org.
18
18
 
19
+ require 'rubygems'
19
20
  require 'boxgrinder-core/helpers/exec-helper'
20
21
  require 'boxgrinder-core/helpers/log-helper'
21
22
  require 'boxgrinder-build/helpers/image-helper'
22
23
  require 'ostruct'
23
- require 'openhash/openhash'
24
+ require 'hashery/opencascade'
24
25
  require 'fileutils'
25
26
  require 'logger'
26
27
 
@@ -41,10 +42,10 @@ module BoxGrinder
41
42
  @previous_deliverables = options[:previous_deliverables] || {}
42
43
  @plugin_config = {}
43
44
 
44
- @deliverables = OpenHash.new
45
- @supported_oses = OpenHash.new
46
- @target_deliverables = OpenHash.new
47
- @dir = OpenHash.new
45
+ @deliverables = OpenCascade.new
46
+ @supported_oses = OpenCascade.new
47
+ @target_deliverables = OpenCascade.new
48
+ @dir = OpenCascade.new
48
49
 
49
50
  @dir.base = "#{@appliance_config.path.build}/#{@plugin_info[:name]}-plugin"
50
51
  @dir.tmp = "#{@dir.base}/tmp"
@@ -73,7 +74,7 @@ module BoxGrinder
73
74
  def register_supported_os(name, versions)
74
75
  raise "You can register supported operating system only after the plugin is initialized, please initialize the plugin using init method." if @initialized.nil?
75
76
 
76
- @supported_oses[name] = OpenHash.new if @supported_oses[name].nil?
77
+ @supported_oses[name] = OpenCascade.new if @supported_oses[name].nil?
77
78
  @supported_oses[name] = versions
78
79
  end
79
80
 
@@ -5,24 +5,25 @@
5
5
 
6
6
  Summary: A tool for creating appliances from simple plain text files
7
7
  Name: rubygem-%{gemname}
8
- Version: 0.6.3
9
- Release: 1%{?dist}
8
+ Version: 0.6.4
9
+ Release: 3%{?dist}
10
10
  Group: Development/Languages
11
11
  License: LGPLv3+
12
12
  URL: http://www.jboss.org/boxgrinder
13
13
  Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
14
- Buildroot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
15
14
 
16
15
  Requires: ruby(abi) = %{rubyabi}
17
- Requires: rubygems >= 1.2
18
- Requires: ruby >= 0
19
- Requires: rubygem(commander) => 4.0.3
20
- Requires: rubygem(commander) < 4.1
21
- Requires: rubygem(boxgrinder-core) => 0.1.1
22
- Requires: rubygem(boxgrinder-core) < 0.2
23
-
24
- BuildRequires: rubygem(boxgrinder-core) => 0.1.1
25
- BuildRequires: rubygem(boxgrinder-core) < 0.2
16
+ Requires: rubygem(commander)
17
+ Requires: rubygem(boxgrinder-core)
18
+ Requires: ruby-libguestfs
19
+ Requires: parted
20
+ Requires: e2fsprogs
21
+
22
+ BuildRequires: rubygem(rake)
23
+ BuildRequires: rubygem(rspec)
24
+ BuildRequires: rubygem(boxgrinder-core)
25
+ BuildRequires: rubygem(echoe)
26
+ BuildRequires: ruby-libguestfs
26
27
 
27
28
  BuildArch: noarch
28
29
  Provides: rubygem(%{gemname}) = %{version}
@@ -45,23 +46,23 @@ Documentation for %{name}
45
46
 
46
47
  %install
47
48
  rm -rf %{buildroot}
48
- mkdir -p %{buildroot}%{gemdir}
49
- gem install --local --install-dir %{buildroot}%{gemdir} \
50
- --force --rdoc %{SOURCE0}
49
+ rm -rf %{_builddir}%{gemdir}
50
+
51
+ mkdir -p %{_builddir}%{gemdir}
51
52
  mkdir -p %{buildroot}/%{_bindir}
52
- mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
53
- rmdir %{buildroot}%{gemdir}/bin
54
- find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
53
+ mkdir -p %{buildroot}/%{gemdir}
54
+
55
+ gem install --local --install-dir %{_builddir}%{gemdir} \
56
+ --force --rdoc %{SOURCE0}
57
+ mv %{_builddir}%{gemdir}/bin/* %{buildroot}/%{_bindir}
58
+ find %{_builddir}%{geminstdir}/bin -type f | xargs chmod a+x
59
+ cp -r %{_builddir}%{gemdir}/* %{buildroot}/%{gemdir}
55
60
 
56
61
  %check
57
- pushd %{buildroot}/%{geminstdir}
62
+ pushd %{_builddir}/%{geminstdir}
58
63
  rake spec
59
- rm -rf log
60
64
  popd
61
65
 
62
- %clean
63
- rm -rf %{buildroot}
64
-
65
66
  %files
66
67
  %defattr(-, root, root, -)
67
68
  %{_bindir}/boxgrinder-build
@@ -84,6 +85,23 @@ rm -rf %{buildroot}
84
85
  %{gemdir}/doc/%{gemname}-%{version}
85
86
 
86
87
  %changelog
88
+ * Mon Nov 22 2010 <mgoldman@redhat.com> - 0.6.4-3
89
+ - Changelog rewritten
90
+ - Added Require: parted and e2fsprogs
91
+
92
+ * Sat Nov 20 2010 <mgoldman@redhat.com> - 0.6.4-2
93
+ - Small set of spec file adjustments
94
+
95
+ * Mon Nov 15 2010 <mgoldman@redhat.com> - 0.6.4-1
96
+ - Updated to new upstream release: 0.6.4
97
+ - Removed BuildRoot tag
98
+ - Adjusted Requires and BuildRequires
99
+ - Different approach for testing
100
+ - [BGBUILD-98] Use hashery gem
101
+ - [BGBUILD-99] Timeout exception is not catched on non-EC2 platfrom in GuestFSHelper
102
+ - [BGBUILD-92] Enable --trace switch by default
103
+ - [BGBUILD-91] Log exceptions to log file
104
+
87
105
  * Tue Nov 09 2010 <mgoldman@redhat.com> - 0.6.3-1
88
106
  - [BGBUILD-94] Check if set_network call is avaialbe in libguestfs
89
107
  - Added 'check' section that executes tests
@@ -41,15 +41,15 @@ module BoxGrinder
41
41
  def prepare_appliance_config
42
42
  @appliance_config = mock('ApplianceConfig')
43
43
 
44
- @appliance_config.stub!(:path).and_return(OpenHash.new({:build => 'build/path'}))
44
+ @appliance_config.stub!(:path).and_return(OpenCascade.new({:build => 'build/path'}))
45
45
  @appliance_config.stub!(:name).and_return('full')
46
46
  @appliance_config.stub!(:summary).and_return('asd')
47
47
  @appliance_config.stub!(:version).and_return(1)
48
48
  @appliance_config.stub!(:release).and_return(0)
49
- @appliance_config.stub!(:os).and_return(OpenHash.new({:name => 'fedora', :version => '11'}))
49
+ @appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'fedora', :version => '11'}))
50
50
 
51
51
  @appliance_config.stub!(:hardware).and_return(
52
- OpenHash.new({
52
+ OpenCascade.new({
53
53
  :partitions =>
54
54
  {
55
55
  '/' => {'size' => 2},
@@ -28,16 +28,16 @@ module BoxGrinder
28
28
 
29
29
  @appliance_config = mock('ApplianceConfig')
30
30
 
31
- @appliance_config.stub!(:path).and_return(OpenHash.new({:build => 'build/path'}))
31
+ @appliance_config.stub!(:path).and_return(OpenCascade.new({:build => 'build/path'}))
32
32
  @appliance_config.stub!(:name).and_return('full')
33
33
  @appliance_config.stub!(:summary).and_return('asd')
34
34
  @appliance_config.stub!(:version).and_return(1)
35
35
  @appliance_config.stub!(:release).and_return(0)
36
- @appliance_config.stub!(:os).and_return(OpenHash.new({:name => 'fedora', :version => '11'}))
37
- @appliance_config.stub!(:post).and_return(OpenHash.new({:vmware => []}))
36
+ @appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'fedora', :version => '11'}))
37
+ @appliance_config.stub!(:post).and_return(OpenCascade.new({:vmware => []}))
38
38
 
39
39
  @appliance_config.stub!(:hardware).and_return(
40
- OpenHash.new({
40
+ OpenCascade.new({
41
41
  :partitions =>
42
42
  {
43
43
  '/' => {'size' => 2},
@@ -183,6 +183,12 @@ module BoxGrinder
183
183
  @helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_return("IP")
184
184
  @helper.hw_virtualization_available?.should == false
185
185
  end
186
+
187
+ it "should return false if timeout exception is thrown" do
188
+ @helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_raise(Timeout::Error.new('something'))
189
+ @helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("0")
190
+ @helper.hw_virtualization_available?.should == false
191
+ end
186
192
  end
187
193
  end
188
194
  end
@@ -28,7 +28,7 @@ module BoxGrinder
28
28
 
29
29
  @appliance_config.stub!(:name).and_return('full')
30
30
  @appliance_config.stub!(:hardware).and_return(
31
- OpenHash.new({
31
+ OpenCascade.new({
32
32
  :partitions =>
33
33
  {
34
34
  '/' => {'size' => 2, 'type' => 'ext4'},
@@ -104,6 +104,7 @@ module BoxGrinder
104
104
  @exec_helper.should_receive(:execute).ordered.with('losetup /dev/loop0 disk.raw')
105
105
  @exec_helper.should_receive(:execute).ordered.with("parted /dev/loop0 'unit B print' | grep -e '^ [0-9]' | awk '{ print $2 }'").and_return("0B\n1234B\n")
106
106
  @exec_helper.should_receive(:execute).ordered.with('losetup -d /dev/loop0')
107
+ @helper.should_receive(:sleep).with(1)
107
108
 
108
109
  @helper.calculate_disk_offsets('disk.raw').should == ["0", "1234"]
109
110
  end
@@ -122,7 +123,7 @@ module BoxGrinder
122
123
 
123
124
  it "should create ext4 filesystem on selected device" do
124
125
  @appliance_config.should_receive(:hardware).and_return(
125
- OpenHash.new({
126
+ OpenCascade.new({
126
127
  :partitions =>
127
128
  {
128
129
  '/' => {'size' => 2, 'type' => 'ext3'},
@@ -29,8 +29,8 @@ module BoxGrinder
29
29
 
30
30
  @appliance_config = mock('ApplianceConfig')
31
31
 
32
- @appliance_config.stub!(:path).and_return(OpenHash.new({:build => 'build/path'}))
33
- @appliance_config.stub!(:os).and_return(OpenHash.new({:name => 'fedora', :version => '11'}))
32
+ @appliance_config.stub!(:path).and_return(OpenCascade.new({:build => 'build/path'}))
33
+ @appliance_config.stub!(:os).and_return(OpenCascade.new({:name => 'fedora', :version => '11'}))
34
34
 
35
35
  @plugin = BasePlugin.new
36
36
  @plugin.init(@config, @appliance_config, :plugin_info => {:name => :plugin_name}, :log => Logger.new('/dev/null'))
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: boxgrinder-build
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 3
10
- version: 0.6.3
9
+ - 4
10
+ version: 0.6.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Marek Goldmann
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-11 00:00:00 +01:00
18
+ date: 2010-11-23 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -42,12 +42,12 @@ dependencies:
42
42
  requirements:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
- hash: 31
45
+ hash: 29
46
46
  segments:
47
47
  - 0
48
48
  - 1
49
- - 2
50
- version: 0.1.2
49
+ - 3
50
+ version: 0.1.3
51
51
  type: :runtime
52
52
  version_requirements: *id002
53
53
  description: A tool for creating appliances from simple plain text files for various virtual environments.