Automatically word-wrap the description of extras subpackages

This only works for package and extra names less than 79 characters long.
I don't expect many actual packages to exceed this limit.
78 characters should be enough for everybody.

Why 78? 79 is the line-lenght limit from rpmlint.
And we need to put punctuation in there.
This commit is contained in:
Miro Hrončok 2021-02-05 14:09:57 +01:00
commit c746b25f28
3 changed files with 52 additions and 10 deletions

View file

@ -202,9 +202,19 @@
local rpmname = value_n .. '+' .. extras
local pkgdef = '%package -n ' .. rpmname
local summary = 'Summary: Metapackage for ' .. value_n .. ': ' .. extras .. ' extras'
local description = '%description -n ' .. rpmname .. '\\\n' ..
'This is a metapackage bringing in ' .. extras .. ' extras requires for ' .. value_n .. '.\\\n' ..
'It contains no code, just makes sure the dependencies are installed.\\\n'
local description = '%description -n ' .. rpmname .. '\\\n'
local current_line = 'This is a metapackage bringing in'
for _, word in ipairs({extras, 'extras', 'requires', 'for', value_n .. '.'}) do
local line = current_line .. ' ' .. word
if line:len() > 79 then
description = description .. current_line .. '\\\n'
current_line = word
else
current_line = line
end
end
description = description .. current_line .. '\\\n' ..
'It contains no code, just makes sure the dependencies are installed.\\\n'
local files = ''
if value_i ~= '' then
files = '%files -n ' .. rpmname .. '\\\n' .. '%ghost ' .. value_i