diff options
author | bapt <bapt@FreeBSD.org> | 2014-01-07 07:34:29 +0800 |
---|---|---|
committer | bapt <bapt@FreeBSD.org> | 2014-01-07 07:34:29 +0800 |
commit | a9b2e829605cde07217edd81e1d6860f59e39034 (patch) | |
tree | 55d384a6de63ef0eab9d6f45e05af947c29fc289 /Mk | |
parent | cd54aeee8e91347bf7533ca3837e57743bd7a25a (diff) | |
download | freebsd-ports-graphics-a9b2e829605cde07217edd81e1d6860f59e39034.tar.gz freebsd-ports-graphics-a9b2e829605cde07217edd81e1d6860f59e39034.tar.zst freebsd-ports-graphics-a9b2e829605cde07217edd81e1d6860f59e39034.zip |
pkgng expect all non ascii code and '%' to be urlencoded in the comment
Reported by: antoine
Tested by: antoine
Diffstat (limited to 'Mk')
-rw-r--r-- | Mk/Scripts/pkgencode.awk | 23 | ||||
-rw-r--r-- | Mk/bsd.pkgng.mk | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/Mk/Scripts/pkgencode.awk b/Mk/Scripts/pkgencode.awk new file mode 100644 index 00000000000..b37a00ac065 --- /dev/null +++ b/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); } diff --git a/Mk/bsd.pkgng.mk b/Mk/bsd.pkgng.mk index 36776feb488..56fc935d55d 100644 --- a/Mk/bsd.pkgng.mk +++ b/Mk/bsd.pkgng.mk @@ -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) |