yutannihilation commented on code in PR #468: URL: https://github.com/apache/sedona-db/pull/468#discussion_r2660998895
########## r/sedonadb/tools/savvy-update.sh: ########## @@ -0,0 +1,94 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +set -eu + +main() { + local -r source_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" + local -r source_rpkg_dir="$(cd "${source_dir}/../" && pwd)" + + # Run the updater + savvy-cli update "${source_rpkg_dir}" + + # Post-process files + local -r api_h="${source_rpkg_dir}/src/rust/api.h" + local -r init_c="${source_rpkg_dir}/src/init.c" + local -r wrappers_r="${source_rpkg_dir}/R/000-wrappers.R" + + mv "${api_h}" "${api_h}.tmp" + mv "${init_c}" "${init_c}.tmp" + mv "${wrappers_r}" "${wrappers_r}.tmp" + + # Add license header to api.h + echo "${LICENSE_C}" > "${api_h}" + cat "${api_h}.tmp" >> "${api_h}" + + # Add license header, put includes on their own lines, and fix a typo in init.c + echo "${LICENSE_C}" > "${init_c}" + sed 's/#include/\n#include/g' "${init_c}.tmp" | \ + sed '1s/^\n//' | \ + sed 's/initialzation/initialization/g' >> "${init_c}" Review Comment: Regarding license files, I found `bindgen` has option to insert arbitrary strings at the top of the generated file. Will it be useful if I implement this in savvy-cli? ```console bindgen input.h -o bindings.rs \ --raw-line "/*" \ --raw-line " * Copyright (c) 2026 Your Name" \ --raw-line " * Licensed under Apache-2.0" \ --raw-line " */" ``` -- 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]
