diff options
author | mat <mat@FreeBSD.org> | 2017-12-20 00:23:48 +0800 |
---|---|---|
committer | mat <mat@FreeBSD.org> | 2017-12-20 00:23:48 +0800 |
commit | e2e0f973b1073a63f0912edaf8e8d499bae1193f (patch) | |
tree | 7d530d9aabea9a037ed02ad61ef394b729dcdf43 | |
parent | db9adfad16c9f1e482219cdc358bf2d73214b918 (diff) | |
download | freebsd-ports-gnome-e2e0f973b1073a63f0912edaf8e8d499bae1193f.tar.gz freebsd-ports-gnome-e2e0f973b1073a63f0912edaf8e8d499bae1193f.tar.zst freebsd-ports-gnome-e2e0f973b1073a63f0912edaf8e8d499bae1193f.zip |
Enhance USES=uniquefiles to be more generic.
This allows to have more complex renaming schemes. Until now, it could
only add a prefix or a suffix, but this was not working at all for man
pages, because it would give man/man1/pyfoo.1.gz-2.7 or
man/man1/pyfoo-1-2.7.gz. With this change, a man page will be correctly
renamed to man/man1/pyfoo-2.7.1.gz.
Unfix ports that were already handling man pages.
PR: 220214
Submitted by: Fukang Chen (previous patch)
Exp-run by: antoine
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D13444
-rw-r--r-- | Mk/Uses/python.mk | 14 | ||||
-rw-r--r-- | Mk/Uses/uniquefiles.mk | 62 | ||||
-rw-r--r-- | mail/py-pymailq/Makefile | 14 | ||||
-rw-r--r-- | math/py-numpy/Makefile | 9 | ||||
-rw-r--r-- | math/py-numpy/pkg-plist | 2 | ||||
-rw-r--r-- | www/py-ddgr/Makefile | 2 | ||||
-rw-r--r-- | www/py-ddgr/files/patch-Makefile | 16 |
7 files changed, 74 insertions, 45 deletions
diff --git a/Mk/Uses/python.mk b/Mk/Uses/python.mk index 4ee191581088..947f34aef9d0 100644 --- a/Mk/Uses/python.mk +++ b/Mk/Uses/python.mk @@ -580,15 +580,19 @@ UNIQUE_DEFAULT_LINKS= no .endif UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} UNIQUE_SUFFIX= -${PYTHON_VER} +UNIQUE_SUFFIX_TYPES+= SUFFIX_MAN +UNIQUE_SUFFIX_MAN_WITH_EXT= .[1-9ln] +UNIQUE_SUFFIX_MAN_EXTRA_EXT= .gz .if defined(_PYTHON_FEATURE_AUTOPLIST) -UNIQUE_FIND_SUFFIX_FILES= \ - ${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST} | \ - ${EGREP} -e '^bin/.*$$|^sbin/.*$$|^libexec/.*$$' +_UNIQUE_FIND_SUFFIX_FILES= ${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST} .else -UNIQUE_FIND_SUFFIX_FILES= \ - ${EGREP} -he '^bin/.*$$|^sbin/.*$$|^libexec/.*$$' ${TMPPLIST} 2>/dev/null +_UNIQUE_FIND_SUFFIX_FILES= ${SED} -e 's|^${PREFIX}/||' ${TMPPLIST} 2>/dev/null .endif +UNIQUE_FIND_SUFFIX_FILES+= ${_UNIQUE_FIND_SUFFIX_FILES} | \ + ${EGREP} -he '^bin/.*$$|^sbin/.*$$|^libexec/.*$$' +UNIQUE_FIND_SUFFIX_MAN_FILES+= ${_UNIQUE_FIND_SUFFIX_FILES} | \ + ${EGREP} -he '^man/man[1-9ln]/.*$$' .endif # defined(_PYTHON_FEATURE_CONCURRENT) _CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} diff --git a/Mk/Uses/uniquefiles.mk b/Mk/Uses/uniquefiles.mk index 940ef3535408..43d0206e4db0 100644 --- a/Mk/Uses/uniquefiles.mk +++ b/Mk/Uses/uniquefiles.mk @@ -56,6 +56,19 @@ # list of files to be iterated over. # Default: empty # +# UNIQUE_SUFFIX_TYPES - A list of TAGS to defined more complex unique +# suffix handling. It can, for example, handle +# man pages by doing: +# +# UNIQUE_SUFFIX_TYPES+= SUFFIX_MAN +# UNIQUE_SUFFIX_MAN_WITH_EXT= .[1-9ln] +# UNIQUE_SUFFIX_MAN_EXTRA_EXT= .gz +# UNIQUE_FIND_SUFFIX_MAN_FILES= ${EGREP} -he '^man/man[1-9ln]/.*$$' ${TMPPLIST} 2>/dev/null +# +# The make(1) target that renames the files +# runs before the man pages are compressed, +# this is what the EXTRA_EXT bit is for. +# # NOTE: multiple logical instances are not supported by pkg and the original # pkg_tools at the moment. # @@ -69,6 +82,8 @@ UNIQUE_SUFFIX?= ${PKGNAMESUFFIX} UNIQUE_PREFIX_FILES?= # empty UNIQUE_SUFFIX_FILES?= # empty +UNIQUE_SUFFIX_TYPES+= SUFFIX + .if ${uniquefiles_ARGS:Mdirs} DOCSDIR= ${PREFIX}/share/doc/${UNIQUE_PREFIX}${PORTNAME} EXAMPLESDIR= ${PREFIX}/share/examples/${UNIQUE_PREFIX}${PORTNAME} @@ -94,7 +109,7 @@ _DO_CONDITIONAL_SYMLINK= \ if [ ! -e ${STAGEDIR}${PREFIX}/$${fname} -a ! -L ${STAGEDIR}${PREFIX}/$${fname} ]; then \ ${ECHO_MSG} "Link: @$${fname} --> $${newf}"; \ ${RLN} ${STAGEDIR}${PREFIX}/$${newf} ${STAGEDIR}${PREFIX}/$${fname}; \ - ${ECHO_CMD} LINKED:$${newf}:$${fname} >> ${_UNIQUEPKGLIST}; \ + ${ECHO_CMD} LINKED:$${newf}%%EXTRA_EXT%%:$${fname}%%EXTRA_EXT%% >> ${_UNIQUEPKGLIST}; \ fi .else # We are not symlinking the renamed binary. @@ -113,7 +128,7 @@ move-uniquefiles: ${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ - ${_DO_CONDITIONAL_SYMLINK}; \ + ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%//g}; \ else \ ${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \ ${FALSE}; \ @@ -126,7 +141,7 @@ move-uniquefiles: ${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ - ${_DO_CONDITIONAL_SYMLINK}; \ + ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%//g}; \ else \ ${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \ ${FALSE}; \ @@ -134,36 +149,51 @@ move-uniquefiles: done; .endif -.if ${UNIQUE_SUFFIX_FILES} || ${UNIQUE_FIND_SUFFIX_FILES} +.for sufxtype in ${UNIQUE_SUFFIX_TYPES} +. if (defined(UNIQUE_${sufxtype}_FILES) && ${UNIQUE_${sufxtype}_FILES}) || \ + (defined(UNIQUE_FIND_${sufxtype}_FILES) && ${UNIQUE_FIND_${sufxtype}_FILES}) +. if defined(UNIQUE_${sufxtype}_WITH_EXT) && ${UNIQUE_${sufxtype}_WITH_EXT} + @${ECHO_MSG} "===> Creating unique files: Move ${sufxtype:S|SUFFIX_||} files needing SUFFIX"; +. else @${ECHO_MSG} "===> Creating unique files: Move files needing SUFFIX"; -.endif -.for entry in ${UNIQUE_SUFFIX_FILES} +. endif +. endif +. for entry in ${UNIQUE_${sufxtype}_FILES} @fname=${entry}; \ + if [ -n "${UNIQUE_${sufxtype}_EXTRA_EXT}" ]; then \ + fname=$${fname%${UNIQUE_${sufxtype}_EXTRA_EXT}}; \ + fi; \ if [ -e ${STAGEDIR}${PREFIX}/$${fname} -o -L ${STAGEDIR}${PREFIX}/$${fname} ]; then \ - newf=$${fname%/*}/$${fname##*/}${UNIQUE_SUFFIX}; \ + ofname=$${fname##*/}; \ + newf=$${fname%/*}/$${ofname%${UNIQUE_${sufxtype}_WITH_EXT}}${UNIQUE_SUFFIX}$${ofname#$${ofname%${UNIQUE_${sufxtype}_WITH_EXT}}}; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}"; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ - ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ - ${_DO_CONDITIONAL_SYMLINK}; \ + ${ECHO_CMD} MOVED:$${fname}${UNIQUE_${sufxtype}_EXTRA_EXT}:$${newf}${UNIQUE_${sufxtype}_EXTRA_EXT} >> ${_UNIQUEPKGLIST}; \ + ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%/${UNIQUE_${sufxtype}_EXTRA_EXT}/g}; \ else \ ${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \ ${FALSE}; \ fi; -.endfor -.if ${UNIQUE_FIND_SUFFIX_FILES} - @for fname in `${UNIQUE_FIND_SUFFIX_FILES}`; do \ +. endfor +. if defined(UNIQUE_FIND_${sufxtype}_FILES) && ${UNIQUE_FIND_${sufxtype}_FILES} + @for fname in `${UNIQUE_FIND_${sufxtype}_FILES}`; do \ + if [ -n "${UNIQUE_${sufxtype}_EXTRA_EXT}" ]; then \ + fname=$${fname%${UNIQUE_${sufxtype}_EXTRA_EXT}}; \ + fi; \ if [ -e ${STAGEDIR}${PREFIX}/$${fname} -o -L ${STAGEDIR}${PREFIX}/$${fname} ]; then \ - newf=$${fname%/*}/$${fname##*/}${UNIQUE_SUFFIX}; \ + ofname=$${fname##*/}; \ + newf=$${fname%/*}/$${ofname%${UNIQUE_${sufxtype}_WITH_EXT}}${UNIQUE_SUFFIX}$${ofname#$${ofname%${UNIQUE_${sufxtype}_WITH_EXT}}}; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}"; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ - ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ - ${_DO_CONDITIONAL_SYMLINK}; \ + ${ECHO_CMD} MOVED:$${fname}${UNIQUE_${sufxtype}_EXTRA_EXT}:$${newf}${UNIQUE_${sufxtype}_EXTRA_EXT} >> ${_UNIQUEPKGLIST}; \ + ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%/${UNIQUE_${sufxtype}_EXTRA_EXT}/g}; \ else \ ${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \ ${FALSE}; \ fi; \ done; -.endif +. endif +.endfor # Using .if exists(${_UNIQUEPKGPLIST} below instead of the sh test # does not work in poudriere. It works fine on the CLI, though... diff --git a/mail/py-pymailq/Makefile b/mail/py-pymailq/Makefile index fb65284d4a14..ce2e733053af 100644 --- a/mail/py-pymailq/Makefile +++ b/mail/py-pymailq/Makefile @@ -19,12 +19,7 @@ NO_ARCH= yes USES= python:2.7+ USE_PYTHON= autoplist distutils concurrent -.include <bsd.port.pre.mk> - -PLIST_FILES+= man/man1/pqshell-${PYTHON_VER}.1.gz -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} -PLIST_FILES+= man/man1/pqshell.1.gz -.endif +PLIST_FILES= man/man1/pqshell.1.gz post-patch: @${REINPLACE_CMD} -e \ @@ -32,9 +27,6 @@ post-patch: ${WRKSRC}/setup.py post-install: - ${INSTALL_MAN} ${WRKSRC}/man/pqshell.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell-${PYTHON_VER}.1 -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} - ${LN} -sf pqshell-${PYTHON_VER}.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell.1 -.endif + ${INSTALL_MAN} ${WRKSRC}/man/pqshell.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell.1 -.include <bsd.port.post.mk> +.include <bsd.port.mk> diff --git a/math/py-numpy/Makefile b/math/py-numpy/Makefile index 374ed0fedfdd..d33997ffb19c 100644 --- a/math/py-numpy/Makefile +++ b/math/py-numpy/Makefile @@ -46,10 +46,6 @@ TESTS_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}nose>=0:devel/py-nose@${FLAVOR} .include <bsd.port.pre.mk> -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} -PLIST_FILES+= man/man1/f2py.1.gz -.endif - post-patch: @${REINPLACE_CMD} -e "s|%%FC%%|${FC}|" ${WRKSRC}/numpy/distutils/fcompiler/gnu.py @${CP} ${FILESDIR}/site.cfg ${WRKSRC}/site.cfg @@ -86,10 +82,7 @@ pre-configure-SUITESPARSE-off: @${REINPLACE_CMD} -e "s|:%%LOCALBASE%%/include/suitesparse||" ${WRKSRC}/site.cfg post-install: - ${INSTALL_MAN} ${WRKSRC}/doc/f2py/f2py.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py-${PYTHON_VER}.1 -.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} - ${LN} -sf f2py-${PYTHON_VER}.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py.1 -.endif + ${INSTALL_MAN} ${WRKSRC}/doc/f2py/f2py.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py.1 ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' | ${XARGS} ${STRIP_CMD} post-install-DOCS-on: diff --git a/math/py-numpy/pkg-plist b/math/py-numpy/pkg-plist index 62b1eb813102..34bee4385f53 100644 --- a/math/py-numpy/pkg-plist +++ b/math/py-numpy/pkg-plist @@ -771,4 +771,4 @@ bin/f2py %%PYTHON_SITELIBDIR%%/numpy/version.py %%PYTHON_SITELIBDIR%%/numpy/version.pyc %%PYTHON_SITELIBDIR%%/numpy/version.pyo -man/man1/f2py-%%PYTHON_VER%%.1.gz +man/man1/f2py.1.gz diff --git a/www/py-ddgr/Makefile b/www/py-ddgr/Makefile index 939bb98c548d..f55d8a0541c6 100644 --- a/www/py-ddgr/Makefile +++ b/www/py-ddgr/Makefile @@ -28,7 +28,7 @@ MAKE_ARGS= DOCDIR=${STAGEDIR}${DOCSDIR} FREEBSD_PYTHON_VER=${PYTHON_VER} OPTIONS_DEFINE= DOCS PLIST_FILES= bin/ddgr \ - share/man/man1/ddgr-${PYTHON_VER}.1.gz + man/man1/ddgr.1.gz PORTDOCS= README.md .include <bsd.port.mk> diff --git a/www/py-ddgr/files/patch-Makefile b/www/py-ddgr/files/patch-Makefile index f5b6586d799d..62c02d85921f 100644 --- a/www/py-ddgr/files/patch-Makefile +++ b/www/py-ddgr/files/patch-Makefile @@ -1,11 +1,21 @@ --- Makefile.orig 2017-11-29 12:33:58 UTC +++ Makefile -@@ -13,7 +13,7 @@ install: +@@ -1,6 +1,6 @@ + PREFIX ?= /usr/local + BINDIR = $(DESTDIR)$(PREFIX)/bin +-MANDIR = $(DESTDIR)$(PREFIX)/share/man/man1 ++MANDIR = $(DESTDIR)$(PREFIX)/man/man1 + DOCDIR = $(DESTDIR)$(PREFIX)/share/doc/ddgr + + .PHONY: all install uninstall +@@ -11,9 +11,8 @@ install: + install -m755 -d $(BINDIR) + install -m755 -d $(MANDIR) install -m755 -d $(DOCDIR) - gzip -c ddgr.1 > ddgr.1.gz +- gzip -c ddgr.1 > ddgr.1.gz install -m755 ddgr $(BINDIR) - install -m644 ddgr.1.gz $(MANDIR) -+ install -m644 ddgr.1.gz $(MANDIR)/ddgr-${FREEBSD_PYTHON_VER}.1.gz ++ install -m644 ddgr.1 $(MANDIR) install -m644 README.md $(DOCDIR) rm -f ddgr.1.gz |