kou commented on code in PR #39762:
URL: https://github.com/apache/arrow/pull/39762#discussion_r1464007725


##########
dev/release/post-08-docs.sh:
##########
@@ -84,6 +84,12 @@ if [ "$is_major_release" = "yes" ] ; then
   previous_series=${previous_version%.*}
   mv docs_temp docs/${previous_series}
 fi
+# Update DOCUMENTATION_OPTIONS.theme_switcher_version_match and
+# DOCUMENTATION_OPTIONS.show_version_warning_banner
+cd docs/${previous_version}
+find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'${previous_version}';/g" {} \;
+find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.show_version_warning_banner = 
false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" {} \;
+cd ../..

Review Comment:
   We can use `pushd`/`popd` pair instead of `cd ../..`:
   
   ```suggestion
   pushd docs/${previous_version}
   find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'${previous_version}';/g" {} \;
   find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.show_version_warning_banner = 
false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" {} \;
   popd
   ```



##########
dev/release/post-08-docs.sh:
##########
@@ -84,6 +84,12 @@ if [ "$is_major_release" = "yes" ] ; then
   previous_series=${previous_version%.*}
   mv docs_temp docs/${previous_series}
 fi
+# Update DOCUMENTATION_OPTIONS.theme_switcher_version_match and
+# DOCUMENTATION_OPTIONS.show_version_warning_banner
+cd docs/${previous_version}
+find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'${previous_version}';/g" {} \;
+find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.show_version_warning_banner = 
false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" {} \;

Review Comment:
   We can use multiple substitutions in one `sed`:
   
   ```suggestion
   find ./ \
     -type f \
     -exec \
       sed -i \
         -e "s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'${previous_version}';/g" \
         -e "s/DOCUMENTATION_OPTIONS.show_version_warning_banner = 
false/DOCUMENTATION_OPTIONS.show_version_warning_banner = true/g" \
         {} \;
   ```



##########
dev/release/post-08-docs.sh:
##########
@@ -84,6 +84,12 @@ if [ "$is_major_release" = "yes" ] ; then
   previous_series=${previous_version%.*}
   mv docs_temp docs/${previous_series}
 fi
+# Update DOCUMENTATION_OPTIONS.theme_switcher_version_match and
+# DOCUMENTATION_OPTIONS.show_version_warning_banner
+cd docs/${previous_version}
+find ./ -type f -exec sed -i 
"s/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'';/DOCUMENTATION_OPTIONS.theme_switcher_version_match = 
'${previous_version}';/g" {} \;

Review Comment:
   Unfortunately, `sed -i` isn't portable...
   `sed -i` works with GNU sed but doesn't work with BSD sed.
   `sed -i ''` works with BSD sed but doesn't work with GNU sed.
   
   `sed -i.bak` works with both of GNU sed BSD sed but it's not in-place.
   
   How about abandoning in-place substitution?
   
   ```bash
   find ./ -type -f -exec sed -i.bak ...
   find ./ -name '*.bak' -delete
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to