alteratorctl rewritten in Rust on top of libalterator-glib (D-Bus only via libalterator-glib)
  • Rust 95.3%
  • C 3.4%
  • Shell 1.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Andrey Limachko edad712b83
feat(cli): add alteratorctl-rs with editions module
clap-based dispatcher with MODULE COMMAND grammar matching alteratorctl.
All D-Bus access goes exclusively through the alterator crate
(libalterator-glib): Glib facade init, SoftwareManager transactions
(commit_and_wait, no GMainLoop), Edition objects.

editions commands: get, set, list (current edition marked with *),
description, license, info. Edition names are validated against the
manager model before edition() lookup to avoid a libalterator-glib
crash path (NULL return without GError for unknown names).

gettext i18n (en source strings, ru translation in po/), setlocale
called explicitly so LC_ALL/LANG are honored.

Generated-by: Kimi Code (Kimi)
Signed-off-by: Andrey Limachko <liannnix@altlinux.org>
2026-09-10 13:20:43 +00:00
alterator feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
alterator-sys feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
alteratorctl feat(cli): add alteratorctl-rs with editions module 2026-09-10 13:20:43 +00:00
po feat(cli): add alteratorctl-rs with editions module 2026-09-10 13:20:43 +00:00
.gitignore feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
Cargo.lock feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
Cargo.toml feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
Gir.toml feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00
LICENSE Initial commit 2026-09-08 22:34:45 +03:00
README.md feat(cli): add alteratorctl-rs with editions module 2026-09-10 13:20:43 +00:00
regen.sh feat(bindings): add gtk-rs gir bindings for libalterator-glib 2026-09-10 13:20:25 +00:00

alteratorctl-rs

CLI для Alterator D-Bus API на Rust. Все обращения к D-Bus идут исключительно через libalterator-glib

  • прямых вызовов D-Bus (zbus/gio) в коде нет. Модель данных alterator-entry потребляется через объекты библиотеки.

Статус

MVP: каркас CLI + модуль editions. Функциональность ограничена тем, что покрыто gir (Alterator-1.0.gir) libalterator-glib: фасад Glib, SoftwareManager, SoftwareTransaction, Edition, Component, ComponentsTree, Package, Object/Entity.

Вне scope MVP: модули services, sources, packages, manager, diag (нет покрытия в libalterator-glib), polkit-агент, completions, pager/цвета, gear-упаковка.

Требования

  • libalterator-glib >= 0.1.7 (собранная с gir: alterator-glib.pc, Alterator-1.0.gir, Alterator-1.0.typelib)
  • Rust (cargo), gtk-rs gir ветки 0.20 (только для перегенерации биндингов)
  • runtime: alterator-manager, alterator-backend-edition

Сборка

cargo build

Использование

alteratorctl-rs editions get                 # текущая редакция
alteratorctl-rs editions set NAME            # установить текущую редакцию
alteratorctl-rs editions list                # список редакций
alteratorctl-rs editions description [NAME]  # описание редакции
alteratorctl-rs editions license [NAME]      # лицензия (сырой HTML)
alteratorctl-rs editions info [NAME]         # info-текст редакции

Известные отличия от alteratorctl (C): license выводит сырой HTML (без рендера gumbo); list-available отсутствует (нет покрытия в gir).

Перегенерация биндингов

Биндинги (alterator-sys, alterator) генерируются из Alterator-1.0.gir инструментом gtk-rs gir (ветка 0.20):

cargo install --git https://github.com/gtk-rs/gir --branch 0.20
./regen.sh   # gir из ../../libalterator-glib/build или /usr/share/gir-1.0

regen.sh копирует gir в gir-files/, санитизирует известные дефекты генерации g-ir-scanner (внутренние типы AlteratorEditionInternal, typedef колбэка с _AlteratorSoftwareManager) и запускает gir для обоих крейтов.

Локализация

Интерфейс локализован на en и ru (gettext, домен alteratorctl-rs, каталог po/). Для проверки перевода без установки .mo:

msgfmt po/ru.po -o /tmp/locale/ru/LC_MESSAGES/alteratorctl-rs.mo
ALTERATORCTL_LOCALEDIR=/tmp/locale ./target/debug/alteratorctl-rs editions --help

English

Rust CLI for the Alterator D-Bus API. All D-Bus access goes exclusively through libalterator-glib (no direct zbus/gio calls). MVP scope: CLI skeleton plus the editions module (get/set/list/description/license/info), limited to what Alterator-1.0.gir covers. Bindings are generated with gtk-rs gir (0.20 branch) via regen.sh. See the Russian section above for build and usage details.

Лицензия

GPL-3.0-or-later