The release moved every source into its own layer (core/, app/, pages/,
providers/, preferences/, logging/, archive/, update/, translations/) and
replaced the plugin shop with .fwspacm packages. main added the headless update
check run at login. Both sides are kept, the feature moved onto the new layout:
- core/startup-check.{h,cpp} and its test, wired into the CMake targets the
release renamed (core/startup-check.cpp, startup-check-test);
- app/main.cpp carries the --check-updates branch, ahead of the command line so
the login unit never opens a window;
- the settings menu keeps the "check at startup" toggle, now through tr(), and
translations/en.json gains the new strings;
- doc/mise-a-jour.md keeps the release's version and gains the startup-check
section; the documented test count follows the new target.
181 lines
6.5 KiB
Markdown
181 lines
6.5 KiB
Markdown
# Contributing to PacManager
|
|
|
|
Thanks for your interest in the project. This document describes **how to
|
|
build, test and propose a change** to PacManager. For project context
|
|
(features, build, licence), see the [`README.en.md`](README.en.md); for the
|
|
internal architecture, the [`doc/`](doc/README.md) folder.
|
|
|
|
## Licence: read before proposing
|
|
|
|
PacManager is **proprietary, source-available, personal use only**
|
|
([`LICENSE`](LICENSE)). You may modify and improve the code for your own use;
|
|
**distributing, selling or reusing the code** — in whole or in part, modified or
|
|
not — is **forbidden**. A contribution sent through an issue or a pull request
|
|
amounts to accepting these terms for the change concerned.
|
|
|
|
## Building
|
|
|
|
Dependencies (Arch Linux):
|
|
|
|
```bash
|
|
sudo pacman -S qt6-base cmake gcc base-devel
|
|
```
|
|
|
|
Build:
|
|
|
|
```bash
|
|
cmake -B build
|
|
cmake --build build -j$(nproc)
|
|
```
|
|
|
|
A plain `cmake -B build` is enough: the Flatpak plugin is built by default. The
|
|
useful options:
|
|
|
|
| Option | Default | Effect |
|
|
| --- | --- | --- |
|
|
| `FWS_BUILD_FLATPAK_PLUGIN` | `ON` | build the Flatpak provider plugin |
|
|
| `FWS_BUILD_AUR_PLUGIN` | `ON` | build the AUR provider plugin |
|
|
| `FWS_BUILD_EXAMPLE_PLUGIN` | `OFF` | build the example provider plugin (template) |
|
|
| `FWS_BUILD_EXAMPLE_ADDON` | `OFF` | build the example addon plugin (template) |
|
|
|
|
Install (user installation, no sudo):
|
|
|
|
```bash
|
|
cmake --install build --prefix ~/.local
|
|
```
|
|
|
|
## Running the tests
|
|
|
|
Every test target is a standalone binary using `assert` — no framework, no
|
|
download. Once built:
|
|
|
|
```bash
|
|
cd build && ctest --output-on-failure
|
|
```
|
|
|
|
There are **13 tests**. Most are unit tests that never touch the system;
|
|
`flatpak-integration-test` is the only one that drives the real flatpak CLI (in
|
|
an isolated temporary installation), and `app-core-test` checks in particular
|
|
that every privileged path goes through the password gate — **without ever
|
|
replaying a request**, so it can never run pacman as root.
|
|
|
|
| Target | Covers |
|
|
| --- | --- |
|
|
| `pacman-manager-test` | parsing pacman output |
|
|
| `flatpak-manager-test` | flatpak parsing, install targets, commands |
|
|
| `flatpak-integration-test` | the real flatpak CLI, end to end |
|
|
| `aur-manager-test` | the AUR provider |
|
|
| `app-core-test` | the core: providers, password gate, lock, plugins |
|
|
| `progress-tracker-test` | reading a tool's output, progress, ANSI |
|
|
| `package-utils-test` | the shared package utilities |
|
|
| `plugin-package-test` | the `.fwspacm` package format and its installation |
|
|
| `app-settings-test` | the preferences model and the journal |
|
|
| `language-manager-test` | the language: resolution, catalogues, coverage |
|
|
| `cli-command-test` | the command-line grammar |
|
|
| `update-manager-test` | version detection and self-update |
|
|
| `startup-check-test` | the update check run at login |
|
|
|
|
[doc/tests.md](doc/tests.md) details each target and explains how to add one.
|
|
|
|
## Code conventions
|
|
|
|
- **Language**: C++17, Qt6. Follow the existing stack and conventions before
|
|
adding any dependency.
|
|
- **Formatting**: `.clang-format` (LLVM, 4 spaces, attached braces, 100
|
|
columns). Run `clang-format -i <file>` before committing.
|
|
- **Files**: `kebab-case` (e.g. `browse-page.cpp`).
|
|
- **Identifiers**: English, `camelCase` for functions and variables,
|
|
`PascalCase` for types.
|
|
- **Comments**: in **English**, "why" style. Do not comment what the code
|
|
already says; document the implementation choice, the trade-off, the edge
|
|
case.
|
|
|
|
## Architecture: where code goes
|
|
|
|
The split is structural and not negotiable:
|
|
|
|
- **All logic lives in `AppCore`** (`core/app-core.h`, `core/app-core.cpp`):
|
|
providers, worker threads, history, sudo, the pacman lock, self-update. This
|
|
layer depends on Qt Core only and **holds no widget** — which is what lets
|
|
`app-core-test` run it without a screen.
|
|
- **The interface lives in `pages/`**, one file per screen. `MainWindow`
|
|
(`app/main-window.cpp`) is only a frame: sidebar, status bar, dialogs. No
|
|
business rule.
|
|
- **The conversation always goes the same way**: the view calls a core method,
|
|
which answers "started", "I need the sudo password" or "the database is
|
|
locked"; the view then asks the user for what is needed and replays the
|
|
request. Results come back through signals.
|
|
|
|
Adding a screen = a `Page` class (see `pages/base/page.h`) and an entry in the
|
|
sidebar. Adding a package manager = a plugin implementing `IPackageManager` in
|
|
`providers/` — **without touching the application** (see
|
|
[doc/plugins.md](doc/plugins.md)).
|
|
|
|
## Workflow
|
|
|
|
### Branches
|
|
|
|
`type/description`: `feat/flatpak-files`, `fix/lock-message`, `docs/tests`…
|
|
|
|
### Commits
|
|
|
|
**Conventional Commits** format:
|
|
|
|
```
|
|
<type>(<scope>): <description>
|
|
```
|
|
|
|
- Message in **English**;
|
|
- types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`,
|
|
`ci`, `chore`, `revert`;
|
|
- short imperative title; the body explains only the **why**, not the how;
|
|
- **signed commits**;
|
|
- the message never mentions **the tool or the assistant** that produced the
|
|
change, and no automatic co-author is added.
|
|
|
|
Example:
|
|
|
|
```
|
|
fix(credentials): ask for the password before a bulk removal
|
|
|
|
The cleanup page grouped its packages by provider but never handed those
|
|
providers to the credential gate, which saw an empty list, concluded
|
|
nothing was privileged and let the request through: pacman was then
|
|
driven with an empty password.
|
|
|
|
Every privileged path now goes through the same door, which the new test
|
|
walks one by one.
|
|
```
|
|
|
|
### Before calling it done
|
|
|
|
1. `cmake --build build` with no error;
|
|
2. `ctest --output-on-failure`: **all green**;
|
|
3. the app starts (`./build/PacManager`) with no console warning;
|
|
4. the relevant documentation is up to date (`doc/`, `README.md` /
|
|
`README.en.md`).
|
|
|
|
A user-visible behaviour change is verified by **running the behaviour**, not
|
|
just by reading the code: paths in `pages/` are not covered by `app-core-test`.
|
|
|
|
### Pull requests
|
|
|
|
- A PR fixing a bug references the issue (`Fixes #123`).
|
|
- Do not close or modify an issue without an explicit request from the
|
|
maintainer.
|
|
- Do not push, merge or publish without an explicit request: those remain the
|
|
maintainer's calls.
|
|
|
|
## Documentation
|
|
|
|
The [`doc/`](doc/README.md) folder is the source of the project wiki; each file
|
|
is a standalone page and its filename is that of the page. A change to the
|
|
architecture, to a plugin contract or to an interface behaviour comes with its
|
|
documentation update.
|
|
|
|
## AI agents
|
|
|
|
Agents working on this repository follow [`AGENTS.md`](AGENTS.md), which
|
|
restates these rules in a form suited to them and adds the constraints specific
|
|
to them (in particular: no tool mention in commits).
|