@@ -18,10 +18,10 @@ module fpm_downloader
18
18
contains
19
19
20
20
! > Perform an http get request and save output to file.
21
- subroutine get_pkg_data (url , version , tmp_pkg_data_file , json , error )
21
+ subroutine get_pkg_data (url , version , tmp_pkg_file , json , error )
22
22
character (* ), intent (in ) :: url
23
23
type (version_t), allocatable , intent (in ) :: version
24
- character (* ), intent (in ) :: tmp_pkg_data_file
24
+ character (* ), intent (in ) :: tmp_pkg_file
25
25
type (json_object), intent (out ) :: json
26
26
type (error_t), allocatable , intent (out ) :: error
27
27
@@ -31,14 +31,14 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
31
31
32
32
if (allocated (version)) then
33
33
! Request specific version.
34
- call get_file(url// ' /' // version% s(), tmp_pkg_data_file , error)
34
+ call get_file(url// ' /' // version% s(), tmp_pkg_file , error)
35
35
else
36
36
! Request latest version.
37
- call get_file(url, tmp_pkg_data_file , error)
37
+ call get_file(url, tmp_pkg_file , error)
38
38
end if
39
39
if (allocated (error)) return
40
40
41
- call json_load(j_value, tmp_pkg_data_file , error= j_error)
41
+ call json_load(j_value, tmp_pkg_file , error= j_error)
42
42
if (allocated (j_error)) then
43
43
allocate (error); call move_alloc(j_error% message, error% message); call json% destroy(); return
44
44
end if
@@ -51,19 +51,19 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
51
51
json = ptr
52
52
end
53
53
54
- subroutine get_file (url , tmp_pkg_data_file , error )
54
+ subroutine get_file (url , tmp_pkg_file , error )
55
55
character (* ), intent (in ) :: url
56
- character (* ), intent (in ) :: tmp_pkg_data_file
56
+ character (* ), intent (in ) :: tmp_pkg_file
57
57
type (error_t), allocatable , intent (out ) :: error
58
58
59
59
integer :: stat
60
60
61
61
if (which(' curl' ) /= ' ' ) then
62
62
print * , " Downloading package data from '" // url// " ' ..."
63
- call execute_command_line(' curl ' // url// ' -s -o ' // tmp_pkg_data_file , exitstat= stat)
63
+ call execute_command_line(' curl ' // url// ' -s -o ' // tmp_pkg_file , exitstat= stat)
64
64
else if (which(' wget' ) /= ' ' ) then
65
65
print * , " Downloading package data from '" // url// " ' ..."
66
- call execute_command_line(' wget ' // url// ' -q -O ' // tmp_pkg_data_file , exitstat= stat)
66
+ call execute_command_line(' wget ' // url// ' -q -O ' // tmp_pkg_file , exitstat= stat)
67
67
else
68
68
call fatal_error(error, " Neither 'curl' nor 'wget' installed." ); return
69
69
end if
@@ -73,8 +73,9 @@ subroutine get_file(url, tmp_pkg_data_file, error)
73
73
end if
74
74
end
75
75
76
- subroutine unpack (tmp_file , destination , error )
77
- character (* ), intent (in ) :: tmp_file
76
+ ! > Unpack a tarball to a destination.
77
+ subroutine unpack (tmp_pkg_file , destination , error )
78
+ character (* ), intent (in ) :: tmp_pkg_file
78
79
character (* ), intent (in ) :: destination
79
80
type (error_t), allocatable , intent (out ) :: error
80
81
@@ -84,11 +85,11 @@ subroutine unpack(tmp_file, destination, error)
84
85
call fatal_error(error, " 'tar' not installed." ); return
85
86
end if
86
87
87
- print * , " Unpacking '" // tmp_file // " ' to '" // destination// " ' ..."
88
- call execute_command_line(' tar -zxf ' // tmp_file // ' -C ' // destination, exitstat= stat)
88
+ print * , " Unpacking '" // tmp_pkg_file // " ' to '" // destination// " ' ..."
89
+ call execute_command_line(' tar -zxf ' // tmp_pkg_file // ' -C ' // destination, exitstat= stat)
89
90
90
91
if (stat /= 0 ) then
91
- call fatal_error(error, " Error unpacking '" // tmp_file // " '." ); return
92
+ call fatal_error(error, " Error unpacking '" // tmp_pkg_file // " '." ); return
92
93
end if
93
94
end
94
95
end
0 commit comments