From nobody Tue Jul 15 05:12:51 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 4bh6l82B8Tz61whC; Tue, 15 Jul 2025 05:12:52 +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 4bh6l80z3bz3mF0; Tue, 15 Jul 2025 05:12:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752556372; 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=i9QVfql9nE8wlBGH12mSlEejIJfyi73YAhqOCPzBMvA=; b=mh2vClp1LyBdrfkkCGSSzlstkxQNrLse/CFDcrXT2FZBQT2mq74/4RtXU2iXGGETatZWfg wtE51ppywRBR4oPRhFopaS19KoHaBV3YjzlZZxSsJVwhW0kuVPc0+AVYOClzk0pOb63A/R 7z1clebqKjvaVWoPjCKUHN3DJqiKRcTdDHwoTtlv5NJgLNYWS3MpXigwIhUk55b4gnt4Qf VveTByiboVmab4vLsuhFZfnvqIWozUF+QNhlzPDQqjW4j6khPIwDbRRL10TKtjRS674n3l bz6huNZ+ZG/UQbvYYzC+dzDwe/aCDGbbJqaOT5P1s5BK5YuyR2DWjmKO9lx14g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752556372; 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=i9QVfql9nE8wlBGH12mSlEejIJfyi73YAhqOCPzBMvA=; b=oayXoA+bbyIt+PQi3OY3jqEeHXDBSYGJPOkeTbHqeSf/gt34KG+jQg45Q/rKSnkzlOiqnY l+s/DQ37tZuEIMQGcF/cVXlD4rXob5VwtTaNshHyk3tkw7REc6vB7FygRrV3a9jsclh1j0 LowxtmbRIpG6FmEEbx4G0XjJmgslRnHzQ/wZZGg+xSeeOVNRBkCMj4+O/1SEAmiyPYZwaU jV9XwJfEkMJZog8stNUb/4uqhN6RfpkvAWi9QtWhAL7VNO2ueyzUTyxUUQHpFtg9F5ouzb CVguAVtpS8xNuhmy2As0TCkTLvEQyZPqTGQvSCjqWEmp/3ku3Cfb/oPAh/hcQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752556372; a=rsa-sha256; cv=none; b=qlFoC+0qGdEQR1k5U+GKp7JSuD0+UP3yz9trFXcyJzAA6lVI8Fj5kclehvEoSp9ZLjdWEe fFejJkETQ43LbC6czbIiu6wEIkJkAuZICrbIQPtgUaDlYqMs1x6Q76QklZbsDwdxZwBNYb +tGAevF2jzJT7ivJdOlkGiIXesPi2Uob3jVWD1fPVjjAUiTo7A3+Ezp2qm017nWsrZKPBe irjTPCa0+ldhb5I8A6Tb3fX+u78iD9W+rl0zC29Ji9uxkgxO2mayN/lNflgsidfuToTSQ8 eU09TR+aMEE5kLPwHZr+BDIh9UBq+IFtIDwEs/qQJER2AElBPEsUAwI0RVlEuA== 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 4bh6l80ZF6z9dg; Tue, 15 Jul 2025 05:12:52 +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 56F5CpR5079657; Tue, 15 Jul 2025 05:12:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56F5CpOD079654; Tue, 15 Jul 2025 05:12:51 GMT (envelope-from git) Date: Tue, 15 Jul 2025 05:12:51 GMT Message-Id: <202507150512.56F5CpOD079654@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: e64ad2324153 - main - packages: move ucl files to a subdirectory 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: e64ad2324153dcd77aba0cd42bb8f194b62bb955 Auto-Submitted: auto-generated The branch main has been updated by ivy: URL: https://cgit.FreeBSD.org/src/commit/?id=e64ad2324153dcd77aba0cd42bb8f194b62bb955 commit e64ad2324153dcd77aba0cd42bb8f194b62bb955 Author: Lexi Winter AuthorDate: 2025-07-07 13:30:13 +0000 Commit: Lexi Winter CommitDate: 2025-07-15 05:12:44 +0000 packages: move ucl files to a subdirectory We want to have a UCL file for every package, to set fields like comment, desc, license, etc.; to avoid cluttering release/packages with ~200 new files, move these to the ucl/ directory. Add a better description for the yp package to demonstrate how this will work in practice. Clean up the handling of the package comment suffix for generated packages (dev, lib32, etc.) and do the UCL modifications in generate-ucl.lua, so we don't overwrite the ucl's comment. Add a long-form suffix to the description for generated packages to explain what they do. Eventually, we should require the ucl file exists (try=false) to prevent people accidentally creating new packages with a typo, but for now, keep the ucl optional. Reviewed by: kevans, des, bapt, emaste Approved by: kevans (mentor), des (mentor) Differential Revision: https://reviews.freebsd.org/D50160 --- release/packages/Makefile.package | 2 - release/packages/generate-ucl.lua | 45 +++++++++++++-- release/packages/generate-ucl.sh | 92 ++++++++++++++++++++---------- release/packages/{ => ucl}/certctl.ucl | 0 release/packages/{ => ucl}/clang-all.ucl | 0 release/packages/{ => ucl}/clibs.ucl | 0 release/packages/{ => ucl}/lld-all.ucl | 0 release/packages/{ => ucl}/lldb-all.ucl | 0 release/packages/{ => ucl}/runtime.ucl | 0 release/packages/{ => ucl}/ssh-all.ucl | 0 release/packages/{ => ucl}/unbound-all.ucl | 0 release/packages/{ => ucl}/utilities.ucl | 0 release/packages/ucl/yp-all.ucl | 7 +++ 13 files changed, 107 insertions(+), 39 deletions(-) diff --git a/release/packages/Makefile.package b/release/packages/Makefile.package index c2427aa16945..e00efed2af1b 100644 --- a/release/packages/Makefile.package +++ b/release/packages/Makefile.package @@ -187,7 +187,5 @@ vt_COMMENT= VT fonts and keyboard files vt_DESC= VT fonts and keyboard files wpa_COMMENT= 802.11 Supplicant wpa_DESC= 802.11 Supplicant -yp_COMMENT= Yellow Pages programs -yp_DESC= Yellow Pages programs zfs_COMMENT= ZFS Libraries and Utilities zfs_DESC= ZFS Libraries and Utilities diff --git a/release/packages/generate-ucl.lua b/release/packages/generate-ucl.lua index ae6ee58dd84a..0d18e1dc0120 100755 --- a/release/packages/generate-ucl.lua +++ b/release/packages/generate-ucl.lua @@ -3,33 +3,66 @@ --[[ usage: generare-ucl.lua [ ]... -In the files the variable (in the form ${variablename} -in the ) will be expanded to . +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 . -The undefined variables will reamin unmofifier "${variablename}" +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") +local comment_suffix = nil +local desc_suffix = nil + +-- This parser is the output UCL we want to build. +local parser = ucl.parser() + +-- Set any $VARIABLES from the command line in the parser. This causes ucl to +-- automatically replace them when we load the source ucl. if #arg < 2 or #arg % 2 ~= 0 then io.stderr:write(arg[0] .. ": expected an even number of arguments, got " .. #arg) os.exit(1) end -local parser = ucl.parser() for i = 2, #arg - 2, 2 do - parser:register_variable(arg[i - 1], arg[i]) + local varname = arg[i - 1] + local varvalue = arg[i] + + if varname == "COMMENT_SUFFIX" and #varvalue > 0 then + comment_suffix = varvalue + elseif varname == "DESC_SUFFIX" and #varvalue > 0 then + desc_suffix = varvalue + end + + parser:register_variable(varname, varvalue) end + +-- Load the source ucl file. local res,err = parser:parse_file(arg[#arg - 1]) if not res then io.stderr:write(arg[0] .. ": fail to parse("..arg[#arg - 1].."): "..err) os.exit(1) end + +local obj = parser:get_object() + +-- 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 + +-- Write the output file. local f,err = io.open(arg[#arg], "w") if not f then io.stderr:write(arg[0] .. ": fail to open("..arg[#arg].."): ".. err) os.exit(1) end -local obj = parser:get_object() + f:write(ucl.to_format(obj, 'ucl', true)) f:close() diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index b7d7bad35023..4dac34cd4753 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -2,9 +2,35 @@ # # +mancx=" (manual pages)" +mandx="This package contains the online manual pages." + +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= + desc_suffix="" comment= + comment_suffix="" debug= uclsource= while getopts "do:s:u:" arg; do @@ -52,51 +78,53 @@ main() { # as a dependency. libcompat-dev|libcompiler_rt-dev|liby-dev) outname=${outname%%-dev} - _descr="Development Files" + comment_suffix="$devcx" + desc_suffix="$devdx" ;; - libcompat-lib32_dev|libcompiler_rt-lib32_dev|liby-lib32_dev) - outname=${outname%%-lib32_dev} - _descr="32-bit Libraries, Development Files" + libcompat-dev-lib32|libcompiler_rt-dev-lib32|liby-dev-lib32) + outname=${outname%%-dev-lib32} + comment_suffix="$dev32cx" + desc_suffix="$dev32dx" ;; libcompat-man|libelftc-man) outname=${outname%%-man} - _descr="Manual Pages" - ;; - utilities) - uclfile="${uclfile}" - ;; - runtime) - outname="runtime" - _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" + comment_suffix="$mancx" + desc_suffix="$mandx" ;; - *-lib32_dev) - outname="${outname%%-lib32_dev}" - _descr="32-bit Libraries, Development Files" + *-dev) + outname="${outname%%-dev}" + comment_suffix="$devcx" + desc_suffix="$devdx" pkgdeps="${outname}" ;; - *-lib32_dbg) - outname="${outname%%-lib32_dbg}" - _descr="32-bit Libraries, Debugging Symbols" + *-dbg) + outname="${outname%%-dbg}" + comment_suffix="$dbgcx" + desc_suffix="$dbgdx" pkgdeps="${outname}" ;; - *-lib32) - outname="${outname%%-lib32}" - _descr="32-bit Libraries" + *-dev-lib32) + outname="${outname%%-dev-lib32}" + comment_suffix="$dev32cx" + desc_suffix="$dev32dx" pkgdeps="${outname}" ;; - *-dev) - outname="${outname%%-dev}" - _descr="Development Files" + *-dbg-lib32) + outname="${outname%%-dbg-lib32}" + comment_suffix="$dbg32cx" + desc_suffix="$dbg32dx" pkgdeps="${outname}" ;; - *-dbg) - outname="${outname%%-dbg}" - _descr="Debugging Symbols" + *-lib32) + outname="${outname%%-lib32}" + comment_suffix="$lib32cx" + desc_suffix="$lib32dx" pkgdeps="${outname}" ;; *-man) outname="${outname%%-man}" - _descr="Manual Pages" + comment_suffix="$mancx" + desc_suffix="$mandx" pkgdeps="${outname}" ;; ${origname}) @@ -116,13 +144,14 @@ main() { echo "" echo "===============================================================" echo "DEBUG:" - echo "_descr=${_descr}" echo "outname=${outname}" echo "origname=${origname}" echo "srctree=${srctree}" echo "uclfile=${uclfile}" echo "desc=${desc}" + echo "desc_suffix=${desc_suffix}" echo "comment=${comment}" + echo "comment_suffix=${comment_suffix}" echo "vital=${vital}" echo "cp ${uclsource} -> ${uclfile}" echo "===============================================================" @@ -132,7 +161,6 @@ main() { fi [ -z "${comment}" ] && comment="${outname} package" - [ -n "${_descr}" ] && comment="${comment} (${_descr})" [ -z "${desc}" ] && desc="${outname} package" cp "${uclsource}" "${uclfile}" @@ -155,11 +183,13 @@ EOF PKGGENNAME "${outname}" \ PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ COMMENT "${comment}" \ + COMMENT_SUFFIX "${comment_suffix}" \ DESC "${desc}" \ + DESC_SUFFIX "$desc_suffix" \ CAP_MKDB_ENDIAN "${cap_arg}" \ PKG_WWW "${PKG_WWW}" \ PKG_MAINTAINER "${PKG_MAINTAINER}" \ - UCLFILES "${srctree}/release/packages/" \ + UCLFILES "${srctree}/release/packages/ucl" \ ${uclfile} ${uclfile} return 0 diff --git a/release/packages/certctl.ucl b/release/packages/ucl/certctl.ucl similarity index 100% rename from release/packages/certctl.ucl rename to release/packages/ucl/certctl.ucl diff --git a/release/packages/clang-all.ucl b/release/packages/ucl/clang-all.ucl similarity index 100% rename from release/packages/clang-all.ucl rename to release/packages/ucl/clang-all.ucl diff --git a/release/packages/clibs.ucl b/release/packages/ucl/clibs.ucl similarity index 100% rename from release/packages/clibs.ucl rename to release/packages/ucl/clibs.ucl diff --git a/release/packages/lld-all.ucl b/release/packages/ucl/lld-all.ucl similarity index 100% rename from release/packages/lld-all.ucl rename to release/packages/ucl/lld-all.ucl diff --git a/release/packages/lldb-all.ucl b/release/packages/ucl/lldb-all.ucl similarity index 100% rename from release/packages/lldb-all.ucl rename to release/packages/ucl/lldb-all.ucl diff --git a/release/packages/runtime.ucl b/release/packages/ucl/runtime.ucl similarity index 100% rename from release/packages/runtime.ucl rename to release/packages/ucl/runtime.ucl diff --git a/release/packages/ssh-all.ucl b/release/packages/ucl/ssh-all.ucl similarity index 100% rename from release/packages/ssh-all.ucl rename to release/packages/ucl/ssh-all.ucl diff --git a/release/packages/unbound-all.ucl b/release/packages/ucl/unbound-all.ucl similarity index 100% rename from release/packages/unbound-all.ucl rename to release/packages/ucl/unbound-all.ucl diff --git a/release/packages/utilities.ucl b/release/packages/ucl/utilities.ucl similarity index 100% rename from release/packages/utilities.ucl rename to release/packages/ucl/utilities.ucl diff --git a/release/packages/ucl/yp-all.ucl b/release/packages/ucl/yp-all.ucl new file mode 100644 index 000000000000..9e17cd108d84 --- /dev/null +++ b/release/packages/ucl/yp-all.ucl @@ -0,0 +1,7 @@ +comment = "Yellow Pages (YP) / Network Information Service (NIS)" +desc = <