svn commit: r551166 - head/Keywords
Emmanuel Vadot
manu at FreeBSD.org
Fri Oct 2 08:58:44 UTC 2020
Author: manu
Date: Fri Oct 2 08:58:44 2020
New Revision: 551166
URL: https://svnweb.freebsd.org/changeset/ports/551166
Log:
Keywords: sample: Really fix the lua version
pkg doesn't accept expanding %X when the argument doesn't exists.
Some how neither my testing or the exp-run (PR 249035) catched that.
Approved by: portmgr (bapt@)
Modified:
head/Keywords/sample.ucl
Modified: head/Keywords/sample.ucl
==============================================================================
--- head/Keywords/sample.ucl Fri Oct 2 08:57:53 2020 (r551165)
+++ head/Keywords/sample.ucl Fri Oct 2 08:58:44 2020 (r551166)
@@ -21,11 +21,15 @@
actions: [file(1)]
arguments: true
post-install-lua: <<EOS
- sample_file = pkg.prefixed_path("%1")
- if "%#" == 2 then
- target_file = pkg.prefixed_path("%2")
- else
+ args = {}
+ for arg in string.gmatch("%@", "%S+") do
+ table.insert(args, arg)
+ end
+ sample_file = pkg.prefixed_path(args[1])
+ if args[2] == nil then
target_file = string.gsub(sample_file,'%.sample$', "")
+ else
+ target_file = pkg.prefixed_path(args[2])
end
if not pkg.stat(target_file) then
pkg.copy(sample_file, target_file)
@@ -33,11 +37,15 @@ post-install-lua: <<EOS
EOS
pre-deinstall-lua: <<EOS
- sample_file = pkg.prefixed_path("%1")
- if "%#" == 2 then
- target_file = pkg.prefixed_path("%2")
- else
+ args = {}
+ for arg in string.gmatch("%@", "%S+") do
+ table.insert(args, arg)
+ end
+ sample_file = pkg.prefixed_path(args[1])
+ if args[2] == nil then
target_file = string.gsub(sample_file,'%.sample$', "")
+ else
+ target_file = pkg.prefixed_path(args[2])
end
if pkg.filecmp(sample_file, target_file) == 0 then
os.remove(target_file)
More information about the svn-ports-all
mailing list