Merge pull request 'Add option to keep AUR packages' (#11) from matthiakl/pamac-classic:store_aur_pkgs into master

Reviewed-on: #11
This commit is contained in:
Chris Cromer 2021-07-10 15:58:09 -04:00
commit cdd9088d91
6 changed files with 156 additions and 26 deletions

View File

@ -847,6 +847,65 @@ All AUR users should be familiar with the build process.</property>
<property name="position">3</property> <property name="position">3</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkBox" id="box4">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">26</property>
<property name="spacing">12</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkSwitch" id="aur_keep_pkgs_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Keep built packages</property>
<property name="halign">end</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_start">6</property>
<property name="margin_end">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="aur_move_dir_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="aur_move_dir_file_chooser">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="margin_left">24</property>
<property name="action">select-folder</property>
<property name="title" translatable="yes"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="name">aur</property> <property name="name">aur</property>

View File

@ -28,5 +28,19 @@
Directory where to build packages that come from the AUR Directory where to build packages that come from the AUR
</description> </description>
</key> </key>
<key name="aur-keep-pkgs" type="b">
<default>false</default>
<summary>Copy AUR packages</summary>
<description>
Save built packages on disk
</description>
</key>
<key name="move-directory" type="s">
<default l10n="messages">""</default>
<summary>AUR package directory</summary>
<description>
Directory where to move built packages that come from the AUR
</description>
</key>
</schema> </schema>
</schemalist> </schemalist>

View File

@ -27,7 +27,7 @@ msgstr ""
"Project-Id-Version: manjaro-pamac\n" "Project-Id-Version: manjaro-pamac\n"
"Report-Msgid-Bugs-To: cromer@cromnix.org\n" "Report-Msgid-Bugs-To: cromer@cromnix.org\n"
"POT-Creation-Date: 2020-03-29 21:48-0300\n" "POT-Creation-Date: 2020-03-29 21:48-0300\n"
"PO-Revision-Date: 2017-07-30 02:40+0000\n" "PO-Revision-Date: 2021-07-08 16:25+0200\n"
"Last-Translator: philm <philm@manjaro.org>\n" "Last-Translator: philm <philm@manjaro.org>\n"
"Language-Team: German (http://www.transifex.com/manjarolinux/manjaro-pamac/" "Language-Team: German (http://www.transifex.com/manjarolinux/manjaro-pamac/"
"language/de/)\n" "language/de/)\n"
@ -92,17 +92,17 @@ msgstr "Paket %s hat keine gültige Architektur"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
#, c-format #, c-format
msgid "unable to satisfy dependency '%s' required by %s" msgid "unable to satisfy dependency '%s' required by %s"
msgstr "" msgstr "Kann Abhängigkeit '%s' von %s nicht erfüllen"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
#, c-format #, c-format
msgid "installing %s (%s) breaks dependency '%s' required by %s" msgid "installing %s (%s) breaks dependency '%s' required by %s"
msgstr "" msgstr "Installation von %s (%s) verletzt Abhängigkeit '%s' von %s"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
#, c-format #, c-format
msgid "removing %s breaks dependency '%s' required by %s" msgid "removing %s breaks dependency '%s' required by %s"
msgstr "" msgstr "Entfernen von %s verletzt Abhängigkeit '%s' von %s"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
#, c-format #, c-format
@ -112,7 +112,7 @@ msgstr "%s und %s stehen im Konflikt zueinander"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
#, c-format #, c-format
msgid "%s needs to be removed but it is a locked package" msgid "%s needs to be removed but it is a locked package"
msgstr "%s soll entfernt werden, ist aber ein gesperrtes Paket " msgstr "%s soll entfernt werden, ist aber ein gesperrtes Paket"
#: ../src/pamac-system-daemon/system_daemon.vala #: ../src/pamac-system-daemon/system_daemon.vala
msgid "Failed to commit transaction" msgid "Failed to commit transaction"
@ -190,7 +190,7 @@ msgstr "Wird neu installiert"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "To upgrade" msgid "To upgrade"
msgstr "" msgstr "Zu aktualisieren"
#: ../src/transaction.vala ../src/pamac-manager/manager_window.vala #: ../src/transaction.vala ../src/pamac-manager/manager_window.vala
msgid "Total download size" msgid "Total download size"
@ -344,11 +344,11 @@ msgstr "Es gibt nichts zu tun"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "Transaction successful" msgid "Transaction successful"
msgstr "" msgstr "Transaktion erfolgreich"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "The transaction has been completed successfully" msgid "The transaction has been completed successfully"
msgstr "" msgstr "Die Transaktion wurde erfolgreich abgeschlossen"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "Transaction successfully finished" msgid "Transaction successfully finished"
@ -356,15 +356,17 @@ msgstr "Vorgang erfolgreich abgeschlossen"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "Transaction failed" msgid "Transaction failed"
msgstr "" msgstr "Transaktion fehlgeschlagen"
#: ../src/transaction.vala #: ../src/transaction.vala
msgid "The transaction failed and no packages have been updated/installed" msgid "The transaction failed and no packages have been updated/installed"
msgstr "" msgstr ""
"Die Transaktion ist fehlgeschlagen und es wurden keine Pakete aktualisiert/"
"installiert"
#: ../src/pamac-install/installer.vala #: ../src/pamac-install/installer.vala
msgid "Unable to lock database!" msgid "Unable to lock database!"
msgstr "" msgstr "Kann Datenbank nicht sperren!"
#: ../src/pamac-tray/tray.vala ../src/pamac-manager/manager_window.vala #: ../src/pamac-tray/tray.vala ../src/pamac-manager/manager_window.vala
msgid "Your system is up-to-date" msgid "Your system is up-to-date"
@ -396,7 +398,7 @@ msgstr "Pamac wird bereits ausgeführt"
#: ../src/pamac-manager/manager.vala #: ../src/pamac-manager/manager.vala
msgid "Refresh Databases" msgid "Refresh Databases"
msgstr "" msgstr "Datenbanken aktualisieren"
#: ../src/pamac-manager/manager.vala ../data/interface/manager_window.ui #: ../src/pamac-manager/manager.vala ../data/interface/manager_window.ui
msgid "View History" msgid "View History"
@ -417,7 +419,7 @@ msgstr "Über"
#: ../src/pamac-manager/manager.vala #: ../src/pamac-manager/manager.vala
msgid "Quit" msgid "Quit"
msgstr "" msgstr "Schließen"
#: ../src/pamac-manager/manager_window.vala #: ../src/pamac-manager/manager_window.vala
msgid "Deselect" msgid "Deselect"
@ -425,7 +427,7 @@ msgstr "Abwählen"
#: ../src/pamac-manager/manager_window.vala #: ../src/pamac-manager/manager_window.vala
msgid "Upgrade" msgid "Upgrade"
msgstr "" msgstr "Aktualisieren"
#: ../src/pamac-manager/manager_window.vala ../data/interface/manager_window.ui #: ../src/pamac-manager/manager_window.vala ../data/interface/manager_window.ui
msgid "Install" msgid "Install"
@ -480,11 +482,11 @@ msgstr "Paketquelle"
#: ../src/pamac-manager/manager_window.vala #: ../src/pamac-manager/manager_window.vala
msgid "Download size" msgid "Download size"
msgstr "" msgstr "Download Größe"
#: ../src/pamac-manager/manager_window.vala #: ../src/pamac-manager/manager_window.vala
msgid "Installed size" msgid "Installed size"
msgstr "" msgstr "Installierte Größe"
#: ../src/pamac-manager/manager_window.vala ../data/interface/manager_window.ui #: ../src/pamac-manager/manager_window.vala ../data/interface/manager_window.ui
msgid "Groups" msgid "Groups"
@ -603,7 +605,11 @@ msgstr "Anzahl der im Cache verbleibenden Paketversionen"
#: ../src/preferences_dialog.vala #: ../src/preferences_dialog.vala
msgid "Build directory" msgid "Build directory"
msgstr "" msgstr "Build Verzeichnis"
#: ../src/preferences_dialog.vala
msgid "Package directory"
msgstr "Paket Verzeichnis"
#: ../src/preferences_dialog.vala #: ../src/preferences_dialog.vala
msgid "Worldwide" msgid "Worldwide"
@ -664,7 +670,7 @@ msgstr "Paketquellen"
#: ../data/interface/manager_window.ui #: ../data/interface/manager_window.ui
msgid "Updates" msgid "Updates"
msgstr "" msgstr "Aktualisierungen"
#: ../data/interface/manager_window.ui #: ../data/interface/manager_window.ui
msgid "Version" msgid "Version"
@ -724,7 +730,7 @@ msgstr "Suche nach Aktualisierungen"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Update files databases (more details but slower)" msgid "Update files databases (more details but slower)"
msgstr "" msgstr "Aktualisiere Datei-Datenbanken (mehr Details, aber langsamer)"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Hide tray icon when no update available" msgid "Hide tray icon when no update available"
@ -742,19 +748,19 @@ msgstr "Allgemein"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Background color:" msgid "Background color:"
msgstr "" msgstr "Hintergrund Farbe:"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Text color:" msgid "Text color:"
msgstr "" msgstr "Text Farbe:"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Font:" msgid "Font:"
msgstr "" msgstr "Schrift:"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Terminal" msgid "Terminal"
msgstr "" msgstr "Terminal"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Use mirrors from:" msgid "Use mirrors from:"
@ -798,6 +804,10 @@ msgstr "Suche standardmäßig im AUR"
msgid "Check for updates from AUR" msgid "Check for updates from AUR"
msgstr "Suche nach Aktualisierungen aus dem AUR" msgstr "Suche nach Aktualisierungen aus dem AUR"
#: ../data/interface/preferences_dialog.ui
msgid "Keep built packages"
msgstr "Behalte erstellte Pakete"
#: ../data/interface/preferences_dialog.ui #: ../data/interface/preferences_dialog.ui
msgid "Remove only the versions of uninstalled packages" msgid "Remove only the versions of uninstalled packages"
msgstr "Entferne nur Versionen von deinstallierten Paketen" msgstr "Entferne nur Versionen von deinstallierten Paketen"

View File

@ -31,6 +31,8 @@ namespace Pamac {
public bool search_aur { get; private set; } public bool search_aur { get; private set; }
public string aur_build_dir { get; private set; } public string aur_build_dir { get; private set; }
public bool check_aur_updates { get; private set; } public bool check_aur_updates { get; private set; }
public bool aur_keep_pkgs { get; private set; }
public string aur_move_dir { get; private set; }
#endif #endif
public uint64 keep_num_pkgs { get; private set; } public uint64 keep_num_pkgs { get; private set; }
public bool rm_only_uninstalled { get; private set; } public bool rm_only_uninstalled { get; private set; }
@ -92,6 +94,8 @@ namespace Pamac {
search_aur = settings.get_boolean ("search-in-aur"); search_aur = settings.get_boolean ("search-in-aur");
check_aur_updates = settings.get_boolean ("check-aur-updates"); check_aur_updates = settings.get_boolean ("check-aur-updates");
aur_build_dir = settings.get_string ("build-directory"); aur_build_dir = settings.get_string ("build-directory");
aur_keep_pkgs = settings.get_boolean("aur-keep-pkgs");
aur_move_dir = settings.get_string("move-directory");
#endif #endif
} }
} }

