lvc / pkgdiff

A tool for visualizing changes in Linux software packages
https://lvc.github.io/pkgdiff/
GNU General Public License v2.0
215 stars 52 forks source link

Hide unchanged option does not hide moved unchanged files #53

Open locobastos opened 2 years ago

locobastos commented 2 years ago

Hello,

Your program is very useful is almost all cases but in some rare cases, where the package are built unconventionally, the diff report is not usable.

Let me explain:

In my company, we are building our software/web services "unconventionally", and we are installing each version in a separate folder:

/opt/my_company/my_product/1.0.0/all_my_files...
/opt/my_company/my_product/1.1.0/all_my_files...
/opt/my_company/my_product/1.2.0/all_my_files...
/opt/my_company/my_product/1.3.0/all_my_files...

Between version 1.2.0 and version 1.3.0, it may have few changes.

When I'm running pkgdiff on both RPM (we are using RPM-based Linux servers), ALL files are reported as moved (yes, it's true) with a Delta = 0%

My RFE is to hide these results when we are using the -hide-unchanged option to keep only files with real delta, even if they are moved.

To reach this point, I've changed this part of code:

https://github.com/lvc/pkgdiff/blob/master/pkgdiff.pl#L2171

2169    if($HideUnchanged)
2170    {
2171        if($Info{"Status"} eq "unchanged")
2172        {  # do not show unchanged files
2173            next;
2174        }
2175    }

to add:

2169    if($HideUnchanged)
2170    {
2171        if($Info{"Status"} eq "unchanged" or show_number($Info{"Rate"}*100) eq 0)
2172        {  # do not show unchanged files
2173            next;
2174        }
2175    }

This let me know which files are modified between two packages ignoring moved file without any modification.

Thank you!

locobastos commented 1 year ago

Let's take a real example with Java JDK which installs multiple versions of the same package at different directory:

You can download these versions here thanks to the WayBackMachine

With this kind of package, I would like an option to ignore install folder. It means that with this option, files '/usr/java/jdk-17.0.1/conf/logging.properties' and '/usr/java/jdk-17.0.2/conf/logging.properties' should show the same result as if both packages install their files on the same folder.