X-Original-To: alpine-devel@lists.alpinelinux.org Received: from welho-filter2.welho.com (welho-filter2.welho.com [83.102.41.24]) by lists.alpinelinux.org (Postfix) with ESMTP id DE2C55C507E for ; Mon, 6 Mar 2017 16:12:57 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by welho-filter2.welho.com (Postfix) with ESMTP id EE9211F240; Mon, 6 Mar 2017 18:12:56 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at pp.htv.fi Received: from welho-smtp3.welho.com ([IPv6:::ffff:83.102.41.86]) by localhost (welho-filter2.welho.com [::ffff:83.102.41.24]) (amavisd-new, port 10024) with ESMTP id iTAQdHU2--Xu; Mon, 6 Mar 2017 18:12:56 +0200 (EET) Received: from kanala.kunkku.net (178-75-143-108.bb.dnainternet.fi [178.75.143.108]) by welho-smtp3.welho.com (Postfix) with ESMTP id 6B4962313; Mon, 6 Mar 2017 18:12:56 +0200 (EET) Received: from kanala.kunkku.net (kanala.kunkku.net [127.0.0.1]) by kanala.kunkku.net (8.15.2/8.15.2) with ESMTP id v26GCuSf002367; Mon, 6 Mar 2017 18:12:56 +0200 Received: (from kaarle@localhost) by kanala.kunkku.net (8.15.2/8.15.2/Submit) id v26GCuge002366; Mon, 6 Mar 2017 18:12:56 +0200 X-Authentication-Warning: kanala.kunkku.net: kaarle set sender to kaarle.ritvanen@datakunkku.fi using -f From: Kaarle Ritvanen To: alpine-devel@lists.alpinelinux.org Cc: Kaarle Ritvanen Subject: [alpine-devel] [PATCH 2/2] abuild: enable -e shell option Date: Mon, 6 Mar 2017 18:12:39 +0200 Message-Id: <20170306161239.2317-2-kaarle.ritvanen@datakunkku.fi> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170306161239.2317-1-kaarle.ritvanen@datakunkku.fi> References: <20170306161239.2317-1-kaarle.ritvanen@datakunkku.fi> X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: --- This patch has the potential to break quite a number of APKBUILD files. However, it would make them simpler and more reliable by removing the need to check command exit codes in most places. An alternative would be to add an APKBUILD option to control the automatic exit code checking behavior. abuild.in | 69 ++++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/abuild.in b/abuild.in index 90da90d..6fd0670 100644 --- a/abuild.in +++ b/abuild.in @@ -1,4 +1,4 @@ -#!/bin/ash +#!/bin/ash -e # abuild - build apk packages (light version of makepkg) # Copyright (c) 2008-2015 Natanael Copa @@ -240,8 +240,7 @@ sumcheck() { endreturnval=0 for src in $sums; do origin=$1; shift - echo "$src" | ${algo}sum -c - if [ $? -ne 0 ]; then + if ! echo "$src" | ${algo}sum -c; then endreturnval=1 is_remote $origin || continue @@ -567,7 +566,9 @@ update_config_guess() { runpart() { local part=$1 [ -n "$DEBUG" ] && msg "$part" - $part || die "$part failed" + abuild_function=$part "$abuild_path" \ + $color_opt $nodeps $force $forceroot $keep $quiet \ + $install_deps $recursive $upgrade || die "$part failed" } # override those in your build script @@ -1409,12 +1410,19 @@ build_abuildrepo() { fi if ! apk_up2date || [ -n "$force" ]; then # check early if we have abuild key - abuild-sign --installed || return 1 + abuild-sign --installed logcmd "building $repo/$pkgname-$pkgver-r$pkgrel" - sanitycheck && builddeps && clean && fetch && unpack \ - && prepare && mkusers && $_build && $_check \ - && rootpkg && cleanup $CLEANUP \ - || return 1 + sanitycheck + builddeps + clean + fetch + unpack + prepare + mkusers + $_build + $_check + rootpkg + cleanup $CLEANUP fi update_abuildrepo_index } @@ -1515,9 +1523,7 @@ default_doc() { rm -f "$subpkgdir/usr/share/info/dir" # remove if empty, ignore error (not empty) - rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null - - return 0 + rmdir "$pkgdir/usr/share" "$pkgdir/usr" 2>/dev/null || : } doc() { @@ -1573,7 +1579,7 @@ default_dev() { d="$subpkgdir/${i%/*}" # dirname $i mkdir -p "$d" mv "$pkgdir/$i" "$d" - rmdir "$pkgdir/${i%/*}" 2>/dev/null + rmdir "$pkgdir/${i%/*}" 2>/dev/null || : fi done # move *.so links needed when linking the apps to -dev packages @@ -1995,7 +2001,9 @@ stripbin() { | while read filename; do local XATTR=$(getfattr --match="" --dump "${filename}") "${stripcmd}" "${filename}" - [ -n "$XATTR" ] && { echo "$XATTR" | setfattr --restore=-; } + if [ -n "$XATTR" ]; then + echo "$XATTR" | setfattr --restore=- + fi done } @@ -2098,12 +2106,11 @@ deps() { undeps() { local _quiet="$@" - $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname + $SUDO_APK del $_quiet $apk_opt_wait .makedepends-$pkgname || : if [ -n "$CBUILDROOT" ]; then $SUDO_APK del $_quiet --root "$CBUILDROOT" --arch "$CTARGET_ARCH" $apk_opt_wait \ - --no-scripts .makedepends-$pkgname + --no-scripts .makedepends-$pkgname || : fi - return 0 } # compat @@ -2247,7 +2254,7 @@ while getopts "AcdfFhkKimnp:P:qrRs:u" opt; do 'A') echo "$CARCH"; exit 0;; 'c') enable_colors color_opt="-c";; - 'd') nodeps=1;; + 'd') nodeps="-d";; 'f') force="-f";; 'F') forceroot="-F";; 'h') usage;; @@ -2303,7 +2310,7 @@ if [ -z "$REPODEST" ]; then fi # for recursive action -export REPODEST +export REPODEST SRCDEST # if we want build debug package if [ -n "$DEBUG" ] || subpackage_types_has "dbg"; then @@ -2331,15 +2338,23 @@ fi controldir="$pkgbasedir"/.control.${subpkgname:-$pkgname} trap 'die "Aborted by user"' INT -[ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname" -if [ -z "$1" ]; then - set all -fi +if [ "$abuild_function" ]; then + _function=$abuild_function + abuild_function= + $_function -while [ $# -gt 0 ]; do - runpart $1 - shift -done +else + [ -z "$subpkgdir" ] && set_xterm_title "abuild${CROSS_COMPILE+-$CARCH}: $pkgname" + + if [ -z "$1" ]; then + set all + fi + + while [ $# -gt 0 ]; do + runpart $1 + shift + done +fi cleanup -- 2.9.3 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---