Merge lp:~mvo/pkgme/add-debian-copyright-template into lp:pkgme

Proposed by Michael Vogt
Status: Merged
Approved by: James Westby
Approved revision: 121
Merged at revision: 117
Proposed branch: lp:~mvo/pkgme/add-debian-copyright-template
Merge into: lp:pkgme
Diff against target: 138 lines (+70/-6)
4 files modified
pkgme/info_elements.py (+13/-0)
pkgme/package_files.py (+15/-3)
pkgme/templates/copyright (+18/-0)
pkgme/tests/test_package_files.py (+24/-3)
To merge this branch: bzr merge lp:~mvo/pkgme/add-debian-copyright-template
Reviewer Review Type Date Requested Status
James Westby Approve
Michael Vogt (community) Needs Resubmitting
Review via email: mp+113568@code.launchpad.net

Commit message

Add a skeleton debian/copyright and allow backends to control some values.

Description of the change

This adds a debian/copyright template/skeleton.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi,

This looks pretty close.

22 +class UpstreamAuthor(InfoElement):

You can just use Maintainer for that I think?

79 +Upstream-Contact: $homepage

$homepage is optional, so making it only appear if it is set would be good. Also, I wonder
if $homepage or $maintainer is better there, or a fallback between them. I don't really
care though.

Thanks,

James

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks! Setting to needs-fixing as tests are missing, but good to know that the direction seems to be sensible.

review: Needs Fixing
118. By Michael Vogt

use maintainer instead of UpstreamAuthor as we assume that by default they will be the same and its trivial to change debian/copyright if needed

119. By Michael Vogt

pkgme/tests/test_package_files.py: improve test

120. By Michael Vogt

yet copyright year as well

121. By Michael Vogt

include link to known licenses

Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your feedback, I improved this a bit now and would appreciate your feedback.

review: Needs Resubmitting
Revision history for this message
James Westby (james-w) wrote :

Hi mvo,

I think this looks good now.

Thanks,

James

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'pkgme/info_elements.py'
2--- pkgme/info_elements.py 2012-06-04 16:40:24 +0000
3+++ pkgme/info_elements.py 2012-07-05 14:18:19 +0000
4@@ -332,3 +332,16 @@
5
6 name = 'icon'
7 description = "The name of the icon. Used in desktop files."
8+
9+
10+class License(InfoElement):
11+
12+ name = 'license'
13+ default = 'unknown'
14+ description = """The license of the files in the package.
15+
16+ Note that this will only apply for "simple" cases where there
17+ is just a single license type. Otherwise it will just write
18+ a default copyright template that the user needs to fill in.
19+ """
20+
21
22=== modified file 'pkgme/package_files.py'
23--- pkgme/package_files.py 2012-06-01 15:27:15 +0000
24+++ pkgme/package_files.py 2012-07-05 14:18:19 +0000
25@@ -21,6 +21,7 @@
26 ExtraFilesFromPaths,
27 Homepage,
28 Icon,
29+ License,
30 Maintainer,
31 PackageName,
32 Section,
33@@ -172,9 +173,18 @@
34 default_package_file_group.add_file_cls(Rules)
35
36
37-class Copyright(DebianPackageFile):
38-
39- filename = "copyright"
40+class Copyright(DebianPackageFile, TemplatePackageFile):
41+
42+ # See http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
43+
44+ elements = [
45+ PackageName,
46+ License,
47+ Homepage,
48+ Maintainer,
49+ ]
50+ filename = 'copyright'
51+ template = 'copyright'
52
53
54 default_package_file_group.add_file_cls(Copyright)
55@@ -260,3 +270,5 @@
56 @property
57 def path(self):
58 return '%s.desktop' % (self.values[PackageName.name],)
59+
60+
61
62=== added file 'pkgme/templates/copyright'
63--- pkgme/templates/copyright 1970-01-01 00:00:00 +0000
64+++ pkgme/templates/copyright 2012-07-05 14:18:19 +0000
65@@ -0,0 +1,18 @@
66+#import datetime
67+#set $year = datetime.datetime.now().year
68+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
69+Upstream-Name: $package_name
70+Upstream-Contact: $maintainer
71+
72+Files: *
73+Copyright: $year $maintainer
74+License: $license
75+#import os.path
76+#set $path = os.path.join("/usr/share/common-licenses", $license)
77+#if os.path.exists($path)
78+ The full text of the can be found in the file '$path'.
79+#end if
80+
81+Files: debian/*
82+Copyright: $year The friendly pkgme.net robot
83+License: public-domain
84
85=== modified file 'pkgme/tests/test_package_files.py'
86--- pkgme/tests/test_package_files.py 2012-06-07 11:29:02 +0000
87+++ pkgme/tests/test_package_files.py 2012-07-05 14:18:19 +0000
88@@ -1,3 +1,4 @@
89+import datetime
90 import json
91 import os
92
93@@ -20,6 +21,7 @@
94 Homepage,
95 Icon,
96 InfoElement,
97+ License,
98 Maintainer,
99 PackageName,
100 Section,
101@@ -216,15 +218,34 @@
102
103 cls = Copyright
104
105+ def get_default_args(self):
106+ return { PackageName.name: "somepackage",
107+ Maintainer.name: "Random Guy <foo@example.com>",
108+ License.name: 'BSD',
109+ }
110+
111 def test_path(self):
112 package_file = self.get_object()
113 self.assertEqual(
114 os.path.join(DEBIAN_DIR, "copyright"), package_file.path)
115
116- def test_contents_empty(self):
117- # TODO: something useful in the copyright file
118+ def test_copyright_valid(self):
119 package_file = self.get_object()
120- self.assertEqual("", package_file.get_contents())
121+ self.assertEqual(package_file.get_contents(),
122+"""Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
123+Upstream-Name: somepackage
124+Upstream-Contact: Random Guy <foo@example.com>
125+
126+Files: *
127+Copyright: %(year)s Random Guy <foo@example.com>
128+License: BSD
129+ The full text of the can be found in the file '/usr/share/common-licenses/BSD'.
130+
131+Files: debian/*
132+Copyright: %(year)s The friendly pkgme.net robot
133+License: public-domain
134+""" % { 'year' : datetime.datetime.now().year,
135+ })
136
137 def test_overwrite(self):
138 package_file = self.get_object()

Subscribers

People subscribed via source and target branches

to all changes: