1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-01 05:45:45 +00:00

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
This commit is contained in:
Mathieu Arnold 2017-12-19 16:23:48 +00:00
parent f3236c0639
commit bf406b4d24
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=456737
7 changed files with 74 additions and 45 deletions

View File

@ -580,15 +580,19 @@ UNIQUE_DEFAULT_LINKS= no
.endif .endif
UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX}
UNIQUE_SUFFIX= -${PYTHON_VER} 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) .if defined(_PYTHON_FEATURE_AUTOPLIST)
UNIQUE_FIND_SUFFIX_FILES= \ _UNIQUE_FIND_SUFFIX_FILES= ${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST}
${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST} | \
${EGREP} -e '^bin/.*$$|^sbin/.*$$|^libexec/.*$$'
.else .else
UNIQUE_FIND_SUFFIX_FILES= \ _UNIQUE_FIND_SUFFIX_FILES= ${SED} -e 's|^${PREFIX}/||' ${TMPPLIST} 2>/dev/null
${EGREP} -he '^bin/.*$$|^sbin/.*$$|^libexec/.*$$' ${TMPPLIST} 2>/dev/null
.endif .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) .endif # defined(_PYTHON_FEATURE_CONCURRENT)
_CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX} _CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}

View File

@ -56,6 +56,19 @@
# list of files to be iterated over. # list of files to be iterated over.
# Default: empty # 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 # NOTE: multiple logical instances are not supported by pkg and the original
# pkg_tools at the moment. # pkg_tools at the moment.
# #
@ -69,6 +82,8 @@ UNIQUE_SUFFIX?= ${PKGNAMESUFFIX}
UNIQUE_PREFIX_FILES?= # empty UNIQUE_PREFIX_FILES?= # empty
UNIQUE_SUFFIX_FILES?= # empty UNIQUE_SUFFIX_FILES?= # empty
UNIQUE_SUFFIX_TYPES+= SUFFIX
.if ${uniquefiles_ARGS:Mdirs} .if ${uniquefiles_ARGS:Mdirs}
DOCSDIR= ${PREFIX}/share/doc/${UNIQUE_PREFIX}${PORTNAME} DOCSDIR= ${PREFIX}/share/doc/${UNIQUE_PREFIX}${PORTNAME}
EXAMPLESDIR= ${PREFIX}/share/examples/${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 \ if [ ! -e ${STAGEDIR}${PREFIX}/$${fname} -a ! -L ${STAGEDIR}${PREFIX}/$${fname} ]; then \
${ECHO_MSG} "Link: @$${fname} --> $${newf}"; \ ${ECHO_MSG} "Link: @$${fname} --> $${newf}"; \
${RLN} ${STAGEDIR}${PREFIX}/$${newf} ${STAGEDIR}${PREFIX}/$${fname}; \ ${RLN} ${STAGEDIR}${PREFIX}/$${newf} ${STAGEDIR}${PREFIX}/$${fname}; \
${ECHO_CMD} LINKED:$${newf}:$${fname} >> ${_UNIQUEPKGLIST}; \ ${ECHO_CMD} LINKED:$${newf}%%EXTRA_EXT%%:$${fname}%%EXTRA_EXT%% >> ${_UNIQUEPKGLIST}; \
fi fi
.else .else
# We are not symlinking the renamed binary. # We are not symlinking the renamed binary.
@ -113,7 +128,7 @@ move-uniquefiles:
${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \
${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \
${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \
${_DO_CONDITIONAL_SYMLINK}; \ ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%//g}; \
else \ else \
${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \ ${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \
${FALSE}; \ ${FALSE}; \
@ -126,7 +141,7 @@ move-uniquefiles:
${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}" ; \
${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \
${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ ${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \
${_DO_CONDITIONAL_SYMLINK}; \ ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%//g}; \
else \ else \
${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \ ${ECHO_MSG} "Makefile error: UNIQUE (prefix): $${fname} not found"; \
${FALSE}; \ ${FALSE}; \
@ -134,36 +149,51 @@ move-uniquefiles:
done; done;
.endif .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"; @${ECHO_MSG} "===> Creating unique files: Move files needing SUFFIX";
. endif . endif
.for entry in ${UNIQUE_SUFFIX_FILES} . endif
. for entry in ${UNIQUE_${sufxtype}_FILES}
@fname=${entry}; \ @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 \ 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}"; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}"; \
${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \
${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ ${ECHO_CMD} MOVED:$${fname}${UNIQUE_${sufxtype}_EXTRA_EXT}:$${newf}${UNIQUE_${sufxtype}_EXTRA_EXT} >> ${_UNIQUEPKGLIST}; \
${_DO_CONDITIONAL_SYMLINK}; \ ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%/${UNIQUE_${sufxtype}_EXTRA_EXT}/g}; \
else \ else \
${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \ ${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \
${FALSE}; \ ${FALSE}; \
fi; fi;
. endfor . endfor
.if ${UNIQUE_FIND_SUFFIX_FILES} . if defined(UNIQUE_FIND_${sufxtype}_FILES) && ${UNIQUE_FIND_${sufxtype}_FILES}
@for fname in `${UNIQUE_FIND_SUFFIX_FILES}`; do \ @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 \ 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}"; \ ${ECHO_MSG} "Move: $${fname} --> $${newf}"; \
${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \ ${MV} ${STAGEDIR}${PREFIX}/$${fname} ${STAGEDIR}${PREFIX}/$${newf}; \
${ECHO_CMD} MOVED:$${fname}:$${newf} >> ${_UNIQUEPKGLIST}; \ ${ECHO_CMD} MOVED:$${fname}${UNIQUE_${sufxtype}_EXTRA_EXT}:$${newf}${UNIQUE_${sufxtype}_EXTRA_EXT} >> ${_UNIQUEPKGLIST}; \
${_DO_CONDITIONAL_SYMLINK}; \ ${_DO_CONDITIONAL_SYMLINK:S/%%EXTRA_EXT%%/${UNIQUE_${sufxtype}_EXTRA_EXT}/g}; \
else \ else \
${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \ ${ECHO_MSG} "Makefile error: UNIQUE (suffix): $${fname} not found"; \
${FALSE}; \ ${FALSE}; \
fi; \ fi; \
done; done;
. endif . endif
.endfor
# Using .if exists(${_UNIQUEPKGPLIST} below instead of the sh test # Using .if exists(${_UNIQUEPKGPLIST} below instead of the sh test
# does not work in poudriere. It works fine on the CLI, though... # does not work in poudriere. It works fine on the CLI, though...

View File

@ -19,12 +19,7 @@ NO_ARCH= yes
USES= python:2.7+ USES= python:2.7+
USE_PYTHON= autoplist distutils concurrent USE_PYTHON= autoplist distutils concurrent
.include <bsd.port.pre.mk> PLIST_FILES= man/man1/pqshell.1.gz
PLIST_FILES+= man/man1/pqshell-${PYTHON_VER}.1.gz
.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION}
PLIST_FILES+= man/man1/pqshell.1.gz
.endif
post-patch: post-patch:
@${REINPLACE_CMD} -e \ @${REINPLACE_CMD} -e \
@ -32,9 +27,6 @@ post-patch:
${WRKSRC}/setup.py ${WRKSRC}/setup.py
post-install: post-install:
${INSTALL_MAN} ${WRKSRC}/man/pqshell.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell-${PYTHON_VER}.1 ${INSTALL_MAN} ${WRKSRC}/man/pqshell.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell.1
.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION}
${LN} -sf pqshell-${PYTHON_VER}.1 ${STAGEDIR}${MANPREFIX}/man/man1/pqshell.1
.endif
.include <bsd.port.post.mk> .include <bsd.port.mk>

View File

@ -46,10 +46,6 @@ TESTS_RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}nose>=0:devel/py-nose@${FLAVOR}
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION}
PLIST_FILES+= man/man1/f2py.1.gz
.endif
post-patch: post-patch:
@${REINPLACE_CMD} -e "s|%%FC%%|${FC}|" ${WRKSRC}/numpy/distutils/fcompiler/gnu.py @${REINPLACE_CMD} -e "s|%%FC%%|${FC}|" ${WRKSRC}/numpy/distutils/fcompiler/gnu.py
@${CP} ${FILESDIR}/site.cfg ${WRKSRC}/site.cfg @${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 @${REINPLACE_CMD} -e "s|:%%LOCALBASE%%/include/suitesparse||" ${WRKSRC}/site.cfg
post-install: post-install:
${INSTALL_MAN} ${WRKSRC}/doc/f2py/f2py.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py-${PYTHON_VER}.1 ${INSTALL_MAN} ${WRKSRC}/doc/f2py/f2py.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py.1
.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION}
${LN} -sf f2py-${PYTHON_VER}.1 ${STAGEDIR}${MANPREFIX}/man/man1/f2py.1
.endif
${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' | ${XARGS} ${STRIP_CMD} ${FIND} ${STAGEDIR}${PYTHON_SITELIBDIR} -name '*.so' | ${XARGS} ${STRIP_CMD}
post-install-DOCS-on: post-install-DOCS-on:

View File

@ -771,4 +771,4 @@ bin/f2py
%%PYTHON_SITELIBDIR%%/numpy/version.py %%PYTHON_SITELIBDIR%%/numpy/version.py
%%PYTHON_SITELIBDIR%%/numpy/version.pyc %%PYTHON_SITELIBDIR%%/numpy/version.pyc
%%PYTHON_SITELIBDIR%%/numpy/version.pyo %%PYTHON_SITELIBDIR%%/numpy/version.pyo
man/man1/f2py-%%PYTHON_VER%%.1.gz man/man1/f2py.1.gz

View File

@ -28,7 +28,7 @@ MAKE_ARGS= DOCDIR=${STAGEDIR}${DOCSDIR} FREEBSD_PYTHON_VER=${PYTHON_VER}
OPTIONS_DEFINE= DOCS OPTIONS_DEFINE= DOCS
PLIST_FILES= bin/ddgr \ PLIST_FILES= bin/ddgr \
share/man/man1/ddgr-${PYTHON_VER}.1.gz man/man1/ddgr.1.gz
PORTDOCS= README.md PORTDOCS= README.md
.include <bsd.port.mk> .include <bsd.port.mk>

View File

@ -1,11 +1,21 @@
--- Makefile.orig 2017-11-29 12:33:58 UTC --- Makefile.orig 2017-11-29 12:33:58 UTC
+++ Makefile +++ 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) install -m755 -d $(DOCDIR)
gzip -c ddgr.1 > ddgr.1.gz - gzip -c ddgr.1 > ddgr.1.gz
install -m755 ddgr $(BINDIR) install -m755 ddgr $(BINDIR)
- install -m644 ddgr.1.gz $(MANDIR) - 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) install -m644 README.md $(DOCDIR)
rm -f ddgr.1.gz rm -f ddgr.1.gz