changeset 31027:6e91c61f626f stable

pkg: Avoid error when unlinking non-existent files (bug #62436). * scripts/pkg/private/build.m: Check configure and Makefile exist before trying to unlink them.
author John Donoghue <john.donoghue@ieee.org>
date Thu, 12 May 2022 08:35:04 -0400
parents 4f2f81989d50
children a9df2af909fd a05f112edde4
files scripts/pkg/private/build.m
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/private/build.m	Tue May 24 22:35:48 2022 +0200
+++ b/scripts/pkg/private/build.m	Thu May 12 08:35:04 2022 -0400
@@ -77,8 +77,12 @@
     else
       arch_abi = getarch ();
       configure_make (desc, build_root, verbose);
-      unlink (fullfile (build_root, "src", "configure"));
-      unlink (fullfile (build_root, "src", "Makefile"));
+      if exist (fullfile (build_root, "src", "configure"), "file")
+        unlink (fullfile (build_root, "src", "configure"));
+      endif
+      if exist (fullfile (build_root, "src", "Makefile"), "file")
+        unlink (fullfile (build_root, "src", "Makefile"));
+      endif
     endif
     tar_name = [desc.name "-" desc.version "-" arch_abi ".tar"];
     tar_path = fullfile (builddir, tar_name);