From nobody Tue Jul 15 05:12:56 2025 X-Original-To: dev-commits-src-all@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 4bh6lF0PGMz61wv2; Tue, 15 Jul 2025 05:12:56 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bh6lD3MqDz3ly5; Tue, 15 Jul 2025 05:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752556376; 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=K8IeVCeU2hlMMIFjutdw8K6dfvTPAhwsCo4d7ZV2Pek=; b=pVCdCM/AnOu4uSvNYSujfColGtLoMt7HgpO/mzMwP7pkNfAtJSLFqY3lG87pBvBwf61kro FWh/ViLL6zeD+qmqoRVMBNVfQ2pDqz41sZb5F88pIZ8efAkEmqBWWXtIdXpjFTAFX+kmM8 OecD/+S/Awcuqo8clMPsRJbGssfGQoXO/+nbxKExRlpGnjYzp+rRf5VBVcKC7/XGvOljw6 nknK9CJQEJaa4XSRr/Kppemdjvr95sOshku/thEnZJQD/inpk7QWGfnB4PNUDPd11+iFSs rBIxVwwCinaS6sQ1TsFxIRjfCHXvSQt3hjqqyedJxWo8GZpnTzweJXh3hsjEIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752556376; 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=K8IeVCeU2hlMMIFjutdw8K6dfvTPAhwsCo4d7ZV2Pek=; b=tgDWat/cnzPyeAquZd0jVRs0pBmK50NU2kR5i57oZdbFJi7tnr2ge4hG8lUFEkr8nhN+ii GufKb6CGkYA1Knd6fF4Vjyhn4wmMwtEa7ZUWDE/dUepSct09BxeKde1ySBBBYd9yGjSnzo LEBvZoGdWpjmudy34LTBTFm2W17VR8zp/x+qp8wYpH6Sg5Qi5pOh7wflmRS7fVSNi32e5x fMWlR/1T9KiGiNsO6zB9/ipRiROAFtF+5VZeY6ZzX8jlTmPPSqoZJ/eCMNdxDdKxHKVqqJ dqECniCu6TbQU11AqkK+OobFff9x6SqG1d1EA/K0GT73jbjyh9ogCKIqzVrcvQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752556376; a=rsa-sha256; cv=none; b=DtnXfRXQ33udUHUHAJIko6t0XNRdJI9vprGV6W7W6UtMKatFoLSoK50I+7P46Hi1M8DNBe 0pjZ+ouyXSPvIG6knZFmqGsg5PNlN8ea+AzXYvuw+Z+wQa8RV2lkxHe4LYgLiG7XwS1eoN IK6KPELqM6+1O7XWuTT7Vb5T0FP65wwaX9xqSSK00kf/sNVZn/MQw07FwgcdjQxycbWzbv 6TV3k/2eBQKaG3FR90WU+h5FT3unnjZFkUsT/xEmKVK8XibvWDWE3b6R26qzVz5YwA+MgP 1SQun46xoKypdDIfAUo4wvEJcyIWG7HtzU4SsDEwG9MmZJN+1ootMKG9AeahmA== 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 4bh6lD2zPfz9c3; Tue, 15 Jul 2025 05:12:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56F5CulO079810; Tue, 15 Jul 2025 05:12:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56F5CusJ079807; Tue, 15 Jul 2025 05:12:56 GMT (envelope-from git) Date: Tue, 15 Jul 2025 05:12:56 GMT Message-Id: <202507150512.56F5CusJ079807@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Lexi Winter Subject: git: 237db83d02c8 - main - packages: handle suffixes in generate-ucl.lua List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ivy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 237db83d02c8fb3a6292427990a92ca280f73177 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=237db83d02c8fb3a6292427990a92ca280f73177 commit 237db83d02c8fb3a6292427990a92ca280f73177 Author: Lexi Winter AuthorDate: 2025-07-07 13:39:39 +0000 Commit: Lexi Winter CommitDate: 2025-07-15 05:12:44 +0000 packages: handle suffixes in generate-ucl.lua Move handling of comment/desc suffixes from generate-ucl.sh to generate-ucl.lua. Reviewed by: des, bapt Approved by: des (mentor) Differential Revision: https://reviews.freebsd.org/D50284 --- release/packages/generate-ucl.lua | 72 ++++++++++++++++++++++++++++++--------- release/packages/generate-ucl.sh | 46 ------------------------- 2 files changed, 56 insertions(+), 62 deletions(-) diff --git a/release/packages/generate-ucl.lua b/release/packages/generate-ucl.lua index 0557e8e8cc23..3d91d11bc42f 100755 --- a/release/packages/generate-ucl.lua +++ b/release/packages/generate-ucl.lua @@ -6,14 +6,65 @@ generare-ucl.lua [ ]... Build a package's UCL configuration by loading the template UCL file , replacing any $VARIABLES in the UCL based on the provided variables, then writing the result to . - -If COMMENT_SUFFIX or DESC_SUFFIX are set, append these to the generated comment -and desc fields. We do this here because there's no way to do it in -template.ucl. ]]-- local ucl = require("ucl") +-- Give subpackages a special comment and description suffix to indicate what +-- they contain, so e.g. "foo-man" has " (manual pages)" appended to its +-- comment. This avoids having to create a separate ucl files for every +-- subpackage just to set this. +-- +-- Note that this is not a key table because the order of the pattern matches +-- is important. +pkg_suffixes = { + { + "%-dev%-lib32$", "(32-bit development files)", + "This package contains development files for compiling ".. + "32-bit applications on a 64-bit host." + }, + { + "%-dbg%-lib32$", "(32-bit debugging symbols)", + "This package contains 32-bit external debugging symbols ".. + "for use with a source-level debugger.", + }, + { + "%-man%-lib32$", "(32-bit manual pages)", + "This package contains the online manual pages for 32-bit ".. + "components on a 64-bit host.", + }, + { + "%-lib32$", "(32-bit libraries)", + "This package contains 32-bit libraries for running 32-bit ".. + "applications on a 64-bit host.", + }, + { + "%-dev$", "(development files)", + "This package contains development files for ".. + "compiling applications." + }, + { + "%-man$", "(manual pages)", + "This package contains the online manual pages." + }, + { + "%-dbg$", "(debugging symbols)", + "This package contains external debugging symbols for use ".. + "with a source-level debugger.", + }, +} + +function add_suffixes(obj) + local pkgname = obj["name"] + for _,pattern in pairs(pkg_suffixes) do + if pkgname:match(pattern[1]) ~= nil then + obj["comment"] = obj["comment"] .. " " .. pattern[2] + obj["desc"] = obj["desc"] .. "\n\n" .. pattern[3] + return + end + end +end + -- Hardcode a list of packages which don't get the automatic pkggenname -- dependency because the base package doesn't exist. We should have a better -- way to handle this. @@ -50,8 +101,6 @@ local pkgname = nil local pkggenname = nil local pkgprefix = nil local pkgversion = nil -local comment_suffix = nil -local desc_suffix = nil -- This parser is the output UCL we want to build. local parser = ucl.parser() @@ -73,10 +122,6 @@ for i = 2, #arg - 2, 2 do pkggenname = varvalue elseif varname == "VERSION" and #varvalue > 0 then pkgversion = varvalue - elseif varname == "COMMENT_SUFFIX" and #varvalue > 0 then - comment_suffix = varvalue - elseif varname == "DESC_SUFFIX" and #varvalue > 0 then - desc_suffix = varvalue elseif varname == "PKG_NAME_PREFIX" and #varvalue > 0 then pkgprefix = varvalue end @@ -118,12 +163,7 @@ if pkgprefix ~= nil and obj["deps"] ~= nil then end -- Add comment and desc suffix. -if comment_suffix ~= nil then - obj["comment"] = obj["comment"] .. comment_suffix -end -if desc_suffix ~= nil then - obj["desc"] = obj["desc"] .. "\n\n" .. desc_suffix -end +add_suffixes(obj) -- Write the output file. local f,err = io.open(arg[#arg], "w") diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index 57fe181ec5bb..7b08c3a8c59d 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -2,37 +2,9 @@ # # -mancx=" (manual pages)" -mandx="This package contains the online manual pages." - -lib32mancx=" (32-bit manual pages)" -lib32mandx="This package contains the online manual pages for 32-bit components -on a 64-bit host." - -lib32cx=" (32-bit libraries)" -lib32dx="This package contains 32-bit libraries for running 32-bit applications on -a 64-bit host." - -devcx=" (development files)" -devdx="This package contains development files for compiling applications." - -dev32cx=" (32-bit development files)" -dev32dx="This package contains development files for compiling 32-bit applications -on a 64-bit host." - -dbgcx=" (debugging symbols)" -dbgdx="This package contains external debugging symbols for use with a source-level -debugger." - -dbg32cx=" (32-bit debugging symbols)" -dbg32dx="This package contains 32-bit external debugging symbols for use with a -source-level debugger." - main() { outname="" origname="" - desc_suffix="" - comment_suffix="" debug= uclsource= while getopts "do:s:u:" arg; do @@ -61,38 +33,24 @@ main() { case "${outname}" in *-dev) outname="${outname%%-dev}" - comment_suffix="$devcx" - desc_suffix="$devdx" ;; *-dbg) outname="${outname%%-dbg}" - comment_suffix="$dbgcx" - desc_suffix="$dbgdx" ;; *-dev-lib32) outname="${outname%%-dev-lib32}" - comment_suffix="$dev32cx" - desc_suffix="$dev32dx" ;; *-dbg-lib32) outname="${outname%%-dbg-lib32}" - comment_suffix="$dbg32cx" - desc_suffix="$dbg32dx" ;; *-man-lib32) outname="${outname%%-man-lib32}" - comment_suffix="$lib32mancx" - desc_suffix="$lib32mandx" ;; *-lib32) outname="${outname%%-lib32}" - comment_suffix="$lib32cx" - desc_suffix="$lib32dx" ;; *-man) outname="${outname%%-man}" - comment_suffix="$mancx" - desc_suffix="$mandx" ;; ${origname}) ;; @@ -112,8 +70,6 @@ main() { echo "origname=${origname}" echo "srctree=${srctree}" echo "uclfile=${uclfile}" - echo "desc_suffix=${desc_suffix}" - echo "comment_suffix=${comment_suffix}" echo "vital=${vital}" echo "cp ${uclsource} -> ${uclfile}" echo "===============================================================" @@ -128,8 +84,6 @@ main() { PKGNAME "${origname}" \ PKGGENNAME "${outname}" \ PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ - COMMENT_SUFFIX "${comment_suffix}" \ - DESC_SUFFIX "$desc_suffix" \ CAP_MKDB_ENDIAN "${cap_arg}" \ PKG_WWW "${PKG_WWW}" \ PKG_MAINTAINER "${PKG_MAINTAINER}" \