chore: enhancements for newdracut.sh

Related: RHEL-178488
This commit is contained in:
Pavel Valena 2026-06-25 00:28:04 +02:00
parent 9afa387eea
commit 3b2f885638

View File

@ -34,8 +34,8 @@ last_patch_nr=${last_patch_nr:-0000}
#for i in *.patch; do git rm -f $i;done
if rpm -ivh --define "_srcrpmdir $PWD" --define "_specdir $PWD" --define "_sourcedir $PWD" "$srcrpm"; then
for nr in $(patchnr *.patch); do
[[ $((10#$nr)) -gt $((10#$last_patch_nr)) ]] && git add "${nr}.patch"
for nr in $(patchnr *.patch); do
[[ $((10#$nr)) -gt $((10#$last_patch_nr)) ]] && git add "${nr}.patch"
done
new_version=$(rpmspec -D "_sourcedir $(pwd)" -q --srpm --qf '%{version}' dracut.spec)
@ -54,7 +54,7 @@ if rpm -ivh --define "_srcrpmdir $PWD" --define "_specdir $PWD" --define "_sourc
subject=$(grep -E '^Subject: ' "`printf "%04d" $i`.patch" | head -1)
subject="${subject#*\[PATCH\]}"
if [ -n "$subject" ] && [ -z "$(echo $subject | grep '^ci: ')" ]; then
if [ -n "$subject" ] && [ -z "$(echo "$subject" | grep -E '^\s*(ci|chore): ')" ]; then
echo "-${subject}"
fi
done
@ -69,6 +69,17 @@ if rpm -ivh --define "_srcrpmdir $PWD" --define "_specdir $PWD" --define "_sourc
# Patch list:
# ls *.patch | tr -s ' ' '\n' | cut -d'.' -f1 | xargs -i zsh -c "nr=\$((10#{})); echo \"Patch\${nr}: {}.patch\""
git_patches=$(git ls-files | grep -E '^[0-9]*\.patch$')
# Remove patches that were previously dropped
for nr in $(patchnr *.patch); do
[[ $((10#$nr)) -gt $((10#$last_patch_nr)) ]] && break
grep -q "^${nr}\.patch$" <<< "$git_patches" || rm "${nr}.patch"
[[ -r "${nr}.patch" ]] || sed -i "/^Patch$((10#$nr)): ${nr}.patch$/ d" dracut.spec
done
git add dracut.spec
msg="Resolves: $(