Adrian Schröter 2020-08-31 09:56:07 +00:00 committed by Git OBS Bridge
parent f52a7bbd6d
commit 80a9351e78
2 changed files with 40 additions and 11 deletions

View File

@ -22,8 +22,10 @@
#
# our outut directory
out=/.build.packages/obsgendiff
outreleased=/.build.packages/obsgendiff.released
# the former output of last released build
released=/.build.packages/obsgendiff.released
eol=$'\n'
@ -31,35 +33,48 @@ echo "Running obsgendiff data differ..."
# create changelogs based on the packaged rpms
mkdir -p $out/{changelogs,disturl}
for report in /.build.packages/OTHER/*.report; do
for report in /.build.packages/OTHER/*.report /.build.packages/KIWI/*.packages; do
[ -e "$report" ] || continue
# skip source and debug media
[ "$report" = "${report/-Media2/}" ] || continue
[ "$report" = "${report/-Media3/}" ] || continue
# we need to be able to handle .packages from kiwi appliances
# and .report files from product builds. Check which case we have.
unset PACKAGES_MODE
[ "$report" == "${report%.packages}" ] || PACKAGES_MODE=1
# find and extract right obsgendiff archive
oldobsgendiff=${report%.report}.obsgendiff
oldobsgendiff=/.build.packages/SOURCES/${oldobsgendiff##*/}
oldobsgendiff=`echo ${oldobsgendiff/-Build*-/-Build*-}` # find old build number
# find old build number:
oldobsgendiff=`echo ${oldobsgendiff/-Build*-/-Build*-}`
if [ -e "$oldobsgendiff" ]; then
echo "Extracting $oldobsgendiff"
mkdir -p "${outreleased}"
tar xf "$oldobsgendiff" -C "${outreleased}"
mkdir -p "${released}"
tar xf "$oldobsgendiff" -C "${released}"
else
echo "WARNING no old obsgendiff found: $oldobsgendiff"
fi
sed -n -e 's,.*<binary .*obs:\(//.*\)</binary>,\1,p' "$report" | while read disturl; do
# REGEXP gets the DISTURL only
REGEXP='s,.*<binary .*\(obs://.*\)</binary>,\1,p'
[ -n "$PACKAGES_MODE" ] && REGEXP='s,.*|\(obs://.*\)|.*,\1,p'
sed -n -e "$REGEXP" "$report" | while read disturl; do
# rpm file name
rpm="${disturl##*/}"
# rpm name only (%NAME)
name="${rpm%-*}"
name="${name%-*}"
# only the worker knows where it was downloaded from....
# the disturl may contained a different build repo
file=`echo /.build.packages/SOURCES/repos/*/*/*/$rpm`
file="${file//${eol}*/}" # bash internal "head -n 1"
file="${file//${eol}*/}" # bash internal "head -n 1" to be faster
# dump changelog and disturl for each rpm NAME
LC_ALL=C.UTF-8 rpm -qp "$file" --changelog --nodigest --nosignature 2>/dev/null > $out/changelogs/${name}
echo "$disturl" > $out/disturl/${name}
done
@ -67,14 +82,22 @@ for report in /.build.packages/OTHER/*.report; do
# create archive
pushd $out
gendiff=${report%.report}.obsgendiff
gendiff=${report%.packages}.obsgendiff
tar cfJ /.build.packages/OTHER/${gendiff##*/} .
popd
#
# All data is collected at this point
# Just generating the changelog files below.
#
# create diff to released archive
# NOTE: it had to be published or it won't exist
if [ -d "${outreleased}" ]; then
if [ -d "${released}" ]; then
# The OBS publisher is publishing all ChangeLog.*.txt files by default.
changelog=/.build.packages/OTHER/ChangeLog.${report##*/}
changelog=${changelog%.report}.txt
changelog=${changelog%.packages}.txt
echo ""> $changelog
# removed packages
@ -82,7 +105,7 @@ for report in /.build.packages/OTHER/*.report; do
echo "================">> $changelog
echo "">> $changelog
find "$outreleased/changelogs/" -type f | sort | sed "s,^$outreleased/changelogs/,," | while read file; do
find "$released/changelogs/" -type f | sort | sed "s,^$released/changelogs/,," | while read file; do
[ -e "${out}/changelogs/$file" ] || echo " - ${file##*::}" >> $changelog
done
echo "">> $changelog
@ -92,7 +115,7 @@ for report in /.build.packages/OTHER/*.report; do
echo "============">> $changelog
echo "">> $changelog
find "$out/changelogs/" -type f | sort | sed "s,^$out/changelogs/,," | while read file; do
[ -e "${outreleased}/changelogs/$file" ] || echo " - ${file##*::}" >> $changelog
[ -e "${released}/changelogs/$file" ] || echo " - ${file##*::}" >> $changelog
done
echo "">> $changelog
@ -100,7 +123,8 @@ for report in /.build.packages/OTHER/*.report; do
echo "Package updates">> $changelog
echo "===============">> $changelog
echo "">> $changelog
diff -ur "${outreleased}/changelogs/" "$out/changelogs/" | grep -v '^Only in ' | grep '^[+-]' | grep -v '^--- ' | sed 's,^+++ .*/\([^\t]*\).*$,\1,' >> $changelog
# poor mans changelog generation
diff -ur "${released}/changelogs/" "$out/changelogs/" | grep -v '^Only in ' | grep '^[+-]' | grep -v '^--- ' | sed 's,^+++ .*/\([^\t]*\).*$,\1,' >> $changelog
fi
done

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Aug 31 09:11:03 UTC 2020 - Adrian Schröter <adrian.schroeter@suse.com>
- support also plain kiwi builds
-------------------------------------------------------------------
Wed Aug 26 13:44:48 UTC 2020 - Adrian Schröter <adrian@suse.de>