[pve-devel] [PATCH client] fix make issue

Oguz Bektas o.bektas at proxmox.com
Thu Jun 27 14:15:30 CEST 2019


fixes an issue where the pve-api-definition.dat file needs to be
installed in order to be able to build the package.

remedy this by checking the current directory if file does not exist

Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
---
 PVE/APIClient/Helpers.pm | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/PVE/APIClient/Helpers.pm b/PVE/APIClient/Helpers.pm
index 3429f4d..b677d49 100644
--- a/PVE/APIClient/Helpers.pm
+++ b/PVE/APIClient/Helpers.pm
@@ -6,6 +6,7 @@ use warnings;
 use Storable;
 use JSON;
 use File::Path qw(make_path);
+use Cwd qw(getcwd);
 
 use PVE::APIClient::JSONSchema;
 use PVE::APIClient::Exception qw(raise);
@@ -18,7 +19,8 @@ use HTTP::Status qw(:constants);
 
 my $pve_api_definition;
 
-my $pve_api_definition_fn = "/usr/share/pve-client/pve-api-definition.dat";
+my $pve_api_definition_fn = "pve-api-definition.dat";
+my $pve_api_definition_path = "/usr/share/pve-client/$pve_api_definition_fn";
 
 our $method_map = {
     create => 'POST',
@@ -71,9 +73,14 @@ my $remove_unknown_formats; $remove_unknown_formats = sub {
 
 sub get_api_definition {
 
+    my $dir = getcwd;
+
     if (!defined($pve_api_definition)) {
-	open(my $fh, '<',  $pve_api_definition_fn) ||
-	    die "unable to open '$pve_api_definition_fn' - $!\n";
+	my $fh;
+	open($fh, '<',  $pve_api_definition_path) ||
+	open($fh, '<', "$dir/$pve_api_definition_fn") ||
+	    die "unable to open '$pve_api_definition_path'" .
+		"or '$dir/$pve_api_definition_fn' - $!\n";
 	$pve_api_definition = Storable::fd_retrieve($fh);
 
 	$remove_unknown_formats->($pve_api_definition);
-- 
2.11.0





More information about the pve-devel mailing list