From d33932be6d9409e4e4a08864ec701eb517862801 Mon Sep 17 00:00:00 2001 From: Quentin Rouland Date: Tue, 7 Jan 2025 20:55:30 +0100 Subject: [PATCH] Setup git libs for Pass plugin --- CMakeLists.txt | 11 +---------- clickable.yaml | 17 +++++++++++------ plugins/Pass/git.cpp | 12 +++++++++--- plugins/Pass/git.h | 2 +- plugins/Pass/pass.cpp | 2 +- plugins/Pass/passphraseprovider.h | 1 - plugins/Utils/CMakeLists.txt | 4 ++++ 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aea1bb4..24aabec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ set(PROJECT_NAME "UTPass") set(FULL_PROJECT_NAME "utpass.qrouland") set(CMAKE_INSTALL_PREFIX /) set(DATA_DIR /) -# set(BIN_DIR ${DATA_DIR}lib/bin) + set(DESKTOP_FILE_NAME ${PROJECT_NAME}.desktop) add_executable(${PROJECT_NAME} main.cpp) @@ -41,7 +41,6 @@ configure_file(${CMAKE_CURRENT_BINARY_DIR}/manifest.json ${CMAKE_CURRENT_BINARY_ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json DESTINATION ${CMAKE_INSTALL_PREFIX}) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest_.json DESTINATION ${DATA_DIR}) -#install(DIRECTORY desktop DESTINATION ${DATA_DIR}) install(FILES ${PROJECT_NAME}.apparmor DESTINATION ${DATA_DIR}) install(FILES ${PROJECT_NAME}.contenthub DESTINATION ${DATA_DIR}) @@ -49,14 +48,6 @@ install(FILES LICENSE DESTINATION ${DATA_DIR}) install(DIRECTORY qml DESTINATION ${DATA_DIR}) install(DIRECTORY assets DESTINATION ${DATA_DIR}) -# file(GLOB_RECURSE BIN_FILES -# "/usr/bin/gpg*" -# ) -# install( -# FILES ${BIN_FILES} -# PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -# DESTINATION ${BIN_DIR} -# ) # Translations file(GLOB_RECURSE I18N_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/po qml/*.qml qml/*.js) diff --git a/clickable.yaml b/clickable.yaml index dd129cf..406cae9 100644 --- a/clickable.yaml +++ b/clickable.yaml @@ -17,12 +17,17 @@ dependencies_target: install_lib: - "libgpg-error.so.0.28.0" -- "libassuan.so" -- "libgpgme.so" -- "libgpgmepp.so" -- "libqgpgme.so.7" -- "libgit2.so" -- "libquazip5.so" +- "libassuan.so*" +- "libgpgme.so*" +- "libgpgmepp.so*" +- "libqgpgme.so*" +- "libgit2.so*" +- "libquazip5.so*" +- "libmbedtls.so*" +- "libmbedx509.so*" +- "libmbedcrypto.so*" +- "libhttp_parser.so*" +- "libssh2.so*" install_bin: - "gpg" diff --git a/plugins/Pass/git.cpp b/plugins/Pass/git.cpp index 690a146..a2a2cc5 100644 --- a/plugins/Pass/git.cpp +++ b/plugins/Pass/git.cpp @@ -20,7 +20,13 @@ Git::~Git() { git_libgit2_shutdown(); } -bool Git::clone(QString url) -{ - return false; +bool Git::clone(QString url, QString path) { + git_repository *repo = NULL; + git_clone_options opts = GIT_CLONE_OPTIONS_INIT; + + int ret = git_clone(&repo, url.toLocal8Bit().data(), path.toLocal8Bit().data(), &opts); + if (repo) { + git_repository_free(repo); + } + return ret == 0; // TODO better error handling to return specifics errors for the ui } diff --git a/plugins/Pass/git.h b/plugins/Pass/git.h index a97d8d7..f7f302f 100644 --- a/plugins/Pass/git.h +++ b/plugins/Pass/git.h @@ -21,7 +21,7 @@ public: Git(Git const &) = delete; void operator=(Git const &) = delete; - bool clone(QString url); + bool clone(QString url, QString path); }; #endif diff --git a/plugins/Pass/pass.cpp b/plugins/Pass/pass.cpp index e1c0ef7..df5bdfc 100644 --- a/plugins/Pass/pass.cpp +++ b/plugins/Pass/pass.cpp @@ -70,5 +70,5 @@ QString Pass::getPasswordStore() bool Pass::gitClone(QString url) { qInfo() << "Cloning . password_store from " << url; - return Git::instance()->clone(url); + return Git::instance()->clone(url, m_password_store); } diff --git a/plugins/Pass/passphraseprovider.h b/plugins/Pass/passphraseprovider.h index 2b7fad6..65c9509 100644 --- a/plugins/Pass/passphraseprovider.h +++ b/plugins/Pass/passphraseprovider.h @@ -7,7 +7,6 @@ #include #include #include -#include "passphraseprovider.h" #include "gpg.h" diff --git a/plugins/Utils/CMakeLists.txt b/plugins/Utils/CMakeLists.txt index d55b7d7..295bebb 100644 --- a/plugins/Utils/CMakeLists.txt +++ b/plugins/Utils/CMakeLists.txt @@ -23,6 +23,10 @@ add_library(${PLUGIN} MODULE ${SRC}) set_target_properties(${PLUGIN} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PLUGIN}) qt5_use_modules(${PLUGIN} Qml Quick DBus) +add_library(libquazip5 SHARED IMPORTED) +set_property(TARGET libquazip5 PROPERTY IMPORTED_LOCATION "/usr/lib/${ARCH_TRIPLET}/libquazip5.so") + +target_link_libraries(${PLUGIN} libquazip5) set(QT_IMPORTS_DIR "/lib/${ARCH_TRIPLET}")