ruby-libvirt-catphish 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS ADDED
@@ -0,0 +1,141 @@
1
+ 2018-02-18 0.7.1
2
+ * Fix a bad bug in block_resize (Marius Rieder)
3
+ * Fix up some problems pointed out by clang
4
+ * Fix up the tests for small semantic differences in how libvirt works
5
+
6
+ 2016-09-22 0.7.0
7
+ * Fix network lease API to allow arguments that libvirt allows
8
+ * Implement VIRT_STORAGE_POOL_CREATE flags
9
+ * Implement more VIR_STORAGE_VOL flags
10
+ * Implement VIR_DOMAIN_QEMU_AGENT_COMMAND_SHUTDOWN
11
+ * Implement virDomainDefineXMLFlags
12
+ * Implement virDomainRename
13
+ * Implement virDomainSetUserPassword
14
+ * Implement VIR_DOMAIN_TIME_SYNC
15
+ * Fix the return value from virStreamSourceFunc so volume upload works
16
+
17
+ 2015-11-20 0.6.0
18
+ * Fix possible buffer overflow
19
+ * Fix storage volume creation error messages
20
+ * Add additional storage pool defines
21
+ * Implement Network dhcp_leases method
22
+ * Implement Connect node_alloc_pages method
23
+ * Implement Domain time method
24
+ * Implement Connect domain_capabilities method
25
+ * Implement Domain core_dump_with_format method
26
+ * Implement Domain fs_freeze method
27
+ * Implement Domain fs_info method
28
+ * Implement Connect node_free_pages method
29
+
30
+ 2014-01-08 0.5.2
31
+ * Fix to make sure we don't free more entires than retrieved
32
+
33
+ 2013-12-15 0.5.1
34
+ * Fixes to compile against older libvirt
35
+ * Fixes to compile against ruby 1.8
36
+
37
+ 2013-12-09 0.5.0
38
+ * Updated Network class, implementing almost all libvirt APIs
39
+ * Updated Domain class, implementing almost all libvirt APIs
40
+ * Updated Connection class, implementing almost all libvirt APIs
41
+ * Updated DomainSnapshot class, implementing almost all libvirt APIs
42
+ * Updated NodeDevice class, implementing almost all libvirt APIs
43
+ * Updated Storage class, implementing almost all libvirt APIs
44
+ * Add constants for almost all libvirt defines
45
+ * Improved performance in the library by using alloca
46
+
47
+ 2011-07-27 0.4.0
48
+ * Updated Domain class, implementing dom.memory_parameters=,
49
+ dom.memory_parameters, dom.updated?, dom.migrate2, dom.migrate_to_uri2,
50
+ dom.migrate_set_max_speed, dom.qemu_monitor_command, dom.blkio_parameters,
51
+ dom.blkio_parameters=, dom.state, dom.open_console, dom.screenshot, and
52
+ dom.inject_nmi
53
+ * Implementation of the Stream class, which covers the libvirt virStream APIs
54
+ * Add the ability to build against non-system libvirt libraries
55
+ * Updated Error object, which now includes the libvirt code, component and
56
+ level of the error, as well as all of the error constants from libvirt.h
57
+ * Updated Connect class, implementing conn.sys_info, conn.stream,
58
+ conn.interface_change_begin, conn.interface_change_commit, and
59
+ conn.interface_change_rollback
60
+ * Updated StorageVol class, implementing vol.download and vol.upload
61
+ * Various bugfixes
62
+
63
+ 2010-12-12 0.3.0
64
+ * Implementation of Libvirt::open_auth, Libvirt::event_register_impl
65
+ * Updated Connect class, implementing conn.compare_cpu, conn.baseline_cpu,
66
+ conn.domain_event_register_any, conn.domain_event_deregister_any,
67
+ conn.domain_event_register, conn.domain_event_deregister, and
68
+ conn.create_domain_xml.
69
+ * Updated Domain class, implementing dom.get_vcpus, dom.update_device,
70
+ dom.scheduler_type, dom.scheduler_parameters, dom.scheduler_parameters=,
71
+ dom.num_vcpus, dom.vcpus_flags=, and dom.qemu_monitor_command.
72
+ * Updated Interface class, implementing interface.free
73
+ * Many potential memory leaks have been fixed.
74
+ * Many bugfixes.
75
+ * Documentation update of many methods, including all of the lookup methods
76
+ that were missing before.
77
+
78
+ 2010-11-10
79
+ * Gem for version 0.2.0 pushed to rubygems.org
80
+
81
+ 2010-07-01 0.2.0
82
+ * Updated Storage class, implementing pool.active?, pool.persistent?,
83
+ pool.vol_create_xml_from.
84
+ * Updated Connect class, implementing conn.node_free_memory,
85
+ conn.node_cells_free_memory, conn.node_get_security_model, conn.encrypted?,
86
+ conn.libversion, and conn.secure?
87
+ * Updated Network class, implementing network.active? and network.persistent?
88
+ * Update Domain class, implementing conn.domain_xml_from_native,
89
+ conn.domain_xml_to_native, dom.migrate_to_uri,
90
+ dom.migrate_set_max_downtime, dom.managed_save, dom.has_managed_save?,
91
+ dom.managed_save_remove, dom.security_label, dom.block_stats,
92
+ dom.memory_stats, dom.blockinfo, dom.block_peek, dom.memory_peek,
93
+ dom.active?, dom.persistent?, dom.snapshot_create_xml,
94
+ dom.num_of_snapshots, dom.list_snapshots, dom.lookup_snapshot_by_name,
95
+ dom.has_current_snapshot?, dom.revert_to_snapshot, dom.current_snapshot,
96
+ snapshot.xml_desc, snapshot.delete, dom.job_info, and dom.abort_job.
97
+ * Implementation of the NodeDevice class.
98
+ * Implementation of the Secret class.
99
+ * Implementation of the NWFilter class.
100
+ * Implementation of the Interface class.
101
+ * Conversion of the development tree to git.
102
+ * New maintainer (Chris Lalancette). David Lutterkort has agreed to transfer
103
+ maintainership since he is not actively involved in their development
104
+ anymore.
105
+
106
+ 2008-11-18 0.1.0
107
+ * Add binding for virConnectFindStoragePoolSources (clalance)
108
+ * Fix dom_migrate (clalance)
109
+ * Add the MIGRATE_LIVE (enum virDomainMigrateFlags) flag
110
+ * Slight improvements of the unit tests
111
+
112
+ 2008-04-15 0.0.7
113
+ * Binding for virDomainMigrate
114
+ * Fix crash caused by using virResetError
115
+ * More sensible message included in exceptions
116
+
117
+ 2008-04-02 0.0.6
118
+ * Fix test failure exposed by the Fedora builders
119
+
120
+ 2008-04-02 0.0.5
121
+ * Explicit free methods for various objects (based on a patch by
122
+ Vadim Zaliva)
123
+ * Make the FLAGS argument for various calls optional, and default it
124
+ to 0. (Chris Lalancette)
125
+ * More finegrained exceptions on errors, containing libvirt error message
126
+ (Mohammed Morsi)
127
+
128
+ 2008-04-01 0.0.4
129
+ * Bindings for the libvirt storage API (requires libvirt 0.4.1)
130
+ * Suppress some bindings if the underlying libvirt doesn't support it
131
+ * Bindings for virDomainSetMemory, virDomainPinVcpu, and
132
+ virDomainSetVcpus (Vadim Zaliva)
133
+
134
+ 2007-12-06 0.0.2
135
+ * Add virNodeGetInfo binding
136
+
137
+ * Convert Ruby API from StudlyCaps to under_score_separation, since that's
138
+ the Ruby convention
139
+
140
+ 2007-11-19 0.0.1
141
+ * Initial release
data/README ADDED
@@ -0,0 +1,219 @@
1
+ ruby-libvirt
2
+ ============
3
+
4
+ Ruby bindings for libvirt (http://libvirt.org)
5
+
6
+ Usage
7
+ -----
8
+
9
+ In your ruby code, do a "require 'libvirt'"; to obtain a connection, use
10
+ 'Libvirt::open' or 'Libvirt::open_read_only'. See tests/*.rb for more
11
+ examples.
12
+
13
+ Hacking
14
+ -------
15
+
16
+ On a Fedora machine, run
17
+ yum install libvirt-devel ruby-devel rubygem-rake
18
+ and then
19
+ rake build
20
+ rake test
21
+
22
+ To run against the checkout, make sure you set RUBYLIB (assuming DIR is the
23
+ toplevel of your source checkout):
24
+
25
+ export RUBYLIB=$dir/lib:$dir/ext/libvirt
26
+ ruby -rlibvirt -e 'puts Libvirt::version[0]'
27
+
28
+ Notes
29
+ -----
30
+ As of October 26, 2013, the ruby-libvirt bindings support all of the libvirt
31
+ APIs up to libvirt commit hash b695aeebd52bcbd0d260893bddd5bfe1e486e980
32
+ with the following exceptions:
33
+
34
+ VIR_DOMAIN_LAST
35
+ VIR_DOMAIN_NOSTATE_LAST
36
+ VIR_DOMAIN_RUNNING_LAST
37
+ VIR_DOMAIN_BLOCKED_LAST
38
+ VIR_DOMAIN_PAUSED_LAST
39
+ VIR_DOMAIN_SHUTDOWN_LAST
40
+ VIR_DOMAIN_SHUTOFF_LAST
41
+ VIR_DOMAIN_CRASHED_LAST
42
+ VIR_DOMAIN_PMSUSPENDED_LAST
43
+ VIR_DOMAIN_PMSUSPENDED_DISK_LAST
44
+ VIR_DOMAIN_CONTROL_LAST
45
+ VIR_DOMAIN_NONE
46
+ VIR_NODE_SUSPEND_TARGET_LAST
47
+ VIR_TYPED_PARAM_LAST
48
+ VIR_TYPED_PARAM_STRING_OKAY
49
+ VIR_DOMAIN_MEMORY_STAT_NR
50
+ VIR_DOMAIN_MEMORY_STAT_LAST
51
+ VIR_CRED_LAST
52
+ VIR_EXPORT_VAR
53
+ VIR_CONNECT_CLOSE_REASON_ERROR
54
+ VIR_CONNECT_CLOSE_REASON_EOF
55
+ VIR_CONNECT_CLOSE_REASON_KEEPALIVE
56
+ VIR_CONNECT_CLOSE_REASON_CLIENT
57
+ VIR_CONNECT_CLOSE_REASON_LAST
58
+ VIR_DOMAIN_NUMATUNE_MEM_STRICT
59
+ VIR_DOMAIN_NUMATUNE_MEM_PREFERRED
60
+ VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE
61
+ VIR_DOMAIN_NUMATUNE_MEM_LAST
62
+ VIR_DOMAIN_METADATA_LAST
63
+ VIR_VCPU_LAST
64
+ VIR_DOMAIN_BLOCK_JOB_TYPE_LAST
65
+ VIR_DOMAIN_DISK_ERROR_LAST
66
+ VIR_NETWORK_UPDATE_COMMAND_LAST
67
+ VIR_NETWORK_SECTION_LAST
68
+ VIR_STORAGE_POOL_STATE_LAST
69
+ VIR_STORAGE_VOL_LAST
70
+ VIR_STORAGE_VOL_WIPE_ALG_LAST
71
+ VIR_KEYCODE_SET_LAST
72
+ VIR_DOMAIN_PROCESS_SIGNAL_LAST
73
+ VIR_DOMAIN_EVENT_LAST
74
+ VIR_DOMAIN_EVENT_DEFINED_LAST
75
+ VIR_DOMAIN_EVENT_UNDEFINED_LAST
76
+ VIR_DOMAIN_EVENT_STARTED_LAST
77
+ VIR_DOMAIN_EVENT_SUSPENDED_LAST
78
+ VIR_DOMAIN_EVENT_RESUMED_LAST
79
+ VIR_DOMAIN_EVENT_STOPPED_LAST
80
+ VIR_DOMAIN_EVENT_SHUTDOWN_LAST
81
+ VIR_DOMAIN_EVENT_PMSUSPENDED_LAST
82
+ VIR_DOMAIN_EVENT_CRASHED_LAST
83
+ VIR_SECRET_USAGE_TYPE_LAST
84
+ VIR_CPU_COMPARE_LAST
85
+ VIR_DOMAIN_JOB_LAST
86
+ VIR_DOMAIN_EVENT_WATCHDOG_LAST
87
+ VIR_DOMAIN_EVENT_IO_ERROR_LAST
88
+ VIR_DOMAIN_EVENT_GRAPHICS_LAST
89
+ VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST
90
+ VIR_DOMAIN_BLOCK_JOB_LAST
91
+ VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START
92
+ VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START
93
+ VIR_DOMAIN_EVENT_DISK_CHANGE_LAST
94
+ VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN
95
+ VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE
96
+ VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST
97
+ VIR_DOMAIN_EVENT_ID_BLOCK_JOB
98
+ VIR_DOMAIN_EVENT_ID_DISK_CHANGE
99
+ VIR_DOMAIN_EVENT_ID_TRAY_CHANGE
100
+ VIR_DOMAIN_EVENT_ID_PMWAKEUP
101
+ VIR_DOMAIN_EVENT_ID_PMSUSPEND
102
+ VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE
103
+ VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK
104
+ VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED
105
+ VIR_DOMAIN_EVENT_ID_LAST
106
+ VIR_DOMAIN_BLKIO_PARAM_INT
107
+ VIR_DOMAIN_BLKIO_PARAM_UINT
108
+ VIR_DOMAIN_BLKIO_PARAM_LLONG
109
+ VIR_DOMAIN_BLKIO_PARAM_ULLONG
110
+ VIR_DOMAIN_BLKIO_PARAM_DOUBLE
111
+ VIR_DOMAIN_BLKIO_PARAM_BOOLEAN
112
+ VIR_DOMAIN_MEMORY_PARAM_INT
113
+ VIR_DOMAIN_MEMORY_PARAM_UINT
114
+ VIR_DOMAIN_MEMORY_PARAM_LLONG
115
+ VIR_DOMAIN_MEMORY_PARAM_ULLONG
116
+ VIR_DOMAIN_MEMORY_PARAM_DOUBLE
117
+ VIR_DOMAIN_MEMORY_PARAM_BOOLEAN
118
+ VIR_DEPRECATED
119
+ VIR_DEPRECATED
120
+ VIR_EXPORT_VAR
121
+ VIR_EXPORT_VAR
122
+ VIR_EXPORT_VAR
123
+ VIR_EXPORT_VAR
124
+ VIR_SECURITY_LABEL_BUFLEN
125
+ VIR_SECURITY_MODEL_BUFLEN
126
+ VIR_SECURITY_DOI_BUFLEN
127
+ VIR_NODE_CPU_STATS_FIELD_LENGTH
128
+ VIR_NODE_CPU_STATS_KERNEL
129
+ VIR_NODE_CPU_STATS_USER
130
+ VIR_NODE_CPU_STATS_IDLE
131
+ VIR_NODE_CPU_STATS_IOWAIT
132
+ VIR_NODE_CPU_STATS_UTILIZATION
133
+ VIR_NODE_MEMORY_STATS_FIELD_LENGTH
134
+ VIR_NODE_MEMORY_STATS_TOTAL
135
+ VIR_NODE_MEMORY_STATS_FREE
136
+ VIR_NODE_MEMORY_STATS_BUFFERS
137
+ VIR_NODE_MEMORY_STATS_CACHED
138
+ VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH
139
+ VIR_DOMAIN_BLOCK_STATS_READ_BYTES
140
+ VIR_DOMAIN_BLOCK_STATS_READ_REQ
141
+ VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES
142
+ VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES
143
+ VIR_DOMAIN_BLOCK_STATS_WRITE_REQ
144
+ VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES
145
+ VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ
146
+ VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES
147
+ VIR_DOMAIN_BLOCK_STATS_ERRS
148
+ VIR_UUID_BUFLEN
149
+ LIBVIR_VERSION_NUMBER
150
+ VIR_DOMAIN_CPU_STATS_CPUTIME
151
+ VIR_DOMAIN_CPU_STATS_USERTIME
152
+ VIR_DOMAIN_CPU_STATS_SYSTEMTIME
153
+ VIR_DOMAIN_CPU_STATS_VCPUTIME
154
+ VIR_UNUSE_CPU
155
+ VIR_COPY_CPUMAP
156
+ VIR_GET_CPUMAP
157
+ VIR_DOMAIN_SEND_KEY_MAX_KEYS
158
+ VIR_DOMAIN_JOB_TIME_ELAPSED
159
+ VIR_DOMAIN_JOB_TIME_REMAINING
160
+ VIR_DOMAIN_JOB_DOWNTIME
161
+ VIR_DOMAIN_JOB_DATA_TOTAL
162
+ VIR_DOMAIN_JOB_DATA_PROCESSED
163
+ VIR_DOMAIN_JOB_DATA_REMAINING
164
+ VIR_DOMAIN_JOB_MEMORY_TOTAL
165
+ VIR_DOMAIN_JOB_MEMORY_PROCESSED
166
+ VIR_DOMAIN_JOB_MEMORY_REMAINING
167
+ VIR_DOMAIN_JOB_MEMORY_CONSTANT
168
+ VIR_DOMAIN_JOB_MEMORY_NORMAL
169
+ VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES
170
+ VIR_DOMAIN_JOB_DISK_TOTAL
171
+ VIR_DOMAIN_JOB_DISK_PROCESSED
172
+ VIR_DOMAIN_JOB_DISK_REMAINING
173
+ VIR_DOMAIN_JOB_COMPRESSION_CACHE
174
+ VIR_DOMAIN_JOB_COMPRESSION_BYTES
175
+ VIR_DOMAIN_JOB_COMPRESSION_PAGES
176
+ VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES
177
+ VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW
178
+ VIR_DOMAIN_SCHED_FIELD_LENGTH
179
+ VIR_DOMAIN_BLKIO_FIELD_LENGTH
180
+ VIR_DOMAIN_MEMORY_FIELD_LENGTH
181
+ virTypedParamsGet
182
+ virTypedParamsGetInt
183
+ virTypedParamsGetUInt
184
+ virTypedParamsGetLLong
185
+ virTypedParamsGetULLong
186
+ virTypedParamsGetDouble
187
+ virTypedParamsGetBoolean
188
+ virTypedParamsGetString
189
+ virTypedParamsAddInt
190
+ virTypedParamsAddUInt
191
+ virTypedParamsAddLLong
192
+ virTypedParamsAddULLong
193
+ virTypedParamsAddDouble
194
+ virTypedParamsAddBoolean
195
+ virTypedParamsAddString
196
+ virTypedParamsAddFromString
197
+ virTypedParamsClear
198
+ virConnectRef
199
+ virConnectRegisterCloseCallback
200
+ virConnectUnregisterCloseCallback
201
+ virDomainGetConnect
202
+ virDomainRef
203
+ virDomainRestoreFlags
204
+ virNetworkGetConnect
205
+ virNetworkRef
206
+ virInterfaceGetConnect
207
+ virInterfaceRef
208
+ virStoragePoolGetConnect
209
+ virStorageVolGetConnect
210
+ virStorageVolRef
211
+ virNodeDeviceRef
212
+ virSecretGetConnect
213
+ virSecretRef
214
+ virStreamRef
215
+ virDomainSnapshotGetDomain
216
+ virDomainSnapshotGetConnect
217
+ virDomainSnapshotRef
218
+ virNWFilterRef
219
+ VIR_DOMAIN_QEMU_AGENT_COMMAND_MIN
data/README.rdoc ADDED
@@ -0,0 +1,28 @@
1
+ = Ruby bindings for libvirt
2
+
3
+ The module Libvirt provides bindings to libvirt[http://libvirt.org]
4
+
5
+ The various *Ptr types in Libvirt map loosely to the following Ruby classes:
6
+
7
+ [virConnectPtr] Libvirt::Connect
8
+ [virNodeInfoPtr] Libvirt::Connect::Nodeinfo
9
+ [virSecurityModelPtr] Libvirt::Connect::NodeSecurityModel
10
+ [virDomainPtr] Libvirt::Domain
11
+ [virDomainInfoPtr] Libvirt::Domain::Info
12
+ [virDomainInterfaceStatsPtr] Libvirt::Domain::InterfaceInfo
13
+ [virSecurityLabelPtr] Libvirt::Domain::SecurityLabel
14
+ [virDomainBlockStatsPtr] Libvirt::Domain::BlockStats
15
+ [virDomainMemoryStatPtr] Libvirt::Domain::MemoryStats
16
+ [virDomainBlockInfoPtr] Libvirt::Domain::BlockInfo
17
+ [virDomainSnapshotPtr] Libvirt::Domain::Snapshot
18
+ [virDomainJobInfoPtr] Libvirt::Domain::JobInfo
19
+ [virNetworkPtr] Libvirt::Network
20
+ [virNWFilterPtr] Libvirt::NWFilter
21
+ [virNodeDevicePtr] Libvirt::NodeDevice
22
+ [virStoragePoolPtr] Libvirt::StoragePool
23
+ [virStoragePoolInfoPtr] Libvirt::StoragePoolInfo
24
+ [virStorageVolPtr] Libvirt::StorageVol
25
+ [virStorageVolInfoPtr] Libvirt::StorageVolInfo
26
+ [virSecretPtr] Libvirt::Secret
27
+ [virInterfacePtr] Libvirt::Interface
28
+ [virStreamPtr] Libvirt::Stream
data/Rakefile ADDED
@@ -0,0 +1,166 @@
1
+ # -*- ruby -*-
2
+ # Rakefile: build ruby libvirt bindings
3
+ #
4
+ # Copyright (C) 2007,2010 Red Hat, Inc.
5
+ # Copyright (C) 2013,2014 Chris Lalancette <clalancette@gmail.com>
6
+ #
7
+ # Distributed under the GNU Lesser General Public License v2.1 or later.
8
+ # See COPYING for details
9
+ #
10
+ # David Lutterkort <dlutter@redhat.com>
11
+
12
+ # Rakefile for ruby-rpm -*- ruby -*-
13
+ require 'rake/clean'
14
+ begin
15
+ require 'rdoc/task'
16
+ rescue LoadError
17
+ require 'rake/rdoctask'
18
+ end
19
+ require 'rake/testtask'
20
+ require 'rubygems/package_task'
21
+ require 'rbconfig'
22
+
23
+ PKG_NAME='ruby-libvirt'
24
+ PKG_VERSION='0.7.1'
25
+
26
+ EXT_CONF='ext/libvirt/extconf.rb'
27
+ MAKEFILE="ext/libvirt/Makefile"
28
+ LIBVIRT_MODULE="ext/libvirt/_libvirt.so"
29
+ SPEC_FILE="ruby-libvirt.spec"
30
+ LIBVIRT_SRC=Dir.glob("ext/libvirt/*.c")
31
+ LIBVIRT_SRC << MAKEFILE
32
+
33
+ #
34
+ # Additional files for clean/clobber
35
+ #
36
+
37
+ CLEAN.include [ "ext/**/*.o", LIBVIRT_MODULE, "ext/**/depend", "ext/**/*.gcda",
38
+ "ext/**/*.gcno", "ext/**/*.gcov" ]
39
+
40
+ CLOBBER.include [ "ext/**/mkmf.log", "ext/**/extconf.h", MAKEFILE ]
41
+
42
+ task :default => :build
43
+
44
+ #
45
+ # Build locally
46
+ #
47
+ file MAKEFILE => EXT_CONF do |t|
48
+ Dir::chdir(File::dirname(EXT_CONF)) do
49
+ extra = ""
50
+ args = ARGV.grep(/^--with-libvirt-include=/)
51
+ extra += args[0].chomp unless args.empty?
52
+ args = ARGV.grep(/^--with-libvirt-lib=/)
53
+ extra += " " + args[0].chomp unless args.empty?
54
+
55
+ unless sh "ruby #{File::basename(EXT_CONF)} #{extra}"
56
+ $stderr.puts "Failed to run extconf"
57
+ break
58
+ end
59
+ end
60
+ end
61
+ file LIBVIRT_MODULE => LIBVIRT_SRC do |t|
62
+ Dir::chdir(File::dirname(EXT_CONF)) do
63
+ unless sh "make"
64
+ $stderr.puts "make failed"
65
+ break
66
+ end
67
+ end
68
+ end
69
+ desc "Build the native library"
70
+ task :build => LIBVIRT_MODULE
71
+
72
+ #
73
+ # Test task
74
+ #
75
+
76
+ Rake::TestTask.new(:test) do |t|
77
+ t.test_files = [ 'tests/test_conn.rb', 'tests/test_domain.rb',
78
+ 'tests/test_interface.rb', 'tests/test_network.rb',
79
+ 'tests/test_nodedevice.rb', 'tests/test_nwfilter.rb',
80
+ 'tests/test_open.rb', 'tests/test_secret.rb',
81
+ 'tests/test_storage.rb', 'tests/test_stream.rb' ]
82
+ t.libs = [ 'lib', 'ext/libvirt' ]
83
+ end
84
+ task :test => :build
85
+
86
+ #
87
+ # Documentation tasks
88
+ #
89
+
90
+ RDOC_FILES = FileList[ "README.rdoc", "lib/libvirt.rb",
91
+ "ext/libvirt/_libvirt.c", "ext/libvirt/connect.c",
92
+ "ext/libvirt/domain.c", "ext/libvirt/interface.c",
93
+ "ext/libvirt/network.c", "ext/libvirt/nodedevice.c",
94
+ "ext/libvirt/nwfilter.c", "ext/libvirt/secret.c",
95
+ "ext/libvirt/storage.c", "ext/libvirt/stream.c" ]
96
+
97
+ Rake::RDocTask.new do |rd|
98
+ rd.main = "README.rdoc"
99
+ rd.rdoc_dir = "doc/site/api"
100
+ rd.rdoc_files.include(RDOC_FILES)
101
+ end
102
+
103
+ Rake::RDocTask.new(:ri) do |rd|
104
+ rd.main = "README.rdoc"
105
+ rd.rdoc_dir = "doc/ri"
106
+ rd.options << "--ri-system"
107
+ rd.rdoc_files.include(RDOC_FILES)
108
+ end
109
+
110
+ #
111
+ # Splint task
112
+ #
113
+
114
+ task :splint => [ MAKEFILE ] do |t|
115
+ Dir::chdir(File::dirname(EXT_CONF)) do
116
+ unless sh "splint -I" + Config::CONFIG['vendorarchdir'] + " *.c"
117
+ $stderr.puts "Failed to run splint"
118
+ break
119
+ end
120
+ end
121
+ end
122
+
123
+ #
124
+ # Package tasks
125
+ #
126
+
127
+ PKG_FILES = FileList[ "Rakefile", "COPYING", "README", "NEWS", "README.rdoc",
128
+ "lib/**/*.rb",
129
+ "ext/**/*.[ch]", "ext/**/MANIFEST", "ext/**/extconf.rb",
130
+ "tests/**/*",
131
+ "spec/**/*" ]
132
+
133
+ DIST_FILES = FileList[ "pkg/*.src.rpm", "pkg/*.gem", "pkg/*.zip",
134
+ "pkg/*.tgz" ]
135
+
136
+ SPEC = Gem::Specification.new do |s|
137
+ s.name = PKG_NAME
138
+ s.version = PKG_VERSION
139
+ s.email = "libvir-list@redhat.com"
140
+ s.homepage = "http://libvirt.org/ruby/"
141
+ s.summary = "Ruby bindings for LIBVIRT"
142
+ s.files = PKG_FILES
143
+ s.required_ruby_version = '>= 1.8.1'
144
+ s.extensions = "ext/libvirt/extconf.rb"
145
+ s.author = "David Lutterkort, Chris Lalancette"
146
+ s.rubyforge_project = "None"
147
+ s.description = "Ruby bindings for libvirt."
148
+ s.license = "LGPLv2"
149
+ end
150
+
151
+ Gem::PackageTask.new(SPEC) do |pkg|
152
+ pkg.need_tar = true
153
+ pkg.need_zip = true
154
+ end
155
+
156
+ desc "Build (S)RPM for #{PKG_NAME}"
157
+ task :rpm => [ :package ] do |t|
158
+ system("sed -e 's/@VERSION@/#{PKG_VERSION}/' #{SPEC_FILE} > pkg/#{SPEC_FILE}")
159
+ Dir::chdir("pkg") do |dir|
160
+ dir = File::expand_path(".")
161
+ system("rpmbuild --define '_topdir #{dir}' --define '_sourcedir #{dir}' --define '_srcrpmdir #{dir}' --define '_rpmdir #{dir}' --define '_builddir #{dir}' -ba #{SPEC_FILE} > rpmbuild.log 2>&1")
162
+ if $? != 0
163
+ raise "rpmbuild failed"
164
+ end
165
+ end
166
+ end