Re: Using Config::Model to compare files
On Tue, Jul 10, 2012 at 10:32 AM, Dominique Dumont <email@example.com> wrote:
> On Tuesday 10 July 2012 02:16:48 Felipe Sateler wrote:
>> I think we need something more elaborate. I'm not sure if cme could
>> handle this or a new executable on top of config::model would be in
>> order, but here is my idea of how a specific copyright file comparer
>> would work:
>> Read copyright file 1 and parse it
>> Read copyright file 2 and parse it
>> Walk the directory tree and for each file, compare the license from
>> file 1 and file 2.
>> Maybe config model is not the right tool for this. The copyright file
>> cannot be understood on its own: the source tree is needed to
>> determine the copyright file's meaning. I believe this is not the
>> usual thing for configuration files.
> this would require a new executable.
> cme can indeed parse copyright file 1 and 2. But the third part is harder.
> It requires:
> 1. walking down the directory tree
> 2. foreach file found in there, find the correct entry in the Files: section
> (must take into account wild cards)
> 3. foreach file, infer the copyright and license (if any).
> 4. track unused entries in copyright file 1 and 2
> Step 3. is the hardest as the information is not structured, often missing.
> /usr/bin/licensecheck does a decent jobs of it but it's not directly usable
> within config::model.
As you note, licensecheck (and there is a licensecheck2dep5 utility in
cdbs) already provides functionality number 3. Therefore, I think it
is not needed.
Use cases for a tool that actually traverses the tree, but need not do step 3:
1. When refactoring copyright files, making sure no unintended
consequences have been achieved. Note that the actual globbing is not
necesarily trivial for a human being to do correctly.
2. When updating a package to a new upstream version, in conjunction
with licensecheck2dep5, compare the licenses of new/removed files,
perhaps even copyright notices have changed. This is definitely not
trivial to do in large packages by diffing the 2 generated files.
Another use case (that does not need a second copyright file) is to
(via a similar gui to the current cme edit gui) check what license is
assigned to individual files.