aboutsummaryrefslogtreecommitdiff
path: root/release/packages/generate-ucl.lua
diff options
context:
space:
mode:
Diffstat (limited to 'release/packages/generate-ucl.lua')
-rwxr-xr-xrelease/packages/generate-ucl.lua43
1 files changed, 31 insertions, 12 deletions
diff --git a/release/packages/generate-ucl.lua b/release/packages/generate-ucl.lua
index 47f0a0e9a6a9..19a9a95d5d38 100755
--- a/release/packages/generate-ucl.lua
+++ b/release/packages/generate-ucl.lua
@@ -1,7 +1,13 @@
#!/usr/libexec/flua
+--
+-- Copyright (c) 2024-2025 Baptiste Daroussin <bapt@FreeBSD.org>
+-- Copyright (c) 2025 Lexi Winter <ivy@FreeBSD.org>
+--
+-- SPDX-License-Identifier: BSD-2-Clause
+--
--[[ usage:
-generare-ucl.lua [<variablename> <variablevalue>]... <sourceucl> <destucl>
+generate-ucl.lua [<variablename> <variablevalue>]... <sourceucl> <destucl>
Build a package's UCL configuration by loading the template UCL file
<sourceucl>, replacing any $VARIABLES in the UCL based on the provided
@@ -161,17 +167,19 @@ if add_gen_dep(pkgname, pkggenname) then
end
obj["deps"][pkggenname] = {
["version"] = pkgversion,
- ["origin"] = "base"
+ ["origin"] = "base/"..pkgprefix.."-"..pkggenname,
}
end
--
--- Handle the 'set' annotation.
+-- Handle the 'set' annotation, a comma-separated list of sets which this
+-- package should be placed in. If it's not specified, the package goes
+-- in the default set which is base.
--
-- Ensure we have an annotations table to work with.
obj["annotations"] = obj["annotations"] or {}
-- If no set is provided, use the default set which is "base".
-set = obj["annotations"]["set"] or "base"
+sets = obj["annotations"]["set"] or "base"
-- For subpackages, we may need to rewrite the set name. This is done a little
-- differently from the normal pkg suffix processing, because we don't need sets
-- to be as a granular as the base packages.
@@ -181,23 +189,32 @@ set = obj["annotations"]["set"] or "base"
-- However, lib32 debug symbols still go into their own package since they're
-- quite large.
if pkgname:match("%-dbg%-lib32$") then
- set = "lib32-dbg"
+ sets = "lib32-dbg"
elseif pkgname:match("%-lib32$") then
- set = "lib32"
+ sets = "lib32"
-- If this is a -dev package, put it in a single set called "devel" which
-- contains all development files. Also include lib*-man packages, which
-- contain manpages for libraries. Having a separate <set>-dev for every
-- set is not necessary, because generally you either want development
-- support or you don't.
elseif pkgname:match("%-dev$") or pkgname:match("^lib.*%-man$") then
- set = "devel"
--- If this is a -dbg package, it goes in <set>-dbg, which means the user can
--- install debug symbols only for the sets they have installed.
+ sets = "devel"
+-- Don't separate tests and tests-dbg into 2 sets, if the user wants tests
+-- they should be able to debug failures.
+elseif sets == "tests" then
+ sets = sets
+-- If this is a -dbg package, put it in the -dbg subpackage of each set,
+-- which means the user can install debug symbols only for the sets they
+-- have installed.
elseif pkgname:match("%-dbg$") then
- set = set .. "-dbg"
+ local newsets = {}
+ for set in sets:gmatch("[^,]+") do
+ newsets[#newsets + 1] = set .. "-dbg"
+ end
+ sets = table.concat(newsets, ",")
end
--- Put our new set back into the package.
-obj["annotations"]["set"] = set
+-- Put our new sets back into the package.
+obj["annotations"]["set"] = sets
-- If PKG_NAME_PREFIX is provided, rewrite the names of dependency packages.
-- We can't do this in UCL since variable substitution doesn't work in array
@@ -206,6 +223,8 @@ if pkgprefix ~= nil and obj["deps"] ~= nil then
newdeps = {}
for dep, opts in pairs(obj["deps"]) do
local newdep = pkgprefix .. "-" .. dep
+ -- Make sure origin is set.
+ opts["origin"] = opts["origin"] or "base/"..newdep
newdeps[newdep] = opts
end
obj["deps"] = newdeps