Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2019 12:57:44 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r503385 - head/Mk/Scripts
Message-ID:  <201906031257.x53Cvi9P092541@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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@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@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 ']'



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906031257.x53Cvi9P092541>