ovirt-engine-sdk 4.0.1 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/ruby
2
2
 
3
3
  #
4
- # Copyright (c) 2015-2016 Red Hat, Inc.
4
+ # Copyright (c) 2015-2017 Red Hat, Inc.
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
@@ -18,11 +18,37 @@
18
18
 
19
19
  require 'mkmf'
20
20
 
21
- # Check that "libxml2" is available:
22
- unless find_executable('xml2-config')
21
+ # Check if "libxml2" is available:
22
+ xml2_config = find_executable('xml2-config')
23
+ if xml2_config
24
+ cflags = `#{xml2_config} --cflags`.strip
25
+ libs = `#{xml2_config} --libs`.strip
26
+ $CPPFLAGS = "#{cflags} #{$CPPFLAGS}"
27
+ $LDFLAGS = "#{libs} #{$LDFLAGS}"
28
+ elsif !pkg_config('libxml2')
23
29
  raise 'The "libxml2" package isn\'t available.'
24
30
  end
25
- $CPPFLAGS = "#{`xml2-config --cflags`.strip} #{$CPPFLAGS}"
26
- $LDFLAGS = "#{`xml2-config --libs`.strip} #{$LDFLAGS}"
27
31
 
32
+ # Check if "libcurl" is available:
33
+ curl_config = find_executable('curl-config')
34
+ if curl_config
35
+ cflags = `#{curl_config} --cflags`.strip
36
+ libs = `#{curl_config} --libs`.strip
37
+ $CPPFLAGS = "#{cflags} #{$CPPFLAGS}"
38
+ $LDFLAGS = "#{libs} #{$LDFLAGS}"
39
+ elsif !pkg_config('libcurl')
40
+ raise 'The "libcurl" package isn\'t available.'
41
+ end
42
+
43
+ # When installing the SDK as a plugin in Vagrant there is an issue with
44
+ # some versions of Vagrant that embed "libxml2" and "libcurl", but using
45
+ # an incorrect directory. To avoid that we need to explicitly fix the
46
+ # Vagrant path.
47
+ def fix_vagrant_prefix(flags)
48
+ flags.gsub!('/vagrant-substrate/staging', '/opt/vagrant')
49
+ end
50
+ fix_vagrant_prefix($CPPFLAGS)
51
+ fix_vagrant_prefix($LDFLAGS)
52
+
53
+ # Create the Makefile:
28
54
  create_makefile 'ovirtsdk4c'
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (c) 2015-2016 Red Hat, Inc.
2
+ Copyright (c) 2015-2017 Red Hat, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -19,9 +19,16 @@ limitations under the License.
19
19
  #include "ov_module.h"
20
20
  #include "ov_error.h"
21
21
 
22
- /* Class: */
22
+ /* Classes: */
23
23
  VALUE ov_error_class;
24
+ VALUE ov_connection_error_class;
25
+ VALUE ov_timeout_error_class;
24
26
 
25
27
  void ov_error_define(void) {
28
+ /* Define the base error class: */
26
29
  ov_error_class = rb_define_class_under(ov_module, "Error", rb_eStandardError);
30
+
31
+ /* Define the specialized error classes: */
32
+ ov_connection_error_class = rb_define_class_under(ov_module, "ConnectionError", ov_error_class);
33
+ ov_timeout_error_class = rb_define_class_under(ov_module, "TimeoutError", ov_error_class);
27
34
  }
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright (c) 2015-2016 Red Hat, Inc.
2
+ Copyright (c) 2015-2017 Red Hat, Inc.
3
3
 
4
4
  Licensed under the Apache License, Version 2.0 (the "License");
5
5
  you may not use this file except in compliance with the License.
@@ -19,6 +19,8 @@ limitations under the License.
19
19
 
20
20
  // Classes:
21
21
  extern VALUE ov_error_class;
22
+ extern VALUE ov_connection_error_class;
23
+ extern VALUE ov_timeout_error_class;
22
24
 
23
25
  // Initialization function:
24
26
  extern void ov_error_define(void);