launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17288
[Merge] lp:~wgrant/launchpad/nmaf-description-md5-fix into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/nmaf-description-md5-fix into lp:launchpad.
Commit message:
Fix NMAF Description-md5 calculation to match apt by including the trailing \n.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/nmaf-description-md5-fix/+merge/229200
Fix NMAF Description-md5 calculation to match apt by including the trailing \n. IndexStanzaFields appends a \n to even multi-line fields, so our formatted Description value doesn't end with a \n. This disagrees with the data that apt hashes.
--
https://code.launchpad.net/~wgrant/launchpad/nmaf-description-md5-fix/+merge/229200
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/nmaf-description-md5-fix into lp:launchpad.
=== modified file 'lib/lp/archivepublisher/tests/test_publisher.py'
--- lib/lp/archivepublisher/tests/test_publisher.py 2014-07-31 18:08:30 +0000
+++ lib/lp/archivepublisher/tests/test_publisher.py 2014-08-01 11:41:52 +0000
@@ -1328,7 +1328,7 @@
'SHA256: 006ca0f356f54b1916c24c282e6fd19961f4356441401f4b0966f2a'
'00bb3e945',
'Description: Foo app is great',
- 'Description-md5: 6f43b8a2c247729beb1a59e5c336ffe2',
+ 'Description-md5: 42d89d502e81dad6d3d4a2f85fdc6c6e',
''],
index_contents)
@@ -1361,7 +1361,7 @@
'SHA256: 006ca0f356f54b1916c24c282e6fd19961f4356441401f4b0966f2a'
'00bb3e945',
'Description: Foo app is great',
- 'Description-md5: f98d4e4b123ac43e12f6848e15b67246',
+ 'Description-md5: 6fecedf187298acb6bc5f15cc5807fb7',
''],
index_contents)
@@ -1392,7 +1392,7 @@
'SHA256: 006ca0f356f54b1916c24c282e6fd19961f4356441401f4b0966f2a'
'00bb3e945',
'Description: Foo app is great',
- 'Description-md5: 6f43b8a2c247729beb1a59e5c336ffe2',
+ 'Description-md5: 42d89d502e81dad6d3d4a2f85fdc6c6e',
''],
index_contents)
@@ -1413,19 +1413,19 @@
self.assertEqual(
['Package: bingo',
- 'Description-md5: f98d4e4b123ac43e12f6848e15b67246',
+ 'Description-md5: 6fecedf187298acb6bc5f15cc5807fb7',
'Description-en: Foo app is great',
' nice udeb',
'',
'Package: foo-bin',
- 'Description-md5: 6f43b8a2c247729beb1a59e5c336ffe2',
+ 'Description-md5: 42d89d502e81dad6d3d4a2f85fdc6c6e',
'Description-en: Foo app is great',
' My leading spaces are normalised to a single space but not '
'trailing. ',
' It does nothing, though',
'',
'Package: foo-bin-dbgsym',
- 'Description-md5: 6f43b8a2c247729beb1a59e5c336ffe2',
+ 'Description-md5: 42d89d502e81dad6d3d4a2f85fdc6c6e',
'Description-en: Foo app is great',
' My leading spaces are normalised to a single space but not '
'trailing. ',
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2014-08-01 07:28:04 +0000
+++ lib/lp/soyuz/model/publishing.py 2014-08-01 11:41:52 +0000
@@ -1026,8 +1026,10 @@
makePoolPath(spr.name, self.component.name), bin_filename)
description = self._getFormattedDescription(
bpr.summary, bpr.description)
+ # Our formatted description isn't \n-terminated, but apt
+ # considers the trailing \n to be part of the data to hash.
bin_description_md5 = hashlib.md5(
- description.encode('utf-8')).hexdigest()
+ description.encode('utf-8') + '\n').hexdigest()
if separate_long_descriptions:
# If distroseries.include_long_descriptions is False, the
# description should be the summary
@@ -1102,8 +1104,10 @@
bin_description = self._getFormattedDescription(
bpr.summary, bpr.description)
+ # Our formatted description isn't \n-terminated, but apt
+ # considers the trailing \n to be part of the data to hash.
bin_description_md5 = hashlib.md5(
- bin_description.encode('utf-8')).hexdigest()
+ bin_description.encode('utf-8') + '\n').hexdigest()
if (bpr.name, bin_description_md5) not in packages:
fields = IndexStanzaFields()
fields.append('Package', bpr.name)
Follow ups