Date: Fri, 2 Oct 2020 08:58:44 +0000 (UTC) From: Emmanuel Vadot <manu@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r551166 - head/Keywords Message-ID: <202010020858.0928wiWE068778@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010020858.0928wiWE068778>