Merge lp:~mvo/click/stronger-hashes into lp:click/devel

Proposed by Michael Vogt on 2014-05-15
Status: Work in progress
Proposed branch: lp:~mvo/click/stronger-hashes
Merge into: lp:click/devel
Diff against target: 53 lines (+21/-11)
2 files modified
click/build.py (+15/-11)
click/tests/test_build.py (+6/-0)
To merge this branch: bzr merge lp:~mvo/click/stronger-hashes
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing on 2014-06-23
click hackers 2014-05-15 Pending
Review via email: mp+219714@code.launchpad.net

This proposal supersedes a proposal from 2014-05-12.

Description of the change

This branch adds support for strong hashes in DEBIAN/ to fix bug #1214485.

Its a bit of a drive-by/get-feedback MP right now to ask about the final location of the filename with the stronger hashes. I currently just used DEBIAN/sha512sums. But I'm happy to change that to e.g. to DEBIAN/hashes/sha512 for example.

Thanks for your feedback,
 Michael

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:423
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mvo/click/stronger-hashes/+merge/219714/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/click-devel-ci/3/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-utopic-amd64-ci/3
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-utopic-armhf-ci/3
        deb: http://jenkins.qa.ubuntu.com/job/click-devel-utopic-armhf-ci/3/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/click-devel-utopic-i386-ci/3

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/click-devel-ci/3/rebuild

review: Needs Fixing (continuous-integration)

Unmerged revisions

423. By Michael Vogt on 2014-05-12

add support for strong hashes (LP: #1214485)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click/build.py'
2--- click/build.py 2014-05-05 13:10:19 +0000
3+++ click/build.py 2014-05-15 15:19:27 +0000
4@@ -270,17 +270,21 @@
5 os.unlink(full_manifest_path)
6 os.chmod(real_manifest_path, 0o644)
7
8- md5sums_path = os.path.join(control_dir, "md5sums")
9- with open(md5sums_path, "w") as md5sums:
10- for path in sorted(self.list_files(root_path)):
11- md5 = hashlib.md5()
12- with open(os.path.join(root_path, path), "rb") as f:
13- while True:
14- buf = f.read(16384)
15- if not buf:
16- break
17- md5.update(buf)
18- print("%s %s" % (md5.hexdigest(), path), file=md5sums)
19+ def _make_hashes(name, hash_class):
20+ hashes_path = os.path.join(control_dir, name)
21+ with open(hashes_path, "w") as hashsums:
22+ for path in sorted(self.list_files(root_path)):
23+ hash = hash_class()
24+ with open(os.path.join(root_path, path), "rb") as f:
25+ while True:
26+ buf = f.read(16384)
27+ if not buf:
28+ break
29+ hash.update(buf)
30+ print("%s %s" % (
31+ hash.hexdigest(), path), file=hashsums)
32+ _make_hashes("md5sums", hashlib.md5)
33+ _make_hashes("sha512sums", hashlib.sha512)
34
35 preinst_path = os.path.join(control_dir, "preinst")
36 with open(preinst_path, "w") as preinst:
37
38=== modified file 'click/tests/test_build.py'
39--- click/tests/test_build.py 2014-05-05 13:10:19 +0000
40+++ click/tests/test_build.py 2014-05-15 15:19:27 +0000
41@@ -173,6 +173,12 @@
42 r"eb774c3ead632b397d6450d1df25e001 bin/foo\n"
43 r"49327ce6306df8a87522456b14a179e0 toplevel\n"
44 r"$")
45+ with open(os.path.join(control_path, "sha512sums")) as sha512sums:
46+ self.assertEqual(
47+ sha512sums.read(),dedent("""be5e74b12a237d6ffb280cfda698113c66d0d2d1262e1dc28696940533f04e923156c27b12cff869d153bd5e81c6ec117c1b6d0e7f0b530daaa22beeac48b63b bin/bar
48+be5e74b12a237d6ffb280cfda698113c66d0d2d1262e1dc28696940533f04e923156c27b12cff869d153bd5e81c6ec117c1b6d0e7f0b530daaa22beeac48b63b bin/foo
49+35f845eec71da8904c3a3e62b4ede16e8f3b3cfdfdd6374f7842cff0385f8dfc52b4b04c76532aee24dd881f4164cf34cc11a24b6031589502e0284993c686c4 toplevel
50+ """))
51 with open(os.path.join(control_path, "preinst")) as preinst:
52 self.assertEqual(static_preinst, preinst.read())
53 contents = subprocess.check_output(

Subscribers

People subscribed via source and target branches

to all changes: