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

centrifuge-core: add linux-aarch64 build #51517

Merged
merged 2 commits into from
Oct 21, 2024

Conversation

martin-g
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>.

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
@martin-g martin-g added the aarch64 Related to adding linux-aarch64 support label Oct 21, 2024
Copy link
Contributor

coderabbitai bot commented Oct 21, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces modifications to two files: build.sh and meta.yaml for the centrifuge-core package. In build.sh, the script has been enhanced to support architecture-specific compilation flags by determining the machine's architecture using uname -m. Based on whether the architecture is aarch64 or arm64, it sets the ARCH_FLAGS variable with specific flags, including POPCNT_CAPABILITY=0 and -fsigned-char. For other architectures, it retains the original CXXFLAGS. The script now uses ARCH_FLAGS for the make command and includes set -xe for improved debugging.

In meta.yaml, the version number has been incremented from 0 to 1. The home URL has been updated, the license changed from GPL3 to GPL-3.0-only, and a license_file entry has been added. Additional URLs for development and documentation have been included, along with an additional-platforms entry for linux-aarch64. These changes collectively enhance the build process and metadata for the centrifuge-core package.

Possibly related PRs

Suggested labels

please review & merge, osx-arm64

Suggested reviewers

  • mencian
  • rpetit3

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: 3

🧹 Outside diff range and nitpick comments (1)
recipes/centrifuge-core/meta.yaml (1)

37-43: LGTM: Metadata improvements enhance package information.

The changes in the 'about' section are well-considered:

  1. The updated home URL now points to the official project page.
  2. The license specification is more precise (GPL-3.0-only) and includes a license file, which is excellent.
  3. The addition of dev_url and doc_url provides valuable resources for users and developers.

These updates improve the package's metadata and align with best practices.

Consider adding a brief description to the summary field to provide more context about the package's functionality.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 127a023 and a715c84.

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

[warning] 15-15: Quotes/backslashes will be treated literally. Use an array.

(SC2089)


[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

🔇 Additional comments (4)
recipes/centrifuge-core/build.sh (2)

3-3: Improved script robustness and debuggability.

The addition of set -xe is a good practice. It enables command tracing (-x) for easier debugging and ensures the script exits immediately if any command fails (-e), preventing cascading errors.


1-24: Approve overall structure and completeness of the build script.

The build script has been successfully enhanced to support architecture-specific compilation, particularly for linux-aarch64. The overall structure is logical, and the script is complete with necessary steps for building and installing the package.

The script now:

  1. Sets up the environment
  2. Detects the architecture and sets appropriate flags
  3. Modifies the Makefile
  4. Builds and installs the package

These changes align well with the PR objective of adding linux-aarch64 build support.

🧰 Tools
🪛 Shellcheck

[warning] 15-15: Quotes/backslashes will be treated literally. Use an array.

(SC2089)


[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

recipes/centrifuge-core/meta.yaml (2)

9-9: LGTM: Build number increment is appropriate.

The build number has been correctly incremented from 0 to 1. This is the expected practice when modifying a package without changing its version, which aligns with the addition of linux-aarch64 support.


Line range hint 9-47: Summary: Well-implemented changes enhancing package metadata and platform support.

The modifications to this meta.yaml file are comprehensive and align well with the PR objectives:

  1. The build number increment reflects the changes made to the package.
  2. The 'about' section updates improve the accuracy and completeness of the package metadata.
  3. The addition of linux-aarch64 to the 'additional-platforms' list extends the package's compatibility.

These changes enhance the package's documentation and usability while preparing it for broader platform support.

sed "/^GCC/d;/^CC =/d;/^CPP =/d;/^CXX =/d" < Makefile > Makefile.new
mv Makefile.new Makefile
cat Makefile
make CC=$CC CXX=$CXX RELEASE_FLAGS="$CXXFLAGS"
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS}
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

Update make command to use ARCH_FLAGS array.

The use of ${ARCH_FLAGS} in the make command is correct, but it needs to be updated if ARCH_FLAGS is changed to an array as suggested earlier.

Update the make command as follows:

-make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS}
+make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"

This change ensures that the array elements of ARCH_FLAGS are properly expanded and passed to the make command.

📝 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
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS}
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"
🧰 Tools
🪛 Shellcheck

[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

Comment on lines +46 to +47
additional-platforms:
- linux-aarch64
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Issue Detected: Incomplete aarch64 Handling in build.sh

While linux-aarch64 has been added to the additional-platforms in meta.yaml, the build.sh script does not appear to include specific environment configurations, dependency installations, or build commands for aarch64. This may result in build failures or incomplete support for the linux-aarch64 architecture.

  • File: recipes/centrifuge-core/build.sh
  • Action Needed: Implement aarch64-specific environment variables, dependency installations, and build commands to ensure proper support.
🔗 Analysis chain

LGTM: Addition of linux-aarch64 support.

The inclusion of linux-aarch64 in the 'additional-platforms' list aligns with the PR objective of adding support for this architecture.

To ensure complete implementation, let's verify that the build.sh script properly handles the aarch64 architecture:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that build.sh handles aarch64 architecture

# Test: Check if build.sh contains aarch64-specific logic
rg -i 'aarch64|arm64' recipes/centrifuge-core/build.sh

Length of output: 77


Script:

#!/bin/bash
# Description: Verify comprehensive handling of aarch64 in build.sh

# Check for aarch64-specific environment variables
rg -i 'export.*aarch64' recipes/centrifuge-core/build.sh

# Check for aarch64 in dependency installations
rg -i 'aarch64' recipes/centrifuge-core/build.sh | grep -i 'install\|depend'

# Check for aarch64 in build commands
rg -i 'aarch64' recipes/centrifuge-core/build.sh | grep -i 'build\|compile'

Length of output: 211


Script:

#!/bin/bash
# Description: Verify comprehensive handling of linux-aarch64 in build.sh

# Check for linux-aarch64-specific environment variables
rg -i 'export.*linux-aarch64' recipes/centrifuge-core/build.sh

# Check for linux-aarch64 in dependency installations
rg -i 'linux-aarch64' recipes/centrifuge-core/build.sh | grep -i 'install\|depend'

# Check for linux-aarch64 in build commands
rg -i 'linux-aarch64' recipes/centrifuge-core/build.sh | grep -i 'build\|compile'

# Additionally, verify any references to 'linux-aarch64' in conditional statements
rg -i 'linux-aarch64' recipes/centrifuge-core/build.sh | grep -i 'if\|case'

Length of output: 305

@martin-g martin-g force-pushed the aarch64-centrifuge-core branch from a715c84 to 7c65adb Compare October 21, 2024 08:19
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: 2

🧹 Outside diff range and nitpick comments (1)
recipes/centrifuge-core/build.sh (1)

10-17: Consider adding a comment to explain architecture-specific flags.

While the implementation of architecture-specific flags is good, it would be helpful to add a brief comment explaining why these specific flags are needed for aarch64/arm64 architectures. This would improve the maintainability of the script and help future contributors understand the rationale behind these changes.

For example, you could add:

# For aarch64/arm64, disable POPCNT and use signed char to ensure compatibility

This additional context will be valuable for future maintenance and updates to the build script.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between a715c84 and 7c65adb.

📒 Files selected for processing (1)
  • recipes/centrifuge-core/build.sh (1 hunks)
🧰 Additional context used
🔇 Additional comments (2)
recipes/centrifuge-core/build.sh (2)

2-3: Excellent addition of error handling and debugging.

The addition of set -xe is a great improvement. It will cause the script to exit immediately if any command fails (-e) and print each command before execution (-x), enhancing error handling and debugging capabilities.


1-24: Summary of review and next steps

The changes to build.sh successfully introduce support for linux-aarch64 architecture, aligning with the PR objectives. The additions improve error handling, introduce architecture-specific compilation flags, and update the build process accordingly.

To finalize these changes:

  1. Implement the suggested modifications to ARCH_FLAGS to use an array.
  2. Update the make command to properly expand the ARCH_FLAGS array.
  3. Consider adding a comment to explain the rationale behind the architecture-specific flags.

Once these changes are made, the script will be more robust, maintainable, and aligned with best practices for shell scripting.

sed "/^GCC/d;/^CC =/d;/^CPP =/d;/^CXX =/d" < Makefile > Makefile.new
mv Makefile.new Makefile
cat Makefile
make CC=$CC CXX=$CXX RELEASE_FLAGS="$CXXFLAGS"
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"
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

Update make command to use ARCH_FLAGS array.

Once you've implemented the change to make ARCH_FLAGS an array, please update the make command to properly expand the array:

-make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS}
+make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"

This change ensures that the array elements of ARCH_FLAGS are properly expanded and passed to the make command.

📝 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
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"

@martin-g martin-g force-pushed the aarch64-centrifuge-core branch from 7c65adb to eef7230 Compare October 21, 2024 08:34
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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 7c65adb and eef7230.

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

[warning] 15-15: Quotes/backslashes will be treated literally. Use an array.

(SC2089)


[error] 22-22: Double quote array expansions to avoid re-splitting elements.

(SC2068)


