[devtools] makechrootpkg: handle errors when copying packages into chroot
diff mbox

Message ID 20180801163130.31518-1-juergen@hoetzel.info
State New
Headers show

Commit Message

juergen@hoetzel.info Aug. 1, 2018, 4:31 p.m. UTC
From: Juergen Hoetzel <juergen@archlinux.org>


Prevents consequential build errors.

Signed-off-by: Juergen Hoetzel <juergen@archlinux.org>

---
 makechrootpkg.in | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Eli Schwartz Aug. 1, 2018, 4:52 p.m. UTC | #1
On 08/01/2018 12:31 PM, juergen@hoetzel.info wrote:
> From: Juergen Hoetzel <juergen@archlinux.org>
> 
> Prevents consequential build errors.

1) this is a patch to devtools, not pacman, and should go to the
arch-projects mailing list.

2) This doesn't really "fix" build errors, it just returns 1 after the
first error instead of the third, then continues trying to build the
package because makechrootpkg does not consider failure in
install_packages() to be an error state and prefers to let makepkg speak
for itself.

It just makes the error logging more pretty.

Patch
diff mbox

diff --git a/makechrootpkg.in b/makechrootpkg.in
index d81be84..419e495 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -145,8 +145,10 @@  install_packages() {
 	local ret
 
 	pkgnames=("${install_pkgs[@]##*/}")
-
-	cp -- "${install_pkgs[@]}" "$copydir/root/"
+	if ! cp -- "${install_pkgs[@]}" "$copydir/root/"; then
+	    error "Cannot copy packages"
+	    return 1
+	fi
 	arch-nspawn "$copydir" "${bindmounts_ro[@]}" "${bindmounts_rw[@]}" \
 		pacman -U --noconfirm -- "${pkgnames[@]/#//root/}"
 	ret=$?