Commit 7acfa49b authored by guinux's avatar guinux

fix build cancellation

parent 685bfd1f
......@@ -309,55 +309,59 @@ namespace Pamac {
status = yield run_cmd_line ({"mkdir", "-p", builddir}, "/", build_cancellable);
if (status == 0) {
status = yield run_cmd_line ({"rm", "-rf", pkgname}, builddir, build_cancellable);
if (!build_cancellable.is_cancelled ()) {
if (build_cancellable.is_cancelled ()) {
status = 1;
}
if (status == 0) {
building = true;
start_building ();
status = yield run_cmd_line ({"git", "clone", "https://aur.archlinux.org/%s.git".printf (pkgname)}, builddir, build_cancellable);
if (build_cancellable.is_cancelled ()) {
status = 1;
}
if (status == 0) {
building = true;
start_building ();
status = yield run_cmd_line ({"git", "clone", "https://aur.archlinux.org/%s.git".printf (pkgname)}, builddir, build_cancellable);
string pkgdir = "%s/%s".printf (builddir, pkgname);
status = yield run_cmd_line ({"makepkg", "-cf"}, pkgdir, build_cancellable);
if (build_cancellable.is_cancelled ()) {
status = 1;
}
if (status == 0) {
string pkgdir = "%s/%s".printf (builddir, pkgname);
status = yield run_cmd_line ({"makepkg", "-cf"}, pkgdir, build_cancellable);
building = false;
if (status == 0) {
// 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;
}
// 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 (Error e) {
stderr.printf ("Error: %s\n", e.message);
status = 1;
}
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
status = 1;
}
}
stop_building ();
}
} else {
status = 1;
stop_building ();
building = false;
}
}
building = false;
if (status == 0 && built_pkgs.length > 0) {
no_confirm_commit = true;
emit_script_output ("");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment