X-Original-To: alpine-devel@lists.alpinelinux.org Received: from welho-filter1.welho.com (welho-filter1.welho.com [83.102.41.23]) by lists.alpinelinux.org (Postfix) with ESMTP id B80F65C3727 for ; Mon, 6 Mar 2017 16:12:54 +0000 (GMT) Received: from localhost (localhost [127.0.0.1]) by welho-filter1.welho.com (Postfix) with ESMTP id 5EBB41CB4D; Mon, 6 Mar 2017 18:12:52 +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-filter1.welho.com [::ffff:83.102.41.23]) (amavisd-new, port 10024) with ESMTP id o_Sfvrj6x-_o; Mon, 6 Mar 2017 18:12:51 +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 CE14B2313; Mon, 6 Mar 2017 18:12:51 +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 v26GCpLO002363; Mon, 6 Mar 2017 18:12:51 +0200 Received: (from kaarle@localhost) by kanala.kunkku.net (8.15.2/8.15.2/Submit) id v26GCoNn002362; Mon, 6 Mar 2017 18:12:50 +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 1/2] abuild: fix dependency checking Date: Mon, 6 Mar 2017 18:12:38 +0200 Message-Id: <20170306161239.2317-1-kaarle.ritvanen@datakunkku.fi> X-Mailer: git-send-email 2.9.3 X-Mailinglist: alpine-devel Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: - versioned dependencies - dependencies on 'provides' tags or library names --- abuild.in | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/abuild.in b/abuild.in index 22bd454..90da90d 100644 --- a/abuild.in +++ b/abuild.in @@ -1855,10 +1855,26 @@ calcdeps() { fi } +get_missing_deps() { + local cmd="$APK info --quiet --installed $1" + shift + + while [ "$1" ]; do + if [ ${1:0:1} = "!" ]; then + if $cmd ${1:1}; then + error "Conflicting package installed: ${1:1}" + return 1 + fi + elif [ "$upgrade" ] || ! $cmd $1; then + echo $1 + fi + shift + done +} + # build and install dependencies builddeps() { - local pkg= i= missing= BUILD_BASE= - local installed_hostdeps= installed_builddeps= + local pkg= i= BUILD_BASE= [ -n "$nodeps" ] && return 0 msg "Analyzing dependencies..." @@ -1872,30 +1888,11 @@ builddeps() { esac calcdeps "$BUILD_BASE" - installed_builddeps=$($APK info --installed $builddeps) - [ -n "$CBUILDROOT" -a -n "$hostdeps" ] && installed_hostdeps=$($APK info --root "$CBUILDROOT" --arch "$CTARGET_ARCH" --installed $hostdeps) - # find which deps are missing - for i in $builddeps; do - if [ "${i#\!}" != "$i" ]; then - if $APK info --quiet --installed "${i#\!}"; then - error "Conflicting package installed: ${i#\!}" - return 1 - fi - elif ! deplist_has $i $installed_builddeps || [ -n "$upgrade" ]; then - missing="$missing $i" - fi - done - for i in $hostdeps; do - if [ "${i#\!}" != "$i" ]; then - if $APK info --quiet --installed --root "$CBUILDROOT" --arch "$CTARGET_ARCH" "${i#\!}"; then - error "Conflicting package installed: ${i#\!}" - return 1 - fi - elif ! deplist_has $i $installed_hostdeps || [ -n "$upgrade" ]; then - missing="$missing $i" - fi - done + local mbd mhd missing + mbd=$(get_missing_deps "" $builddeps) || return 1 + mhd=$(get_missing_deps "--root $CBUILDROOT --arch $CTARGET_ARCH" $hostdeps) || return 1 + missing=$(echo $mbd $mhd) if [ -z "$install_deps" ] && [ -z "$recursive" ]; then # if we dont have any missing deps we are done now -- 2.9.3 --- Unsubscribe: alpine-devel+unsubscribe@lists.alpinelinux.org Help: alpine-devel+help@lists.alpinelinux.org ---