Skip to content

Commit 4d15956

Browse files
committed
Add a message to vcpkg install where the licenses of the packages installed in this invocation are printed, and a separate license-report command that prints all information known in the installed tree.
1 parent 0875ad6 commit 4d15956

25 files changed

+409
-101
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: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "vcpkg-license-bsd-on-mit",
3+
"version": "0",
4+
"license": "BSD-3-Clause",
5+
"dependencies": [
6+
"vcpkg-license-mit"
7+
]
8+
}
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-license-bsd",
3+
"version": "0",
4+
"license": "BSD-3-Clause"
5+
}
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-license-mit",
3+
"version": "0",
4+
"license": "MIT"
5+
}
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-license-null",
3+
"version": "0",
4+
"license": null
5+
}

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,25 @@ if ($output -notmatch 'Trailing comma') {
5151
# Check for msgAlreadyInstalled vs. msgAlreadyInstalledNotHead
5252
$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3
5353
Throw-IfFailed
54-
if ($output -notmatch 'vcpkg-internal-e2e-test-port3:[^ ]+ is already installed') {
54+
if (-not $output -contains @"
55+
The following packages are already installed:
56+
vcpkg-internal-e2e-test-port3:
57+
"@) {
5558
throw 'Wrong already installed message'
5659
}
5760

5861
$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3 --head
5962
Throw-IfFailed
60-
if ($output -notmatch 'vcpkg-internal-e2e-test-port3:[^ ]+ is already installed -- not building from HEAD') {
63+
if (-not $output -contains @"
64+
The following packages are already installed, but were requested at --head version. Their installed contents will not be changed. To get updated versions, remove these packages first:
65+
vcpkg-internal-e2e-test-port3:
66+
"@) {
6167
throw 'Wrong already installed message for --head'
6268
}
6369

6470
Refresh-TestRoot
6571
$output = Run-VcpkgAndCaptureOutput @commonArgs --x-builtin-ports-root="$PSScriptRoot/../e2e-ports" install vcpkg-bad-spdx-license
6672
Throw-IfFailed
67-
$output = $output.Replace("`r`n", "`n")
6873
$expected = @"
6974
vcpkg.json: warning: $.license (an SPDX license expression): warning: Unknown license identifier 'BSD-new'. Known values are listed at https://spdx.org/licenses/
7075
on expression: BSD-new

azure-pipelines/end-to-end-tests-dir/ci-verify-versions.ps1

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
. "$PSScriptRoot/../end-to-end-tests-prelude.ps1"
22

3-
Refresh-TestRoot
43

54
Copy-Item -Recurse "$PSScriptRoot/../e2e-assets/ci-verify-versions-registry" "$TestingRoot/ci-verify-versions-registry"
65
git -C "$TestingRoot/ci-verify-versions-registry" @gitConfigOptions init
@@ -160,17 +159,12 @@ Throw-IfNotFailed
160159

161160
function Sanitize() {
162161
Param([string]$text)
163-
$workTreeRegex = 'error: failed to execute:[^\r\n]+' # Git command line has an unpredictable PID inside
164-
$text = $text.Replace('\', '/').Replace("`r`n", "`n").Trim()
162+
$workTreeRegex = 'error: failed to execute:[^\n]+' # Git command line has an unpredictable PID inside
163+
$text = $text.Replace('\', '/').Trim()
165164
$text = [System.Text.RegularExpressions.Regex]::Replace($text, $workTreeRegex, '')
166165
return $text
167166
}
168167

169168
$expected = Sanitize $expected
170169
$actual = Sanitize $actual
171-
if ($actual -ne $expected) {
172-
Set-Content -Value $expected -LiteralPath "$TestingRoot/expected.txt"
173-
Set-Content -Value $actual -LiteralPath "$TestingRoot/actual.txt"
174-
git diff --no-index -- "$TestingRoot/expected.txt" "$TestingRoot/actual.txt"
175-
throw "Bad x-ci-verify-versions output."
176-
}
170+
Throw-IfNonEqual -Expected $expected -Actual $actual

0 commit comments

Comments
 (0)