From 0cd276474f3a334a4efad3c181624e05a86ca0cd Mon Sep 17 00:00:00 2001 From: Markus Frosch Date: Wed, 20 Nov 2019 08:59:34 +0100 Subject: [PATCH] Add script to diff with OBS --- diff-obs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 diff-obs diff --git a/diff-obs b/diff-obs new file mode 100755 index 0000000..2647033 --- /dev/null +++ b/diff-obs @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +srcpkg=icingaweb2 +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 + sed '/^%changelog/q' "${file}" >"${temp_compare}/${file}" +done + +( + cd "${temp_compare}" + diff --color=auto -Nu "${srcpkg}.obs.spec~" "${srcpkg}.spec" +) + +# vi: ts=2 sw=2 expandtab