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

Proposed by James Tunnicliffe
Status: Merged
Merged at revision: 557
Proposed branch: lp://qastaging/~dooferlad/linaro-image-tools/copy-files-support
Merge into: lp://qastaging/linaro-image-tools/11.11
Diff against target: 436 lines (+225/-48)
4 files modified
linaro_image_tools/hwpack/builder.py (+94/-43)
linaro_image_tools/hwpack/hardwarepack.py (+3/-1)
linaro_image_tools/hwpack/packages.py (+10/-1)
linaro_image_tools/hwpack/tests/test_builder.py (+118/-3)
To merge this branch: bzr merge lp://qastaging/~dooferlad/linaro-image-tools/copy-files-support
Reviewer Review Type Date Requested Status
Paul Sokolovsky Approve
Review via email: mp+122554@code.qastaging.launchpad.net

Description of the change

Adding copy_files support to linaro-hwpack-create

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

Line #359 and on is a bit cryptic - instead of using unobvious numeric indexes targetting at the unneeded for tests feature of being able to change "foo" and "bar" in one place, it would be better to use "foo" and "bar" literally as needed - the test would become more clear and actually easier to maintain and extend.

More importantly, this has a regression wrt to original test which I wrote - which check that even if we have 2 different packages with the same layout (i.e. files with the same names at the same paths, but with different content), then exactly the file from expected package is used. This actually hit me due to bug in file expand code, and of course, it may hit again.

With new implementation, the problem is in line 266, which writes the same mock content to files on the same package, so it's not possible to distinguish 2 such files from different packages. I suggest letting user pass the content explicitly, then it can be easily specified as:

package_files = {
"foo": [("usr/lib/u-boot/omap4_panda/u-boot.img", "mock uboot #1"), ("usr/share/doc/u-boot-linaro-omap4-panda/copyright", "mock copyright #1")]
...
}

review: Needs Fixing
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Yea, the "foo", "bar" thing has been happening a lot in other tests in the suite and I was sticking with the style. I agree that it is easier to read with the strings used instead of a reference, but I was trying not to repeat myself. I don't have a strong opinion about it, so I am happy to change it.

Actually each mock file has the originating package and path written to it, so I can add more checks. I thought I had mirrored your original test - sorry if I missed something. Since the logic is there, I might as well use it for all the files though, so I will do that.

Thanks for the review.

Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Oops, spoke too soon. I am testing the origin of all the files (I just have some duplicated tests, which is pointless). Will take out the duplicates and use explicit package names.

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

Ok, I got confused with workflow of code (again, how much easier it would be to just look at *exact* packages being used), it appears that content will be unique already if package names are unique.

review: Approve
559. By James Tunnicliffe

Made test clearer.

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