pkgdiff icon indicating copy to clipboard operation
pkgdiff copied to clipboard

Hide unchanged option does not hide moved unchanged files

Open locobastos opened this issue 2 years ago • 1 comments

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 avatar Oct 10 '22 14:10 locobastos

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

  • /usr/java/jdk-17.0.1/
  • /usr/java/jdk-17.0.2/
  • /usr/java/jdk-17.0.3/
  • ...

You can download these versions here thanks to the WayBackMachine

  • 17.0.1 ==> https://web.archive.org/web/20220101012755/https://www.oracle.com/java/technologies/downloads/
  • 17.0.2 ==> https://web.archive.org/web/20220323033115/https://www.oracle.com/java/technologies/downloads/
  • 17.0.5 ==> https://web.archive.org/web/20221201030525/https://www.oracle.com/java/technologies/downloads/

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.

locobastos avatar Dec 06 '22 10:12 locobastos