diff --git a/data/config/pamac.conf b/data/config/pamac.conf
index 1790da1..6d6c210 100644
--- a/data/config/pamac.conf
+++ b/data/config/pamac.conf
@@ -19,5 +19,8 @@ RefreshPeriod = 6
## When AUR support is enabled check for updates from AUR:
#CheckAURUpdates
+## AUR build directory:
+BuildDirectory = /tmp
+
## Do not ask for confirmation when building packages:
#NoConfirmBuild
diff --git a/po/pamac.pot b/po/pamac.pot
index 554843c..db19312 100644
--- a/po/pamac.pot
+++ b/po/pamac.pot
@@ -549,6 +549,10 @@ msgstr ""
msgid "Number of versions of each package to keep in the cache"
msgstr ""
+#: ../src/preferences_dialog.vala
+msgid "Build directory"
+msgstr ""
+
#: ../src/preferences_dialog.vala
msgid "Worldwide"
msgstr ""
diff --git a/resources/preferences_dialog.ui b/resources/preferences_dialog.ui
index bf50579..abf6812 100644
--- a/resources/preferences_dialog.ui
+++ b/resources/preferences_dialog.ui
@@ -620,6 +620,48 @@ All AUR users should be familiar with the build process.
2
+
+
+
+ False
+ True
+ 3
+
+
Check for updates from AUR
diff --git a/src/pamac_config.vala b/src/pamac_config.vala
index a0116d4..b2cee75 100644
--- a/src/pamac_config.vala
+++ b/src/pamac_config.vala
@@ -27,6 +27,7 @@ namespace Pamac {
public bool no_update_hide_icon { get; private set; }
public bool enable_aur { get; private set; }
public bool search_aur { get; private set; }
+ public string aur_build_dir { get; private set; }
public bool check_aur_updates { get; private set; }
public unowned HashTable environment_variables {
get {
@@ -71,6 +72,7 @@ namespace Pamac {
no_update_hide_icon = false;
enable_aur = false;
search_aur = false;
+ aur_build_dir = "/tmp";
check_aur_updates = false;
parse_file (conf_path);
}
@@ -109,6 +111,10 @@ namespace Pamac {
enable_aur = true;
} else if (key == "SearchInAURByDefault") {
search_aur = true;
+ } else if (key == "BuildDirectory") {
+ if (splitted.length == 2) {
+ aur_build_dir = splitted[1]._strip ();
+ }
} else if (key == "CheckAURUpdates") {
check_aur_updates = true;
}
@@ -188,6 +194,13 @@ namespace Pamac {
} else {
data.append (line + "\n");
}
+ } else if (line.contains ("BuildDirectory")) {
+ if (new_conf.lookup_extended ("BuildDirectory", null, out variant)) {
+ data.append ("BuildDirectory = %s\n".printf (variant.get_string ()));
+ new_conf.remove ("BuildDirectory");
+ } else {
+ data.append (line + "\n");
+ }
} else if (line.contains ("CheckAURUpdates")) {
if (new_conf.lookup_extended ("CheckAURUpdates", null, out variant)) {
if (variant.get_boolean ()) {
@@ -244,6 +257,8 @@ namespace Pamac {
} else {
data.append ("#SearchInAURByDefault\n");
}
+ } else if (key == "BuildDirectory") {
+ data.append ("BuildDirectory = %s\n".printf (val.get_string ()));
} else if (key == "CheckAURUpdates") {
if (val.get_boolean ()) {
data.append ("CheckAURUpdates\n");
diff --git a/src/preferences_dialog.vala b/src/preferences_dialog.vala
index a3cae9d..c019de6 100644
--- a/src/preferences_dialog.vala
+++ b/src/preferences_dialog.vala
@@ -51,6 +51,10 @@ namespace Pamac {
[GtkChild]
Gtk.CheckButton search_aur_checkbutton;
[GtkChild]
+ Gtk.Label aur_build_dir_label;
+ [GtkChild]
+ Gtk.FileChooserButton aur_build_dir_file_chooser;
+ [GtkChild]
Gtk.CheckButton check_aur_updates_checkbutton;
[GtkChild]
Gtk.Label cache_keep_nb_label;
@@ -70,6 +74,7 @@ namespace Pamac {
this.transaction = transaction;
refresh_period_label.set_markup (dgettext (null, "How often to check for updates, value in hours") +":");
cache_keep_nb_label.set_markup (dgettext (null, "Number of versions of each package to keep in the cache") +":");
+ aur_build_dir_label.set_markup (dgettext (null, "Build directory") +":");
remove_unrequired_deps_button.active = transaction.recurse;
check_space_button.active = transaction.get_checkspace ();
if (transaction.refresh_period == 0) {
@@ -133,10 +138,20 @@ namespace Pamac {
enable_aur_button.active = transaction.enable_aur;
search_aur_checkbutton.active = transaction.search_aur;
search_aur_checkbutton.sensitive = transaction.enable_aur;
+ aur_build_dir_label.sensitive = transaction.enable_aur;
+ aur_build_dir_file_chooser.sensitive = transaction.enable_aur;
+ aur_build_dir_file_chooser.set_filename (transaction.aur_build_dir);
+ // add /tmp choice always visible
+ try {
+ aur_build_dir_file_chooser.add_shortcut_folder ("/tmp");
+ } catch (GLib.Error e) {
+ stderr.printf ("%s\n", e.message);
+ }
check_aur_updates_checkbutton.active = transaction.check_aur_updates;
check_aur_updates_checkbutton.sensitive = transaction.enable_aur;
enable_aur_button.state_set.connect (on_enable_aur_button_state_set);
search_aur_checkbutton.toggled.connect (on_search_aur_checkbutton_toggled);
+ 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);
}
@@ -187,6 +202,12 @@ namespace Pamac {
transaction.start_write_pamac_config (new_pamac_conf);
}
+ void on_aur_build_dir_set () {
+ var new_pamac_conf = new HashTable (str_hash, str_equal);
+ new_pamac_conf.insert ("BuildDirectory", new Variant.string (aur_build_dir_file_chooser.get_filename ()));
+ transaction.start_write_pamac_config (new_pamac_conf);
+ }
+
void on_check_aur_updates_checkbutton_toggled () {
var new_pamac_conf = new HashTable (str_hash, str_equal);
new_pamac_conf.insert ("CheckAURUpdates", new Variant.boolean (check_aur_updates_checkbutton.active));
@@ -194,7 +215,7 @@ namespace Pamac {
}
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
- bool enable_aur, bool search_aur, bool check_aur_updates) {
+ bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates) {
remove_unrequired_deps_button.state = recurse;
if (refresh_period == 0) {
check_updates_button.state = false;
@@ -215,6 +236,8 @@ namespace Pamac {
enable_aur_button.state = enable_aur;
search_aur_checkbutton.active = search_aur;
search_aur_checkbutton.sensitive = enable_aur;
+ aur_build_dir_label.sensitive = enable_aur;
+ aur_build_dir_file_chooser.sensitive = enable_aur;
check_aur_updates_checkbutton.active = check_aur_updates;
check_aur_updates_checkbutton.sensitive = enable_aur;
}
diff --git a/src/system_daemon.vala b/src/system_daemon.vala
index b992e05..c28ef89 100644
--- a/src/system_daemon.vala
+++ b/src/system_daemon.vala
@@ -87,7 +87,7 @@ namespace Pamac {
public signal void trans_commit_finished (bool success);
public signal void get_authorization_finished (bool authorized);
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
- bool enable_aur, bool search_aur, bool check_aur_updates);
+ bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
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 generate_mirrors_list_data (string line);
@@ -339,7 +339,7 @@ namespace Pamac {
pamac_config.reload ();
}
write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon,
- pamac_config.enable_aur, pamac_config.search_aur, pamac_config.check_aur_updates);
+ pamac_config.enable_aur, pamac_config.search_aur, pamac_config.aur_build_dir, pamac_config.check_aur_updates);
});
}
diff --git a/src/transaction.vala b/src/transaction.vala
index c916f6c..9fbe267 100644
--- a/src/transaction.vala
+++ b/src/transaction.vala
@@ -87,7 +87,7 @@ namespace Pamac {
public signal void trans_commit_finished (bool success);
public signal void get_authorization_finished (bool authorized);
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
- bool enable_aur, bool search_aur, bool check_aur_updates);
+ bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
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 generate_mirrors_list_data (string line);
@@ -119,6 +119,7 @@ namespace Pamac {
public bool recurse { get { return pamac_config.recurse; } }
public uint64 refresh_period { get { return pamac_config.refresh_period; } }
public bool search_aur { get { return pamac_config.search_aur; } }
+ public string aur_build_dir { get { return pamac_config.aur_build_dir; } }
//Alpm.TransFlag
int flags;
@@ -171,7 +172,7 @@ namespace Pamac {
public signal void finished (bool success);
public signal void set_pkgreason_finished ();
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
- bool enable_aur, bool search_aur, bool check_aur_updates);
+ bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
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 generate_mirrors_list ();
@@ -749,7 +750,7 @@ namespace Pamac {
try {
pkg = yield user_daemon.get_aur_details (pkgname);
} catch (IOError e) {
- stderr.printf ("IOError: %s\n", e.message);
+ stderr.printf ("IOError: %s\n", e.message);
}
return pkg;
}
@@ -1079,7 +1080,12 @@ namespace Pamac {
to_build.remove_all ();
string [] built_pkgs = {};
int status = 1;
- string builddir = "/tmp/pamac-build-%s".printf (Environment.get_user_name ());
+ string builddir;
+ if (aur_build_dir == "/tmp") {
+ builddir = "/tmp/pamac-build-%s".printf (Environment.get_user_name ());
+ } else {
+ builddir = aur_build_dir;
+ }
status = yield spawn_in_term ({"mkdir", "-p", builddir});
if (status == 0) {
status = yield spawn_in_term ({"rm", "-rf", pkgname}, builddir);
@@ -1472,7 +1478,7 @@ namespace Pamac {
previous_percent = 0;
previous_textbar = "";
total_download = total;
- // this is emitted at the end of the total download
+ // this is emitted at the end of the total download
// with the value 0 so stop our timer
if (total == 0) {
timer.stop ();
@@ -1748,7 +1754,7 @@ namespace Pamac {
}
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
- bool enable_aur, bool search_aur, bool check_aur_updates) {
+ bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates) {
system_daemon.write_pamac_config_finished.disconnect (on_write_pamac_config_finished);
pamac_config.reload ();
flags = (1 << 4); //Alpm.TransFlag.CASCADE
@@ -1756,7 +1762,7 @@ namespace Pamac {
flags |= (1 << 5); //Alpm.TransFlag.RECURSE
}
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
- enable_aur, search_aur, check_aur_updates);
+ enable_aur, search_aur, aur_build_dir, check_aur_updates);
}
void on_write_alpm_config_finished (bool checkspace) {