From e3245747342860da44fcbb49ac68b8b33e5b43a3 Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Sun, 17 Jul 2016 20:32:44 -0700 Subject: 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" Signed-off-by: Robert Yang Signed-off-by: Ross Burton --- .../build-compare/build-compare_git.bb | 3 ++ .../pkg-diff.sh-check-for-fifo-named-pipe.patch | 35 ++++++++++++++++++++ ...-check_single_file-return-at-once-when-sa.patch | 37 ++++++++++++++++++++++ ...diff.sh-remove-space-in-the-end-for-ftype.patch | 32 +++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch create mode 100644 meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch create mode 100644 meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch diff --git a/meta/recipes-devtools/build-compare/build-compare_git.bb b/meta/recipes-devtools/build-compare/build-compare_git.bb index 9ec8c2392f..09740d4921 100644 --- a/meta/recipes-devtools/build-compare/build-compare_git.bb +++ b/meta/recipes-devtools/build-compare/build-compare_git.bb @@ -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" diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch new file mode 100644 index 0000000000..e4f0c54163 --- /dev/null +++ b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check-for-fifo-named-pipe.patch @@ -0,0 +1,35 @@ +From a78fe4f792a9ac9f4d364e836c8855f48561d6f2 Mon Sep 17 00:00:00 2001 +From: Robert Yang +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 +--- + 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 + diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch new file mode 100644 index 0000000000..b42af2531d --- /dev/null +++ b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch @@ -0,0 +1,37 @@ +From 657983ef9ca8f8354172682e17408c4f6b5bc667 Mon Sep 17 00:00:00 2001 +From: Robert Yang +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 +--- + 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 + diff --git a/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch new file mode 100644 index 0000000000..8077172333 --- /dev/null +++ b/meta/recipes-devtools/build-compare/files/pkg-diff.sh-remove-space-in-the-end-for-ftype.patch @@ -0,0 +1,32 @@ +From 836a6783df9c582a834fca239f227063a5687715 Mon Sep 17 00:00:00 2001 +From: Robert Yang +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 +--- + 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 + -- cgit 1.2.3-korg