Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2014 13:27:28 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r339122 - in branches/2014Q1/Mk: . Scripts
Message-ID:  <201401081327.s08DRSc6086770@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Wed Jan  8 13:27:28 2014
New Revision: 339122
URL: http://svnweb.freebsd.org/changeset/ports/339122

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

Added:
  branches/2014Q1/Mk/Scripts/pkgencode.awk
     - copied unchanged from r338956, head/Mk/Scripts/pkgencode.awk
Modified:
  branches/2014Q1/Mk/bsd.pkgng.mk
Directory Properties:
  branches/2014Q1/   (props changed)

Copied: branches/2014Q1/Mk/Scripts/pkgencode.awk (from r338956, head/Mk/Scripts/pkgencode.awk)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2014Q1/Mk/Scripts/pkgencode.awk	Wed Jan  8 13:27:28 2014	(r339122, copy of r338956, head/Mk/Scripts/pkgencode.awk)
@@ -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: branches/2014Q1/Mk/bsd.pkgng.mk
==============================================================================
--- branches/2014Q1/Mk/bsd.pkgng.mk	Wed Jan  8 13:26:21 2014	(r339121)
+++ branches/2014Q1/Mk/bsd.pkgng.mk	Wed Jan  8 13:27:28 2014	(r339122)
@@ -42,7 +42,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?201401081327.s08DRSc6086770>