feat(update): self-update from a cloned repo wherever the app is installed
Self-update assumed a conventional install prefix (silently reinstalling into ~/.local when the binary lived elsewhere) and needed a release tarball to do anything. Pick the strategy from what the machine actually has -- a local checkout, git+cmake+compiler for a clone, the prebuilt archive, or the release sources -- and always write the fresh binary next to the running one, building in a temp directory so sudo is only needed for the final copy. Bundles the UI work that depends on it (tray, shortcuts, log filter, CSV exports, cached package details), the structured log categories, and the new test targets (update-manager, AUR, plugins) wired into CTest. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
1 parent
6d5b4274c4
commit
54bff16369
9 files changed
+1123
-200
No files matched your search
+75
-1
@@ -19,6 +19,7 @@ set(SOURCES
|
||||
src/history-manager.cpp
|
||||
src/package-model.cpp
|
||||
src/update-manager.cpp
|
||||
src/app-logging.cpp
|
||||
resources/resources.qrc
|
||||
)
|
||||
|
||||
@@ -31,6 +32,7 @@ set(HEADERS
|
||||
include/history-manager.h
|
||||
include/package-model.h
|
||||
include/update-manager.h
|
||||
include/app-logging.h
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||
@@ -48,6 +50,45 @@ add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
||||
# Install
|
||||
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||
install(FILES version DESTINATION bin)
|
||||
|
||||
# Ship the providers with the install so an installed app keeps its plugins:
|
||||
# <prefix>/bin/plugins (next to the binary, first search path) and
|
||||
# <prefix>/lib/PacManager/plugins (system-wide search path).
|
||||
if(FWS_BUILD_FLATPAK_PLUGIN)
|
||||
install(FILES $<TARGET_FILE:flatpak-provider-plugin>
|
||||
DESTINATION bin/plugins)
|
||||
install(FILES $<TARGET_FILE:flatpak-provider-plugin>
|
||||
DESTINATION lib/PacManager/plugins)
|
||||
endif()
|
||||
if(FWS_BUILD_AUR_PLUGIN)
|
||||
install(FILES $<TARGET_FILE:aur-provider-plugin>
|
||||
DESTINATION bin/plugins)
|
||||
install(FILES $<TARGET_FILE:aur-provider-plugin>
|
||||
DESTINATION lib/PacManager/plugins)
|
||||
endif()
|
||||
|
||||
# Desktop entry + icon so the installed app shows up in launchers
|
||||
# (wofi, GNOME, KDE...). Icon goes to the hicolor theme, desktop file is
|
||||
# patched with the actual install prefix at install time.
|
||||
install(FILES resources/icons/package.svg
|
||||
DESTINATION share/icons/hicolor/scalable/apps
|
||||
RENAME org.fws.PacManager.svg)
|
||||
install(CODE "
|
||||
set(DESKTOP_DIR \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/share/applications\")
|
||||
file(MAKE_DIRECTORY \"\${DESKTOP_DIR}\")
|
||||
file(WRITE \"\${DESKTOP_DIR}/org.fws.PacManager.desktop\"
|
||||
\"[Desktop Entry]
|
||||
Type=Application
|
||||
Name=PacManager
|
||||
GenericName=Package Manager
|
||||
Comment=Gestionnaire de paquets pour Arch Linux
|
||||
Exec=${CMAKE_INSTALL_PREFIX}/bin/PacManager
|
||||
Icon=org.fws.PacManager
|
||||
Terminal=false
|
||||
Categories=System;PackageManager;Qt;
|
||||
StartupNotify=true
|
||||
\")
|
||||
")
|
||||
install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME})
|
||||
|
||||
# Tests
|
||||
@@ -72,6 +113,19 @@ add_executable(package-utils-test tests/package-utils.test.cpp)
|
||||
target_include_directories(package-utils-test PRIVATE include)
|
||||
add_test(NAME package-utils-test COMMAND package-utils-test)
|
||||
|
||||
add_executable(aur-manager-test tests/aur-manager.test.cpp
|
||||
plugins/aur-provider/aur-manager.cpp)
|
||||
target_include_directories(aur-manager-test PRIVATE include plugins/aur-provider)
|
||||
add_test(NAME aur-manager-test COMMAND aur-manager-test)
|
||||
|
||||
# UpdateManager::isNewerVersion is pure logic, but the file also pulls in Qt
|
||||
# Network, so the test links Core + Network (no display needed).
|
||||
add_executable(update-manager-test tests/update-manager.test.cpp
|
||||
src/update-manager.cpp src/app-logging.cpp include/update-manager.h)
|
||||
target_include_directories(update-manager-test PRIVATE include)
|
||||
target_link_libraries(update-manager-test PRIVATE Qt6::Core Qt6::Network)
|
||||
add_test(NAME update-manager-test COMMAND update-manager-test)
|
||||
|
||||
# ---- Plugins ----
|
||||
#
|
||||
# Flatpak ships as an external provider plugin (not compiled into the binary):
|
||||
@@ -81,6 +135,11 @@ add_test(NAME package-utils-test COMMAND package-utils-test)
|
||||
# Flatpak-enabled app; disable with -DFWS_BUILD_FLATPAK_PLUGIN=OFF.
|
||||
option(FWS_BUILD_FLATPAK_PLUGIN "Build the Flatpak provider plugin" ON)
|
||||
|
||||
# AUR provider plugin (yay/paru wrapper). Built by default like Flatpak;
|
||||
# disable with -DFWS_BUILD_AUR_PLUGIN=OFF. Shows "Unavailable" in the Plugins
|
||||
# page when neither yay nor paru is installed.
|
||||
option(FWS_BUILD_AUR_PLUGIN "Build the AUR provider plugin" ON)
|
||||
|
||||
# Optional example external provider plugin. Demonstrates the plugin mechanism:
|
||||
# the produced library is copied next to the executable and discovered at
|
||||
# runtime by PluginManager (see the Plugins page).
|
||||
@@ -107,6 +166,21 @@ if(FWS_BUILD_FLATPAK_PLUGIN)
|
||||
$<TARGET_FILE_DIR:PacManager>/plugins/)
|
||||
endif()
|
||||
|
||||
if(FWS_BUILD_AUR_PLUGIN)
|
||||
add_library(aur-provider-plugin MODULE
|
||||
plugins/aur-provider/aur-provider.cpp
|
||||
plugins/aur-provider/aur-manager.cpp)
|
||||
target_include_directories(aur-provider-plugin PRIVATE include plugins/aur-provider)
|
||||
set_target_properties(aur-provider-plugin PROPERTIES
|
||||
OUTPUT_NAME "aur-provider"
|
||||
CXX_STANDARD 17
|
||||
CXX_STANDARD_REQUIRED ON)
|
||||
add_custom_command(TARGET aur-provider-plugin POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:PacManager>/plugins
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:aur-provider-plugin>
|
||||
$<TARGET_FILE_DIR:PacManager>/plugins/)
|
||||
endif()
|
||||
|
||||
if(FWS_BUILD_EXAMPLE_PLUGIN)
|
||||
add_library(example-provider-plugin MODULE plugins/example-provider/example-provider.cpp)
|
||||
target_include_directories(example-provider-plugin PRIVATE include)
|
||||
@@ -141,7 +215,7 @@ endif()
|
||||
# options.
|
||||
if(FWS_BUILD_EXAMPLE_PLUGIN AND FWS_BUILD_EXAMPLE_ADDON)
|
||||
add_executable(plugin-manager-test tests/plugin-manager.test.cpp
|
||||
src/plugin-manager.cpp src/pacman-manager.cpp
|
||||
src/plugin-manager.cpp src/pacman-manager.cpp src/app-logging.cpp
|
||||
plugins/flatpak-provider/flatpak-manager.cpp)
|
||||
target_include_directories(plugin-manager-test PRIVATE include plugins/flatpak-provider)
|
||||
# Qt6::Widgets is linked so the process can load the example addon, which
|
||||
|
||||
Reference in new issue
Block a user