Skip to content

Commit 24bdea2

Browse files
committed
Merge branch 'metapackages' of https://github.com/perazz/fpm into metapackages
2 parents 6d6411c + f3f4d41 commit 24bdea2

20 files changed

+208
-156
lines changed

fpm.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name = "fpm"
2-
version = "0.8.1"
2+
version = "0.8.2"
33
license = "MIT"
44
author = "fpm maintainers"
55
maintainer = ""
6-
copyright = "2020 fpm contributors"
6+
copyright = "2020-2023 fpm contributors"
77

88
[preprocess]
99
[preprocess.cpp]

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ fi
7373

7474
LATEST_RELEASE=$(get_latest_release "fortran-lang/fpm" "$FETCH")
7575

76+
# Fallback to a latest known release if network timeout
7677
if [ -z "$LATEST_RELEASE" ]; then
77-
echo "Could not fetch the latest release from GitHub. Install curl or wget, and ensure network connectivity."
78-
exit 3
78+
LATEST_RELEASE="0.8.0"
7979
fi
8080

8181
SOURCE_URL="https://github.com/fortran-lang/fpm/releases/download/v${LATEST_RELEASE}/fpm-${LATEST_RELEASE}.F90"

src/fpm/cmd/publish.f90

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ module fpm_cmd_publish
88
use fpm_model, only: fpm_model_t
99
use fpm_error, only: error_t, fpm_stop
1010
use fpm_versioning, only: version_t
11-
use fpm_filesystem, only: exists, join_path, get_tmp_directory
12-
use fpm_git, only: git_archive, compressed_package_name
11+
use fpm_filesystem, only: exists, join_path, get_temp_filename
12+
use fpm_git, only: git_archive
1313
use fpm_downloader, only: downloader_t
1414
use fpm_strings, only: string_t
1515
use fpm_settings, only: official_registry_base_url
@@ -31,7 +31,7 @@ subroutine cmd_publish(settings)
3131
type(error_t), allocatable :: error
3232
type(version_t), allocatable :: version
3333
type(string_t), allocatable :: form_data(:)
34-
character(len=:), allocatable :: tmpdir
34+
character(len=:), allocatable :: tmp_file
3535
type(downloader_t) :: downloader
3636
integer :: i
3737

@@ -69,11 +69,10 @@ subroutine cmd_publish(settings)
6969

