Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Aug 2006 17:17:09 +0100
From:      Shaun Amott <shaun@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/102102: [PATCH] bsd.port.mk: Allow user to ignore DIST_SUBDIR directories
Message-ID:  <1155658629.21886@charon.picobyte.net>
Resent-Message-ID: <200608151620.k7FGKGLA040113@freefall.freebsd.org>

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

>Number:         102102
>Category:       ports
>Synopsis:       [PATCH] bsd.port.mk: Allow user to ignore DIST_SUBDIR directories
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 15 16:20:15 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Shaun Amott
>Release:        FreeBSD 6.1-STABLE i386
>Organization:
>Environment:

>Description:

Currently, sharing a common distfiles directory between multiple
Operating Systems (e.g. FreeBSD and OpenBSD) is made tricky by
the DIST_SUBDIR mechanism implemented by our ports system. It is
desirable in some cases to have all distfiles stored directly under
${DISTDIR}, rather than in ${DISTDIR}/${DIST_SUBDIR}, as decided by
individual ports.

I propose that, for users willing to accept the small risk of filename
collisions, a knob to disable DIST_SUBDIR directories be implemented.
Nothing changes, other than the location of the downloaded distfiles.

>How-To-Repeat:

>Fix:

--- bsd.port.mk.diff begins here ---
Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.540
diff -u -r1.540 bsd.port.mk
--- bsd.port.mk	14 Aug 2006 13:24:18 -0000	1.540
+++ bsd.port.mk	14 Aug 2006 15:56:29 -0000
@@ -113,6 +113,11 @@
 #				  ${PATCHFILES} will be put in this subdirectory of
 #				  ${DISTDIR} (see below).  Also they will be fetched in this
 #				  subdirectory from FreeBSD mirror sites.
+# WITHOUT_DIST_SUBDIR
+#				  If set, DIST_SUBDIR will be ignored locally; i.e. all
+#				  distfiles will be stored directly under ${DISTDIR}, rather
+#				  than ${DISTDIR}/${DIST_SUBDIR}, at the (tiny) risk of filename
+#				  collisions.
 # ALLFILES		- All of ${DISTFILES} and ${PATCHFILES}.
 # IGNOREFILES	- If set, don't perform checksum checks on these files.
 # NOFETCHFILES	- If set, don't download these files from the ${MASTER_SITES}
@@ -1314,7 +1319,11 @@
 X11BASE:=		${DESTDIR}${X11BASE_REL}
 LINUXBASE:=		${DESTDIR}${LINUXBASE_REL}
 DISTDIR?=		${PORTSDIR}/distfiles
+.if defined(WITHOUT_DIST_SUBDIR)
+_DISTDIR?=		${DISTDIR}
+.else
 _DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
+.endif
 INDEXDIR?=		${PORTSDIR}
 .if ${OSVERSION} >= 500036
 INDEXFILE?=		INDEX-${OSVERSION:C/([0-9]).*/\1/}
@@ -4426,7 +4435,7 @@
 			fi; \
 		done; \
 	fi
-.if defined(DIST_SUBDIR)
+.if defined(DIST_SUBDIR) && !defined(WITHOUT_DIST_SUBDIR)
 	@${ECHO_CMD} "${RMDIR} ${_DISTDIR} 2>/dev/null || ${TRUE}"
 .endif
 .endif
@@ -4586,7 +4595,12 @@
 				eval alg_executable=\$$$$alg; \
 				\
 				if [ $$alg_executable != "NO" ]; then \
-					MKSUM=`$$alg_executable < $$file`; \
+					if [ ${WITHOUT_DIST_SUBDIR} ]; then \
+						_file=`${ECHO_CMD} $$file | ${SED} -e 's/^${DIST_SUBDIR}\///'`; \
+					else \
+						_file=$$file; \
+					fi; \
+					MKSUM=`$$alg_executable < $$_file`; \
 					CKSUM=`${GREP} "^$$alg ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				else \
 					ignore="true"; \
--- bsd.port.mk.diff ends here ---


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



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