diff --git a/src/system_daemon.vala b/src/system_daemon.vala index e8fbf722bb6cd81cf0612a3da523eded35a078a6..ed36fbd1fb66085cebefb75e5f4de317e9c57d0f 100644 --- a/src/system_daemon.vala +++ b/src/system_daemon.vala @@ -59,7 +59,7 @@ namespace Pamac { private string[] to_build; private bool sysupgrade; private UpdateInfos[] to_build_infos; - private GLib.List<string> aur_pkgbases_to_build; + private GenericSet<string?> aur_pkgbases_to_build; private GenericSet<string?> aur_desc_list; private GenericSet<string?> already_checked_aur_dep; private HashTable<string, string> to_install_as_dep; @@ -99,7 +99,7 @@ namespace Pamac { public SystemDaemon () { alpm_config = new AlpmConfig ("/etc/pacman.conf"); - aur_pkgbases_to_build = new GLib.List<string> (); + aur_pkgbases_to_build = new GenericSet<string?> (str_hash, str_equal); aur_desc_list = new GenericSet<string?> (str_hash, str_equal); already_checked_aur_dep = new GenericSet<string?> (str_hash, str_equal); to_install_as_dep = new HashTable<string, string> (str_hash, str_equal); @@ -515,7 +515,6 @@ namespace Pamac { foreach (unowned string pkgname in temporary_ignorepkgs) { alpm_handle.remove_ignorepkg (pkgname); } - temporary_ignorepkgs = {}; } private AlpmPackage initialise_pkg_struct (Alpm.Package? alpm_pkg) { @@ -913,7 +912,7 @@ namespace Pamac { to_load = {}; to_build = to_build_; to_build_infos = {}; - aur_pkgbases_to_build = new GLib.List<string> (); + aur_pkgbases_to_build.remove_all (); if (downloading_updates) { cancellable.cancel (); // let time to cancel download updates @@ -1215,7 +1214,7 @@ namespace Pamac { lockfile = GLib.File.new_for_path (alpm_handle.lockfile); // fake aur db alpm_handle.register_syncdb ("aur", 0); - // add to_build in to_install for the fake trans prpeapre + // add to_build in to_install for the fake trans prepare foreach (unowned string name in to_build) { to_install += name; // check if we need to remove debug package to avoid dep problem @@ -1306,7 +1305,7 @@ namespace Pamac { if (db != null) { if (db.name == "aur") { // it is a aur pkg to build - aur_pkgbases_to_build.append (trans_pkg.pkgbase); + aur_pkgbases_to_build.add (trans_pkg.pkgbase); var infos = UpdateInfos () { name = trans_pkg.name, old_version = "", @@ -1385,7 +1384,7 @@ namespace Pamac { to_load = to_load_; to_build = to_build_; to_build_infos = {}; - aur_pkgbases_to_build = new GLib.List<string> (); + aur_pkgbases_to_build.remove_all (); sysupgrade = false; if (downloading_updates) { cancellable.cancel (); diff --git a/src/transaction.vala b/src/transaction.vala index 06535371f39fc45303fcc488cf3167864885f5cc..f803d32815a4c1a3c443dc71957efd46bc53821e 100644 --- a/src/transaction.vala +++ b/src/transaction.vala @@ -1142,27 +1142,38 @@ namespace Pamac { status = yield spawn_in_term ({"git", "clone", "https://aur.archlinux.org/%s.git".printf (pkgname)}, builddir); if (status == 0) { string pkgdir = "%s/%s".printf (builddir, pkgname); - status = yield spawn_in_term ({"makepkg", "-c"}, pkgdir); + status = yield spawn_in_term ({"makepkg", "-cf"}, pkgdir); building = false; if (status == 0) { - foreach (unowned string aurpkg in aur_pkgs_to_install) { - string standard_output; - try { - Process.spawn_command_line_sync ("find %s -name %s".printf (pkgdir, "'%s-*.pkg.tar*'".printf (aurpkg)), - out standard_output, - null, - out status); - if (status == 0) { - foreach (unowned string path in standard_output.split ("\n")) { - if (path != "" && !(path in built_pkgs)) { - built_pkgs += path; + // get built pkgs path + var launcher = new SubprocessLauncher (SubprocessFlags.STDOUT_PIPE); + launcher.set_cwd (pkgdir); + try { + Subprocess process = launcher.spawnv ({"makepkg", "--packagelist"}); + yield process.wait_async (null); + if (process.get_if_exited ()) { + status = process.get_exit_status (); + } + if (status == 0) { + var dis = new DataInputStream (process.get_stdout_pipe ()); + string? line; + // Read lines until end of file (null) is reached + while ((line = dis.read_line ()) != null) { + var file = GLib.File.new_for_path (line); + string filename = file.get_basename (); + string name_version_release = filename.slice (0, filename.last_index_of_char ('-')); + string name_version = name_version_release.slice (0, name_version_release.last_index_of_char ('-')); + string name = name_version.slice (0, name_version.last_index_of_char ('-')); + if (name in aur_pkgs_to_install) { + if (!(line in built_pkgs)) { + built_pkgs += line; } } } - } catch (SpawnError e) { - stderr.printf ("SpawnError: %s\n", e.message); - status = 1; } + } catch (Error e) { + stderr.printf ("Error: %s\n", e.message); + status = 1; } } } @@ -1173,13 +1184,11 @@ namespace Pamac { } } building = false; - if (status == 0) { - if (built_pkgs.length > 0) { - no_confirm_commit = true; - show_in_term (""); - stop_progressbar_pulse (); - start_trans_prepare (flags, {}, {}, built_pkgs, {}); - } + if (status == 0 && built_pkgs.length > 0) { + no_confirm_commit = true; + show_in_term (""); + stop_progressbar_pulse (); + start_trans_prepare (flags, {}, {}, built_pkgs, {}); } else { important_details_outpout (true); to_load.remove_all ();