Last active
November 27, 2017 13:04
-
-
Save alexey-sveshnikov/e75a764845acc0c78be31bb33b59a8d5 to your computer and use it in GitHub Desktop.
Show diff between debian packages
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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