Skip to content

Packages (FreeBSD): adds flatpkg detection - #2778

Open
Tyagiquamar wants to merge 1 commit into
fastfetch-cli:devfrom
Tyagiquamar:feat-flatpkg-packages
Open

Tyagiquamar wants to merge 1 commit into
fastfetch-cli:devfrom
Tyagiquamar:feat-flatpkg-packages

Conversation

@Tyagiquamar

Copy link
Copy Markdown
Contributor

Summary

Adds a flatpkg counter to the Packages module on FreeBSD. flatpkg is a clean-room Flatpak reimplementation for BSD systems; its package store at /var/db/flatpkg was previously invisible to fastfetch.

Closes #2720

Changes

  • src/detection/packages/packages_bsd.c: scans the flatpkg store (/var/db/flatpkg) using the layout from flatpkg's own src/shared/store.c:
    • app/<id> counts once when the app has a deployed revision (<id>/<arch>/<branch>/active, a symlink to the deploy dir that stat() follows) or an app/<id>/pointer file, which is how flatpkg marks apps exported to the host.
    • runtime/<id>/<arch>/<branch> counts once per branch that has an active deploy marker, so superseded deploys kept by flatpkg are not counted. .Locale and .Debug refs are skipped, matching the flatpak counting rules.
    • extension/ refs are not counted, matching flatpak behavior.
  • src/detection/packages/packages.h: new flatpkg result field (picked up by the all total automatically).
  • src/modules/packages/option.h: new FF_PACKAGES_FLAG_FLATPKG_BIT (auto-wires the PACKAGES_DISABLE_FLATPKG CMake option and the disabled JSON list via the existing regex).
  • src/modules/packages/packages.c: prints (flatpkg) in text output, adds the {flatpkg} format placeholder, JSON result field, and disabled list support.
  • doc/json_schema.json, CHANGELOG.md: documented.

Only the system store is counted. flatpkg's per-user store lives at ~/.local/share/flatpak, which is shared with real Flatpak installs and uses the Flatpak layout, so it cannot be attributed to flatpkg unambiguously; the FreeBSD backend does not count Flatpak user installs today either.

Tests

  • gcc -fsyntax-only on packages_bsd.c (FreeBSD-only TU, not reachable from the Linux build) and packages.c: clean.
  • Full Linux build in Docker (debian:trixie-slim, cmake -B build -DBUILD_TESTS=On): cmake --build build succeeded; ctest --output-on-failure: 21/21 tests passed.
  • Smoke-tested the built binary: {flatpkg} resolves in --packages-format, appears in -h packages-format, disabled: ["flatpkg"] is accepted, and JSON output is unchanged on Linux (flatpkg is BSD-only).
  • Functional check of the new detection code: compiled packages_bsd.c into a scratch harness and pointed it at a synthetic /var/db/flatpkg store (3 apps incl. one pointer-only, 1 deployed runtime, 1 .Locale ref, 1 undeployed branch, 1 extension). Result: flatpkg=4 as expected; 0 when the store is absent.

Note: the port-tree patch referenced in the issue (ports/sysutils/fastfetch/files/patch-... in Poiesys/flatpkg) targets /var/lib/flatpkg and the Flatpak app/<id>/current layout; the actual flatpkg store is /var/db/flatpkg with <id>/<arch>/<branch>/active deploy markers, so this implements the real layout instead.

Checklist

  • I have tested my changes locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add support for flatpkg packages

1 participant