summaryrefslogtreecommitdiffstats
path: root/bin/debian-sponsor.sh
blob: 17191f53991f095e2fa5815107e24aa6a677c198 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh

set -e

DSC="${1}"

case "${DSC}" in
	*.dsc)
		;;

	*)
		echo "Usage: ${0} DSC"
		;;
esac

SOURCE="$(basename ${DSC} | awk -F_ '{ print $1 }')"

# Download sources
mkdir -p NEW OLD

cd NEW
DGET_VERIFY=no dget --insecure -u -d "${DSC}"
cd "${OLDPWD}"

cd OLD
apt source --only-source --download-only ${SOURCE}
cd "${OLDPWD}"

# Compare upstream tarballs
if [ -e NEW/$(basename OLD/*.orig.tar.*) ]
then
	OLD_MD5="$(md5sum OLD/*.orig.tar.* | awk '{ print $1 }')"
	NEW_MD5="$(md5sum OLD/*.orig.tar.* | awk '{ print $1 }')"

	if [ "${OLD_MD5}" != "${NEW_MD5}" ]
	then
		echo "E: upstream tarballs do not match!"
		echo "E: new version?"
	fi
fi

# Unpack upstream
cd NEW
dpkg-source -x --skip-debianization *.dsc ${SOURCE}
cd "${OLDPWD}"

cd OLD
dpkg-source -x --skip-debianization *.dsc ${SOURCE}
cd "${OLDPWD}"

# Compare upstream
set +e
diff -Naurp OLD/${SOURCE} NEW/${SOURCE} > upstream.diff
set -e

# Unpack debian
cd "NEW/${SOURCE}"
tar xf ../*debian.tar.*
cd "${OLDPWD}"

cd "OLD/${SOURCE}"
tar xf ../*debian.tar.*
cd "${OLDPWD}"

# Compare debian
set +e
diff -Naurp OLD/${SOURCE}/debian NEW/${SOURCE}/debian > debian.diff
set -e