Commit 9d77708c authored by Craig Small's avatar Craig Small

Custom copyright file

Bug #718685 asked for wtfpl to be added to the licenses. I closed that
bug because its not used much and there can be problems with it.

By using -c custom --copyrightfile blah dh_make will use the file blah
as your copyright file, so you can use whatever you want now.
parent 0aa083ff
dh-make (1.20150602) UNRELEASED; urgency=medium
dh-make (1.20150913) UNRELEASED; urgency=medium
* Fixed LGPL comment
* Added custom copyright template option
-- Craig Small <csmall@debian.org> Mon, 07 Sep 2015 21:12:25 +1000
......
......@@ -27,6 +27,7 @@ my %RULES_FORMATS = ('dh7' => 'Debhelper v7+', 'old' => 'old debhelper',
our $DASHLINE="";
our $license="";
our $copyrightfile="";
our $username="";
our $package_name="";
our $cap_package_name="";
......@@ -105,6 +106,33 @@ sub process_file(@)
close OUT;
}
sub process_copyright
{
my $myfile = "";
if ($main::license eq "custom")
{
if ($main::copyrightfile =~ /^\//) {
$myfile = $main::copyrightfile;
} else {
my $pwd = &Cwd::cwd();
$myfile = "$pwd/../$main::copyrightfile";
}
}
elsif ($main::license eq '')
{
$myfile = "$main::DHLIB/licenses/blank";
} else {
$myfile = "$main::DHLIB/licenses/$main::license";
}
if ( -r "$myfile" )
{
process_file( $myfile, "copyright");
} else {
die "Unable to find copyright template file $myfile";
}
}
sub output_source_format
{
my $outfile = "source/format";
......@@ -149,7 +177,8 @@ sub show_help
Usage: dh_make [options]
-c, --copyright <type> use <type> of license in copyright file
(apache|artistic|bsd|gpl|gpl2|gpl3|lgpl|lgpl2|
lgpl3|mit)
lgpl3|mit|custom)
--copyrightfile <file> Template to use for custom copyright
-C, --packageclass <cls> set package class (s|i|k||l||m||n)
-e, --email <address> use <address> as the maintainer e-mail address
-n, --native the program is Debian native, don\'t generate .orig
......@@ -184,6 +213,7 @@ sub parse_args
my ($dohelp,$doversion, $single,$indep,$multi,$library,$kmod,$kpatch);
if (GetOptions(
'copyright|c=s' => \$main::license,
'copyrightfile=s' => \$main::copyrightfile,
'packageclass|C=s' => \$main::package_class,
'email|e=s' => \$main::email,
'file|f=s' => \$main::source_file,
......@@ -252,11 +282,21 @@ sub parse_args
$main::package_class = 'n';
}
$main::license = lc $main::license;
if ($main::license ne "" && !($main::license =~ /^(gpl|gpl2|gpl3|lgpl|lgpl2|lgpl3|artistic|bsd|blank|apache|mit)$/))
if ($main::license ne "" && !($main::license =~ /^(gpl|gpl2|gpl3|lgpl|lgpl2|lgpl3|artistic|bsd|blank|apache|mit|custom)$/))
{
print "Copyright type \"$main::license\" is not gpl, gpl2, gpl3, lgpl, lgpl2, lgpl3, apache, artistic, bsd, blank or mit.\n";
exit;
}
if ($main::license eq "custom" && $main::copyrightfile eq "")
{
print "Copyright type \"custom\" requires --copyrightfile option used.\n";
exit;
}
if ($main::license ne "custom" && $main::copyrightfile ne "")
{
print "--copyrightfile only makes sense with custom license.\n";
exit;
}
# Change the non-versioned into the latest version
$main::license = "gpl3" if ($main::license eq "gpl");
$main::license = "lgpl3" if ($main::license eq "lgpl");
......@@ -733,17 +773,8 @@ if ( ! $no_defaults )
}
# Copyright file
if ($license eq '')
{
process_file("$DHLIB/licenses/blank", "copyright");
} else {
if ( -r "$DHLIB/licenses/$license" )
{
process_file("$DHLIB/licenses/$license", "copyright");
} else {
die "Unable to find copyright template file $DHLIB/licenses/$license";
}
}
process_copyright();
# Remove the README if a kernel package, we use the specific one
if ( $package_class eq 'k')
{
......
.\" (C) Copyright 1998-2012 Craig Small <csmall@debian.org>
.\" (C) Copyright 1998-2015 Craig Small <csmall@debian.org>
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 3 of the License, or
.\" (at your option) any later version.
.\"
.TH DH_MAKE 8 2012-06-24 "Debian Project"
.TH DH_MAKE 8 2015-09-13 "Debian Project"
.SH NAME
dh_make \- prepare Debian packaging for an original source archive
.SH SYNOPSIS
......@@ -113,13 +113,20 @@ templates described in the FILES section of this manpage for samples.
.TP
.BR \-c ", " \-\-copyright\ \fIlicense\fR
Use \fIlicense\fR type in copyright file. \fIlicense\fR can be gpl, gpl2,
gpl3, lgpl, lgpl2 lgpl3, artistic, apache, bsd or mit.
gpl3, lgpl, lgpl2 lgpl3, artistic, apache, bsd, mit or custom.
If this field is not specified the copyright file has a space to
fill in which sort of license is used. The field is case-insensitive so
\-c GPL works as well as \-c gpl. gpl and lgpl will give you version 3
of the corresponding license, apache implies Apache v2.0. If you need a
different version, change the
license file afterwards or use the gpl2 and lgpl2 options.
license file afterwards or use the gpl2 and lgpl2 options. If you select
custom here you will need to use the \fB\-\-copyrightfile\fR option as well.
.TP
.BR \-\-copyrightfile\ \fIfilename\fR
When using the custom \fB\-\-copyright\fR option this is the location of
your custom copyright file. \fBdh_make\fR will process this file just like
the standard copyright files. It is suggested you use one of the existing
license files as a starting point.
.TP
.BR \-e ", " \-\-email\ \fIaddress\fR
Use \fIaddress\fR as the e\-mail address in the Maintainer: field of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment