Blob Blame Raw
#!/bin/bash

if [ "$#" != 2 ]; then
    cat<<EOM
Usage: $(basename $0) OLD_RELEASE NEW_RELEASE

Compares corresponding RPM packages produced in OLD_RELASE and NEW_RELEASE.
The same version strings are assumed.
EOM
    exit 1;
fi

OLD_RELEASE="$1"
NEW_RELEASE="$2"

function process_dir() {
    for F in $(ls $1/* | sed -r 's/-[0-9].*//' | sort | uniq ); do
        OLD_RPM=$(echo ${F}-[0-9]*-${OLD_RELEASE}.*)
        NEW_RPM=$(echo ${F}-[0-9]*-${NEW_RELEASE}.*)
        
        test \( ! -e "$OLD_RPM" \) -a \( ! -e "$NEW_RPM" \) && continue
        if [ ! -e "$OLD_RPM" ]; then echo "+ Package ${F}"; continue; fi
        if [ ! -e "$NEW_RPM" ]; then echo "- Package ${F}"; continue; fi

        DIFF=$(rpmdiff -i S -i 5 -i T "$OLD_RPM" "$NEW_RPM" | \
            grep -vE 'REQUIRES perl = | REQUIRES rpmlib\(' )

        test -n "$DIFF" && printf '* %s:\n%s\n' "$F" "$DIFF"
    done
}

process_dir 'x86_64'
process_dir 'noarch'