aboutsummaryrefslogtreecommitdiff
path: root/Keywords
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-03-26 21:32:11 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-03-26 21:32:11 +0000
commitb5c21c056bb0b2c1beec7452775157b7f9ed7fbc (patch)
tree7e53b777c0406acf1ca6470b77beb3e8a9d2ee80 /Keywords
parent0268baf624367dfae5de55b630827b7f092e5bf7 (diff)
downloadports-b5c21c056bb0b2c1beec7452775157b7f9ed7fbc.tar.gz
ports-b5c21c056bb0b2c1beec7452775157b7f9ed7fbc.zip
Validate the @sample usage at packaging time
Notes
Notes: svn path=/head/; revision=569271
Diffstat (limited to 'Keywords')
-rw-r--r--Keywords/sample.ucl16
1 files changed, 16 insertions, 0 deletions
diff --git a/Keywords/sample.ucl b/Keywords/sample.ucl
index 5022254bcfd2..1a216f0836de 100644
--- a/Keywords/sample.ucl
+++ b/Keywords/sample.ucl
@@ -20,6 +20,22 @@
actions: [file(1)]
arguments: true
+prepackaging: <<EOS
+ if #arg == 1 then
+ if string.find(arg[1], "%.sample$") == nil then
+ io.stderr:write("@sample with 1 single argument expect \".sample\" extension\n")
+ return(1)
+ end
+ elseif #arg == 2 then
+ if arg[1] == arg[2] then
+ io.stderr:write("@sample: 2 identicals arguments are provided\n")
+ return(1)
+ end
+ else
+ io.stderr:write("@sample expect 1 or 2 arguments, got " .. #arg .. "\n")
+ return(1)
+ end
+EOS
post-install-lua: <<EOS
args = {}
for arg in string.gmatch("%@", "%S+") do