Merge branch 'master' of github.com:manjaro/pamac

This commit is contained in:
Philip 2015-03-28 11:26:56 +01:00
commit aea37c9ea7
4 changed files with 46 additions and 38 deletions

View File

@ -30,6 +30,11 @@ namespace Pamac {
public bool is_syncfirst; public bool is_syncfirst;
public UpdateInfos[] repos_updates; public UpdateInfos[] repos_updates;
public UpdateInfos[] aur_updates; public UpdateInfos[] aur_updates;
public Updates () {
is_syncfirst = false;
repos_updates = {};
aur_updates = {};
}
} }
public enum Mode { public enum Mode {

View File

@ -35,9 +35,8 @@ namespace Pamac {
public Mutex provider_mutex; public Mutex provider_mutex;
public int? choosen_provider; public int? choosen_provider;
private Mutex databases_lock_mutex; private Mutex databases_lock_mutex;
private HashTable<string, Json.Array> aur_results; private HashTable<string, Json.Array> aur_search_results;
private UpdateInfos[] aur_updates; private Json.Array aur_updates_results;
private bool aur_updates_checked;
private bool intern_lock; private bool intern_lock;
private bool extern_lock; private bool extern_lock;
@ -61,8 +60,8 @@ namespace Pamac {
public Daemon () { public Daemon () {
alpm_config = new Alpm.Config ("/etc/pacman.conf"); alpm_config = new Alpm.Config ("/etc/pacman.conf");
databases_lock_mutex = Mutex (); databases_lock_mutex = Mutex ();
aur_results = new HashTable<string, Json.Array> (str_hash, str_equal); aur_search_results = new HashTable<string, Json.Array> (str_hash, str_equal);
aur_updates_checked = false; aur_updates_results = new Json.Array ();
intern_lock = false; intern_lock = false;
extern_lock = false; extern_lock = false;
Timeout.add (500, check_pacman_running); Timeout.add (500, check_pacman_running);
@ -91,7 +90,6 @@ namespace Pamac {
if (extern_lock) { if (extern_lock) {
if (lockfile.query_exists () == false) { if (lockfile.query_exists () == false) {
extern_lock = false; extern_lock = false;
aur_updates_checked = false;
refresh_handle (); refresh_handle ();
} }
} else { } else {
@ -424,11 +422,11 @@ namespace Pamac {
} }
if (search_from_aur) { if (search_from_aur) {
Json.Array aur_pkgs; Json.Array aur_pkgs;
if (aur_results.contains (search_string)) { if (aur_search_results.contains (search_string)) {
aur_pkgs = aur_results.get (search_string); aur_pkgs = aur_search_results.get (search_string);
} else { } else {
aur_pkgs = AUR.search (splitted); aur_pkgs = AUR.search (splitted);
aur_results.insert (search_string, aur_pkgs); aur_search_results.insert (search_string, aur_pkgs);
} }
foreach (var node in aur_pkgs.get_elements ()) { foreach (var node in aur_pkgs.get_elements ()) {
var aur_pkg = node.get_object (); var aur_pkg = node.get_object ();
@ -613,7 +611,6 @@ namespace Pamac {
var infos = UpdateInfos (); var infos = UpdateInfos ();
UpdateInfos[] updates_infos = {}; UpdateInfos[] updates_infos = {};
var updates = Updates (); var updates = Updates ();
updates.aur_updates = {};
unowned Alpm.Package? pkg = null; unowned Alpm.Package? pkg = null;
unowned Alpm.Package? candidate = null; unowned Alpm.Package? candidate = null;
foreach (var name in alpm_config.syncfirsts) { foreach (var name in alpm_config.syncfirsts) {
@ -663,18 +660,18 @@ namespace Pamac {
} }
} }
} }
updates.is_syncfirst = false;
updates.repos_updates = updates_infos; updates.repos_updates = updates_infos;
if (enable_aur) { if (enable_aur) {
if (aur_updates_checked == false) {
// get aur updates // get aur updates
aur_updates = {}; if (aur_updates_results.get_length () == 0) {
var aur_pkgs = AUR.multiinfo (local_pkgs); aur_updates_results = AUR.multiinfo (local_pkgs);
}
int cmp; int cmp;
unowned Json.Object pkg_info; unowned Json.Object pkg_info;
string version; string version;
string name; string name;
foreach (var node in aur_pkgs.get_elements ()) { updates_infos = {};
foreach (var node in aur_updates_results.get_elements ()) {
pkg_info = node.get_object (); pkg_info = node.get_object ();
version = pkg_info.get_string_member ("Version"); version = pkg_info.get_string_member ("Version");
name = pkg_info.get_string_member ("Name"); name = pkg_info.get_string_member ("Name");
@ -685,12 +682,10 @@ namespace Pamac {
infos.db_name = "AUR"; infos.db_name = "AUR";
infos.tarpath = pkg_info.get_string_member ("URLPath"); infos.tarpath = pkg_info.get_string_member ("URLPath");
infos.download_size = 0; infos.download_size = 0;
aur_updates += infos; updates_infos += infos;
} }
} }
aur_updates_checked = true; updates.aur_updates = updates_infos;
}
updates.aur_updates = aur_updates;
} }
return updates; return updates;
} }

View File

@ -1368,8 +1368,12 @@ namespace Pamac {
Source.remove (pulse_timeout_id); Source.remove (pulse_timeout_id);
to_build.steal_all (); to_build.steal_all ();
build_status = status; build_status = status;
// let the time to the daemon to update packages
Timeout.add (1000, () => {
var err = ErrorInfos (); var err = ErrorInfos ();
on_trans_commit_finished (err); on_trans_commit_finished (err);
return false;
});
} }
void on_write_pamac_config_finished (int refresh_period, bool aur_enabled, bool recurse) { void on_write_pamac_config_finished (int refresh_period, bool aur_enabled, bool recurse) {

View File

@ -197,7 +197,11 @@ namespace Pamac {
if (locked) { if (locked) {
if (lockfile.query_exists () == false) { if (lockfile.query_exists () == false) {
locked = false; locked = false;
// let the time to the daemon to update packages
Timeout.add (1000, () => {
check_updates (); check_updates ();
return false;
});
} }
} else { } else {
if (lockfile.query_exists () == true) { if (lockfile.query_exists () == true) {