diff --git a/src/alpm_config.vala b/src/alpm_config.vala index 96e11db4500c6a7f5f07e2de897c8efe7a336fe4..368fa6ebf63c9f1f9837bec6f9e191787271d10d 100644 --- a/src/alpm_config.vala +++ b/src/alpm_config.vala @@ -138,11 +138,12 @@ class AlpmConfig { Alpm.Errno error = 0; Alpm.Handle? handle = null; if (tmp_db) { - string tmp_dbpath = "/tmp/pamac-checkdbs-%s".printf (Environment.get_user_name ()); + string tmp_dbpath = "/tmp/pamac-checkdbs"; try { Process.spawn_command_line_sync ("mkdir -p %s".printf (tmp_dbpath)); Process.spawn_command_line_sync ("ln -sf %s/local %s".printf (dbpath, tmp_dbpath)); Process.spawn_command_line_sync ("cp -au %s/sync %s".printf (dbpath, tmp_dbpath)); + Process.spawn_command_line_sync ("chmod -R 777 %s/sync".printf (tmp_dbpath)); handle = new Alpm.Handle (rootdir, tmp_dbpath, out error); } catch (SpawnError e) { stderr.printf ("SpawnError: %s\n", e.message); diff --git a/src/manager_window.vala b/src/manager_window.vala index c4f9db729eb22b2af311bac22e1a6ba11ed70803..a126b3e2dcdc9b4172ff0c46f38736c6fa613463 100644 --- a/src/manager_window.vala +++ b/src/manager_window.vala @@ -17,7 +17,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -const string VERSION = "5.0.0"; +const string VERSION = "5.1.0"; namespace Pamac { diff --git a/src/system_daemon.vala b/src/system_daemon.vala index 7d199f95f0c8f9fd1125850e40fc2372b4067977..5beb2f018613d4a88061c1813a49e716c4e083a2 100644 --- a/src/system_daemon.vala +++ b/src/system_daemon.vala @@ -141,8 +141,8 @@ namespace Pamac { (alpm_action) => { alpm_action.run (); }, - // two threads at a time - 2, + // only one thread created so alpm action will run one after one + 1, // no exclusive thread false ); @@ -168,7 +168,12 @@ namespace Pamac { alpm_handle.logcb = (Alpm.LogCallBack) cb_log; lockfile = GLib.File.new_for_path (alpm_handle.lockfile); files_handle = alpm_config.get_handle (true); + files_handle.eventcb = (Alpm.EventCallBack) cb_event; + files_handle.progresscb = (Alpm.ProgressCallBack) cb_progress; + files_handle.questioncb = (Alpm.QuestionCallBack) cb_question; files_handle.fetchcb = (Alpm.FetchCallBack) cb_fetch; + files_handle.totaldlcb = (Alpm.TotalDownloadCallBack) cb_totaldownload; + files_handle.logcb = (Alpm.LogCallBack) cb_log; } } @@ -471,21 +476,30 @@ namespace Pamac { write_log_file ("synchronizing package lists"); cancellable.reset (); int force = (force_refresh) ? 1 : 0; + // try to copy refresh dbs in tmp + string tmp_dbpath = "/tmp/pamac-checkdbs"; + try { + Process.spawn_command_line_sync ("cp -au %s/sync %s".printf (tmp_dbpath, alpm_handle.dbpath)); + } catch (SpawnError e) { + stderr.printf ("SpawnError: %s\n", e.message); + } // update ".db" bool success = update_dbs (alpm_handle, force); if (cancellable.is_cancelled ()) { refresh_finished (false); return; } - if (success) { + // update ".files", do not need to know if we succeeded + update_dbs (files_handle, force); + if (cancellable.is_cancelled ()) { + refresh_finished (false); + } else if (success) { refreshed = true; refresh_finished (true); } else { current_error.message = _("Failed to synchronize any databases"); refresh_finished (false); } - // update ".files", do it in background, do not need to know if we succeeded - update_dbs (files_handle, force); } public void start_refresh (bool force, GLib.BusName sender) { diff --git a/src/transaction.vala b/src/transaction.vala index ac8431a5b3604dbcba2f653bfa69575b9e2d69c7..fd3099c5511845b22b05b30d72f4d845621600ef 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -472,6 +472,9 @@ namespace Pamac { success = false; finish_transaction (); } + } else { + success = false; + finish_transaction (); } }); } @@ -1396,8 +1399,8 @@ namespace Pamac { rates_nb = 0; fraction = 0; timer.start (); - if (filename.has_suffix (".db")) { - string action = dgettext (null, "Refreshing %s").printf (filename.replace (".db", "")) + "..."; + if (filename.has_suffix (".db") || filename.has_suffix (".files")) { + string action = dgettext (null, "Refreshing %s").printf (filename) + "..."; reset_progress_box (action); } } else if (xfered == total) { diff --git a/src/tray.vala b/src/tray.vala index e8c6cb01cfd7d60b737d1eddbeddf393ea26852d..eff05311cfe4afc7050c1a09c6bc5990e9edf3b3 100644 --- a/src/tray.vala +++ b/src/tray.vala @@ -220,7 +220,9 @@ namespace Pamac { } } else { if (lockfile.query_exists ()) { - extern_lock = true; + if (!check_pamac_running ()) { + extern_lock = true; + } } } return true; diff --git a/src/user_daemon.vala b/src/user_daemon.vala index 557e1b933b776e7e43ff582c7fe6e466c2c137a2..09d8dc95b999be65e27fa2d4f2b310fa53e556ea 100644 --- a/src/user_daemon.vala +++ b/src/user_daemon.vala @@ -847,6 +847,14 @@ namespace Pamac { db.update (0); syncdbs.next (); } + // refresh file dbs + var tmp_files_handle = alpm_config.get_handle (true, true); + syncdbs = tmp_files_handle.syncdbs; + while (syncdbs != null) { + unowned Alpm.DB db = syncdbs.data; + db.update (0); + syncdbs.next (); + } string[] local_pkgs = {}; unowned Alpm.List<unowned Alpm.Package> pkgcache = tmp_handle.localdb.pkgcache; while (pkgcache != null) {