Skip site navigation (1)Skip section navigation (2)
Date:      3 Apr 2002 23:58:01 -0000
From:      Mario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        pat@FreeBSD.org
Subject:   ports/36709: bsd.port.mk MASTER_SITES:n - add comma operator to {DIST,PATCH}FILES
Message-ID:  <20020403235801.18411.qmail@exxodus.fedaykin.here>

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

>Number:         36709
>Category:       ports
>Synopsis:       bsd.port.mk MASTER_SITES:n - add comma operator to {DIST,PATCH}FILES
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 03 16:10:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mario Sergio Fujikawa Ferreira
>Release:        FreeBSD 4.5-STABLE i386
>Organization:
>Environment:
System: FreeBSD exxodus.fedaykin.here 4.5-STABLE FreeBSD 4.5-STABLE #0: Thu Mar 21 17:13:58 BRT 2002 lioux@exxodus.fedaykin.here:/usr/obj/usr/src/sys/LIOUX i386

	Current cvsup updated ports tree.

>Description:

Following discussion with aDe in an uncharted IRC channel.

Check 

Message-ID: <20020402140619.A65560@exxodus.fedaykin.here>

http://docs.freebsd.org/cgi/getmsg.cgi?fetch=1112088+0+current/freebsd-ports

for proposed documentation which also contemplates the idea brought
here.

Recall MASTER_SITES:n? We have comma operator that works as an
additive group operator. Thus, one {MASTER,PATCH}SITES item can
belong to more than one group (A and B) if there's a comma, e.g.,
site1:A,B. The same applies to *SUBDIR, except that we require the
user to add a leading / so that we know for sure that : is not part
of the subdir name (suggested by sobomax), e.g., subdir/:A,B.
However, the comma operator does not exist for {MASTER,PATCH}FILES.

I think that comma should be orthogonal; thus, working inside *FILES
as well.

However, if I add comma awareness to *FILES... I cannot feasibly
know if file:a,b is not a <filename>file:a,b</filename> as opposed
to <filename>file</filename> belonging to groups both a and b

Currently, without comma, I test if a *SITES group exist...  if
not, it's a filename...

aDe suggested: "so why not assume that file:a,b is 'file' belonging
to groups 'a' and 'b', try to fetch, and if that fails, it's a
filename. I think it's unlikely that we'd see a filename like that."

Hummm... defeats the main purpose of the patch which is to reduce
file search delay, not to mention brute force.  Furthermore, I know
it's unlikely that such filenames exist but I'd better make sure
we have our bases covered.

I welcome suggestions like we did for *SUBDIR where trailing / does
not exist in dir names. However, is there such a character we can
trust does not exist in filenames?

There are 3 solutions:

1) keep current behavior: seriously suboptimal. Check the following
patch. It is a workaround adding additional groups to achieve similar
behavior as using the comma operator;

--- Makefile.orig	Wed Apr  3 17:38:35 2002
+++ Makefile	Wed Apr  3 20:34:34 2002
@@ -2,7 +2,7 @@
 # Date created:		Tue Jun 10 21:58:54 CEST 1997
 # Whom:			Andreas Klemm <andreas@klemm.gtn.com>
 #
-# $FreeBSD: ports/print/ghostscript-gnu/Makefile,v 1.70 2002/04/02 21:38:47 lioux Exp $
+# $FreeBSD: ports/print/ghostscript-gnu/Makefile,v 1.71 2002/04/03 20:49:37 lioux Exp $
 #
 
 PORTNAME=	ghostscript
@@ -16,23 +16,23 @@
 		http://home.t-online.de/home/Martin.Lottermoser/pcl3dist/:hpdj_pcl3 \
 		http://www.harsch.net/Download/:gdevdj \
 		ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/gs652/ \
-		ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/fonts/:fonts \
-		ftp://gatekeeper.dec.com/pub/GNU/ghostscript/:gatekeeper
+		ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/gnu/fonts/:fonts,fonts_std \
+		ftp://gatekeeper.dec.com/pub/GNU/ghostscript/:gatekeeper,DEFAULT,fonts,gimp_print,hpijs
 # gatekeeper is an exception, it is the only GNU site which carries
 # some of the other files, so add it although it is listed inside
 # MASTER_SITE_GNU
 MASTER_SITE_SUBDIR=     ${PORTNAME} gimp-print/:gimp_print hpinkjet/:hpijs
 PKGNAMESUFFIX=	-gnu
