From nbm@rucus.ru.ac.za Sun Mar 28 08:21:15 1999
Return-Path: <nbm@rucus.ru.ac.za>
Received: from rucus.ru.ac.za (rucus.ru.ac.za [146.231.29.2])
	by hub.freebsd.org (Postfix) with SMTP id 775D7155F4
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Mar 1999 08:21:07 -0800 (PST)
	(envelope-from nbm@rucus.ru.ac.za)
Received: (qmail 62224 invoked by uid 1003); 28 Mar 1999 18:25:35 -0000
Message-Id: <19990328182535.A29002@rucus.ru.ac.za>
Date: Sun, 28 Mar 1999 18:25:35 +0000
From: Neil Blakey-Milner <nbm@mithrandr.moria.org>
Sender: nbm@rucus.ru.ac.za
Reply-To: nbm@mithrandr.moria.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: New license mechanism for ports.
X-Send-Pr-Version: 3.2

>Number:         10837
>Category:       ports
>Synopsis:       New license mechanism for ports.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jkh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 28 08:30:01 PST 1999
>Closed-Date:    Fri May 28 06:10:13 PDT 1999
>Last-Modified:  Fri May 28 06:13:37 PDT 1999
>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:

From: Neil Blakey-Milner <nbm@mithrandr.moria.org>
To: FreeBSD-gnats-submit@FreeBSD.ORG
Cc:  
Subject: Re: ports/10837: New license mechanism for ports.
Date: Mon, 29 Mar 1999 09:00:02 +0000

 On Sun 1999-03-28 (18:25), I wrote:
 
 >         These two patches, first one to bsd.port.mk, and the other one
 >         to the /usr/src/usr.sbin/pkg_install directory.
 
 > +.if exists(${LICENSE})
 > +PKG_ARGS+=		-n ${LICENSE}
 > +.else
 > +.if exists(${LICENSES}/${LICENSE})
 > +PKG_ARGS+=		-n ${LICENSES}/${LICENSE}
 > +.endif
 > +.endif
 
 Obviously, there should be a check against that version variable, or the
 version variable should be updated, depending on the method decided upon.
 
 (Hence my problems with just bumping the minimum - people would be a bit
 irritated having to fetch another upgrade kit after the fetch -A one)
 
 Neil
 -- 
 Neil Blakey-Milner
 nbm@rucus.ru.ac.za
 

From: "Jordan K. Hubbard" <jkh@zippy.cdrom.com>
To: Sheldon Hearn <sheldonh@freebsd.org>
Cc: jkh@freebsd.org, asami@freebsd.org,
	nbm@rucus.ru.ac.za (Neil Blakey-Milner)
Subject: Re: ports/10837: New license mechanism for ports. 
Date: Thu, 01 Apr 1999 16:15:30 -0800

 > As far as I know, a PR can't be assigned to two parties, yet this one
 > looks like it'll need approval from both Mr Ports and Mr pkg_*.  :-)
 
 No offense, but I think that this can be achieved using existing
 "hooks" without adding handling for yet another special case.  In both
 the port/package systems, for example, there exists the idea of a file
 to display after the package is added.  This feature is underutilized
 at best (hardly anything uses it) and should be seriously considered
 as a "license displayer" before adding a new feature expressly for
 that purpose.
 
 In the future package system, I also see the "LICENSE" being a
 package/port-supplied procedure rather than a file.  That's the only
 way to do the "please click here after you've read that" or "please
 register yourself online to get these bits" sorts of functionality we
 already see commonly elsewhere in the industry.
 
 - Jordan
 
 
Responsible-Changed-From-To: freebsd-ports->asami 
Responsible-Changed-By: jseger 
Responsible-Changed-When: Mon Apr 19 13:43:09 PDT 1999 
Responsible-Changed-Why:  
Ports system architecture issues go to asami 

State-Changed-From-To: open->closed 
State-Changed-By: sheldonh 
State-Changed-When: Fri May 28 06:10:13 PDT 1999 
State-Changed-Why:  
Idea didn't meet with Mr Sysinstall's approval. 


Responsible-Changed-From-To: asami->jkh 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Fri May 28 06:10:13 PDT 1999 
Responsible-Changed-Why:  
jkh is Mr Sysinstall and was the man behind the axe. 
>Unformatted:
