Adding build script for lingua-rs#8181
Conversation
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
Here are last few lines from running the build script showing it as success along with test results.
tests/python/test_builder.py ........... [ 14%] =============================================================== 74 passed in 0.34s ================================================================
[root@onprem133723021 lingua-ubi-build]# |
| set -e | ||
|
|
||
| # Variables | ||
| PKG_NAME="lingua-language-detector" |
There was a problem hiding this comment.
| PKG_NAME="lingua-language-detector" | |
| PACKAGE_NAME="lingua-language-detector" |
| PKG_NAME="lingua-language-detector" | ||
| PKG_VERSION="2.2.0" | ||
| PKG_ORG="pemistahl" | ||
| PKG_REPO="lingua-rs" |
There was a problem hiding this comment.
Lets keep the variable name as per: https://github.com/ppc64le/build-scripts/blob/master/templates/build_script_python.sh#L23
| ln -sf /usr/bin/python3.12 /usr/bin/python3 | ||
| ln -sf /usr/bin/pip-3.12 /usr/bin/pip3 | ||
| ln -sf /usr/bin/python3.12 /usr/bin/python | ||
| ln -sf /usr/bin/pip-3.12 /usr/bin/pip |
There was a problem hiding this comment.
Normalize Python commands block not required, python version will be managed GHA.
| # ------------------------------------------------------------------------------ | ||
|
|
||
| sed -i \ | ||
| "s/^version = .*/version = \"${PKG_VERSION}+${IBM_SUFFIX}\"/" \ |
There was a problem hiding this comment.
We can skip this line, as we don't apply suffix in front of version.
|
|
||
| echo "Running upstream Python tests with pytest..." | ||
| pytest tests/python | ||
| if [ $? -ne 0 ]; then |
There was a problem hiding this comment.
Take a look here, this is how we execute test cases
There was a problem hiding this comment.
Done. Modified the script according to the template.
| fi | ||
|
|
||
| echo "" | ||
| echo "SUCCESS: ${PKG_NAME} ${PKG_VERSION} built and validated" |
There was a problem hiding this comment.
Generally we don't have this kind of messages at the end.
There was a problem hiding this comment.
Done. Removed the echo statement.
| { | ||
| "maintainer": "vijay-vinnakota", | ||
| "package_name": "lingua-language-detector", | ||
| "github_url": "https://github.com/pemistahl/lingua-rs", |
There was a problem hiding this comment.
Where we not able to build pkg from lingua-py?
There was a problem hiding this comment.
From version 2 on, the repo is lingua-rs
| # ------------------------------------------------------------------------------ | ||
| echo "Building wheel using maturin..." | ||
|
|
||
| maturin build --release --strip |
There was a problem hiding this comment.
You can build the pkg using pip as well
reference here
There was a problem hiding this comment.
While pip can invoke the build, lingua-rs is a PyO3‑based Rust extension package and the build configuration explicitly uses maturin as build backend as defined in repo's pyproject.toml file.
There was a problem hiding this comment.
Please ignore my above comment. I misunderstood your comment.
I have now changed the build command to use pip per the template.
|
|
||
| WHEEL_FILE="$(ls target/wheels/${PKG_NAME//-/_}-*.whl | head -n 1)" | ||
|
|
||
| if [[ ! -f "${WHEEL_FILE}" ]]; then |
There was a problem hiding this comment.
No need to locate wheel
There was a problem hiding this comment.
The wheel check is intentional—it resolves and validates the exact wheel filename produced by maturin before installation. Since the install step depends on this variable, the check helps fail early with clearer diagnostics. Essentially, treating the generated wheel filename validated before input for the installation step.
There was a problem hiding this comment.
Please ignore my above comment. I have removed all those lines now as they are not needed in my new updated script where i am using pip and not maturin.
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
@cdeepali can you please help review this PR once as this is for a new package addition ? cc : @prachikurade1 |
|
@yussufsh PTAL |
|
@cdeepali can you please review the PR, as we want to merge PR |
| # Install dependencies (UBI 9.6 + RPM Python 3.12) | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| dnf install -y \ |
There was a problem hiding this comment.
Pls put this on a single line.
There was a problem hiding this comment.
I intentionally kept them on separate lines for readability and easier maintenance. It is quite a big list and may span across the screen on one line. Please let me know if you'd still prefer it flattened into one line.
There was a problem hiding this comment.
I Agree that it should be a multiline command for readability.
But for specific handling that is done in wrapper script in our workflow - we expect the it to be on a single line or atleast the python specific command should be together on first line, the others can be on separate lines.
Pls refer to this template for more details - https://ibm.ent.box.com/file/2211466225461?s=klya622gmi0ghvx2os8k0br8861qqwpi.
There was a problem hiding this comment.
Got it. Will make the changes.
Also, the above ibm box link says, "folder link has been removed or is unavailable to you".
| # Package : lingua-language-detector | ||
| # Version : 2.2.0 | ||
| # Source repo : https://github.com/pemistahl/lingua-rs | ||
| # Tested on : UBI 9.6 |
There was a problem hiding this comment.
| # Tested on : UBI 9.6 | |
| # Tested on : UBI:9.6 |
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
|
@cdeepali test notification |
| set -e | ||
|
|
||
| # Variables | ||
| PACKAGE_NAME="lingua-language-detector" |
There was a problem hiding this comment.
| PACKAGE_NAME="lingua-language-detector" | |
| PACKAGE_NAME="lingua-rs" |
There was a problem hiding this comment.
As we discussed in the call, I kept the name as is, but renamed the folder name. The package name will match as what is called in the upstream.
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
| "maintainer": "vijay-vinnakota", | ||
| "package_name": "lingua-language-detector", | ||
| "github_url": "https://github.com/pemistahl/lingua-rs", | ||
| "version": "2.2.0", |
There was a problem hiding this comment.
There is no 2.2.0 in the release tag yet
1.8.0 is the latest
| # Clone source (lingua-rs is Git-only;) | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| git clone "${PACKAGE_URL}" |
There was a problem hiding this comment.
You have missed to take git checkout on the PACKAGE_VERSION
please follow the template here, you can skip line 65 - 84 which is for extracting tar file
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Signed-off-by: Vijayv <vijay.vinnakota@ibm.com>
Checklist
set -eoption enabled and observe success ?