Skip to content

Commit

Permalink
Merge remote-tracking branch 'microsoft/master' into 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
daschuer committed Jul 31, 2021
2 parents 232d6cb + 261c458 commit 3f2bcb1
Show file tree
Hide file tree
Showing 1,707 changed files with 20,725 additions and 8,640 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/trustedPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Modelled after https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

name: Post PR Suggestions

on:
workflow_run:
workflows: ["PR Suggestions"]
types:
- completed

jobs:
comment:
runs-on: ubuntu-latest
if: >
${{ github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v3.1.0
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id }},
});
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr"
})[0];
var download = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
var fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data));
- run: unzip pr.zip

- uses: actions/github-script@v4
with:
script: |
const { promises: fs } = require('fs')
const event = (await fs.readFile('event', 'utf8')).trim()
const body = (await fs.readFile('body', 'utf8')).trim()
const issue_number = Number(await fs.readFile('./NR'));
var req = {
owner: context.repo.owner,
pull_number: issue_number,
repo: context.repo.repo,
event: event
};
if (body !== "") {
req.body = body;
}
await github.pulls.createReview(req);
98 changes: 98 additions & 0 deletions .github/workflows/untrustedPR.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Modelled after https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

# These "checks" are also performed as part of our critical-path azure-pipelines review,
# however here they are better able to post back to the original PR
name: PR Suggestions

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
# fetch-depth 2 ensures we capture both parents of the merge commit
fetch-depth: 2

- uses: actions/cache@v2
id: cache
with:
path: |
./vcpkg
key: ${{ runner.os }}-${{ hashFiles('scripts/bootstrap*') }}

- name: bootstrap
if: steps.cache.outputs.cache-hit != 'true'
run: ./bootstrap-vcpkg.sh

- name: Save PR number
run: |
mkdir -p ./pr
echo ${{ github.event.number }} > ./pr/NR
- name: Formatting
run: |
git config user.email github-actions
git config user.name github-actions@github.com
./vcpkg format-manifest ports/*/vcpkg.json
git diff > .github-pr.format-manifest
git add -u
git commit -m "tmp" --allow-empty
# HEAD^^ refers to the "main" commit that was merged into
git checkout HEAD^^ -- versions
git restore --staged versions
./vcpkg x-add-version --all --skip-formatting-check > .github-pr.x-add-version.out
git diff > .github-pr.x-add-version.diff
git reset HEAD~ --mixed
- uses: actions/github-script@v4
with:
script: |
const { promises: fs } = require('fs')
const add_version = (await fs.readFile('.github-pr.x-add-version.diff', 'utf8')).trim()
const add_version_out = (await fs.readFile('.github-pr.x-add-version.out', 'utf8')).trim()
const format = (await fs.readFile('.github-pr.format-manifest', 'utf8')).trim()
var output = ''
if (format !== "") {
output += "<details><summary><b>All manifest files must be formatted</b></summary>\n\n"
output += "`./vcpkg format-manifest ports/*/vcpkg.json`\n"
output += "<details><summary><b>Diff</b></summary>\n\n"
output += "```diff\n" + format + "\n```\n"
output += "</details></details>\n\n"
}
if (add_version_out !== "") {
output += "<details><summary><b>PRs must add only one version and must not modify any published versions</b></summary>\n\n"
output += "When making any changes to a library, the version or port-version in `vcpkg.json` or `CONTROL` must be modified.\n"
output += "```\n" + add_version_out + "\n```\n</details>\n"
}
if (add_version !== "") {
output += "<details><summary><b>After committing all other changes, the version database must be updated</b></summary>\n\n"
output += "```sh\n"
output += "git add -u && git commit\n"
output += "git checkout ${{ github.event.pull_request.base.sha }} -- versions\n"
output += "./vcpkg x-add-version --all\n"
output += "```\n"
output += "<details><summary><b>Diff</b></summary>\n\n"
output += "```diff\n" + add_version + "\n```\n"
output += "</details></details>\n\n"
}
if (output === "") {
await fs.writeFile("pr/event", "APPROVE")
} else {
output = "_This is a new experimental fast check for PR issues. Please let us know if this bot is helpful!_\n\n" + output
await fs.writeFile("pr/event", "REQUEST_CHANGES")
}
await fs.writeFile("pr/body", output)
console.log(output);
- uses: actions/upload-artifact@v2
with:
name: pr
path: pr/
16 changes: 15 additions & 1 deletion README_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,18 @@ Para instalar las librerías para su proyecto, ejecute:
$ ./vcpkg/vcpkg install [paquetes a instalar]
```

Nota: por defecto se instalarán las librerías x86, para instalar x64, ejecute:

```cmd
> .\vcpkg\vcpkg install [paquete a instalar]:x64-windows
```

O si desea instalar varios paquetes:

```cmd
> .\vcpkg\vcpkg install [paquetes a instalar] --triplet=x64-windows
```

También puede buscar las librerías que necesita con el subcomando `search`:

```sh
Expand Down Expand Up @@ -365,7 +377,9 @@ ver la [documentación](docs/README.md) para tutoriales específicos, incluyendo
[agregando un nuevo paquete desde un archivo comprimido](docs/examples/packaging-zipfiles.md),
[agregando un nuevo paquete desde un repositorio en GitHub](docs/examples/packaging-github-repos.md).

