Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
guinux committed Aug 22, 2017
1 parent 9c6c435 commit e9076f6
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/alpm_config.vala
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/manager_window.vala
Expand Up @@ -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 {

Expand Down
24 changes: 19 additions & 5 deletions src/system_daemon.vala
Expand Up @@ -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
);
Expand All @@ -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;
}
}

Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 5 additions & 2 deletions src/transaction.vala
Expand Up @@ -472,6 +472,9 @@ namespace Pamac {
success = false;
finish_transaction ();
}
} else {
success = false;
finish_transaction ();
}
});
}
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/tray.vala
Expand Up @@ -220,7 +220,9 @@ namespace Pamac {
}
} else {
if (lockfile.query_exists ()) {
extern_lock = true;
if (!check_pamac_running ()) {
extern_lock = true;
}
}
}
return true;
Expand Down
8 changes: 8 additions & 0 deletions src/user_daemon.vala
Expand Up @@ -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) {
Expand Down

0 comments on commit e9076f6

Please sign in to comment.