View File

@ -65,6 +65,12 @@ namespace Pamac {
unowned Gtk.FileChooserButton aur_build_dir_file_chooser; unowned Gtk.FileChooserButton aur_build_dir_file_chooser;
[GtkChild] [GtkChild]
unowned Gtk.CheckButton check_aur_updates_checkbutton; unowned Gtk.CheckButton check_aur_updates_checkbutton;
[GtkChild]
unowned Gtk.Switch aur_keep_pkgs_button;
[GtkChild]
unowned Gtk.Label aur_move_dir_label;
[GtkChild]
unowned Gtk.FileChooserButton aur_move_dir_file_chooser;
#endif #endif
[GtkChild] [GtkChild]
unowned Gtk.Label cache_keep_nb_label; unowned Gtk.Label cache_keep_nb_label;
@ -94,6 +100,7 @@ namespace Pamac {
stack.remove (aur_config_box); stack.remove (aur_config_box);
#else #else
aur_build_dir_label.set_markup (dgettext (null, "Build directory") +":"); aur_build_dir_label.set_markup (dgettext (null, "Build directory") +":");
aur_move_dir_label.set_markup (dgettext (null, "Package directory") +":");
#endif #endif
remove_unrequired_deps_button.active = transaction.recurse; remove_unrequired_deps_button.active = transaction.recurse;
update_files_db_button.active = transaction.update_files_db; update_files_db_button.active = transaction.update_files_db;
@ -193,6 +200,13 @@ namespace Pamac {
search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled); search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled);
aur_build_dir_file_chooser.file_set.connect (on_aur_build_dir_set); aur_build_dir_file_chooser.file_set.connect (on_aur_build_dir_set);
check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_checkbutton_toggled); check_aur_updates_checkbutton.toggled.connect (on_check_aur_updates_checkbutton_toggled);
aur_keep_pkgs_button.sensitive = transaction.enable_aur;
aur_keep_pkgs_button.active = transaction.aur_keep_pkgs;
aur_keep_pkgs_button.state_set.connect(on_aur_keep_pkgs_button_state_set);
aur_move_dir_label.sensitive = transaction.enable_aur && transaction.aur_keep_pkgs;
aur_move_dir_file_chooser.sensitive = transaction.enable_aur && transaction.aur_keep_pkgs;
aur_move_dir_file_chooser.set_filename(transaction.aur_move_dir);
aur_move_dir_file_chooser.file_set.connect(on_aur_move_dir_set);
#endif #endif
} }
@ -290,6 +304,14 @@ namespace Pamac {
return true; return true;
} }
bool on_aur_keep_pkgs_button_state_set (bool new_state) {
var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("aur-keep-pkgs", new_state);
config_changed();
transaction.start_save_pamac_config ();
return true;
}
void on_search_aur_checkbutton_toggled () { void on_search_aur_checkbutton_toggled () {
var settings = new Settings ("org.pamac.aur"); var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("search-in-aur", search_aur_checkbutton.active); settings.set_boolean ("search-in-aur", search_aur_checkbutton.active);
@ -304,6 +326,13 @@ namespace Pamac {
transaction.start_save_pamac_config (); transaction.start_save_pamac_config ();
} }
void on_aur_move_dir_set () {
var settings = new Settings ("org.pamac.aur");
settings.set_string ("move-directory", aur_move_dir_file_chooser.get_filename ());
config_changed();
transaction.start_save_pamac_config ();
}
void on_check_aur_updates_checkbutton_toggled () { void on_check_aur_updates_checkbutton_toggled () {
var settings = new Settings ("org.pamac.aur"); var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("check-aur-updates", check_aur_updates_checkbutton.active); settings.set_boolean ("check-aur-updates", check_aur_updates_checkbutton.active);
@ -341,6 +370,10 @@ namespace Pamac {
aur_build_dir_file_chooser.sensitive = transaction.enable_aur; aur_build_dir_file_chooser.sensitive = transaction.enable_aur;
check_aur_updates_checkbutton.active = transaction.check_aur_updates; check_aur_updates_checkbutton.active = transaction.check_aur_updates;
check_aur_updates_checkbutton.sensitive = transaction.enable_aur; check_aur_updates_checkbutton.sensitive = transaction.enable_aur;
aur_keep_pkgs_button.sensitive = transaction.enable_aur;
aur_keep_pkgs_button.state = transaction.aur_keep_pkgs;
aur_move_dir_label.sensitive = transaction.enable_aur && transaction.aur_keep_pkgs;
aur_move_dir_file_chooser.sensitive = transaction.enable_aur && transaction.aur_keep_pkgs;
#endif #endif
} }

View File

@ -114,7 +114,7 @@ namespace Pamac {
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon); public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else #else
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates); bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates, bool aur_keep_pkgs, string aur_move_dir);
#endif #endif
public signal void write_alpm_config_finished (bool checkspace); public signal void write_alpm_config_finished (bool checkspace);
public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method); public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method);
@ -146,6 +146,8 @@ namespace Pamac {
public bool enable_aur { get { return pamac_config.enable_aur; } } public bool enable_aur { get { return pamac_config.enable_aur; } }
public bool search_aur { get { return pamac_config.search_aur; } } public bool search_aur { get { return pamac_config.search_aur; } }
public string aur_build_dir { get { return pamac_config.aur_build_dir; } } public string aur_build_dir { get { return pamac_config.aur_build_dir; } }
public bool aur_keep_pkgs { get { return pamac_config.aur_keep_pkgs; } }
public string aur_move_dir { get { return pamac_config.aur_move_dir; } }
#endif #endif
public uint64 keep_num_pkgs { get { return pamac_config.keep_num_pkgs; } } public uint64 keep_num_pkgs { get { return pamac_config.keep_num_pkgs; } }
public bool rm_only_uninstalled { get { return pamac_config.rm_only_uninstalled; } } public bool rm_only_uninstalled { get { return pamac_config.rm_only_uninstalled; } }
@ -228,7 +230,7 @@ namespace Pamac {
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon); public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else #else
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates); bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates, bool aur_keep_pkgs, string aur_move_dir);
#endif #endif
public signal void write_alpm_config_finished (bool checkspace); public signal void write_alpm_config_finished (bool checkspace);
public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method); public signal void write_mirrors_config_finished (string choosen_country, string choosen_generation_method);
@ -1401,12 +1403,20 @@ namespace Pamac {
foreach (unowned string path in standard_output.split ("\n")) { foreach (unowned string path in standard_output.split ("\n")) {
if (path != "" && !(path in built_pkgs)) { if (path != "" && !(path in built_pkgs)) {
built_pkgs += path; built_pkgs += path;
if(aur_keep_pkgs) {
File pkg_file = GLib.File.new_for_path (path);
File target_file = GLib.File.new_build_filename (aur_move_dir, pkg_file.get_basename());
pkg_file.copy (target_file, OVERWRITE);
}
} }
} }
} }
} catch (SpawnError e) { } catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message); stderr.printf ("SpawnError: %s\n", e.message);
status = 1; status = 1;
} catch (GLib.Error e) {
stderr.printf ("GLib Error: %s\n", e.message);
status = 1;
} }
} }
} }
@ -2094,7 +2104,7 @@ namespace Pamac {
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) { void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
#else #else
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon, void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates) { bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates, bool aur_keep_pkgs, string aur_move_dir) {
#endif #endif
system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished); system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished);
pamac_config.reload (); pamac_config.reload ();
@ -2106,7 +2116,7 @@ namespace Pamac {
save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon); save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon);
#else #else
save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon, save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
enable_aur, search_aur, aur_build_dir, check_aur_updates); enable_aur, search_aur, aur_build_dir, check_aur_updates, aur_keep_pkgs, aur_move_dir);
#endif #endif
} }