svn commit: r569271 - head/Keywords

Baptiste Daroussin bapt at FreeBSD.org
Fri Mar 26 21:32:12 UTC 2021


Author: bapt
Date: Fri Mar 26 21:32:11 2021
New Revision: 569271
URL: https://svnweb.freebsd.org/changeset/ports/569271

Log:
  Validate the @sample usage at packaging time

Modified:
  head/Keywords/sample.ucl

Modified: head/Keywords/sample.ucl
==============================================================================
--- head/Keywords/sample.ucl	Fri Mar 26 21:16:37 2021	(r569270)
+++ head/Keywords/sample.ucl	Fri Mar 26 21:32:11 2021	(r569271)
@@ -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


More information about the svn-ports-head mailing list