[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

🔇 Additional comments (2)
recipes/centrifuge-core/build.sh (2)

2-3: Approve addition of set -xe

The addition of set -xe is a good practice. It enables debugging (-x) and causes the script to exit immediately if any command fails (-e), which can help catch and diagnose issues early.


1-24: Overall changes align well with PR objectives

The modifications to this build script effectively add support for the linux-aarch64 architecture, which is in line with the PR objective of introducing a build for the linux-aarch64 architecture for the centrifuge-core package. The script now detects the machine architecture and applies appropriate compilation flags, particularly for aarch64/arm64 platforms.

Once the suggested changes regarding the use of arrays for ARCH_FLAGS are implemented, this script will provide robust support for building on different architectures, including linux-aarch64.

Great job on implementing these changes! They significantly contribute to achieving the PR's goals.

🧰 Tools
🪛 Shellcheck

[warning] 15-15: Quotes/backslashes will be treated literally. Use an array.

(SC2089)


[error] 22-22: Double quote array expansions to avoid re-splitting elements.

(SC2068)


[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

sed "/^GCC/d;/^CC =/d;/^CPP =/d;/^CXX =/d" < Makefile > Makefile.new
mv Makefile.new Makefile
cat Makefile
make CC=$CC CXX=$CXX RELEASE_FLAGS="$CXXFLAGS"
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS[@]}
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

Update make command to use ARCH_FLAGS array correctly

The current usage of ${ARCH_FLAGS[@]} in the make command is incorrect, as ARCH_FLAGS is not yet defined as an array. Once you've implemented the change to make ARCH_FLAGS an array as suggested in the previous comment, update the make command to properly expand the array:

-make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS[@]}
+make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"

This change ensures that the array elements of ARCH_FLAGS are properly expanded and passed to the make command, resolving the static analysis warnings.

📝 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
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX ${ARCH_FLAGS[@]}
make -j"${CPU_COUNT}" CC=$CC CXX=$CXX "${ARCH_FLAGS[@]}"
🧰 Tools
🪛 Shellcheck

[error] 22-22: Double quote array expansions to avoid re-splitting elements.

(SC2068)


[warning] 22-22: Quotes/backslashes in this variable will not be respected.

(SC2090)

Comment on lines 10 to 17
case $(uname -m) in
aarch64 | arm64)
ARCH_FLAGS="POPCNT_CAPABILITY=0 RELEASE_FLAGS=\"${CXXFLAGS} -fsigned-char\""
;;
*)
ARCH_FLAGS="RELEASE_FLAGS=\"${CXXFLAGS}\""
;;
esac
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

Use an array for ARCH_FLAGS to improve robustness

The addition of architecture-specific compilation flags is good and aligns with the PR objective. However, using a string for ARCH_FLAGS can lead to issues with spaces and special characters. Let's implement an array as suggested in previous comments:

 case $(uname -m) in
     aarch64 | arm64)
-        ARCH_FLAGS="POPCNT_CAPABILITY=0 RELEASE_FLAGS=\"${CXXFLAGS} -fsigned-char\""
+        ARCH_FLAGS=(POPCNT_CAPABILITY=0 "RELEASE_FLAGS=${CXXFLAGS} -fsigned-char")
         ;;
     *)
-        ARCH_FLAGS="RELEASE_FLAGS=\"${CXXFLAGS}\""
+        ARCH_FLAGS=("RELEASE_FLAGS=${CXXFLAGS}")
         ;;
 esac

This change uses an array for ARCH_FLAGS, which will properly handle spaces and special characters in the CXXFLAGS variable and resolve the static analysis warning.

📝 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
case $(uname -m) in
aarch64 | arm64)
ARCH_FLAGS="POPCNT_CAPABILITY=0 RELEASE_FLAGS=\"${CXXFLAGS} -fsigned-char\""
;;
*)
ARCH_FLAGS="RELEASE_FLAGS=\"${CXXFLAGS}\""
;;
esac
case $(uname -m) in
aarch64 | arm64)
ARCH_FLAGS=(POPCNT_CAPABILITY=0 "RELEASE_FLAGS=${CXXFLAGS} -fsigned-char")
;;
*)
ARCH_FLAGS=("RELEASE_FLAGS=${CXXFLAGS}")
;;
esac
🧰 Tools
🪛 Shellcheck

[warning] 15-15: Quotes/backslashes will be treated literally. Use an array.

(SC2089)

Signed-off-by: Martin Tzvetanov Grigorov <[email protected]>
@martin-g martin-g force-pushed the aarch64-centrifuge-core branch from eef7230 to de109ea Compare October 21, 2024 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aarch64 Related to adding linux-aarch64 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants