Skip to content

Commit 9ad93c4

Browse files
committed
scripts: update UNRELEASED export map on release
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]>
1 parent 607df19 commit 9ad93c4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

scripts/release.sh

+36
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,42 @@ if [ "$build_doc" = true ]; then
132132
git commit -s -m "doc: Regenerate all docs for $VERSION"
133133
fi
134134

135+
declare -A maps
136+
maps=(
137+
[src/libnvme.map]=LIBNVME
138+
[src/libnvme-mi.map]=LIBNVME_MI
139+
)
140+
141+
lib_ver="${ver//./_}"
142+
143+
for map_file in "${!maps[@]}"
144+
do
145+
lib_name=${maps[$map_file]}
146+
147+
if [ ! -f "${map_file}" ]; then
148+
continue
149+
fi
150+
151+
lib_unreleased="${lib_name}_UNRELEASED"
152+
153+
# Check if UNRELEASED has symbols
154+
if ! awk -v lib_unreleased="$lib_unreleased" '
155+
$0 ~ "^"lib_unreleased { in_section = 1; next }
156+
in_section && $0 ~ /\}/ { exit }
157+
in_section && $0 !~ /^[[:space:]]*($|\/|\/\*|\*|#)/ { found = 1; exit }
158+
END { exit !found }
159+
' "${map_file}"; then
160+
continue
161+
fi
162+
163+
sed -i \
164+
-e "s/^${lib_unreleased}\s*{/&\n};\n\n${lib_name}_${lib_ver} {/" \
165+
"$map_file"
166+
167+
git add "${map_file}"
168+
echo "${map_file} updated."
169+
done
170+
135171
# update meson.build
136172
sed -i -e "0,/[ \t]version: /s/\([ \t]version: \).*/\1\'$ver\',/" meson.build
137173
if [[ -n "$libnvme_VERSION" ]] && [[ -f subprojects/libnvme.wrap ]]; then

0 commit comments

Comments
 (0)