Skip to content

Refactor/overhaul - #41

Draft
michadasis wants to merge 15 commits into
mainfrom
refactor/overhaul
Draft

michadasis wants to merge 15 commits into
mainfrom
refactor/overhaul

Conversation

@michadasis

@michadasis michadasis commented Oct 11, 2026 •

Copy link
Copy Markdown
Member

Refactors the install logic and fixes several bugs found along the way. Builds with no warnings (-Wall -Wextra -Wpedantic, treated as errors in CI), and all unit tests pass on Qt 6.12.

Refactoring

  • Package manager backends. The new PackageManager interface has PacmanBackend and AptBackend implementations. Each backend holds its repo check, install command, environment and progress parsing. This replaces the four near-identical branches in read_package_list and the "pacman"/"apt" string checks that were spread across the code.
  • Core library. Everything except the widgets is now built as unibackpack_core, so the tests can link against it.
  • One package list per department. pacman_list.txt and apt_list.txt are replaced by a single packages.json that lists each tool once with its package name for each manager. The current lists convert one-to-one. FreeCAD and Wireshark still have only a pacman entry, as before.
  • MainWindow split up. The 100-line click handler is now split into smaller functions, the "__back__" list row is replaced by a real Back button, and the package manager is detected once at startup.
  • Translations.
    • University and department names now carry their translations in universities.json. Before, lupdate would mark the hand-added .ts entries as obsolete.
    • Every user-facing string goes through tr().
    • applyTranslator is now utils/language.* and handles any language, not just Greek.
  • Package lists are bundled automatically from resources/lists/ instead of being listed by hand in resources.qrc.

Bug fixes

  • UI stuck after a failed start. If pkexec (or apt-cache/pacman) failed to start, the UI stayed disabled forever. Failures now always end the run with an error message.
  • Frozen UI while checking packages. Each package was checked with a separate blocking process plus processEvents(). All packages are now checked in one non-blocking call.
  • Lost environment. pkexec clears the environment, so DEBIAN_FRONTEND never reached apt. Commands now run through env, with LC_ALL=C so the output can be parsed on non-English systems. The polkit prompt will now show /usr/bin/env as the program. A small helper with its own polkit .policy would fix that, and is left for a follow-up PR.
  • Stale apt package lists. apt now runs apt-get update before apt-get install, in the same pkexec call so the user authorizes once. Without it, a system whose lists are out of date could fail with 404 errors while downloading. The update only refreshes the lists and upgrades nothing. pacman is unchanged: it still installs with -S and warns the user to run pacman -Syu themselves first.
  • Possible hang in apt. The install process now gets an empty standard input, and dpkg runs with --force-confdef --force-confold. Before, upgrading a package with a locally modified config file made dpkg wait for an answer forever, while the window could not be closed.
  • Progress bar:
    • The pacman patterns didn't match what pacman 6 prints without a terminal.
    • apt's bar jumped backwards between download and install.
    • Output chunks that split a line broke progress parsing.
  • Details panel. The output view rendered package output as HTML. It is now plain text.
  • Departments without a package list used to fail with a generic "Installation failed". They are now greyed out.
  • Language selector. It showed "English" on Greek systems even though the UI was in Greek.
  • Warning dialog.
    • Downloader no longer shows dialogs itself.
    • The pacman warning now has Continue/Cancel.
    • The pacman warning's Greek translation was never used because the string was registered under the wrong context. Fixed.
  • Status messages. Failures now say why: authorization cancelled, not authorized, or the exit code.
  • Cancelling and closing during an install.
    • A new Cancel button stops the run while the packages are being checked and while the polkit prompt is open. Closing the window at that point cancels too.
    • Once apt or pacman runs as root it can no longer be stopped by the app, and interrupting it could break the package database. The Cancel button is then disabled with a tooltip explaining why, and closing the window is blocked until the install finishes.
    • This also fixes a possible crash on close.
  • Wayland icon. setDesktopFileName now matches unibackpack.desktop.
  • Doxygen output. Placeholders like <language> and <university> were read as HTML tags and disappeared from the generated docs. They are now escaped.

Build, CI and packaging

  • Unit tests (Qt Test) cover both availability parsers and both progress parsers, the apt install command, the JSON loaders, and the bundled data: icons exist, every list parses and matches a department in universities.json.
  • CI
    • Builds the project and runs ctest on Ubuntu (apt, Qt 6.4) and in an Arch Linux container (pacman), not just cppcheck. It also checks the install layout on Arch.
    • Compiles with -Wall -Wextra -Wpedantic -Werror (the UNIBACKPACK_WERROR CMake option, off by default for local builds).
    • cppcheck now covers src/, include/ and tests/, with Qt's macros understood (--library=qt).
    • A new job generates the Doxygen docs, fails on any warning, and uploads the HTML as the docs-html artifact. Missing @param/@return are not reported, because most functions are documented in one line that names their parameters with @p.
    • Read-only permissions.
  • CMake install now covers the .desktop file and icon, so the PKGBUILD's package() is a single cmake --install, and it runs the tests in check().
  • Cleanup: the unused Qt6::Network dependency, dead declarations, stale includes and the empty menu bar are removed.
  • Docs:
    • Doxygen briefs for all new and changed public APIs.
    • README restructured to follow the UniOS docs guidelines: corrected CMake version and Debian packages, plus sections on package lists, building, tests and adding a department.
    • Added .editorconfig.

Testing

  • Builds with no warnings (MinGW 13.1 with Qt 6.12, GCC on Ubuntu and Arch in CI)
  • Unit tests pass (ctest)
  • Doxygen and cppcheck pass in CI
  • lupdate finds all 34 strings with no obsolete entries, all translated to Greek
  • App starts and shows translated university names and status messages
  • Full install on Ubuntu (apt): repo check, polkit prompt, apt-get update, progress, success and failure
  • Full install on Arch (pacman): same, including the Continue/Cancel warning
  • Cancel on both: while checking, at the polkit prompt, and disabled once the install has started

@michadasis
michadasis requested a review from TolisSth October 11, 2026 12:33
@michadasis michadasis added documentation Improvements or additions to documentation enhancement New feature or request build.unios-project.eu After the merge of this PR you should rebuild the package in our build server labels Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build.unios-project.eu After the merge of this PR you should rebuild the package in our build server documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant