@@ -18,10 +18,10 @@ module fpm_downloader
1818contains
1919
2020 ! > 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 )
2222 character (* ), intent (in ) :: url
2323 type (version_t), allocatable , intent (in ) :: version
24- character (* ), intent (in ) :: tmp_pkg_data_file
24+ character (* ), intent (in ) :: tmp_pkg_file
2525 type (json_object), intent (out ) :: json
2626 type (error_t), allocatable , intent (out ) :: error
2727
@@ -31,14 +31,14 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
3131
3232 if (allocated (version)) then
3333 ! 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)
3535 else
3636 ! Request latest version.
37- call get_file(url, tmp_pkg_data_file , error)
37+ call get_file(url, tmp_pkg_file , error)
3838 end if
3939 if (allocated (error)) return
4040
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)
4242 if (allocated (j_error)) then
4343 allocate (error); call move_alloc(j_error% message, error% message); call json% destroy(); return
4444 end if
@@ -51,19 +51,19 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
5151 json = ptr
5252 end
5353
54- subroutine get_file (url , tmp_pkg_data_file , error )
54+ subroutine get_file (url , tmp_pkg_file , error )
5555 character (* ), intent (in ) :: url
56- character (* ), intent (in ) :: tmp_pkg_data_file
56+ character (* ), intent (in ) :: tmp_pkg_file
5757 type (error_t), allocatable , intent (out ) :: error
5858
5959 integer :: stat
6060
6161 if (which(' curl' ) /= ' ' ) then
6262 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)
6464 else if (which(' wget' ) /= ' ' ) then
6565 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)
6767 else
6868 call fatal_error(error, " Neither 'curl' nor 'wget' installed." ); return
6969 end if
@@ -73,8 +73,9 @@ subroutine get_file(url, tmp_pkg_data_file, error)
7373 end if
7474 end
7575
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
7879 character (* ), intent (in ) :: destination
7980 type (error_t), allocatable , intent (out ) :: error
8081
@@ -84,11 +85,11 @@ subroutine unpack(tmp_file, destination, error)
8485 call fatal_error(error, " 'tar' not installed." ); return
8586 end if
8687
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)
8990
9091 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
9293 end if
9394 end
9495end
0 commit comments