Nuestra documentación se encuentra online en ReadTheDocs: <https://vcpkg.readthedocs.io/>!
Nuestra documentación también esta disponible en nuestro sitio web [vcpkg.io](https://vcpkg.io/).
Si necesita ayuda puede [crear un incidente](https://github.com/vcpkg/vcpkg.github.io/issues).
¡Apreciamos cualquier retroalimentación!

Ver un [video de demostración](https://www.youtube.com/watch?v=y41WFKbQFTw) de 4 minutos.

Expand Down
2 changes: 1 addition & 1 deletion README_ko_KR.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ vcpkg 사용을 시작하는 방법은 [시작하기](#시작하기) 섹션을
- [Vcpkg: 개요 둘러보기](#vcpkg-개요)
- [목차](#목차)
- [시작하기](#시작하기)
- [빠르게 시작하기: 원도우](#빠르게-시작하기-원도우)
- [빠르게 시작하기: 윈도우](#빠르게-시작하기-윈도우)
- [빠르게 시작하기: 유닉스](#빠르게-시작하기-유닉스)
- [리눅스 개발자 도구 설치하기](#리눅스-개발자-도구-설치하기)
- [macOS 개발자 도구 설치하기](#macos-개발자-도구-설치하기)
Expand Down
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Vcpkg helps you manage C and C++ libraries on Windows, Linux and MacOS. This too
- [Common CMake definitions](maintainers/vcpkg_common_definitions.md)
- [Maintainer Guidelines](maintainers/maintainer-guide.md)
- [Creating Registries](maintainers/registries.md)
- [CMake Guidelines](maintainers/cmake-guidelines.md)

### [Vcpkg-Tool](https://github.com/microsoft/vcpkg-tool) Maintainer Help

Expand Down
27 changes: 15 additions & 12 deletions docs/examples/versioning.getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Create a folder with the following files:
"dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
"zlib"
],
"builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61"
"builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc"
}
```

Expand Down Expand Up @@ -69,8 +69,10 @@ PS D:\versions-test\build> cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/script
-- Running vcpkg install
Detecting compiler hash for triplet x86-windows...
The following packages will be built and installed:
fmt[core]:x86-windows -> 7.1.3 -- D:\vcpkg\buildtrees\versioning\versions\fmt\dd8cf5e1a2dce2680189a0744102d4b0f1cfb8b6
zlib[core]:x86-windows -> 1.2.11#9 -- D:\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
fmt[core]:x64-windows -> 7.1.3#1 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\fmt\4f8427eb0bd40da1856d4e67bde39a4fda689d72
vcpkg-cmake[core]:x64-windows -> 2021-02-26 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\vcpkg-cmake\51896aa8073adb5c8450daa423d03eedf0dfc61f
vcpkg-cmake-config[core]:x64-windows -> 2021-02-26 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\vcpkg-cmake-config\d255b3d566a8861dcc99a958240463e678528066
zlib[core]:x64-windows -> 1.2.11#9 -- D:\Work\viromer\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
...
```

Expand All @@ -90,7 +92,8 @@ zlib version is 1.2.11
Take a look at the output:

```
fmt[core]:x86-windows -> 7.1.3 -- D:\vcpkg\buildtrees\versioning\versions\fmt\dd8cf5e1a2dce2680189a0744102d4b0f1cfb8b6
fmt[core]:x86-windows -> 7.1.3#1 -- D:\vcpkg\buildtrees\versioning\versions\fmt\4f8427eb0bd40da1856d4e67bde39a4fda689d72
...
zlib[core]:x86-windows -> 1.2.11#9 -- D:\vcpkg\buildtrees\versioning\versions\zlib\827111046e37c98153d9d82bb6fa4183b6d728e4
```

Expand Down Expand Up @@ -130,23 +133,23 @@ Version scheme | Description
}
```

This property is used to express minimum version constraints, it is allowed only as part of the `"dependencies"` declarations. In our example we set an explicit constraint on version `7.1.3` of `fmt`.
This property is used to express minimum version constraints, it is allowed only as part of the `"dependencies"` declarations. In our example we set an explicit constraint on version `7.1.3#1` of `fmt`.

Vcpkg is allowed to upgrade this constraint if a transitive dependency requires a newer version. For example, if `zlib` were to declare a dependency on `fmt` version `7.1.4` then vcpkg would install `7.1.4` instead.

Vcpkg uses a minimum version approach, in our example, even if `fmt` version `8.0.0` were to be released, vcpkg would still install version `7.1.3` as that is the minimum version that satisfies the constraint. The advantages of this approach are that you don't get unexpected dependency upgrades when you update vcpkg and you get reproducible builds (in terms of version used) as long as you use the same manifest.
Vcpkg uses a minimum version approach, in our example, even if `fmt` version `8.0.0` were to be released, vcpkg would still install version `7.1.3#1` as that is the minimum version that satisfies the constraint. The advantages of this approach are that you don't get unexpected dependency upgrades when you update vcpkg and you get reproducible builds (in terms of version used) as long as you use the same manifest.

If you want to upgrade your dependencies, you can bump the minimum version constraint or use a newer baseline.

#### **`builtin-baseline`**

```json
{ "builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61" }
{ "builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc" }
```

This field declares the versioning baseline for all ports. Setting a baseline is required to enable versioning, otherwise you will get the current versions on the ports directory. You can run 'git rev-parse HEAD' to get the current commit of vcpkg and set it as the builtin-baseline. See the [`builtin-baseline` documentation](../users/versioning.md#builtin-baseline) for more information.

In our example, you can notice that we do not declare a version constraint for `zlib`; instead, the version is taken from the baseline. Internally, vcpkg will look in commit `b60f003ccf5fe8613d029f49f835c8929a66eb61` to find out what version of `zlib` was the latest at that point in time (in our case it was `1.2.11#9`).
In our example, you can notice that we do not declare a version constraint for `zlib`; instead, the version is taken from the baseline. Internally, vcpkg will look in commit `3426db05b996481ca31e95fff3734cf23e0f51bc` to find out what version of `zlib` was the latest at that point in time (in our case it was `1.2.11#9`).

During version resolution, baseline versions are treated as minimum version constraints. If you declare an explicit constraint that is lower than a baseline version, the explicit constraint will be upgraded to the baseline version.

Expand All @@ -155,7 +158,7 @@ For example, if we modified our dependencies like this:
{ "dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
{
"name": "zlib",
Expand Down Expand Up @@ -187,14 +190,14 @@ Let's modify our example once more, this time to force vcpkg to use version `6.0
"dependencies": [
{
"name": "fmt",
"version>=": "7.1.3"
"version>=": "7.1.3#1"
},
{
"name": "zlib",
"version>=": "1.2.11#7"
}
],
"builtin-baseline": "b60f003ccf5fe8613d029f49f835c8929a66eb61",
"builtin-baseline": "3426db05b996481ca31e95fff3734cf23e0f51bc",
"overrides": [
{
"name": "fmt",
Expand Down
Loading

0 comments on commit 3f2bcb1

Please sign in to comment.