Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ these entries stays in the GitHub releases and the Git history.
- Bundle npm packages that use `#` subpath imports (the `imports` of their `package.json`, naming their own files or a dependency), such as Svelte 5, once an environment with it is published (#767).
- Start an interface without a UI library on a C++ state store with `wf create store`, once an environment with it is published (#767, `docs/STORE.md`).
- `@webfront/store` adapters for Vue and Lit are run in the browser suite, and the Svelte store contract with `svelte/store` 5 in a `wf test` case, with a per-library support policy (#767, ADR-010).
- Verify that the Life installer leaves nothing behind: Settings and start-menu entries on Windows, every file and the package record on Debian (#762, `docs/DISTRIBUTION.md`).
- Use an installed WebFront with `find_package(WebFront)`, offline, through `cmake --install`, a vcpkg overlay port or a Conan recipe of the repository (#762, ADR-028, `docs/DISTRIBUTION.md`).
- Build an installer of your application with `webfront_package()`: Debian package with the WebKitGTK profile, macOS disk image or NSIS installer that detects the WebView2 runtime (#762, ADR-028, `docs/DISTRIBUTION.md`).
- Replace an executable with a signed one, with rollback, using the optional `webfront/components/update/Updater.hpp` (#762, ADR-028, `docs/DISTRIBUTION.md`).
Expand Down
5 changes: 4 additions & 1 deletion docs/DISTRIBUTION.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ Then `cmake --build <build> --target package` (or `cpack` in it) writes one inst
statically, as [the Life package](../examples/life/package/CMakeLists.txt) does, or ship its redistributable.

The CI packages the embedded Game of Life this way on the three systems, installs it, runs `--check` and removes it
(`test/cmake/CheckLifeInstaller.cmake`). It does not open the installed application's window.
(`test/cmake/CheckLifeInstaller.cmake`). The removal is checked beyond the application's directory: on Windows the entries of
Settings and of the start menu are the same before the installation and after the uninstaller; on Debian every file of the
package is gone after `dpkg --purge` and dpkg forgets the package; on macOS the bundle is the whole installation. The check does
not open the installed application's window.

## Verified updates

Expand Down
39 changes: 39 additions & 0 deletions test/cmake/CheckLifeInstaller.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,37 @@ if(NOT count EQUAL 1)
message(FATAL_ERROR "Expected one installer in ${PACKAGE_DIR}, found: ${installer}")
endif()

# What an installer writes outside its directory on Windows: the entries of Settings > Apps and the start menu. Sorted lines.
function(windows_system_entries out)
execute_process(COMMAND pwsh -NoProfile -Command
"$keys = 'HKLM:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall', 'HKLM:\\Software\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall'; $keys | Where-Object { Test-Path $_ } | ForEach-Object { Get-ChildItem $_ | ForEach-Object { 'uninstall ' + $_.PSChildName } }; $menu = Join-Path $env:ProgramData 'Microsoft\\Windows\\Start Menu\\Programs'; Get-ChildItem $menu -Recurse | ForEach-Object { 'menu ' + $_.FullName } | Sort-Object"
RESULT_VARIABLE result OUTPUT_VARIABLE entries ERROR_VARIABLE errors TIMEOUT 120)
if(NOT result EQUAL 0)
message(FATAL_ERROR "Cannot list the system entries of installed programs: ${errors}")
endif()
string(REPLACE "\r" "" entries "${entries}")
string(REGEX REPLACE "\n$" "" entries "${entries}")
set(${out} "${entries}" PARENT_SCOPE)
endfunction()

if(CMAKE_HOST_WIN32)
# NSIS takes /D= and _?= last and unquoted: a directory without spaces.
file(TO_CMAKE_PATH "$ENV{RUNNER_TEMP}" temp)
set(directory "${temp}/webfront-life-installed")
file(TO_NATIVE_PATH "${directory}" native)
windows_system_entries(before)
run("${installer}" /S "/D=${native}")
windows_system_entries(installed)
if(installed STREQUAL before)
message(FATAL_ERROR "The installer registered nothing in Settings or the start menu")
endif()
check_installed("${directory}/bin/webfront-life.exe" "${directory}/webfront-life.spdx.json" "Microsoft.Web.WebView2")
run("${directory}/Uninstall.exe" /S "_?=${native}")
check_removed("${directory}/bin/webfront-life.exe" "${directory}/webfront-life.spdx.json")
windows_system_entries(after)
if(NOT after STREQUAL before)
message(FATAL_ERROR "The uninstaller left entries in Settings or the start menu.\nBefore:\n${before}\nAfter:\n${after}")
endif()
elseif(CMAKE_HOST_APPLE)
set(volume "${PACKAGE_DIR}/volume")
set(application "/Applications/webfront-life.app")
Expand All @@ -76,7 +98,24 @@ else()
message(FATAL_ERROR "The package did not install ${file}")
endif()
endforeach()
# Every file the package owns, from its own list, must be gone after the purge, and dpkg must forget the package.
run(dpkg -L webfront-life)
string(REPLACE "\n" ";" listed "${run_output}")
set(owned "")
foreach(path IN LISTS listed)
if(path MATCHES "^/" AND EXISTS "${path}" AND NOT IS_DIRECTORY "${path}")
list(APPEND owned "${path}")
endif()
endforeach()
if(NOT owned)
message(FATAL_ERROR "dpkg lists no file of webfront-life")
endif()
run(dpkg --purge webfront-life)
check_removed(${owned})
execute_process(COMMAND dpkg -s webfront-life RESULT_VARIABLE known OUTPUT_QUIET ERROR_QUIET)
if(known EQUAL 0)
message(FATAL_ERROR "dpkg still knows webfront-life after the purge")
endif()
check_removed(/usr/bin/webfront-life /usr/share/applications/webfront-life.desktop /etc/apparmor.d/webfront-webfront-life
/usr/share/webfront-life /usr/share/doc/webfront-life)
endif()
Loading