From 02dbc7e3478e409d6f5e3e1c53daddf8838be999 Mon Sep 17 00:00:00 2001
From: Paul Eggleton <paul.eggleton@linux.intel.com>
Date: Tue, 1 Sep 2015 12:04:33 +0100
Subject: [PATCH] Add support for deb and ipk packaging

Upstream-Status: Submitted [https://github.com/openSUSE/build-compare/pull/10]

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 functions.sh | 15 +++++++++++++++
 pkg-diff.sh  |  6 ++++++
 2 files changed, 21 insertions(+)

diff --git a/functions.sh b/functions.sh
index 06079df..85c9003 100644
--- a/functions.sh
+++ b/functions.sh
@@ -85,6 +85,13 @@ function unpackage()
             CPIO_OPTS="--extract --unconditional --preserve-modification-time --make-directories --quiet"
             rpm2cpio $file | cpio ${CPIO_OPTS}
             ;;
+        *.ipk|*.deb)
+            ar x $file
+            tar xf control.tar.gz
+            rm control.tar.gz
+            tar xf data.tar.gz
+            rm data.tar.gz
+            ;;
     esac
     popd 1>/dev/null
 }
@@ -255,4 +262,12 @@ function cmp_spec ()
     rm $file1 $file2
     return $RES
 }
+
+function adjust_controlfile() {
+    cat $1/control | sed '/^Version: /d' > $1/control.fixed
+    mv $1/control.fixed $1/control
+    cat $2/control | sed '/^Version: /d' > $2/control.fixed
+    mv $2/control.fixed $2/control
+}
+
 # vim: tw=666 ts=2 et
diff --git a/pkg-diff.sh b/pkg-diff.sh
index 0f1fa76..3cf10aa 100644
--- a/pkg-diff.sh
+++ b/pkg-diff.sh
@@ -138,6 +138,12 @@ echo "Extracting packages"
 unpackage $oldpkg $dir/old
 unpackage $newpkg $dir/new
 
+case $oldpkg in
+  *.deb|*.ipk)
+     adjust_controlfile $dir/old $dir/new
+  ;;
+esac
+
 # files is set in cmp_spec for rpms, so if RES is empty we should assume
 # it wasn't an rpm and pick all files for comparison.
 if [ -z $RES ]; then
-- 
2.1.0

