Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Mar 1999 18:25:35 +0000
From:      Neil Blakey-Milner <nbm@mithrandr.moria.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/10837: New license mechanism for ports.
Message-ID:  <19990328182535.A29002@rucus.ru.ac.za>

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

>Number:         10837
>Category:       ports
>Synopsis:       New license mechanism for ports.
>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:   Sun Mar 28 08:30:01 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Neil Blakey-Milner
>Release:        FreeBSD 3.0-STABLE i386
>Organization:

        Rhodes University Computer Users' Society

>Environment:

FreeBSD rucus.ru.ac.za 3.0-STABLE FreeBSD 3.0-STABLE #0: Tue Feb  9 22:52:23 GMT 1999     grahams@rucus.ru.ac.za:/usr/src/sys/compile/RUCUS-SMP  i386

>Description:

        Someone asked on FreeBSD-ports for a mechanism to support
        licenses in our ports system.  These patches allow for LICENSE
        files in pkg/, or a LICENSE variable pointing to a file, or one
        of a few default licenses (BSD, GPL, LGPL, etc - not provided).

>How-To-Repeat:
>Fix:

        These two patches, first one to bsd.port.mk, and the other one
        to the /usr/src/usr.sbin/pkg_install directory.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.307
diff -u -r1.307 bsd.port.mk
--- bsd.port.mk	1999/03/09 11:27:34	1.307
+++ bsd.port.mk	1999/03/28 17:48:58
@@ -475,6 +475,7 @@
 .endif
 PACKAGES?=		${PORTSDIR}/packages
 TEMPLATES?=		${PORTSDIR}/Templates
+LICENSES?=		${PORTSDIR}/Licenses
 
 .if exists(${MASTERDIR}/patches.${ARCH}-${OPSYS})
 PATCHDIR?=		${MASTERDIR}/patches.${ARCH}-${OPSYS}
@@ -737,6 +738,12 @@
 .undef NO_PACKAGE
 .endif
 
+.if exists(${PKGDIR}/LICENSE)
+LICENSE?=	${PKGDIR}/LICENSE
+.else
+LICENSE?=	${WRKSRC}/LICENSE
+.endif
+
 COMMENT?=	${PKGDIR}/COMMENT
 DESCR?=		${PKGDIR}/DESCR
 PLIST?=		${PKGDIR}/PLIST
@@ -750,6 +757,13 @@
 PKG_DELETE?=	/usr/sbin/pkg_delete
 .if !defined(PKG_ARGS)
 PKG_ARGS=		-v -c ${COMMENT} -d ${DESCR} -f ${TMPPLIST} -p ${PREFIX} -P "`${MAKE} package-depends | grep -v -E ${PKG_IGNORE_DEPENDS} | sort -u`" ${EXTRA_PKG_ARGS}
+.if exists(${LICENSE})
+PKG_ARGS+=		-n ${LICENSE}
+.else
+.if exists(${LICENSES}/${LICENSE})
+PKG_ARGS+=		-n ${LICENSES}/${LICENSE}
+.endif
+.endif
 .if exists(${PKGINSTALL})
 PKG_ARGS+=		-i ${PKGINSTALL}
 .endif
@@ -2286,6 +2300,13 @@
 		${PKG_CMD} ${PKG_ARGS} -O ${PKGFILE} > ${PKG_DBDIR}/${PKGNAME}/+CONTENTS; \
 		${CP} ${DESCR} ${PKG_DBDIR}/${PKGNAME}/+DESC; \
 		${CP} ${COMMENT} ${PKG_DBDIR}/${PKGNAME}/+COMMENT; \
+		if [ -n "${LICENSE}" ]; then \
+			if [ -f ${LICENSE} ]; then \
+				${CP} ${LICENSE} ${PKG_DBDIR}/${PKGNAME}/+LICENSE; \
+			elif [ -f ${LICENSES}/${LICENSE} ]; then \
+				${CP} ${LICENSES}/${LICENSE} ${PKG_DBDIR}/${PKGNAME}/+LICENSE; \
+			fi; \
+		fi; \
 		if [ -f ${PKGINSTALL} ]; then \
 			${CP} ${PKGINSTALL} ${PKG_DBDIR}/${PKGNAME}/+INSTALL; \
 		fi; \

Index: add/perform.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/add/perform.c,v
retrieving revision 1.54
diff -u -r1.54 perform.c
--- perform.c	1998/12/16 13:59:29	1.54
+++ perform.c	1999/03/28 17:59:19
@@ -430,6 +430,8 @@
 	move_file(".", COMMENT_FNAME, LogDir);
 	if (fexists(DISPLAY_FNAME))
 	    move_file(".", DISPLAY_FNAME, LogDir);
+	if (fexists(LICENSE_FNAME))
+	    move_file(".", LICENSE_FNAME, LogDir);
 	for (p = Plist.head; p ; p = p->next) {
 	    if (p->type != PLIST_PKGDEP)
 		continue;
Index: create/create.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/create.h,v
retrieving revision 1.14
diff -u -r1.14 create.h
--- create.h	1998/12/16 13:59:30	1.14
+++ create.h	1999/03/10 09:47:09
@@ -37,6 +37,7 @@
 extern char	*ExcludeFrom;
 extern char	*Mtree;
 extern char	*Pkgdeps;
+extern char	*License;
 extern char	PlayPen[];
 extern int	Dereference;
 extern int	PlistOnly;
Index: create/main.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/main.c,v
retrieving revision 1.18
diff -u -r1.18 main.c
--- main.c	1998/12/16 13:59:30	1.18
+++ main.c	1999/03/12 12:21:54
@@ -18,7 +18,7 @@
 #include "lib.h"
 #include "create.h"
 
-static char Options[] = "YNOhvf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:";
+static char Options[] = "YNOhvn:f:p:P:c:d:i:I:k:K:r:t:X:D:m:s:";
 
 char	*Prefix		= NULL;
 char	*Comment        = NULL;
@@ -34,6 +34,7 @@
 char	*ExcludeFrom	= NULL;
 char	*Mtree		= NULL;
 char	*Pkgdeps	= NULL;
+char	*License	= NULL;
 char	PlayPen[FILENAME_MAX];
 int	Dereference	= 0;
 int	PlistOnly	= 0;
@@ -129,6 +130,10 @@
 	    Pkgdeps = optarg;
 	    break;
 
+	case 'n':
+	    License = optarg;
+	    break;
+
 	case '?':
 	default:
 	    usage();
@@ -165,7 +170,7 @@
 "usage: pkg_create [-YNOhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
 "                  [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ",
 "                  [-t template] [-X excludefile] [-D displayfile] ",
-"                  [-m mtreefile] -c comment -d description -f packlist ",
-"                  pkg-name");
+"                  [-m mtreefile] [-n licensefile] -c comment ",
+"                  -d description -f packlist pkg-name");
     exit(1);
 }
Index: create/perform.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/create/perform.c,v
retrieving revision 1.47
diff -u -r1.47 perform.c
--- perform.c	1998/12/16 13:59:30	1.47
+++ perform.c	1999/03/12 12:01:11
@@ -151,6 +151,12 @@
     add_plist(&plist, PLIST_IGNORE, NULL);
     add_plist(&plist, PLIST_FILE, DESC_FNAME);
 
+    if (License) {
+	copy_file(home, License, LICENSE_FNAME);
+        add_plist(&plist, PLIST_IGNORE, NULL);
+        add_plist(&plist, PLIST_FILE, LICENSE_FNAME);
+    }
+
     if (Install) {
 	copy_file(home, Install, INSTALL_FNAME);
 	add_plist(&plist, PLIST_IGNORE, NULL);
@@ -278,6 +284,8 @@
     fprintf(totar, "%s\n", COMMENT_FNAME);
     fprintf(totar, "%s\n", DESC_FNAME);
 
+    if (License)
+    	fprintf(totar, "%s\n", LICENSE_FNAME);
     if (Install)
 	fprintf(totar, "%s\n", INSTALL_FNAME);
     if (PostInstall)
Index: info/info.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/info/info.h,v
retrieving revision 1.10
diff -u -r1.10 info.h
--- info.h	1997/02/22 16:09:40	1.10
+++ info.h	1999/03/12 12:04:23
@@ -43,6 +43,7 @@
 #define SHOW_DISPLAY	0x0200
 #define SHOW_REQBY	0x0400
 #define SHOW_MTREE	0x0800
+#define SHOW_LICENSE	0x1000
 
 extern int Flags;
 extern Boolean AllInstalled;
Index: info/main.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/info/main.c,v
retrieving revision 1.15
diff -u -r1.15 main.c
--- main.c	1997/12/26 05:29:29	1.15
+++ main.c	1999/03/12 12:33:40
@@ -28,7 +28,7 @@
 #include "lib.h"
 #include "info.h"
 
-static char Options[] = "acdDe:fikrRpLqImvhl:";
+static char Options[] = "acdDe:fikrRpLqImvhl:n";
 
 int	Flags		= 0;
 Boolean AllInstalled	= FALSE;
@@ -105,6 +105,10 @@
 
 	case 'm':
 	    Flags |= SHOW_MTREE;
+	    break;
+
+	case 'n':
+	    Flags |= SHOW_LICENSE;
 	    break;
 
 	case 'l':
Index: info/perform.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/info/perform.c,v
retrieving revision 1.26
diff -u -r1.26 perform.c
--- perform.c	1998/12/16 13:59:31	1.26
+++ perform.c	1999/03/28 18:20:01
@@ -191,6 +191,8 @@
 	    show_plist("Prefix(s):\n", &plist, PLIST_CWD);
 	if (Flags & SHOW_FILES)
 	    show_files("Files:\n", &plist);
+	if ((Flags & SHOW_LICENSE) && fexists(LICENSE_FNAME))
+	    show_file("License:\n", LICENSE_FNAME);
 	if (!Quiet)
 	    puts(InfoPrefix);
     }
Index: lib/lib.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/pkg_install/lib/lib.h,v
retrieving revision 1.27
diff -u -r1.27 lib.h
--- lib.h	1998/12/16 13:59:31	1.27
+++ lib.h	1999/03/10 10:19:45
@@ -65,6 +65,7 @@
 #define CONTENTS_FNAME		"+CONTENTS"
 #define COMMENT_FNAME		"+COMMENT"
 #define DESC_FNAME		"+DESC"
+#define LICENSE_FNAME		"+LICENSE"
 #define INSTALL_FNAME		"+INSTALL"
 #define POST_INSTALL_FNAME	"+POST-INSTALL"
 #define DEINSTALL_FNAME		"+DEINSTALL"

>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?19990328182535.A29002>