Skip to content

Commit 33fe38d

Browse files
authored
Fix doubled warnings being printed for manifest warnings when loading ports. (#1466)
1 parent cfa00f4 commit 33fe38d

29 files changed

+164
-169
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "vcpkg-bad-spdx-license",
3+
"version": "1",
4+
"license": "BSD-new"
5+
}

azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,19 @@ Throw-IfFailed
6060
if ($output -notmatch 'vcpkg-internal-e2e-test-port3:[^ ]+ is already installed -- not building from HEAD') {
6161
throw 'Wrong already installed message for --head'
6262
}
63+
64+
Refresh-TestRoot
65+
$output = Run-VcpkgAndCaptureOutput @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports" install vcpkg-bad-spdx-license
66+
Throw-IfFailed
67+
$output = $output.Replace("`r`n", "`n")
68+
$expected = @"
69+
vcpkg.json: warning: $.license (an SPDX license expression): warning: Unknown license identifier 'BSD-new'. Known values are listed at https://spdx.org/licenses/
70+
on expression: BSD-new
71+
^
72+
"@
73+
$firstMatch = $output.IndexOf($expected)
74+
if ($firstMatch -lt 0) {
75+
throw 'Did not detect expected bad license'
76+
} elseif ($output.IndexOf($expected, $firstMatch + 1) -ge 0) {
77+
throw 'Duplicated bad license'
78+
}

include/vcpkg/base/message-data.inc.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,10 +3033,6 @@ DECLARE_MESSAGE(VersionMissingRequiredFeature,
30333033
(msg::version_spec, msg::feature, msg::constraint_origin),
30343034
"",
30353035
"{version_spec} does not have required feature {feature} needed by {constraint_origin}")
3036-
DECLARE_MESSAGE(VersionNotFound,
3037-
(msg::expected, msg::actual),
3038-
"{expected} and {actual} are versions",
3039-
"{expected} not available, only {actual} is available")
30403036
DECLARE_MESSAGE(VersionNotFoundInVersionsFile2,
30413037
(msg::version_spec),
30423038
"",

include/vcpkg/metrics.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace vcpkg
3737
VcpkgDefaultBinaryCache,
3838
VcpkgNugetRepository,
3939
VersioningErrorBaseline,
40-
VersioningErrorVersion,
40+
VersioningErrorVersion, // no longer used
4141
X_VcpkgRegistriesCache,
4242
X_WriteNugetPackagesConfig,
4343
COUNT // always keep COUNT last

include/vcpkg/paragraphs.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,8 @@ namespace vcpkg::Paragraphs
5858
std::vector<std::pair<std::string, LocalizedString>> errors;
5959
};
6060

61-
LoadResults try_load_all_registry_ports(const ReadOnlyFilesystem& fs, const RegistrySet& registries);
62-
63-
std::vector<SourceControlFileAndLocation> load_all_registry_ports(const ReadOnlyFilesystem& fs,
64-
const RegistrySet& registries);
61+
LoadResults try_load_all_registry_ports(const RegistrySet& registries);
62+
std::vector<SourceControlFileAndLocation> load_all_registry_ports(const RegistrySet& registries);
6563

6664
LoadResults try_load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir);
6765
std::vector<SourceControlFileAndLocation> load_overlay_ports(const ReadOnlyFilesystem& fs, const Path& dir);

include/vcpkg/portfileprovider.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ namespace vcpkg
6363

6464
struct PathsPortFileProvider : PortFileProvider
6565
{
66-
explicit PathsPortFileProvider(const ReadOnlyFilesystem& fs,
67-
const RegistrySet& registry_set,
66+
explicit PathsPortFileProvider(const RegistrySet& registry_set,
6867
std::unique_ptr<IFullOverlayProvider>&& overlay);
6968
ExpectedL<const SourceControlFileAndLocation&> get_control_file(const std::string& src_name) const override;
7069
std::vector<const SourceControlFileAndLocation*> load_all_control_files() const override;
@@ -76,8 +75,7 @@ namespace vcpkg
7675
};
7776

7877
std::unique_ptr<IBaselineProvider> make_baseline_provider(const RegistrySet& registry_set);
79-
std::unique_ptr<IFullVersionedPortfileProvider> make_versioned_portfile_provider(const ReadOnlyFilesystem& fs,
80-
const RegistrySet& registry_set);
78+
std::unique_ptr<IFullVersionedPortfileProvider> make_versioned_portfile_provider(const RegistrySet& registry_set);
8179
std::unique_ptr<IFullOverlayProvider> make_overlay_provider(const ReadOnlyFilesystem& fs,
8280
const Path& original_cwd,
8381
View<std::string> overlay_ports);

include/vcpkg/registries.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace vcpkg
5858
{
5959
virtual ExpectedL<View<Version>> get_port_versions() const = 0;
6060

61-
virtual ExpectedL<PortLocation> get_version(const Version& version) const = 0;
61+
virtual ExpectedL<SourceControlFileAndLocation> try_load_port(const Version& version) const = 0;
6262

6363
virtual ~RegistryEntry() = default;
6464
};

include/vcpkg/sourceparagraph.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,17 @@ namespace vcpkg
210210
VersionSpec to_version_spec() const { return source_control_file->to_version_spec(); }
211211
Path port_directory() const { return control_path.parent_path(); }
212212

213+
SourceControlFileAndLocation clone() const
214+
{
215+
std::unique_ptr<SourceControlFile> scf;
216+
if (source_control_file)
217+
{
218+
scf = std::make_unique<SourceControlFile>(source_control_file->clone());
219+
}
220+
221+
return SourceControlFileAndLocation{std::move(scf), control_path, spdx_location};
222+
}
223+
213224
std::unique_ptr<SourceControlFile> source_control_file;
214225
Path control_path;
215226

locales/messages.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,8 +1613,6 @@
16131613
"_VersionMissing.comment": "The names version, version-date, version-semver, and version-string are code and must not be localized",
16141614
"VersionMissingRequiredFeature": "{version_spec} does not have required feature {feature} needed by {constraint_origin}",
16151615
"_VersionMissingRequiredFeature.comment": "An example of {version_spec} is zlib:[email protected]. An example of {feature} is avisynthplus. An example of {constraint_origin} is zlib:[email protected].",
1616-
"VersionNotFound": "{expected} not available, only {actual} is available",
1617-
"_VersionNotFound.comment": "{expected} and {actual} are versions",
16181616
"VersionNotFoundInVersionsFile2": "{version_spec} was not found in versions database",
16191617
"_VersionNotFoundInVersionsFile2.comment": "An example of {version_spec} is zlib:[email protected].",
16201618
"VersionNotFoundInVersionsFile3": "the version should be in this file",

0 commit comments

Comments
 (0)