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
=== modified file 'pkgme/info_elements.py'
--- pkgme/info_elements.py 2012-06-04 16:40:24 +0000
+++ pkgme/info_elements.py 2012-07-05 14:18:19 +0000
@@ -332,3 +332,16 @@
332332
333 name = 'icon'333 name = 'icon'
334 description = "The name of the icon. Used in desktop files."334 description = "The name of the icon. Used in desktop files."
335
336
337class License(InfoElement):
338
339 name = 'license'
340 default = 'unknown'
341 description = """The license of the files in the package.
342
343 Note that this will only apply for "simple" cases where there
344 is just a single license type. Otherwise it will just write
345 a default copyright template that the user needs to fill in.
346 """
347
335348
=== modified file 'pkgme/package_files.py'
--- pkgme/package_files.py 2012-06-01 15:27:15 +0000
+++ pkgme/package_files.py 2012-07-05 14:18:19 +0000
@@ -21,6 +21,7 @@
21 ExtraFilesFromPaths,21 ExtraFilesFromPaths,
22 Homepage,22 Homepage,
23 Icon,23 Icon,
24 License,
24 Maintainer,25 Maintainer,
25 PackageName,26 PackageName,
26 Section,27 Section,
@@ -172,9 +173,18 @@
172default_package_file_group.add_file_cls(Rules)173default_package_file_group.add_file_cls(Rules)
173174
174175
175class Copyright(DebianPackageFile):176class Copyright(DebianPackageFile, TemplatePackageFile):
176177
177 filename = "copyright"178 # See http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
179
180 elements = [
181 PackageName,
182 License,
183 Homepage,
184 Maintainer,
185 ]
186 filename = 'copyright'
187 template = 'copyright'
178188
179189
180default_package_file_group.add_file_cls(Copyright)190default_package_file_group.add_file_cls(Copyright)
@@ -260,3 +270,5 @@
260 @property270 @property
261 def path(self):271 def path(self):
262 return '%s.desktop' % (self.values[PackageName.name],)272 return '%s.desktop' % (self.values[PackageName.name],)
273
274
263275
=== added file 'pkgme/templates/copyright'
--- pkgme/templates/copyright 1970-01-01 00:00:00 +0000
+++ pkgme/templates/copyright 2012-07-05 14:18:19 +0000
@@ -0,0 +1,18 @@
1#import datetime
2#set $year = datetime.datetime.now().year
3Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
4Upstream-Name: $package_name
5Upstream-Contact: $maintainer
6
7Files: *
8Copyright: $year $maintainer
9License: $license
10#import os.path
11#set $path = os.path.join("/usr/share/common-licenses", $license)
12#if os.path.exists($path)
13 The full text of the can be found in the file '$path'.
14#end if
15
16Files: debian/*
17Copyright: $year The friendly pkgme.net robot
18License: public-domain
019
=== modified file 'pkgme/tests/test_package_files.py'
--- pkgme/tests/test_package_files.py 2012-06-07 11:29:02 +0000
+++ pkgme/tests/test_package_files.py 2012-07-05 14:18:19 +0000
@@ -1,3 +1,4 @@
1import datetime
1import json2import json
2import os3import os
34
@@ -20,6 +21,7 @@
20 Homepage,21 Homepage,
21 Icon,22 Icon,
22 InfoElement,23 InfoElement,
24 License,
23 Maintainer,25 Maintainer,
24 PackageName,26 PackageName,
25 Section,27 Section,
@@ -216,15 +218,34 @@
216218
217 cls = Copyright219 cls = Copyright
218220
221 def get_default_args(self):
222 return { PackageName.name: "somepackage",
223 Maintainer.name: "Random Guy <foo@example.com>",
224 License.name: 'BSD',
225 }
226
219 def test_path(self):227 def test_path(self):
220 package_file = self.get_object()228 package_file = self.get_object()
221 self.assertEqual(229 self.assertEqual(
222 os.path.join(DEBIAN_DIR, "copyright"), package_file.path)230 os.path.join(DEBIAN_DIR, "copyright"), package_file.path)
223231
224 def test_contents_empty(self):232 def test_copyright_valid(self):
225 # TODO: something useful in the copyright file
226 package_file = self.get_object()233 package_file = self.get_object()
227 self.assertEqual("", package_file.get_contents())234 self.assertEqual(package_file.get_contents(),
235"""Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
236Upstream-Name: somepackage
237Upstream-Contact: Random Guy <foo@example.com>
238
239Files: *
240Copyright: %(year)s Random Guy <foo@example.com>
241License: BSD
242 The full text of the can be found in the file '/usr/share/common-licenses/BSD'.
243
244Files: debian/*
245Copyright: %(year)s The friendly pkgme.net robot
246License: public-domain
247""" % { 'year' : datetime.datetime.now().year,
248 })
228249
229 def test_overwrite(self):250 def test_overwrite(self):
230 package_file = self.get_object()251 package_file = self.get_object()

Subscribers

People subscribed via source and target branches

to all changes: