On Wednesday, 26 October 2016 18:26:01 CET you wrote: > it would be nice if I could do something like the following with cme: > > $ cme diff dpkg-control pkg1/debian/control pkg2/debian/control > > This should show me the semantic differences between two files after > they have been parsed, i.e. independently of statement orders (for > formats where it doesn't matter) and comments.
Yes, I've had that feature on my mind for quite a while. There's 2 ways to handle such a diff. Either run internally 'cme dump dpkg-control' on both package and run a diff on the result (you can try that on your side to see if this fits your need). This may not produce the expected result when comparing lists like Build- Depends: the same list of packages listed in different order will produce a diff even if the lists are the same for dpkg. Or I could design a class to scan both trees and produce a diff. This will raise some challenges: - how to compare list ? (same problem as above). Should I enhance the model to mention that list order does not matter even if the order must be respected to avoid bothering user. - how to show difference when ordered hash of node have a different order ? (e.g. same binary packages are listed in a different order) - how to detect diff in a list of nodes (I've no example for Dpkg, but this case could arise for other models). How can I detect that list with object A B and C is different from list A, B and D where only the content of the object matter ? (note that there are similarities between this problem and the one above) > cme probably has already most things it needs including a way to show > differences. AFAIK currently differences are only shown as "what cme > would change", not as differences between two configurations. Yes. This is done by recording changes which is quite different from comparing 2 existing trees. Note that your idea is interesting, but there's still a lot of head scratching involved.... I'll welcome other ideas to solve this problem. All the best -- https://github.com/dod38fr/ -o- http://search.cpan.org/~ddumont/ http://ddumont.wordpress.com/ -o- irc: dod at irc.debian.org