From 756912bae264f9d834abcc02423fd41544d530ec46d849b016cf90550dc01ce6 Mon Sep 17 00:00:00 2001 From: Olaf Hering Date: Fri, 28 Apr 2023 22:13:53 +0000 Subject: [PATCH] - remove timestamps from png files - Ignore more sections when comparing ELF executable files OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=302 --- build-compare.changes | 10 ++++++++++ build-compare.spec | 2 +- pkg-diff.sh | 42 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/build-compare.changes b/build-compare.changes index deb4318..9bfd2c7 100644 --- a/build-compare.changes +++ b/build-compare.changes @@ -1,3 +1,13 @@ +------------------------------------------------------------------- +Fri Apr 28 21:21:21 UTC 2023 - olaf@aepfle.de + +- remove timestamps from png files + +------------------------------------------------------------------- +Sat Apr 8 23:58:34 UTC 2023 - Oleg Girko + +- Ignore more sections when comparing ELF executable files + ------------------------------------------------------------------- Fri Nov 25 23:51:35 UTC 2022 - Stefan BrĂ¼ns diff --git a/build-compare.spec b/build-compare.spec index a649ea9..1c3887d 100644 --- a/build-compare.spec +++ b/build-compare.spec @@ -17,7 +17,7 @@ Name: build-compare -Version: 20221206T204012.bb70754 +Version: 20230428T221133.82ffb27 Release: 0 Summary: Build Result Compare Script License: GPL-2.0-or-later diff --git a/pkg-diff.sh b/pkg-diff.sh index a921a79..d954183 100644 --- a/pkg-diff.sh +++ b/pkg-diff.sh @@ -83,8 +83,39 @@ filter_dvi() { } filter_png() { - convert "$f" +set date:create +set date:modify "${f}.$PPID.$$" - mv -f "${f}.$PPID.$$" "${f}" + perl -e ' + use strict; + use warnings; + my $a, my $b, my $c, my $d, my $f; + open ($f, "+<", shift); + $d = read($f, $c, 8); + ($a,$b) = unpack("N2", $c); + unless($a == 0x89504e47 && $b == 0x0d0a1a0a) { + die("bogus png file."); + } + sub fn { + my ($fd, $l) = @_; + my $d = sprintf("%d", $l + 4); + $d = pack("a$d", ""); + print($fd $d); + } + for ($d = read($f, $c, 8); $d > 0; $d = read($f, $c, 8)) { + ($a,$b) = unpack("N a4", $c); + if ($b eq "tIME") { + fn($f, $a); + } elsif ($b eq "tEXt") { + $d = read($f, $c, $a); + $b = unpack("Z$a", $c); + if ($b eq "date:create" || $b eq "date:modify") { + $d = seek($f, -$a, 1); + fn($f, $a); + } + } else { + $d = seek($f, $a + 4, 1); + } + } + close($f); + ' "$f" } filter_emacs_lisp() { @@ -422,10 +453,7 @@ normalize_file() filter_generic dvi ;; *.png) - # Try to remove timestamps, only if convert from ImageMagick is installed - if [[ $(type -p convert) ]]; then - filter_generic png - fi + filter_generic png ;; /usr/share/locale/*/LC_MESSAGES/*.mo|\ /usr/share/locale-bundle/*/LC_MESSAGES/*.mo|\ @@ -931,6 +959,8 @@ check_single_file() /\.build-id/d /\.gnu_debuglink/d /\.gnu_debugdata/d + /\.note\.package/d + /\.note\.go\.buildid/d p } '))