Merge lp://qastaging/~dooferlad/linaro-image-tools/copy-files-new-syntax into lp://qastaging/linaro-image-tools/11.11

Proposed by James Tunnicliffe
Status: Merged
Approved by: James Tunnicliffe
Approved revision: 564
Merged at revision: 560
Proposed branch: lp://qastaging/~dooferlad/linaro-image-tools/copy-files-new-syntax
Merge into: lp://qastaging/linaro-image-tools/11.11
Diff against target: 913 lines (+484/-139)
5 files modified
linaro_image_tools/hwpack/builder.py (+70/-74)
linaro_image_tools/hwpack/config.py (+67/-3)
linaro_image_tools/hwpack/tests/test_builder.py (+22/-16)
linaro_image_tools/media_create/boards.py (+171/-11)
linaro_image_tools/media_create/tests/test_media_create.py (+154/-35)
To merge this branch: bzr merge lp://qastaging/~dooferlad/linaro-image-tools/copy-files-new-syntax
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+123761@code.qastaging.launchpad.net

This proposal supersedes a proposal from 2012-09-10.

Description of the change

Have addressed Paul's review.

Tests run:
testr run
Built image using 12.06 release Nano image (V2 hwpack). Booted on Pandaboard.
Built V3 hwpack with copy_files entry and two bootloaders defined. Combined with 12.06 Nano image. Booted on Pandaboard.

----
Adds support for copy_files as specified in https://wiki.linaro.org/HardwarePacksV3

Unfortunately had to roll back some previous changes to make this work in a nice way.

To post a comment you must log in.
Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

Just for the record, I don't think such extreme refactoring was required, and it being started, is not complete - instead of moving entire file processing to be package based and happen on the level of linaro-media-create, this still leaves bootloader.file, bootloader.spl_file as it was, just flips copy_files handling - instead of being done consistent with how bootloader.file/bootloader.spl_file works, it is now package based, but that means we have file-extraction code spread around both linaro-hwpack-create and linaro-media-create.

But for the purpose of having it done, it's ok.

(more comments to come.)

Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

It seems that EXTRACT_FILES dict is no longer used by this code, then it should be removed, possibly propagating that recursively (i.e. if it used symbol defined elsewhere, and those symbols are not used either, they should be removed too).

review: Needs Fixing
Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

It's not really clear what .get_last_used_keys() does, suggested to add more details docstring.

review: Needs Fixing
Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

call_for_all_boards_and_bootloaders(self, function) - somehow I got used to such functions be called foreach_board_and_bootloader() , which hints that it implements enumeration loop, though that's of course just a preference.

Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

[package for package in copy_files] - that looks a bit strange. Was "copy_files[:]" meant instead (make a copy of list)?

Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

> [package for package in copy_files] - that looks a bit strange. Was "copy_files[:]" meant instead (make a copy of list)?

Ah, I see, that's unobvious way to do copy_files.keys(). Btw, I missed moment when they allowed iteration on dict directly, and that started to mean iteration over its keys. I still think that doing it explicitly ("for i in a.iterkeys()") is more clear.

Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal
Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

> if not dest_path.startswith("/boot"):

Great, thanks for implementing this handling.

Revision history for this message
Paul Sokolovsky (pfalcon) wrote : Posted in a previous version of this proposal

342 - for expected_file, contents in expected_files:
343 - self.assertThat(
344 - tf, TarfileHasFile(expected_file, content=contents))
345 + stored_package_names = [p.name for p in builder.packages]
346 + for package_name in package_names:
347 + self.assertIn(package_name, stored_package_names)

I'm again not sure about this change - old version did check that file comes from the expected package and not some else, I don't the new does.

review: Needs Fixing
Revision history for this message
James Tunnicliffe (dooferlad) wrote : Posted in a previous version of this proposal

On 11 September 2012 10:37, Paul Sokolovsky <email address hidden> wrote:
01234567890123456789012345678901234567890123456789012345678901234567890123456789
> Just for the record, I don't think such extreme refactoring was required,
> and it being started, is not complete - instead of moving entire file
> processing to be package based and happen on the level of
> linaro-media-create, this still leaves bootloader.file, bootloader.spl_file
> as it was, just flips copy_files handling - instead of being done consistent
> with how bootloader.file/bootloader.spl_file works, it is now package based,
> but that means we have file-extraction code spread around both
> linaro-hwpack-create and linaro-media-create.
>
> But for the purpose of having it done, it's ok.

I agree that we could move all file extraction to the hardware pack
install stage, and it is something I considered. I think it is worth
doing as part of a separate update because it would change existing
functionality (well, change it more than has already been done as part
of supporting multiple boards and bootloaders). I don't know if anyone
is replacing bootloader binaries in a hardware pack after they have
created it with linaro-hwpack-create. If they are, we need to discuss
changes to the hardware pack format with them.

I didn't make the decision to start refactoring lightly. I only did
when it became clear that I was going to have to write some rather
ugly code to support the new copy_files format as well as
re-implementing storing files that exist in a package - it seemed that
just using packages would be a lot cleaner!

I expect that the reason for U-Boot and the second stage bootloader
binaries being in a separate folder in the hardware pack it is
historical - I could not see any mention of the reasons in the code!
It adds unnecessary complication to the hardware pack create and
install stages and now that we support multiple bootloaders and boards
in a single hardware pack, we have already missed some bugs around it,
which you fixed (thanks!)

Thanks for the other comments. I will address them now and get an
updated branch ready.

--
James Tunnicliffe

Revision history for this message
Paul Sokolovsky (pfalcon) wrote :

Great work, thanks for updating and testing!

review: Approve
Revision history for this message
Fathi Boudra (fboudra) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches