Skip to content

Use libostree for getting deployments list#113

Open
Eeems wants to merge 7 commits into
masterfrom
pygobject
Open

Use libostree for getting deployments list#113
Eeems wants to merge 7 commits into
masterfrom
pygobject

Conversation

@Eeems
Copy link
Copy Markdown
Owner

@Eeems Eeems commented May 20, 2026

Summary by CodeRabbit

  • Refactor

    • Deployment handling now uses native OSTree system bindings, improving accuracy and reliability of detected deployments, boot/pending/rollback status and deployment paths.
  • Chores

    • Build image and container setup updated to include GObject Introspection support and PyGObject, ensuring required system integration libraries are available during builds.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7fefeda1-c119-4e41-b445-778c5706a593

📥 Commits

Reviewing files that changed from the base of the PR and between 830c471 and 61c0961.

📒 Files selected for processing (1)
  • overlay/base/usr/lib/system/_os/ostree.py

📝 Walkthrough

Walkthrough

The PR replaces JSON-based OSTree parsing with GObject Introspection (OSTree/Gio), refactors Deployment to wrap OSTree.Deployment, adds a sysroot() helper, rewires deployments()/current_deployment(), and updates the Containerfile to install GI system packages and PyGObject.

Changes

OSTree GI Integration

Layer / File(s) Summary
GI bindings setup
overlay/base/usr/lib/system/_os/ostree.py
Remove json import and add GObject Introspection setup: call gi.require_version and import Gio and OSTree from gi.repository.
Deployment class refactor
overlay/base/usr/lib/system/_os/ostree.py
Refactor Deployment to wrap an OSTree.Deployment; property getters (checksum, stateroot, unlocked, booted/pending/rollback, index, path) now call OSTree GI and sysroot APIs and validate paths.
Sysroot helper and deployment APIs
overlay/base/usr/lib/system/_os/ostree.py
Add sysroot() to construct/load OSTree.Sysroot; deployments() iterates sysroot().get_deployments(); current_deployment() wraps sysroot().get_booted_deployment().
Build dependencies for GI integration
tools/builder/Containerfile
Reorder apt package list and add gir1.2-gtk-4.0, gir1.2-ostree-1.0; split pip install steps and add PyGObject to Python packages.

Sequence Diagram

sequenceDiagram
  participant Caller
  participant SysrootFactory as sysroot()
  participant OSTreeSysroot as OSTree.Sysroot
  participant GI_Deployment as OSTree.Deployment
  participant DeploymentClass as Deployment

  Caller->>SysrootFactory: sysroot(path)
  SysrootFactory->>OSTreeSysroot: new() / load(path)
  Caller->>SysrootFactory: deployments()
  SysrootFactory->>OSTreeSysroot: get_deployments()
  OSTreeSysroot-->>SysrootFactory: [OSTree.Deployment,...]
  SysrootFactory->>DeploymentClass: wrap(each OSTree.Deployment)
  DeploymentClass->>GI_Deployment: get_checksum/get_osname/is_unlocked/get_index/get_sysroot_deployment_dir
  GI_Deployment-->>DeploymentClass: property values
  DeploymentClass-->>Caller: Deployment instances
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

A rabbit hops through bindings new,
From JSON crumbs to GI dew,
Sysroot hums and deployments bloom,
Methods call where dicts left room —
🐰✨ tidy hops, a brighter plume

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: refactoring the module to use libostree (via GObject Introspection) instead of executing ostree commands and parsing JSON for deployments.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Eeems Eeems linked an issue May 20, 2026 that may be closed by this pull request
@Eeems Eeems marked this pull request as ready for review May 21, 2026 05:10
coderabbitai[bot]

This comment was marked as resolved.

@Eeems

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

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.

Use pygobject for libostree access instead of calling cli tool

1 participant