diff --git a/d/ddtrace/LICENSE b/d/ddtrace/LICENSE new file mode 100644 index 0000000000..9c8f3ea087 --- /dev/null +++ b/d/ddtrace/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. \ No newline at end of file diff --git a/d/ddtrace/build_info.json b/d/ddtrace/build_info.json new file mode 100644 index 0000000000..c37a945281 --- /dev/null +++ b/d/ddtrace/build_info.json @@ -0,0 +1,22 @@ +{ + "maintainer": "vikashsingh14", + "package_name": "ddtrace", + "github_url": "https://github.com/DataDog/dd-trace-py", + "version": "4.3.0", + "default_branch": "main", + + "build_script": "ddtrace_4.3.0_ubi_9_minimal.sh", + "package_dir": "d/ddtrace/", + "validate_build_script": true, + "use_non_root_user": false, + "docker_build": false, + "wheel_build": true, + + "4.3.*": { + "build_script": "ddtrace_4.3.0_ubi_9_minimal.sh", + "patches": { + "DDTRACE_PATCH": "https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/ddtrace_4.3.0.patch", + "LIBDATADOG_CRASHTRACKER_PATCH": "https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch" + } + } +} \ No newline at end of file diff --git a/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh b/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh new file mode 100644 index 0000000000..5b43e27e78 --- /dev/null +++ b/d/ddtrace/ddtrace_4.3.0_ubi_9_minimal.sh @@ -0,0 +1,157 @@ +#!/bin/bash -e +# ---------------------------------------------------------------------------- +# +# Package : ddtrace +# Version : 4.3.0 +# Source repo : https://github.com/DataDog/dd-trace-py +# Tested on : UBI:9.3 +# Language : Python,Rust +# Ci-Check : True +# Script License : Apache License, Version 2 or later +# Maintainer : Vikash Kumar Singh +# +# Disclaimer: This script has been tested in root mode on given +# ========== platform using the mentioned version of the package. +# It may not work as expected with newer versions of the +# package and/or distribution. In such case, please +# contact "Maintainer" of this script. +# +# ---------------------------------------------------------------------------- + +PACKAGE_NAME=ddtrace +PACKAGE_URL=https://github.com/DataDog/dd-trace-py.git +PACKAGE_VERSION=${1:-v4.3.0} + +# libdatadog version to vendor crashtracker from +LIBDATADOG_VERSION=${LIBDATADOG_VERSION:-v25.0.0} + +# Patches hosted in build-scripts (Agent-style: fetch via wget then git apply) +DDTRACE_PATCH_URL=${DDTRACE_PATCH_URL:-https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/ddtrace_4.3.0.patch} +LIBDD_PATCH_URL=${LIBDD_PATCH_URL:-https://raw.githubusercontent.com/ppc64le/build-scripts/master/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch} + +# Build toggles (keep crashtracker off at runtime for smoke test) +export DD_USE_SYSTEM_LIBDATADOG=${DD_USE_SYSTEM_LIBDATADOG:-1} +export DD_NO_CRASHTRACKER=${DD_NO_CRASHTRACKER:-1} + +# ---------------------------------------------------------------------------- +# Install required dependencies +# ---------------------------------------------------------------------------- +yum install -y wget git python3 python3-devel openssl openssl-devel make gcc gcc-c++ diffutils cmake patch rust cargo findutils libffi-devel elfutils-libelf-devel + +# Ensure pip/setuptools/wheel and build deps required by ddtrace build system +# NOTE: ddtrace build docs require cmake >=3.24.2,<3.28 for source builds. +python3 -m pip install --upgrade pip setuptools wheel +python3 -m pip install "cmake>=3.24.2,<3.28" cython "setuptools-rust<2" "setuptools_scm[toml]>=4" pytest twine || true + +# ---------------------------------------------------------------------------- +# Clone ddtrace and checkout version +# ---------------------------------------------------------------------------- +git clone "${PACKAGE_URL}" +cd "${PACKAGE_NAME}" +git checkout "${PACKAGE_VERSION}" + +# Apply ddtrace patch (if available) +wget -O ddtrace.patch "${DDTRACE_PATCH_URL}" || true +if [ -s ddtrace.patch ]; then + git apply --ignore-whitespace ddtrace.patch || true +fi + +# ---------------------------------------------------------------------------- +# Build libdatadog (crashtracker) and stage static archive into ddtrace +# ---------------------------------------------------------------------------- +TMPDIR="$(mktemp -d)" +pushd "${TMPDIR}" >/dev/null + git clone --depth=1 --branch "${LIBDATADOG_VERSION}" https://github.com/DataDog/libdatadog.git + cd libdatadog + + # Apply libdatadog crashtracker patch (if available) + wget -O libdd.patch "${LIBDD_PATCH_URL}" || true + if [ -s libdd.patch ]; then + git apply --ignore-whitespace libdd.patch || true + fi + + # Pin libc crate as per working flow + cargo update -p libc --precise 0.2.178 + + # Build crashtracker staticlib + cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker + + # Locate produced static archive (hashed or plain) + CRASH_A="$(find target -type f -name 'liblibdd_crashtracker*.a' | head -n1 || true)" + if [ -z "${CRASH_A}" ] || [ ! -f "${CRASH_A}" ]; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails (crashtracker .a not found)" + exit 1 + fi +popd >/dev/null + +# Stage the crashtracker archive into ddtrace src/native/ +mkdir -p src/native +cp -f "${TMPDIR}/${CRASH_A}" src/native/liblibdd_crashtracker.a + +# ---------------------------------------------------------------------------- +# Build ddtrace native extension (Rust) and make it visible to CMake +# ---------------------------------------------------------------------------- +pushd src/native >/dev/null + cargo build --release --features "pyo3/extension-module profiling" + + # Discover produced .so (support hashed filenames in target tree) + SRC_SO="$(find target ../target -type f \( -name 'libddtrace*_native*.so' -o -name 'lib_native*.so' \) 2>/dev/null | head -n1 || true)" + if [ -z "${SRC_SO}" ] || [ ! -f "${SRC_SO}" ]; then + SRC_SO="$(find "${CARGO_TARGET_DIR:-.}" -type f \( -name 'libddtrace*_native*.so' -o -name 'lib_native*.so' \) 2>/dev/null | head -n1 || true)" + fi +popd >/dev/null + +if [ -z "${SRC_SO}" ] || [ ! -f "${SRC_SO}" ]; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails (native .so not found)" + exit 1 +fi + +# Place .so where CMake's dd_wrapper expects it: build/lib./.../_native.*.so +PLAT="$(python3 - <<'PY' +from pkg_resources import get_build_platform +print(get_build_platform()) +PY +)" +SOABI="$(python3 - <<'PY' +import sysconfig, sys +print(sysconfig.get_config_var('SOABI') or f"cpython-{sys.version_info.major}{sys.version_info.minor}-{sys.platform}") +PY +)" +BUILD_LIB_DIR="build/lib.${PLAT}/ddtrace/internal/native" +mkdir -p "${BUILD_LIB_DIR}" +cp -f "${SRC_SO}" "${BUILD_LIB_DIR}/_native.${SOABI}.so" + +# ---------------------------------------------------------------------------- +# Build Wheel (Agent-style: setup.py bdist_wheel, no build isolation) +# ---------------------------------------------------------------------------- +if ! python3 setup.py bdist_wheel --dist-dir="$(pwd)"; then + echo "------------------$PACKAGE_NAME:build_fails-------------------------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Build_Fails" + exit 1 +fi + +# Optional checksum (not required but helpful) +sha256sum ddtrace-*.whl > SHA256SUMS 2>/dev/null || true + +# ---------------------------------------------------------------------------- +# Install wheel and run upstream smoke test (tests/smoke_test.py) via pytest +# ---------------------------------------------------------------------------- +python3 -m pip install --force-reinstall ./ddtrace-*.whl + +# Run only the upstream smoke test to validate install/runtime +if ! python3 -m pytest -q tests/smoke_test.py; then + echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------" + echo "$PACKAGE_VERSION $PACKAGE_NAME" + echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Test_Fails" + exit 2 +fi + +echo "------------------$PACKAGE_NAME:install_and_test_success-------------------------" +echo "$PACKAGE_VERSION $PACKAGE_NAME" +echo "$PACKAGE_NAME | $PACKAGE_VERSION | $OS_NAME | GitHub | Pass | Install_and_Test_Success" +exit 0 \ No newline at end of file diff --git a/d/ddtrace/patches/ddtrace_4.3.0.patch b/d/ddtrace/patches/ddtrace_4.3.0.patch new file mode 100644 index 0000000000..c8fe8326b0 --- /dev/null +++ b/d/ddtrace/patches/ddtrace_4.3.0.patch @@ -0,0 +1,28 @@ +diff --git a/setup.py b/setup.py +index bf40f1f988..e5acabeaaf 100644 +--- a/setup.py ++++ b/setup.py +@@ -268,9 +268,11 @@ def is_64_bit_python(): + + rust_features = [] + if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): +- rust_features.append("crashtracker") ++ rust_features.append("pyo3/extension-module") + rust_features.append("profiling") + ++ if platform.machine() not in ("ppc64le", "ppc64"): ++ rust_features.append("crashtracker") + + class PatchedDistribution(Distribution): + def __init__(self, attrs=None): +@@ -616,8 +618,8 @@ class CustomBuildExt(build_ext): + def run(self): + self.build_rust() + +- # Build libdd_wrapper before building other extensions that depend on it +- if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): ++ # Build libdd_wrapper only when profiling is enabled ++ if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python() and "profiling" in rust_features: + self.build_libdd_wrapper() + + super().run() diff --git a/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch b/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch new file mode 100644 index 0000000000..c879ba03c9 --- /dev/null +++ b/d/ddtrace/patches/libdatadog-crashtracker_25.0.0.patch @@ -0,0 +1,18 @@ +diff --git a/libdd-crashtracker/src/collector/emitters.rs b/libdd-crashtracker/src/collector/emitters.rs +index f609c9f9..cbbdd56a 100644 +--- a/libdd-crashtracker/src/collector/emitters.rs ++++ b/libdd-crashtracker/src/collector/emitters.rs +@@ -384,6 +384,13 @@ fn extract_ip(ucontext: *const ucontext_t) -> usize { + return (*ucontext).uc_mcontext.gregs[libc::REG_RIP as usize] as usize; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return (*ucontext).uc_mcontext.pc as usize; ++ ++ #[cfg(all(target_os = "linux", any(target_arch = "powerpc64", target_arch = "powerpc64le")))] ++ return unsafe { ++ let regs = (*ucontext).uc_mcontext.regs as *const u64; ++ *regs.add(32) ++ } as usize; ++ + } + } + diff --git a/o/openwebui-pipelines/LICENSE b/o/openwebui-pipelines/LICENSE new file mode 100644 index 0000000000..9c8f3ea087 --- /dev/null +++ b/o/openwebui-pipelines/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed 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. \ No newline at end of file diff --git a/o/openwebui-pipelines/build_info.json b/o/openwebui-pipelines/build_info.json new file mode 100644 index 0000000000..a2abdf9d8e --- /dev/null +++ b/o/openwebui-pipelines/build_info.json @@ -0,0 +1,19 @@ +{ + "maintainer": "vikashsingh14", + "package_name": "openwebui-pipelines", + "github_url": "https://github.com/open-webui/pipelines", + "version": "0.0.1", + "default_branch": "main", + "build_script": "", + "package_dir": "o/openwebui-pipelines", + "docker_cmd": "docker build -t ${package_name}:${PACKAGE_VERSION} ${dir}", + "validate_build_script": false, + "wheel_build": false, + "docker_build": true, + "use_non_root_user": false, + "*": { + "dir": "0.0.1_ubi9_minimal", + "base_docker_image":"registry.access.redhat.com/ubi9/ubi-minimal:latest", + "base_docker_variant": "redhat" + } +} \ No newline at end of file diff --git a/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile new file mode 100644 index 0000000000..71cb1d02cd --- /dev/null +++ b/o/openwebui-pipelines/dockerfiles/0.0.1_ubi9_minimal/Dockerfile @@ -0,0 +1,178 @@ +# --- STAGE 1: ddtrace Native Builder --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS ddtrace-native-builder + +LABEL name="open-webui-pipelines" maintainer="Vikash.Singh14@ibm.com" + +USER root + +ENV PATH="/root/.cargo/bin:${PATH}" \ + CC=clang \ + PIP_NO_CACHE_DIR=1 + +RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf update -y && \ + microdnf install -y \ + --enablerepo=ubi-9-baseos-rpms \ + --enablerepo=ubi-9-appstream-rpms \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + python3-setuptools \ + python3.11-wheel \ + gcc gcc-c++ make git pkg-config \ + libffi-devel openssl-devel \ + clang clang-libs llvm llvm-devel \ + cmake \ + findutils \ + wget \ + ca-certificates && \ + microdnf clean all && rm -rf /var/cache/* && \ + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \ + python3.11 -m pip install --no-cache-dir \ + cmake \ + cython \ + setuptools-rust \ + "setuptools_scm[toml]>=4" \ + patchelf \ + semantic_version \ + build && \ + mkdir -p /patches && \ + wget -q -O /patches/libdatadog-crashtracker_25.0.0.patch \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch && \ + wget -q -O /patches/ddtrace_4.3.0.patch \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch + +WORKDIR /app + +# --- Build libdatadog and ddtrace --- +RUN git clone --depth=1 --branch v25.0.0 https://github.com/DataDog/libdatadog.git /tmp/libdatadog && \ + cd /tmp/libdatadog && \ + git apply /patches/libdatadog-crashtracker_25.0.0.patch && \ + cargo update -p libc --precise 0.2.178 && \ + cargo rustc --lib --release --crate-type staticlib -p libdd-crashtracker && \ + \ + git clone --depth=1 --branch v4.3.0 https://github.com/DataDog/dd-trace-py.git /tmp/ddtrace && \ + cd /tmp/ddtrace && \ + git apply /patches/ddtrace_4.3.0.patch && \ + cp /tmp/libdatadog/target/release/liblibdd_crashtracker.a src/native/ && \ + cd src/native && \ + cargo build --release --features "pyo3/extension-module profiling" && \ + \ + mkdir -p /artifacts/ddtrace && \ + mkdir -p /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native && \ + cp target/release/lib_native.so \ + /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so && \ + \ + cd /tmp/ddtrace && \ + DD_USE_SYSTEM_LIBDATADOG=1 DD_NO_CRASHTRACKER=1 \ + python3.11 setup.py bdist_wheel --dist-dir=/artifacts/ddtrace && \ + rm -rf /tmp/* /root/.cargo /root/.rustup + +# --- STAGE 2: Pipelines Python Builder --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS pipelines-python-builder + +USER root + +ENV PIP_NO_CACHE_DIR=1 \ + PIP_DISABLE_PIP_VERSION_CHECK=1 \ + PIP_NO_BUILD_ISOLATION=1 \ + PATH="/opt/venv/bin:${PATH}" + +WORKDIR /app + +RUN rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf update -y --nobest && \ + microdnf install -y \ + --enablerepo=ubi-9-baseos-rpms \ + --enablerepo=ubi-9-appstream-rpms \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + python3.11-wheel \ + python3-setuptools \ + gcc gcc-c++ make git pkg-config \ + libffi-devel \ + openssl-devel \ + ca-certificates \ + cmake \ + findutils \ + wget \ + curl-minimal && \ + microdnf clean all && rm -rf /var/cache/* && \ + python3.11 -m venv /opt/venv && \ + /opt/venv/bin/pip install --no-cache-dir --upgrade pip && \ + mkdir -p /patches && \ + wget -q -O /patches/openwebui-pipelines-requirements-0.0.1.patch \ + https://raw.githubusercontent.com/ppc64le/build-scripts/master/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch + +COPY --from=ddtrace-native-builder /artifacts/ddtrace/*.whl /tmp/ +COPY --from=ddtrace-native-builder \ + /usr/local/lib64/python3.11/site-packages/ddtrace/internal/native/_native.cpython-311-powerpc64le-linux-gnu.so \ + /opt/venv/lib/python3.11/site-packages/ddtrace/internal/native/ + +RUN /opt/venv/bin/pip install /tmp/ddtrace-*.whl && \ + rm -rf /tmp/* && \ + git clone --depth=1 https://github.com/open-webui/pipelines.git . && \ + git apply /patches/requirements.patch && \ + /opt/venv/bin/pip install \ + --no-cache-dir \ + --prefer-binary \ + --only-binary=all \ + --index-url https://pypi.org/simple \ + --extra-index-url https://wheels.developerfirst.ibm.com/ppc64le/linux \ + "grpcio==1.71.0" \ + "opencv-python==4.10.0.84" \ + -r requirements.txt && \ + rm -rf ~/.cache .git + +# Cleanup like Milvus +RUN find /opt/venv -name '__pycache__' -type d -prune -exec rm -rf {} + && \ + find /opt/venv -type f -name '*.a' -delete && \ + find /opt/venv -type d \( -name 'doc' -o -name 'docs' -o -name 'tests' -o -name '*.egg-info' \) \ + -exec rm -rf {} + 2>/dev/null || true + +# --- STAGE 3: Runtime --- +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest AS pipelines-runtime + +USER root +WORKDIR /app + +ENV ENV=prod \ + PORT=9099 \ + HOST=0.0.0.0 \ + DD_AGENT_HOST=host.dockerinternal \ + DD_TRACE_AGENT_PORT=8126 \ + DD_PROFILING_ENABLED=true \ + PYTHONPATH=/app \ + PATH="/opt/venv/bin:${PATH}" \ + LD_LIBRARY_PATH="/opt/venv/lib:/usr/lib" + +RUN mkdir -p /etc/yum.repos.d && \ + rpm -e --nodeps openssl-fips-provider openssl-fips-provider-so || true && \ + microdnf --disableplugin=subscription-manager update -y && \ + microdnf --disableplugin=subscription-manager install -y \ + bash \ + gcc \ + gcc-c++ \ + make \ + cmake \ + pkg-config \ + libffi \ + openssl \ + findutils \ + python3.11 \ + python3.11-pip \ + python3.11-devel \ + ca-certificates && \ + microdnf clean all && rm -rf /var/cache/* + +COPY --from=pipelines-python-builder /app /app +COPY --from=pipelines-python-builder /opt/venv /opt/venv + +RUN mkdir -p /.cache /.local && \ + chgrp -R 0 /app /.cache /.local /opt/venv 2>/dev/null || true && \ + chmod -R g+rwX /app /.cache /.local /opt/venv 2>/dev/null || true && \ + find /app /opt/venv -type d -exec chmod g+s {} + 2>/dev/null || true + +EXPOSE ${PORT} +ENTRYPOINT ["bash", "start.sh"] diff --git a/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch b/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch new file mode 100644 index 0000000000..c8fe8326b0 --- /dev/null +++ b/o/openwebui-pipelines/patches/ddtrace_4.3.0.patch @@ -0,0 +1,28 @@ +diff --git a/setup.py b/setup.py +index bf40f1f988..e5acabeaaf 100644 +--- a/setup.py ++++ b/setup.py +@@ -268,9 +268,11 @@ def is_64_bit_python(): + + rust_features = [] + if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): +- rust_features.append("crashtracker") ++ rust_features.append("pyo3/extension-module") + rust_features.append("profiling") + ++ if platform.machine() not in ("ppc64le", "ppc64"): ++ rust_features.append("crashtracker") + + class PatchedDistribution(Distribution): + def __init__(self, attrs=None): +@@ -616,8 +618,8 @@ class CustomBuildExt(build_ext): + def run(self): + self.build_rust() + +- # Build libdd_wrapper before building other extensions that depend on it +- if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python(): ++ # Build libdd_wrapper only when profiling is enabled ++ if CURRENT_OS in ("Linux", "Darwin") and is_64_bit_python() and "profiling" in rust_features: + self.build_libdd_wrapper() + + super().run() diff --git a/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch b/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch new file mode 100644 index 0000000000..c879ba03c9 --- /dev/null +++ b/o/openwebui-pipelines/patches/libdatadog-crashtracker_25.0.0.patch @@ -0,0 +1,18 @@ +diff --git a/libdd-crashtracker/src/collector/emitters.rs b/libdd-crashtracker/src/collector/emitters.rs +index f609c9f9..cbbdd56a 100644 +--- a/libdd-crashtracker/src/collector/emitters.rs ++++ b/libdd-crashtracker/src/collector/emitters.rs +@@ -384,6 +384,13 @@ fn extract_ip(ucontext: *const ucontext_t) -> usize { + return (*ucontext).uc_mcontext.gregs[libc::REG_RIP as usize] as usize; + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + return (*ucontext).uc_mcontext.pc as usize; ++ ++ #[cfg(all(target_os = "linux", any(target_arch = "powerpc64", target_arch = "powerpc64le")))] ++ return unsafe { ++ let regs = (*ucontext).uc_mcontext.regs as *const u64; ++ *regs.add(32) ++ } as usize; ++ + } + } + diff --git a/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch b/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch new file mode 100644 index 0000000000..7d2e64e202 --- /dev/null +++ b/o/openwebui-pipelines/patches/openwebui-pipelines-requirements-0.0.1.patch @@ -0,0 +1,38 @@ +--- ../patches/requirements.orig 2026-02-17 07:16:01.471242478 -0500 ++++ requirements.txt 2026-02-17 07:16:01.481242477 -0500 +@@ -1,6 +1,5 @@ + fastapi==0.111.0 + uvicorn[standard]==0.22.0 +-pydantic==2.7.1 + python-multipart==0.0.9 + python-socketio + grpcio +@@ -17,7 +16,6 @@ + openai + anthropic + google-generativeai +-vertexai + + # Database + pymongo +@@ -31,7 +29,6 @@ + + # Observability + langfuse +-ddtrace + opik + + # ML libraries +@@ -58,10 +55,7 @@ + seaborn + + # Web scraping +-selenium +-playwright +-beautifulsoup4 + + # Llama Index for RAG + llama-index +-llama-index-llms-ollama +\ No newline at end of file ++llama-index-llms-ollama