makepkg: implement error codes

For your convenience, makepkg now has 16 distinct ways to fail.
Also closes FS#54204.

Signed-off-by: Ivy Foster <iff@escondida.tk>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Ivy Foster 2017-09-22 13:01:09 -05:00 committed by Allan McRae
parent 67ce123457
commit ab2be5794d
4 changed files with 158 additions and 61 deletions

View file

@ -288,6 +288,63 @@ See linkman:makepkg.conf[5] for more details on configuring makepkg using the
'makepkg.conf' file. 'makepkg.conf' file.
Errors
------
On exit, makepkg will return one of the following error codes.
0::
Normal exit condition.
1::
Unknown cause of failure.
2::
Error in configuration file.
3::
User specified an invalid option
4::
Error in user-supplied function in PKGBUILD.
5::
Failed to create a viable package.
6::
A source or auxiliary file specified in the PKGBUILD is
missing.
7::
The PKGDIR is missing.
8::
Failed to install dependencies.
9::
Failed to remove dependencies.
10::
User attempted to run makepkg as root.
11::
User lacks permissions to build or install to a given
location.
12::
Error parsing PKGBUILD.
13::
A package has already been built.
14::
The package failed to install.
15::
Programs necessary to run makepkg are missing.
16::
Specified GPG key does not exist.
See Also See Also
-------- --------
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8] linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]

View file

@ -96,6 +96,7 @@ LIBMAKEPKG_IN = \
libmakepkg/tidy/strip.sh \ libmakepkg/tidy/strip.sh \
libmakepkg/tidy/zipman.sh \ libmakepkg/tidy/zipman.sh \
libmakepkg/util.sh \ libmakepkg/util.sh \
libmakepkg/util/error.sh \
libmakepkg/util/message.sh \ libmakepkg/util/message.sh \
libmakepkg/util/option.sh \ libmakepkg/util/option.sh \
libmakepkg/util/parseopts.sh \ libmakepkg/util/parseopts.sh \

View file

@ -0,0 +1,41 @@
#!/bin/bash
#
# error.sh.in - error variable definitions for makepkg
#
# Copyright (c) 2006-2017 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[[ -n "$LIBMAKEPKG_UTIL_ERROR_SH" ]] && return
LIBMAKEPKG_UTIL_ERROR_SH=1
E_OK=0
E_FAIL=1 # Generic error
E_CONFIG_ERROR=2
E_INVALID_OPTION=3
E_USER_FUNCTION_FAILED=4
E_PACKAGE_FAILED=5
E_MISSING_FILE=6
E_MISSING_PKGDIR=7
E_INSTALL_DEPS_FAILED=8
E_REMOVE_DEPS_FAILED=9
E_ROOT=10
E_FS_PERMISSIONS=11
E_PKGBUILD_ERROR=12
E_ALREADY_BUILT=13
E_INSTALL_FAILED=14
E_MISSING_MAKEPKG_DEPS=15
E_PRETTY_BAD_PRIVACY=16

View file

@ -136,7 +136,7 @@ clean_up() {
return return
fi fi
if (( ! EXIT_CODE && CLEANUP )); then if (( (EXIT_CODE == E_OK || EXIT_CODE == E_INSTALL_FAILED) && CLEANUP )); then
local pkg file local pkg file
# If it's a clean exit and -c/--clean has been passed... # If it's a clean exit and -c/--clean has been passed...
@ -190,7 +190,7 @@ update_pkgver() {
newpkgver=$(run_function_safe pkgver) newpkgver=$(run_function_safe pkgver)
if ! check_pkgver "$newpkgver"; then if ! check_pkgver "$newpkgver"; then
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver" error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
exit 1 exit $E_PKGBUILD_ERROR
fi fi
if [[ -n $newpkgver && $newpkgver != "$pkgver" ]]; then if [[ -n $newpkgver && $newpkgver != "$pkgver" ]]; then
@ -198,7 +198,7 @@ update_pkgver() {
if ! @SEDPATH@ @SEDINPLACEFLAGS@ "s:^pkgver=[^ ]*:pkgver=$newpkgver:" "$BUILDFILE"; then if ! @SEDPATH@ @SEDINPLACEFLAGS@ "s:^pkgver=[^ ]*:pkgver=$newpkgver:" "$BUILDFILE"; then
error "$(gettext "Failed to update %s from %s to %s")" \ error "$(gettext "Failed to update %s from %s to %s")" \
"pkgver" "$pkgver" "$newpkgver" "pkgver" "$pkgver" "$newpkgver"
exit 1 exit $E_PKGBUILD_ERROR
fi fi
@SEDPATH@ @SEDINPLACEFLAGS@ "s:^pkgrel=[^ ]*:pkgrel=1:" "$BUILDFILE" @SEDPATH@ @SEDINPLACEFLAGS@ "s:^pkgrel=[^ ]*:pkgrel=1:" "$BUILDFILE"
source_safe "$BUILDFILE" source_safe "$BUILDFILE"
@ -215,7 +215,7 @@ update_pkgver() {
missing_source_file() { missing_source_file() {
error "$(gettext "Unable to find source file %s.")" "$(get_filename "$1")" error "$(gettext "Unable to find source file %s.")" "$(get_filename "$1")"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 # $E_MISSING_FILE exit $E_MISSING_FILE
} }
run_pacman() { run_pacman() {
@ -269,7 +269,7 @@ handle_deps() {
if ! run_pacman -S --asdeps "${deplist[@]}"; then if ! run_pacman -S --asdeps "${deplist[@]}"; then
error "$(gettext "'%s' failed to install missing dependencies.")" "$PACMAN" error "$(gettext "'%s' failed to install missing dependencies.")" "$PACMAN"
exit 1 # TODO: error code exit $E_INSTALL_DEPS_FAILED
fi fi
fi fi
@ -290,12 +290,12 @@ resolve_deps() {
# deplist cannot be declared like this: local deplist=$(foo) # deplist cannot be declared like this: local deplist=$(foo)
# Otherwise, the return value will depend on the assignment. # Otherwise, the return value will depend on the assignment.
local deplist local deplist
deplist=($(check_deps "$@")) || exit 1 deplist=($(check_deps "$@")) || exit $E_INSTALL_DEPS_FAILED
[[ -z $deplist ]] && return $R_DEPS_SATISFIED [[ -z $deplist ]] && return $R_DEPS_SATISFIED
if handle_deps "${deplist[@]}"; then if handle_deps "${deplist[@]}"; then
# check deps again to make sure they were resolved # check deps again to make sure they were resolved
deplist=$(check_deps "$@") || exit 1 deplist=$(check_deps "$@") || exit $E_INSTALL_DEPS_FAILED
[[ -z $deplist ]] && return $R_DEPS_SATISFIED [[ -z $deplist ]] && return $R_DEPS_SATISFIED
fi fi
@ -316,7 +316,7 @@ remove_deps() {
if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \ if [[ -n $(grep -xvFf <(printf '%s\n' "${current_pkglist[@]}") \
<(printf '%s\n' "${original_pkglist[@]}")) ]]; then <(printf '%s\n' "${original_pkglist[@]}")) ]]; then
warning "$(gettext "Failed to remove installed dependencies.")" warning "$(gettext "Failed to remove installed dependencies.")"
return 0 return $E_REMOVE_DEPS_FAILED
fi fi
local deplist local deplist
@ -330,7 +330,7 @@ remove_deps() {
# exit cleanly on failure to remove deps as package has been built successfully # exit cleanly on failure to remove deps as package has been built successfully
if ! run_pacman -Rn ${deplist[@]}; then if ! run_pacman -Rn ${deplist[@]}; then
warning "$(gettext "Failed to remove installed dependencies.")" warning "$(gettext "Failed to remove installed dependencies.")"
return 0 return $E_REMOVE_DEPS_FAILED
fi fi
} }
@ -343,14 +343,14 @@ error_function() {
error "$(gettext "A failure occurred in %s().")" "$1" error "$(gettext "A failure occurred in %s().")" "$1"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
fi fi
exit 2 # $E_BUILD_FAILED exit $E_USER_FUNCTION_FAILED
} }
source_safe() { source_safe() {
shopt -u extglob shopt -u extglob
if ! source "$@"; then if ! source "$@"; then
error "$(gettext "Failed to source %s")" "$1" error "$(gettext "Failed to source %s")" "$1"
exit 1 exit $E_MISSING_FILE
fi fi
shopt -s extglob shopt -s extglob
} }
@ -621,7 +621,7 @@ write_kv_pair() {
for val in "$@"; do for val in "$@"; do
if [[ $val = *$'\n'* ]]; then if [[ $val = *$'\n'* ]]; then
error "$(gettext "Invalid value for %s: %s")" "$key" "$val" error "$(gettext "Invalid value for %s: %s")" "$key" "$val"
exit 1 exit $E_PKGBUILD_ERROR
fi fi
printf "%s = %s\n" "$key" "$val" printf "%s = %s\n" "$key" "$val"
done done
@ -710,7 +710,7 @@ create_package() {
if [[ ! -d $pkgdir ]]; then if [[ ! -d $pkgdir ]]; then
error "$(gettext "Missing %s directory.")" "\$pkgdir/" error "$(gettext "Missing %s directory.")" "\$pkgdir/"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 # $E_MISSING_PKGDIR exit $E_MISSING_PKGDIR
fi fi
cd_safe "$pkgdir" cd_safe "$pkgdir"
@ -728,7 +728,7 @@ create_package() {
msg2 "$(gettext "Adding %s file...")" "$orig" msg2 "$(gettext "Adding %s file...")" "$orig"
if ! cp "$startdir/${!orig}" "$dest"; then if ! cp "$startdir/${!orig}" "$dest"; then
error "$(gettext "Failed to add %s file to package.")" "$orig" error "$(gettext "Failed to add %s file to package.")" "$orig"
exit 1 exit $E_MISSING_FILE
fi fi
chmod 644 "$dest" chmod 644 "$dest"
fi fi
@ -774,7 +774,7 @@ create_package() {
if (( ret )); then if (( ret )); then
error "$(gettext "Failed to create package file.")" error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code exit $E_PACKAGE_FAILED
fi fi
} }
@ -870,14 +870,13 @@ create_srcpackage() {
cd_safe "${srclinks}" cd_safe "${srclinks}"
if ! LANG=C bsdtar -cL ${TAR_OPT} -f "$pkg_file" ${pkgbase}; then if ! LANG=C bsdtar -cL ${TAR_OPT} -f "$pkg_file" ${pkgbase}; then
error "$(gettext "Failed to create source package file.")" error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code exit $E_PACKAGE_FAILED
fi fi
cd_safe "${startdir}" cd_safe "${startdir}"
rm -rf "${srclinks}" rm -rf "${srclinks}"
} }
# this function always returns 0 to make sure clean-up will still occur
install_package() { install_package() {
(( ! INSTALL )) && return (( ! INSTALL )) && return
@ -903,7 +902,7 @@ install_package() {
if ! run_pacman -U "${pkglist[@]}"; then if ! run_pacman -U "${pkglist[@]}"; then
warning "$(gettext "Failed to install built package(s).")" warning "$(gettext "Failed to install built package(s).")"
return 0 return $E_INSTALL_FAILED
fi fi
} }
@ -923,7 +922,7 @@ get_vcsclient() {
if [[ -z $client ]]; then if [[ -z $client ]]; then
error "$(gettext "Unknown download protocol: %s")" "$proto" error "$(gettext "Unknown download protocol: %s")" "$proto"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 # $E_CONFIG_ERROR exit $E_CONFIG_ERROR
fi fi
printf "%s\n" "$client" printf "%s\n" "$client"
@ -962,7 +961,7 @@ check_vcs_software() {
client=$(get_vcsclient "$proto") || exit $? client=$(get_vcsclient "$proto") || exit $?
# ensure specified program is installed # ensure specified program is installed
local uninstalled local uninstalled
uninstalled=$(check_deps "$client") || exit 1 uninstalled=$(check_deps "$client") || exit $E_INSTALL_DEPS_FAILED
# if not installed, check presence in depends or makedepends # if not installed, check presence in depends or makedepends
if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then if [[ -n "$uninstalled" ]] && (( ! NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
if ! in_array "$client" ${all_deps[@]}; then if ! in_array "$client" ${all_deps[@]}; then
@ -1087,11 +1086,11 @@ check_build_status() {
&& ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then && ! (( FORCE || SOURCEONLY || NOBUILD || NOARCHIVE)); then
if (( INSTALL )); then if (( INSTALL )); then
warning "$(gettext "A package has already been built, installing existing package...")" warning "$(gettext "A package has already been built, installing existing package...")"
install_package status=$(install_package)
exit 0 exit $status
else else
error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f" error "$(gettext "A package has already been built. (use %s to overwrite)")" "-f"
exit 1 exit $E_ALREADY_BUILT
fi fi
fi fi
else else
@ -1110,16 +1109,16 @@ check_build_status() {
if (( allpkgbuilt )); then if (( allpkgbuilt )); then
if (( INSTALL )); then if (( INSTALL )); then
warning "$(gettext "The package group has already been built, installing existing packages...")" warning "$(gettext "The package group has already been built, installing existing packages...")"
install_package status=$(install_package)
exit 0 exit $status
else else
error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f" error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f"
exit 1 exit $E_ALREADY_BUILT
fi fi
fi fi
if (( somepkgbuilt && ! PKGVERFUNC )); then if (( somepkgbuilt && ! PKGVERFUNC )); then
error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f" error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f"
exit 1 exit $E_ALREADY_BUILT
fi fi
fi fi
unset allpkgbuilt somepkgbuilt unset allpkgbuilt somepkgbuilt
@ -1154,7 +1153,7 @@ run_split_packaging() {
backup_package_variables backup_package_variables
run_package $pkgname run_package $pkgname
tidy_install tidy_install
lint_package || exit 1 lint_package || exit $E_PACKAGE_FAILED
create_package create_package
restore_package_variables restore_package_variables
done done
@ -1251,7 +1250,7 @@ OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar') OPT_LONG+=('asdeps' 'noconfirm' 'needed' 'noprogressbar')
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
exit 1 # E_INVALID_OPTION; exit $E_INVALID_OPTION;
fi fi
set -- "${OPTRET[@]}" set -- "${OPTRET[@]}"
unset OPT_SHORT OPT_LONG OPTRET unset OPT_SHORT OPT_LONG OPTRET
@ -1300,8 +1299,8 @@ while true; do
-S|--source) SOURCEONLY=1 ;; -S|--source) SOURCEONLY=1 ;;
--verifysource) VERIFYSOURCE=1 ;; --verifysource) VERIFYSOURCE=1 ;;
-h|--help) usage; exit 0 ;; # E_OK -h|--help) usage; exit $E_OK ;;
-V|--version) version; exit 0 ;; # E_OK -V|--version) version; exit $E_OK ;;
--) OPT_IND=0; shift; break 2;; --) OPT_IND=0; shift; break 2;;
esac esac
@ -1347,7 +1346,7 @@ if [[ -r $MAKEPKG_CONF ]]; then
else else
error "$(gettext "%s not found.")" "$MAKEPKG_CONF" error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 # $E_CONFIG_ERROR exit $E_CONFIG_ERROR
fi fi
# Source user-specific makepkg.conf overrides, but only if no override config # Source user-specific makepkg.conf overrides, but only if no override config
@ -1381,14 +1380,14 @@ if [[ ! -d $BUILDDIR ]]; then
if ! mkdir -p "$BUILDDIR"; then if ! mkdir -p "$BUILDDIR"; then
error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
chmod a-s "$BUILDDIR" chmod a-s "$BUILDDIR"
fi fi
if [[ ! -w $BUILDDIR ]]; then if [[ ! -w $BUILDDIR ]]; then
error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR" error "$(gettext "You do not have write permission to create packages in %s.")" "$BUILDDIR"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
# override settings from extra variables on commandline, if any # override settings from extra variables on commandline, if any
@ -1401,7 +1400,7 @@ PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
if (( ! (NOBUILD || GENINTEG) )) && [[ ! -w $PKGDEST ]]; then if (( ! (NOBUILD || GENINTEG) )) && [[ ! -w $PKGDEST ]]; then
error "$(gettext "You do not have write permission to store packages in %s.")" "$PKGDEST" error "$(gettext "You do not have write permission to store packages in %s.")" "$PKGDEST"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
SRCDEST=${_SRCDEST:-$SRCDEST} SRCDEST=${_SRCDEST:-$SRCDEST}
@ -1409,7 +1408,7 @@ SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
if [[ ! -w $SRCDEST ]] ; then if [[ ! -w $SRCDEST ]] ; then
error "$(gettext "You do not have write permission to store downloads in %s.")" "$SRCDEST" error "$(gettext "You do not have write permission to store downloads in %s.")" "$SRCDEST"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
SRCPKGDEST=${_SRCPKGDEST:-$SRCPKGDEST} SRCPKGDEST=${_SRCPKGDEST:-$SRCPKGDEST}
@ -1418,7 +1417,7 @@ if (( SOURCEONLY )); then
if [[ ! -w $SRCPKGDEST ]]; then if [[ ! -w $SRCPKGDEST ]]; then
error "$(gettext "You do not have write permission to store source tarballs in %s.")" "$SRCPKGDEST" error "$(gettext "You do not have write permission to store source tarballs in %s.")" "$SRCPKGDEST"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
# If we're only making a source tarball, then we need to ignore architecture- # If we're only making a source tarball, then we need to ignore architecture-
@ -1431,7 +1430,7 @@ LOGDEST=${LOGDEST:-$startdir} #default to $startdir if undefined
if (( LOGGING )) && [[ ! -w $LOGDEST ]]; then if (( LOGGING )) && [[ ! -w $LOGDEST ]]; then
error "$(gettext "You do not have write permission to store logs in %s.")" "$LOGDEST" error "$(gettext "You do not have write permission to store logs in %s.")" "$LOGDEST"
plain "$(gettext "Aborting...")" plain "$(gettext "Aborting...")"
exit 1 exit $E_FS_PERMISSIONS
fi fi
PKGEXT=${_PKGEXT:-$PKGEXT} PKGEXT=${_PKGEXT:-$PKGEXT}
@ -1445,12 +1444,12 @@ if (( ! INFAKEROOT )); then
if (( EUID == 0 )); then if (( EUID == 0 )); then
error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\ error "$(gettext "Running %s as root is not allowed as it can cause permanent,\n\
catastrophic damage to your system.")" "makepkg" catastrophic damage to your system.")" "makepkg"
exit 1 # $E_USER_ABORT exit $E_ROOT
fi fi
else else
if [[ -z $FAKEROOTKEY ]]; then if [[ -z $FAKEROOTKEY ]]; then
error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg" error "$(gettext "Do not use the %s option. This option is only for internal use by %s.")" "'-F'" "makepkg"
exit 1 # TODO: error code exit $E_INVALID_OPTION
fi fi
fi fi
@ -1465,16 +1464,17 @@ unset "${!sha384sums_@}" "${!sha512sums_@}"
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT} BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
if [[ ! -f $BUILDFILE ]]; then if [[ ! -f $BUILDFILE ]]; then
error "$(gettext "%s does not exist.")" "$BUILDFILE" error "$(gettext "%s does not exist.")" "$BUILDFILE"
exit 1 exit $E_USER_FUNCTION_FAILED
else else
if [[ $(<"$BUILDFILE") = *$'\r'* ]]; then if [[ $(<"$BUILDFILE") = *$'\r'* ]]; then
error "$(gettext "%s contains %s characters and cannot be sourced.")" "$BUILDFILE" "CRLF" error "$(gettext "%s contains %s characters and cannot be sourced.")" "$BUILDFILE" "CRLF"
exit 1 exit $E_PKGBUILD_ERROR
fi fi
if [[ ! $BUILDFILE -ef $PWD/${BUILDFILE##*/} ]]; then if [[ ! $BUILDFILE -ef $PWD/${BUILDFILE##*/} ]]; then
error "$(gettext "%s must be in the current working directory.")" "$BUILDFILE" error "$(gettext "%s must be in the current working directory.")" "$BUILDFILE"
exit 1 exit $E_PKGBUILD_ERROR
fi fi
if [[ ${BUILDFILE:0:1} != "/" ]]; then if [[ ${BUILDFILE:0:1} != "/" ]]; then
@ -1486,7 +1486,7 @@ fi
pkgbase=${pkgbase:-${pkgname[0]}} pkgbase=${pkgbase:-${pkgname[0]}}
# check the PKGBUILD for some basic requirements # check the PKGBUILD for some basic requirements
lint_pkgbuild || exit 1 lint_pkgbuild || exit $E_PKGBUILD_ERROR
if (( !SOURCEONLY && !PRINTSRCINFO )); then if (( !SOURCEONLY && !PRINTSRCINFO )); then
merge_arch_attrs merge_arch_attrs
@ -1512,7 +1512,7 @@ if (( GENINTEG )); then
cd_safe "$srcdir" cd_safe "$srcdir"
download_sources novcs allarch download_sources novcs allarch
generate_checksums generate_checksums
exit 0 # $E_OK exit $E_OK
fi fi
if have_function pkgver; then if have_function pkgver; then
@ -1520,7 +1520,7 @@ if have_function pkgver; then
fi fi
# check we have the software required to process the PKGBUILD # check we have the software required to process the PKGBUILD
check_software || exit 1 check_software || exit $E_MISSING_MAKEPKG_DEPS
if (( ${#pkgname[@]} > 1 )); then if (( ${#pkgname[@]} > 1 )); then
SPLITPKG=1 SPLITPKG=1
@ -1557,18 +1557,18 @@ if { [[ -z $SIGNPKG ]] && check_buildenv "sign" "y"; } || [[ $SIGNPKG == 'y' ]];
else else
error "$(gettext "There is no key in your keyring.")" error "$(gettext "There is no key in your keyring.")"
fi fi
exit 1 exit $E_PRETTY_BAD_PRIVACY
fi fi
fi fi
if (( PACKAGELIST )); then if (( PACKAGELIST )); then
print_all_package_names print_all_package_names
exit 0 exit $E_OK
fi fi
if (( PRINTSRCINFO )); then if (( PRINTSRCINFO )); then
write_srcinfo_content write_srcinfo_content
exit 0 exit $E_OK
fi fi
if (( ! PKGVERFUNC )); then if (( ! PKGVERFUNC )); then
@ -1580,7 +1580,7 @@ if (( INFAKEROOT )); then
if (( SOURCEONLY )); then if (( SOURCEONLY )); then
create_srcpackage create_srcpackage
msg "$(gettext "Leaving %s environment.")" "fakeroot" msg "$(gettext "Leaving %s environment.")" "fakeroot"
exit 0 # $E_OK exit $E_OK
fi fi
prepare_buildenv prepare_buildenv
@ -1593,7 +1593,7 @@ if (( INFAKEROOT )); then
run_package run_package
fi fi
tidy_install tidy_install
lint_package || exit 1 lint_package || exit $E_PACKAGE_FAILED
create_package create_package
create_debug_package create_debug_package
else else
@ -1601,7 +1601,7 @@ if (( INFAKEROOT )); then
fi fi
msg "$(gettext "Leaving %s environment.")" "fakeroot" msg "$(gettext "Leaving %s environment.")" "fakeroot"
exit 0 # $E_OK exit $E_OK
fi fi
msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))" msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))"
@ -1611,7 +1611,7 @@ if (( SOURCEONLY )); then
if [[ -f $SRCPKGDEST/${pkgbase}-${basever}${SRCEXT} ]] \ if [[ -f $SRCPKGDEST/${pkgbase}-${basever}${SRCEXT} ]] \
&& (( ! FORCE )); then && (( ! FORCE )); then
error "$(gettext "A source package has already been built. (use %s to overwrite)")" "-f" error "$(gettext "A source package has already been built. (use %s to overwrite)")" "-f"
exit 1 exit $E_ALREADY_BUILT
fi fi
# Get back to our src directory so we can begin with sources. # Get back to our src directory so we can begin with sources.
@ -1633,7 +1633,7 @@ if (( SOURCEONLY )); then
create_signature "$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}" create_signature "$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))" msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
exit 0 exit $E_OK
fi fi
if (( NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then if (( NODEPS || ( VERIFYSOURCE && !DEP_BIN ) )); then
@ -1666,7 +1666,7 @@ else
if (( deperr )); then if (( deperr )); then
error "$(gettext "Could not resolve all dependencies.")" error "$(gettext "Could not resolve all dependencies.")"
exit 1 exit $E_INSTALL_DEPS_FAILED
fi fi
fi fi
@ -1681,7 +1681,7 @@ if (( !REPKG )); then
else else
download_sources download_sources
check_source_integrity check_source_integrity
(( VERIFYSOURCE )) && exit 0 # $E_OK (( VERIFYSOURCE )) && exit $E_OK
if (( CLEANBUILD )); then if (( CLEANBUILD )); then
msg "$(gettext "Removing existing %s directory...")" "\$srcdir/" msg "$(gettext "Removing existing %s directory...")" "\$srcdir/"
@ -1708,7 +1708,7 @@ fi
if (( NOBUILD )); then if (( NOBUILD )); then
msg "$(gettext "Sources are ready.")" msg "$(gettext "Sources are ready.")"
exit 0 #E_OK exit $E_OK
else else
# clean existing pkg directory # clean existing pkg directory
if [[ -d $pkgdirbase ]]; then if [[ -d $pkgdirbase ]]; then
@ -1735,13 +1735,11 @@ fi
# if inhibiting archive creation, go no further # if inhibiting archive creation, go no further
if (( NOARCHIVE )); then if (( NOARCHIVE )); then
msg "$(gettext "Package directory is ready.")" msg "$(gettext "Package directory is ready.")"
exit 0 exit $E_OK
fi fi
msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))" msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))"
install_package install_package && exit $E_OK || exit $E_INSTALL_FAILED
exit 0 #E_OK
# vim: set noet: # vim: set noet: