Colin Watson has proposed merging lp:~cjwatson/launchpad/custom-upload-publish-dirty into lp:launchpad.
Commit message: After publishing a custom file, mark its target suite as dirty so that it will be published. Requested reviews: Launchpad code reviewers (launchpad-reviewers) Related bugs: Bug #1509026 in Launchpad itself: "Custom uploads of translations cause Release to get out of sync" https://bugs.launchpad.net/launchpad/+bug/1509026 For more details, see: https://code.launchpad.net/~cjwatson/launchpad/custom-upload-publish-dirty/+merge/343005 -- Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/custom-upload-publish-dirty into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/queue.py' --- lib/lp/soyuz/model/queue.py 2017-06-13 12:19:20 +0000 +++ lib/lp/soyuz/model/queue.py 2018-04-11 11:24:54 +0000 @@ -1,4 +1,4 @@ -# Copyright 2009-2017 Canonical Ltd. This software is licensed under the +# Copyright 2009-2018 Canonical Ltd. This software is licensed under the # GNU Affero General Public License version 3 (see the file LICENSE). __metaclass__ = type @@ -1363,6 +1363,8 @@ handler = getUtility(ICustomUploadHandler, self.customformat.name) handler.publish( self.packageupload, self.libraryfilealias, logger=logger) + self.packageupload.archive.markSuiteDirty( + self.packageupload.distroseries, self.packageupload.pocket) @implementer(IPackageUploadSet) === modified file 'lib/lp/soyuz/tests/test_packageupload.py' --- lib/lp/soyuz/tests/test_packageupload.py 2018-02-02 03:14:35 +0000 +++ lib/lp/soyuz/tests/test_packageupload.py 2018-04-11 11:24:54 +0000 @@ -6,6 +6,7 @@ from __future__ import absolute_import, print_function, unicode_literals from datetime import timedelta +import io from urllib2 import ( HTTPError, urlopen, @@ -34,6 +35,8 @@ from lp.services.job.interfaces.job import JobStatus from lp.services.job.runner import JobRunner from lp.services.librarian.browser import ProxiedLibraryFileAlias +from lp.services.log.logger import BufferLogger +from lp.services.tarfile_helpers import LaunchpadWriteTarFile from lp.soyuz.adapters.overrides import SourceOverride from lp.soyuz.enums import ( PackagePublishingStatus, @@ -138,6 +141,34 @@ [spph] = upload.realiseUpload() self.assertEqual(spph.packageupload, upload) + def test_publish_custom_marks_suite_dirty(self): + # Publishing a PackageUploadCustom will mark the suite as dirty so + # that new indexes will be published for it. + buf = io.BytesIO() + tarfile = LaunchpadWriteTarFile(buf) + tarfile.add_file("installer-amd64/1/hello", b"world") + tarfile.close() + upload = self.factory.makePackageUpload( + pocket=PackagePublishingPocket.PROPOSED) + filename = "debian-installer-images_1_amd64.tar.gz" + lfa = self.factory.makeLibraryFileAlias( + filename=filename, content=buf.getvalue(), + content_type="application/gzipped-tar") + upload.addCustom(lfa, PackageUploadCustomFormat.DEBIAN_INSTALLER) + transaction.commit() + upload.setAccepted() + self.assertIsNone(upload.archive.dirty_suites) + logger = BufferLogger() + self.assertEqual([], upload.realiseUpload(logger=logger)) + self.assertEqual( + "DEBUG Publishing custom %s to %s/%s\n" % ( + filename, upload.distroseries.distribution.name, + upload.distroseries.name), + logger.getLogBuffer()) + self.assertEqual( + ["%s-proposed" % upload.distroseries.name], + upload.archive.dirty_suites) + def test_overrideSource_ignores_None_component_change(self): # overrideSource accepts None as a component; it will not object # based on permissions for the new component.
_______________________________________________ Mailing list: https://launchpad.net/~launchpad-reviewers Post to : launchpad-reviewers@lists.launchpad.net Unsubscribe : https://launchpad.net/~launchpad-reviewers More help : https://help.launchpad.net/ListHelp