some fixes
This commit is contained in:
parent
61981732bf
commit
9ac8dc81e6
@ -411,7 +411,6 @@ namespace Pamac {
|
||||
unowned Alpm.Package? pkg = alpm_handle.localdb.get_pkg (pkgname);
|
||||
if (pkg != null) {
|
||||
pkg.reason = (Alpm.Package.Reason) reason;
|
||||
refresh_handle ();
|
||||
}
|
||||
}
|
||||
set_pkgreason_finished ();
|
||||
@ -419,18 +418,19 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
private void refresh () {
|
||||
current_error = ErrorInfos ();
|
||||
if (!databases_lock_mutex.trylock ()) {
|
||||
// Wait for pacman to finish
|
||||
emit_event (0, 0, {});
|
||||
databases_lock_mutex.lock ();
|
||||
}
|
||||
if (cancellable.is_cancelled ()) {
|
||||
databases_lock_mutex.unlock ();
|
||||
cancellable.reset ();
|
||||
refresh_finished (true);
|
||||
databases_lock_mutex.unlock ();
|
||||
return;
|
||||
}
|
||||
write_log_file ("synchronizing package lists");
|
||||
current_error = ErrorInfos ();
|
||||
int force = (force_refresh) ? 1 : 0;
|
||||
uint success = 0;
|
||||
cancellable.reset ();
|
||||
@ -440,7 +440,8 @@ namespace Pamac {
|
||||
while (syncdbs != null) {
|
||||
unowned Alpm.DB db = syncdbs.data;
|
||||
if (cancellable.is_cancelled ()) {
|
||||
refresh_handle ();
|
||||
delete curl;
|
||||
alpm_handle.dbext = ".db";
|
||||
refresh_finished (false);
|
||||
databases_lock_mutex.unlock ();
|
||||
return;
|
||||
@ -460,7 +461,7 @@ namespace Pamac {
|
||||
syncdbs.next ();
|
||||
}
|
||||
delete curl;
|
||||
refresh_handle ();
|
||||
alpm_handle.dbext = ".db";
|
||||
// We should always succeed if at least one DB was upgraded - we may possibly
|
||||
// fail later with unresolved deps, but that should be rare, and would be expected
|
||||
if (success == 0) {
|
||||
@ -1488,17 +1489,17 @@ namespace Pamac {
|
||||
}
|
||||
|
||||
private bool trans_init (Alpm.TransFlag flags) {
|
||||
current_error = ErrorInfos ();
|
||||
if (!databases_lock_mutex.trylock ()) {
|
||||
// Wait for pacman to finish
|
||||
emit_event (0, 0, {});
|
||||
databases_lock_mutex.lock ();
|
||||
}
|
||||
if (cancellable.is_cancelled ()) {
|
||||
databases_lock_mutex.unlock ();
|
||||
cancellable.reset ();
|
||||
databases_lock_mutex.unlock ();
|
||||
return false;
|
||||
}
|
||||
current_error = ErrorInfos ();
|
||||
cancellable.reset ();
|
||||
if (alpm_handle.trans_init (flags) == -1) {
|
||||
Alpm.Errno errno = alpm_handle.errno ();
|
||||
@ -1637,6 +1638,10 @@ namespace Pamac {
|
||||
return false;
|
||||
} else if (alpm_handle.trans_add_pkg (pkg) == -1) {
|
||||
Alpm.Errno errno = alpm_handle.errno ();
|
||||
if (errno == Alpm.Errno.TRANS_DUP_TARGET || errno == Alpm.Errno.PKG_IGNORED) {
|
||||
// just skip duplicate or ignored targets
|
||||
return true;
|
||||
} else {
|
||||
current_error.errno = (uint) errno;
|
||||
current_error.message = _("Failed to prepare transaction");
|
||||
if (errno != 0) {
|
||||
@ -1646,6 +1651,7 @@ namespace Pamac {
|
||||
delete pkg;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1658,6 +1664,10 @@ namespace Pamac {
|
||||
return false;
|
||||
} else if (alpm_handle.trans_remove_pkg (pkg) == -1) {
|
||||
Alpm.Errno errno = alpm_handle.errno ();
|
||||
if (errno == Alpm.Errno.TRANS_DUP_TARGET) {
|
||||
// just skip duplicate targets
|
||||
return true;
|
||||
} else {
|
||||
current_error.errno = (uint) errno;
|
||||
current_error.message = _("Failed to prepare transaction");
|
||||
if (errno != 0) {
|
||||
@ -1665,6 +1675,7 @@ namespace Pamac {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1824,7 +1835,7 @@ namespace Pamac {
|
||||
alpm_handle.logcb = (Alpm.LogCallBack) cb_log;
|
||||
lockfile = GLib.File.new_for_path (alpm_handle.lockfile);
|
||||
// fake aur db
|
||||
alpm_handle.register_syncdb ("aur", Alpm.Signature.Level.PACKAGE_OPTIONAL | Alpm.Signature.Level.DATABASE_OPTIONAL);
|
||||
alpm_handle.register_syncdb ("aur", 0);
|
||||
// add to_build in to_install for the fake trans prpeapre
|
||||
foreach (unowned string name in to_build) {
|
||||
to_install += name;
|
||||
@ -2085,7 +2096,6 @@ namespace Pamac {
|
||||
// cancel the download return an EXTERNAL_DOWNLOAD error
|
||||
if (errno == Alpm.Errno.EXTERNAL_DOWNLOAD && cancellable.is_cancelled ()) {
|
||||
trans_release ();
|
||||
refresh_handle ();
|
||||
trans_commit_finished (false);
|
||||
return;
|
||||
}
|
||||
@ -2136,20 +2146,14 @@ namespace Pamac {
|
||||
success = false;
|
||||
}
|
||||
trans_release ();
|
||||
refresh_handle ();
|
||||
bool need_refresh = false;
|
||||
to_install_as_dep.foreach_remove ((pkgname, val) => {
|
||||
unowned Alpm.Package? pkg = alpm_handle.localdb.get_pkg (pkgname);
|
||||
if (pkg != null) {
|
||||
pkg.reason = Alpm.Package.Reason.DEPEND;
|
||||
need_refresh = true;
|
||||
return true; // remove current pkgname
|
||||
}
|
||||
return false;
|
||||
});
|
||||
if (need_refresh) {
|
||||
refresh_handle ();
|
||||
}
|
||||
trans_commit_finished (success);
|
||||
}
|
||||
|
||||
@ -2167,7 +2171,6 @@ namespace Pamac {
|
||||
message = _("Authentication failed")
|
||||
};
|
||||
trans_release ();
|
||||
refresh_handle ();
|
||||
trans_commit_finished (false);
|
||||
}
|
||||
});
|
||||
|
@ -279,8 +279,12 @@ namespace Pamac {
|
||||
|
||||
transaction = new Transaction (this as Gtk.ApplicationWindow);
|
||||
transaction.mode = Mode.MANAGER;
|
||||
transaction.start_transaction.connect (on_start_transaction);
|
||||
transaction.start_waiting.connect (on_start_waiting);
|
||||
transaction.stop_waiting.connect (on_stop_waiting);
|
||||
transaction.start_downloading.connect (on_start_downloading);
|
||||
transaction.stop_downloading.connect (on_stop_downloading);
|
||||
transaction.start_building.connect (on_start_building);
|
||||
transaction.stop_building.connect (on_stop_building);
|
||||
transaction.important_details_outpout.connect (on_important_details_outpout);
|
||||
transaction.finished.connect (on_transaction_finished);
|
||||
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished);
|
||||
@ -1631,12 +1635,14 @@ namespace Pamac {
|
||||
void on_apply_button_clicked () {
|
||||
transaction_running = true;
|
||||
apply_button.sensitive = false;
|
||||
cancel_button.sensitive = false;
|
||||
transaction.run ();
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
void on_cancel_button_clicked () {
|
||||
if (transaction_running) {
|
||||
if (transaction_running || refreshing) {
|
||||
transaction_running = false;
|
||||
transaction.cancel ();
|
||||
} else {
|
||||
transaction.clear_lists ();
|
||||
@ -1665,7 +1671,19 @@ namespace Pamac {
|
||||
transaction_infobox.show_all ();
|
||||
}
|
||||
|
||||
void on_start_transaction () {
|
||||
void on_start_waiting () {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_waiting () {
|
||||
set_pendings_operations ();
|
||||
}
|
||||
|
||||
void on_start_downloading () {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_downloading () {
|
||||
cancel_button.sensitive = false;
|
||||
}
|
||||
|
||||
@ -1673,6 +1691,10 @@ namespace Pamac {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_building () {
|
||||
cancel_button.sensitive = false;
|
||||
}
|
||||
|
||||
void on_important_details_outpout (bool must_show) {
|
||||
if (must_show) {
|
||||
main_stack.visible_child_name = "term";
|
||||
|
@ -154,8 +154,12 @@ namespace Pamac {
|
||||
//parent window
|
||||
public Gtk.ApplicationWindow? application_window { get; private set; }
|
||||
|
||||
public signal void start_transaction ();
|
||||
public signal void start_waiting ();
|
||||
public signal void stop_waiting ();
|
||||
public signal void start_downloading ();
|
||||
public signal void stop_downloading ();
|
||||
public signal void start_building ();
|
||||
public signal void stop_building ();
|
||||
public signal void important_details_outpout (bool must_show);
|
||||
public signal void alpm_handle_refreshed ();
|
||||
public signal void finished (bool success);
|
||||
@ -395,11 +399,13 @@ namespace Pamac {
|
||||
void reset_progress_box (string action) {
|
||||
show_in_term (action);
|
||||
progress_box.action_label.label = action;
|
||||
stop_progressbar_pulse ();
|
||||
progress_box.progressbar.fraction = 0;
|
||||
progress_box.progressbar.text = "";
|
||||
}
|
||||
|
||||
void start_progressbar_pulse () {
|
||||
stop_progressbar_pulse ();
|
||||
pulse_timeout_id = Timeout.add (500, (GLib.SourceFunc) progress_box.progressbar.pulse);
|
||||
}
|
||||
|
||||
@ -1062,7 +1068,7 @@ namespace Pamac {
|
||||
out status);
|
||||
if (status == 0) {
|
||||
foreach (unowned string path in standard_output.split ("\n")) {
|
||||
if (path != "") {
|
||||
if (path != "" && !(path in built_pkgs)) {
|
||||
built_pkgs += path;
|
||||
}
|
||||
}
|
||||
@ -1074,6 +1080,7 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
}
|
||||
stop_building ();
|
||||
}
|
||||
} else {
|
||||
status = 1;
|
||||
@ -1107,6 +1114,9 @@ namespace Pamac {
|
||||
}
|
||||
}
|
||||
show_in_term ("\n" + dgettext (null, "Transaction cancelled") + ".\n");
|
||||
progress_box.action_label.label = "";
|
||||
stop_progressbar_pulse ();
|
||||
stop_waiting ();
|
||||
warning_textbuffer = new StringBuilder ();
|
||||
}
|
||||
|
||||
@ -1134,12 +1144,12 @@ namespace Pamac {
|
||||
case 0: //special case: wait for database lock
|
||||
action = dgettext (null, "Waiting for another package manager to quit") + "...";
|
||||
start_progressbar_pulse ();
|
||||
start_waiting ();
|
||||
break;
|
||||
case 1: //Alpm.Event.Type.CHECKDEPS_START
|
||||
action = dgettext (null, "Checking dependencies") + "...";
|
||||
break;
|
||||
case 3: //Alpm.Event.Type.FILECONFLICTS_START
|
||||
start_transaction ();
|
||||
action = dgettext (null, "Checking file conflicts") + "...";
|
||||
break;
|
||||
case 5: //Alpm.Event.Type.RESOLVEDEPS_START
|
||||
@ -1148,9 +1158,6 @@ namespace Pamac {
|
||||
case 7: //Alpm.Event.Type.INTERCONFLICTS_START
|
||||
action = dgettext (null, "Checking inter-conflicts") + "...";
|
||||
break;
|
||||
case 9: //Alpm.Event.Type.TRANSACTION_START
|
||||
start_transaction ();
|
||||
break;
|
||||
case 11: //Alpm.Event.Type.PACKAGE_OPERATION_START
|
||||
switch (secondary_event) {
|
||||
// special case handle differently
|
||||
@ -1213,8 +1220,13 @@ namespace Pamac {
|
||||
important_details_outpout (false);
|
||||
break;
|
||||
case 25: //Alpm.Event.Type.RETRIEVE_START
|
||||
start_downloading ();
|
||||
action = dgettext (null, "Downloading") + "...";
|
||||
break;
|
||||
case 26: //Alpm.Event.Type.RETRIEVE_DONE
|
||||
case 27: //Alpm.Event.Type.RETRIEVE_FAILED
|
||||
stop_downloading ();
|
||||
break;
|
||||
case 28: //Alpm.Event.Type.PKGDOWNLOAD_START
|
||||
// special case handle differently
|
||||
show_in_term (dgettext (null, "Downloading %s").printf (details[0]) + "...");
|
||||
@ -1248,7 +1260,6 @@ namespace Pamac {
|
||||
case 41: //Alpm.Event.Type.HOOK_START
|
||||
switch (secondary_event) {
|
||||
case 1: //Alpm.HookWhen.PRE_TRANSACTION
|
||||
start_transaction ();
|
||||
action = dgettext (null, "Running pre-transaction hooks") + "...";
|
||||
break;
|
||||
case 2: //Alpm.HookWhen.POST_TRANSACTION
|
||||
|
@ -89,8 +89,12 @@ namespace Pamac {
|
||||
|
||||
transaction = new Transaction (this as Gtk.ApplicationWindow);
|
||||
transaction.mode = Mode.UPDATER;
|
||||
transaction.start_transaction.connect (on_start_transaction);
|
||||
transaction.start_waiting.connect (on_start_waiting);
|
||||
transaction.stop_waiting.connect (on_stop_waiting);
|
||||
transaction.start_downloading.connect (on_start_downloading);
|
||||
transaction.stop_downloading.connect (on_stop_downloading);
|
||||
transaction.start_building.connect (on_start_building);
|
||||
transaction.stop_building.connect (on_stop_building);
|
||||
transaction.important_details_outpout.connect (on_important_details_output);
|
||||
transaction.finished.connect (populate_updates_list);
|
||||
transaction.get_updates_finished.connect (on_get_updates_finished);
|
||||
@ -262,7 +266,19 @@ namespace Pamac {
|
||||
transaction.cancel ();
|
||||
}
|
||||
|
||||
void on_start_transaction () {
|
||||
void on_start_waiting () {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_waiting () {
|
||||
populate_updates_list ();
|
||||
}
|
||||
|
||||
void on_start_downloading () {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_downloading () {
|
||||
cancel_button.sensitive = false;
|
||||
}
|
||||
|
||||
@ -270,6 +286,10 @@ namespace Pamac {
|
||||
cancel_button.sensitive = true;
|
||||
}
|
||||
|
||||
void on_stop_building () {
|
||||
cancel_button.sensitive = false;
|
||||
}
|
||||
|
||||
void on_important_details_output (bool must_show) {
|
||||
if (must_show) {
|
||||
stackswitcher.visible = false;
|
||||
|
Loading…
Reference in New Issue
Block a user