forked from opendatahub-io/notebooks
-
Notifications
You must be signed in to change notification settings - Fork 19
RHOAIENG-28547: add TeX Live and Pandoc installation for ppc64le #1318
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
Open
puneetsharma21
wants to merge
6
commits into
red-hat-data-services:rhoai-2.23-multi-arch-poc
Choose a base branch
from
odh-on-pz:jupyter-minimal-ppc64le-support
base: rhoai-2.23-multi-arch-poc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0074e35
Fix TeX Live and Pandoc for multi-arch support
puneetsharma21 9522ef1
Add CentOS Stream and EPEL repos to install missing TeX Live deps on …
puneetsharma21 7a6abc7
Disable temporary CentOS Stream repos after installing TeX Live depen…
puneetsharma21 240aa79
update user config to avoid 403 error from Hackage during cabal update
puneetsharma21 d031ee5
Replace CentOS repo-based installs with direct RPM installation for U…
puneetsharma21 3c790ad
Replace CentOS repo-based installs with direct RPM installation
puneetsharma21 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# Mapping of `uname -m` values to equivalent GOARCH values | ||
declare -A UNAME_TO_GOARCH | ||
UNAME_TO_GOARCH["x86_64"]="amd64" | ||
UNAME_TO_GOARCH["aarch64"]="arm64" | ||
UNAME_TO_GOARCH["ppc64le"]="ppc64le" | ||
UNAME_TO_GOARCH["s390x"]="s390x" | ||
|
||
ARCH="${UNAME_TO_GOARCH[$(uname -m)]}" | ||
|
||
if [[ "$ARCH" == "ppc64le" ]]; then | ||
# Install Pandoc from source | ||
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm | ||
dnf install -y cabal-install ghc gmp-devel | ||
|
||
# Set version | ||
PANDOC_VERSION=3.7.0.2 | ||
|
||
cd /tmp | ||
git clone --recurse-submodules https://github.com/jgm/pandoc.git | ||
cd pandoc | ||
git checkout ${PANDOC_VERSION} | ||
git submodule update --init --recursive | ||
|
||
export HOME=/root | ||
# Initialize cabal user config (don't fail if already done) | ||
cabal user-config init || true | ||
|
||
# Modify config | ||
echo "repository hackage.haskell.org | ||
url: https://hackage.haskell.org/ | ||
secure: False" >> $HOME/.cabal/config | ||
|
||
cabal update | ||
cd pandoc-cli | ||
cabal build -j"$(nproc)" | ||
mkdir -p /usr/local/pandoc/bin | ||
cabal install \ | ||
--installdir=/usr/local/pandoc/bin \ | ||
--overwrite-policy=always \ | ||
--install-method=copy | ||
|
||
# Clean up Haskell build system | ||
rm -rf ~/.cabal ~/.ghc /tmp/pandoc | ||
dnf remove -y cabal-install ghc gmp-devel | ||
dnf clean all && rm -rf /var/cache/dnf | ||
|
||
/usr/local/pandoc/bin/pandoc --version | ||
|
||
elif [[ "$ARCH" == "amd64" ]]; then | ||
# pandoc installation | ||
curl -fL "https://github.com/jgm/pandoc/releases/download/3.7.0.2/pandoc-3.7.0.2-linux-${ARCH}.tar.gz" -o /tmp/pandoc.tar.gz | ||
mkdir -p /usr/local/pandoc | ||
tar xvzf /tmp/pandoc.tar.gz --strip-components 1 -C /usr/local/pandoc/ | ||
rm -f /tmp/pandoc.tar.gz | ||
|
||
else | ||
echo "Unsupported architecture: $ARCH" >&2 | ||
exit 1 | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#!/bin/bash | ||
set -euxo pipefail | ||
|
||
# Mapping of `uname -m` values to equivalent GOARCH values | ||
declare -A UNAME_TO_GOARCH | ||
UNAME_TO_GOARCH["x86_64"]="amd64" | ||
UNAME_TO_GOARCH["aarch64"]="arm64" | ||
UNAME_TO_GOARCH["ppc64le"]="ppc64le" | ||
UNAME_TO_GOARCH["s390x"]="s390x" | ||
|
||
ARCH="${UNAME_TO_GOARCH[$(uname -m)]}" | ||
|
||
if [[ "$ARCH" == "ppc64le" ]]; then | ||
echo "Installing TeX Live from source for $ARCH..." | ||
|
||
# Install build dependencies | ||
dnf install -y gcc-toolset-13 perl make libX11-devel \ | ||
zlib-devel freetype-devel libpng-devel ncurses-devel \ | ||
gd-devel libtool wget tar xz | ||
|
||
rpm -q libXmu-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXmu-devel-1.1.3-8.el9.ppc64le.rpm | ||
rpm -q libXext-devel|| rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXext-devel-1.3.4-8.el9.ppc64le.rpm | ||
rpm -q libICE-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libICE-devel-1.0.10-8.el9.ppc64le.rpm | ||
rpm -q libSM-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libSM-devel-1.2.3-10.el9.ppc64le.rpm | ||
rpm -q libXmu || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXmu-1.1.3-8.el9.ppc64le.rpm | ||
rpm -q libXaw-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXaw-devel-1.0.13-19.el9.ppc64le.rpm | ||
rpm -q libXaw || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXaw-1.0.13-19.el9.ppc64le.rpm | ||
rpm -q libXt-devel || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/libXt-devel-1.2.0-6.el9.ppc64le.rpm | ||
rpm -q flex || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/flex-2.6.4-9.el9.ppc64le.rpm | ||
rpm -q bison || rpm -ivh --nodeps https://mirror.stream.centos.org/9-stream/AppStream/ppc64le/os/Packages/bison-3.7.4-5.el9.ppc64le.rpm | ||
|
||
# Step 1: Download and extract the TeX Live source | ||
wget https://ftp.math.utah.edu/pub/tex/historic/systems/texlive/2025/texlive-20250308-source.tar.xz | ||
tar -xf texlive-20250308-source.tar.xz | ||
cd texlive-20250308-source | ||
|
||
# Enable newer GCC toolchain | ||
source /opt/rh/gcc-toolset-13/enable | ||
|
||
# Create build directory and build | ||
mkdir -p ../texlive-build | ||
cd ../texlive-build | ||
../texlive-20250308-source/configure --prefix=/usr/local/texlive | ||
make -j"$(nproc)" | ||
make install | ||
|
||
# Symlink for pdflatex | ||
ln -sf pdftex /usr/local/texlive/bin/powerpc64le-unknown-linux-gnu/pdflatex | ||
|
||
# Cleanup sources to reduce image size | ||
rm -rf /texlive-20250308-source /texlive-build | ||
|
||
# Step 2: Run TeX Live installer for runtime tree setup | ||
cd / | ||
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | ||
tar -xzf install-tl-unx.tar.gz | ||
cd install-tl-2*/ | ||
|
||
# Create a custom install profile | ||
TEXLIVE_INSTALL_PREFIX="/usr/local/texlive" | ||
cat <<EOF > texlive.profile | ||
selected_scheme scheme-small | ||
TEXDIR $TEXLIVE_INSTALL_PREFIX | ||
TEXMFCONFIG ~/.texlive2025/texmf-config | ||
TEXMFVAR ~/.texlive2025/texmf-var | ||
option_doc 0 | ||
option_src 0 | ||
EOF | ||
|
||
./install-tl --profile=texlive.profile --custom-bin=$TEXLIVE_INSTALL_PREFIX/bin/powerpc64le-unknown-linux-gnu | ||
|
||
# TeX Live binary directory | ||
TEX_BIN_DIR="/usr/local/texlive/bin/powerpc64le-unknown-linux-gnu" | ||
|
||
# Create standard symlink 'linux' → arch-specific folder | ||
ln -sf "$TEX_BIN_DIR" /usr/local/texlive/bin/linux | ||
|
||
|
||
# Set up environment | ||
export PATH="$TEXLIVE_INSTALL_PREFIX/bin/linux:$PATH" | ||
pdflatex --version | ||
tlmgr --version | ||
|
||
elif [[ "$ARCH" == "amd64" ]]; then | ||
# tex live installation | ||
echo "Installing TexLive to allow PDf export from Notebooks" | ||
curl -fL https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz -o install-tl-unx.tar.gz | ||
zcat < install-tl-unx.tar.gz | tar xf - | ||
cd install-tl-2* | ||
perl ./install-tl --no-interaction --scheme=scheme-small --texdir=/usr/local/texlive | ||
mv /usr/local/texlive/bin/"$(uname -m)-linux" /usr/local/texlive/bin/linux | ||
cd /usr/local/texlive/bin/linux | ||
./tlmgr install tcolorbox pdfcol adjustbox titling enumitem soul ucs collection-fontsrecommended | ||
|
||
else | ||
echo "Unsupported architecture: $ARCH" >&2 | ||
exit 1 | ||
|
||
fi | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UBI and CentOS may not be mixed in anything that Red Hat does, that's against Red Hat policy.