7070
if (allocated(settings%token)) form_data = [form_data, string_t('upload_token="'//settings%token//'"')]
7171

72-
call get_tmp_directory(tmpdir, error)
73-
if (allocated(error)) call fpm_stop(1, '*cmd_publish* Tmp directory error: '//error%message)
74-
call git_archive('.', tmpdir, error)
72+
tmp_file = get_temp_filename()
73+
call git_archive('.', tmp_file, error)
7574
if (allocated(error)) call fpm_stop(1, '*cmd_publish* Pack error: '//error%message)
76-
form_data = [form_data, string_t('tarball=@"'//join_path(tmpdir, compressed_package_name)//'"')]
75+
form_data = [form_data, string_t('tarball=@"'//tmp_file//'"')]
7776

7877
if (settings%show_form_data) then
7978
do i = 1, size(form_data)

src/fpm/dependency.f90

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -719,40 +719,45 @@ subroutine check_and_read_pkg_data(json, node, download_url, version, error)
719719

720720
integer :: code, stat
721721
type(json_object), pointer :: p, q
722-
character(:), allocatable :: version_key, version_str, error_message
722+
character(:), allocatable :: version_key, version_str, error_message, namespace, name
723+
724+
namespace = ""
725+
name = "UNNAMED_NODE"
726+
if (allocated(node%namespace)) namespace = node%namespace
727+
if (allocated(node%name)) name = node%name
723728

724729
if (.not. json%has_key('code')) then
725-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No status code."); return
730+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No status code."); return
726731
end if
727732

728733
call get_value(json, 'code', code, stat=stat)
729734
if (stat /= 0) then
730-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': "// &
735+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': "// &
731736
& "Failed to read status code."); return
732737
end if
733738

734739
if (code /= 200) then
735740
if (.not. json%has_key('message')) then
736-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No error message."); return
741+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No error message."); return
737742
end if
738743

739744
call get_value(json, 'message', error_message, stat=stat)
740745
if (stat /= 0) then
741-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': "// &
746+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': "// &
742747
& "Failed to read error message."); return
743748
end if
744749

745-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"'. Status code: '"// &
750+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"'. Status code: '"// &
746751
& str(code)//"'. Error message: '"//error_message//"'."); return
747752
end if
748753

749754
if (.not. json%has_key('data')) then
750-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No data."); return
755+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No data."); return
751756
end if
752757

753758
call get_value(json, 'data', p, stat=stat)
754759
if (stat /= 0) then
755-
call fatal_error(error, "Failed to read package data for '"//join_path(node%namespace, node%name)//"'."); return
760+
call fatal_error(error, "Failed to read package data for '"//join_path(namespace, name)//"'."); return
756761
end if
757762

758763
if (allocated(node%requested_version)) then
@@ -762,38 +767,38 @@ subroutine check_and_read_pkg_data(json, node, download_url, version, error)
762767
end if
763768

764769
if (.not. p%has_key(version_key)) then
765-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No version data."); return
770+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No version data."); return
766771
end if
767772

768773
call get_value(p, version_key, q, stat=stat)
769774
if (stat /= 0) then
770-
call fatal_error(error, "Failed to retrieve version data for '"//join_path(node%namespace, node%name)//"'."); return
775+
call fatal_error(error, "Failed to retrieve version data for '"//join_path(namespace, name)//"'."); return
771776
end if
772777

773778
if (.not. q%has_key('download_url')) then
774-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No download url."); return
779+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No download url."); return
775780
end if
776781

777782
call get_value(q, 'download_url', download_url, stat=stat)
778783
if (stat /= 0) then
779-
call fatal_error(error, "Failed to read download url for '"//join_path(node%namespace, node%name)//"'."); return
784+
call fatal_error(error, "Failed to read download url for '"//join_path(namespace, name)//"'."); return
780785
end if
781786

782787
download_url = official_registry_base_url//download_url
783788

784789
if (.not. q%has_key('version')) then
785-
call fatal_error(error, "Failed to download '"//join_path(node%namespace, node%name)//"': No version found."); return
790+
call fatal_error(error, "Failed to download '"//join_path(namespace, name)//"': No version found."); return
786791
end if
787792

788793
call get_value(q, 'version', version_str, stat=stat)
789794
if (stat /= 0) then
790-
call fatal_error(error, "Failed to read version data for '"//join_path(node%namespace, node%name)//"'."); return
795+
call fatal_error(error, "Failed to read version data for '"//join_path(namespace, name)//"'."); return
791796
end if
792797

793798
call new_version(version, version_str, error)
794799
if (allocated(error)) then
795800
call fatal_error(error, "'"//version_str//"' is not a valid version for '"// &
796-
& join_path(node%namespace, node%name)//"'."); return
801+
& join_path(namespace, name)//"'."); return
797802
end if
798803
end subroutine
799804

File renamed without changes.

src/fpm/git.f90

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module fpm_git
66

77
public :: git_target_t, git_target_default, git_target_branch, git_target_tag, git_target_revision, git_revision, &
88
& git_archive, git_matches_manifest, operator(==), compressed_package_name
9-
9+
1010
!> Name of the compressed package that is generated temporarily.
1111
character(len=*), parameter :: compressed_package_name = 'compressed_package'
1212

@@ -165,6 +165,8 @@ logical function git_matches_manifest(cached,manifest,verbosity,iunit)
165165
!> while the cached dependency always stores a commit hash because it's built
166166
!> after the repo is available (saved as git_descriptor%revision==revision).
167167
!> So, comparing against the descriptor is not reliable
168+
git_matches_manifest = allocated(cached%object) .eqv. allocated(manifest%object)
169+
if (git_matches_manifest .and. allocated(cached%object)) &
168170
git_matches_manifest = cached%object == manifest%object
169171
if (.not.git_matches_manifest) then
170172
if (verbosity>1) write(iunit,out_fmt) "GIT OBJECT has changed: ",cached%object," vs. ", manifest%object
@@ -326,8 +328,7 @@ subroutine git_archive(source, destination, error)
326328
call fatal_error(error, "Cannot find a suitable archive format for 'git archive'."); return
327329
end if
328330

329-
call execute_command_line('git archive HEAD --format='//archive_format//' -o '// &
330-
& join_path(destination, compressed_package_name), exitstat=stat)
331+
call execute_command_line('git archive HEAD --format='//archive_format//' -o '// destination, exitstat=stat)
331332
if (stat /= 0) then
332333
call fatal_error(error, "Error packing '"//source//"'."); return
333334
end if

src/fpm/manifest/dependency.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module fpm_manifest_dependency
2727
use fpm_git, only: git_target_t, git_target_tag, git_target_branch, &
2828
& git_target_revision, git_target_default, operator(==), git_matches_manifest
2929
use fpm_toml, only: toml_table, toml_key, toml_stat, get_value, check_keys
30-
use fpm_filesystem, only: windows_path
30+
use fpm_filesystem, only: windows_path, join_path
3131
use fpm_environment, only: get_os_type, OS_WINDOWS
3232
use fpm_manifest_metapackages, only: metapackage_config_t, is_meta_package, new_meta_config
3333
use fpm_versioning, only: version_t, new_version
@@ -95,7 +95,7 @@ subroutine new_dependency(self, table, root, error)
9595
call get_value(table, "path", uri)
9696
if (allocated(uri)) then
9797
if (get_os_type() == OS_WINDOWS) uri = windows_path(uri)
98-
if (present(root)) uri = root//uri ! Relative to the fpm.toml it’s written in
98+
if (present(root)) uri = join_path(root,uri) ! Relative to the fpm.toml it’s written in
9999
call move_alloc(uri, self%path)
100100
return
101101
end if

0 commit comments

Comments
 (0)