reduce meaningless changes when updating release notes links

If the existing link matches the expected link, leave it in place
regardless of where it is in the file.

If the link needs to be updated, try to insert the link after the
"team" entry, assuming that will be closer to the top of the file
than "releases" and avoiding the need to figure out if "branches" comes
before or after "releases".

Change-Id: I4161bb048deba91ccf8170ea5f0b7208bd9a80a3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2017-02-16 14:03:59 -05:00
parent 2c1d1be7e4
commit 4ee77e9dcd

View File

@@ -42,12 +42,17 @@ for filename in deliverables/$SERIES/*.yaml; do
if ! url_exists $url; then
echo " no release notes page at $url"
else
# Remove any existing links, since they might point to the
# "unreleased" page.
sed -i -e '/release-notes/d' $filename
# Add the link pointing to the series-specific page.
sed -i -e "/releases:/i \
release-notes: $url" $filename
echo
new_value="release-notes: $url"
if grep -q "$new_value" $filename; then
echo " OK"
else
# Remove any existing links, since they might point to the
# "unreleased" page.
sed -i -e '/release-notes/d' $filename
# Add the link pointing to the series-specific page.
sed -i -e "/team:.*/a \
$new_value" $filename
echo " updated"
fi
fi
done