[Ovirt-devel] [PATCH] rakefile to build the ovirt rpm
Bryan Kearney
bkearney at redhat.com
Thu Dec 18 17:11:54 UTC 2008
---
ace-ovirt.spec | 2 +-
ace-ovirt/modules/ovirt/manifests/dns.pp | 21 ++++++++----
ace-ovirt/modules/ovirt/ovirt-installer | 4 ++-
rakefile.rb | 53 ++++++++++++++++++++++++++++++
4 files changed, 71 insertions(+), 9 deletions(-)
create mode 100644 rakefile.rb
diff --git a/ace-ovirt.spec b/ace-ovirt.spec
index 7c72962..451ce4b 100755
--- a/ace-ovirt.spec
+++ b/ace-ovirt.spec
@@ -44,7 +44,7 @@ install -d %{buildroot}/%{acehome}
install -d %{buildroot}/%{ruby_sitelibdir}
install -d %{buildroot}/%{_bindir}
install -d %{buildroot}/%{_initrddir}
-cp -pr %{pbuild}/modules %{buildroot}/%{acehome}
+cp -pr %{pbuild}/ace-ovirt/modules %{buildroot}/%{acehome}
diff --git a/ace-ovirt/modules/ovirt/manifests/dns.pp b/ace-ovirt/modules/ovirt/manifests/dns.pp
index 8665b99..f6a82a5 100644
--- a/ace-ovirt/modules/ovirt/manifests/dns.pp
+++ b/ace-ovirt/modules/ovirt/manifests/dns.pp
@@ -18,8 +18,7 @@
# Author: Joey Boggs <jboggs at redhat.com>
#--
-
-define dns::bundled($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
+define dns::common($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
package {"dnsmasq":
ensure => installed,
@@ -45,10 +44,6 @@ define dns::bundled($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="")
require => [Single_exec["add_mgmt_server_to_etc_hosts"],Single_exec["set_hostname"]]
}
- single_exec {"add_mgmt_server_to_etc_hosts":
- command => "/bin/echo $mgmt_ipaddr $ipa_host >> /etc/hosts",
- notify => Service[dnsmasq]
- }
file_replacement {"dnsmasq_configdir":
file => "/etc/dnsmasq.conf",
@@ -63,7 +58,17 @@ define dns::bundled($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="")
}
-class dns::remote {
+define dns::bundled($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
+
+ dns::common("setup": mgmt_ipaddr=>$mgmt_ipaddr, prov_ipaddr=>$prov_ipaddr, mgmt_dev=>$mgmt_dev, prov_dev=>$prov_dev)
+
+ single_exec {"add_mgmt_server_to_etc_hosts":
+ command => "/bin/echo $mgmt_ipaddr $ipa_host >> /etc/hosts",
+ notify => Service[dnsmasq]
+ }
+}
+
+define dns::remote($mgmt_ipaddr="", $prov_ipaddr="",$mgmt_dev="",$prov_dev="") {
# On the pxe server you will need to ensure that the
# next server option points to the ip address of the tftp server
@@ -81,4 +86,6 @@ class dns::remote {
# Also A records must be present for each oVirt node. Without this they are unable
# to determine their hostname and locate the management server.
+ dns::common("setup": mgmt_ipaddr=>$mgmt_ipaddr, prov_ipaddr=>$prov_ipaddr, mgmt_dev=>$mgmt_dev, prov_dev=>$prov_dev)
+
}
diff --git a/ace-ovirt/modules/ovirt/ovirt-installer b/ace-ovirt/modules/ovirt/ovirt-installer
index 7d7b9d8..902b916 100755
--- a/ace-ovirt/modules/ovirt/ovirt-installer
+++ b/ace-ovirt/modules/ovirt/ovirt-installer
@@ -123,16 +123,18 @@ mgmt_ipaddr= mgmt_ip.scan(/\s*inet addr:([\d.]+)/)
prov_ip = `ifconfig #{prov_dev}`
prov_ipaddr= prov_ip.scan(/\s*inet addr:([\d.]+)/)
-if dns_servers == "n"
config_file.write "# dns configuration\n"
config_file.write "$mgmt_ipaddr = '#{mgmt_ipaddr}'\n"
config_file.write "$prov_ipaddr = '#{prov_ipaddr}'\n"
config_file.write "$ovirt_host = '#{ovirt_host}'\n"
config_file.write "$ipa_host = '#{ipa_host}'\n\n"
+
+if dns_servers == "n"
config_file.write "dns::bundled{setup: mgmt_ipaddr=> $mgmt_ipaddr, prov_ipaddr=> $prov_ipaddr, mgmt_dev => '#{mgmt_dev}', prov_dev => '#{prov_dev}'}\n\n"
end
if dns_servers == "y"
+config_file.write "dns::remote{setup: mgmt_ipaddr=> $mgmt_ipaddr, prov_ipaddr=> $prov_ipaddr, mgmt_dev => '#{mgmt_dev}', prov_dev => '#{prov_dev}'}\n\n"
host_lookup = Socket.getaddrinfo(ipa_host,nil)
hostip = host_lookup[1][3]
if hostip.to_s != mgmt_ipaddr.to_s
diff --git a/rakefile.rb b/rakefile.rb
new file mode 100644
index 0000000..a2fae18
--- /dev/null
+++ b/rakefile.rb
@@ -0,0 +1,53 @@
+# -*- ruby -*-
+# Rakefile: build appliance configuration engine rpms
+#
+# Copyright (C) 2007 Red Hat, Inc.
+#
+# Distributed under the GNU Lesser General Public License v2.1 or later.
+# See COPYING for details
+#
+# Bryan Kearney <bkearney at redhat.com>
+
+require 'rake/clean'
+require 'rake/rdoctask'
+require 'rake/testtask'
+require 'rake/packagetask'
+
+ROOT_DIR = File::expand_path(".")
+PKG_VERSION="0.0.94"
+PACKAGE_DIR = ROOT_DIR + "/pkg"
+
+#
+# Files to clean up
+#
+
+CLEAN.include("**/*~","pkg")
+
+
+# Packaging Tasks
+#
+Rake::PackageTask.new("ace-ovirt", PKG_VERSION) do |pkg|
+ pkg.need_tar_gz = true
+ pkg.package_files.include(Dir["ace-ovirt/**/*"])
+end
+
+
+#
+# Tasks to build the rpms
+#
+
+# Set up the directories
+task :rpm => [ :package ] do |t|
+ Dir["*.spec"].each do |specfile|
+ spec = File.basename(specfile)
+ cp(specfile, "pkg")
+ puts("Building with spec file #{spec}")
+ Dir::chdir("pkg") do |dir|
+ dir = File::expand_path(".")
+ system("rpmbuild --define '_topdir #{dir}' --define '_sourcedir #{dir}' --define '_srcrpmdir #{dir}' --define '_rpmdir #{dir}' --define '_builddir #{dir}' -ba #{spec} > #{spec}.rpmbuild.log 2>&1")
+ if $? != 0
+ raise "rpmbuild failed"
+ end
+ end
+ end
+end
--
1.6.0.4
More information about the ovirt-devel
mailing list