-
Notifications
You must be signed in to change notification settings - Fork 629
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3890 from masatake/rpmMacros--curly-bracket-areas
rpmMacros: process areas surrounded by pairs of curly bracket
- Loading branch information
Showing
11 changed files
with
134 additions
and
19 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_sysuser input.macros /^%add_sysuser(-) %{lua:$/;" m signature:(-) end:39 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# | ||
# Taken from rpm/macros.in | ||
# | ||
|
||
# Add a sysuser user/group to a package. Takes a sysusers.d(5) line as | ||
# arguments, eg `%add_sysuser g mygroup 515`. | ||
# -b option omits the "Provides: " to support formatting the entry outside | ||
# spec context. | ||
%add_sysuser(-) %{lua: | ||
if arg[1] == '-b' then | ||
prefix = '' | ||
table.remove(arg, 1) | ||
else | ||
prefix = 'Provides: ' | ||
end | ||
if #arg < 2 then | ||
error('not enough arguments') | ||
end | ||
if arg[1] == 'g' then | ||
type = 'group' | ||
elseif arg[1] == 'u' then | ||
type = 'user' | ||
else | ||
error('invalid sysuser type: '..arg[1]) | ||
end | ||
name = arg[2] | ||
line = table.concat(arg, ' ') | ||
-- \0-pad source string to avoid '=' in the output | ||
llen = line:len() | ||
ulen = math.ceil(4 * (llen / 3)) | ||
plen = 4 * math.ceil(llen / 3) | ||
pad = string.rep('\\0', plen-ulen) | ||
enc = rpm.b64encode(line..pad, 0); | ||
|
||
print(string.format('%s%s(%s) = %s\\n', prefix, type, name, enc)) | ||
if type == 'user' then | ||
print(string.format('%s%s(%s)\\n', prefix, 'group', name)) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--sort=no | ||
--fields=+eS | ||
--map-RpmMacros=+.macros |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters