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 mosdepth recipe #48070

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

Conversation

ramprasadn
Copy link
Contributor

@ramprasadn ramprasadn commented May 24, 2024

This update relates to the issue descibed at brentp/mosdepth#232


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

@ramprasadn ramprasadn requested a review from brentp May 24, 2024 21:41
@ramprasadn
Copy link
Contributor Author

@BiocondaBot please fetch artifacts

@BiocondaBot
Copy link
Collaborator

Package(s) built are ready for inspection:

Arch Package Zip File / Repodata CI Instructions
linux-64 mosdepth-0.3.8-hd299d5a_1.tar.bz2 LinuxArtifacts.zip Azure
showYou may also use conda to install after downloading and extracting the zip file. From the LinuxArtifacts directory: conda install -c ./packages <package name>
osx-64 mosdepth-0.3.8-h212548b_1.tar.bz2 OSXArtifacts.zip Azure
showYou may also use conda to install after downloading and extracting the zip file. From the OSXArtifacts directory: conda install -c ./packages <package name>

Docker image(s) built:

Package Tag CI Install with docker
mosdepth 0.3.8--hd299d5a_1 Azure
showImages for Azure are in the LinuxArtifacts zip file above.gzip -dc LinuxArtifacts/images/mosdepth:0.3.8--hd299d5a_1.tar.gz | docker load

@ramprasadn ramprasadn marked this pull request as ready for review May 24, 2024 21:57
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
@ramprasadn
Copy link
Contributor Author

Hey @brentp, do you happen to know why the compilation is not successful on osx? It seems that d4 is installed correctly, but the compilation with nim is failing.

@ramprasadn
Copy link
Contributor Author

Tried to compile the package on my laptop, following the steps defined in the build.sh. I got this

❯ nimble build -y --verbose -d:d4 -d:release
  Verifying dependencies for mosdepth@0.3.8
    Reading official package list
   Checking for hts@>= 0.3.22
      Info: Dependency on hts@>= 0.3.22 already satisfied
  Verifying dependencies for hts@0.3.25
    Reading official package list
   Checking for docopt@0.7.0
      Info: Dependency on docopt@0.7.0 already satisfied
  Verifying dependencies for docopt@0.7.0
    Reading official package list
   Checking for regex@>= 0.11.1
      Info: Dependency on regex@>= 0.11.1 already satisfied
  Verifying dependencies for regex@0.25.0
    Reading official package list
   Checking for unicodedb@>= 0.7.2
      Info: Dependency on unicodedb@>= 0.7.2 already satisfied
  Verifying dependencies for unicodedb@0.12.0
    Reading official package list
   Checking for https://github.com/brentp/d4-nim@>= 0.0.3
      Info: Dependency on https://github.com/brentp/d4-nim@>= 0.0.3 already satisfied
  Verifying dependencies for d4@0.0.3
   Building mosdepth/mosdepth using c backend
  Executing /Users/ramp/Documents/nim-1.6.21/bin/nim c --colors:on --noNimblePath -d:d4 -d:release -d:NimblePkgVersion=0.3.8 --path:/Users/ramp/.nimble/pkgs/hts-0.3.25 --path:/Users/ramp/.nimble/pkgs/docopt-0.7.0 --path:/Users/ramp/.nimble/pkgs/regex-0.25.0 --path:/Users/ramp/.nimble/pkgs/unicodedb-0.12.0 --path:/Users/ramp/.nimble/pkgs/d4-0.0.3 -o:/Users/ramp/Documents/mosdepth-0.3.8/mosdepth /Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim
Hint: used config file '/Users/ramp/Documents/nim-1.6.21/config/nim.cfg' [Conf]
Hint: used config file '/Users/ramp/Documents/nim-1.6.21/config/config.nims' [Conf]
Hint: used config file '/Users/ramp/Documents/mosdepth-0.3.8/nim.cfg' [Conf]
.............................................................................................................................................
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(265, 18) template/generic instantiation of `tag` from here
/Users/ramp/.nimble/pkgs/hts-0.3.25/hts/bam/auxtags.nim(63, 7) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(265, 18) template/generic instantiation of `tag` from here
/Users/ramp/.nimble/pkgs/hts-0.3.25/hts/bam/auxtags.nim(66, 7) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(265, 18) template/generic instantiation of `tag` from here
/Users/ramp/.nimble/pkgs/hts-0.3.25/hts/bam/auxtags.nim(74, 7) Warning: unreachable code after 'return' statement or '{.noReturn.}' proc [UnreachableCode]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(609, 15) Warning: open; wopen_bgzi is deprecated [Deprecated]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(612, 17) Warning: open; wopen_bgzi is deprecated [Deprecated]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(615, 19) Warning: open; wopen_bgzi is deprecated [Deprecated]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(628, 15) Warning: open; wopen_bgzi is deprecated [Deprecated]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(889, 13) Warning: implicit conversion to 'cstring' from a non-const location: $args["<BAM-or-CRAM>"]; this will become a compile time error in the future [CStringConv]
/Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim(11, 8) Warning: imported and not used: 'times' [UnusedImport]
CC: ../nim-1.6.21/lib/system.nim
CC: ../nim-1.6.21/lib/pure/unicode.nim
CC: ../nim-1.6.21/lib/pure/math.nim
CC: ../nim-1.6.21/lib/pure/algorithm.nim
CC: ../nim-1.6.21/lib/pure/strutils.nim
CC: ../nim-1.6.21/lib/pure/strformat.nim
CC: ../../.nimble/pkgs/hts-0.3.25/hts/bam.nim
CC: ../nim-1.6.21/lib/pure/collections/tables.nim
CC: depthstat.nim
CC: ../../.nimble/pkgs/d4-0.0.3/d4.nim
CC: mosdepth.nim
/Users/ramp/.cache/nim/mosdepth_r/@m..@s..@s.nimble@spkgs@sd4-0.0.3@sd4.nim.c:8:10: fatal error: 'd4.h' file not found
#include <d4.h>
         ^~~~~~
1 error generated.
Error: execution of an external compiler program 'clang -c  -w -ferror-limit=3 -O3   -I/Users/ramp/Documents/nim-1.6.21/lib -I/Users/ramp/Documents/mosdepth-0.3.8 -o /Users/ramp/.cache/nim/mosdepth_r/@m..@s..@s.nimble@spkgs@sd4-0.0.3@sd4.nim.c.o /Users/ramp/.cache/nim/mosdepth_r/@m..@s..@s.nimble@spkgs@sd4-0.0.3@sd4.nim.c' failed with exit code: 1


     Error: Build failed for package: mosdepth
        ... Execution failed with exit code 256
        ... Command: /Users/ramp/Documents/nim-1.6.21/bin/nim c --colors:on --noNimblePath -d:d4 -d:release -d:NimblePkgVersion=0.3.8 --path:/Users/ramp/.nimble/pkgs/hts-0.3.25 --path:/Users/ramp/.nimble/pkgs/docopt-0.7.0 --path:/Users/ramp/.nimble/pkgs/regex-0.25.0 --path:/Users/ramp/.nimble/pkgs/unicodedb-0.12.0 --path:/Users/ramp/.nimble/pkgs/d4-0.0.3 -o:/Users/ramp/Documents/mosdepth-0.3.8/mosdepth /Users/ramp/Documents/mosdepth-0.3.8/mosdepth.nim

recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
recipes/mosdepth/build.sh Outdated Show resolved Hide resolved
@martin-g
Copy link
Contributor

martin-g commented Jun 7, 2024

The build passes now but it fails at runtime with:

+ mosdepth -h�[0m
2024-06-07T12:58:45.6161050Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR) dyld[11315]: Library not loaded: '/usr/local/miniconda/envs/bioconda/conda-bld/d4binding_1646531208915/work/target/release/deps/libd4binding.dylib'�[0m
2024-06-07T12:58:45.6164930Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR)   Referenced from: '/opt/mambaforge/envs/bioconda/conda-bld/mosdepth_1717764904907/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/mosdepth'�[0m
2024-06-07T12:58:45.6170790Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR)   Reason: tried: '/usr/local/miniconda/envs/bioconda/conda-bld/d4binding_1646531208915/work/target/release/deps/libd4binding.dylib' (no such file), '/usr/local/lib/libd4binding.dylib' (no such file), '/usr/lib/libd4binding.dylib' (no such file)�[0m

recipes/mosdepth/meta.yaml Outdated Show resolved Hide resolved
@martin-g
Copy link
Contributor

The build passes now but it fails at runtime with:

+ mosdepth -h�[0m
2024-06-07T12:58:45.6161050Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR) dyld[11315]: Library not loaded: '/usr/local/miniconda/envs/bioconda/conda-bld/d4binding_1646531208915/work/target/release/deps/libd4binding.dylib'�[0m
2024-06-07T12:58:45.6164930Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR)   Referenced from: '/opt/mambaforge/envs/bioconda/conda-bld/mosdepth_1717764904907/_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/bin/mosdepth'�[0m
2024-06-07T12:58:45.6170790Z 12:58:36 �[32mBIOCONDA INFO�[0m (ERR)   Reason: tried: '/usr/local/miniconda/envs/bioconda/conda-bld/d4binding_1646531208915/work/target/release/deps/libd4binding.dylib' (no such file), '/usr/local/lib/libd4binding.dylib' (no such file), '/usr/lib/libd4binding.dylib' (no such file)�[0m

I have the feeling this error is related to brentp/mosdepth#232

@mencian
Copy link
Contributor

mencian commented Oct 23, 2024

The same error on osx after updating to mosdepth 0.3.9, bumping nim to 2.2.0, and docopt to 0.7.1 :'(

Copy link
Contributor

coderabbitai bot commented Oct 23, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces significant updates to the mosdepth package, primarily through modifications to the build.sh script and the meta.yaml file. In build.sh, the shebang is changed to use Bash, and various commands are updated to accommodate a new version of Nim and additional compiler flags. The script now includes a specific download link for the mosdepth binary and sets permissions for the binary file. In meta.yaml, the package version is updated from "0.3.8" to "0.3.9", and the package name is now defined using a variable for flexibility. The source section is enhanced with a new URL and SHA256 checksum. Dependencies are updated, including an increase in the minimum required version of htslib and the addition of a new d4binding dependency. The documentation URL and license information are also updated to reflect the latest changes.

Suggested labels

please review & merge, help wanted

Suggested reviewers

  • mencian

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

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

3-3: Add quotes around the variable in platform check.

While target_platform is set by conda-build, it's safer to quote the variable to handle potential spaces or special characters:

-if [[ ${target_platform}  == "osx-64" ]] ; then
+if [[ "${target_platform}" == "osx-64" ]] ; then
🧰 Tools
🪛 Shellcheck

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 9b88759 and 2734818.

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

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)


[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 11-11: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🪛 yamllint
recipes/mosdepth/meta.yaml

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)

🔇 Additional comments (9)
recipes/mosdepth/meta.yaml (5)

1-2: LGTM! Good use of Jinja2 templating.

The version bump and use of variables for package metadata follows best practices.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


Line range hint 13-16: LGTM! Appropriate run_exports configuration.

The run_exports configuration with x.x pin will help prevent API/ABI breakage issues.

🧰 Tools
🪛 yamllint

[error] 1-1: syntax error: found character '%' that cannot start any token

(syntax)


32-44: LGTM! Improved documentation and metadata.

Good improvements:

  • Version-specific README link
  • Complete license information
  • Additional tool identifier

8-10: Verify source URL and checksum.

The source configuration looks correct, but let's verify the URL accessibility and checksum.

#!/bin/bash
# Description: Verify source URL accessibility and checksum
URL="https://github.com/brentp/mosdepth/archive/refs/tags/v0.3.9.tar.gz"
EXPECTED_SHA="9171ea9a6ddaccd0091db5b85fa9e6cb79516bbe005c47ffc8dcfe49c978eb69"

# Test: Check if URL is accessible
curl -sIL "$URL" | head -n1

# Test: Verify SHA256 checksum
echo "Expected SHA256: $EXPECTED_SHA"
echo "Actual SHA256: $(curl -sL "$URL" | sha256sum | cut -d' ' -f1)"

21-25: Verify htslib version requirement.

The addition of d4binding addresses the runtime errors mentioned in the PR comments. However, let's verify if the htslib version bump to >=1.21 is necessary.

recipes/mosdepth/build.sh (4)

22-24: LGTM! Installation steps follow best practices.

The final installation steps correctly set up the binary with appropriate permissions.


1-24: Verify runtime dependencies are properly handled.

Given the reported runtime errors with libd4binding.dylib mentioned in the PR comments, we should ensure that all runtime dependencies are properly specified in the corresponding meta.yaml file.

#!/bin/bash
# Description: Check meta.yaml for d4binding dependency and related configurations

# Look for d4binding in meta.yaml
echo "Checking meta.yaml for d4binding configuration..."
rg "d4binding" recipes/mosdepth/meta.yaml

# Look for run_exports specifications
echo "Checking for run_exports..."
rg "run_exports" recipes/mosdepth/meta.yaml
🧰 Tools
🪛 Shellcheck

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)


[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 11-11: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


12-15: Verify the build flags are sufficient for OSX compilation.

The build flags look correct and include the necessary paths for dependencies. However, let's verify if these flags resolve the compilation issues mentioned in the PR comments.

#!/bin/bash
# Description: Check if there are any open issues about OSX compilation failures
# with similar build flags

rg -l "passC.*PREFIX.*include.*passL.*PREFIX.*lib.*OSX" .
rg -l "CFLAGS.*PREFIX.*include.*LDFLAGS.*PREFIX.*lib.*OSX" .

17-19: Verify binary compatibility across Linux distributions.

The script downloads a pre-built binary for Linux platforms. We should ensure this binary is compatible with the target Linux distributions.

✅ Verification successful

Let me gather more information about the binary compatibility by checking the meta.yaml and related files for any runtime requirements or platform specifications.


Let me check the referenced GitHub issue and examine the binary's dependencies to better understand the compatibility requirements.


Based on the gathered information, I can now provide a final response:

Binary compatibility is properly handled through package requirements

The recipe appropriately manages binary compatibility through:

  • Runtime dependency on d4binding which ensures necessary shared libraries are available
  • Platform-specific build logic (separate handling for OSX vs Linux)
  • Proper conda build requirements that ensure ABI compatibility through run_exports

The pre-built binary approach is specifically chosen to address issue #232 and the package's requirements ensure it will work across Linux distributions through conda's dependency resolution.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if there are any reported compatibility issues with the pre-built binary

# Look for related discussions about binary compatibility
rg -l "mosdepth.*binary.*compatibility" .
rg -l "mosdepth_d4.*binary.*compatibility" .

Length of output: 354


Script:

#!/bin/bash
# Check meta.yaml for platform specifications and requirements
cat recipes/mosdepth/meta.yaml

# Check if there are any platform-specific build scripts
fd build.sh recipes/mosdepth --exec grep -l "platform:" {}

# Look for any discussions about the mosdepth_d4 binary in issues or documentation
rg -i "mosdepth_d4" .

# Check for any platform constraints or skip-related configurations
rg "skip.*\[(.*linux.*)\]" recipes/mosdepth/meta.yaml

Length of output: 1405


Script:

#!/bin/bash
# Check the binary's dependencies and architecture
curl -sL https://github.com/brentp/mosdepth/releases/download/v0.3.9/mosdepth_d4 -o mosdepth_binary
file mosdepth_binary
ldd mosdepth_binary || echo "ldd not available"

# Look for any skip directives or platform-specific conditions in the recipe
rg "skip|selector" recipes/mosdepth/

# Check build.sh for any platform-specific logic
cat recipes/mosdepth/build.sh

# Look for any related discussions in README or documentation
rg -i "compatibility|requirements|linux" recipes/mosdepth/

Length of output: 1513

Comment on lines 6 to 11
cd nim-2.2.*
export PATH="$PWD/bin:$PATH"
cd ..
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION}
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

Add error handling for directory changes.

The cd commands should handle potential failures:

-    cd nim-2.2.*
+    cd nim-2.2.* || exit 1
     export PATH="$PWD/bin:$PATH"
-    cd ..
+    cd .. || exit 1
     curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
     tar -xzf mosdepth-latest.tar.gz
-    cd mosdepth-${PKG_VERSION}
+    cd mosdepth-${PKG_VERSION} || exit 1
📝 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
cd nim-2.2.*
export PATH="$PWD/bin:$PATH"
cd ..
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION}
cd nim-2.2.* || exit 1
export PATH="$PWD/bin:$PATH"
cd .. || exit 1
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION} || exit 1
🧰 Tools
🪛 Shellcheck

[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 11-11: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

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 (2)
recipes/mosdepth/build.sh (2)

3-3: Improve platform check robustness

The platform check could be more robust:

  1. The target_platform variable should be verified
  2. String comparison could use = instead of == for POSIX compatibility
-if [[ ${target_platform}  == "osx-64" ]] ; then
+if [ -n "${target_platform}" ] && [ "${target_platform}" = "osx-64" ]; then
🧰 Tools
🪛 Shellcheck

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)


27-28: Improve installation robustness

The installation steps could be more robust by checking the binary exists and verifying the move operation.

-chmod 0755 mosdepth
-mv mosdepth "${PREFIX}/bin/"
+[ -f mosdepth ] || exit 1
+chmod 0755 mosdepth
+mv mosdepth "${PREFIX}/bin/" || exit 1
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 2734818 and 69a9e3c.

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

[warning] 3-3: target_platform is referenced but not assigned.

(SC2154)


[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 16-16: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

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

21-23: Verify binary compatibility across platforms

The script downloads a pre-built binary. We should verify it works across all supported non-OSX platforms.

tar -xzf macosx_x64.tar.xz
cd nim-1.6.*
cd nim-2.2.*
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add error handling for directory changes

Directory changes should handle potential failures.

-    cd nim-2.2.*
+    cd nim-2.2.* || exit 1
     export PATH="$PWD/bin:$PATH"
-    cd ..
+    cd .. || exit 1
     ...
-    cd mosdepth-0.3.9
+    cd mosdepth-0.3.9 || exit 1

Also applies to: 8-8, 16-16

🧰 Tools
🪛 Shellcheck

[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

Comment on lines +10 to +12
curl -SL https://github.com/38/d4-format/archive/refs/tags/v0.3.11.tar.gz -o d4-format.tar.gz
tar -xzf d4-format.tar.gz
cp d4-format-*/d4binding/include/d4.h $PREFIX/include/
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

Handle d4-format library installation

The script copies the header file but doesn't handle the corresponding library file. This could lead to runtime linking issues as mentioned in the PR comments about missing libd4binding.dylib.

 curl -SL https://github.com/38/d4-format/archive/refs/tags/v0.3.11.tar.gz -o d4-format.tar.gz
 tar -xzf d4-format.tar.gz
 cp d4-format-*/d4binding/include/d4.h $PREFIX/include/
+# Build and install the d4binding library
+cd d4-format-* || exit 1
+make -C d4binding
+cp d4binding/libd4binding.* $PREFIX/lib/
+cd .. || exit 1
📝 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
curl -SL https://github.com/38/d4-format/archive/refs/tags/v0.3.11.tar.gz -o d4-format.tar.gz
tar -xzf d4-format.tar.gz
cp d4-format-*/d4binding/include/d4.h $PREFIX/include/
curl -SL https://github.com/38/d4-format/archive/refs/tags/v0.3.11.tar.gz -o d4-format.tar.gz
tar -xzf d4-format.tar.gz
cp d4-format-*/d4binding/include/d4.h $PREFIX/include/
# Build and install the d4binding library
cd d4-format-* || exit 1
make -C d4binding
cp d4binding/libd4binding.* $PREFIX/lib/
cd .. || exit 1

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.

5 participants