fix(build): cmake
This commit is contained in:
1 parent
1242753962
commit
4a773c63ce
17 files changed
+78
-73
No files matched your search
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(PackageManager VERSION 1.0.0 LANGUAGES CXX)
|
project(PacManager VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# PackageMapper 📦
|
# PacManager 📦
|
||||||
|
|
||||||
Gestionnaire de paquets unifié avec support d'extensions pour Arch Linux.
|
Gestionnaire de paquets unifié avec support d'extensions pour Arch Linux.
|
||||||
|
|
||||||
@@ -70,10 +70,10 @@ sudo make install
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Depuis le dossier build
|
# Depuis le dossier build
|
||||||
./PackageMapper
|
./PacManager
|
||||||
|
|
||||||
# Ou depuis /usr/bin après install
|
# Ou depuis /usr/bin après install
|
||||||
PackageMapper
|
PacManager
|
||||||
```
|
```
|
||||||
|
|
||||||
## Plugin Universal 🌍
|
## Plugin Universal 🌍
|
||||||
@@ -120,7 +120,7 @@ Si aucun paquet n'est trouvé, le plugin :
|
|||||||
```bash
|
```bash
|
||||||
# Installer le plugin universal
|
# Installer le plugin universal
|
||||||
make universal_plugin
|
make universal_plugin
|
||||||
cp plugins/universal/libuniversal.so ~/.local/lib/PackageMapper/plugins/
|
cp plugins/universal/libuniversal.so ~/.local/lib/PacManager/plugins/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Installation des plugins
|
## Installation des plugins
|
||||||
@@ -128,9 +128,9 @@ cp plugins/universal/libuniversal.so ~/.local/lib/PackageMapper/plugins/
|
|||||||
Les plugins sont des bibliothèques partagées `.so` qui s'auto-chargent.
|
Les plugins sont des bibliothèques partagées `.so` qui s'auto-chargent.
|
||||||
|
|
||||||
### Emplacements recherchés (par ordre) :
|
### Emplacements recherchés (par ordre) :
|
||||||
1. `~/.local/lib/PackageMapper/plugins/`
|
1. `~/.local/lib/PacManager/plugins/`
|
||||||
2. `/usr/lib/PackageMapper/plugins/`
|
2. `/usr/lib/PacManager/plugins/`
|
||||||
3. `/usr/local/lib/PackageMapper/plugins/`
|
3. `/usr/local/lib/PacManager/plugins/`
|
||||||
4. `./plugins/` (relatif à l'exécutable)
|
4. `./plugins/` (relatif à l'exécutable)
|
||||||
|
|
||||||
### Compiler uniquement les plugins
|
### Compiler uniquement les plugins
|
||||||
@@ -146,10 +146,10 @@ make pkg_plugin
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Pour l'utilisateur courant
|
# Pour l'utilisateur courant
|
||||||
mkdir -p ~/.local/lib/PackageMapper/plugins
|
mkdir -p ~/.local/lib/PacManager/plugins
|
||||||
cp build/plugins/pacman/libpacman.so ~/.local/lib/PackageMapper/plugins/
|
cp build/plugins/pacman/libpacman.so ~/.local/lib/PacManager/plugins/
|
||||||
cp build/plugins/apt/libapt.so ~/.local/lib/PackageMapper/plugins/
|
cp build/plugins/apt/libapt.so ~/.local/lib/PacManager/plugins/
|
||||||
cp build/plugins/pkg/libpkg.so ~/.local/lib/PackageMapper/plugins/
|
cp build/plugins/pkg/libpkg.so ~/.local/lib/PacManager/plugins/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Créer un plugin
|
## Créer un plugin
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo "🔨 Compilation de PackageMapper..."
|
echo "🔨 Compilation de PacManager..."
|
||||||
|
|
||||||
# Create build directory
|
# Create build directory
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
@@ -19,12 +19,12 @@ echo ""
|
|||||||
echo "✅ Compilation terminée !"
|
echo "✅ Compilation terminée !"
|
||||||
echo ""
|
echo ""
|
||||||
echo "📋 Pour lancer :"
|
echo "📋 Pour lancer :"
|
||||||
echo " ./PackageMapper"
|
echo " ./PacManager"
|
||||||
echo ""
|
echo ""
|
||||||
echo "📋 Pour installer :"
|
echo "📋 Pour installer :"
|
||||||
echo " sudo make install"
|
echo " sudo make install"
|
||||||
echo ""
|
echo ""
|
||||||
echo "📋 Pour copier les plugins (user mode) :"
|
echo "📋 Pour copier les plugins (user mode) :"
|
||||||
echo " mkdir -p ~/.local/lib/PackageMapper/plugins"
|
echo " mkdir -p ~/.local/lib/PacManager/plugins"
|
||||||
echo " cp plugins/*/lib*.so ~/.local/lib/PackageMapper/plugins/"
|
echo " cp plugins/*/lib*.so ~/.local/lib/PacManager/plugins/"
|
||||||
echo ""
|
echo ""
|
||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
@echo off
|
@echo off
|
||||||
echo ============================================
|
echo ============================================
|
||||||
echo PackageMapper - Build Windows
|
echo PacManager - Build Windows
|
||||||
echo ============================================
|
echo ============================================
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ if errorlevel 1 (
|
|||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [3/4] Copie des DLLs...
|
echo [3/4] Copie des DLLs...
|
||||||
"%MSYS2_SHELL%" -defterm -no-start -mingw64 -c "cd /e/dev/gestionnaire/build_windows && ldd PackageManager.exe 2>/dev/null | grep 'mingw64' | awk '{print $3}' | while read dll; do cp \"$dll\" . 2>/dev/null; done"
|
"%MSYS2_SHELL%" -defterm -no-start -mingw64 -c "cd /e/dev/gestionnaire/build_windows && ldd PacManager.exe 2>/dev/null | grep 'mingw64' | awk '{print $3}' | while read dll; do cp \"$dll\" . 2>/dev/null; done"
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo [4/4] Copie des DLLs des plugins...
|
echo [4/4] Copie des DLLs des plugins...
|
||||||
@@ -47,11 +47,11 @@ echo [4/4] Copie des DLLs des plugins...
|
|||||||
echo.
|
echo.
|
||||||
echo ============================================
|
echo ============================================
|
||||||
echo BUILD REUSSI !
|
echo BUILD REUSSI !
|
||||||
echo Executable : build_windows\PackageManager.exe
|
echo Executable : build_windows\PacManager.exe
|
||||||
echo ============================================
|
echo ============================================
|
||||||
echo.
|
echo.
|
||||||
echo Pour lancer :
|
echo Pour lancer :
|
||||||
echo cd build_windows
|
echo cd build_windows
|
||||||
echo PackageManager.exe
|
echo PacManager.exe
|
||||||
echo.
|
echo.
|
||||||
pause
|
pause
|
||||||
@@ -17,7 +17,7 @@ struct HistoryEntry {
|
|||||||
|
|
||||||
class HistoryManager {
|
class HistoryManager {
|
||||||
public:
|
public:
|
||||||
HistoryManager(const std::string& historyFile = "~/.local/share/PackageMapper/history.csv");
|
HistoryManager(const std::string& historyFile = "~/.local/share/PacManager/history.csv");
|
||||||
~HistoryManager();
|
~HistoryManager();
|
||||||
|
|
||||||
void record(const HistoryEntry& entry);
|
void record(const HistoryEntry& entry);
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
PLUGIN_DIR="$HOME/.local/lib/PackageMapper/plugins"
|
PLUGIN_DIR="$HOME/.local/lib/PacManager/plugins"
|
||||||
|
|
||||||
echo "📦 Installation des plugins..."
|
echo "📦 Installation des plugins..."
|
||||||
|
|
||||||
@@ -22,4 +22,4 @@ fi
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "📁 Plugins installés dans: $PLUGIN_DIR"
|
echo "📁 Plugins installés dans: $PLUGIN_DIR"
|
||||||
echo "🔄 Redémarrez PackageMapper pour charger les nouveaux plugins."
|
echo "🔄 Redémarrez PacManager pour charger les nouveaux plugins."
|
||||||
@@ -3,6 +3,6 @@ target_include_directories(apt_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
|||||||
set_target_properties(apt_plugin PROPERTIES
|
set_target_properties(apt_plugin PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
OUTPUT_NAME "apt"
|
OUTPUT_NAME "apt"
|
||||||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
|
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
|
||||||
)
|
)
|
||||||
install(TARGETS apt_plugin DESTINATION lib/PackageMapper/plugins)
|
install(TARGETS apt_plugin DESTINATION lib/PacManager/plugins)
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
||||||
|
|
||||||
std::string output = exec(("sudo apt install -y " + packageName + " 2>&1").c_str());
|
std::string output = exec(("pkexec apt install -y " + packageName + " 2>&1").c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
std::istringstream iss(output);
|
std::istringstream iss(output);
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
||||||
|
|
||||||
std::string output = exec(("sudo apt remove -y " + packageName + " 2>&1").c_str());
|
std::string output = exec(("pkexec apt remove -y " + packageName + " 2>&1").c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
std::istringstream iss(output);
|
std::istringstream iss(output);
|
||||||
@@ -97,12 +97,12 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
||||||
if (packageName.empty()) {
|
if (packageName.empty()) {
|
||||||
if (progressCallback) progressCallback("Mise à jour des paquets...");
|
if (progressCallback) progressCallback("Mise à jour des paquets...");
|
||||||
exec("sudo apt update 2>&1");
|
exec("pkexec apt update 2>&1");
|
||||||
exec("sudo apt upgrade -y 2>&1");
|
exec("pkexec apt upgrade -y 2>&1");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
||||||
exec(("sudo apt install --only-upgrade -y " + packageName + " 2>&1").c_str());
|
exec(("pkexec apt install --only-upgrade -y " + packageName + " 2>&1").c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ target_include_directories(pacman_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
|||||||
set_target_properties(pacman_plugin PROPERTIES
|
set_target_properties(pacman_plugin PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
OUTPUT_NAME "pacman"
|
OUTPUT_NAME "pacman"
|
||||||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
|
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
|
||||||
)
|
)
|
||||||
install(TARGETS pacman_plugin DESTINATION lib/PackageMapper/plugins)
|
install(TARGETS pacman_plugin DESTINATION lib/PacManager/plugins)
|
||||||
@@ -89,7 +89,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
||||||
|
|
||||||
std::string cmd = "sudo pacman -S --noconfirm " + packageName + " 2>&1";
|
std::string cmd = "pkexec pacman -S --noconfirm " + packageName + " 2>&1";
|
||||||
std::string output = exec(cmd.c_str());
|
std::string output = exec(cmd.c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
@@ -107,7 +107,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
||||||
|
|
||||||
std::string cmd = "sudo pacman -R --noconfirm " + packageName + " 2>&1";
|
std::string cmd = "pkexec pacman -R --noconfirm " + packageName + " 2>&1";
|
||||||
std::string output = exec(cmd.c_str());
|
std::string output = exec(cmd.c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
@@ -125,12 +125,12 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
||||||
if (packageName.empty()) {
|
if (packageName.empty()) {
|
||||||
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
|
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
|
||||||
std::string cmd = "sudo pacman -Syu --noconfirm 2>&1";
|
std::string cmd = "pkexec pacman -Syu --noconfirm 2>&1";
|
||||||
exec(cmd.c_str());
|
exec(cmd.c_str());
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
||||||
std::string cmd = "sudo pacman -S --noconfirm " + packageName + " 2>&1";
|
std::string cmd = "pkexec pacman -S --noconfirm " + packageName + " 2>&1";
|
||||||
exec(cmd.c_str());
|
exec(cmd.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ target_include_directories(pkg_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
|||||||
set_target_properties(pkg_plugin PROPERTIES
|
set_target_properties(pkg_plugin PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
OUTPUT_NAME "pkg"
|
OUTPUT_NAME "pkg"
|
||||||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
|
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
|
||||||
)
|
)
|
||||||
install(TARGETS pkg_plugin DESTINATION lib/PackageMapper/plugins)
|
install(TARGETS pkg_plugin DESTINATION lib/PacManager/plugins)
|
||||||
@@ -66,7 +66,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
if (progressCallback) progressCallback("Installation de " + packageName + "...");
|
||||||
|
|
||||||
std::string output = exec(("sudo pkg install -y " + packageName + " 2>&1").c_str());
|
std::string output = exec(("pkexec pkg install -y " + packageName + " 2>&1").c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
std::istringstream iss(output);
|
std::istringstream iss(output);
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback) override {
|
std::function<void(const std::string&)> progressCallback) override {
|
||||||
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
if (progressCallback) progressCallback("Suppression de " + packageName + "...");
|
||||||
|
|
||||||
std::string output = exec(("sudo pkg delete -y " + packageName + " 2>&1").c_str());
|
std::string output = exec(("pkexec pkg delete -y " + packageName + " 2>&1").c_str());
|
||||||
|
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
std::istringstream iss(output);
|
std::istringstream iss(output);
|
||||||
@@ -100,11 +100,11 @@ public:
|
|||||||
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
std::function<void(const std::string&)> progressCallback = nullptr) override {
|
||||||
if (packageName.empty()) {
|
if (packageName.empty()) {
|
||||||
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
|
if (progressCallback) progressCallback("Mise à jour de tous les paquets...");
|
||||||
exec("sudo pkg upgrade -y 2>&1");
|
exec("pkexec pkg upgrade -y 2>&1");
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
if (progressCallback) progressCallback("Mise à jour de " + packageName + "...");
|
||||||
exec(("sudo pkg install -y " + packageName + " 2>&1").c_str());
|
exec(("pkexec pkg install -y " + packageName + " 2>&1").c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ target_include_directories(universal_plugin PRIVATE ${CMAKE_SOURCE_DIR}/include)
|
|||||||
set_target_properties(universal_plugin PROPERTIES
|
set_target_properties(universal_plugin PROPERTIES
|
||||||
PREFIX ""
|
PREFIX ""
|
||||||
OUTPUT_NAME "universal"
|
OUTPUT_NAME "universal"
|
||||||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PackageMapper/plugins"
|
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib/PacManager/plugins"
|
||||||
)
|
)
|
||||||
install(TARGETS universal_plugin DESTINATION lib/PackageMapper/plugins)
|
install(TARGETS universal_plugin DESTINATION lib/PacManager/plugins)
|
||||||
@@ -227,7 +227,7 @@ public:
|
|||||||
for (auto& mgr : m_managers) {
|
for (auto& mgr : m_managers) {
|
||||||
if (!mgr.available) continue;
|
if (!mgr.available) continue;
|
||||||
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
||||||
std::string cmd = "sudo " + mgr.updateCmd + " 2>&1";
|
std::string cmd = "pkexec sh -c \"" + mgr.updateCmd + "\" 2>&1";
|
||||||
exec(cmd.c_str());
|
exec(cmd.c_str());
|
||||||
}
|
}
|
||||||
// Flatpak
|
// Flatpak
|
||||||
@@ -238,7 +238,7 @@ public:
|
|||||||
// Snap
|
// Snap
|
||||||
if (m_hasSnap) {
|
if (m_hasSnap) {
|
||||||
if (progressCallback) progressCallback("🔄 Mise à jour Snap...");
|
if (progressCallback) progressCallback("🔄 Mise à jour Snap...");
|
||||||
exec("sudo snap refresh 2>&1");
|
exec("pkexec snap refresh 2>&1");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ public:
|
|||||||
if (!mgr.available) continue;
|
if (!mgr.available) continue;
|
||||||
if (isInstalledWithManager(mgr, packageName)) {
|
if (isInstalledWithManager(mgr, packageName)) {
|
||||||
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
if (progressCallback) progressCallback("🔄 Mise à jour via " + mgr.name + "...");
|
||||||
std::string cmd = "sudo " + mgr.installCmd + " " + packageName + " 2>&1";
|
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + packageName + "\" 2>&1";
|
||||||
exec(cmd.c_str());
|
exec(cmd.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -410,7 +410,14 @@ private:
|
|||||||
// Parse common formats: "name version - description" or "name version description"
|
// Parse common formats: "name version - description" or "name version description"
|
||||||
size_t spacePos = line.find(' ');
|
size_t spacePos = line.find(' ');
|
||||||
if (spacePos != std::string::npos) {
|
if (spacePos != std::string::npos) {
|
||||||
pkg.name = line.substr(0, spacePos);
|
// Strip repository prefix (e.g. "extra/vlc" -> "vlc")
|
||||||
|
std::string firstToken = line.substr(0, spacePos);
|
||||||
|
size_t slashPos = firstToken.find('/');
|
||||||
|
if (slashPos != std::string::npos) {
|
||||||
|
pkg.name = firstToken.substr(slashPos + 1);
|
||||||
|
} else {
|
||||||
|
pkg.name = firstToken;
|
||||||
|
}
|
||||||
size_t nextSpace = line.find(' ', spacePos + 1);
|
size_t nextSpace = line.find(' ', spacePos + 1);
|
||||||
if (nextSpace != std::string::npos) {
|
if (nextSpace != std::string::npos) {
|
||||||
pkg.version = line.substr(spacePos + 1, nextSpace - spacePos - 1);
|
pkg.version = line.substr(spacePos + 1, nextSpace - spacePos - 1);
|
||||||
@@ -430,7 +437,7 @@ private:
|
|||||||
|
|
||||||
bool installWithManager(const DetectedManager& mgr, const std::string& pkg,
|
bool installWithManager(const DetectedManager& mgr, const std::string& pkg,
|
||||||
std::function<void(const std::string&)> progressCallback) {
|
std::function<void(const std::string&)> progressCallback) {
|
||||||
std::string cmd = "sudo " + mgr.installCmd + " " + pkg + " 2>&1";
|
std::string cmd = "pkexec sh -c \"" + mgr.installCmd + " " + pkg + "\" 2>&1";
|
||||||
std::string output = exec(cmd.c_str());
|
std::string output = exec(cmd.c_str());
|
||||||
if (progressCallback) {
|
if (progressCallback) {
|
||||||
std::istringstream iss(output);
|
std::istringstream iss(output);
|
||||||
@@ -444,7 +451,7 @@ private:
|
|||||||
|
|
||||||
bool removeWithManager(const DetectedManager& mgr, const std::string& pkg,
|
bool removeWithManager(const DetectedManager& mgr, const std::string& pkg,
|
||||||
std::function<void(const std::string&)> progressCallback) {
|
std::function<void(const std::string&)> progressCallback) {
|
||||||
std::string cmd = "sudo " + mgr.removeCmd + " " + pkg + " 2>&1";
|
std::string cmd = "pkexec sh -c \"" + mgr.removeCmd + " " + pkg + "\" 2>&1";
|
||||||
exec(cmd.c_str());
|
exec(cmd.c_str());
|
||||||
return !isInstalledWithManager(mgr, pkg);
|
return !isInstalledWithManager(mgr, pkg);
|
||||||
}
|
}
|
||||||
@@ -497,15 +504,21 @@ private:
|
|||||||
PackageInfo pkg;
|
PackageInfo pkg;
|
||||||
size_t tabPos = line.find('\t');
|
size_t tabPos = line.find('\t');
|
||||||
if (tabPos != std::string::npos) {
|
if (tabPos != std::string::npos) {
|
||||||
|
// Columns: Name, Description, Application ID, Version, Branch, Remote
|
||||||
|
size_t descTab = line.find('\t', tabPos + 1);
|
||||||
|
size_t idTab = line.find('\t', descTab + 1);
|
||||||
|
if (descTab != std::string::npos && idTab != std::string::npos) {
|
||||||
|
pkg.description = line.substr(tabPos + 1, descTab - tabPos - 1);
|
||||||
|
pkg.name = line.substr(descTab + 1, idTab - descTab - 1); // App ID
|
||||||
|
} else {
|
||||||
pkg.name = line.substr(0, tabPos);
|
pkg.name = line.substr(0, tabPos);
|
||||||
size_t nextTab = line.find('\t', tabPos + 1);
|
|
||||||
if (nextTab != std::string::npos) {
|
|
||||||
pkg.description = line.substr(tabPos + 1, nextTab - tabPos - 1);
|
|
||||||
}
|
}
|
||||||
pkg.installed = isFlatpakInstalled(pkg.name);
|
pkg.installed = isFlatpakInstalled(pkg.name);
|
||||||
|
if (!pkg.name.empty()) {
|
||||||
results.push_back(pkg);
|
results.push_back(pkg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -583,14 +596,14 @@ private:
|
|||||||
bool installSnap(const std::string& pkg,
|
bool installSnap(const std::string& pkg,
|
||||||
std::function<void(const std::string&)> progressCallback) {
|
std::function<void(const std::string&)> progressCallback) {
|
||||||
if (progressCallback) progressCallback("📦 Installation Snap: " + pkg + "...");
|
if (progressCallback) progressCallback("📦 Installation Snap: " + pkg + "...");
|
||||||
exec(("sudo snap install " + pkg + " 2>&1").c_str());
|
exec(("pkexec snap install " + pkg + " 2>&1").c_str());
|
||||||
return isSnapInstalled(pkg);
|
return isSnapInstalled(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool removeSnap(const std::string& pkg,
|
bool removeSnap(const std::string& pkg,
|
||||||
std::function<void(const std::string&)> progressCallback) {
|
std::function<void(const std::string&)> progressCallback) {
|
||||||
if (progressCallback) progressCallback("🗑️ Suppression Snap: " + pkg + "...");
|
if (progressCallback) progressCallback("🗑️ Suppression Snap: " + pkg + "...");
|
||||||
exec(("sudo snap remove " + pkg + " 2>&1").c_str());
|
exec(("pkexec snap remove " + pkg + " 2>&1").c_str());
|
||||||
return !isSnapInstalled(pkg);
|
return !isSnapInstalled(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-12
@@ -328,8 +328,8 @@ void MainWindow::setupMenuBar() {
|
|||||||
// Help menu
|
// Help menu
|
||||||
QMenu* helpMenu = menuBar->addMenu("Aide");
|
QMenu* helpMenu = menuBar->addMenu("Aide");
|
||||||
helpMenu->addAction("À propos", [this]() {
|
helpMenu->addAction("À propos", [this]() {
|
||||||
QMessageBox::about(this, "PackageMapper",
|
QMessageBox::about(this, "PacManager",
|
||||||
"<h2>PackageMapper v1.0.0</h2>"
|
"<h2>PacManager v1.0.0</h2>"
|
||||||
"<p>Gestionnaire de paquets unifié avec support d'extensions.</p>"
|
"<p>Gestionnaire de paquets unifié avec support d'extensions.</p>"
|
||||||
"<p>Système de plugins : chargez des gestionnaires supplémentaires "
|
"<p>Système de plugins : chargez des gestionnaires supplémentaires "
|
||||||
"pour gérer apt, pkg, et bien d'autres.</p>"
|
"pour gérer apt, pkg, et bien d'autres.</p>"
|
||||||
@@ -340,16 +340,8 @@ void MainWindow::setupMenuBar() {
|
|||||||
void MainWindow::loadPlugins() {
|
void MainWindow::loadPlugins() {
|
||||||
m_pluginSelector->clear();
|
m_pluginSelector->clear();
|
||||||
|
|
||||||
// Try to load from default paths
|
// The PluginManager constructor already loads plugins from all default
|
||||||
m_pluginManager->loadPluginsFromDirectory("/usr/lib/PackageMapper/plugins");
|
// search paths (~/.local/lib, /usr/lib, /usr/local/lib, ./plugins).
|
||||||
m_pluginManager->loadPluginsFromDirectory("/usr/local/lib/PackageMapper/plugins");
|
|
||||||
|
|
||||||
char* home = getenv("HOME");
|
|
||||||
if (home) {
|
|
||||||
std::string userPluginDir = std::string(home) + "/.local/lib/PackageMapper/plugins";
|
|
||||||
m_pluginManager->loadPluginsFromDirectory(userPluginDir);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t count = m_pluginManager->getPluginCount();
|
size_t count = m_pluginManager->getPluginCount();
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
m_pluginSelector->addItem("Aucun plugin chargé");
|
m_pluginSelector->addItem("Aucun plugin chargé");
|
||||||
|
|||||||
@@ -10,16 +10,16 @@ PluginManager::PluginManager() {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
char* appdata = getenv("APPDATA");
|
char* appdata = getenv("APPDATA");
|
||||||
if (appdata) {
|
if (appdata) {
|
||||||
m_searchPaths.push_back(std::string(appdata) + "\\PackageMapper\\plugins");
|
m_searchPaths.push_back(std::string(appdata) + "\\PacManager\\plugins");
|
||||||
}
|
}
|
||||||
m_searchPaths.push_back(".\\plugins");
|
m_searchPaths.push_back(".\\plugins");
|
||||||
#else
|
#else
|
||||||
char* home = getenv("HOME");
|
char* home = getenv("HOME");
|
||||||
if (home) {
|
if (home) {
|
||||||
m_searchPaths.push_back(std::string(home) + "/.local/lib/PackageMapper/plugins");
|
m_searchPaths.push_back(std::string(home) + "/.local/lib/PacManager/plugins");
|
||||||
}
|
}
|
||||||
m_searchPaths.push_back("/usr/lib/PackageMapper/plugins");
|
m_searchPaths.push_back("/usr/lib/PacManager/plugins");
|
||||||
m_searchPaths.push_back("/usr/local/lib/PackageMapper/plugins");
|
m_searchPaths.push_back("/usr/local/lib/PacManager/plugins");
|
||||||
#endif
|
#endif
|
||||||
m_searchPaths.push_back("./plugins");
|
m_searchPaths.push_back("./plugins");
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
app.setApplicationName("PackageMapper");
|
app.setApplicationName("PacManager");
|
||||||
app.setApplicationVersion("1.0.0");
|
app.setApplicationVersion("1.0.0");
|
||||||
app.setOrganizationName("Freebuff");
|
app.setOrganizationName("Freebuff");
|
||||||
|
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
window.setWindowTitle("PackageMapper - Gestionnaire de Paquets");
|
window.setWindowTitle("PacManager - Gestionnaire de Paquets");
|
||||||
window.resize(1000, 700);
|
window.resize(1000, 700);
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user