Debian Codegraph @

buildtools/make_vcpkg.php

raw symbols SCIP
1 <?php
2
3 /**
4 * Automatic CI process for generating new vcpkg releases.
5 * Based loosely on RealTimeChris's shell script version.
6 *
7 * This updates the content of ./vcpkg directory within the DPP
8 * repository on the master branch, which can then be diffed into
9 * the microsoft/vcpkg master branch to build a PR for the new
10 * release.
11 *
12 * The procedure for this is:
13 *
14 * 1) Generate various configuration files and put them into the
15 * systemwide vcpkg installation inside the CI container
16 * 2) Attempt to build the package from the release tag,
17 * this will fail due to invalid SHA512 sum and return the
18 * correct SHA512 sum in the error output. Inability to get the
19 * SHA512 sum here will return nonzero from the script, failing
20 * the CI action.
21 * 3) Capture the SHA512 from the error output, switch to master
22 * 4) Copy the correct configuration into both the systemwide
23 * vcpkg install in the container, and into the vcpkg directory
24 * of master branch.
25 * 5) Rerun the `vcpkg install` process again to verify it is working.
26 * A build failure here will return a nonzero return code from
27 * the script, failing the CI action.
28 */
29
30 require __DIR__ . '/vendor/autoload.php';
31 use Dpp\Packager\Vcpkg;
32
33 $vcpkg = new Vcpkg();
34
35 /* Check out source for latest tag */
36 if (!$vcpkg->checkoutRepository($vcpkg->getTag())) {
37 exit(1);
38 }
39
40 /* First run with SHA512 of 0 to gather actual value and save it */
41 $sha512 = $vcpkg->firstBuild(
42 $vcpkg->constructPortAndVersionFile()
43 );
44 if (!empty($sha512)) {
45 /* Now check out the latest tag or specified tag */
46 if (!$vcpkg->checkoutRepository(count($argv) > 2 && !empty($argv[3]) ? $argv[3] : "")) {
47 exit(1);
48 }
49
50 /* Attempt second build with the valid SHA512 sum. Program exit
51 * status is the exit status of `vcpkg install`
52 */
53 exit(
54 $vcpkg->secondBuild(
55 $vcpkg->constructPortAndVersionFile($sha512)
56 )
57 );
58
59 }
60
61 /* Error if no SHA sum could be generated */
62 exit(1);