diff options
author | Emmanuel Vadot <manu@FreeBSD.org> | 2020-10-02 08:58:44 +0000 |
---|---|---|
committer | Emmanuel Vadot <manu@FreeBSD.org> | 2020-10-02 08:58:44 +0000 |
commit | f1d81cf365f774fe9cbd9aeb59a542aebdbe6edf (patch) | |
tree | b6e1928829f35a32da7844b63ecb3a85e76e7f34 /Keywords | |
parent | update pyside2 to 5.15.1 (diff) |
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@)
Notes
Notes:
svn path=/head/; revision=551166
Diffstat (limited to 'Keywords')
-rw-r--r-- | Keywords/sample.ucl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Keywords/sample.ucl b/Keywords/sample.ucl index 818e833a2b5d..5022254bcfd2 100644 --- a/Keywords/sample.ucl +++ b/Keywords/sample.ucl @@ -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) |