build-compare: fix checking for named pipe and others

* Fixed checking for named pipe
* Return at once when archives are the same
* Fix for type "directory"

(From OE-Core rev: e3245747342860da44fcbb49ac68b8b33e5b43a3)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Robert Yang
2016-07-17 20:32:44 -07:00
committed by Richard Purdie
parent fef5ae147e
commit ad6aae3106
4 changed files with 107 additions and 0 deletions

View File

@@ -11,6 +11,9 @@ SRC_URI = "git://github.com/openSUSE/build-compare.git \
file://0001-Add-support-for-deb-and-ipk-packaging.patch \
file://functions.sh-remove-space-at-head.patch \
file://functions.sh-run-rpm-once-to-make-it-faster.patch \
file://pkg-diff.sh-check-for-fifo-named-pipe.patch \
file://pkg-diff.sh-check_single_file-return-at-once-when-sa.patch \
file://pkg-diff.sh-remove-space-in-the-end-for-ftype.patch \
"
SRCREV = "c5352c054c6ef15735da31b76d6d88620f4aff0a"

View File

@@ -0,0 +1,35 @@
From a78fe4f792a9ac9f4d364e836c8855f48561d6f2 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 14 Jul 2016 19:52:18 -0700
Subject: [PATCH 3/4] pkg-diff.sh: check for fifo(named pipe)
Otherwise "cmp -s fifo1 fifo2" will wait for inputing forever.
Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
pkg-diff.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pkg-diff.sh b/pkg-diff.sh
index 5dd3a38..1f353aa 100644
--- a/pkg-diff.sh
+++ b/pkg-diff.sh
@@ -735,6 +735,13 @@ check_single_file()
return 1
fi
;;
+ fifo*pipe*)
+ ftype_new="`/usr/bin/file new/$file | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]*$@@'`"
+ if [ "$ftype_new" = "$ftype" ]; then
+ return 0
+ fi
+ return 1
+ ;;
*)
if ! diff_two_files; then
return 1
--
2.9.0

View File

@@ -0,0 +1,37 @@
From 657983ef9ca8f8354172682e17408c4f6b5bc667 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 14 Jul 2016 19:46:08 -0700
Subject: [PATCH 1/4] pkg-diff.sh: check_single_file(): return at once when
same
If the two files are the same, return at once, this can save a lot of
time when there are archives inside archives.
Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
pkg-diff.sh | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pkg-diff.sh b/pkg-diff.sh
index 3cf10aa..402d4a4 100644
--- a/pkg-diff.sh
+++ b/pkg-diff.sh
@@ -293,6 +293,13 @@ check_compressed_file()
check_single_file()
{
local file="$1"
+
+ # If the two files are the same, return at once.
+ if [ -f old/$file -a -f new/$file ]; then
+ if cmp -s old/$file new/$file; then
+ return 0
+ fi
+ fi
case $file in
*.spec)
sed -i -e "s,Release:.*$release1,Release: @RELEASE@," old/$file
--
2.9.0

View File

@@ -0,0 +1,32 @@
From 836a6783df9c582a834fca239f227063a5687715 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Thu, 14 Jul 2016 19:49:12 -0700
Subject: [PATCH 2/4] pkg-diff.sh: remove space in the end for ftype
Versions of file like 5.14 returns a " " in the end, for example:
ftype="directory ", but we need ftype="directory", remove the space to
fix the problem.
Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
pkg-diff.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg-diff.sh b/pkg-diff.sh
index 402d4a4..5dd3a38 100644
--- a/pkg-diff.sh
+++ b/pkg-diff.sh
@@ -633,7 +633,7 @@ check_single_file()
;;
esac
- ftype=`/usr/bin/file old/$file | sed 's@^[^:]\+:[[:blank:]]*@@'`
+ ftype=`/usr/bin/file old/$file | sed -e 's@^[^:]\+:[[:blank:]]*@@' -e 's@[[:blank:]]*$@@'`
case $ftype in
PE32\ executable*Mono\/\.Net\ assembly*)
echo "PE32 Mono/.Net assembly: $file"
--
2.9.0