Update the release script to update linker mapping file#1001
Update the release script to update linker mapping file#1001igaw merged 2 commits intolinux-nvme:masterfrom
Conversation
It is not obvious to start a new section after a release. Add an explicit new UNRELEASED section so contributers know where to put a new symbol. Signed-off-by: Daniel Wagner <[email protected]>
|
If this is utterly shit, we could also just use a python script... |
|
You probably don't want the release version to have an In which case, all release.sh needs to do is |
|
.. I guess that doesn't address the "where do contributors add their changes" thing though |
|
note that the library base names change between libnvme ( |
|
hm, and we seem to have different version syntax in these. ie: vs libnvme had changed from |
|
My idea was always have a UNRELEASED section at the beginning of the linker script, because it happens very often new symbols are placed somewhere. Though if we can't have the 'global' label it's kind of useless. Maybe we should just add a proper comment at the beginning and have the Though one think I do like at this awk script is the sorting of the new symbol names. |
Argh! That's why a release script is needed |
OK, makes sense. So we want something along the lines of:
is that correct? |
|
Yes that is what I tried to do with the awk script. It's not easy to read I agree. (hit the wrong button...) |
|
Something like this? declare -A maps
maps=(
[src/libnvme.map]=LIBNVME
[src/libnvme-mi.map]=LIBNVME_MI
)
lib_ver="${ver//./_}"
for map_file in "${!maps[@]}"
do
lib_name=${maps[$map_file]}
if [ ! -f "${map_file}" ]; then
continue
fi
lib_unreleased="${lib_name}_UNRELEASED"
# Check if UNRELEASED has symbols
if ! awk -v lib_unreleased="$lib_unreleased" '
$0 ~ "^"lib_unreleased { in_section = 1; next }
in_section && $0 ~ /\}/ { exit }
in_section && $0 !~ /^[[:space:]]*($|\/|\/\*|\*|#)/ { found = 1; exit }
END { exit !found }
' "${map_file}"; then
continue
fi
sed -i -e "s/${lib_unreleased}/${lib_name}_${lib_ver}/" "$map_file"
git add "${map_file}"
echo "${map_file} updated."
done |
| @@ -1,3 +1,7 @@ | |||
| # SPDX-License-Identifier: LGPL-2.1-or-later | |||
| LIBNVME_UNRELEASED { | |||
|
Ah, plus adding the new UNRELEASED section, just a minute. |
yes, that is way saner than what I've done :) |
declare -A maps
maps=(
[src/libnvme.map]=LIBNVME
[src/libnvme-mi.map]=LIBNVME_MI
)
lib_ver="${ver//./_}"
for map_file in "${!maps[@]}"
do
lib_name=${maps[$map_file]}
if [ ! -f "${map_file}" ]; then
continue
fi
lib_unreleased="${lib_name}_UNRELEASED"
# Check if UNRELEASED has symbols
if ! awk -v lib_unreleased="$lib_unreleased" '
$0 ~ "^"lib_unreleased { in_section = 1; next }
in_section && $0 ~ /\}/ { exit }
in_section && $0 !~ /^[[:space:]]*($|\/|\/\*|\*|#)/ { found = 1; exit }
END { exit !found }
' "${map_file}"; then
continue
fi
sed -i \
-e "s/^${lib_unreleased}\s*{/&\n};\n\n${lib_name}_${lib_ver} {/" \
"$map_file"
git add "${map_file}"
echo "${map_file} updated."
done |
|
(only the sed expression has changed there) |
To reduce the confusion where to put a new exported symbol, there is a new UNRELEASED section with all the unreleased symbols. On release, update the export map to the new release version and add back the UNRELEASED section. Signed-off-by: Daniel Wagner <[email protected]>
|
I've gave it a quick test and it seems to do the trick! Way better than my awk hack... |
|
I'd like to change the author credits to you if this is okay with you. |
|
No need, all I did was write a bit of sed there :) |
|
Okay, thanks anyway! :) |
|
I think this still had the LIBNVME_UNRELEASED tag for libnvme-mi.map? |
|
Oops. Fix it directly. Thanks! |
It is not obvious to start a new section after a release. Add an explicit new UNRELEASED section so contributers know where to put a new symbol.
I tried to get this done in awk and I really don't have a lot of experience with it. Yes, I asked a LLM to support me with it...