rpm-icinga2/diff-obs

41 lines
872 B
Bash
Executable File

#!/bin/bash
set -e
srcpkg=icinga2
project=server:monitoring
if [ -n "$1" ]; then
project="$1"
fi
if ! which osc &>/dev/null; then
echo "This script needs 'osc' to download files from OpenSuSE Build Service" >&2
exit 1
fi
# You can not download this un-authenticated!
osc cat "$project" "${srcpkg}" "${srcpkg}".spec >"${srcpkg}".obs.spec~
# compare without a changelog
temp_compare="$(mktemp -d)"
trap 'rm -rf "${temp_compare}"' EXIT SIGINT SIGTERM
for file in "${srcpkg}.obs.spec~" "${srcpkg}.spec"
do
cp ${file} "${temp_compare}/${file}"
# Start with first line that is not a comment
sed -i -n '/^[^#]/,$p' "${temp_compare}/${file}"
# remove everything after changelog
sed -i '/^%changelog/q' "${temp_compare}/${file}"
done
(
cd "${temp_compare}"
diff --color=auto -Nu "${srcpkg}.obs.spec~" "${srcpkg}.spec"
)
# vi: ts=2 sw=2 expandtab