Skip to content

Instantly share code, notes, and snippets.

@alexey-sveshnikov
Last active November 27, 2017 13:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexey-sveshnikov/e75a764845acc0c78be31bb33b59a8d5 to your computer and use it in GitHub Desktop.
Save alexey-sveshnikov/e75a764845acc0c78be31bb33b59a8d5 to your computer and use it in GitHub Desktop.
Show diff between debian packages
#!/bin/bash
set -e
DEB_DIR=/var/cache/apt/archives
pkg1=$1
pkg2=$2
file1=$DEB_DIR/$pkg1
file2=$DEB_DIR/$pkg2
usage() {
echo "Usage: $0 <package1> <package2>"
exit 1
}
if [[ -z $pkg1 || -z $pkg2 ]]; then
usage
fi
echo "Displaying diff between backages $pkg1 and $pkg2"
wrkdir=`mktemp -d`
cd $wrkdir
extract() {
file=$1
echo "Extracting $file (deb)"
ar x $file
tar zxf control.tar.gz
mkdir data
echo "Extracting $file (data)"
tar zxf data.tar.gz -C data
}
mkdir $wrkdir/a && cd $wrkdir/a
extract $file1
mkdir $wrkdir/b && cd $wrkdir/b
extract $file2
cd $wrkdir
diff -x '*.pyc' -x changelog.Debian.gz -ur a b | view -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment