ruby-libvirt 0.8.3 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cedabfb7ce30484b1ee1781d9c54eecc102f3a02ae4e8bb3939dc76048db072d
4
- data.tar.gz: a5bbc0558a140785b26f7687b3d155767f2813baa51271d7114ff7389761755d
3
+ metadata.gz: 39fda947f631865aa0b6f0583aad469746de1bde687a106f08e9cc40167bb78c
4
+ data.tar.gz: 010a9b66860d55d01ea1220a896a267151bb0c773261c37076101fb7dcae439e
5
5
  SHA512:
6
- metadata.gz: 61db9b3ab4593e7712a96bd740aaf2c4ef825605a6773038f679f120e62f08dc9052421fd0b1b67a98e3d34593f93ef90df7f3fdb09cc34174ba2ececd75062f
7
- data.tar.gz: 6d8821193b57518149efcda6d2a14c6eadc06895e7388f9b344ae28f56529e4ee70623fcea2fb70683e4541f15e4e72e5baa8071c17bf54cfb2c7273a1174d2e
6
+ metadata.gz: cc4db18a21728f16e913fd1f23a2b9de39c46e17a9936f72c4cf9d4da7d6f9051a95a55cb750504640e8bc9ba12055d4a505f441c73ccadb32024983dd326e67
7
+ data.tar.gz: cb461a77f74fe3a69ac5ae4e52ba46a2b2bbaebf759dd4b8301296842c378501e0e3801e506ffd9a0b4d14f560dabe9e7cd3e6c49d77d3b93083b19bff9cdfaa
data/NEWS.rst CHANGED
@@ -3,6 +3,12 @@ ruby-libvirt releases
3
3
  =====================
4
4
 
5
5
 
6
+ 0.8.4 (2024-08-01)
7
+ ==================
8
+
9
+ * Explicitly disallow use of ``new`` for wrapper classes
10
+
11
+
6
12
  0.8.3 (2024-05-13)
7
13
  ==================
8
14
 
data/Rakefile CHANGED
@@ -16,7 +16,7 @@ require 'rdoc/task'
16
16
  require 'rubygems/package_task'
17
17
 
18
18
  PKG_NAME='ruby-libvirt'
19
- PKG_VERSION='0.8.3'
19
+ PKG_VERSION='0.8.4'
20
20
 
21
21
  EXT_DIR = "ext/libvirt"
22
22
  EXTCONF = "#{EXT_DIR}/extconf.rb"
data/ext/libvirt/common.c CHANGED
@@ -491,3 +491,14 @@ int ruby_libvirt_get_maxcpus(virConnectPtr conn)
491
491
 
492
492
  return maxcpu;
493
493
  }
494
+
495
+ /* For classes where Ruby objects are just wrappers around C pointers,
496
+ * the only acceptable way to create new instances is to use
497
+ * Connect.create_domain_xml and similar. The use of Domain.new and
498
+ * friends is explicitly disallowed by providing this functions as
499
+ * implementation when defining the class
500
+ */
501
+ VALUE ruby_libvirt_new_not_allowed(int argc, VALUE *argv, VALUE obj)
502
+ {
503
+ rb_raise(rb_eTypeError, "Not allowed for this class");
504
+ }
data/ext/libvirt/common.h CHANGED
@@ -268,6 +268,8 @@ struct ruby_libvirt_str_new2_and_ary_store_arg {
268
268
  };
269
269
  VALUE ruby_libvirt_str_new2_and_ary_store_wrap(VALUE arg);
270
270
 
271
+ VALUE ruby_libvirt_new_not_allowed(int argc, VALUE *argv, VALUE obj);
272
+
271
273
  #ifndef RARRAY_LEN
272
274
  #define RARRAY_LEN(ar) (RARRAY(ar)->len)
273
275
  #endif
