pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc lang/python: fix PYVERSSUFFIX escaping for print-PLIST



details:   https://anonhg.NetBSD.org/pkgsrc/rev/df25e070ddbf
branches:  trunk
changeset: 336554:df25e070ddbf
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Wed Jul 17 18:34:16 2019 +0000

description:
lang/python: fix PYVERSSUFFIX escaping for print-PLIST

Before, the filename "3270" was wrongly replaced with "${PYVERSSUFFIX}"
since the version number "3.7", when interpreted as a regular expression,
matched that filename.

diffstat:

 lang/python/egg.mk                  |   8 ++++----
 regress/Makefile                    |   3 ++-
 regress/print-plist-python/DESCR    |   3 +++
 regress/print-plist-python/Makefile |  32 ++++++++++++++++++++++++++++++++
 regress/print-plist-python/PLIST    |   3 +++
 regress/print-plist-python/spec     |  12 ++++++++++++
 6 files changed, 56 insertions(+), 5 deletions(-)

diffs (107 lines):

diff -r ba5b35b3f0a8 -r df25e070ddbf lang/python/egg.mk
--- a/lang/python/egg.mk        Wed Jul 17 17:56:22 2019 +0000
+++ b/lang/python/egg.mk        Wed Jul 17 18:34:16 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: egg.mk,v 1.27 2017/02/08 12:09:30 wiz Exp $
+# $NetBSD: egg.mk,v 1.28 2019/07/17 18:34:16 rillig Exp $
 #
 # Common logic to handle Python Eggs
 #
@@ -28,11 +28,11 @@
 
 PLIST_SUBST+=  EGG_NAME=${EGG_NAME}-py${PYVERSSUFFIX}
 PLIST_SUBST+=  EGG_INFODIR=${EGG_INFODIR}
-PRINT_PLIST_AWK+=      { gsub(/${EGG_NAME}-py${PYVERSSUFFIX}.egg-info/, \
+PRINT_PLIST_AWK+=      { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}.egg-info/, \
                               "$${EGG_INFODIR}") }
-PRINT_PLIST_AWK+=      { gsub(/${EGG_NAME}-py${PYVERSSUFFIX}-nspkg.pth/, \
+PRINT_PLIST_AWK+=      { gsub(/${EGG_NAME}-py${PYVERSSUFFIX:S,.,\.,g}-nspkg.pth/, \
                               "$${EGG_NAME}-nspkg.pth") }
-PRINT_PLIST_AWK+=      { gsub(/${PYVERSSUFFIX}/, \
+PRINT_PLIST_AWK+=      { gsub(/${PYVERSSUFFIX:S,.,\.,g}/, \
                               "$${PYVERSSUFFIX}") }
 
 _PYSETUPTOOLSINSTALLARGS=      --single-version-externally-managed
diff -r ba5b35b3f0a8 -r df25e070ddbf regress/Makefile
--- a/regress/Makefile  Wed Jul 17 17:56:22 2019 +0000
+++ b/regress/Makefile  Wed Jul 17 18:34:16 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2019/05/04 15:17:39 rillig Exp $
+# $NetBSD: Makefile,v 1.24 2019/07/17 18:34:16 rillig Exp $
 #
 # See https://www.netbsd.org/docs/pkgsrc/regression.html for more
 # information about these tests.
@@ -22,6 +22,7 @@
 SUBDIR+=       pkg-options
 SUBDIR+=       pkgfail
 SUBDIR+=       print-plist
+SUBDIR+=       print-plist-python
 SUBDIR+=       show-all
 SUBDIR+=       subst
 SUBDIR+=       tools
diff -r ba5b35b3f0a8 -r df25e070ddbf regress/print-plist-python/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/print-plist-python/DESCR  Wed Jul 17 18:34:16 2019 +0000
@@ -0,0 +1,3 @@
+This test verifies that the dots that may appear as "3.7" in PYVERSSUFFIX
+are properly escaped when that variable is treated as a regular
+expression in PLIST_AWK.
diff -r ba5b35b3f0a8 -r df25e070ddbf regress/print-plist-python/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/print-plist-python/Makefile       Wed Jul 17 18:34:16 2019 +0000
@@ -0,0 +1,32 @@
+# $NetBSD: Makefile,v 1.1 2019/07/17 18:34:16 rillig Exp $
+
+DISTNAME=      print-plist-python-0.0
+CATEGORIES=    regress
+MASTER_SITES=  # none
+DISTFILES=     # none
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+COMMENT=       Test escaping in PRINT_PLIST_AWK
+LICENSE=       2-clause-bsd
+
+NO_CHECKSUM=   yes
+NO_CONFIGURE=  yes
+WRKSRC=                ${WRKDIR}
+AUTO_MKDIRS=   yes
+
+# When interpreted as a regular expression, the version number "3.7"
+# matches the filename "share/emul3270". Therefore only that version works.
+PYTHON_VERSIONS_ACCEPTABLE=    37
+
+pre-build:
+       ${TOUCH} ${WRKDIR}/setup.py
+
+post-build:
+       ${ECHO} "content" >${WRKDIR}/file
+
+post-install:
+       ${INSTALL_DATA} ${WRKSRC}/file ${DESTDIR}${PREFIX}/share/emul3270
+       ${INSTALL_DATA} ${WRKSRC}/file ${DESTDIR}${PREFIX}/share/file-${PYVERSSUFFIX}.txt
+
+.include "../../lang/python/egg.mk"
+.include "../../mk/bsd.pkg.mk"
diff -r ba5b35b3f0a8 -r df25e070ddbf regress/print-plist-python/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/print-plist-python/PLIST  Wed Jul 17 18:34:16 2019 +0000
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2019/07/17 18:34:16 rillig Exp $
+share/emul3270
+share/file-${PYVERSSUFFIX}.txt
diff -r ba5b35b3f0a8 -r df25e070ddbf regress/print-plist-python/spec
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/print-plist-python/spec   Wed Jul 17 18:34:16 2019 +0000
@@ -0,0 +1,12 @@
+# $NetBSD: spec,v 1.1 2019/07/17 18:34:16 rillig Exp $
+
+MAKEARGS_TEST="-s install print-PLIST"
+
+MAKEARGS_CLEAN="deinstall clean"
+
+check_result()
+{
+       exit_status 0
+       output_require "^share/emul3270$"
+       output_require "^share/file-\\\${PYVERSSUFFIX}\\.txt$"
+}



Home | Main Index | Thread Index | Old Index