-DISTFILES=	${GS_SOURCES}:DEFAULT,gatekeeper \
-		${GS_FONTS_STD}:fonts \
-		${GS_FONTS_OTHER}:fonts,gatekeeper \
+DISTFILES=	${GS_SOURCES}:DEFAULT \
+		${GS_FONTS_STD}:fonts_std \
+		${GS_FONTS_OTHER}:fonts \
 		${DECRYPT_PDF}:pdf \
 		${HP8XX_DRV}:gdevcd \
 		${HPDJ_SRC}:hpdj_pcl3 \
 		${PCL3_SRC}:hpdj_pcl3 \
 		${HP970_DRV}:gdevdj \
-		${GPRINT_SRC}:gatekeeper,gimp_print \
-		${HPIJS_SRC}:gatekeeper,hpijs
+		${GPRINT_SRC}:gimp_print \
+		${HPIJS_SRC}:hpijs
 DIST_SUBDIR=	ghostscript
 EXTRACT_ONLY=	${GS_SOURCES}

2) add additional character delimiters such as *SUBDIR: any?

3) add an example to Porter's Handbook on how to avoid the caveat...

For instance, we have files file1, file2, file3:a. file1 belongs to group b, file2 to c and file3:a to default

DISTFILES=	file1:b file2:c file3:a:DEFAULT

Therefore, you will be safe if you mandatoraly add a group definition
(even if redundant DEFAULT) to a filename containing a trailing :

The patch adding comma awareness to *FILES follows.

>How-To-Repeat:

	Check revision 1.70 of ports/print/ghostscript-gnu/Makefile

http://www.freebsd.org/cgi/cvsweb.cgi/ports/print/ghostscript-gnu/Makefile?rev=1.70&content-type=text/x-cvsweb-markup

for non-working example.

>Fix:

--- bsd.port.mk.orig	Wed Apr  3 16:29:12 2002
+++ bsd.port.mk	Wed Apr  3 17:22:05 2002
@@ -1443,26 +1443,44 @@
 DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
 _MASTER_SITES_ALL=	${_MASTER_SITES_DEFAULT}
 _PATCH_SITES_ALL=	${_PATCH_SITES_DEFAULT}
+_G_TEMP=	DEFAULT
 .for _D in ${DISTFILES}
 _D_TEMP=	${_D:S/^${_D:C/:[^:]+$//}//}
-.	if !empty(_D_TEMP) && defined(_MASTER_SITES_${_D_TEMP:S/^://})
-#_MASTER_SITES_ALL+=	${MASTER_SITES_${_D_TEMP:S/^://}}
-_MASTER_SITES_ALL+=	${_MASTER_SITES_${_D:S/^${_D:C/:[^:]+$//}://}}
-#_DISTFILES+=	${_D:S/:${_D_TEMP:S/^://}$//}
+.	if !empty(_D_TEMP)
+.			for _group in ${_D_TEMP:S/^://:S/,/ /g}
+.				if !defined(_MASTER_SITES_${_group})
+_G_TEMP_TEMP=	${_G_TEMP:M/${_group}/}
+.					if empty(_G_TEMP_TEMP)
+_G_TEMP+=	${_group}
+_MASTER_SITES_ALL+=	${_MASTER_SITES_${_group}}
+.					endif
+.				endif
+.			endfor
 _DISTFILES+=	${_D:C/:[^:]+$//}
 .	else
 _DISTFILES+=	${_D}
 .	endif
 .endfor
+_G_TEMP=	DEFAULT
 .for _P in ${PATCHFILES}
 _P_TEMP=	${_P:S/^${_P:C/:[^:]+$//}//}
-.	if !empty(_P_TEMP) && defined(_PATCH_SITES_${_P_TEMP:S/^://})
-_PATCH_SITES_ALL+=	${_PATCH_SITES_${_P:S/^${_P:C/:[^:]+$//}://}}
+.	if !empty(_P_TEMP)
+.			for _group in ${_P_TEMP:S/^://:S/,/ /g}
+.				if !defined(_PATCH_SITES_${_group})
+_G_TEMP_TEMP=	${_G_TEMP:M/${_group}/}
+.					if empty(_G_TEMP_TEMP)
+_G_TEMP+=	${_group}
+_PATCH_SITES_ALL+=	${_PATCH_SITES_${_group}}
+.					endif
+.				endif
+.			endfor
 _PATCHFILES+=	${_P:C/:[^:]+$//}
 .	else
 _PATCHFILES+=	${_P}
 .	endif
 .endfor
+_G_TEMP=
+_G_TEMP_TEMP=
 ALLFILES?=	${_DISTFILES} ${_PATCHFILES}
 
 #
>Release-Note:
>Audit-Trail:
>Unformatted:

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?20020403235801.18411.qmail>