Merge lp:~cjwatson/launchpad/custom-upload-parsing into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | William Grant on 2012-05-30 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 15332 |
| Proposed branch: | lp:~cjwatson/launchpad/custom-upload-parsing |
| Merge into: | lp:launchpad |
| Diff against target: |
696 lines (+197/-168) 13 files modified
lib/lp/archivepublisher/customupload.py (+45/-11) lib/lp/archivepublisher/ddtp_tarball.py (+11/-6) lib/lp/archivepublisher/debian_installer.py (+18/-22) lib/lp/archivepublisher/dist_upgrader.py (+19/-21) lib/lp/archivepublisher/tests/test_customupload.py (+4/-4) lib/lp/archivepublisher/tests/test_debian_installer.py (+24/-3) lib/lp/archivepublisher/tests/test_dist_upgrader.py (+23/-3) lib/lp/archiveuploader/nascentuploadfile.py (+2/-1) lib/lp/soyuz/enums.py (+3/-3) lib/lp/soyuz/model/queue.py (+1/-1) lib/lp/soyuz/scripts/custom_uploads_copier.py (+22/-44) lib/lp/soyuz/scripts/tests/test_custom_uploads_copier.py (+23/-47) lib/lp/soyuz/tests/test_distroseriesqueue_debian_installer.py (+2/-2) |
| To merge this branch: | bzr merge lp:~cjwatson/launchpad/custom-upload-parsing |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| William Grant | code | 2012-05-28 | Approve on 2012-05-30 |
|
Review via email:
|
|||
Commit Message
Redesign the CustomUpload interface to allow pushing semi-duplicated parsing code down from CustomUploadsCo
Description of the Change
== Summary ==
In bug 827973, Jeroen noted that the custom uploads copier has code that is rather similar to the filename parsing in custom upload implementations, and that these should be unified.
== Proposed fix ==
Redesign the custom upload interface to support both its previous uses and the custom upload copier.
Note that this should make a subsequent fix for bug 827941 trivial.
== Implementation details ==
The custom upload constructor now takes no parameters, with these being passed in later. This makes the new filename parsing methods implemented by each custom upload type (setTargetDirectory and getSeriesKey) make somewhat more sense, and avoids inelegant passing of None in tests.
I discarded the business where extractNameFields uses a default architecture of "all". Firstly, this should now be handled by custom upload implementations if at all. But secondly and more importantly, I know of no real-world case where it matters. The copier only handles debian-installer and dist-upgrader uploads right now. debian-installer uploads always have an architecture (e.g. https:/
I pushed the check for conflicts in the filesystem down into CustomUpload. The ddtp-tarball implementation overrides this, since it doesn't care.
== LOC Rationale ==
+25 (my first attempt was +119, but its interface was the wrong shape). However, this is part of an arc of work building on r15312, which was -199, so I'd like to claim credit against that.
== Tests ==
bin/test -vvct test_customupload -t test_debian_
== Demo and Q/A ==
None needed; this is refactoring.
| Colin Watson (cjwatson) wrote : | # |
I've made the classmethod change, thanks. I prefer to keep setTargetDirectory separate, though, in order that all processing failures happen during process() rather than some of them happening during the constructor instead; this makes more sense to me, and it makes it easier to consolidate the previously-

Looks reasonable to me, although I'd personally prefer to turn getSeriesKey into a classmethod and merge setTargetDirectory back into __init__.