Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 08 Sep 2003 19:11:21 +0200
From:      Oliver Eikemeier <eikemeier@fillmore-labs.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        portmgr@FreeBSD.org
Subject:   ports/56600: [PATCH] bsd.port.mk: work with -s flag, correct handling of MLINKS
Message-ID:  <3F5CB839.9080903@fillmore-labs.com>
Resent-Message-ID: <200309081720.h88HKCpr094338@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         56600
>Category:       ports
>Synopsis:       [PATCH] bsd.port.mk: work with -s flag, correct handling of MLINKS
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 08 10:20:11 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Oliver Eikemeier
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Fillmore Labs - http://www.fillmore-labs.com
>Environment:
System: FreeBSD nuuk.fillmore-labs.com 4.8-STABLE

>Description:

Any port that tries to install linked manpages with
the MLINKS macro gets these files with a double //
in the packing list.

The code in bsd.port.mk does

  @for i in ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,:S,//,/,g}; do \
    ${ECHO_CMD} "$$i" >> ${TMPPLIST}; \
  done

_TMLINKS contains /usr/local/man/""/man1/portinstall.1.gz, and the
double quotes are removed by the echo so :S,//,/,g doesn't see them.

The cat files are not removed when deinstalling if the port is
installed with 'make install -s`, because they use ${ECHO}.

'make -s deinstall` does not work at all for the very same reason.

>How-To-Repeat:

# cd /usr/ports/sysutils/portupgrade; make deinstall; make -s install

# pkg_info -L 'portupgrade*'
...
/usr/local/man//man1/pkg_which.1.gz
/usr/local/man//man1/portinstall.1.gz
/usr/local/man//man1/ports_glob.1.gz
...

# pkg_info -qf 'portupgrade*' | grep cat

# make -s deinstall; pkg_info -L 'portupgrade*'

>Fix:

- correct usage of ${ECHO} in deinstall:, generate-plist:, check-conflicts:

- instead of looping over
    "" en_US.ISO8859-1 ru_RU.KOI8-R
  and constructing
    man/"" man/en_US.ISO8859-1 man/ru_RU.KOI8-R
  loop directly over
    man man/en_US.ISO8859-1 man/ru_RU.KOI8-R

- when we are here, simplify things a bit and
  remove all hacks that tried to cope with /""/

- btw: kudos for the s^H and s/^H/ hack in the __pmlinks definition

--- bsd.port.mk.patch begins here ---
--- ports/Mk/bsd.port.mk.orig	Wed Sep  3 21:50:24 2003
+++ ports/Mk/bsd.port.mk	Mon Sep  8 18:38:05 2003
@@ -2367,14 +2367,14 @@
 		else \
 			{ print "broken"; exit; } \
 	} \
-  }' | ${SED} -e 's \([^/ ][^ ]*\.\(.\)[^. ]*\) $${MAN\2PREFIX}/man/$$$$$$$${__lang}/man\2/\1${MANEXT}g' -e 's/ //g' -e 's/MANlPREFIX/MANLPREFIX/g' -e 's/MANnPREFIX/MANNPREFIX/g'
+  }' | ${SED} -e 's \([^/ ][^ ]*\.\(.\)[^. ]*\) $${MAN\2PREFIX}/$$$$$$$${__lang}/man\2/\1${MANEXT}g' -e 's/ //g' -e 's/MANlPREFIX/MANLPREFIX/g' -e 's/MANnPREFIX/MANNPREFIX/g'
 .if ${__pmlinks:Mbroken} == "broken"
 .BEGIN:
 	@${ECHO_CMD} "${PKGNAME}: Unable to parse MLINKS."
 	@${FALSE}
 .endif
 _MLINKS=	${_MLINKS_PREPEND}
