[pacman-dev] [PATCH 3/4] makepkg: abort on lint_package errors

Andrew Gregory andrew.gregory.8 at gmail.com
Sat Nov 5 22:08:16 UTC 2016


Allows lint_package to prevent makepkg from creating an invalid package.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 scripts/libmakepkg/lint_package.sh.in                  | 4 +++-
 scripts/libmakepkg/lint_package/build_references.sh.in | 1 +
 scripts/libmakepkg/lint_package/missing_backup.sh.in   | 1 +
 scripts/makepkg.sh.in                                  | 4 ++--
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/scripts/libmakepkg/lint_package.sh.in b/scripts/libmakepkg/lint_package.sh.in
index 82b8b9b..f5bd979 100644
--- a/scripts/libmakepkg/lint_package.sh.in
+++ b/scripts/libmakepkg/lint_package.sh.in
@@ -40,7 +40,9 @@ lint_package() {
 	cd_safe "$pkgdir"
 	msg "$(gettext "Checking for packaging issue...")"
 
+	local ret=0
 	for func in ${lint_package_functions[@]}; do
-		$func
+		$func || ret=1
 	done
+	return $ret
 }
diff --git a/scripts/libmakepkg/lint_package/build_references.sh.in b/scripts/libmakepkg/lint_package/build_references.sh.in
index 514ec05..cae9852 100644
--- a/scripts/libmakepkg/lint_package/build_references.sh.in
+++ b/scripts/libmakepkg/lint_package/build_references.sh.in
@@ -37,4 +37,5 @@ warn_build_references() {
 			printf '%s\n' "${refs[@]}" >&2
 		fi
 	done
+	return 0
 }
diff --git a/scripts/libmakepkg/lint_package/missing_backup.sh.in b/scripts/libmakepkg/lint_package/missing_backup.sh.in
index 727a18b..1963627 100644
--- a/scripts/libmakepkg/lint_package/missing_backup.sh.in
+++ b/scripts/libmakepkg/lint_package/missing_backup.sh.in
@@ -35,4 +35,5 @@ warn_missing_backup() {
 			warning "$(gettext "%s entry file not in package : %s")" "backup" "$file"
 		fi
 	done
+	return 0
 }
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8376e4a..80b5d9e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1164,7 +1164,7 @@ run_split_packaging() {
 		backup_package_variables
 		run_package $pkgname
 		tidy_install
-		lint_package
+		lint_package || exit 1
 		create_package
 		create_debug_package
 		restore_package_variables
@@ -1598,7 +1598,7 @@ if (( INFAKEROOT )); then
 			run_package
 		fi
 		tidy_install
-		lint_package
+		lint_package || exit 1
 		create_package
 		create_debug_package
 	else
-- 
2.10.2


More information about the pacman-dev mailing list