Skip to content

Commit

Permalink
base: add licensecheck target
Browse files Browse the repository at this point in the history
  • Loading branch information
danchr authored and mascguy committed May 25, 2021
1 parent 8cc6526 commit ad2781e
Show file tree
Hide file tree
Showing 7 changed files with 516 additions and 1 deletion.
1 change: 1 addition & 0 deletions doc/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ MAN1= \
port-info.1 \
port-install.1 \
port-installed.1 \
port-licensecheck.1 \
port-lint.1 \
port-list.1 \
port-livecheck.1 \
Expand Down
107 changes: 107 additions & 0 deletions doc/port-licensecheck.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
'\" t
.TH "PORT\-LICENSECHECK" "1" "2\&.6\&.99" "MacPorts 2\&.6\&.99" "MacPorts Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
port-licensecheck \- Check whether a port is disbributable
.SH "SYNOPSIS"
.sp
.nf
\fBport\fR [\fB\-vd\fR] [\fB\-D\fR \fIportdir\fR] \fBlicensecheck\fR
[[\fIportname\fR | \fIpseudo\-portname\fR | \fIport\-expressions\fR | \fIport\-url\fR]]
.fi
.SH "DESCRIPTION"
.sp
\fBport licensecheck\fR checks whether a port is distributable, meaning that not only does the license allow distribution, but so do its dependencies, and none of those dependencies cause license conflicts\&.
.sp
By default, it is assumed that ports may use libraries or headers from their dependencies and thus form a derivative work\&. A dependency with an incompatible license thus prevents the port from being distributed in binary form\&. If a dependency with an incompatible license is not used in such a way that a derivative work is formed, or should not prevent binary distribution for any other reason, list it in license_noconflict, see \fBportfile\fR(7)\&.
.sp
As an example, assume a port, A, is licensed under the GNU General Public License and depends on B, which is licensed under a BSD license\&. Now, if B depends on OpenSSL, we have a conflict, as the GPL conflicts with its license\&. In this case, we \fIcould\fR list port B in license_noconflict, but this requires careful inspection, and at the very least a comment in the Portfile\&. The most common case where it is safe to mark a license as non\-conflicting are:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If a port only a invokes a dependency as a build tool, it is most likely safe to list\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If a port invokes a dependency as a tool, i\&.e\&. by executing its binaries, it may be safe to list\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
If a port links against a dependency using dynamic linking or some form of higher\-level object oriented environment, it is probably not safe to list\&.
.RE
.sp
The above points should only be taken as examples and general guidelines; any addition of license_noconflict should probably go through a review on GitHub to ensure that the change is safe\&.
.sp
The MacPorts infrastructure only offers binary archives that pass this test\&.
.SH "GLOBAL OPTIONS"
.sp
Please see the section \fBGLOBAL OPTIONS\fR in the \fBport\fR(1) man page for a description of global port options\&.
.PP
\fB\-v\fR
.RS 4
Print a message if the port is up to date\&.
.RE
.PP
\fB\-d\fR
.RS 4
Print debugging information such as the regular expression and all matches\&.
.RE
.SH "SEE ALSO"
.sp
\fBport\fR(1), \fBportfile\fR(7), \fBport-upgrade\fR(7), \m[blue]\fBUsing Binaries in the MacPorts Guide\fR\m[]\&\s-2\u[1]\d\s+2
.SH "AUTHORS"
.sp
.if n \{\
.RS 4
.\}
.nf
(C) 2014 The MacPorts Project
Clemens Lang <cal@macports\&.org>
.fi
.if n \{\
.RE
.\}
.SH "EXTERNAL REFERENCES"
.IP " 1." 4
Using Binaries in the MacPorts Guide
.RS 4
\%https://guide.macports.org/#using.binaries
.RE
69 changes: 69 additions & 0 deletions doc/port-licensecheck.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// vim: set et sw=4 ts=8 ft=asciidoc tw=80:
port-licensecheck(1)
====================

