Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jan 2014 23:34:30 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r338956 - in head/Mk: . Scripts
Message-ID:  <201401062334.s06NYULC000728@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Mon Jan  6 23:34:29 2014
New Revision: 338956
URL: http://svnweb.freebsd.org/changeset/ports/338956

Log:
  pkgng expect all non ascii code and '%' to be urlencoded in the comment
  
  Reported by:	antoine
  Tested by:	antoine

Added:
  head/Mk/Scripts/pkgencode.awk   (contents, props changed)
Modified:
  head/Mk/bsd.pkgng.mk

Added: head/Mk/Scripts/pkgencode.awk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Mk/Scripts/pkgencode.awk	Mon Jan  6 23:34:29 2014	(r338956)
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+BEGIN {
+	for (i = 0; i <= 255; i++)
+		ord[sprintf("%c", i)] = i
+	for (i = 0; i < 128; i++) {
+		if (i != 37)
+			ascii = sprintf("%s%c", ascii, i)
+	}
+}
+function encode(str, c, len, res) {
+	len = length(str)
+	res = ""
+	for (i = 1; i <= len; i++) {
+		c = substr(str, i, 1);
+		if (index(ascii, c) != 0)
+			res = res c
+		else
+			res = res "%" sprintf("%02X", ord[c])
+	}
+	return res
+}
+{ print encode($0); }

Modified: head/Mk/bsd.pkgng.mk
==============================================================================
--- head/Mk/bsd.pkgng.mk	Mon Jan  6 23:28:42 2014	(r338955)
+++ head/Mk/bsd.pkgng.mk	Mon Jan  6 23:34:29 2014	(r338956)
@@ -41,7 +41,7 @@ create-manifest:
 	@${ECHO_CMD} "version: ${PKGVERSION}" >> ${MANIFESTF}
 	@${ECHO_CMD} "origin: ${PKGORIGIN}" >> ${MANIFESTF}
 	@${ECHO_CMD} "comment: |" >> ${MANIFESTF}
-	@${ECHO_CMD} "  "${COMMENT:Q} >> ${MANIFESTF}
+	@${ECHO_CMD} "  "${COMMENT:Q} | ${AWK} -f ${SCRIPTSDIR}/pkgencode.awk >> ${MANIFESTF}
 	@${ECHO_CMD} "maintainer: ${MAINTAINER}" >> ${MANIFESTF}
 	@${ECHO_CMD} "prefix: ${PREFIX}" >> ${MANIFESTF}
 #.if defined(NO_ARCH)



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