From nobody Tue Mar 19 06:58:57 2024 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 4TzMyT6fylz5DhNN; Tue, 19 Mar 2024 06:58:57 +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 4TzMyT6Q6Rz4Dp3; Tue, 19 Mar 2024 06:58:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710831537; 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=H9a6h89XLVr3NUeQz2Ax932zL4AC6Sv21In00D64fos=; b=f3cf+gsAflfmwtkot5ImZMHxqTyICgsAGgT2NlA4YRaXSNwNXTmbBXixreJAuTCt/Wx6Dc 80beKoOEY0WyVPWSPqA2M/uK5rZ7cjrR008mQWoknzmAj/2V9lr34kj0M1fVBScpBNnAB6 lA3PARgBa6/p5uxAW/ou+5l3dnZ9iGlZDLo9RY+0brIzPVGvvq5GD1aFsuwaw1UAPYgYyK Ub2SgcbpvgxG0C39ROmwHlStJS+qzNgK8cGDYO+6gdqNvnJcdiidyCaMwfJjVyTnZDSIz8 5SEIAPaHOiB8rs9LkjYsmyAQfaPLDrdRyeTHrFJ1gJbAl6LVnPJfUc3h91E8PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710831537; a=rsa-sha256; cv=none; b=orSiFFoAxKbCUB7nD08Jhderd0Wk/2QvKhGUOvVGGnXJpzcfYUjATblqZsLLTdp9ZJmpV6 H8MbZpmBJ2TyuTkF69b5GJIG9x+TOLCDqKq1YZBqTPvYaa1ntnnPC7/qP1GVvlHr3ALyFE OIfmo0jqXrH55ocEKL3z/rcVJppCMUujMCykSaaEpJQyF2OdsMSwVbB8cE0+JRCH92xKM8 56kW2lvs8uNZnEPGo+HIIiTUVMGIordiMYp9rSiFxdcFtF5PAksxLihd+UsPWb9xrpLIyC be2QJklVY879v7ARhuh5utScCIZMHYvy0K6z0K1rVdor++6WpNPok4c2V3tFGQ== 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=1710831537; 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=H9a6h89XLVr3NUeQz2Ax932zL4AC6Sv21In00D64fos=; b=A4CuAurhFGSNz6w1ZH2jkn4m6eFgIA8E7fbWaJq8AmEbHvrYTcHLvyEyVmSvl3wXAhXDPw FgDfiaV5iCZDRNiYJTB6bpYR7bBpXh9oGK1nyCoh2lvZBMOEyHFeZRCcOB7ZnoEpuN/tFX meIj4YjgiAAdNBBKcS15BHc6/K0aUU5zCNx6EtUoAfImmvdd5qqaiRUTQ701PQHrpvIERD Bso7pigyJdOkHtfBmlSyLEfR9Xsw/oODiXxivZYGDo4M93gwhEdQgAkkRh0vFhlgnxGYmF S5OB8ZVveTrNLd4ttBpa8NF/9yqCmzx07nADXRAuYtrP55ldcM5nuxMBuObLrA== 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 4TzMyT5xSfzwtW; Tue, 19 Mar 2024 06:58:57 +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 42J6wvJW024688; Tue, 19 Mar 2024 06:58:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42J6wvAM024685; Tue, 19 Mar 2024 06:58:57 GMT (envelope-from git) Date: Tue, 19 Mar 2024 06:58:57 GMT Message-Id: <202403190658.42J6wvAM024685@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: f8e46fd61e05 - main - pkgbase: rework certctl package to only run rehash on the main package 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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: f8e46fd61e055fcc767c2038d867f58c38e43ec3 Auto-Submitted: auto-generated The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f8e46fd61e055fcc767c2038d867f58c38e43ec3 commit f8e46fd61e055fcc767c2038d867f58c38e43ec3 Author: Baptiste Daroussin AuthorDate: 2024-01-31 12:42:16 +0000 Commit: Baptiste Daroussin CommitDate: 2024-03-19 06:58:29 +0000 pkgbase: rework certctl package to only run rehash on the main package Rework how ucl manifest are generated leveraging ucl features and flua now the ucl generation is done via a lua script which uses libucl to ingest the template and use variables as defined in its command line. the template will include only if it exist a ucl file named after the package name which will complement the template or overwrite what was defined in the template if defined in this specific ucl file this allows to overwrite license, but add script only to the packages who actually needs them. As a results the post install scripts are now only added to the right package and not also added to the subpackages like -man or -dev Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44374 --- Makefile.inc1 | 60 +++++++++++++++++++++------------------ release/packages/certctl.ucl | 16 ----------- release/packages/clang-all.ucl | 1 + release/packages/clang.ucl | 17 ----------- release/packages/clibs.ucl | 1 + release/packages/dtb.ucl | 16 ----------- release/packages/generate-ucl.lua | 35 +++++++++++++++++++++++ release/packages/generate-ucl.sh | 36 +++++++++-------------- release/packages/jail.ucl | 18 ------------ release/packages/kernel.ucl | 18 +----------- release/packages/lld-all.ucl | 1 + release/packages/lld.ucl | 17 ----------- release/packages/lldb-all.ucl | 1 + release/packages/lldb.ucl | 17 ----------- release/packages/runtime.ucl | 26 ++++------------- release/packages/src-sys.ucl | 17 ----------- release/packages/src.ucl | 17 ----------- release/packages/ssh-all.ucl | 1 + release/packages/ssh.ucl | 17 ----------- release/packages/template.ucl | 15 +++++----- release/packages/unbound-all.ucl | 1 + release/packages/unbound.ucl | 17 ----------- release/packages/utilities.ucl | 21 ++------------ 23 files changed, 104 insertions(+), 282 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index f97e53cc7f9a..003aaf513644 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2101,22 +2101,28 @@ create-source-packages: _pkgbootstrap .PHONY ( echo "@override_prefix /usr/src" ; \ ${GIT_CMD} ls-files --recurse-submodules "sys/" ) \ > ${SSTAGEDIR}/src-sys.plist - sed -e "s/%VERSION%/${PKG_VERSION}/" \ - -e "s/%DESC%/FreeBSD sources/" \ - -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ - -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ - -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - -e "s|%PKG_WWW%|${PKG_WWW}|" \ - ${SRCDIR}/release/packages/src.ucl \ - > ${SSTAGEDIR}/src.ucl - sed -e "s/%VERSION%/${PKG_VERSION}/" \ - -e "s/%DESC%/FreeBSD Kernel sources/" \ - -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ - -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ - -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - -e "s|%PKG_WWW%|${PKG_WWW}|" \ - ${SRCDIR}/release/packages/src-sys.ucl \ - > ${SSTAGEDIR}/src-sys.ucl + ${SRCDIR}/release/packages/generate-ucl.lua \ + PKGNAME "src" \ + PKGGENNAME "src" \ + VERSION "${PKG_VERSION}" \ + DESC "FreeBSD Kernel Sources" \ + COMMENT "FreeBSD Userland Sources" \ + PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ + PKG_MAINTAINER "${PKG_MAINTAINER}" \ + PKG_WWW "${PKG_WWW}" \ + ${SRCDIR}/release/packages/template.ucl \ + ${SSTAGEDIR}/src.ucl + ${SRCDIR}/release/packages/generate-ucl.lua \ + PKGNAME "src-sys" \ + PKGGENNAME "src" \ + VERSION "${PKG_VERSION}" \ + DESC "FreeBSD Kernel Sources" \ + COMMENT "FreeBSD Kernel Sources" \ + PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ + PKG_MAINTAINER "${PKG_MAINTAINER}" \ + PKG_WWW "${PKG_WWW}" \ + ${SRCDIR}/release/packages/template.ucl \ + ${SSTAGEDIR}/src-sys.ucl ${PKG_CMD} -o ABI=${PKG_ABI} \ -o OSVERSION="${SRCRELDATE}" \ create -f ${PKG_FORMAT} \ @@ -2212,17 +2218,17 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap ${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.meta | \ awk -f ${SRCDIR}/release/scripts/mtree-to-plist.awk \ -v kernel=yes -v _kernconf=${INSTALLKERNEL} ; \ - sed -e "s/%VERSION%/${PKG_VERSION}/" \ - -e "s/%PKGNAME%/kernel-${INSTALLKERNEL:tl}${flavor}/" \ - -e "s/%KERNELDIR%/kernel/" \ - -e "s/%COMMENT%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ - -e "s/%DESC%/FreeBSD ${INSTALLKERNEL} kernel ${flavor}/" \ - -e "s/ %VCS_REVISION%/${VCS_REVISION}/" \ - -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ - -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - -e "s|%PKG_WWW%|${PKG_WWW}|" \ - ${SRCDIR}/release/packages/kernel.ucl \ - > ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ + ${SRCDIR}/release/packages/generate-ucl.lua \ + PKGNAME "kernel-${INSTALLKERNEL:tl}${flavor}" \ + VERSION "${PKG_VERSION}" \ + KERNELDIR "kernel" \ + COMMENT "FreeBSD ${INSTALLKERNEL} kernel ${flavor}" \ + DESC "FreeBSD ${INSTALLKERNEL} kernel ${flavor}" \ + PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ + PKG_MAINTAINER "${PKG_MAINTAINER}" \ + PKG_WWW "${PKG_WWW}" \ + ${SRCDIR}/release/packages/template.ucl \ + ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \ awk -F\" ' \ /name/ { printf("===> Creating %s-", $$2); next } \ /version/ {print $$2; next } ' \ diff --git a/release/packages/certctl.ucl b/release/packages/certctl.ucl index f6dbb012ce64..664a6d139585 100644 --- a/release/packages/certctl.ucl +++ b/release/packages/certctl.ucl @@ -1,19 +1,3 @@ -# -# - -name = "%PKG_NAME_PREFIX%-%PKGNAME%" -origin = "base" -version = "%VERSION%" -comment = "%COMMENT%" -categories = [ base ] -maintainer = %PKG_MAINTAINER% -www = "%PKG_WWW%" -prefix = "/" -licenselogic = "single" -licenses = [ BSD2CLAUSE ] -desc = < ]... + +In the files the variable (in the form ${variablename} +in the ) will be expanded to . + +The undefined variables will reamin unmofifier "${variablename}" +]]-- + +local ucl = require("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]) +end +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 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')) +f:close() diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index e5563c51a4cd..c7147a97a868 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -30,17 +30,10 @@ main() { shift $(( ${OPTIND} - 1 )) - vital="false" - case "${outname}" in bootloader) pkgdeps="" ;; - clibs) - vital="true" - # clibs should not have any dependencies or anything - # else imposed on it. - ;; certctl) pkgdeps="caroot openssl" ;; @@ -68,7 +61,6 @@ main() { runtime) outname="runtime" _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" - vital="true" ;; *-lib32_dev) outname="${outname%%-lib32_dev}" @@ -111,10 +103,7 @@ main() { desc="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESC)" comment="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_COMMENT)" - uclsource="${srctree}/release/packages/${outname}.ucl" - if [ ! -e "${uclsource}" ]; then - uclsource="${srctree}/release/packages/template.ucl" - fi + uclsource="${srctree}/release/packages/template.ucl" if [ ! -z "${debug}" ]; then echo "" @@ -153,16 +142,19 @@ EOF echo '}' >> ${uclfile} fi cap_arg="$( make -f ${srctree}/share/mk/bsd.endian.mk -VCAP_MKDB_ENDIAN )" - sed -i '' -e "s/%VERSION%/${PKG_VERSION}/" \ - -e "s/%PKGNAME%/${origname}/" \ - -e "s/%COMMENT%/${comment}/" \ - -e "s/%DESC%/${desc}/" \ - -e "s/%VITAL%/${vital}/" \ - -e "s/%CAP_MKDB_ENDIAN%/${cap_arg}/g" \ - -e "s/%PKG_NAME_PREFIX%/${PKG_NAME_PREFIX}/" \ - -e "s|%PKG_WWW%|${PKG_WWW}|" \ - -e "s/%PKG_MAINTAINER%/${PKG_MAINTAINER}/" \ - ${uclfile} + ${srctree}/release/packages/generate-ucl.lua \ + VERSION "${PKG_VERSION}" \ + PKGNAME "${origname}" \ + PKGGENNAME "${outname}" \ + PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \ + COMMENT "${comment}" \ + DESC "${desc}" \ + CAP_MKDB_ENDIAN "${cap_arg}" \ + PKG_WWW "${PKG_WWW}" \ + PKG_MAINTAINER "${PKG_MAINTAINER}" \ + UCLFILES "${srctree}/release/packages/" \ + ${uclsource} ${uclfile} + return 0 } diff --git a/release/packages/jail.ucl b/release/packages/jail.ucl deleted file mode 100644 index bc137f009db9..000000000000 --- a/release/packages/jail.ucl +++ /dev/null @@ -1,18 +0,0 @@ -# -# - -name = "%PKG_NAME_PREFIX%-%PKGNAME%" -origin = "base" -version = "%VERSION%" -comment = "%COMMENT%" -categories = [ base ] -maintainer = "%PKG_MAINTAINER%" -www = "%PKG_WWW%" -prefix = "/" -vital = %VITAL% -licenselogic = "single" -licenses = [ BSD2CLAUSE ] -desc = <