6 Commits
Author SHA1 Message Date
BlackAngelTV d27792975e Merge branch 'main' of https://gitea.nocode-var.tech/FWS/FWS-PacManage 2026-10-30 18:04:51 +01:00
BlackAngelTV c23308f78e Fix(update): chaine de SU 2026-10-30 18:04:04 +01:00
BlackAngelTV 9343f53bae Merge pull request 'Release 1.6.1' (#25) from release-1.6.1 into main
Reviewed-on: #25
2026-10-30 16:50:02 +00:00
BlackAngelTV 111143cd4c chore(release): 1.6.1
The journal fix and the file feedback of this branch ship together,
with nothing else: 1.6.0 stays the feature release it was.
2026-10-09 19:22:27 +02:00
BlackAngelTV 55718064a6 feat(files): confirm dropped files and refuse the ones already installed
A drop — or "Ouvrir avec PacManager" — answered nothing: a Flatpak
install walked off into the background and a plugin package landed
without a sound, so the gesture read as ignored. Both now open a
dialog saying what was taken and what it starts.

A file the machine already has is refused before anything runs, and
named. The application a file would install is read out of the file
itself (the [Flatpak Ref] section of a .flatpakref, the header of a
.flatpak bundle, the manifest of a .fwspacm) and compared with what
the provider has, so nothing is started to find out: Flatpak would
otherwise skip the install and report a success the user never got,
and a plugin package would silently replace the one in place.
2026-10-09 19:22:24 +02:00
BlackAngelTV f4aa661b54 fix(logging): keep Qt's platform chatter out of the journal
Opening a dialog under Wayland made Qt write a burst of qt.qpa
warnings into the application journal — the text-input focus one,
repeated at every prompt — where the user can do nothing with them:
they describe the display server, not the application. Those
categories stay on stderr from now on, next to everything else, while
what the application logs (its own categories, and a bare qCWarning)
keeps going to the journal.
2026-10-09 19:22:19 +02:00
23 changed files with 706 additions and 29 deletions

No files matched your search

+52 -1
View File
@@ -1,6 +1,57 @@
# ChangeLog # ChangeLog
Toutes les modifications entre la **V1.5.0** (23/09/2026) et la version courante ## V1.6.1 — branche `release-1.6.1`
Deux corrections ciblées, rien d'autre : le journal ne reprend plus le bavardage
de la couche graphique de Qt, et un fichier déposé est confirmé — ou refusé
quand la machine le possède déjà.
### Le journal ne reprend plus la sortie interne de Qt
Chaque boîte de dialogue ouverte sous Wayland faisait écrire à Qt, dans le
journal de l'application, une rafale de lignes de sa couche graphique :
```
[2026-10-09 18:49:23] [ui] mot de passe fourni
[2026-10-09 18:49:23] [qt/qt.qpa.wayland.textinput] avertissement: virtual void QtWaylandClient::QWaylandTextInputv3::disableSurface(wl_surface*) Trying to disable 0x… but 0x… is focused
```
Ces catégories (`qt.qpa.*`) décrivent le serveur d'affichage, pas
l'application, et l'utilisateur ne peut rien en faire : elles restent sur la
sortie standard — là où un développeur les cherche, la console n'ayant rien
perdu — et ne sont plus journalisées. Tout ce que l'application journalise
d'elle-même, `pacmgr.*` compris, y est toujours ; `LogManager::journalsQtCategory()`
porte la décision.
### Un fichier déposé est confirmé, et refusé s'il est déjà installé
Déposer un fichier Flatpak ou un paquet `.fwspacm` — ou l'ouvrir par « Ouvrir
avec PacManager » — répond maintenant par une boîte de dialogue : ce qui a été
pris en compte, et ce que cela déclenche (l'installation démarre et sa
progression s'affiche en bas de la fenêtre ; un plugin est installé et utilisable
sans redémarrer). Un dépôt restait sinon silencieux dès que l'installation
partait en arrière-plan.
Un fichier dont l'application est **déjà** installée est refusé avant toute
exécution, avec la raison. Le nom est lu dans le fichier lui-même — section
`[Flatpak Ref]` d'un `.flatpakref`, en-tête d'un `.flatpak`, manifeste d'un
`.fwspacm` — puis comparé à ce que le fournisseur a déjà
(`IPackageManager::fileTargetName()` / `isPackageInstalled()`). Sans cela,
Flatpak se contentait de sauter l'installation et de renvoyer un succès que
l'utilisateur n'avait pas ; réinstaller un paquet de plugin écrasait celui en
place sans le dire. Rien n'est exécuté pour lire ces fichiers, et un fichier
qu'on ne sait pas lire (dépôt, format inconnu) s'installe comme avant.
*Fichiers : `logging/log-manager.*`, `include/sdk/package-manager.h`,
`providers/flatpak-provider/flatpak-manager.*`, `core/app-core.*`,
`app/main-window.*`, les catalogues `translations/*.json`, et les tests
`flatpak-manager-test` / `app-settings-test` / `app-core-test`.*
---
## V1.6.0
Toutes les modifications entre la **V1.5.0** (23/09/2026) et la version
**1.6.0** (branche `release-1.6.0`, 33 commits, 95 fichiers touchés, **1.6.0** (branche `release-1.6.0`, 33 commits, 95 fichiers touchés,
+8 758 / −2 308 lignes). +8 758 / −2 308 lignes).
+83 -1
View File
@@ -1070,14 +1070,36 @@ void MainWindow::dropEvent(QDropEvent* event) {
void MainWindow::installLocalFiles(const QStringList& paths) { void MainWindow::installLocalFiles(const QStringList& paths) {
if (paths.isEmpty()) return; if (paths.isEmpty()) return;
QStringList files; QStringList files; // handed to a provider, one at a time
QStringList plugins; // installed on the spot
QStringList installedPackages; // already on the machine: refused
QStringList installedPlugins;
QStringList rejected; QStringList rejected;
for (const QString& path : paths) { for (const QString& path : paths) {
// A file whose application is already there is refused before anything
// runs: flatpak would skip it and report a success the user did not
// get, and re-installing a plugin package would silently replace the
// one in place.
const AppCore::FileTarget target = m_core->fileTarget(path);
if (target.installed) {
(target.plugin ? installedPlugins : installedPackages) << target.name;
LogManager::instance().logEvent(
QStringLiteral("fichier"),
tr("%1 : déjà installé, rien à faire").arg(target.name));
continue;
}
// A plugin package is installed by the core straight away: it needs no // A plugin package is installed by the core straight away: it needs no
// provider, no password and no queue, and the registry is reloaded when // provider, no password and no queue, and the registry is reloaded when
// it lands (see AppCore::installPluginPackage). // it lands (see AppCore::installPluginPackage).
if (m_core->isPluginPackage(path)) { if (m_core->isPluginPackage(path)) {
m_core->installPluginPackage(path); m_core->installPluginPackage(path);
// Only announced when its manifest could be read: a package the
// reader refuses installs nothing and is reported by the Plugins
// screen, and the window must not promise an install that is not
// happening.
if (!target.name.isEmpty()) plugins << path;
continue; continue;
} }
if (m_core->canInstallFile(path)) files << path; if (m_core->canInstallFile(path)) files << path;
@@ -1094,6 +1116,11 @@ void MainWindow::installLocalFiles(const QStringList& paths) {
.arg(QFileInfo(rejected.first()).fileName())); .arg(QFileInfo(rejected.first()).fileName()));
} }
// Nothing else in the window would tell the user their gesture landed: a
// drop starts a background install, or a plugin goes in without a sound.
announceAcceptedFiles(files, plugins);
announceInstalledFiles(installedPackages, installedPlugins);
if (files.isEmpty()) return; if (files.isEmpty()) return;
LogManager::instance().logEvent( LogManager::instance().logEvent(
@@ -1103,6 +1130,61 @@ void MainWindow::installLocalFiles(const QStringList& paths) {
if (!m_fileInstallRunning) startNextFileInstall(); if (!m_fileInstallRunning) startNextFileInstall();
} }
// What the window says about the files it just took. Without it, a drop that
// starts a background install — or a plugin that lands silently — reads as a
// gesture the application ignored.
void MainWindow::announceAcceptedFiles(const QStringList& installing,
const QStringList& plugins) {
if (installing.isEmpty() && plugins.isEmpty()) return;
QStringList lines;
for (const QString& path : installing) {
lines << tr("<b>%1</b> pris en compte : l'installation démarre, sa "
"progression s'affiche en bas de la fenêtre.")
.arg(QFileInfo(path).fileName());
}
for (const QString& path : plugins) {
lines << tr("<b>%1</b> pris en compte : le plugin est installé et "
"utilisable sans redémarrer.")
.arg(QFileInfo(path).fileName());
}
QMessageBox box(this);
box.setWindowTitle(tr("Fichiers pris en compte"));
box.setIcon(QMessageBox::Information);
box.setTextFormat(Qt::RichText);
box.setText(lines.join(QStringLiteral("<br>")));
box.setStandardButtons(QMessageBox::Ok);
box.exec();
}
// The other half of the answer: a file the machine already has is refused, and
// the user is told which one it is and what to do instead.
void MainWindow::announceInstalledFiles(const QStringList& packages,
const QStringList& plugins) {
if (packages.isEmpty() && plugins.isEmpty()) return;
QStringList lines;
for (const QString& name : packages) {
lines << tr("<b>%1</b> est déjà installé : il n'y a rien à installer. "
"Sa mise à jour se fait depuis l'écran des mises à jour.")
.arg(name);
}
for (const QString& name : plugins) {
lines << tr("<b>%1</b> : ce plugin est déjà installé. Supprimez-le "
"depuis l'écran Extensions pour en installer un autre.")
.arg(name);
}
QMessageBox box(this);
box.setWindowTitle(tr("Déjà installé"));
box.setIcon(QMessageBox::Information);
box.setTextFormat(Qt::RichText);
box.setText(lines.join(QStringLiteral("<br>")));
box.setStandardButtons(QMessageBox::Ok);
box.exec();
}
void MainWindow::startNextFileInstall() { void MainWindow::startNextFileInstall() {
if (m_pendingFileInstalls.isEmpty()) { if (m_pendingFileInstalls.isEmpty()) {
m_fileInstallRunning = false; m_fileInstallRunning = false;
+9 -1
View File
@@ -58,7 +58,9 @@ public:
// Installs the Flatpak files handed over by the desktop: dropped on the // Installs the Flatpak files handed over by the desktop: dropped on the
// window, or opened from the file manager ("Ouvrir avec PacManager", which // window, or opened from the file manager ("Ouvrir avec PacManager", which
// passes them on the command line). One install runs at a time; the rest // passes them on the command line). One install runs at a time; the rest
// wait in line. Paths the core does not recognise are reported and skipped. // wait in line. Paths the core does not recognise are reported and skipped,
// a file the machine already has is refused, and both answers are told to
// the user in a dialog — the gesture is the only thing they see.
void installLocalFiles(const QStringList& paths); void installLocalFiles(const QStringList& paths);
protected: protected:
@@ -174,6 +176,12 @@ private:
// Takes the next queued file and asks the core to install it. A core busy // Takes the next queued file and asks the core to install it. A core busy
// with another operation leaves it queued: onCoreActionFinished calls back. // with another operation leaves it queued: onCoreActionFinished calls back.
void startNextFileInstall(); void startNextFileInstall();
// What the user is told about the files just handed over: which ones were
// taken (and what each of them starts), and which ones were refused because
// the machine already has them. Two dialogs, since the two answers ask for
// different things from the user.
void announceAcceptedFiles(const QStringList& installing, const QStringList& plugins);
void announceInstalledFiles(const QStringList& packages, const QStringList& plugins);
// Logic layer: it owns the providers, the workers, the history, the // Logic layer: it owns the providers, the workers, the history, the
// credentials and the self-updater. The frame never talks to them directly. // credentials and the self-updater. The frame never talks to them directly.
+30
View File
@@ -544,6 +544,36 @@ bool AppCore::isPluginPackage(const QString& path) const {
return PluginPackage::isPackagePath(path); return PluginPackage::isPackagePath(path);
} }
AppCore::FileTarget AppCore::fileTarget(const QString& path) const {
FileTarget target;
const QString clean = path.trimmed();
if (clean.isEmpty()) return target;
// A plugin package names itself in its own manifest, and the registry knows
// whether that plugin is already there. Read only: nothing is written
// before the window has decided what to tell the user.
if (isPluginPackage(clean)) {
QString error;
const PluginPackage::Contents contents = PluginPackage::read(clean, &error);
if (!error.isEmpty()) return target; // unusable: nothing to announce
target.name = contents.manifest.id;
target.plugin = true;
target.installed = m_packages->isInstalled(target.name);
return target;
}
// A provider file: the provider owning the format names the application it
// would install, and answers whether it is already deployed.
for (IPackageManager* pm : availableProviders()) {
const std::string name = pm->fileTargetName(clean.toStdString());
if (name.empty()) continue;
target.name = QString::fromStdString(name);
target.installed = pm->isPackageInstalled(name);
return target;
}
return target;
}
AppCore::StartResult AppCore::removePackages(const std::vector<PackageInfo>& packages, AppCore::StartResult AppCore::removePackages(const std::vector<PackageInfo>& packages,
const QString& description) { Request request; const QString& description) { Request request;
request.action = QStringLiteral("cleanup"); request.action = QStringLiteral("cleanup");
+17
View File
@@ -121,6 +121,23 @@ public:
// by a provider: they carry a plugin, they are not packages to install, so // by a provider: they carry a plugin, they are not packages to install, so
// they never take the sudo gate and never enter the file install queue. // they never take the sudo gate and never enter the file install queue.
bool isPluginPackage(const QString& path) const; bool isPluginPackage(const QString& path) const;
// What a file the user drops (or opens with PacManager) would install, and
// whether that application is already on the machine. Read before anything
// runs, so the view can refuse a file the provider would only skip — or an
// install that would silently do nothing — and say why.
struct FileTarget {
// Application id for a provider file ("com.example.App"), plugin id for
// a .fwspacm. Empty when the file names no single application: a
// .flatpakrepo registers a remote, and an unreadable file names
// nothing at all.
QString name;
bool installed = false;
// A .fwspacm carries a plugin, not a package: the two are refused with
// different advice.
bool plugin = false;
};
FileTarget fileTarget(const QString& path) const;
// Bulk removal: one command per provider, run one provider at a time // Bulk removal: one command per provider, run one provider at a time
// (pacman locks its database for the whole operation). // (pacman locks its database for the whole operation).
StartResult removePackages(const std::vector<PackageInfo>& packages, StartResult removePackages(const std::vector<PackageInfo>& packages,
+9
View File
@@ -51,6 +51,15 @@ Depuis un paquet installé, la sortie part dans le journal :
journalctl --user -f | grep pacmgr journalctl --user -f | grep pacmgr
``` ```
Le journal de l'application **ne reprend pas** la sortie interne de Qt : les
catégories de la couche graphique (`qt.qpa.*`, par exemple
`qt.qpa.wayland.textinput`, qui redit un avertissement de focus à chaque boîte de
dialogue ouverte sous Wayland) décrivent le serveur d'affichage, pas
l'application, et noieraient le journal sous des lignes sur lesquelles
l'utilisateur ne peut rien. Elles restent sur la sortie standard — c'est là
qu'un développeur les cherche — et tout ce que l'application journalise
d'elle-même (événements, commandes, `pacmgr.*`) y est toujours.
Les commandes réellement lancées par les fournisseurs y sont tracées (ligne Les commandes réellement lancées par les fournisseurs y sont tracées (ligne
`$ …`, cache `cache · …`, compteurs de résultats), ce qui permet de reproduire `$ …`, cache `cache · …`, compteurs de résultats), ce qui permet de reproduire
l'échec à la main dans un terminal. Le détail est dans l'échec à la main dans un terminal. Le détail est dans
+18
View File
@@ -64,6 +64,24 @@ d'un coup s'installent **un par un** (le core n'accepte qu'une opération à la
fois) ; un paquet `.fwspacm`, lui, s'installe immédiatement, sans mot de passe fois) ; un paquet `.fwspacm`, lui, s'installe immédiatement, sans mot de passe
ni file d'attente. ni file d'attente.
Un fichier accepté est **confirmé par une boîte de dialogue** : elle nomme ce qui
vient d'être pris en compte et ce que cela déclenche (l'installation démarre et
sa progression s'affiche en bas de la fenêtre, ou le plugin est installé et
utilisable tout de suite). Sans elle, un dépôt qui lance une installation en
arrière-plan — ou qui pose un plugin sans un bruit — se lit comme un geste
ignoré.
Le cadre refuse en revanche un fichier que la machine possède **déjà**. Le
fournisseur nomme l'application que le fichier installerait
(`fileTargetName()`) et répond s'il l'a déjà (`isPackageInstalled()`), sans rien
lancer : le nom est lu dans le fichier lui-même (section `[Flatpak Ref]` d'un
`.flatpakref`, en-tête d'un `.flatpak`, manifeste d'un `.fwspacm`) et comparé à
ce qui est installé. La boîte de dialogue dit alors quel fichier est déjà
installé et quoi faire à la place : mettre à jour depuis l'écran des mises à
jour, ou supprimer le plugin depuis l'écran Extensions. Sans ce contrôle,
Flatpak se contenterait de sauter l'installation et de renvoyer un succès que
l'utilisateur n'a pas eu.
Certains widgets refusent le dépôt (`setAcceptDrops(false)`) : un `.fwspacm` Certains widgets refusent le dépôt (`setAcceptDrops(false)`) : un `.fwspacm`
lâché sur le champ de recherche ou sur celui des logs doit être traité par la lâché sur le champ de recherche ou sur celui des logs doit être traité par la
fenêtre, pas collé dans le filtre. fenêtre, pas collé dans le filtre.
+1
View File
@@ -96,6 +96,7 @@ Copiez `providers/example-provider/example-provider.cpp` comme point de départ.
| `canListCleanup()`, `listCleanupCandidates()`, `canCleanCache()`, `cleanCache()` | non | Page Nettoyage. Un fournisseur qui ne les implémente pas est simplement ignoré. | | `canListCleanup()`, `listCleanupCandidates()`, `canCleanCache()`, `cleanCache()` | non | Page Nettoyage. Un fournisseur qui ne les implémente pas est simplement ignoré. |
| `removePackages(names, callback)` | non | Suppression groupée en une commande. Le défaut (un `remove()` par entrée) convient aux `target` d'un paquet installé plusieurs fois (voir plus bas). | | `removePackages(names, callback)` | non | Suppression groupée en une commande. Le défaut (un `remove()` par entrée) convient aux `target` d'un paquet installé plusieurs fois (voir plus bas). |
| `canInstallFile(path)`, `installFile(path, callback)` | non | Installation depuis un fichier du bureau (glisser-déposer, « Ouvrir avec PacManager »). Le fournisseur ne revendique que **ses** formats : Flatpak accepte `.flatpakref`, `.flatpakrepo` et `.flatpak`, et ignore le reste. | | `canInstallFile(path)`, `installFile(path, callback)` | non | Installation depuis un fichier du bureau (glisser-déposer, « Ouvrir avec PacManager »). Le fournisseur ne revendique que **ses** formats : Flatpak accepte `.flatpakref`, `.flatpakrepo` et `.flatpak`, et ignore le reste. |
| `fileTargetName(path)`, `isPackageInstalled(name)` | non | L'application qu'un fichier installerait, et si elle est déjà là. Lue dans le fichier sans rien exécuter (section `[Flatpak Ref]` d'une référence, en-tête d'un bundle), pour refuser un fichier déjà installé au lieu de lancer une installation qui ne ferait rien. Une chaîne vide (dépôt, format inconnu, fichier illisible) signifie « rien à comparer » : le fichier s'installe normalement. |
`update("")` signifie **tout mettre à jour** : c'est ce que le worker appelle pour `update("")` signifie **tout mettre à jour** : c'est ce que le worker appelle pour
l'opération globale. l'opération globale.
+7 -5
View File
@@ -16,17 +16,17 @@ lance qu'une partie (`ctest -R progress`).
| Cible | Ce qu'elle couvre | Dépendances | | Cible | Ce qu'elle couvre | Dépendances |
| --- | --- | --- | | --- | --- | --- |
| `pacman-manager-test` | Parsing de la sortie pacman : listes, mises à jour, orphelins/étrangers, commandes construites (`removePackagesCommand`, `cleanCacheCommand`) et détection des échecs (mot de passe, verrou). | Aucune (pas de pacman). | | `pacman-manager-test` | Parsing de la sortie pacman : listes, mises à jour, orphelins/étrangers, commandes construites (`removePackagesCommand`, `cleanCacheCommand`) et détection des échecs (mot de passe, verrou). | Aucune (pas de pacman). |
| `flatpak-manager-test` | Parsing de la sortie Flatpak : recherche, listes, colonnes ; reconnaissance des formats de fichier (`.flatpakref`, `.flatpakrepo`, `.flatpak`, casse et URL) et commandes construites pour l'installation depuis un fichier (chemins entre guillemets compris) ; **installations multiples** : chaque copie nommée (`<installation>:<ref>`, version absente qui ne décale pas les colonnes), copies conservées après fusion des lignes, commandes de désinstallation et de mise à jour ciblant une copie. | Aucune. | | `flatpak-manager-test` | Parsing de la sortie Flatpak : recherche, listes, colonnes ; reconnaissance des formats de fichier (`.flatpakref`, `.flatpakrepo`, `.flatpak`, casse et URL) et commandes construites pour l'installation depuis un fichier (chemins entre guillemets compris) ; **installations multiples** : chaque copie nommée (`<installation>:<ref>`, version absente qui ne décale pas les colonnes), copies conservées après fusion des lignes, commandes de désinstallation et de mise à jour ciblant une copie ; **ce qu'un fichier installerait** : application lue dans la section `[Flatpak Ref]` d'un `.flatpakref` et dans l'en-tête d'un `.flatpak` (octets réels d'un bundle), refus d'un nom absent, d'un identifiant non conforme (injection comprise), d'une magie absente ou d'un en-tête tronqué. | Aucune. |
| `flatpak-integration-test` | **Le vrai CLI flatpak** : installation et désinstallation d'une petite application, liste, recherche, mise à jour — donc aussi le `DownloadWatcher` en conditions réelles. | `flatpak` (le test se saute s'il est absent). | | `flatpak-integration-test` | **Le vrai CLI flatpak** : installation et désinstallation d'une petite application, liste, recherche, mise à jour — donc aussi le `DownloadWatcher` en conditions réelles. | `flatpak` (le test se saute s'il est absent). |
| `aur-manager-test` | Parsing du helper AUR (yay/paru) et nettoyage des séquences ANSI. | Aucune. | | `aur-manager-test` | Parsing du helper AUR (yay/paru) et nettoyage des séquences ANSI. | Aucune. |
| `package-utils-test` | Logique partagée de `package-manager.h` : fusion des doublons entre fournisseurs, tri par fournisseur puis par nom. | Aucune. | | `package-utils-test` | Logique partagée de `package-manager.h` : fusion des doublons entre fournisseurs, tri par fournisseur puis par nom. | Aucune. |
| `progress-tracker-test` | `ProgressTracker` : compteurs pacman/Flatpak, pourcentages seuls, phases pondérées, étapes non identifiables, monotonie, faux positifs ; exécution d'une commande (`/bin/sh` en une ligne) : suppression des séquences ANSI, remontage d'une sortie au fil de l'eau, dernière ligne sans retour à la ligne, jalons de progression d'une jauge « sur place ». | Aucune, **même pas Qt**. | | `progress-tracker-test` | `ProgressTracker` : compteurs pacman/Flatpak, pourcentages seuls, phases pondérées, étapes non identifiables, monotonie, faux positifs ; exécution d'une commande (`/bin/sh` en une ligne) : suppression des séquences ANSI, remontage d'une sortie au fil de l'eau, dernière ligne sans retour à la ligne, jalons de progression d'une jauge « sur place ». | Aucune, **même pas Qt**. |
| `plugin-package-test` | Le format `.fwspacm` : lecture d'une archive valide, les deux méthodes de compression, refus d'un manifeste illisible / sans `id` / d'un format inconnu / d'une bibliothèque absente ou à nom dangereux, somme de contrôle non conforme, bibliothèque vide ; recherche de la bibliothèque par suffixe et ambiguïté ; installation, réinstallation, désinstallation, et le fait qu'une bibliothèque copiée à la main n'est jamais supprimée. | Qt Core + zlib, aucun accès réseau. | | `plugin-package-test` | Le format `.fwspacm` : lecture d'une archive valide, les deux méthodes de compression, refus d'un manifeste illisible / sans `id` / d'un format inconnu / d'une bibliothèque absente ou à nom dangereux, somme de contrôle non conforme, bibliothèque vide ; recherche de la bibliothèque par suffixe et ambiguïté ; installation, réinstallation, désinstallation, et le fait qu'une bibliothèque copiée à la main n'est jamais supprimée. | Qt Core + zlib, aucun accès réseau. |
| `app-core-test` | La couche logique : portes d'entrée (opération en cours, mot de passe, providers), file d'attente des listes, historique, mode d'identification, refus d'un fichier qu'aucun fournisseur ne sait installer ; **porte du mot de passe** : chaque chemin privilégié (install, suppression, mise à jour, globale, rafraîchissement, caches, nettoyage groupé, suppression d'une ou de plusieurs installations, libération du verrou) s'arrête là, sans lancer de commande, et sa demande reste rejouable. | Qt Core seulement — **pas** QtWidgets. | | `app-core-test` | La couche logique : portes d'entrée (opération en cours, mot de passe, providers), file d'attente des listes, historique, mode d'identification, refus d'un fichier qu'aucun fournisseur ne sait installer, et `fileTarget()` — un fichier illisible ou qu'aucun fournisseur ne revendique ne nomme rien, donc n'est jamais refusé à tort ; **porte du mot de passe** : chaque chemin privilégié (install, suppression, mise à jour, globale, rafraîchissement, caches, nettoyage groupé, suppression d'une ou de plusieurs installations, libération du verrou) s'arrête là, sans lancer de commande, et sa demande reste rejouable. | Qt Core seulement — **pas** QtWidgets. |
| `update-manager-test` | Comparaison de versions, choix de la méthode de mise à jour, et le script d'installation, exécuté pour de vrai contre un binaire en cours d'exécution. | Qt Core + Network. | | `update-manager-test` | Comparaison de versions, choix de la méthode de mise à jour, et le script d'installation, exécuté pour de vrai contre un binaire en cours d'exécution. | Qt Core + Network. |
| `startup-check-test` | La **vérification au démarrage** : parsing des deux formats (`checkupdates` puis le repli `pacman -Qu`), classement d'un paquet comme critique ou nécessitant un redémarrage, texte de la notification (dont le plafond des paquets cités), et l'unité systemd écrite **dans une arborescence temporaire** — installation, activation, suppression — jamais dans le `~/.config` de l'utilisateur. | Qt Core seulement. | | `startup-check-test` | La **vérification au démarrage** : parsing des deux formats (`checkupdates` puis le repli `pacman -Qu`), classement d'un paquet comme critique ou nécessitant un redémarrage, texte de la notification (dont le plafond des paquets cités), et l'unité systemd écrite **dans une arborescence temporaire** — installation, activation, suppression — jamais dans le `~/.config` de l'utilisateur. | Qt Core seulement. |
| `language-manager-test` | La langue : ce que le réglage résout (un code connu, un code inconnu, « système » suivant `LC_ALL`/`LC_MESSAGES`/`LANG` puis `/etc/locale.conf`, le suffixe `@mod` ignoré, une locale non couverte qui retombe sur la langue d'écriture) ; le catalogue JSON en'core (installé, chaîne traduite, chaîne inconnue qui retombe sur la source, une clé seule servie à tous les contextes) ; un catalogue cassé ou sans chaîne **refusé**, l'interface restant entière ; et la couverture : le catalogue anglais doit contenir **toute** chaîne que le code demande, sinon une chaîne se lirait en français dans une interface anglaise. | Qt Core + les ressources, aucun affichage. | | `language-manager-test` | La langue : ce que le réglage résout (un code connu, un code inconnu, « système » suivant `LC_ALL`/`LC_MESSAGES`/`LANG` puis `/etc/locale.conf`, le suffixe `@mod` ignoré, une locale non couverte qui retombe sur la langue d'écriture) ; le catalogue JSON en'core (installé, chaîne traduite, chaîne inconnue qui retombe sur la source, une clé seule servie à tous les contextes) ; un catalogue cassé ou sans chaîne **refusé**, l'interface restant entière ; et la couverture : le catalogue anglais doit contenir **toute** chaîne que le code demande, sinon une chaîne se lirait en français dans une interface anglaise. | Qt Core + les ressources, aucun affichage. |
| `app-settings-test` | Les préférences : valeurs par défaut, valeurs refusées (dossier vide, langue inconnue, taille de journal aberrante), persistance après relecture, un réglage qui n'émet que s'il change, la politique de blocage des mises à jour (durée, expiration, indefini) et — pour de vrai — le **journal** : il atterrit dans le dossier choisi, accompagne un changement de dossier, tourne au plafond de taille et garde une version précédente. | Qt Core seulement. | | `app-settings-test` | Les préférences : valeurs par défaut, valeurs refusées (dossier vide, langue inconnue, taille de journal aberrante), persistance après relecture, un réglage qui n'émet que s'il change, la politique de blocage des mises à jour (durée, expiration, indefini) et — pour de vrai — le **journal** : il atterrit dans le dossier choisi, accompagne un changement de dossier, tourne au plafond de taille et garde une version précédente ; le bavardage de la couche graphique de Qt (`qt.qpa.*`) reste sur la sortie standard au lieu de le remplir, alors que les alertes de l'application (et une `qCWarning` sans catégorie) y sont. | Qt Core seulement. |
| `cli-command-test` | La **grammaire de la ligne de commande** : ce qui demande la CLI plutôt que la fenêtre (mot-clé ou option, contre un chemin ou un fichier `.flatpak`/`.fwspacm`) et ce que chaque mot-clé donne — recherche à plusieurs mots, install/suppression de plusieurs paquets, `maj` avec ou sans nom, commandes de lecture sans argument, `-y` lu partout, `--help`/`--version` prioritaires, commande ou option inconnue. | Qt Core seulement, rien n'est lancé. | | `cli-command-test` | La **grammaire de la ligne de commande** : ce qui demande la CLI plutôt que la fenêtre (mot-clé ou option, contre un chemin ou un fichier `.flatpak`/`.fwspacm`) et ce que chaque mot-clé donne — recherche à plusieurs mots, install/suppression de plusieurs paquets, `maj` avec ou sans nom, commandes de lecture sans argument, `-y` lu partout, `--help`/`--version` prioritaires, commande ou option inconnue. | Qt Core seulement, rien n'est lancé. |
### Pourquoi `app-core-test` ne lie pas QtWidgets ### Pourquoi `app-core-test` ne lie pas QtWidgets
@@ -91,8 +91,10 @@ est donc autant une vérification de comportement qu'un garde-fou d'architecture
- L'interface, y compris le glisser-déposer sur la fenêtre (fichiers Flatpak et - L'interface, y compris le glisser-déposer sur la fenêtre (fichiers Flatpak et
paquets `.fwspacm`) : elle est vérifiée à la main (`./build/PacManager`). Le paquets `.fwspacm`) : elle est vérifiée à la main (`./build/PacManager`). Le
reste du chemin est couvert (reconnaissance des formats, refus d'un fichier reste du chemin est couvert (reconnaissance des formats, refus d'un fichier
inconnu, lecture d'un paquet, commandes construites) ; seul le geste de la inconnu, lecture d'un paquet, commandes construites, application visée par le
souris ne l'est pas. Un aperçu fichier et présence sur la machine) ; seul le geste de la souris et les deux
boîtes de dialogue qui y répondent (prise en compte, déjà installé) ne sont
pas automatisés. Un aperçu
hors écran reste possible en rendant la fenêtre avec hors écran reste possible en rendant la fenêtre avec
`QT_QPA_PLATFORM=offscreen`, ce qui est utile pour vérifier une feuille de style `QT_QPA_PLATFORM=offscreen`, ce qui est utile pour vérifier une feuille de style
(aucune alerte de parsing, couleurs attendues) sans écran. (aucune alerte de parsing, couleurs attendues) sans écran.
+20
View File
@@ -236,6 +236,26 @@ public:
return false; return false;
} }
// The application a file would install, as this provider names it
// internally ("com.example.App" for flatpak): a reference file spells it
// out, a bundle embeds it. Empty when the format is not this provider's,
// when the file names no single application (a .flatpakrepo only defines a
// remote), or when nothing can be read from it. Read without running
// anything, so the app can tell the user a file is already installed
// instead of starting an install that would do nothing.
virtual std::string fileTargetName(const std::string& path) const {
(void)path;
return {};
}
// Whether the provider already has that application, in any of its
// installations. A single lookup through the provider's own tool, cheap
// enough to run while the user is dropping a file.
virtual bool isPackageInstalled(const std::string& packageName) const {
(void)packageName;
return false;
}
// Check if the package manager is available on the system // Check if the package manager is available on the system
virtual bool isAvailable() const = 0; virtual bool isAvailable() const = 0;
+25 -14
View File
@@ -229,6 +229,13 @@ bool LogManager::hasEntries() const {
return !readFile().isEmpty(); return !readFile().isEmpty();
} }
bool LogManager::journalsQtCategory(const QString& category) {
// Only the platform plugin is filtered. A category the application chose
// (pacmgr.*, the "default" one a bare qCWarning carries) describes what the
// app did and stays in the journal.
return !category.startsWith(QStringLiteral("qt.qpa"));
}
void LogManager::installQtMessageHandler() { void LogManager::installQtMessageHandler() {
// Make sure the singleton is created on the calling (main) thread before any // Make sure the singleton is created on the calling (main) thread before any
// worker emits a log message. // worker emits a log message.
@@ -237,23 +244,27 @@ void LogManager::installQtMessageHandler() {
qInstallMessageHandler([](QtMsgType type, const QMessageLogContext& context, qInstallMessageHandler([](QtMsgType type, const QMessageLogContext& context,
const QString& message) { const QString& message) {
// Keep the usual console output too, so a developer still sees the logs // Keep the usual console output too, so a developer still sees the logs
// in a terminal. // in a terminal — including the platform chatter the journal leaves
const char* category = context.category ? context.category : "default"; // out.
std::fprintf(stderr, "[%s] %s\n", category, message.toLocal8Bit().constData()); const char* rawCategory = context.category ? context.category : "default";
std::fprintf(stderr, "[%s] %s\n", rawCategory, message.toLocal8Bit().constData());
QString level; const QString category = QString::fromLatin1(rawCategory);
switch (type) { if (journalsQtCategory(category)) {
case QtDebugMsg: level = QStringLiteral("debug"); break; QString level;
case QtInfoMsg: level = QStringLiteral("info"); break; switch (type) {
case QtWarningMsg: level = QCoreApplication::translate("LogManager", "avertissement"); break; case QtDebugMsg: level = QStringLiteral("debug"); break;
case QtCriticalMsg: level = QCoreApplication::translate("LogManager", "critique"); break; case QtInfoMsg: level = QStringLiteral("info"); break;
case QtFatalMsg: level = QStringLiteral("fatal"); break; case QtWarningMsg: level = QCoreApplication::translate("LogManager", "avertissement"); break;
case QtCriticalMsg: level = QCoreApplication::translate("LogManager", "critique"); break;
case QtFatalMsg: level = QStringLiteral("fatal"); break;
}
LogManager::instance().logEvent(
QStringLiteral("qt/%1").arg(category),
QStringLiteral("%1: %2").arg(level, message));
} }
LogManager::instance().logEvent(
QStringLiteral("qt/%1").arg(QString::fromLatin1(category)),
QStringLiteral("%1: %2").arg(level, message));
if (type == QtFatalMsg) std::abort(); if (type == QtFatalMsg) std::abort();
}); });
} }
+12 -1
View File
@@ -33,7 +33,9 @@
// //
// Every Qt log message (qCDebug/qCInfo/qCWarning/qCCritical) is funnelled into // Every Qt log message (qCDebug/qCInfo/qCWarning/qCCritical) is funnelled into
// the same journal by installQtMessageHandler(), so the categories already used // the same journal by installQtMessageHandler(), so the categories already used
// across the code base feed it without extra plumbing. // across the code base feed it without extra plumbing. Qt's own platform
// categories (`qt.qpa.*`) are the one exception: they describe the display
// server, not the application, and stay on stderr (see journalsQtCategory).
// //
// The file lives in the user's own data tree (XDG_CONFIG_HOME / home) so it is // The file lives in the user's own data tree (XDG_CONFIG_HOME / home) so it is
// never lost when a sandbox is rebuilt, and both that directory and a size cap // never lost when a sandbox is rebuilt, and both that directory and a size cap
@@ -87,6 +89,15 @@ public:
// QApplication exists. Safe to call more than once. // QApplication exists. Safe to call more than once.
static void installQtMessageHandler(); static void installQtMessageHandler();
// Whether a Qt log category belongs in the journal at all. Qt's platform
// plugins (`qt.qpa.*`: xcb, wayland, ...) narrate the display server, not
// the application: the Wayland one, for instance, repeats a warning about
// its text-input focus for every dialog the user opens, which is a line the
// user can neither read nor act on. Those keep going to stderr, where a
// developer looks for them; everything the application itself logs — its
// own categories, and a bare qCWarning — still lands in the journal.
static bool journalsQtCategory(const QString& category);
signals: signals:
// The journal changed on disk and a fresh copy of its content is available. // The journal changed on disk and a fresh copy of its content is available.
void fileUpdated(); void fileUpdated();
+109 -1
View File
@@ -14,6 +14,7 @@
#include <algorithm> #include <algorithm>
#include <cstdlib> #include <cstdlib>
#include <filesystem> #include <filesystem>
#include <fstream>
#include <set> #include <set>
#include <thread> #include <thread>
#include <utility> #include <utility>
@@ -363,6 +364,15 @@ static bool endsWith(const std::string& text, const std::string& suffix) {
&& text.compare(text.size() - suffix.size(), suffix.size(), suffix) == 0; && text.compare(text.size() - suffix.size(), suffix.size(), suffix) == 0;
} }
// Leading and trailing blanks removed, for the INI lines of a .flatpakref.
static std::string trimmed(const std::string& text) {
std::size_t begin = 0;
std::size_t end = text.size();
while (begin < end && std::isspace(static_cast<unsigned char>(text[begin]))) ++begin;
while (end > begin && std::isspace(static_cast<unsigned char>(text[end - 1]))) --end;
return text.substr(begin, end - begin);
}
// Quote one argument for the shell popen() runs, so a dropped file whose name // Quote one argument for the shell popen() runs, so a dropped file whose name
// contains spaces or quotes still reaches flatpak as a single argument. // contains spaces or quotes still reaches flatpak as a single argument.
static std::string shellQuote(const std::string& value) { static std::string shellQuote(const std::string& value) {
@@ -536,6 +546,88 @@ std::string FlatpakManager::repoNamespace(const std::string& path) {
return name.empty() ? "flatpak-repo" : name; return name.empty() ? "flatpak-repo" : name;
} }
std::string FlatpakManager::appIdFromRef(const std::string& ref) {
const std::size_t typeEnd = ref.find('/');
if (typeEnd == std::string::npos) return {};
const std::size_t idEnd = ref.find('/', typeEnd + 1);
if (idEnd == std::string::npos) return {};
// A ref is "<kind>/<id>/<arch>/<branch>", and only the two kinds flatpak
// installs name an application here.
const std::string kind = ref.substr(0, typeEnd);
if (kind != "app" && kind != "runtime") return {};
const std::string id = ref.substr(typeEnd + 1, idEnd - typeEnd - 1);
return isAppId(id) ? id : std::string();
}
std::string FlatpakManager::appIdFromRefFile(const std::string& path) {
std::ifstream file(path);
if (!file) return {};
// A .flatpakref is an INI file whose [Flatpak Ref] section names the
// application flatpak will resolve (`Name=com.example.App`); the rest of it
// describes the remote. Only that section is read.
bool inRefSection = false;
std::string line;
while (std::getline(file, line)) {
const std::string text = trimmed(line);
if (text.empty() || text[0] == '#' || text[0] == ';') continue;
if (text[0] == '[') {
inRefSection = toLower(text) == "[flatpak ref]";
continue;
}
if (!inRefSection) continue;
const std::size_t equals = text.find('=');
if (equals == std::string::npos) continue;
if (toLower(trimmed(text.substr(0, equals))) != "name") continue;
// Refused rather than handed back when it is not an application id:
// this comes straight out of a file the user dropped, and the caller
// passes it to flatpak.
const std::string id = trimmed(text.substr(equals + 1));
return isAppId(id) ? id : std::string();
}
return {};
}
std::string FlatpakManager::appIdFromBundle(const std::string& path) {
// A bundle opens with a header of its own: the magic, then the exact ref it
// installs and the application metadata, both NUL-terminated. The header is
// all that is read — the payload behind it weighs tens of megabytes and
// nothing there would answer the question.
std::ifstream file(path, std::ios::binary);
if (!file) return {};
std::array<char, 8192> buffer{};
file.read(buffer.data(), static_cast<std::streamsize>(buffer.size()));
const std::string header(buffer.data(), static_cast<std::size_t>(file.gcount()));
const std::string magic("flatpak\0", 8);
if (header.size() <= magic.size() || header.compare(0, magic.size(), magic) != 0) {
// An OCI bundle, or a file that is not one: nothing is guessed at, so
// the caller installs it the ordinary way.
return {};
}
// The ref sits behind a "ref" key. Skipping the framing between the two —
// flatpak writes sizes there of its own choosing — is what keeps this
// readable across the versions of the format.
const std::string key("ref\0", 4);
for (std::size_t at = header.find(key, magic.size()); at != std::string::npos;
at = header.find(key, at + key.size())) {
std::size_t value = at + key.size();
while (value < header.size() && header[value] == '\0') ++value;
const std::size_t end = header.find('\0', value);
if (end == std::string::npos) break;
const std::string id = appIdFromRef(header.substr(value, end - value));
if (!id.empty()) return id;
}
return {};
}
std::string FlatpakManager::installFileCommand(FileKind kind, const std::string& path, std::string FlatpakManager::installFileCommand(FileKind kind, const std::string& path,
bool userScope) { bool userScope) {
const std::string scope = userScope ? "--user " : ""; const std::string scope = userScope ? "--user " : "";
@@ -642,7 +734,7 @@ std::vector<PackageInfo> FlatpakManager::listUpdates() {
return results; return results;
} }
bool FlatpakManager::isInstalled(const std::string& appId) { bool FlatpakManager::isInstalled(const std::string& appId) const {
std::string cmd = "flatpak info " + appId + " > /dev/null 2>&1"; std::string cmd = "flatpak info " + appId + " > /dev/null 2>&1";
return system(cmd.c_str()) == 0; return system(cmd.c_str()) == 0;
} }
@@ -942,6 +1034,22 @@ bool FlatpakManager::canInstallFile(const std::string& path) const {
return classifyFile(path) != FileKind::None; return classifyFile(path) != FileKind::None;
} }
// What the user is about to install, named the way flatpak names it. A
// `.flatpakrepo` answers nothing: it registers a remote and installs no
// application, so there is nothing that could already be there.
std::string FlatpakManager::fileTargetName(const std::string& path) const {
switch (classifyFile(path)) {
case FileKind::Ref: return appIdFromRefFile(path);
case FileKind::Bundle: return appIdFromBundle(path);
default: return {};
}
}
bool FlatpakManager::isPackageInstalled(const std::string& packageName) const {
if (packageName.empty()) return false;
return isInstalled(packageName);
}
bool FlatpakManager::installFile(const std::string& path, bool FlatpakManager::installFile(const std::string& path,
ProgressCallback progressCallback) { ProgressCallback progressCallback) {
m_lastError.clear(); m_lastError.clear();
+17 -1
View File
@@ -66,6 +66,18 @@ public:
// types in `flatpak install <name> <app>`. // types in `flatpak install <name> <app>`.
static std::string repoNamespace(const std::string& path); static std::string repoNamespace(const std::string& path);
// Application a file would install. A `.flatpakref` spells it out in its
// `[Flatpak Ref]` section; a `.flatpak` bundle carries the exact ref it
// installs in its own header. Both are read without running flatpak — the
// file is already on disk — so the answer is available before anything is
// started. Empty when the file names no application or cannot be read, in
// which case the caller simply installs it.
static std::string appIdFromRefFile(const std::string& path);
static std::string appIdFromBundle(const std::string& path);
// The application id inside a ref ("app/com.example.App/x86_64/stable" ->
// "com.example.App"). Empty when the string is not a ref.
static std::string appIdFromRef(const std::string& ref);
std::vector<PackageInfo> search(const std::string& query) override; std::vector<PackageInfo> search(const std::string& query) override;
bool install(const std::string& packageName, bool install(const std::string& packageName,
ProgressCallback progressCallback) override; ProgressCallback progressCallback) override;
@@ -88,6 +100,8 @@ public:
// URL, so flatpak resolves the remote itself. // URL, so flatpak resolves the remote itself.
bool canInstallFile(const std::string& path) const override; bool canInstallFile(const std::string& path) const override;
bool installFile(const std::string& path, ProgressCallback progressCallback) override; bool installFile(const std::string& path, ProgressCallback progressCallback) override;
std::string fileTargetName(const std::string& path) const override;
bool isPackageInstalled(const std::string& packageName) const override;
// Make an app appear in the desktop's application launcher (wofi, GNOME, // Make an app appear in the desktop's application launcher (wofi, GNOME,
// KDE, ...) regardless of XDG_DATA_DIRS, like a pacman install would: link // KDE, ...) regardless of XDG_DATA_DIRS, like a pacman install would: link
@@ -102,7 +116,9 @@ public:
void integrateAllInstalled(); void integrateAllInstalled();
private: private:
bool isInstalled(const std::string& appId); // Whether that application is deployed, in any installation (flatpak info
// looks them all up). Exposed through isPackageInstalled().
bool isInstalled(const std::string& appId) const;
std::string m_lastError; std::string m_lastError;
}; };
+31
View File
@@ -2,6 +2,7 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
#include <QFile>
#include <QStringList> #include <QStringList>
#include <QTemporaryDir> #include <QTemporaryDir>
@@ -252,6 +253,35 @@ void testDatabaseLockIsQueryable() {
} }
} }
// What a file the user drops would install. Only the half that needs no
// provider is asserted here (the Flatpak side is covered by that provider's own
// test, on the bytes a bundle really carries): an unreadable package names
// nothing, so the window installs it and lets the reader report the reason.
void testFileTargetAnswersNothingForWhatItCannotRead() {
AppCore core;
assert(core.fileTarget(QString()).name.isEmpty());
assert(!core.fileTarget(QString()).installed);
assert(!core.fileTarget(QStringLiteral(" ")).installed);
// No provider claims a text document, so there is nothing to name.
assert(core.fileTarget(QStringLiteral("/tmp/liste-de-courses.txt")).name.isEmpty());
QTemporaryDir dir;
assert(dir.isValid());
const QString broken = dir.filePath(QStringLiteral("casse.fwspacm"));
QFile file(broken);
assert(file.open(QIODevice::WriteOnly));
file.write("pas une archive");
file.close();
const AppCore::FileTarget target = core.fileTarget(broken);
assert(target.name.isEmpty());
assert(!target.installed);
// It is still a plugin package by its name, which is what the window asks
// next before handing it to the installer.
assert(core.isPluginPackage(broken));
}
} // namespace } // namespace
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@@ -282,6 +312,7 @@ int main(int argc, char* argv[]) {
testLogReadReportsItsFailure(); testLogReadReportsItsFailure();
testUpdateStateIsReadableWithoutRunningAnything(); testUpdateStateIsReadableWithoutRunningAnything();
testDatabaseLockIsQueryable(); testDatabaseLockIsQueryable();
testFileTargetAnswersNothingForWhatItCannotRead();
std::cout << "app-core: all tests passed" << std::endl; std::cout << "app-core: all tests passed" << std::endl;
return 0; return 0;
+39
View File
@@ -5,6 +5,7 @@
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
#include <QFile> #include <QFile>
#include <QLoggingCategory>
#include <QObject> #include <QObject>
#include <QSettings> #include <QSettings>
#include <QString> #include <QString>
@@ -271,6 +272,43 @@ void testJournalMovesAndRotates() {
assert(journal.currentSizeBytes() > before); assert(journal.currentSizeBytes() > before);
} }
// Qt's platform plugins narrate the display server, not the application: the
// Wayland text-input warning, for one, repeats for every dialog the user opens,
// and a journal full of it is unreadable. Those categories stay on stderr; what
// the application logs — its own categories, and the "default" one a bare
// qCWarning carries — still lands in the journal.
void testPlatformChatterStaysOutOfTheJournal() {
// The decision itself first, so the test says which side a category is on
// even when nothing is written.
assert(LogManager::journalsQtCategory(QStringLiteral("default")));
assert(LogManager::journalsQtCategory(QStringLiteral("pacmgr.update")));
assert(LogManager::journalsQtCategory(QStringLiteral("qt.sql")));
assert(!LogManager::journalsQtCategory(QStringLiteral("qt.qpa.wayland.textinput")));
assert(!LogManager::journalsQtCategory(QStringLiteral("qt.qpa.xcb")));
resetSettings();
AppSettings& prefs = AppSettings::instance();
const QString dir = QDir::homePath() + QStringLiteral("/journal-c");
QFile::remove(dir + QStringLiteral("/operations.log"));
prefs.setLogDirectory(dir);
prefs.setLogMaxBytes(0);
LogManager::installQtMessageHandler();
LogManager& journal = LogManager::instance();
// An event the application writes, then the warning Qt's Wayland plugin
// repeats: the first must be in the journal, the second must not.
journal.logEvent(QStringLiteral("ui"), QStringLiteral("mot de passe fourni"));
qCWarning(QLoggingCategory("qt.qpa.wayland.textinput"))
<< "Trying to disable 0x1 but 0x2 is focused";
qCWarning(QLoggingCategory("pacmgr.update")) << "une alerte de l'application";
const QString content = journal.readFile();
assert(content.contains(QStringLiteral("mot de passe fourni")));
assert(content.contains(QStringLiteral("une alerte de l'application")));
assert(!content.contains(QStringLiteral("Trying to disable")));
}
} // namespace } // namespace
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
@@ -299,6 +337,7 @@ int main(int argc, char* argv[]) {
testUpdateBlockIsPersistedAndCleared(); testUpdateBlockIsPersistedAndCleared();
testAutomaticCheckCanBeTurnedOff(); testAutomaticCheckCanBeTurnedOff();
testJournalMovesAndRotates(); testJournalMovesAndRotates();
testPlatformChatterStaysOutOfTheJournal();
std::cout << "app-settings: all tests passed" << std::endl; std::cout << "app-settings: all tests passed" << std::endl;
return 0; return 0;
+187
View File
@@ -1,6 +1,39 @@
#include "flatpak-manager.h" #include "flatpak-manager.h"
#include <cassert> #include <cassert>
#include <filesystem>
#include <fstream>
#include <iostream> #include <iostream>
#include <string>
// The parsers below read real files, so the tests write real bytes: a scratch
// directory of our own in the system temp tree, never the user's home.
static std::filesystem::path scratchDir() {
std::error_code ec;
const std::filesystem::path dir =
std::filesystem::temp_directory_path(ec) / "pacmanager-flatpak-manager-test";
std::filesystem::create_directories(dir, ec);
return dir;
}
static std::string writeScratch(const std::string& name, const std::string& bytes) {
const std::filesystem::path path = scratchDir() / name;
std::ofstream out(path, std::ios::binary | std::ios::trunc);
out.write(bytes.data(), static_cast<std::streamsize>(bytes.size()));
out.close();
return path.string();
}
// Bytes encoded the way a hex dump reads, so a fixture can be copied from the
// real file it came from.
static std::string fromHex(const std::string& hex) {
std::string bytes;
bytes.reserve(hex.size() / 2);
for (std::size_t i = 0; i + 1 < hex.size(); i += 2) {
bytes.push_back(static_cast<char>(std::stoi(hex.substr(i, 2), nullptr, 16)));
}
return bytes;
}
static void testParseSearchOutput_parsesAlignedRows() { static void testParseSearchOutput_parsesAlignedRows() {
std::string output = std::string output =
@@ -240,6 +273,153 @@ static void testUninstallCommand_stillAcceptsAnApplicationId() {
assert(plain.find("--user") == std::string::npos); assert(plain.find("--user") == std::string::npos);
} }
// ---- What a dropped file would install ----
//
// The window asks this before it runs anything, to refuse a file the machine
// already has. Both answers are read out of the file itself: no flatpak call,
// no network, and nothing guessed at.
static void testAppIdFromRefFile_readsTheNameField() {
const std::string ref = writeScratch("org.gnome.Dictionary.flatpakref",
"[Flatpak Ref]\n"
"Title=Dictionary\n"
"Name=org.gnome.Dictionary\n"
"Branch=stable\n"
"Url=https://dl.flathub.org/repo/\n"
"SuggestRemoteName=flathub\n"
"RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo\n"
"IsRuntime=false\n");
assert(FlatpakManager::appIdFromRefFile(ref) == "org.gnome.Dictionary");
// A hand-written file: comments, blank lines, CRLF endings, spaces around
// the separator, a lower-case section, and another section behind it whose
// `Name` is not the application.
const std::string spoken = writeScratch("spaced.flatpakref",
"; written by hand\r\n"
"\r\n"
"[FLATPAK REF]\r\n"
" Name = org.gnome.Calculator \r\n"
"[Flatpak Repo]\n"
"Name=org.example.NotTheApp\n");
assert(FlatpakManager::appIdFromRefFile(spoken) == "org.gnome.Calculator");
}
static void testAppIdFromRefFile_refusesWhatNamesNoApplication() {
// The name is not in the ref section: a repository definition lists other
// keys there, and reading one of them as the application would refuse an
// install that has every right to run.
const std::string repo = writeScratch("flathub.flatpakref",
"[Flatpak Repo]\n"
"Name=org.example.NotTheApp\n"
"[Flatpak Ref]\n"
"Branch=stable\n");
assert(FlatpakManager::appIdFromRefFile(repo).empty());
// An id that is not one is refused rather than handed to flatpak: this came
// straight out of a file the user dropped.
const std::string injected = writeScratch("injected.flatpakref",
"[Flatpak Ref]\n"
"Name=org.example.App; rm -rf ~\n");
assert(FlatpakManager::appIdFromRefFile(injected).empty());
// A file that is not there, an empty one, and one that is not a ref file.
assert(FlatpakManager::appIdFromRefFile("/tmp/pacmgr-does-not-exist.flatpakref").empty());
assert(FlatpakManager::appIdFromRefFile(writeScratch("empty.flatpakref", "")).empty());
assert(FlatpakManager::appIdFromRefFile(writeScratch("junk.flatpakref", "garbage")).empty());
}
static void testAppIdFromRef_stripsKindArchAndBranch() {
assert(FlatpakManager::appIdFromRef("app/org.gnome.Calculator/x86_64/stable")
== "org.gnome.Calculator");
assert(FlatpakManager::appIdFromRef("runtime/org.freedesktop.Platform/x86_64/50")
== "org.freedesktop.Platform");
// A branch can carry a dash and a version, which is not part of the id.
assert(FlatpakManager::appIdFromRef("app/org.winehq.Wine/x86_64/stable-25.08")
== "org.winehq.Wine");
// Not a ref at all: a bare id, a kind alone, an empty string, a URL.
assert(FlatpakManager::appIdFromRef("com.example.App").empty());
assert(FlatpakManager::appIdFromRef("app/").empty());
assert(FlatpakManager::appIdFromRef("").empty());
assert(FlatpakManager::appIdFromRef("https://flathub.org/repo/app.flatpakref").empty());
// A kind flatpak does not install as an application.
assert(FlatpakManager::appIdFromRef("something/org.example.App/x86_64/stable").empty());
}
// The first bytes of a real bundle, hex-encoded exactly as `flatpak
// build-bundle` wrote them: the magic, the ref it installs, then the metadata.
static std::string bundleHeaderFixture() {
return fromHex(
"666c617470616b00010089e500750800"
"72656600000000006170702f636f6d2e"
"757365626f74746c65732e626f74746c"
"65732f7838365f36342f737461626c65"
"00007304000000006d65746164617461"
"00000000000000005b4170706c696361"
"74696f6e5d0a6e616d653d636f6d2e75"
"7365626f74746c65732e626f74746c65"
"730a72756e74696d653d6f72672e676e"
"6f6d652e506c6174666f726d2f783836"
"5f36342f35300a73");
}
static void testAppIdFromBundle_readsTheRefInTheHeader() {
const std::string bundle = writeScratch("bottles.flatpak", bundleHeaderFixture());
assert(FlatpakManager::appIdFromBundle(bundle) == "com.usebottles.bottles");
// A runtime bundle is named the same way, behind "runtime/" instead of
// "app/", and with the framing flatpak may put around the ref differing.
std::string runtime("flatpak\0", 8);
runtime += std::string("\x01\0\0\0\0\0\0\0", 8);
runtime += std::string("ref\0\0\0\0", 8);
runtime += "runtime/org.freedesktop.Platform/x86_64/50";
runtime += '\0';
runtime += "metadata";
assert(FlatpakManager::appIdFromBundle(writeScratch("platform.flatpak", runtime))
== "org.freedesktop.Platform");
}
static void testAppIdFromBundle_refusesWhatItCannotRead() {
assert(FlatpakManager::appIdFromBundle("/tmp/pacmgr-does-not-exist.flatpak").empty());
assert(FlatpakManager::appIdFromBundle(writeScratch("empty.flatpak", "")).empty());
assert(FlatpakManager::appIdFromBundle(writeScratch("plain.flatpak", "not a bundle")).empty());
// The magic alone, then a header that stops in the middle of the ref.
std::string truncated("flatpak\0", 8);
truncated += "ref\0";
assert(FlatpakManager::appIdFromBundle(writeScratch("truncated.flatpak", truncated)).empty());
// The right magic with something else behind the ref key.
std::string foreign("flatpak\0", 8);
foreign += std::string("ref\0\0\0\0\0", 9);
foreign += "garbage-not-a-ref";
foreign += '\0';
assert(FlatpakManager::appIdFromBundle(writeScratch("foreign.flatpak", foreign)).empty());
}
// A repository definition installs no application, so it answers nothing and
// is installed the ordinary way; the two other formats name what they install.
static void testFileTargetName_onlyNamesApplications() {
FlatpakManager manager;
const std::string repo = writeScratch("flathub.flatpakrepo",
"[Flatpak Repo]\n"
"Name=flathub\n"
"Url=https://dl.flathub.org/repo/\n");
assert(manager.fileTargetName(repo).empty());
const std::string ref = writeScratch("calculator.flatpakref",
"[Flatpak Ref]\n"
"Name=org.gnome.Calculator\n");
assert(manager.fileTargetName(ref) == "org.gnome.Calculator");
assert(manager.fileTargetName(writeScratch("app.flatpak", bundleHeaderFixture()))
== "com.usebottles.bottles");
// A file no format claims stays unknown rather than guessed at.
assert(manager.fileTargetName(writeScratch("documents.txt", "rien à voir")).empty());
}
int main() { int main() {
testParseSearchOutput_parsesAlignedRows(); testParseSearchOutput_parsesAlignedRows();
testParseSearchOutput_keepsMultiWordDescriptions(); testParseSearchOutput_keepsMultiWordDescriptions();
@@ -261,6 +441,13 @@ int main() {
testUninstallAndUpdateCommands_targetOneCopy(); testUninstallAndUpdateCommands_targetOneCopy();
testUninstallCommand_stillAcceptsAnApplicationId(); testUninstallCommand_stillAcceptsAnApplicationId();
testAppIdFromRefFile_readsTheNameField();
testAppIdFromRefFile_refusesWhatNamesNoApplication();
testAppIdFromRef_stripsKindArchAndBranch();
testAppIdFromBundle_readsTheRefInTheHeader();
testAppIdFromBundle_refusesWhatItCannotRead();
testFileTargetName_onlyNamesApplications();
std::cout << "All flatpak-manager tests passed." << std::endl; std::cout << "All flatpak-manager tests passed." << std::endl;
return 0; return 0;
} }
+7
View File
@@ -5,6 +5,7 @@
" PacManager reprendra ensuite l'opération automatiquement.": " PacManager setzt den Vorgang anschließend automatisch fort.", " PacManager reprendra ensuite l'opération automatiquement.": " PacManager setzt den Vorgang anschließend automatisch fort.",
"%1 (jusqu'au %2)": "%1 (bis %2)", "%1 (jusqu'au %2)": "%1 (bis %2)",
"%1 : %2": "%1: %2", "%1 : %2": "%1: %2",
"%1 : déjà installé, rien à faire": "%1: bereits installiert, nichts zu tun",
"%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: Format nicht erkannt (PacManager installiert die Dateien .flatpakref, .flatpakrepo, .flatpak sowie .fwspacm-Plugin-Pakete).", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: Format nicht erkannt (PacManager installiert die Dateien .flatpakref, .flatpakrepo, .flatpak sowie .fwspacm-Plugin-Pakete).",
"%1 Ko": "%1 KB", "%1 Ko": "%1 KB",
"%1 Mo": "%1 MB", "%1 Mo": "%1 MB",
@@ -37,6 +38,10 @@
"5 Mo": "5 MB", "5 Mo": "5 MB",
"7 jours": "7 Tage", "7 jours": "7 Tage",
"<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> verwendet die pacman-Datenbank bereits.", "<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> verwendet die pacman-Datenbank bereits.",
"<b>%1</b> : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "<b>%1</b>: Dieses Plugin ist bereits installiert. Entferne es im Bildschirm Erweiterungen, um ein anderes zu installieren.",
"<b>%1</b> est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "<b>%1</b> ist bereits installiert: es gibt nichts zu installieren. Aktualisiert wird es über den Bildschirm der Aktualisierungen.",
"<b>%1</b> pris en compte : le plugin est installé et utilisable sans redémarrer.": "<b>%1</b> berücksichtigt: das Plugin ist installiert und ohne Neustart nutzbar.",
"<b>%1</b> pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "<b>%1</b> berücksichtigt: die Installation startet, ihr Fortschritt wird unten im Fenster angezeigt.",
"<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Paketverwaltung für Arch Linux (pacman).</p>", "<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Paketverwaltung für Arch Linux (pacman).</p>",
"<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager wurde aktualisiert</h3><p>Die neue Version ist beim nächsten Start aktiv.</p><pre>%1</pre>", "<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager wurde aktualisiert</h3><p>Die neue Version ist beim nächsten Start aktiv.</p><pre>%1</pre>",
"<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 ist verfügbar</h3><p>Du verwendest derzeit Version %2.</p>", "<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 ist verfügbar</h3><p>Du verwendest derzeit Version %2.</p>",
@@ -97,6 +102,7 @@
"Dossier du journal": "Journal-Ordner", "Dossier du journal": "Journal-Ordner",
"Dossier du journal : %1": "Journal-Ordner: %1", "Dossier du journal : %1": "Journal-Ordner: %1",
"Débloquer": "Entsperren", "Débloquer": "Entsperren",
"Déjà installé": "Bereits installiert",
"Dépend de": "Hängt ab von", "Dépend de": "Hängt ab von",
"Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Lege eine Datei <code>%1</code> irgendwo im Fenster ab: Ihre Bibliothek wird nach <code>%2</code> entpackt, ohne Passwort, und das Plugin wird sofort geladen, ohne Neustart. Das Paket enthält ein Manifest <code>plugin.json</code> und die Bibliothek; es wird mit <code>./make-plugin-package.py</code> erstellt (siehe doc/plugins.md).", "Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Lege eine Datei <code>%1</code> irgendwo im Fenster ab: Ihre Bibliothek wird nach <code>%2</code> entpackt, ohne Passwort, und das Plugin wird sofort geladen, ohne Neustart. Das Paket enthält ein Manifest <code>plugin.json</code> und die Bibliothek; es wird mit <code>./make-plugin-package.py</code> erstellt (siehe doc/plugins.md).",
"Dépôt": "Repository", "Dépôt": "Repository",
@@ -123,6 +129,7 @@
"Fermer le gestionnaire": "Die Paketverwaltung schließen", "Fermer le gestionnaire": "Die Paketverwaltung schließen",
"Fichier": "Datei", "Fichier": "Datei",
"Fichier installé": "Installierte Datei", "Fichier installé": "Installierte Datei",
"Fichiers pris en compte": "Dateien berücksichtigt",
"Filtre local, instantané": "Lokaler Filter, sofort", "Filtre local, instantané": "Lokaler Filter, sofort",
"Filtrer :": "Filtern:", "Filtrer :": "Filtern:",
"Filtrer les logs (paquet, action, date)...": "Die Logs filtern (Paket, Aktion, Datum)...", "Filtrer les logs (paquet, action, date)...": "Die Logs filtern (Paket, Aktion, Datum)...",
+7
View File
@@ -5,6 +5,7 @@
" PacManager reprendra ensuite l'opération automatiquement.": " PacManager will then resume the operation automatically.", " PacManager reprendra ensuite l'opération automatiquement.": " PacManager will then resume the operation automatically.",
"%1 (jusqu'au %2)": "%1 (until %2)", "%1 (jusqu'au %2)": "%1 (until %2)",
"%1 : %2": "%1: %2", "%1 : %2": "%1: %2",
"%1 : déjà installé, rien à faire": "%1: already installed, nothing to do",
"%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: unsupported format (PacManager installs the .flatpakref, .flatpakrepo and .flatpak files, and the .fwspacm plugin packages).", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: unsupported format (PacManager installs the .flatpakref, .flatpakrepo and .flatpak files, and the .fwspacm plugin packages).",
"%1 Ko": "%1 KB", "%1 Ko": "%1 KB",
"%1 Mo": "%1 MB", "%1 Mo": "%1 MB",
@@ -37,6 +38,10 @@
"5 Mo": "5 MB", "5 Mo": "5 MB",
"7 jours": "7 days", "7 jours": "7 days",
"<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> is already using the pacman database.", "<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> is already using the pacman database.",
"<b>%1</b> : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "<b>%1</b>: this plugin is already installed. Remove it from the Extensions screen to install another one.",
"<b>%1</b> est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "<b>%1</b> is already installed: there is nothing to install. It is updated from the updates screen.",
"<b>%1</b> pris en compte : le plugin est installé et utilisable sans redémarrer.": "<b>%1</b> taken into account: the plugin is installed and usable without restarting.",
"<b>%1</b> pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "<b>%1</b> taken into account: the installation starts, its progress is shown at the bottom of the window.",
"<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Package manager for Arch Linux (pacman).</p>", "<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Package manager for Arch Linux (pacman).</p>",
"<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager has been updated</h3><p>The new version will be active on the next start.</p><pre>%1</pre>", "<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager has been updated</h3><p>The new version will be active on the next start.</p><pre>%1</pre>",
"<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 is available</h3><p>You are currently running version %2.</p>", "<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 is available</h3><p>You are currently running version %2.</p>",
@@ -97,6 +102,7 @@
"Dossier du journal": "Journal folder", "Dossier du journal": "Journal folder",
"Dossier du journal : %1": "Journal folder: %1", "Dossier du journal : %1": "Journal folder: %1",
"Débloquer": "Unblock", "Débloquer": "Unblock",
"Déjà installé": "Already installed",
"Dépend de": "Depends on", "Dépend de": "Depends on",
"Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Drop a <code>%1</code> file anywhere on the window: its library is extracted into <code>%2</code>, without a password, and the plugin is loaded right away, with no restart. The package holds a <code>plugin.json</code> manifest and the library; it is built with <code>./make-plugin-package.py</code> (see doc/plugins.md).", "Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Drop a <code>%1</code> file anywhere on the window: its library is extracted into <code>%2</code>, without a password, and the plugin is loaded right away, with no restart. The package holds a <code>plugin.json</code> manifest and the library; it is built with <code>./make-plugin-package.py</code> (see doc/plugins.md).",
"Dépôt": "Repository", "Dépôt": "Repository",
@@ -123,6 +129,7 @@
"Fermer le gestionnaire": "Close the package manager", "Fermer le gestionnaire": "Close the package manager",
"Fichier": "File", "Fichier": "File",
"Fichier installé": "Installed file", "Fichier installé": "Installed file",
"Fichiers pris en compte": "Files taken into account",
"Filtre local, instantané": "Local filter, instant", "Filtre local, instantané": "Local filter, instant",
"Filtrer :": "Filter:", "Filtrer :": "Filter:",
"Filtrer les logs (paquet, action, date)...": "Filter the logs (package, action, date)...", "Filtrer les logs (paquet, action, date)...": "Filter the logs (package, action, date)...",
+7
View File
@@ -5,6 +5,7 @@
" PacManager reprendra ensuite l'opération automatiquement.": " PacManager reanudará la operación automáticamente.", " PacManager reprendra ensuite l'opération automatiquement.": " PacManager reanudará la operación automáticamente.",
"%1 (jusqu'au %2)": "%1 (hasta %2)", "%1 (jusqu'au %2)": "%1 (hasta %2)",
"%1 : %2": "%1: %2", "%1 : %2": "%1: %2",
"%1 : déjà installé, rien à faire": "%1: ya instalado, nada que hacer",
"%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato no reconocido (PacManager instala los archivos .flatpakref, .flatpakrepo, .flatpak y los paquetes de plugin .fwspacm).", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato no reconocido (PacManager instala los archivos .flatpakref, .flatpakrepo, .flatpak y los paquetes de plugin .fwspacm).",
"%1 Ko": "%1 KB", "%1 Ko": "%1 KB",
"%1 Mo": "%1 MB", "%1 Mo": "%1 MB",
@@ -37,6 +38,10 @@
"5 Mo": "5 MB", "5 Mo": "5 MB",
"7 jours": "7 días", "7 jours": "7 días",
"<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> ya está usando la base de datos de pacman.", "<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> ya está usando la base de datos de pacman.",
"<b>%1</b> : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "<b>%1</b>: este plugin ya está instalado. Elimínalo desde la pantalla Extensiones para instalar otro.",
"<b>%1</b> est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "<b>%1</b> ya está instalado: no hay nada que instalar. Su actualización se hace desde la pantalla de actualizaciones.",
"<b>%1</b> pris en compte : le plugin est installé et utilisable sans redémarrer.": "<b>%1</b> tenido en cuenta: el plugin está instalado y se puede usar sin reiniciar.",
"<b>%1</b> pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "<b>%1</b> tenido en cuenta: la instalación comienza y su progreso se muestra en la parte inferior de la ventana.",
"<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Gestor de paquetes para Arch Linux (pacman).</p>", "<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Gestor de paquetes para Arch Linux (pacman).</p>",
"<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager se ha actualizado</h3><p>La nueva versión estará activa en el próximo inicio.</p><pre>%1</pre>", "<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager se ha actualizado</h3><p>La nueva versión estará activa en el próximo inicio.</p><pre>%1</pre>",
"<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 está disponible</h3><p>Actualmente usas la versión %2.</p>", "<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 está disponible</h3><p>Actualmente usas la versión %2.</p>",
@@ -97,6 +102,7 @@
"Dossier du journal": "Carpeta del diario", "Dossier du journal": "Carpeta del diario",
"Dossier du journal : %1": "Carpeta del diario: %1", "Dossier du journal : %1": "Carpeta del diario: %1",
"Débloquer": "Desbloquear", "Débloquer": "Desbloquear",
"Déjà installé": "Ya instalado",
"Dépend de": "Depende de", "Dépend de": "Depende de",
"Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Suelta un archivo <code>%1</code> en cualquier parte de la ventana: su biblioteca se extrae en <code>%2</code>, sin contraseña, y el plugin se carga de inmediato, sin reiniciar. El paquete contiene un manifiesto <code>plugin.json</code> y la biblioteca; se crea con <code>./make-plugin-package.py</code> (ver doc/plugins.md).", "Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Suelta un archivo <code>%1</code> en cualquier parte de la ventana: su biblioteca se extrae en <code>%2</code>, sin contraseña, y el plugin se carga de inmediato, sin reiniciar. El paquete contiene un manifiesto <code>plugin.json</code> y la biblioteca; se crea con <code>./make-plugin-package.py</code> (ver doc/plugins.md).",
"Dépôt": "Repositorio", "Dépôt": "Repositorio",
@@ -123,6 +129,7 @@
"Fermer le gestionnaire": "Cerrar el gestor", "Fermer le gestionnaire": "Cerrar el gestor",
"Fichier": "Archivo", "Fichier": "Archivo",
"Fichier installé": "Archivo instalado", "Fichier installé": "Archivo instalado",
"Fichiers pris en compte": "Archivos tenidos en cuenta",
"Filtre local, instantané": "Filtro local, instantáneo", "Filtre local, instantané": "Filtro local, instantáneo",
"Filtrer :": "Filtrar:", "Filtrer :": "Filtrar:",
"Filtrer les logs (paquet, action, date)...": "Filtrar los registros (paquete, acción, fecha)...", "Filtrer les logs (paquet, action, date)...": "Filtrar los registros (paquete, acción, fecha)...",
+7
View File
@@ -5,6 +5,7 @@
" PacManager reprendra ensuite l'opération automatiquement.": " PacManager riprenderà poi l'operazione automaticamente.", " PacManager reprendra ensuite l'opération automatiquement.": " PacManager riprenderà poi l'operazione automaticamente.",
"%1 (jusqu'au %2)": "%1 (fino al %2)", "%1 (jusqu'au %2)": "%1 (fino al %2)",
"%1 : %2": "%1: %2", "%1 : %2": "%1: %2",
"%1 : déjà installé, rien à faire": "%1: già installato, nulla da fare",
"%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato non riconosciuto (PacManager installa i file .flatpakref, .flatpakrepo, .flatpak e i pacchetti di plugin .fwspacm).", "%1 : format non reconnu (PacManager installe les fichiers .flatpakref, .flatpakrepo, .flatpak et les paquets de plugin .fwspacm).": "%1: formato non riconosciuto (PacManager installa i file .flatpakref, .flatpakrepo, .flatpak e i pacchetti di plugin .fwspacm).",
"%1 Ko": "%1 KB", "%1 Ko": "%1 KB",
"%1 Mo": "%1 MB", "%1 Mo": "%1 MB",
@@ -37,6 +38,10 @@
"5 Mo": "5 MB", "5 Mo": "5 MB",
"7 jours": "7 giorni", "7 jours": "7 giorni",
"<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> sta già usando il database di pacman.", "<b>%1</b> utilise déjà la base pacman.": "<b>%1</b> sta già usando il database di pacman.",
"<b>%1</b> : ce plugin est déjà installé. Supprimez-le depuis l'écran Extensions pour en installer un autre.": "<b>%1</b>: questo plugin è già installato. Rimuovilo dalla schermata Estensioni per installarne un altro.",
"<b>%1</b> est déjà installé : il n'y a rien à installer. Sa mise à jour se fait depuis l'écran des mises à jour.": "<b>%1</b> è già installato: non c'è nulla da installare. Il suo aggiornamento si fa dalla schermata degli aggiornamenti.",
"<b>%1</b> pris en compte : le plugin est installé et utilisable sans redémarrer.": "<b>%1</b> preso in carico: il plugin è installato e utilizzabile senza riavviare.",
"<b>%1</b> pris en compte : l'installation démarre, sa progression s'affiche en bas de la fenêtre.": "<b>%1</b> preso in carico: l'installazione inizia e il suo avanzamento è mostrato in fondo alla finestra.",
"<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Gestore di pacchetti per Arch Linux (pacman).</p>", "<h2>PacManager v%1</h2><p>Gestionnaire de paquets pour Arch Linux (pacman).</p>": "<h2>PacManager v%1</h2><p>Gestore di pacchetti per Arch Linux (pacman).</p>",
"<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager è stato aggiornato</h3><p>La nuova versione sarà attiva al prossimo avvio.</p><pre>%1</pre>", "<h3>PacManager a été mis à jour</h3><p>La nouvelle version sera active au prochain démarrage.</p><pre>%1</pre>": "<h3>PacManager è stato aggiornato</h3><p>La nuova versione sarà attiva al prossimo avvio.</p><pre>%1</pre>",
"<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 è disponibile</h3><p>Al momento usi la versione %2.</p>", "<h3>PacManager v%1 est disponible</h3><p>Vous utilisez actuellement la version %2.</p>": "<h3>PacManager v%1 è disponibile</h3><p>Al momento usi la versione %2.</p>",
@@ -97,6 +102,7 @@
"Dossier du journal": "Cartella del diario", "Dossier du journal": "Cartella del diario",
"Dossier du journal : %1": "Cartella del diario: %1", "Dossier du journal : %1": "Cartella del diario: %1",
"Débloquer": "Sblocca", "Débloquer": "Sblocca",
"Déjà installé": "Già installato",
"Dépend de": "Dipende da", "Dépend de": "Dipende da",
"Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Rilascia un file <code>%1</code> in qualsiasi punto della finestra: la sua libreria viene estratta in <code>%2</code>, senza password, e il plugin viene caricato subito, senza riavviare. Il pacchetto contiene un manifesto <code>plugin.json</code> e la libreria; si crea con <code>./make-plugin-package.py</code> (vedi doc/plugins.md).", "Déposez un fichier <code>%1</code> n'importe où sur la fenêtre : son bibliothèque est extraite dans <code>%2</code>, sans mot de passe, et le plugin est chargé immédiatement, sans redémarrer. Le paquet contient un manifeste <code>plugin.json</code> et la bibliothèque ; il se crée avec <code>./make-plugin-package.py</code> (voir doc/plugins.md).": "Rilascia un file <code>%1</code> in qualsiasi punto della finestra: la sua libreria viene estratta in <code>%2</code>, senza password, e il plugin viene caricato subito, senza riavviare. Il pacchetto contiene un manifesto <code>plugin.json</code> e la libreria; si crea con <code>./make-plugin-package.py</code> (vedi doc/plugins.md).",
"Dépôt": "Repository", "Dépôt": "Repository",
@@ -123,6 +129,7 @@
"Fermer le gestionnaire": "Chiudi il gestore", "Fermer le gestionnaire": "Chiudi il gestore",
"Fichier": "File", "Fichier": "File",
"Fichier installé": "File installato", "Fichier installé": "File installato",
"Fichiers pris en compte": "File presi in carico",
"Filtre local, instantané": "Filtro locale, istantaneo", "Filtre local, instantané": "Filtro locale, istantaneo",
"Filtrer :": "Filtra:", "Filtrer :": "Filtra:",
"Filtrer les logs (paquet, action, date)...": "Filtra i log (pacchetto, azione, data)...", "Filtrer les logs (paquet, action, date)...": "Filtra i log (pacchetto, azione, data)...",
+11 -3
View File
@@ -579,18 +579,26 @@ QString UpdateManager::stagedInstallScript() {
// Install command: the action runs in a child `sh` (so it may be a compound // Install command: the action runs in a child `sh` (so it may be a compound
// command and expands the exported paths), through sudo when a password was // command and expands the exported paths), through sudo when a password was
// provided or the target directory is not writable. // provided or the target directory is not writable.
//
// The paths are handed to the child through `env` because sudo resets the
// environment (env_reset, the default): the exports from the prologue would be
// dropped and the install script would run `mkdir -p ""` on a system-wide
// install (/usr/bin and the like). They are expanded by the unprivileged shell
// that still has them, since the action itself is single-quoted.
QString UpdateManager::installCommand(const QString& quotedPassword, QString UpdateManager::installCommand(const QString& quotedPassword,
const QString& action) const { const QString& action) const {
const QString quotedAction = quoteShell(action); const QString quotedAction = quoteShell(action);
const QString passThrough = QStringLiteral(
"env BIN_DIR=\"$BIN_DIR\" STAGE=\"$STAGE\" APP_VERSION=\"$APP_VERSION\"");
if (!quotedPassword.isEmpty()) { if (!quotedPassword.isEmpty()) {
// NOTE: single %s — QString::arg() only substitutes %1..%99. // NOTE: single %s — QString::arg() only substitutes %1..%99.
return QStringLiteral("printf '%s\\n' %1 | sudo -S sh -c %2 2>&1\n") return QStringLiteral("printf '%s\\n' %1 | sudo -S %2 sh -c %3 2>&1\n")
.arg(quotedPassword, quotedAction); .arg(quotedPassword, passThrough, quotedAction);
} }
if (QFileInfo(binDir()).isWritable()) { if (QFileInfo(binDir()).isWritable()) {
return QStringLiteral("sh -c %1 2>&1\n").arg(quotedAction); return QStringLiteral("sh -c %1 2>&1\n").arg(quotedAction);
} }
return QStringLiteral("sudo sh -c %1 2>&1\n").arg(quotedAction); return QStringLiteral("sudo %1 sh -c %2 2>&1\n").arg(passThrough, quotedAction);
} }
QString UpdateManager::quotedBinDir() const { QString UpdateManager::quotedBinDir() const {
+1 -1
View File
@@ -1 +1 @@
1.6.0 1.6.1