NAME
----
port-licensecheck - Check whether a port is disbributable

SYNOPSIS
--------
[cmdsynopsis]
*port* [*-vd*] [*-D* 'portdir'] *licensecheck*
[['portname' | 'pseudo-portname' | 'port-expressions' | 'port-url']]

DESCRIPTION
-----------

*port licensecheck* checks whether a port is distributable, meaning
that not only does the license allow distribution, but so do its
dependencies, and none of those dependencies cause license conflicts.

By default, it is assumed that ports may use libraries or headers from
their dependencies and thus form a derivative work. A dependency with
an incompatible license thus prevents the port from being distributed
in binary form. If a dependency with an incompatible license is not
used in such a way that a derivative work is formed, or should not
prevent binary distribution for any other reason, list it in
+license_noconflict+, see man:portfile[7].

As an example, assume a port, A, is licensed under the GNU General
Public License and depends on B, which is licensed under a BSD
license. Now, if B depends on OpenSSL, we have a conflict, as the GPL
conflicts with its license. In this case, we _could_ list port B in
+license_noconflict+, but this requires careful inspection, and at the
very least a comment in the `Portfile`. The most common case where it
is safe to mark a license as non-conflicting are:

* If a port only a invokes a dependency as a build tool, it is most
likely safe to list.
* If a port invokes a dependency as a tool, i.e. by executing its
binaries, it may be safe to list.
* If a port links against a dependency using dynamic linking or some
form of higher-level object oriented environment, it is probably not
safe to list.
The above points should only be taken as examples and general
guidelines; any addition of `license_noconflict` should probably go
through a review on GitHub to ensure that the change is safe.

The MacPorts infrastructure only offers binary archives that pass this
test.

include::global-flags.txt[]

*-v*::
Print a message if the port is up to date.

*-d*::
Print debugging information such as the regular expression and all matches.

SEE ALSO
--------
man:port[1], man:portfile[7], man:port-upgrade[7],
guide:using.binaries[Using Binaries in the MacPorts Guide]

AUTHORS
-------
(C) 2014 The MacPorts Project
Clemens Lang <[email protected]>
1 change: 1 addition & 0 deletions src/port/port.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -4352,6 +4352,7 @@ array set action_array [list \
install [list action_target [ACTION_ARGS_PORTS]] \
clean [list action_target [ACTION_ARGS_PORTS]] \
test [list action_target [ACTION_ARGS_PORTS]] \
licensecheck [list action_target [ACTION_ARGS_PORTS]] \
lint [list action_target [ACTION_ARGS_PORTS]] \
livecheck [list action_target [ACTION_ARGS_PORTS]] \
distcheck [list action_target [ACTION_ARGS_PORTS]] \
Expand Down
2 changes: 1 addition & 1 deletion src/port1.0/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SRCS= port.tcl portchecksum.tcl portconfigure.tcl portextract.tcl \
portlint.tcl portclean.tcl porttest.tcl portactivate.tcl portbump.tcl \
portdeactivate.tcl portstartupitem.tcl porttrace.tcl portlivecheck.tcl \
portdistcheck.tcl portmirror.tcl portload.tcl portunload.tcl portreload.tcl \
portdistfiles.tcl fetch_common.tcl portsandbox.tcl
portdistfiles.tcl fetch_common.tcl portsandbox.tcl portlicensecheck.tcl

include $(srcdir)/../../Mk/macports.subdir.mk

Expand Down
1 change: 1 addition & 0 deletions src/port1.0/port.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ package require portactivate 1.0
package require portdeactivate 1.0
package require portclean 1.0
package require porttest 1.0
package require portlicensecheck 1.0
package require portlint 1.0
package require porttrace 1.0
package require portdistcheck 1.0
Expand Down
Loading

0 comments on commit ad2781e

Please sign in to comment.