Date: Fri, 29 Sep 2000 06:26:47 -0700 (PDT) From: asami@freebsd.org (Satoshi Asami) To: ports@freebsd.org Subject: RFC: RESTRICTED_FILES Message-ID: <200009291326.e8TDQle87752@silvia.hip.berkeley.edu>
next in thread | raw e-mail | index | archive | help
First, a little background. The "clean-restricted-list" and "clean-for-cdrom-list" are used to print out shell commands to remove packages and distfiles/patchfiles for RESTRICTED or NO_CDROM ports, respectively. These are used in the automated package build process (which is used for both FTP and CDROMs). The output looks like this: === >> make clean-for-cdrom-list # oneko-sakura3-1.2 [ -f /usr/ports/distfiles//oneko-1.2.tar.gz ] && (echo deleting /usr/ports/distfiles//oneko-1.2.tar.gz; /bin/rm -f /usr/ports/distfiles//oneko-1.2.tar.gz) [ -f /usr/ports/distfiles//oneko-1.2.sakura.3.diff.gz ] && (echo deleting /usr/ports/distfiles//oneko-1.2.sakura.3.diff.gz; /bin/rm -f /usr/ports/distfiles//oneko-1.2.sakura.3.diff.gz) /bin/rm -f /usr/ports/packages/games/oneko-sakura3-1.2.tgz /bin/rm -f /usr/ports/packages/Latest/oneko-sakura3.tgz [ -f /usr/ports/packages/All/oneko-sakura3-1.2.tgz ] && (echo deleting /usr/ports/packages/All/oneko-sakura3-1.2.tgz; /bin/rm -f /usr/ports/packages/All/oneko-sakura3-1.2.tgz) === Unfortunately, the list of distfiles/patchfiles include all the files listed in DISTFILES and PATCHFILES, and there is no way to indicate that only a subset of the files is actually undistributable. Usually it is no big deal if all the files are erased -- the user needs to fetch some files manually anyway. However, when a file is shared among multiple ports, and if one of them is marked RESTRICTED or NO_CDROM, then the file will be deleted. This is bad since an unrestricted port is affected. An example of this is games/oneko and games/oneko-sakura. They share the same distfile, and oneko-sakura has an extra patchfile. oneko-sakura is marked NO_CDROM because the patchfile might infringe on someone's copyright. However, oneko-sakura's clean-for-cdrom-list (shown above) includes both the distfile (which it shares with the unrestricted oneko port) and the patchfile, when only the patchfile should be in there. The following patch attempts to solve the problem by adding a new variable RESTRICTED_FILES. You say something like RESTRICTED_FILES= ${PATCHFILES} in oneko-sakura/Makefile and the distfile won't show up in the list anymore. When RESTRICTED_FILES is not defined, it defaults to the old behavior, i.e., the entire ${DISTIFLES} and ${PATCHFILES} lists. === Index: bsd.port.mk =================================================================== RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v retrieving revision 1.352 diff -u -r1.352 bsd.port.mk --- bsd.port.mk 2000/09/22 07:21:24 1.352 +++ bsd.port.mk 2000/09/29 13:11:27 @@ -103,6 +103,14 @@ # BROKEN_ELF - Port doesn't build on ELF machines. # BROKEN - Port is broken. # +# In addition to RESTRICTED or NO_CDROM, if only a subset of distfiles +# or patchfiles have redistribution restrictions, set the following +# to the list of such files. +# +# RESTRICTED_FILES - List of files that cannot be redistributed +# (default: "${DISTFILES} ${PATCHFILES}" if RESTRICTED +# or NO_CDROM is set, empty otherwise). +# # This variable is a boolean, so you don't need to set it to the reason. # # IS_INTERACTIVE - Set this if your port needs to interact with the user @@ -1540,6 +1567,7 @@ .if defined(RESTRICTED) clean-restricted: delete-distfiles delete-package clean-restricted-list: delete-distfiles-list delete-package-list +RESTRICTED_FILES?= ${DISTFILES} ${PATCHFILES} .else clean-restricted: clean-restricted-list: @@ -1548,6 +1576,7 @@ .if defined(NO_CDROM) clean-for-cdrom: delete-distfiles delete-package clean-for-cdrom-list: delete-distfiles-list delete-package-list +RESTRICTED_FILES?= ${DISTFILES} ${PATCHFILES} .else clean-for-cdrom: clean-for-cdrom-list: @@ -2276,9 +2323,9 @@ .if !target(delete-distfiles) delete-distfiles: @${ECHO_MSG} "===> Deleting distfiles for ${PKGNAME}" - @(if [ "X${DISTFILES}${PATCHFILES}" != "X" -a -d ${_DISTDIR} ]; then \ + @(if [ "X${RESTRICTED_FILES}" != "X" -a -d ${_DISTDIR} ]; then \ cd ${_DISTDIR}; \ - for file in ${DISTFILES} ${PATCHFILES}; do \ + for file in ${RESTRICTED_FILES}; do \ ${RM} -f $${file}; \ dir=$${file%/*}; \ if [ "$${dir}" != "$${file}" ]; then \ @@ -2294,8 +2341,8 @@ .if !target(delete-distfiles-list) delete-distfiles-list: @${ECHO} "# ${PKGNAME}" - @if [ "X${DISTFILES}${PATCHFILES}" != "X" ]; then \ - for file in ${DISTFILES} ${PATCHFILES}; do \ + @if [ "X${RESTRICTED_FILES}" != "X" ]; then \ + for file in ${RESTRICTED_FILES}; do \ ${ECHO} "[ -f ${_DISTDIR}/$$file ] && (${ECHO} deleting ${_DISTDIR}/$$file; ${RM} -f ${_DISTDIR}/$$file)"; \ dir=$${file%/*}; \ if [ "$${dir}" != "$${file}" ]; then \ === Comments? (Has anyone else ever used these targets? ;) Satoshi 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?200009291326.e8TDQle87752>