boxgrinder-build 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/README +1 -1
- data/Rakefile +1 -1
- data/bin/boxgrinder-build +4 -7
- data/boxgrinder-build.gemspec +6 -6
- data/lib/boxgrinder-build/appliance.rb +4 -11
- data/lib/boxgrinder-build/helpers/appliance-customize-helper.rb +3 -5
- data/lib/boxgrinder-build/helpers/augeas-helper.rb +7 -6
- data/lib/boxgrinder-build/helpers/guestfs-helper.rb +49 -38
- data/lib/boxgrinder-build/helpers/image-helper.rb +3 -5
- data/lib/boxgrinder-build/helpers/linux-helper.rb +4 -6
- data/lib/boxgrinder-build/helpers/package-helper.rb +12 -28
- data/lib/boxgrinder-build/helpers/plugin-helper.rb +4 -6
- data/lib/boxgrinder-build/managers/plugin-manager.rb +3 -5
- data/lib/boxgrinder-build/plugins/base-plugin.rb +26 -18
- data/rubygem-boxgrinder-build.spec +69 -0
- data/spec/Rakefile +18 -0
- data/spec/appliance-spec.rb +19 -1
- data/spec/helpers/appliance-customize-helper-spec.rb +18 -0
- data/spec/helpers/augeas-helper-spec.rb +21 -0
- data/spec/helpers/guestfs-helper-spec.rb +42 -2
- data/spec/helpers/linux-helper-spec.rb +18 -0
- data/spec/helpers/package-helper-spec.rb +18 -0
- data/spec/helpers/plugin-helper-spec.rb +18 -0
- data/spec/managers/plugin-manager-spec.rb +18 -0
- data/spec/plugins/base-plugin-spec.rb +18 -0
- metadata +8 -7
data/CHANGELOG
CHANGED
data/README
CHANGED
data/Rakefile
CHANGED
@@ -7,5 +7,5 @@ Echoe.new("boxgrinder-build") do |p|
|
|
7
7
|
p.url = "http://www.jboss.org/boxgrinder"
|
8
8
|
p.email = "info@boxgrinder.org"
|
9
9
|
p.ignore_pattern = /^(pkg|doc)|\.svn|CVS|\.bzr|\.DS|\.git|\.log/
|
10
|
-
p.runtime_dependencies = ["commander ~>4.0.3", "boxgrinder-core ~>0.1.
|
10
|
+
p.runtime_dependencies = ["commander ~>4.0.3", "boxgrinder-core ~>0.1.1"]
|
11
11
|
end
|
data/bin/boxgrinder-build
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright 2009, Red Hat Middleware LLC, and individual contributors
|
5
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
6
|
-
# full listing of individual contributors.
|
3
|
+
# Copyright 2010 Red Hat, Inc.
|
7
4
|
#
|
8
5
|
# This is free software; you can redistribute it and/or modify it
|
9
6
|
# under the terms of the GNU Lesser General Public License as
|
10
|
-
# published by the Free Software Foundation; either version
|
7
|
+
# published by the Free Software Foundation; either version 3 of
|
11
8
|
# the License, or (at your option) any later version.
|
12
9
|
#
|
13
10
|
# This software is distributed in the hope that it will be useful,
|
@@ -22,7 +19,7 @@
|
|
22
19
|
|
23
20
|
require 'rubygems'
|
24
21
|
|
25
|
-
gem 'boxgrinder-core', '>= 0.1.
|
22
|
+
gem 'boxgrinder-core', '>= 0.1.1'
|
26
23
|
gem 'commander', '>= 4.0.3'
|
27
24
|
|
28
25
|
require 'boxgrinder-core/helpers/log-helper'
|
@@ -38,7 +35,7 @@ end
|
|
38
35
|
require 'commander/import'
|
39
36
|
|
40
37
|
program :name, 'BoxGrinder Build'
|
41
|
-
program :version, '0.6.
|
38
|
+
program :version, '0.6.1'
|
42
39
|
program :description, "A tool for building VM images from simple definition files."
|
43
40
|
program :help, 'Homepage', 'http://www.jboss.org/boxgrinder/build.html'
|
44
41
|
program :help, 'Documentation', 'http://community.jboss.org/docs/DOC-14358'
|
data/boxgrinder-build.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{boxgrinder-build}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.1"
|
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-
|
9
|
+
s.date = %q{2010-11-02}
|
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}
|
13
13
|
s.executables = ["boxgrinder-build"]
|
14
14
|
s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README", "bin/boxgrinder-build", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/appliance-customize-helper.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb"]
|
15
|
-
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "bin/boxgrinder-build", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/appliance-customize-helper.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb", "spec/Rakefile", "spec/appliance-spec.rb", "spec/helpers/appliance-customize-helper-spec.rb", "spec/helpers/augeas-helper-spec.rb", "spec/helpers/guestfs-helper-spec.rb", "spec/helpers/image-helper-spec.rb", "spec/helpers/linux-helper-spec.rb", "spec/helpers/package-helper-spec.rb", "spec/helpers/plugin-helper-spec.rb", "spec/managers/plugin-manager-spec.rb", "spec/plugins/base-plugin-spec.rb", "spec/rspec/src/appliances/jeos-f13.appl", "boxgrinder-build.gemspec"]
|
15
|
+
s.files = ["CHANGELOG", "LICENSE", "Manifest", "README", "Rakefile", "bin/boxgrinder-build", "lib/boxgrinder-build/appliance.rb", "lib/boxgrinder-build/helpers/appliance-customize-helper.rb", "lib/boxgrinder-build/helpers/augeas-helper.rb", "lib/boxgrinder-build/helpers/guestfs-helper.rb", "lib/boxgrinder-build/helpers/image-helper.rb", "lib/boxgrinder-build/helpers/linux-helper.rb", "lib/boxgrinder-build/helpers/package-helper.rb", "lib/boxgrinder-build/helpers/plugin-helper.rb", "lib/boxgrinder-build/managers/plugin-manager.rb", "lib/boxgrinder-build/plugins/base-plugin.rb", "rubygem-boxgrinder-build.spec", "spec/Rakefile", "spec/appliance-spec.rb", "spec/helpers/appliance-customize-helper-spec.rb", "spec/helpers/augeas-helper-spec.rb", "spec/helpers/guestfs-helper-spec.rb", "spec/helpers/image-helper-spec.rb", "spec/helpers/linux-helper-spec.rb", "spec/helpers/package-helper-spec.rb", "spec/helpers/plugin-helper-spec.rb", "spec/managers/plugin-manager-spec.rb", "spec/plugins/base-plugin-spec.rb", "spec/rspec/src/appliances/jeos-f13.appl", "boxgrinder-build.gemspec"]
|
16
16
|
s.homepage = %q{http://www.jboss.org/boxgrinder}
|
17
17
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Boxgrinder-build", "--main", "README"]
|
18
18
|
s.require_paths = ["lib"]
|
@@ -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.
|
29
|
+
s.add_runtime_dependency(%q<boxgrinder-core>, ["~> 0.1.1"])
|
30
30
|
else
|
31
31
|
s.add_dependency(%q<commander>, ["~> 4.0.3"])
|
32
|
-
s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.
|
32
|
+
s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.1"])
|
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.
|
36
|
+
s.add_dependency(%q<boxgrinder-core>, ["~> 0.1.1"])
|
37
37
|
end
|
38
38
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -123,12 +121,7 @@ module BoxGrinder
|
|
123
121
|
|
124
122
|
delivery_plugin, delivery_plugin_info = PluginManager.instance.initialize_plugin(:delivery, @options.delivery )
|
125
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] )
|
126
|
-
|
127
|
-
if @options.delivery != delivery_plugin_info[:name]
|
128
|
-
delivery_plugin.run( @options.delivery )
|
129
|
-
else
|
130
|
-
delivery_plugin.run
|
131
|
-
end
|
124
|
+
delivery_plugin.run( @options.delivery )
|
132
125
|
end
|
133
126
|
end
|
134
127
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -40,6 +38,9 @@ module BoxGrinder
|
|
40
38
|
return
|
41
39
|
end
|
42
40
|
|
41
|
+
@log.trace "Enabling coredump catching for augeas..."
|
42
|
+
@guestfs.debug( "core_pattern", [ "/sysroot/core" ] )
|
43
|
+
|
43
44
|
@guestfs.aug_init( "/", 32 )
|
44
45
|
|
45
46
|
unload = []
|
@@ -73,4 +74,4 @@ module BoxGrinder
|
|
73
74
|
@files[name][key] = value
|
74
75
|
end
|
75
76
|
end
|
76
|
-
end
|
77
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -24,14 +22,14 @@ require 'logger'
|
|
24
22
|
|
25
23
|
module BoxGrinder
|
26
24
|
class SilencerProxy
|
27
|
-
def initialize(
|
25
|
+
def initialize(o, destination)
|
28
26
|
@o = o
|
29
27
|
@destination = destination
|
30
28
|
end
|
31
29
|
|
32
|
-
def method_missing(
|
30
|
+
def method_missing(m, *args, &block)
|
33
31
|
begin
|
34
|
-
redirect_streams(
|
32
|
+
redirect_streams(@destination) do
|
35
33
|
@o.send(m, *args, &block)
|
36
34
|
end
|
37
35
|
rescue
|
@@ -39,20 +37,20 @@ module BoxGrinder
|
|
39
37
|
end
|
40
38
|
end
|
41
39
|
|
42
|
-
def redirect_streams(
|
40
|
+
def redirect_streams(destination)
|
43
41
|
old_stdout_stream = STDOUT.dup
|
44
42
|
old_stderr_stream = STDERR.dup
|
45
43
|
|
46
|
-
STDOUT.reopen(
|
47
|
-
STDERR.reopen(
|
44
|
+
STDOUT.reopen(destination)
|
45
|
+
STDERR.reopen(destination)
|
48
46
|
|
49
47
|
STDOUT.sync = true
|
50
48
|
STDERR.sync = true
|
51
49
|
|
52
50
|
yield
|
53
51
|
ensure
|
54
|
-
STDOUT.reopen(
|
55
|
-
STDERR.reopen(
|
52
|
+
STDOUT.reopen(old_stdout_stream)
|
53
|
+
STDERR.reopen(old_stderr_stream)
|
56
54
|
end
|
57
55
|
end
|
58
56
|
end
|
@@ -61,9 +59,9 @@ module Guestfs
|
|
61
59
|
class Guestfs
|
62
60
|
alias_method :sh_original, :sh
|
63
61
|
|
64
|
-
def sh(
|
62
|
+
def sh(command)
|
65
63
|
begin
|
66
|
-
output = sh_original(
|
64
|
+
output = sh_original(command)
|
67
65
|
puts output
|
68
66
|
rescue => e
|
69
67
|
puts "Error occurred while executing above command. Appliance may not work properly."
|
@@ -72,15 +70,15 @@ module Guestfs
|
|
72
70
|
output
|
73
71
|
end
|
74
72
|
|
75
|
-
def redirect(
|
76
|
-
BoxGrinder::SilencerProxy.new(
|
73
|
+
def redirect(destination)
|
74
|
+
BoxGrinder::SilencerProxy.new(self, destination)
|
77
75
|
end
|
78
76
|
end
|
79
77
|
end
|
80
78
|
|
81
79
|
module BoxGrinder
|
82
80
|
class GuestFSHelper
|
83
|
-
def initialize(
|
81
|
+
def initialize(raw_disk, options = {})
|
84
82
|
@raw_disk = raw_disk
|
85
83
|
@log = options[:log] || Logger.new(STDOUT)
|
86
84
|
|
@@ -102,7 +100,7 @@ module BoxGrinder
|
|
102
100
|
end
|
103
101
|
end
|
104
102
|
|
105
|
-
helper = execute(
|
103
|
+
helper = execute(write_pipe)
|
106
104
|
|
107
105
|
yield @guestfs, helper
|
108
106
|
|
@@ -113,14 +111,15 @@ module BoxGrinder
|
|
113
111
|
Process.wait
|
114
112
|
end
|
115
113
|
|
116
|
-
def execute(
|
114
|
+
def execute(pipe = nil)
|
117
115
|
@log.debug "Preparing guestfs..."
|
118
116
|
|
119
|
-
@guestfs = pipe.nil? ? Guestfs::create : Guestfs::create.redirect(
|
117
|
+
@guestfs = pipe.nil? ? Guestfs::create : Guestfs::create.redirect(pipe)
|
120
118
|
|
121
119
|
# TODO remove this, https://bugzilla.redhat.com/show_bug.cgi?id=502058
|
122
|
-
@guestfs.set_append(
|
120
|
+
@guestfs.set_append("noapic")
|
123
121
|
|
122
|
+
@log.trace "Setting debug + trace..."
|
124
123
|
@guestfs.set_verbose(1)
|
125
124
|
@guestfs.set_trace(1)
|
126
125
|
|
@@ -130,22 +129,25 @@ module BoxGrinder
|
|
130
129
|
# Looks like in F13 (qemu-img-0.12.3-8.fc13.i686) this is fixed
|
131
130
|
qemu_wrapper = "/usr/share/qemu-stable/bin/qemu.wrapper"
|
132
131
|
|
133
|
-
if File.exists?(
|
134
|
-
@guestfs.set_qemu(
|
132
|
+
if File.exists?(qemu_wrapper)
|
133
|
+
@guestfs.set_qemu(qemu_wrapper)
|
135
134
|
end
|
136
135
|
|
137
136
|
@log.trace "Adding drive '#{@raw_disk}'..."
|
138
|
-
@guestfs.add_drive(
|
137
|
+
@guestfs.add_drive(@raw_disk)
|
139
138
|
@log.trace "Drive added."
|
140
139
|
|
140
|
+
@log.debug "Enabling networking for GuestFS..."
|
141
|
+
@guestfs.set_network(1)
|
142
|
+
|
141
143
|
@log.debug "Launching guestfs..."
|
142
144
|
@guestfs.launch
|
143
145
|
|
144
146
|
case @guestfs.list_partitions.size
|
145
147
|
when 0
|
146
|
-
mount_partition(
|
148
|
+
mount_partition(@guestfs.list_devices.first, '/')
|
147
149
|
when 1
|
148
|
-
mount_partition(
|
150
|
+
mount_partition(@guestfs.list_partitions.first, '/')
|
149
151
|
else
|
150
152
|
mount_partitions
|
151
153
|
end
|
@@ -165,17 +167,17 @@ module BoxGrinder
|
|
165
167
|
@log.trace "Guestfs closed."
|
166
168
|
end
|
167
169
|
|
168
|
-
def mount_partition(
|
170
|
+
def mount_partition(part, mount_point)
|
169
171
|
@log.trace "Mounting #{part} partition to #{mount_point}..."
|
170
|
-
@guestfs.mount_options(
|
172
|
+
@guestfs.mount_options("", part, mount_point)
|
171
173
|
@log.trace "Partition mounted."
|
172
174
|
end
|
173
175
|
|
174
176
|
# TODO this is shitty, I know... https://bugzilla.redhat.com/show_bug.cgi?id=507188
|
175
177
|
def rebuild_rpm_database
|
176
178
|
@log.debug "Cleaning RPM database..."
|
177
|
-
@guestfs.sh(
|
178
|
-
@guestfs.sh(
|
179
|
+
@guestfs.sh("rm -f /var/lib/rpm/__db.*")
|
180
|
+
@guestfs.sh("rpm --rebuilddb")
|
179
181
|
@log.debug "Cleaning RPM database finished."
|
180
182
|
end
|
181
183
|
|
@@ -183,24 +185,33 @@ module BoxGrinder
|
|
183
185
|
root_partition = nil
|
184
186
|
|
185
187
|
@guestfs.list_partitions.each do |partition|
|
186
|
-
mount_partition(
|
187
|
-
|
188
|
+
mount_partition(partition, '/')
|
189
|
+
|
190
|
+
# TODO: use this http://libguestfs.org/guestfs.3.html#guestfs_vfs_label
|
191
|
+
if @guestfs.exists('/sbin/e2label') != 0
|
188
192
|
root_partition = partition
|
189
193
|
break
|
190
194
|
end
|
191
|
-
@guestfs.umount(
|
195
|
+
@guestfs.umount(partition)
|
192
196
|
end
|
193
197
|
|
194
|
-
raise "No root partition found for '#{File.basename(
|
198
|
+
raise "No root partition found for '#{File.basename(@raw_disk)}' disk!" if root_partition.nil?
|
195
199
|
|
196
200
|
@guestfs.list_partitions.each do |partition|
|
197
201
|
next if partition == root_partition
|
198
|
-
mount_partition(
|
202
|
+
mount_partition(partition, @guestfs.sh("/sbin/e2label #{partition}").chomp.strip)
|
199
203
|
end
|
200
204
|
end
|
201
205
|
|
202
|
-
def
|
203
|
-
|
206
|
+
def sh(cmd, options = {})
|
207
|
+
arch = options[:arch] || `uname -m`.chomp.strip
|
208
|
+
|
209
|
+
@log.debug "Executing #{cmd}"
|
210
|
+
@guestfs.sh("setarch #{arch} << SETARCH_EOF\n#{cmd.gsub('$', '\$')}\nSETARCH_EOF\n")
|
211
|
+
end
|
212
|
+
|
213
|
+
def augeas(&block)
|
214
|
+
AugeasHelper.new(@guestfs, self, :log => @log).edit(&block)
|
204
215
|
end
|
205
216
|
end
|
206
217
|
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -66,4 +64,4 @@ module BoxGrinder
|
|
66
64
|
@log.debug "Kernel image recreated."
|
67
65
|
end
|
68
66
|
end
|
69
|
-
end
|
67
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -29,46 +27,32 @@ module BoxGrinder
|
|
29
27
|
@exec_helper = options[:exec_helper] || ExecHelper.new({:log => @log})
|
30
28
|
end
|
31
29
|
|
32
|
-
def package(deliverables,
|
33
|
-
type = options[:type] || :tar
|
34
|
-
plugin_info = options[:plugin_info]
|
35
|
-
|
36
|
-
platform = 'raw'
|
37
|
-
|
38
|
-
unless plugin_info.nil?
|
39
|
-
if plugin_info[:type] == :platform
|
40
|
-
platform = plugin_info[:name].to_s
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
30
|
+
def package(deliverables, package, type = :tar)
|
44
31
|
files = []
|
45
32
|
|
46
33
|
deliverables.each_value do |file|
|
47
34
|
files << File.basename(file)
|
48
35
|
end
|
49
36
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if File.exists?(package_path)
|
54
|
-
@log.info "Package of #{type} type for #{@appliance_config.name} appliance and #{platform} platform already exists, skipping."
|
55
|
-
return package_path
|
37
|
+
if File.exists?(package)
|
38
|
+
@log.info "Package of #{type} type for #{@appliance_config.name} appliance already exists, skipping."
|
39
|
+
return package
|
56
40
|
end
|
57
41
|
|
58
|
-
FileUtils.mkdir_p(File.dirname(
|
42
|
+
FileUtils.mkdir_p(File.dirname(package))
|
59
43
|
|
60
|
-
@log.info "Packaging #{@appliance_config.name} appliance
|
44
|
+
@log.info "Packaging #{@appliance_config.name} appliance to #{type}..."
|
61
45
|
|
62
46
|
case type
|
63
47
|
when :tar
|
64
|
-
@exec_helper.execute "tar -C #{File.dirname(deliverables[:disk])} -cvzf '#{
|
48
|
+
@exec_helper.execute "tar -C #{File.dirname(deliverables[:disk])} -cvzf '#{package}' #{files.join(' ')}"
|
65
49
|
else
|
66
50
|
raise "Only tar format is currently supported."
|
67
51
|
end
|
68
52
|
|
69
53
|
@log.info "Appliance #{@appliance_config.name} packaged."
|
70
54
|
|
71
|
-
|
55
|
+
package
|
72
56
|
end
|
73
57
|
end
|
74
|
-
end
|
58
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -86,4 +84,4 @@ module BoxGrinder
|
|
86
84
|
attr_reader :platform_plugins
|
87
85
|
attr_reader :delivery_plugins
|
88
86
|
end
|
89
|
-
end
|
87
|
+
end
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -1,11 +1,9 @@
|
|
1
|
-
#
|
2
|
-
# Copyright
|
3
|
-
# by the @authors tag. See the copyright.txt in the distribution for a
|
4
|
-
# full listing of individual contributors.
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
5
3
|
#
|
6
4
|
# This is free software; you can redistribute it and/or modify it
|
7
5
|
# under the terms of the GNU Lesser General Public License as
|
8
|
-
# published by the Free Software Foundation; either version
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
9
7
|
# the License, or (at your option) any later version.
|
10
8
|
#
|
11
9
|
# This software is distributed in the hope that it will be useful,
|
@@ -28,13 +26,13 @@ require 'logger'
|
|
28
26
|
module BoxGrinder
|
29
27
|
class BasePlugin
|
30
28
|
def init(config, appliance_config, options = {})
|
31
|
-
@config
|
32
|
-
@appliance_config
|
33
|
-
@options
|
29
|
+
@config = config
|
30
|
+
@appliance_config = appliance_config
|
31
|
+
@options = options
|
34
32
|
|
35
|
-
@log
|
36
|
-
@exec_helper
|
37
|
-
@image_helper
|
33
|
+
@log = options[:log] || Logger.new(STDOUT)
|
34
|
+
@exec_helper = options[:exec_helper] || ExecHelper.new(:log => @log)
|
35
|
+
@image_helper = options[:image_helper] || ImageHelper.new(:log => @log)
|
38
36
|
|
39
37
|
@plugin_info = options[:plugin_info]
|
40
38
|
@previous_plugin_info = options[:previous_plugin_info]
|
@@ -54,14 +52,14 @@ module BoxGrinder
|
|
54
52
|
|
55
53
|
read_plugin_config
|
56
54
|
|
57
|
-
@initialized
|
55
|
+
@initialized = true
|
58
56
|
|
59
57
|
after_init
|
60
58
|
|
61
59
|
self
|
62
60
|
end
|
63
61
|
|
64
|
-
def register_deliverable(
|
62
|
+
def register_deliverable(deliverable)
|
65
63
|
raise "You can only register deliverables after the plugin is initialized, please initialize the plugin using init method." if @initialized.nil?
|
66
64
|
raise "Please specify deliverables as Hash, not #{deliverable.class}." unless deliverable.is_a?(Hash)
|
67
65
|
|
@@ -71,7 +69,7 @@ module BoxGrinder
|
|
71
69
|
end
|
72
70
|
end
|
73
71
|
|
74
|
-
def register_supported_os(
|
72
|
+
def register_supported_os(name, versions)
|
75
73
|
raise "You can register supported operating system only after the plugin is initialized, please initialize the plugin using init method." if @initialized.nil?
|
76
74
|
|
77
75
|
@supported_oses[name] = OpenHash.new if @supported_oses[name].nil?
|
@@ -94,6 +92,16 @@ module BoxGrinder
|
|
94
92
|
supported
|
95
93
|
end
|
96
94
|
|
95
|
+
def current_platform
|
96
|
+
platform = :raw
|
97
|
+
|
98
|
+
if @previous_plugin_info[:type] == :platform
|
99
|
+
platform = @previous_plugin_info[:name]
|
100
|
+
end unless @previous_plugin_info.nil?
|
101
|
+
|
102
|
+
platform.to_s
|
103
|
+
end
|
104
|
+
|
97
105
|
def validate_plugin_config(fields = [], doc = nil)
|
98
106
|
more_info = doc.nil? ? '' : "See #{doc} for more info"
|
99
107
|
|
@@ -108,11 +116,11 @@ module BoxGrinder
|
|
108
116
|
raise "You can only execute the plugin after the plugin is initialized, please initialize the plugin using init method." if @initialized.nil?
|
109
117
|
end
|
110
118
|
|
111
|
-
def run(
|
119
|
+
def run(*args)
|
112
120
|
FileUtils.rm_rf @dir.tmp
|
113
121
|
FileUtils.mkdir_p @dir.tmp
|
114
122
|
|
115
|
-
execute(
|
123
|
+
execute(*args)
|
116
124
|
|
117
125
|
after_execute
|
118
126
|
end
|
@@ -123,7 +131,7 @@ module BoxGrinder
|
|
123
131
|
def after_execute
|
124
132
|
@deliverables.each do |name, path|
|
125
133
|
@log.trace "Moving '#{path}' deliverable to target destination '#{@target_deliverables[name]}'..."
|
126
|
-
FileUtils.mv(
|
134
|
+
FileUtils.mv(path, @target_deliverables[name])
|
127
135
|
end
|
128
136
|
|
129
137
|
FileUtils.rm_rf @dir.tmp
|
@@ -164,4 +172,4 @@ module BoxGrinder
|
|
164
172
|
end
|
165
173
|
end
|
166
174
|
end
|
167
|
-
end
|
175
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
%global gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
|
2
|
+
%global gemname boxgrinder-build
|
3
|
+
%global geminstdir %{gemdir}/gems/%{gemname}-%{version}
|
4
|
+
%global rubyabi 1.8
|
5
|
+
|
6
|
+
Summary: A tool for creating appliances from simple plain text files
|
7
|
+
Name: rubygem-%{gemname}
|
8
|
+
Version: 0.6.1
|
9
|
+
Release: 1%{?dist}
|
10
|
+
Group: Development/Languages
|
11
|
+
License: LGPL
|
12
|
+
URL: http://www.jboss.org/boxgrinder
|
13
|
+
Source0: http://rubygems.org/gems/%{gemname}-%{version}.gem
|
14
|
+
|
15
|
+
Requires: ruby(abi) = %{rubyabi}
|
16
|
+
Requires: rubygems >= 1.2
|
17
|
+
Requires: ruby >= 0
|
18
|
+
Requires: rubygem(commander) => 4.0.3
|
19
|
+
Requires: rubygem(commander) < 4.1
|
20
|
+
Requires: rubygem(boxgrinder-core) => 0.1.0
|
21
|
+
Requires: rubygem(boxgrinder-core) < 0.2
|
22
|
+
BuildRequires: rubygems >= 1.2
|
23
|
+
BuildRequires: ruby >= 0
|
24
|
+
|
25
|
+
BuildArch: noarch
|
26
|
+
Provides: rubygem(%{gemname}) = %{version}
|
27
|
+
|
28
|
+
%description
|
29
|
+
A tool for creating appliances from simple plain text files for various
|
30
|
+
virtual environments
|
31
|
+
|
32
|
+
%prep
|
33
|
+
|
34
|
+
%build
|
35
|
+
|
36
|
+
%install
|
37
|
+
rm -rf %{buildroot}
|
38
|
+
mkdir -p %{buildroot}%{gemdir}
|
39
|
+
gem install --local --install-dir %{buildroot}%{gemdir} \
|
40
|
+
--force --rdoc %{SOURCE0}
|
41
|
+
mkdir -p %{buildroot}/%{_bindir}
|
42
|
+
mv %{buildroot}%{gemdir}/bin/* %{buildroot}/%{_bindir}
|
43
|
+
rmdir %{buildroot}%{gemdir}/bin
|
44
|
+
find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
|
45
|
+
|
46
|
+
%clean
|
47
|
+
rm -rf %{buildroot}
|
48
|
+
|
49
|
+
%files
|
50
|
+
%defattr(-, root, root, -)
|
51
|
+
%{_bindir}/boxgrinder-build
|
52
|
+
%dir %{geminstdir}
|
53
|
+
%{geminstdir}/bin
|
54
|
+
%{geminstdir}/lib
|
55
|
+
%doc %{gemdir}/doc/%{gemname}-%{version}
|
56
|
+
%doc %{geminstdir}/%{gemname}.gemspec
|
57
|
+
%doc %{geminstdir}/rubygem-%{gemname}.spec
|
58
|
+
%doc %{geminstdir}/CHANGELOG
|
59
|
+
%doc %{geminstdir}/LICENSE
|
60
|
+
%doc %{geminstdir}/README
|
61
|
+
%doc %{geminstdir}/Manifest
|
62
|
+
%doc %{geminstdir}/Rakefile
|
63
|
+
%doc %{geminstdir}/spec
|
64
|
+
%{gemdir}/cache/%{gemname}-%{version}.gem
|
65
|
+
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
66
|
+
|
67
|
+
%changelog
|
68
|
+
* Mon Oct 18 2010 <mgoldman@redhat.com> - 0.6.1-1
|
69
|
+
- Initial package
|
data/spec/Rakefile
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'rake'
|
2
20
|
require 'spec/rake/spectask'
|
3
21
|
|
data/spec/appliance-spec.rb
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/appliance'
|
2
20
|
require 'rspec/rspec-config-helper'
|
3
21
|
require 'ostruct'
|
@@ -180,7 +198,7 @@ module BoxGrinder
|
|
180
198
|
|
181
199
|
delivery_plugin = mock('S3 Plugin')
|
182
200
|
delivery_plugin.should_receive(:init)
|
183
|
-
delivery_plugin.should_receive(:run).with(
|
201
|
+
delivery_plugin.should_receive(:run).with( :same )
|
184
202
|
|
185
203
|
@plugin_manager.should_receive(:plugins).and_return( { :delivery => "something" } )
|
186
204
|
@plugin_manager.should_receive(:initialize_plugin).with(:delivery, :same).and_return([ delivery_plugin, {:class => Appliance, :type => :delivery, :name => :same, :full_name => "A plugin"} ] )
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/appliance-customize-helper'
|
2
20
|
require 'rspec/rspec-config-helper'
|
3
21
|
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/augeas-helper'
|
2
20
|
|
3
21
|
module BoxGrinder
|
@@ -18,6 +36,7 @@ module BoxGrinder
|
|
18
36
|
end
|
19
37
|
|
20
38
|
it "should change configuration for one file" do
|
39
|
+
@guestfs.should_receive(:debug).with("core_pattern", ["/sysroot/core"])
|
21
40
|
@guestfs.should_receive(:exists).with('/etc/ssh/sshd_config').and_return(1)
|
22
41
|
@guestfs.should_receive(:aug_init).with('/', 32)
|
23
42
|
@guestfs.should_receive(:aug_rm).with("/augeas/load//incl[. != '/etc/ssh/sshd_config']")
|
@@ -31,6 +50,7 @@ module BoxGrinder
|
|
31
50
|
end
|
32
51
|
|
33
52
|
it "should change configuration for two files" do
|
53
|
+
@guestfs.should_receive(:debug).with("core_pattern", ["/sysroot/core"])
|
34
54
|
@guestfs.should_receive(:exists).with('/etc/ssh/sshd_config').and_return(1)
|
35
55
|
@guestfs.should_receive(:exists).with('/etc/sysconfig/selinux').and_return(1)
|
36
56
|
@guestfs.should_receive(:aug_init).with('/', 32)
|
@@ -47,6 +67,7 @@ module BoxGrinder
|
|
47
67
|
end
|
48
68
|
|
49
69
|
it "should change one configuration for two files because one file doesn't exists" do
|
70
|
+
@guestfs.should_receive(:debug).with("core_pattern", ["/sysroot/core"])
|
50
71
|
@guestfs.should_receive(:exists).with('/etc/ssh/sshd_config').and_return(1)
|
51
72
|
@guestfs.should_receive(:exists).with('/etc/sysconfig/selinux').and_return(0)
|
52
73
|
@guestfs.should_receive(:aug_init).with('/', 32)
|
@@ -1,14 +1,36 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/guestfs-helper'
|
2
20
|
|
3
21
|
module BoxGrinder
|
4
22
|
describe GuestFSHelper do
|
5
23
|
|
24
|
+
before(:all) do
|
25
|
+
@arch = `uname -m`.chomp.strip
|
26
|
+
end
|
27
|
+
|
6
28
|
before(:each) do
|
7
29
|
@log = Logger.new('/dev/null')
|
8
30
|
@helper = GuestFSHelper.new('a/raw/disk', :log => @log)
|
9
31
|
end
|
10
32
|
|
11
|
-
def prepare_and_launch(
|
33
|
+
def prepare_and_launch(partitions)
|
12
34
|
guetfs = mock('Guestfs')
|
13
35
|
guetfs.should_receive(:set_append).with('noapic')
|
14
36
|
guetfs.should_receive(:set_verbose)
|
@@ -18,8 +40,9 @@ module BoxGrinder
|
|
18
40
|
|
19
41
|
guetfs.should_receive(:set_qemu).with('/usr/share/qemu-stable/bin/qemu.wrapper')
|
20
42
|
guetfs.should_receive(:add_drive).with('a/raw/disk')
|
43
|
+
guetfs.should_receive(:set_network).with(1)
|
21
44
|
guetfs.should_receive(:launch)
|
22
|
-
guetfs.should_receive(:list_partitions).and_return(
|
45
|
+
guetfs.should_receive(:list_partitions).and_return(partitions)
|
23
46
|
|
24
47
|
Guestfs.should_receive(:create).and_return(guetfs)
|
25
48
|
|
@@ -123,7 +146,24 @@ module BoxGrinder
|
|
123
146
|
end
|
124
147
|
end
|
125
148
|
|
149
|
+
it "execute a command for current arch" do
|
150
|
+
guestfs = mock('Guestfs')
|
126
151
|
|
152
|
+
@helper.should_receive(:`).with('uname -m').and_return('bleh')
|
153
|
+
@helper.instance_variable_set(:@guestfs, guestfs)
|
154
|
+
|
155
|
+
guestfs.should_receive(:sh).with("setarch bleh << SETARCH_EOF\ncommand\nSETARCH_EOF\n")
|
127
156
|
|
157
|
+
@helper.sh("command")
|
158
|
+
end
|
159
|
+
|
160
|
+
it "execute a command for specified arch" do
|
161
|
+
guestfs = mock('Guestfs')
|
162
|
+
@helper.instance_variable_set(:@guestfs, guestfs)
|
163
|
+
|
164
|
+
guestfs.should_receive(:sh).with("setarch arch << SETARCH_EOF\ncommand\nSETARCH_EOF\n")
|
165
|
+
|
166
|
+
@helper.sh("command", :arch => 'arch')
|
167
|
+
end
|
128
168
|
end
|
129
169
|
end
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/linux-helper'
|
2
20
|
|
3
21
|
module BoxGrinder
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/package-helper'
|
2
20
|
|
3
21
|
module BoxGrinder
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/helpers/plugin-helper'
|
2
20
|
require 'rspec/rspec-config-helper'
|
3
21
|
require 'ostruct'
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/managers/plugin-manager'
|
2
20
|
|
3
21
|
module BoxGrinder
|
@@ -1,3 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2010 Red Hat, Inc.
|
3
|
+
#
|
4
|
+
# This is free software; you can redistribute it and/or modify it
|
5
|
+
# under the terms of the GNU Lesser General Public License as
|
6
|
+
# published by the Free Software Foundation; either version 3 of
|
7
|
+
# the License, or (at your option) any later version.
|
8
|
+
#
|
9
|
+
# This software is distributed in the hope that it will be useful,
|
10
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
# Lesser General Public License for more details.
|
13
|
+
#
|
14
|
+
# You should have received a copy of the GNU Lesser General Public
|
15
|
+
# License along with this software; if not, write to the Free
|
16
|
+
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
17
|
+
# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
|
18
|
+
|
1
19
|
require 'boxgrinder-build/plugins/base-plugin'
|
2
20
|
require 'rspec/rspec-config-helper'
|
3
21
|
|
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:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 1
|
10
|
+
version: 0.6.1
|
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-
|
18
|
+
date: 2010-11-02 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:
|
45
|
+
hash: 25
|
46
46
|
segments:
|
47
47
|
- 0
|
48
48
|
- 1
|
49
|
-
-
|
50
|
-
version: 0.1.
|
49
|
+
- 1
|
50
|
+
version: 0.1.1
|
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.
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/boxgrinder-build/helpers/plugin-helper.rb
|
89
89
|
- lib/boxgrinder-build/managers/plugin-manager.rb
|
90
90
|
- lib/boxgrinder-build/plugins/base-plugin.rb
|
91
|
+
- rubygem-boxgrinder-build.spec
|
91
92
|
- spec/Rakefile
|
92
93
|
- spec/appliance-spec.rb
|
93
94
|
- spec/helpers/appliance-customize-helper-spec.rb
|