Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Sep 1999 17:29:14 -0700 (PDT)
From:      John Polstra <jdp@polstra.com>
To:        ports@freebsd.org
Cc:        asami@freebsd.org
Subject:   Re: Handling distfiles in multiple subdirs on master site: how?
Message-ID:  <199909180029.RAA55497@vashon.polstra.com>
In-Reply-To: <XFMail.990904160033.jdp@polstra.com>
References:  <XFMail.990904160033.jdp@polstra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <XFMail.990904160033.jdp@polstra.com>, I wrote:
> I'm trying to make a new port and have run into something I don't
> know how to do.  The master site has a funky system of cgi scripts (I
> guess) that constructs tarballs of arbitrary subtrees on the fly.  I
> need to get several distfiles from various subdirectories on the same
> master site.  Ideally, I'd like to be able to do something like this
> (just an example):
> 
> MASTER_SITES=   http://m3.polymtl.ca/m3htbin/download/m3/pkg/pm3-1.1.13/
> DISTFILES=      libs/set.tgz \
>                 m3config.tgz \
>                 graphics/gr-libs/ui
> DIST_SUBDIR=    pm3-1.1.13
> 
> But having subdirectories in the DISTFILES list isn't working.

I made some changes to <bsd.port.mk> locally that solve this problem.
Could one or more ports-gods please look it over and hopefully get it
committed?  The patch is appended.

Here's what this patch does:

* If filenames in DISTFILES contain one or more "/" characters,
their directory structure is preserved on the local machine.  This
is done by creating the necessary directories and adding a "-o path"
option to the fetch command.

* If there are no "/" characters in the filenames, the "-o path"
argument is omitted from the fetch command, and everything happens
just the same as always.  Thus, existing ports which override
FETCH_CMD won't experience any surprises.

It all seems to work fine here, including the "makesum", "checksum"
and "extract" targets.

John
--
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "No matter how cynical I get, I just can't keep up."        -- Nora Ephron


Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.319
diff -u -r1.319 bsd.port.mk
--- bsd.port.mk	1999/09/11 01:11:21	1.319
+++ bsd.port.mk	1999/09/17 01:42:13
@@ -1474,7 +1474,12 @@
 			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
-				if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
+				case $${file} in \
+				*/*)	${MKDIR} $${file%/*}; \
+						args="-o $${file} $${site}$${file}";; \
+				*)		args=$${site}$${file};; \
+				esac; \
+				if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \
 					continue 2; \
 				fi \
 			done; \
@@ -1498,7 +1503,12 @@
 			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
-				if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
+				case $${file} in \
+				*/*)	${MKDIR} $${file%/*}; \
+						args="-o $${file} $${site}$${file}";; \
+				*)		args=$${site}$${file};; \
+				esac; \
+				if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \
 					continue 2; \
 				fi \
 			done; \
@@ -2033,7 +2043,11 @@
 			for site in ${MASTER_SITES}; do \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
-				${ECHO} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
+				case $${file} in \
+				*/*)	args="-o $${file} $${site}$${file}";; \
+				*)		args=$${site}$${file};; \
+				esac; \
+				${ECHO} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} "${FETCH_AFTER_ARGS}" '||' ; \
 					break; \
 			done; \
 			${ECHO} "echo $${file} not fetched" ; \
@@ -2046,7 +2060,11 @@
 			for site in ${PATCH_SITES}; do \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
-				${ECHO} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
+				case $${file} in \
+				*/*)	args="-o $${file} $${site}$${file}";; \
+				*)		args=$${site}$${file};; \
+				esac; \
+				${ECHO} -n ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} "${FETCH_AFTER_ARGS}" '||' ; \
 					break; \
 			done; \
 			${ECHO} "echo $${file} not fetched" ; \


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




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