rpm-icinga2/diff-obs

41 lines
872 B
Plaintext
Raw Normal View History

#!/bin/bash
set -e
2018-09-10 14:39:51 +02:00
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
2018-09-10 14:39:51 +02:00
# 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"
)
2018-09-10 14:39:51 +02:00
# vi: ts=2 sw=2 expandtab