-.for lang in ${MANLANG}
+.for lang in ${MANLANG:S%^%man/%:S%^man/""$%man%}
 .for ___pmlinks in ${__pmlinks}
 .for __lang in ${lang}
 _MLINKS+=	${___pmlinks:S// /g}
@@ -2392,36 +2392,32 @@
 .endif
 .endfor
 
-.for lang in ${MANLANG}
+.for manlang in ${MANLANG:S%^%man/%:S%^man/""$%man%}
 
-.for sect in 1 2 3 4 5 6 7 8 9
+.for sect in 1 2 3 4 5 6 7 8 9 L N
 .if defined(MAN${sect})
-_MANPAGES+=	${MAN${sect}:S%^%${MAN${sect}PREFIX}/man/${lang}/man${sect}/%}
+_MANPAGES+=	${MAN${sect}:S%^%${MAN${sect}PREFIX}/${manlang}/man${sect:L}/%}
 .endif
 .endfor
 
-.if defined(MANL)
-_MANPAGES+=	${MANL:S%^%${MANLPREFIX}/man/${lang}/manl/%}
-.endif
-
-.if defined(MANN)
-_MANPAGES+=	${MANN:S%^%${MANNPREFIX}/man/${lang}/mann/%}
-.endif
-
 .endfor
 
 .if !defined(_MLINKS)
 _TMLINKS=
 .endif
 
-.if defined(_MANPAGES) && defined(NOMANCOMPRESS)
-__MANPAGES:=	${_MANPAGES:S^${PREFIX}/^^:S/""//:S^//^/^g}
-.elif defined(_MANPAGES)
-__MANPAGES:=	${_MANPAGES:S^${PREFIX}/^^:S/""//:S^//^/^g:S/$/.gz/}
+.if defined(_MANPAGES)
+
+.if defined(NOMANCOMPRESS)
+__MANPAGES:=	${_MANPAGES:S%^${PREFIX}/%%}
+.else
+__MANPAGES:=	${_MANPAGES:S%^${PREFIX}/%%:S%$%.gz%}
+.endif
+
+.if ${MANCOMPRESSED} == "yes"
+_MANPAGES:=	${_MANPAGES:S%$%.gz%}
 .endif
 
-.if defined(_MANPAGES) && ${MANCOMPRESSED} == "yes"
-_MANPAGES:=	${_MANPAGES:S/$/.gz/}
 .endif
 
 .if ${XFREE86_VERSION} == 3
@@ -2985,7 +2981,7 @@
 .for conflict in ${CONFLICTS}
 	@found="`${LS} -d ${PKG_DBDIR}/${conflict} 2>/dev/null || ${TRUE}`"; \
 	if [ X"$$found" != X"" ]; then \
-		${ECHO} "$$found" >> ${WRKDIR}/.CONFLICTS; \
+		${ECHO_CMD} "$$found" >> ${WRKDIR}/.CONFLICTS; \
 	fi
 .endfor
 	@if [ -s ${WRKDIR}/.CONFLICTS ]; then \
@@ -3469,9 +3465,9 @@
 pretty-print-www-site:
 	@www_site=$$(cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} www-site); \
 	if [ -n "$${www_site}" ]; then \
-		${ECHO} -n " and/or visit the "; \
-		${ECHO} -n "<a href=\"$${www_site}\">web site</a>"; \
-		${ECHO} " for futher informations"; \
+		${ECHO_CMD} -n " and/or visit the "; \
+		${ECHO_CMD} -n "<a href=\"$${www_site}\">web site</a>"; \
+		${ECHO_CMD} " for futher informations"; \
 	fi
 .endif
 
@@ -3507,7 +3503,7 @@
 	@${ECHO_MSG} "===>  Deinstalling for ${PKGORIGIN}"
 	@found_names=`${PKG_INFO} -q -O ${PKGORIGIN} 2> /dev/null`; \
 	for p in $${found_names}; do \
-			check_name=`${ECHO} $${p} | ${SED} -e 's/-[^-]*$$//'`; \
+			check_name=`${ECHO_CMD} $${p} | ${SED} -e 's/-[^-]*$$//'`; \
 			if [ "$${check_name}" = "${PKGBASE}" ]; then \
 					prfx=`${PKG_INFO} -q -p $${p} 2> /dev/null | ${HEAD} -n 1 | ${SED} -ne '1s|^@cwd ||p'`; \
 					if [ "x${PREFIX}" = "x$${prfx}" ]; then \
@@ -3697,7 +3693,7 @@
 		DISTORIG=${DISTORIG} \
 		${SH} ${PORTSDIR}/Tools/scripts/update-patches`; \
 	case $$toedit in "");; \
-	*) ${ECHO} -n 'edit patches: '; read i; \
+	*) ${ECHO_CMD} -n 'edit patches: '; read i; \
 	cd ${PATCHDIR} && $${VISUAL:-$${EDIT:-/usr/bin/vi}} $$toedit;; esac
 
 # Checksumming utilities
@@ -4307,7 +4303,7 @@
 	done
 .for _PREFIX in ${PREFIX}
 .if ${_TMLINKS:M${_PREFIX}*}x != x
-	@for i in ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,:S,//,/,g}; do \
+	@for i in ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,}; do \
 		${ECHO_CMD} "$$i" >> ${TMPPLIST}; \
 	done
 .endif
@@ -4318,8 +4314,8 @@
 	done
 	@${ECHO_CMD} '@cwd ${PREFIX}' >> ${TMPPLIST}
 .endif
-	@for i in $$(${ECHO} ${__MANPAGES} ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,:S,//,/,g} ' ' | ${SED} -E -e 's,man([1-9ln])/([^/ ]+) ,cat\1/\2 ,g'); do \
-		${ECHO} "@unexec rm -f %D/$${i%.gz} %D/$${i%.gz}.gz" >> ${TMPPLIST}; \
+	@for i in $$(${ECHO_CMD} ${__MANPAGES} ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,} ' ' | ${SED} -E -e 's,man([1-9ln])/([^/ ]+) ,cat\1/\2 ,g'); do \
+		${ECHO_CMD} "@unexec rm -f %D/$${i%.gz} %D/$${i%.gz}.gz" >> ${TMPPLIST}; \
 	done
 .if ${XFREE86_HTML_MAN:L} == "yes"
 .for mansect in 1 2 3 4 5 6 7 8 9 L N
@@ -4380,7 +4376,7 @@
 	@_manpages='${_MANPAGES:S/'/'\''/g}' && [ "$${_manpages}" != "" ] && ( eval ${GZIP_CMD} $${_manpages} ) || ${TRUE}
 .endif
 .if defined(_MLINKS)
-	@set ${_MLINKS:S,"",,g:S,//,/,g}; \
+	@set ${_MLINKS}; \
 	while :; do \
 		[ $$# -eq 0 ] && break || ${TRUE}; \
 		${RM} -f $${2%.gz}; ${RM} -f $$2.gz; \
--- bsd.port.mk.patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F5CB839.9080903>