@@ -2742,6 +2742,8 @@ void ruby_libvirt_connect_init(void)
2742
2742
  {
2743
2743
  c_connect = rb_define_class_under(m_libvirt, "Connect", rb_cObject);
2744
2744
  rb_undef_alloc_func(c_connect);
2745
+ rb_define_singleton_method(c_connect, "new",
2746
+ ruby_libvirt_new_not_allowed, -1);
2745
2747
 
2746
2748
  /*
2747
2749
  * Class Libvirt::Connect::Nodeinfo
data/ext/libvirt/domain.c CHANGED
@@ -4064,6 +4064,8 @@ void ruby_libvirt_domain_init(void)
4064
4064
  {
4065
4065
  c_domain = rb_define_class_under(m_libvirt, "Domain", rb_cObject);
4066
4066
  rb_undef_alloc_func(c_domain);
4067
+ rb_define_singleton_method(c_domain, "new",
4068
+ ruby_libvirt_new_not_allowed, -1);
4067
4069
 
4068
4070
  rb_define_const(c_domain, "NOSTATE", INT2NUM(VIR_DOMAIN_NOSTATE));
4069
4071
  rb_define_const(c_domain, "RUNNING", INT2NUM(VIR_DOMAIN_RUNNING));
@@ -4390,6 +4392,8 @@ void ruby_libvirt_domain_init(void)
4390
4392
  */
4391
4393
  c_domain_snapshot = rb_define_class_under(c_domain, "Snapshot", rb_cObject);
4392
4394
  rb_undef_alloc_func(c_domain_snapshot);
4395
+ rb_define_singleton_method(c_domain_snapshot, "new",
4396
+ ruby_libvirt_new_not_allowed, -1);
4393
4397
 
4394
4398
  rb_define_const(c_domain_snapshot, "DELETE_CHILDREN",
4395
4399
  INT2NUM(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN));
@@ -1,9 +1,5 @@
1
1
  require 'mkmf'
2
2
 
3
- RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC']
4
- RbConfig::MAKEFILE_CONFIG['CCDLFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
5
- RbConfig::MAKEFILE_CONFIG['EXTDLDFLAGS'] = ENV['CFLAGS'] if ENV['CFLAGS']
6
-
7
3
  extension_name = '_libvirt'
8
4
 
9
5
  unless pkg_config("libvirt")
@@ -175,6 +175,8 @@ void ruby_libvirt_interface_init(void)
175
175
  {
176
176
  c_interface = rb_define_class_under(m_libvirt, "Interface", rb_cObject);
177
177
  rb_undef_alloc_func(c_interface);
178
+ rb_define_singleton_method(c_interface, "new",
179
+ ruby_libvirt_new_not_allowed, -1);
178
180
 
179
181
  rb_define_const(c_interface, "XML_INACTIVE",
180
182
  INT2NUM(VIR_INTERFACE_XML_INACTIVE));
@@ -330,6 +330,8 @@ void ruby_libvirt_network_init(void)
330
330
  {
331
331
  c_network = rb_define_class_under(m_libvirt, "Network", rb_cObject);
332
332
  rb_undef_alloc_func(c_network);
333
+ rb_define_singleton_method(c_network, "new",
334
+ ruby_libvirt_new_not_allowed, -1);
333
335
 
334
336
  rb_define_attr(c_network, "connection", 1, 0);
335
337
 
@@ -261,6 +261,8 @@ void ruby_libvirt_nodedevice_init(void)
261
261
  {
262
262
  c_nodedevice = rb_define_class_under(m_libvirt, "NodeDevice", rb_cObject);
263
263
  rb_undef_alloc_func(c_nodedevice);
264
+ rb_define_singleton_method(c_nodedevice, "new",
265
+ ruby_libvirt_new_not_allowed, -1);
264
266
 
265
267
  rb_define_attr(c_nodedevice, "connection", 1, 0);
266
268
 
@@ -124,6 +124,8 @@ void ruby_libvirt_nwfilter_init(void)
124
124
  {
125
125
  c_nwfilter = rb_define_class_under(m_libvirt, "NWFilter", rb_cObject);
126
126
  rb_undef_alloc_func(c_nwfilter);
127
+ rb_define_singleton_method(c_nwfilter, "new",
128
+ ruby_libvirt_new_not_allowed, -1);
127
129
 
128
130
  rb_define_attr(c_nwfilter, "connection", 1, 0);
129
131
 
data/ext/libvirt/secret.c CHANGED
@@ -231,6 +231,8 @@ void ruby_libvirt_secret_init(void)
231
231
  {
232
232
  c_secret = rb_define_class_under(m_libvirt, "Secret", rb_cObject);
233
233
  rb_undef_alloc_func(c_secret);
234
+ rb_define_singleton_method(c_secret, "new",
235
+ ruby_libvirt_new_not_allowed, -1);
234
236
 
235
237
  rb_define_attr(c_secret, "connection", 1, 0);
236
238
 
@@ -753,6 +753,8 @@ void ruby_libvirt_storage_init(void)
753
753
  c_storage_pool = rb_define_class_under(m_libvirt, "StoragePool",
754
754
  rb_cObject);
755
755
  rb_undef_alloc_func(c_storage_pool);
756
+ rb_define_singleton_method(c_storage_pool, "new",
757
+ ruby_libvirt_new_not_allowed, -1);
756
758
 
757
759
  rb_define_attr(c_storage_pool, "connection", 1, 0);
758
760
 
@@ -866,6 +868,8 @@ void ruby_libvirt_storage_init(void)
866
868
  c_storage_vol = rb_define_class_under(m_libvirt, "StorageVol",
867
869
  rb_cObject);
868
870
  rb_undef_alloc_func(c_storage_vol);
871
+ rb_define_singleton_method(c_storage_vol, "new",
872
+ ruby_libvirt_new_not_allowed, -1);
869
873
 
870
874
  rb_define_const(c_storage_vol, "XML_INACTIVE",
871
875
  INT2NUM(VIR_STORAGE_XML_INACTIVE));
data/ext/libvirt/stream.c CHANGED
@@ -361,6 +361,8 @@ void ruby_libvirt_stream_init(void)
361
361
  {
362
362
  c_stream = rb_define_class_under(m_libvirt, "Stream", rb_cObject);
363
363
  rb_undef_alloc_func(c_stream);
364
+ rb_define_singleton_method(c_stream, "new",
365
+ ruby_libvirt_new_not_allowed, -1);
364
366
 
365
367
  rb_define_attr(c_stream, "connection", 1, 0);
366
368
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-libvirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Lutterkort
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-13 00:00:00.000000000 Z
12
+ date: 2024-08-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: |
15
15
  ruby-libvirt allows applications written in Ruby to use the