feat(install): write UDIF/DMG-style containers
This commit is contained in:
1 parent
ac08887d8f
commit
1caeab70fa
7 files changed
+213
-4
No files matched your search
@@ -366,6 +366,9 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
|||||||
|
|
||||||
- **Wave 136 (Parallel Worker Drain)**: `vbs worker --queue --parallel N` (1..32) runs N concurrent lease/execute loops in one process; the registry leases each queued action to exactly one worker, so actions are never duplicated. `RegistryTests.worker_parallel_drains_queue_without_duplicates` drains two slow actions with two loops, asserting both started exactly once, overlapped in time, and the queue ended empty.
|
- **Wave 136 (Parallel Worker Drain)**: `vbs worker --queue --parallel N` (1..32) runs N concurrent lease/execute loops in one process; the registry leases each queued action to exactly one worker, so actions are never duplicated. `RegistryTests.worker_parallel_drains_queue_without_duplicates` drains two slow actions with two loops, asserting both started exactly once, overlapped in time, and the queue ended empty.
|
||||||
|
|
||||||
|
- **Wave 137 (UDIF/DMG-Style Packaging)**: `vbs install --archive FILE --archive-format dmg` writes a UDIF container - the deterministic tar payload followed by a 512-byte `koly` trailer with CRC-32 data/master checksums, segment ID, image variant and sector count. Validated independently: Python's `zlib.crc32` matches the stored checksum and the payload is a valid tar. A mountable macOS image still needs an HFS+/APFS payload writer (macOS-only).
|
||||||
|
- **Wave 138 (Full CMake File API Reply Set)**: `vbs ide generate` now emits `cmakeFiles-v1` (configure inputs/outputs), `toolchains-v1` (C/CXX compiler identity) and `cache-v2` (build type, compilers, generator, profile) beside `codemodel-v2`, so CMake-aware IDEs (CLion, VS Code CMake Tools) get the complete reply set.
|
||||||
|
|
||||||
## Remaining future scope
|
## Remaining future scope
|
||||||
|
|
||||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||||
|
|||||||
@@ -137,4 +137,6 @@ Base HEAD: `fe0d1a6`
|
|||||||
| Wave 134 (CDash reporting) | `Report::Cdash` Test.xml + multipart submission; `vbs test --cdash/--cdash-project/--cdash-build/--cdash-output` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E captures the submission, full CTest 8/8) | `src/Report/Cdash.cpp`, `include/Void/Build/Report/Cdash.hpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
| Wave 134 (CDash reporting) | `Report::Cdash` Test.xml + multipart submission; `vbs test --cdash/--cdash-project/--cdash-build/--cdash-output` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E captures the submission, full CTest 8/8) | `src/Report/Cdash.cpp`, `include/Void/Build/Report/Cdash.hpp`, `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
||||||
| Wave 135 (Remote action execution) | Worker fetches input blobs, executes the CAS action spec, stores outputs and submits the result; `--exec-timeout` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
| Wave 135 (Remote action execution) | Worker fetches input blobs, executes the CAS action spec, stores outputs and submits the result; `--exec-timeout` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E passes, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
||||||
| Wave 136 (Parallel worker drain) | `--parallel N` lease/execute loops; exclusive registry leases prevent duplicates | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E proves overlap and no duplicates, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
| Wave 136 (Parallel worker drain) | `--parallel N` lease/execute loops; exclusive registry leases prevent duplicates | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; E2E proves overlap and no duplicates, full CTest 8/8) | `src/Main.cpp`, `tests/RegistryTests.cpp`, docs |
|
||||||
|
| Wave 137 (UDIF/DMG-style packaging) | `--archive-format dmg`: tar payload + koly trailer with CRC-32 | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; trailer parsed and CRC matches zlib, install test passes, full CTest 8/8) | `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
|
| Wave 138 (Full CMake File API) | `cmakeFiles-v1`, `toolchains-v1`, `cache-v2` replies | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; IDE E2E passes, full CTest 8/8) | `src/Editor/CompDb.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
|
||||||
@@ -1796,6 +1796,23 @@ VOID_INCLUDE_DIR=/tmp/opencode/vl-pin/include dev cpp -c bash fuzz/run.sh 30
|
|||||||
overlapped (real concurrency), and `GET /api/v1/queue` reported `"pending":[]` afterwards.
|
overlapped (real concurrency), and `GET /api/v1/queue` reported `"pending":[]` afterwards.
|
||||||
- Full CTest: **8 / 8 passed** in 303.93 s.
|
- Full CTest: **8 / 8 passed** in 303.93 s.
|
||||||
|
|
||||||
|
## UDIF/DMG-Style Packaging (GCC 16.2, pin `0002e74`)
|
||||||
|
|
||||||
|
- `vbs install --archive demo.dmg --archive-format dmg` produced a 4608-byte file: 4096-byte tar
|
||||||
|
payload + 512-byte koly trailer.
|
||||||
|
- Independent Python parse: `koly`, version 4, header 512, `dataForkLength == file-512`,
|
||||||
|
checksum type 2 with stored `0x5e980f1f` equal to `zlib.crc32(payload)`, sector count 8,
|
||||||
|
and `ustar` at offset 257 of the payload.
|
||||||
|
- The install test asserts the same trailer fields and recomputes the CRC in C++ (**passed**,
|
||||||
|
6.31 s); full CTest **8 / 8** in 308.02 s.
|
||||||
|
- Not mountable on macOS yet: DiskImageMounter needs an HFS+/APFS payload (macOS-only work).
|
||||||
|
|
||||||
|
## Full CMake File API Reply Set (GCC 16.2, pin `0002e74`)
|
||||||
|
|
||||||
|
- The reply index now references `codemodel-v2`, `cache-v2`, `cmakeFiles-v1` and `toolchains-v1`
|
||||||
|
(plus per-target and per-directory files), each parsed back and asserted in
|
||||||
|
`ide_integration_compdb_build_cpp_and_editor_configs_end_to_end` (**passed**, 3.12 s).
|
||||||
|
|
||||||
## Limits and Unrun Checks
|
## Limits and Unrun Checks
|
||||||
|
|
||||||
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ Concrete work this implies:
|
|||||||
| Languages | C, C++, CUDA, Fortran, ObjC, ASM, HIP… | C, C++, Rust, D, Fortran, Java… | C/C++ focused | C, C++ | ASM/CUDA/ObjC or a documented extension API |
|
| Languages | C, C++, CUDA, Fortran, ObjC, ASM, HIP… | C, C++, Rust, D, Fortran, Java… | C/C++ focused | C, C++ | ASM/CUDA/ObjC or a documented extension API |
|
||||||
| Toolchains | MSVC, clang-cl, GCC, Clang, Apple, many | GCC, Clang, MSVC, many | GCC, Clang, MSVC | GCC, Clang (Linux) | MinGW target; MSVC deferred |
|
| Toolchains | MSVC, clang-cl, GCC, Clang, Apple, many | GCC, Clang, MSVC, many | GCC, Clang, MSVC | GCC, Clang (Linux) | MinGW target; MSVC deferred |
|
||||||
| Package/registry | External (vcpkg, Conan, FetchContent) | wrapdb, subprojects | cppget.org / brep | **Built-in registry + solver + lock + binary variants + signatures + SBOM** | federation, mirrors, key distribution |
|
| Package/registry | External (vcpkg, Conan, FetchContent) | wrapdb, subprojects | cppget.org / brep | **Built-in registry + solver + lock + binary variants + signatures + SBOM** | federation, mirrors, key distribution |
|
||||||
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | **RPM (rpm 6.1-validated)**, **WiX source for MSI** (candle/light on Windows), DMG-style |
|
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | **RPM (rpm 6.1-validated)**, **WiX source for MSI** (candle/light on Windows), **UDIF/DMG container** (koly trailer, CRC-32; HFS+ payload is macOS-only) |
|
||||||
| IDE integration | File API, presets, every IDE | `meson-info` introspection | limited | `vbs ide generate/query`, CompDB, daemon protocol | File API shim, `CMakePresets.json` import, plugins |
|
| IDE integration | File API, presets, every IDE | `meson-info` introspection | limited | `vbs ide generate/query`, CompDB, daemon protocol | File API shim, `CMakePresets.json` import, plugins |
|
||||||
| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner; `vbs test --junit --test-timeout --label`; parallel tests with resource locks and fixtures; CDash submission | - |
|
| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner; `vbs test --junit --test-timeout --label`; parallel tests with resource locks and fixtures; CDash submission | - |
|
||||||
| Incremental / cache | compiler depfiles, ccache external | depfiles, ccache | internal caching model | **content-addressed state, immutable snapshots, remote action cache** | scale benchmarks |
|
| Incremental / cache | compiler depfiles, ccache external | depfiles, ccache | internal caching model | **content-addressed state, immutable snapshots, remote action cache** | scale benchmarks |
|
||||||
|
|||||||
@@ -598,6 +598,116 @@ write_wix_source(const std::filesystem::path &output, const InstallOptions &opti
|
|||||||
return Platform::atomic_write_file(output, xml, true);
|
return Platform::atomic_write_file(output, xml, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ── UDIF (DMG) trailer ─────────────────────────────────────────────────────────────────────
|
||||||
|
// A DMG is a data fork (the disk image payload) followed by a 512-byte "koly" trailer. This
|
||||||
|
// writer produces a valid UDIF container whose payload is the deterministic tar of the package;
|
||||||
|
// macOS DiskImageMounter additionally needs a filesystem payload (HFS+/APFS), which is macOS-only
|
||||||
|
// work. Checksums are CRC-32 as in the UDIF specification.
|
||||||
|
|
||||||
|
class Crc32 {
|
||||||
|
public:
|
||||||
|
void update(std::string_view data) {
|
||||||
|
for (const char ch : data) {
|
||||||
|
crc_ ^= static_cast<std::uint32_t>(static_cast<unsigned char>(ch));
|
||||||
|
for (int bit = 0; bit < 8; ++bit) {
|
||||||
|
crc_ = (crc_ >> 1) ^ (0xEDB88320u & (0u - (crc_ & 1u)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] std::uint32_t value() const { return ~crc_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::uint32_t crc_{0xFFFFFFFFu};
|
||||||
|
};
|
||||||
|
|
||||||
|
void put_be32(std::string &out, std::size_t offset, std::uint32_t value) {
|
||||||
|
for (int i = 3; i >= 0; --i) {
|
||||||
|
out[offset + static_cast<std::size_t>(i)] = static_cast<char>(value & 0xFFu);
|
||||||
|
value >>= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void put_be64(std::string &out, std::size_t offset, std::uint64_t value) {
|
||||||
|
for (int i = 7; i >= 0; --i) {
|
||||||
|
out[offset + static_cast<std::size_t>(i)] = static_cast<char>(value & 0xFFu);
|
||||||
|
value >>= 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string make_koly_trailer(std::uint64_t data_fork_length, std::uint32_t data_crc,
|
||||||
|
std::string_view segment_seed) {
|
||||||
|
std::string koly(512, '\0');
|
||||||
|
koly[0] = 'k';
|
||||||
|
koly[1] = 'o';
|
||||||
|
koly[2] = 'l';
|
||||||
|
koly[3] = 'y';
|
||||||
|
put_be32(koly, 4, 4); // version
|
||||||
|
put_be32(koly, 8, 512); // header size
|
||||||
|
put_be32(koly, 12, 1); // flags
|
||||||
|
put_be64(koly, 16, 0); // running data fork offset
|
||||||
|
put_be64(koly, 24, 0); // data fork offset
|
||||||
|
put_be64(koly, 32, data_fork_length);
|
||||||
|
put_be64(koly, 40, 0); // resource fork offset
|
||||||
|
put_be64(koly, 48, 0); // resource fork length
|
||||||
|
put_be32(koly, 56, 1); // segment number
|
||||||
|
put_be32(koly, 60, 1); // segment count
|
||||||
|
const std::string digest = Util::sha256_hex(segment_seed);
|
||||||
|
for (std::size_t i = 0; i < 16; ++i) {
|
||||||
|
koly[64 + i] = static_cast<char>(std::stoul(digest.substr(i * 2, 2), nullptr, 16));
|
||||||
|
}
|
||||||
|
// Data fork checksum: type 2 (CRC-32), 32-bit.
|
||||||
|
put_be32(koly, 80, 2);
|
||||||
|
put_be32(koly, 84, 32);
|
||||||
|
put_be32(koly, 88, data_crc);
|
||||||
|
put_be64(koly, 216, 0); // no XML plist
|
||||||
|
put_be64(koly, 224, 0);
|
||||||
|
// Master checksum mirrors the data fork checksum.
|
||||||
|
put_be32(koly, 352, 2);
|
||||||
|
put_be32(koly, 356, 32);
|
||||||
|
put_be32(koly, 360, data_crc);
|
||||||
|
put_be32(koly, 488, 1); // image variant
|
||||||
|
put_be64(koly, 492, (data_fork_length + 511u) / 512u); // sector count
|
||||||
|
return koly;
|
||||||
|
}
|
||||||
|
|
||||||
|
Void::Result::Result<void, Void::Result::Error>
|
||||||
|
write_dmg_archive(const std::filesystem::path &output, const std::filesystem::path &payload) {
|
||||||
|
std::ifstream in{payload, std::ios::binary};
|
||||||
|
if (!in) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::SystemErrorCode::io_error,
|
||||||
|
std::format("cannot open DMG payload '{}'", payload.string()))};
|
||||||
|
}
|
||||||
|
std::ofstream out{output, std::ios::binary | std::ios::trunc};
|
||||||
|
if (!out) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::SystemErrorCode::io_error,
|
||||||
|
std::format("cannot create DMG '{}'", output.string()))};
|
||||||
|
}
|
||||||
|
Crc32 crc;
|
||||||
|
std::uint64_t length = 0;
|
||||||
|
std::array<char, 64 * 1024> buffer{};
|
||||||
|
while (in) {
|
||||||
|
in.read(buffer.data(), static_cast<std::streamsize>(buffer.size()));
|
||||||
|
const auto count = in.gcount();
|
||||||
|
if (count > 0) {
|
||||||
|
out.write(buffer.data(), count);
|
||||||
|
crc.update(std::string_view{buffer.data(), static_cast<std::size_t>(count)});
|
||||||
|
length += static_cast<std::uint64_t>(count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const std::string koly = make_koly_trailer(length, crc.value(), payload.filename().string());
|
||||||
|
out.write(koly.data(), static_cast<std::streamsize>(koly.size()));
|
||||||
|
out.flush();
|
||||||
|
if (!out) {
|
||||||
|
return std::unexpected{Void::System::make_system_error(
|
||||||
|
Void::System::SystemErrorCode::io_error,
|
||||||
|
std::format("failed writing DMG '{}'", output.string()))};
|
||||||
|
}
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
// Debian package: ar container with debian-binary, control.tar and data.tar (uncompressed).
|
// Debian package: ar container with debian-binary, control.tar and data.tar (uncompressed).
|
||||||
Void::Result::Result<void, Void::Result::Error>
|
Void::Result::Result<void, Void::Result::Error>
|
||||||
write_deb_package(const std::filesystem::path &output, const InstallOptions &options,
|
write_deb_package(const std::filesystem::path &output, const InstallOptions &options,
|
||||||
@@ -1042,6 +1152,16 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
|
|||||||
!packed) {
|
!packed) {
|
||||||
return std::unexpected{packed.error()};
|
return std::unexpected{packed.error()};
|
||||||
}
|
}
|
||||||
|
} else if (options.archive_format == "dmg") {
|
||||||
|
const auto payload = stage_root / "installer-payload.tar";
|
||||||
|
auto archived =
|
||||||
|
Package::create_deterministic_tar(payload, std::move(archive_entries), 0);
|
||||||
|
if (!archived) {
|
||||||
|
return std::unexpected{archived.error()};
|
||||||
|
}
|
||||||
|
if (auto packed = write_dmg_archive(*options.archive_path, payload); !packed) {
|
||||||
|
return std::unexpected{packed.error()};
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const bool archive_as_script = options.archive_format == "sh";
|
const bool archive_as_script = options.archive_format == "sh";
|
||||||
const auto archive_target = archive_as_script
|
const auto archive_target = archive_as_script
|
||||||
|
|||||||
+4
-3
@@ -2527,9 +2527,10 @@ int execute_install_command(const InstallCmdOptions &opts) {
|
|||||||
iopts.bundle_runtime_dependencies = opts.bundle_dependencies;
|
iopts.bundle_runtime_dependencies = opts.bundle_dependencies;
|
||||||
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh" &&
|
if (opts.archive_format_arg != "tar" && opts.archive_format_arg != "sh" &&
|
||||||
opts.archive_format_arg != "zip" && opts.archive_format_arg != "deb" &&
|
opts.archive_format_arg != "zip" && opts.archive_format_arg != "deb" &&
|
||||||
opts.archive_format_arg != "rpm" && opts.archive_format_arg != "wix") {
|
opts.archive_format_arg != "rpm" && opts.archive_format_arg != "wix" &&
|
||||||
|
opts.archive_format_arg != "dmg") {
|
||||||
std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
|
std::cerr << "vbs install: unsupported --archive-format '" << opts.archive_format_arg
|
||||||
<< "' (expected tar, sh, zip, deb, rpm or wix)\n";
|
<< "' (expected tar, sh, zip, deb, rpm, wix or dmg)\n";
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (opts.archive_arg && !opts.archive_arg->empty()) {
|
if (opts.archive_arg && !opts.archive_arg->empty()) {
|
||||||
@@ -3734,7 +3735,7 @@ int main(int argc, char **argv) {
|
|||||||
.option("--archive", "", "Write a deterministic installer archive of the prefix",
|
.option("--archive", "", "Write a deterministic installer archive of the prefix",
|
||||||
install_opts.archive_arg)
|
install_opts.archive_arg)
|
||||||
.option_default("--archive-format", "",
|
.option_default("--archive-format", "",
|
||||||
"Installer archive format: tar (default), sh, zip, deb, rpm or wix",
|
"Installer archive format: tar (default), sh, zip, deb, rpm, wix or dmg",
|
||||||
install_opts.archive_format_arg, "tar")
|
install_opts.archive_format_arg, "tar")
|
||||||
.option("--signing-key", "",
|
.option("--signing-key", "",
|
||||||
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
|
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
|
||||||
|
|||||||
@@ -1091,6 +1091,52 @@ void build(Void::Build::Project &p) {
|
|||||||
Void::Testing::expect(wix_text->find("ComponentGroup Id=\"ProductComponents\"") !=
|
Void::Testing::expect(wix_text->find("ComponentGroup Id=\"ProductComponents\"") !=
|
||||||
std::string::npos);
|
std::string::npos);
|
||||||
|
|
||||||
|
// UDIF (DMG-style) container: tar payload followed by a 512-byte koly trailer.
|
||||||
|
const auto dmg_archive = tmp / "cli_hi.dmg";
|
||||||
|
auto dmg_req = inst_req;
|
||||||
|
for (auto &arg : dmg_req.arguments) {
|
||||||
|
if (arg == installer_archive.string()) {
|
||||||
|
arg = dmg_archive.string();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dmg_req.arguments.push_back("--archive-format");
|
||||||
|
dmg_req.arguments.push_back("dmg");
|
||||||
|
auto dmg_res = Platform::run_supervised(dmg_req);
|
||||||
|
Void::Testing::expect(dmg_res.has_value() && dmg_res->succeeded());
|
||||||
|
auto dmg_bytes = Void::FileSystem::read_file(dmg_archive);
|
||||||
|
Void::Testing::require(dmg_bytes.has_value() && dmg_bytes->size() > 512);
|
||||||
|
const auto dmg_length = dmg_bytes->size();
|
||||||
|
const std::string koly = dmg_bytes->substr(dmg_length - 512);
|
||||||
|
const auto read_be32 = [](std::string_view bytes, std::size_t offset) {
|
||||||
|
std::uint32_t value = 0;
|
||||||
|
for (std::size_t i = 0; i < 4; ++i) {
|
||||||
|
value = (value << 8) | static_cast<unsigned char>(bytes[offset + i]);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
const auto read_be64 = [](std::string_view bytes, std::size_t offset) {
|
||||||
|
std::uint64_t value = 0;
|
||||||
|
for (std::size_t i = 0; i < 8; ++i) {
|
||||||
|
value = (value << 8) | static_cast<unsigned char>(bytes[offset + i]);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
};
|
||||||
|
Void::Testing::expect(koly.starts_with("koly"));
|
||||||
|
Void::Testing::expect_eq(read_be32(koly, 8), std::uint32_t{512});
|
||||||
|
const std::uint64_t data_fork_length = read_be64(koly, 32);
|
||||||
|
Void::Testing::expect_eq(data_fork_length, static_cast<std::uint64_t>(dmg_length - 512));
|
||||||
|
Void::Testing::expect_eq(read_be32(koly, 80), std::uint32_t{2}); // CRC-32
|
||||||
|
std::uint32_t crc = 0xFFFFFFFFu;
|
||||||
|
for (const char ch : dmg_bytes->substr(0, data_fork_length)) {
|
||||||
|
crc ^= static_cast<std::uint32_t>(static_cast<unsigned char>(ch));
|
||||||
|
for (int bit = 0; bit < 8; ++bit) {
|
||||||
|
crc = (crc >> 1) ^ (0xEDB88320u & (0u - (crc & 1u)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Void::Testing::expect_eq(read_be32(koly, 88), ~crc);
|
||||||
|
Void::Testing::expect_eq(read_be64(koly, 492), (data_fork_length + 511) / 512);
|
||||||
|
Void::Testing::expect(dmg_bytes->substr(257, 5) == "ustar"); // tar payload
|
||||||
|
|
||||||
// RPM package generator: lead + header magic + newc cpio payload.
|
// RPM package generator: lead + header magic + newc cpio payload.
|
||||||
const auto rpm_archive = tmp / "cli_hi.rpm";
|
const auto rpm_archive = tmp / "cli_hi.rpm";
|
||||||
auto rpm_req = inst_req;
|
auto rpm_req = inst_req;
|
||||||
@@ -3051,6 +3097,26 @@ VOID_TEST(FullV1Tests, ide_integration_compdb_build_cpp_and_editor_configs_end_t
|
|||||||
const auto codemodel_file = get_string(*codemodel_entry, "jsonFile");
|
const auto codemodel_file = get_string(*codemodel_entry, "jsonFile");
|
||||||
Void::Testing::require(!codemodel_file.empty());
|
Void::Testing::require(!codemodel_file.empty());
|
||||||
|
|
||||||
|
// The full reply set an IDE needs to load the project: cache, cmake files, toolchains.
|
||||||
|
for (const auto &kind : {"cache-v2", "cmakeFiles-v1", "toolchains-v1"}) {
|
||||||
|
const auto *entry = get_object(*reply, kind);
|
||||||
|
Void::Testing::require(entry != nullptr);
|
||||||
|
const auto file = get_string(*entry, "jsonFile");
|
||||||
|
Void::Testing::require(!file.empty());
|
||||||
|
const auto parsed = read_json(reply_dir / file);
|
||||||
|
Void::Testing::require(parsed.has_value());
|
||||||
|
const auto *object = std::get_if<JsonObject>(&parsed->value);
|
||||||
|
Void::Testing::require(object != nullptr);
|
||||||
|
Void::Testing::expect(!get_string(*object, "kind").empty());
|
||||||
|
}
|
||||||
|
const auto cache_file = get_string(*get_object(*reply, "cache-v2"), "jsonFile");
|
||||||
|
const auto cache_json = read_json(reply_dir / cache_file);
|
||||||
|
Void::Testing::require(cache_json.has_value());
|
||||||
|
auto cache_text = Void::FileSystem::read_file(reply_dir / cache_file);
|
||||||
|
Void::Testing::require(cache_text.has_value());
|
||||||
|
Void::Testing::expect(cache_text->find("CMAKE_BUILD_TYPE") != std::string::npos);
|
||||||
|
Void::Testing::expect(cache_text->find("CMAKE_CXX_COMPILER") != std::string::npos);
|
||||||
|
|
||||||
const auto codemodel_json = read_json(reply_dir / codemodel_file);
|
const auto codemodel_json = read_json(reply_dir / codemodel_file);
|
||||||
Void::Testing::require(codemodel_json.has_value());
|
Void::Testing::require(codemodel_json.has_value());
|
||||||
const auto *codemodel_object = std::get_if<JsonObject>(&codemodel_json->value);
|
const auto *codemodel_object = std::get_if<JsonObject>(&codemodel_json->value);
|
||||||
|
|||||||
Reference in new issue
Block a user