-
Notifications
You must be signed in to change notification settings - Fork 4
Todo List
Here is a list of things that are incomplete or unimplemented altogether. Some of them might even get done in the glorious future!
Open source software licenses can be a big deal for distributing software. However, it’s not a big deal when I am just generating packages for my local computer setup.
Licenses are not auto-detected. Instead they just automatically get assigned the dual perl license that perl has. When converted to PKGBUILD lingo, this means license=('GPL', 'PerlArtistic')
. In order to implement licensing you must be able to map from CPAN’s less restrictive licensing info to pacman’s.
Here is an excerpt from the PKGBUILD manpage1.
license (array) This field specifies the license(s) that apply to the package. Commonly-used licenses are found in /usr/share/licenses/common. If you see the package's license there, simply reference it in the license field (e.g. license=('GPL')). If the package provides a license not found in /usr/share/licenses/common, then you should include the license in the package itself and set license=('custom') or license=('custom:LicenseName'). The license should be placed in $pkgdir/usr/share/licenses/$pkgname when building the package. If multiple licenses are applicable for a package, list all of them: license=('GPL' 'FDL').
Here is the list of licenses in my /usr/share/licenses/common:
[juster@artemis ~]$ ls /usr/share/licenses/common APACHE/ CPL/ FDL1.2/ GPL2/ LGPL2.1/ MPL/ PerlArtistic/ ZPL/ CCPL/ EPL/ FDL1.3/ GPL3/ LGPL3/ PHP/ RALINK/ CDDL/ FDL@ GPL@ LGPL@ LPPL/ PSF/ RUBY/
The best way to extract license info is to parse the META.yml file. These values can be just about anything I think. These licenses are supposed to be one of the following. When there is a special license there is maybe a LICENSE file. Module::Build can generate a LICENSE file for you based on the license parameter you give to Module::Build.
Copy/pasted from Module::Build::API.
- license
-
[version 0.07]
Specifies the licensing terms of your distribution. Valid options include:
- apache
- The distribution is licensed under the Apache License, Version 2.0 (http://apache.org/licenses/LICENSE-2.0).
- apache_1_1
- The distribution is licensed under the Apache Software License, Version 1.1 (http://apache.org/licenses/LICENSE-1.1).
- artistic
- The distribution is licensed under the Artistic License, as specified by the Artistic file in the standard Perl distribution.
- artistic_2
- The distribution is licensed under the Artistic 2.0 License (http://opensource.org/licenses/artistic-license-2.0.php.)
- bsd
- The distribution is licensed under the BSD License (http://www.opensource.org/licenses/bsd-license.php).
- gpl
- The distribution is licensed under the terms of the GNU General Public License (http://www.opensource.org/licenses/gpl-license.php).
- lgpl
- The distribution is licensed under the terms of the GNU Lesser General Public License (http://www.opensource.org/licenses/lgpl-license.php).
- mit
- The distribution is licensed under the MIT License (http://opensource.org/licenses/mit-license.php).
- mozilla
- The distribution is licensed under the Mozilla Public License. (http://opensource.org/licenses/mozilla1.0.php or http://opensource.org/licenses/mozilla1.1.php)
- open_source
- The distribution is licensed under some other Open Source Initiative-approved license listed at http://www.opensource.org/licenses/.
- perl
- The distribution may be copied and redistributed under the same terms as Perl itself (this is by far the most common licensing option for modules on CPAN). This is a dual license, in which the user may choose between either the GPL or the Artistic license.
- restrictive
- The distribution may not be redistributed without special permission from the author and/or copyright holder.
- unrestricted
- The distribution is licensed under a license that is not approved by www.opensource.org but that allows distribution without restrictions.
Note that you must still include the terms of your license in your documentation – this field only lets automated tools figure out your licensing restrictions. Humans still need something to read. If you choose to provide this field, you should make sure that you keep it in sync with your written documentation if you ever change your licensing terms.
You may also use a license type of unknown if you don’t wish to specify your terms in the metadata.
It is a fatal error to use a license other than the ones mentioned above. This is not because I wish to impose licensing terms on you – please let me know if you would like another license option to be added to the list. I just started out with a small set of licenses to keep things simple, figuring I’d let people with actual working knowledge in this area tell me what to do. So if that’s you, drop me a line.
sub cpan_to_arch_license
{
my $cpan_license = shift;
# Map from cpan to archlinux license if one's available.
my %arch_license_of ( map { ( $_ => [ uc $_ ] ) } qw/ apache gpl lgpl /,
mozilla => [ 'MPL' ], perl => [ qw/ PerlArtistic GPL / ],
);
my $license = $arch_license_of{ $cpan_license };
return @$license if $license;
# Otherwise use custom:$LicenseName for license.
$license = sprintf 'custom:%s', ucfirst $cpan_license;
# ...and copy the COPYING file (if there is one) to $pkgdir/usr/share/licenses/$pkgname
}
- juster
1 The closest thing online is the PKGBUILD wiki page.