summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/build-compare/files/pkg-diff.sh-check_single_file-return-at-once-when-sa.patch
blob: b42af2531d966fb776c60c3f63dd38e83cff7fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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