From nobody Thu Oct 5 15:31:30 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4S1bBW1CNKz4vmTb; Thu, 5 Oct 2023 15:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4S1bBW0kvRz4bjt; Thu, 5 Oct 2023 15:31:31 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696519891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8zjTgEvsa2PyXtoTi1eDqrjv0zX6m/ol2MYzYZyst7w=; b=ITziiSXhqrs2ygx3ohpUYGmuK/lQz0z+hhh+KHyrF03yo627beyM8PQ4g7sCl2EGZcWYpv xoMoomGNoa/dXPacdKWEa7joi0FMZc4rkxOPuBum+yLcvJ+KF/gQqB5UAYeCxWU3lvn1Hx c1cc0fZ3MtPgyXNFJ6x+VTo6XiM51xwqeXB1uFDwcxc1LmZ+xY4AbRulHtQL6p2larkCUu /q0keFHtI8eaukuxAh/JqKzpc2zTHG7840bIdx8nOxBxO5Tz3/5mHC8U7oW7YZyx1oEu8d BNeoobyWqjc4mO+aPzMTzZLLqMKjMyBz/2INss0BXVcSJnl3khM0/ZJfIBvTfg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696519891; a=rsa-sha256; cv=none; b=egalqt7yoo7CiAkzb3HLt41U/4rnAxQqJxieGS5hPjP6eIjIT+sRYoARnK/DXbzS5XeWlj Hs+sSfIOkvkfmNckjFqnomceWwKCwYT73IScZH1DraVck04pDe6Ts+wyRdMFB7G+aPdeLw H7aU+aDPrwowG06Fl8Ce87Ctifr0uTEh0FEXpKo/oozFH2Bo4BZmFh3YCdzzQaqad5dp/W /hahCSu6g1/NVHxIhO+Y8DcxI0MAgE9UrOGUBTGpqo70aNQy9AIe+zbbholZ8mjZR29zr9 sxTErgfFdG//zQiztIPdXbI6TMRoZlTOHdlefTniHpv84YOvdodpJnsRxTo+yg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696519891; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8zjTgEvsa2PyXtoTi1eDqrjv0zX6m/ol2MYzYZyst7w=; b=qqUxeErASZ9Q7ZTMSEXKGCjzvXv9+WiGjEn8k/lUecxs+Lr3Y8MPSFsezq/F/AwU1eEVbo hlgxgmkWK4Mw+jaRc6OrKhDtOF3OsGEfpBIcuzuHSjvbpZgytsANjf0j6p9dYtHPTJ9ctw t5b0ZwyF34XJgW1N9stptPoG6H8yl6CdB7WiXNlfXKdCO6AIp+BhY5Alol51MTfTXwJ8K6 Au5CuqHbQDK7SwRbqUBu14wwlaCt3DPXsUWH6+utDWwMC86mScB6HsUIx8CycOL7xj6JEZ L8jDLQMR8a4rIdpW8otsvBr2Xft037fh5jUCitrc7GjqKNcrHF9ZskSHpjbJNg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4S1bBV6vS5z1Q6q; Thu, 5 Oct 2023 15:31:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 395FVUSK008764; Thu, 5 Oct 2023 15:31:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 395FVUFg008750; Thu, 5 Oct 2023 15:31:30 GMT (envelope-from git) Date: Thu, 5 Oct 2023 15:31:30 GMT Message-Id: <202310051531.395FVUFg008750@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 4ab019329025 - main - bsdconfig: simplify pkg installation and ABI detection List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4ab0193290255dffce3e123b7b9eec8f768740de Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4ab0193290255dffce3e123b7b9eec8f768740de commit 4ab0193290255dffce3e123b7b9eec8f768740de Author: Baptiste Daroussin AuthorDate: 2023-10-05 15:16:31 +0000 Commit: Baptiste Daroussin CommitDate: 2023-10-05 15:30:17 +0000 bsdconfig: simplify pkg installation and ABI detection --- usr.sbin/bsdconfig/share/packages/musthavepkg.subr | 34 ++++++++-------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/usr.sbin/bsdconfig/share/packages/musthavepkg.subr b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr index 9b5d94675345..0a1026afe86c 100644 --- a/usr.sbin/bsdconfig/share/packages/musthavepkg.subr +++ b/usr.sbin/bsdconfig/share/packages/musthavepkg.subr @@ -44,26 +44,16 @@ f_include $BSDCFG_SHARE/mustberoot.subr f_musthavepkg_init() { local funcname=f_musthavepkg_init - local pkg_abi_awk=' # BEGIN-AWK - $1 ~ /^ABI/ && $0 = $NF, sub(/^"/, "") && sub(/".*/, "") { - print; found = 1; exit - } END { exit ! found } - ' # END-AWK - if [ "$PKG_ABI" ]; then # Already set - f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" - export PKG_ABI - f_quietly pkg -N -vv # return status (pkg(8) functional?) - return $? - fi - - # Attempt to get PKG_ABI without prematurely bootstrapping pkg(8) - if f_eval_catch -k PKG_ABI $funcname pkg \ - "pkg -N -vv | awk '%s'" "$pkg_abi_awk" - then - f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" - export PKG_ABI - return $SUCCESS + if f_quietly pkg -N; then + if [ -n "$PKG_ABI" ]; then + export PKG_ABI + return $SUCCESS + fi + if f_eval_catch -k PKG_ABI $funcname pkg "pkg config abi"; then + export PKG_ABI + return $SUCCESS + fi fi # pkg(8) not yet bootstrapped; ask for permission unless nonInteractive @@ -74,10 +64,10 @@ f_musthavepkg_init() # Bootstrap pkg(8) f_dialog_info "$msg_bootstrapping_pkg" - f_eval_catch -k PKG_ABI $funcname pkg \ - "ASSUME_ALWAYS_YES=1 pkg -vv | awk '%s'" "$pkg_abi_awk" || + f_eval_catch $funcname pkg \ + "pkg bootstrap -y" || f_die 1 "$msg_must_have_pkg_to_execute" "$pgm" - + f_eval_catch -k PKG_ABI $funcname pkg "pkg config abi" f_dprintf "PKG_ABI=[%s]" "$PKG_ABI" export PKG_ABI return $SUCCESS