svn commit: r503385 - head/Mk/Scripts

Mathieu Arnold mat at FreeBSD.org
Mon Jun 3 12:57:45 UTC 2019


Author: mat
Date: Mon Jun  3 12:57:44 2019
New Revision: 503385
URL: https://svnweb.freebsd.org/changeset/ports/503385

Log:
  Use UCL for pkg-message
  
  Remain backward compatible but use ucl for the pkg-messages, which allows to:
  - append messages one after the other
  - only print message on delete, install, upgrade from a version to another
  
  If pkg-message starts with a [ we consider it should be a valid ucl file
  
  The format is the following:
  [
  { message: "Always print" },
  { message: "package being removed", type: remove },
  { message: "package being installed", type: install },
  { message: "package is being upgraded", type: upgrade },
  { message: "Upgrading from lower than 1.0", maximum_version: "1.0", type: upgrade },
  { message: "Upgrading from higher than 1.0", minimum_version: "1.0", type: upgrade  },
  { message: "Upgrading from >1.0 < 3.0", maximum_version: "3.0", minimum_version: "1.0",
  ]
  
  Because it is ucl one can use some sugar like:
  [
  { message = <<EOD
  formatted
  message 'with fancy things'
  EOD
  },
  }
  
  Submitted by:	bapt
  Reviewed by:	bapt, mat
  Differential Revision:	https://reviews.freebsd.org/D19310

Modified:
  head/Mk/Scripts/create-manifest.sh   (contents, props changed)

Modified: head/Mk/Scripts/create-manifest.sh
==============================================================================
--- head/Mk/Scripts/create-manifest.sh	Mon Jun  3 12:56:26 2019	(r503384)
+++ head/Mk/Scripts/create-manifest.sh	Mon Jun  3 12:57:44 2019	(r503385)
@@ -112,14 +112,24 @@ done
 
 exec >${dp_METADIR}/+DISPLAY
 
+echo '['
 for message in ${dp_PKGMESSAGES}; do
-  [ -f "${message}" ] && cat "${message}"
+	if [ -f "${message}" ]; then
+		#if if starts with [ then it is ucl and we do drop last and first line
+		if head -1 "${message}" | grep -q '^\['; then
+			sed '1d;$d' "${message}"
+		else
+			echo '{message=<<EOD'
+			cat "${message}"
+			printf 'EOD\n},\n'
+		fi
+	fi
 done
 
 # Try and keep these messages in sync with check-deprecated
 if [ ${dp_MAINTAINER} = "ports at FreeBSD.org" ]; then
-	if [ -f "${dp_METADIR}/+DISPLAY" ]; then echo; fi
 	cat <<-EOT
+	{ message=<<EOD
 	===>   NOTICE:
 
 	The ${dp_PKGBASE} port currently does not have a maintainer. As a result, it is
@@ -131,12 +141,14 @@ if [ ${dp_MAINTAINER} = "ports at FreeBSD.org" ]; then
 	More information about port maintainership is available at:
 
 	https://www.freebsd.org/doc/en/articles/contributing/ports-contributing.html#maintain-port
+	EOD
+	},
 	EOT
 fi
 
 if [ -n "${dp_DEPRECATED}" ]; then
-	if [ -f "${dp_METADIR}/+DISPLAY" ]; then echo; fi
 	cat <<-EOT
+	{ message=<<EOD
 	===>   NOTICE:
 
 	This port is deprecated; you may wish to reconsider installing it:
@@ -151,8 +163,6 @@ if [ -n "${dp_DEPRECATED}" ]; then
 
 		EOT
 	fi
+	printf 'EOD\n},\n'
 fi
-
-if [ ! -s ${dp_METADIR}/+DISPLAY ]; then
-	rm -f ${dp_METADIR}/+DISPLAY
-fi
+echo ']'


More information about the svn-ports-all mailing list