This commit is contained in:
guinux 2014-11-24 21:34:23 +01:00
parent da70da90da
commit 6024012729
4 changed files with 35 additions and 30 deletions

View File

@ -187,7 +187,7 @@ static void walk_reverse_deps(Package pkg, int depth) {
if((max_depth >= 0) && (depth > max_depth)) return; if((max_depth >= 0) && (depth > max_depth)) return;
walked.add(pkg.name); walked.add(pkg.name);
unowned Alpm.List<string?> required_by = pkg.compute_requiredby (); Alpm.List<string?> required_by = pkg.compute_requiredby ();
foreach(string? i in required_by) { foreach(string? i in required_by) {
string pkgname = i; string pkgname = i;

View File

@ -121,23 +121,16 @@ namespace Pamac {
ErrorInfos err = ErrorInfos (); ErrorInfos err = ErrorInfos ();
string[] details = {}; string[] details = {};
int success = 0; int success = 0;
int ret = handle.trans_init (0); int ret;
if (ret == 0) { foreach (var db in handle.syncdbs) {
foreach (var db in handle.syncdbs) { ret = db.update (force_refresh);
ret = db.update (force_refresh); if (ret >= 0) {
if (ret >= 0) { success++;
success++;
}
} }
// 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 // We should always succeed if at least one DB was upgraded - we may possibly
if (success == 0) { // fail later with unresolved deps, but that should be rare, and would be expected
err.str = _("Failed to synchronize any databases"); if (success == 0) {
details += Alpm.strerror (handle.errno ());
err.details = details;
}
trans_release ();
} else {
err.str = _("Failed to synchronize any databases"); err.str = _("Failed to synchronize any databases");
details += Alpm.strerror (handle.errno ()); details += Alpm.strerror (handle.errno ());
err.details = details; err.details = details;

View File

@ -250,22 +250,17 @@ namespace Pamac {
public void set_infos_list (Pamac.Package pkg) { public void set_infos_list (Pamac.Package pkg) {
name_label.set_markup ("<big><b>%s %s</b></big>".printf (pkg.name, pkg.version)); name_label.set_markup ("<big><b>%s %s</b></big>".printf (pkg.name, pkg.version));
// fix &,-,>,< in desc
string desc; string desc;
if (pkg.alpm_pkg != null) if (pkg.alpm_pkg != null)
desc = pkg.alpm_pkg.desc; desc = Markup.escape_text (pkg.alpm_pkg.desc);
else else
desc = pkg.aur_json.get_string_member ("Description"); desc = Markup.escape_text (pkg.aur_json.get_string_member ("Description"));
desc = desc.replace ("&", "&amp;");
desc = desc.replace ("<->", "/");
desc_label.set_markup (desc); desc_label.set_markup (desc);
// fix & in url
string url; string url;
if (pkg.alpm_pkg != null) if (pkg.alpm_pkg != null)
url = pkg.alpm_pkg.url; url = Markup.escape_text (pkg.alpm_pkg.url);
else else
url = pkg.aur_json.get_string_member ("URL"); url = Markup.escape_text (pkg.aur_json.get_string_member ("URL"));
url = url.replace ("&", "&amp;");
link_label.set_markup ("<a href=\"%s\">%s</a>".printf (url, url)); link_label.set_markup ("<a href=\"%s\">%s</a>".printf (url, url));
StringBuilder licenses = new StringBuilder (); StringBuilder licenses = new StringBuilder ();
licenses.append (dgettext (null, "Licenses")); licenses.append (dgettext (null, "Licenses"));
@ -509,6 +504,8 @@ namespace Pamac {
TreeSelection selection = search_treeview.get_selection (); TreeSelection selection = search_treeview.get_selection ();
if (selection.get_selected (out model, out iter)) { if (selection.get_selected (out model, out iter)) {
on_search_treeview_selection_changed (); on_search_treeview_selection_changed ();
} else {
show_all_pkgs ();
} }
} else if (current_page == 1) { } else if (current_page == 1) {
on_groups_treeview_selection_changed (); on_groups_treeview_selection_changed ();

View File

@ -249,8 +249,8 @@ namespace Pamac {
// run as a standard transaction // run as a standard transaction
run (); run ();
} else { } else {
UpdatesInfos[] updates = get_repos_updates (handle, ignorepkg); UpdatesInfos[] repos_updates = get_repos_updates (handle, ignorepkg);
uint repos_updates_len = updates.length; int repos_updates_len = repos_updates.length;
if (check_aur) { if (check_aur) {
if (aur_checked == false) { if (aur_checked == false) {
aur_updates = get_aur_updates (handle, ignorepkg); aur_updates = get_aur_updates (handle, ignorepkg);
@ -554,12 +554,18 @@ namespace Pamac {
} }
} }
public void spawn_in_term (string[] args, out int pid = null) { public void spawn_in_term (string[] args, out Pid child_pid = null) {
Pid intern_pid;
try { try {
Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out pid); Process.spawn_async (null, args, null, SpawnFlags.DO_NOT_REAP_CHILD, pty.child_setup, out intern_pid);
ChildWatch.add (intern_pid, (pid, status) => {
// triggered when the child indicated by intern_pid exits
Process.close_pid (pid);
});
} catch (SpawnError e) { } catch (SpawnError e) {
stderr.printf ("SpawnError: %s\n", e.message); stderr.printf ("SpawnError: %s\n", e.message);
} }
child_pid = intern_pid;
term.set_pty (pty); term.set_pty (pty);
} }
@ -906,6 +912,10 @@ namespace Pamac {
transaction_sum_dialog.hide (); transaction_sum_dialog.hide ();
while (Gtk.events_pending ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
if (aur_updates.length != 0)
to_build.steal_all ();
sysupgrade_after_trans = false;
sysupgrade_after_build = false;
finished (true); finished (true);
} }
} else if (sysupgrade_after_build) { } else if (sysupgrade_after_build) {
@ -923,6 +933,10 @@ namespace Pamac {
while (Gtk.events_pending ()) while (Gtk.events_pending ())
Gtk.main_iteration (); Gtk.main_iteration ();
release (); release ();
if (aur_updates.length != 0)
to_build.steal_all ();
sysupgrade_after_trans = false;
sysupgrade_after_build = false;
finished (true); finished (true);
} }
} else if (mode == Mode.UPDATER) { } else if (mode == Mode.UPDATER) {
@ -987,6 +1001,7 @@ namespace Pamac {
already_downloaded = 0; already_downloaded = 0;
build_status = 0; build_status = 0;
previous_filename = ""; previous_filename = "";
aur_checked = false;
} }
void on_term_child_exited (int status) { void on_term_child_exited (int status) {