[pacman-dev] [PATCH] Return 17 if a package/group has been built.

fbt fbt at fleshless.org
Fri May 22 13:48:12 UTC 2015


A specific exit code to distinguish failed builds and refusal to build
because the package/group has already been built.
Useful in autobuild scripts.

Signed-off-by: Jack L. Frost <fbt at fleshless.org>
---
 doc/makepkg.8.txt     | 11 +++++++++++
 scripts/makepkg.sh.in |  6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 41df30e..2f9415c 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -267,6 +267,17 @@ Environment Variables
 	in linkman:makepkg.conf[5]
 
 
+Exit codes
+----------
+**0**
+	Success.
+
+**1**
+	Some error has occured.
+
+**2**
+	A package or (part of) group has already been built.
+
 Configuration
 -------------
 See linkman:makepkg.conf[5] for more details on configuring makepkg using the
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c74e84a..7025161 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1613,7 +1613,7 @@ check_build_status() {
 				exit 0
 			else
 				error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f"
-				exit 1
+				exit 2
 			fi
 		fi
 	else
@@ -1636,12 +1636,12 @@ check_build_status() {
 					exit 0
 				else
 					error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f"
-					exit 1
+					exit 2
 				fi
 			fi
 			if (( somepkgbuilt && ! PKGVERFUNC )); then
 				error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f"
-				exit 1
+				exit 2
 			fi
 		fi
 		unset allpkgbuilt somepkgbuilt
-- 
2.4.1


More information about the pacman-dev mailing list