From owner-freebsd-ports-bugs@FreeBSD.ORG Fri Jul 28 18:40:15 2006 Return-Path: X-Original-To: freebsd-ports-bugs@hub.freebsd.org Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B985916A4DF for ; Fri, 28 Jul 2006 18:40:15 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id E95CC43D58 for ; Fri, 28 Jul 2006 18:40:14 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k6SIeEE4097585 for ; Fri, 28 Jul 2006 18:40:14 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k6SIeE0O097583; Fri, 28 Jul 2006 18:40:14 GMT (envelope-from gnats) Resent-Date: Fri, 28 Jul 2006 18:40:14 GMT Resent-Message-Id: <200607281840.k6SIeE0O097583@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stanislav Sedov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EC20716A4DE; Fri, 28 Jul 2006 18:32:14 +0000 (UTC) (envelope-from ssedov@mbsd.msk.ru) Received: from com1.ht-systems.ru (com1.ht-systems.ru [83.97.104.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id D8C6243D5D; Fri, 28 Jul 2006 18:32:13 +0000 (GMT) (envelope-from ssedov@mbsd.msk.ru) Received: from [217.118.83.1] (helo=fonon.realnet) by com1.ht-systems.ru with esmtpa (Exim 4.62) (envelope-from ) id 1G6XFq-0000uJ-UD; Fri, 28 Jul 2006 22:40:14 +0400 Received: by fonon.realnet (Postfix, from userid 1001) id 2CC651209D; Fri, 28 Jul 2006 22:31:47 +0400 (MSD) Message-Id: <20060728183147.2CC651209D@fonon.realnet> Date: Fri, 28 Jul 2006 22:31:47 +0400 (MSD) From: Stanislav Sedov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: freebsd-ports@FreeBSD.org Subject: ports/100996: add macro to dial with directory trees X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Jul 2006 18:40:15 -0000 >Number: 100996 >Category: ports >Synopsis: add macro to dial with directory trees >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Jul 28 18:40:14 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Stanislav Sedov >Release: FreeBSD 7.0-CURRENT i386 >Organization: MBSD labs, Inc. >Environment: System: FreeBSD fonon.realnet 7.0-CURRENT FreeBSD 7.0-CURRENT #7: Sun Jun 18 20:51:36 MSD 2006 root@fonon.realnet:/work/src/fbsd-cur/src/sys/i386/compile/FONON i386 >Description: We have a lot of ports (thousands, actually), that need to copy entire directory trees to specific location, e.g. when installing examples for port one could issue: @${TAR} -cf - -C ${WRKSRC} copyfs cryptfs gzipfs uuencodefs tests | \ ${TAR} -xf - -C ${EXAMPLESDIR} @${FIND} ${EXAMPLESDIR} -type f -exec ${CHMOD} ${SHAREMODE} {} \; @${FIND} ${EXAMPLESDIR} -exec ${CHOWN} ${SHAREOWN} {} \; There are many other solutions (e.g. using PAX, FIND, CPIO combinations) , buth every require one important step - set up permissions for installed files, since this files are not processed by INSTALL_XXX program. A lot of ports usually forget to do this - I began to fix some of them - but it's tedios and giant work... The macros introduced allows to dial with such tree ierarchies in handy and efficient way. For previos example one can use: cd ${WRKSRC} && ${COPYTREE_SHARE} "copyfs cryptfs gzipfs uuencodefs test s" "${EXAMPLESDIR}" and that's all. I decided to use CPIO (though I don't like it) since it can be used with find program, that allows to manipulate on file sets with a great power. Additional commands to FIND program might be passed by third argument to macro, e.g. to eclude 'Makefile" file we can use: cd ${WRKSRC} && ${COPYTREE_BIN} docs "${DOCSDIR}" "! -name Makefile" Thus, this macro allows to use the whole power of FIND program. Also, I've used "-l" swith in CPIO to speed-up copies in some cases. That's why I've redirected cpio output to /dev/null ;-) It would be nice to have you comments/suggestions here. Thanks! >How-To-Repeat: >Fix: --- portmk.diff begins here --- --- bsd.port.mk.orig Fri Jul 28 22:09:42 2006 +++ bsd.port.mk Fri Jul 28 22:13:32 2006 @@ -1970,6 +1970,18 @@ REINPLACE_ARGS?= -i.bak REINPLACE_CMD?= ${SED} ${REINPLACE_ARGS} +# Macro for coping entire directory tree with correct permissions +COPYTREE_BIN= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \ + 2>&1) && \ + ${CHOWN} -R ${BINOWN}:${BINGRP} $$1 && \ + ${FIND} $$1 -type d -exec chmod 755 {} \; && \ + ${FIND} $$1 -type f -exec chmod ${BINMODE} {} \;' -- +COPYTREE_SHARE= ${SH} -c '(${FIND} -d $$0 $$2 | ${CPIO} -dumpl $$1 >/dev/null \ + 2>&1) && \ + ${CHOWN} -R ${SHAREOWN}:${SHAREGRP} $$1 && \ + ${FIND} $$1 -type d -exec chmod 755 {} \; && \ + ${FIND} $$1 -type f -exec chmod ${SHAREMODE} {} \;' -- + # Names of cookies used to skip already completed stages EXTRACT_COOKIE?= ${WRKDIR}/.extract_done.${PORTNAME}.${PREFIX:S/\//_/g} CONFIGURE_COOKIE?= ${WRKDIR}/.configure_done.${PORTNAME}.${PREFIX:S/\//_/g} --- portmk.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: