Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Spring to support ARM #51773

Merged
merged 8 commits into from
Oct 30, 2024
Merged

Conversation

FriederikeHanssen
Copy link
Contributor

Describe your pull request here


Please read the guidelines for Bioconda recipes before opening a pull request (PR).

General instructions

  • If this PR adds or updates a recipe, use "Add" or "Update" appropriately as the first word in its title.
  • New recipes not directly relevant to the biological sciences need to be submitted to the conda-forge channel instead of Bioconda.
  • PRs require reviews prior to being merged. Once your PR is passing tests and ready to be merged, please issue the @BiocondaBot please add label command.
  • Please post questions on Gitter or ping @bioconda/core in a comment.

Instructions for avoiding API, ABI, and CLI breakage issues

Conda is able to record and lock (a.k.a. pin) dependency versions used at build time of other recipes.
This way, one can avoid that expectations of a downstream recipe with regards to API, ABI, or CLI are violated by later changes in the recipe.
If not already present in the meta.yaml, make sure to specify run_exports (see here for the rationale and comprehensive explanation).
Add a run_exports section like this:

build:
  run_exports:
    - ...

with ... being one of:

Case run_exports statement
semantic versioning {{ pin_subpackage("myrecipe", max_pin="x") }}
semantic versioning (0.x.x) {{ pin_subpackage("myrecipe", max_pin="x.x") }}
known breakage in minor versions {{ pin_subpackage("myrecipe", max_pin="x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
known breakage in patch versions {{ pin_subpackage("myrecipe", max_pin="x.x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
calendar versioning {{ pin_subpackage("myrecipe", max_pin=None) }}

while replacing "myrecipe" with either name if a name|lower variable is defined in your recipe or with the lowercase name of the package in quotes.

Bot commands for PR management

Please use the following BiocondaBot commands:

Everyone has access to the following BiocondaBot commands, which can be given in a comment:

@BiocondaBot please update Merge the master branch into a PR.
@BiocondaBot please add label Add the please review & merge label.
@BiocondaBot please fetch artifacts Post links to CI-built packages/containers.
You can use this to test packages locally.

Note that the @BiocondaBot please merge command is now depreciated. Please just squash and merge instead.

Also, the bot watches for comments from non-members that include @bioconda/<team> and will automatically re-post them to notify the addressed <team>.

Copy link
Contributor

coderabbitai bot commented Oct 29, 2024

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request modifies the build.sh script located in the recipes/spring directory to incorporate a conditional check based on the system architecture prior to executing the cmake command. If the architecture is identified as aarch64, the script will run cmake .. without any additional flags. For all other architectures, the script will continue to execute cmake -Dspring_optimize_for_portability=ON ... This change alters the control flow within the script to adapt the build configuration according to the specified architecture, impacting the build process across different environments. Additionally, the meta.yaml file for the spring package has been updated to increment the build number from 2 to 3, indicating a new build iteration. The inclusion of the <cstdint> header file in src/libbsc/bsc.h and src/util.h enhances type safety by allowing the use of fixed-width integer types.

Possibly related PRs

Suggested labels

please review & merge, aarch64, osx-arm64


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (2)

11-11: Quote the architecture comparison for better reliability.

While the architecture detection works, it should follow shell scripting best practices.

-if [ $(arch) == aarch64 ]; then
+if [ "$(arch)" = "aarch64" ]; then

Note: Also using = instead of == for better POSIX compatibility.

🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)


11-19: Clean up script formatting.

The script would benefit from consistent formatting:

  1. Normalize indentation in the if-else block
  2. Remove extra blank lines at the end
 if [ "$(arch)" = "aarch64" ]; then
-   cmake ..
-  else
-      cmake -Dspring_optimize_for_portability=ON ..
-fi
+    cmake ..
+else
+    cmake -Dspring_optimize_for_portability=ON ..
+fi
 make
 cp spring $PREFIX/bin
-
-
🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2914659 and 2c0085d.

📒 Files selected for processing (1)
  • recipes/spring/build.sh (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

🔇 Additional comments (1)
recipes/spring/build.sh (1)

12-14: Verify the removal of portability optimization for ARM.

Please confirm:

  1. Why is the portability optimization flag specifically removed for ARM?
  2. Are there any performance implications of this change?

Let's check if there's any documentation about ARM-specific build requirements:

@matthdsm
Copy link
Contributor

Don't forget to bump the build number here too

recipes/spring/build.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@matthdsm matthdsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, let's see what the CI says

@pabloaledo
Copy link
Contributor

you might need this patch for the recipe to build in ARM (not sure about the CI, though)

diff --git a/src/libbsc/bsc.h b/src/libbsc/bsc.h
index 25230dc..caca189 100644
--- a/src/libbsc/bsc.h
+++ b/src/libbsc/bsc.h
@@ -48,6 +48,7 @@ preprocessor macro LIBBSC_SORT_TRANSFORM_SUPPORT at compile time.
 #ifndef SPRING_LIBBSC_BSC_H_
 #define SPRING_LIBBSC_BSC_H_
 
+#include <cstdint>
 #include "params.h"
 
 namespace spring {
diff --git a/src/util.h b/src/util.h
index 30bad68..a72a0b6 100644
--- a/src/util.h
+++ b/src/util.h
@@ -17,6 +17,7 @@ limitations under the License.
 
 #include <fstream>
 #include <string>
+#include <cstdint>
 
 namespace spring {

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (1)

Line range hint 1-15: Consider adding error handling for cmake configuration.

The build script would benefit from error handling to catch potential cmake configuration issues.

Consider adding error handling:

 if [ "$(arch)" = "aarch64" ]; then
-   cmake ..
+   if ! cmake ..; then
+     echo "Failed to configure cmake for ARM architecture"
+     exit 1
+   fi
 else
-   cmake -Dspring_optimize_for_portability=ON ..
+   if ! cmake -Dspring_optimize_for_portability=ON ..; then
+     echo "Failed to configure cmake with portability optimization"
+     exit 1
+   fi
 fi
🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

recipes/spring/meta.yaml (1)

The search results show that while many files use fixed-width integer types, they include <stdint.h> rather than . However, for ARM compatibility, it's safer to use in C++ code. Let me generate the final response:

Add header to ensure ARM compatibility

The codebase extensively uses fixed-width integer types but includes <stdint.h> instead of . For C++ code, is the proper header and helps ensure compatibility across platforms including ARM.

  • Add #include <cstdint> to the following key files:
    • src/bsc.h
    • src/util.h

The suggested patch in the recipe will help ensure proper integer type definitions are available on ARM platforms.

🔗 Analysis chain

Line range hint 11-13: Consider adding the suggested patch for ARM compatibility.

Based on the PR comments, a patch adding <cstdint> headers might be necessary for ARM builds. Consider adding a patches section:

source:
  url: https://github.com/shubhamchandak94/Spring/archive/v{{ version }}.tar.gz
  sha256: f3fdd6317295d143b244ca9dc0ca03e132a6fec3a60b8e42a514a705d49d6264 
+ patches:
+   - cstdint.patch

And create a cstdint.patch file in the recipe directory with:

diff --git a/src/bsc.h b/src/bsc.h
index abc123..def456 100644
--- a/src/bsc.h
+++ b/src/bsc.h
@@ -1,2 +1,3 @@
+#include <cstdint>
 // rest of the file
 
diff --git a/src/util.h b/src/util.h
index abc123..def456 100644
--- a/src/util.h
+++ b/src/util.h
@@ +1,2 +1,3 @@
+#include <cstdint>
 // rest of the file

Let's verify if the source files need this patch:


Let me generate another script to check if the Spring source code uses fixed-width integer types without cstdint header.


Based on the search results, I can see that the codebase makes extensive use of fixed-width integer types like uint8_t, uint16_t, uint32_t, uint64_t, etc., but does not include header in most files. Let me verify if the header is included through some other means.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if source files already include cstdint
# or if they use fixed-width integer types without it

# First, find the source files
echo "Searching for bsc.h and util.h..."
fd -t f "bsc\.h|util\.h"

# Then, check for existing cstdint inclusion
echo -e "\nChecking for existing cstdint inclusion..."
rg "#include\s+[<\"]cstdint[>\"]" -l

# Finally, check for usage of fixed-width integer types
echo -e "\nChecking for fixed-width integer type usage..."
rg "(?:u?int(?:8|16|32|64)_t)" -l

Length of output: 1484


Script:

#!/bin/bash
# Download and extract the source to check the actual files
mkdir -p temp && cd temp
curl -L https://github.com/shubhamchandak94/Spring/archive/v1.1.1.tar.gz -o spring.tar.gz
tar xf spring.tar.gz

# Check if source files exist and contain fixed-width integer types
echo "Checking source files for fixed-width integer types..."
cd Spring-1.1.1
find . -type f -name "*.h" -o -name "*.cpp" | while read -r file; do
  echo "=== $file ==="
  # Check for fixed-width integer types
  rg "(?:u?int(?:8|16|32|64)_t)" "$file" || true
  # Check for cstdint inclusion
  rg "#include\s+[<\"]cstdint[>\"]" "$file" || true
  echo
done

Length of output: 226594


Script:

#!/bin/bash
# Check for indirect inclusion of cstdint through other headers
rg -l '#include\s+[<"]stdint\.h[>"]'

Length of output: 3184

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 2c0085d and 61d60ae.

📒 Files selected for processing (2)
  • recipes/spring/build.sh (1 hunks)
  • recipes/spring/meta.yaml (1 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

🔇 Additional comments (2)
recipes/spring/build.sh (1)

11-15: Verify ARM-specific build configuration.

The changes look good for supporting ARM architecture by removing the portability optimization flag. However, we should verify if any additional compiler flags or dependencies are needed based on the suggested patch from @pabloaledo regarding the <cstdint> header.

Let's verify if the source files need patching:

Would you like me to help implement the patch for adding the <cstdint> header as suggested in the PR comments?

🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

recipes/spring/meta.yaml (1)

8-8: LGTM! Build number correctly incremented.

The build number has been incremented from 2 to 3 as requested, which is appropriate for tracking the ARM compatibility changes.

Comment on lines 11 to 15
if [ $(arch) == aarch64 ]; then
cmake ..
else
cmake -Dspring_optimize_for_portability=ON ..
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix word splitting vulnerability in architecture detection.

The arch command should be quoted to prevent word splitting issues.

Apply this fix:

-if [ $(arch) == aarch64 ]; then
+if [ "$(arch)" = "aarch64" ]; then

Also note the use of = instead of == for better POSIX compatibility.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ $(arch) == aarch64 ]; then
cmake ..
else
cmake -Dspring_optimize_for_portability=ON ..
fi
if [ "$(arch)" = "aarch64" ]; then
cmake ..
else
cmake -Dspring_optimize_for_portability=ON ..
fi
🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
recipes/spring/build.sh (2)

11-15: Improve code style and documentation.

While the architecture-specific cmake configuration is a good approach, consider these improvements:

  1. Fix the inconsistent indentation between the if and else blocks
  2. Add a comment explaining why ARM64 requires different cmake flags

Apply this diff:

-if [ $(arch) == "aarch64" ]; then
-   cmake ..
-  else
-      cmake -Dspring_optimize_for_portability=ON ..
-fi
+# ARM64 uses native optimization while other architectures require portability flags
+if [ $(arch) == "aarch64" ]; then
+    cmake ..
+else
+    cmake -Dspring_optimize_for_portability=ON ..
+fi
🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)


Line range hint 1-18: Implementation successfully adds ARM support.

The changes effectively implement ARM architecture support while maintaining compatibility with other architectures. The environment setup and build process are well-structured.

Consider adding this change to your package documentation to inform users about the architecture-specific optimizations.

🧰 Tools
🪛 Shellcheck

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 61d60ae and 306a619.

📒 Files selected for processing (2)
  • recipes/spring/Makefile.patch (1 hunks)
  • recipes/spring/build.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • recipes/spring/Makefile.patch
🧰 Additional context used
🪛 Shellcheck
recipes/spring/build.sh

[warning] 11-11: Quote this to prevent word splitting.

(SC2046)

@mencian mencian merged commit 3e97b74 into bioconda:master Oct 30, 2024
6 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants