this is a port of something currently done in my 'check-compose' tool which produces the 'compose check report' emails. I think it makes sense to do it here instead. It's pretty simple: we consider the 3-tuple (subvariant, type, arch) for an image to be a unique identifier for the image, and we compare the images in each compose and produce 'added_images' and 'dropped_images' from sets of the identifiers. We use the same identifier run through " ".join() as the human-readable identifier and include just a count of added/removed images in the summary, the id for each added and removed image in the brief log, and the id plus the path for each added and removed image in the verbose log.
I tried to future proof it a bit, in case we need to change the identifier format at any point, the idea is that we can just change the image_id method and the rest of the code should keep working. At first I just got the tuples and stored those as added_images and dropped_images, but then it's a bit messy in future if we change the identifier format. It's also set up such that we can also add check-compose's 'expected images' feature quite easily using the get_images dict (planning that as a separate PR).
image_id
get_images
Why did you remove this?
Why did we remove x86_64 here?
Why? Well, so there's an image diff to test =) The image lists in the test metadata prior to this commit are identical, so they're useless for testing the image diff feature because there's no difference. In order to test it I have to remove one image from each compose, so there's one 'added' image and one 'removed' image when you diff one against the other.
The existing tests don't use the image data at all, I don't think, it just had to be there to prevent productmd from choking.
ah hum, just found a problem with this that the tests don't catch but running the real binary on the test data does...TypeError: <productmd.images.Image object at 0x7f6c63315c50> is not JSON serializable. I'll figure a way to deal with that.
TypeError: <productmd.images.Image object at 0x7f6c63315c50> is not JSON serializable
Pull-Request has been rebased
OK, that solves the serialization problem by serializing the Image objects. Now the tests work and running bin/compose-changelog -p /tmp tests/composes/DP-1.0-20160315.t.0/ tests/composes/DP-1.0-20160315.t.1/ works too.
Image
bin/compose-changelog -p /tmp tests/composes/DP-1.0-20160315.t.0/ tests/composes/DP-1.0-20160315.t.1/
Looks good. Test case passes for me and when testing on actual data I also get expected results.
Commit d52446e0 fixes this pull-request
Pull-Request has been merged by awilliam@redhat.com
For the record I have merged this outside of pagure (I fixed some trailing whitespace in tests).
It just occurred to me that I didn't conditionalize anything for the case where there is no image diff. It shouldn't break anything but the report might look a bit weird? I guess we'll see when it happens how the report looks and we can tweak it if necessary.