Skip to content

Commit

Permalink
this one should work
Browse files Browse the repository at this point in the history
  • Loading branch information
amandahla committed Nov 19, 2024
1 parent a105445 commit 8a3eeba
Showing 1 changed file with 22 additions and 40 deletions.
62 changes: 22 additions & 40 deletions synapse_rock/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,70 +113,52 @@ parts:
- POETRY_VERSION: "1.7.1"
override-build: |
craftctl default
##
# install rust
##
mkdir -p /rust /cargo
export RUSTUP_HOME=/rust
export CARGO_HOME=/cargo
export PATH=/cargo/bin:/rust/bin:$PATH
export CARGO_NET_GIT_FETCH_WITH_CLI=false
mkdir -p /rust /cargo /synapse /install
curl -m 30 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --default-toolchain=$RUST_VERSION --profile minimal
/rust/toolchains/$RUST_VERSION-x86_64-unknown-linux-gnu/bin/rustc -V > $CRAFT_PART_INSTALL/rust-version
##
#
# install synapse requirements
##
mkdir -p /synapse /install
cp -pr /usr/lib/python3.12/ensurepip ${CRAFT_PART_INSTALL}/usr/lib/python3.12/
python3 -m venv synapse-env
source synapse-env/bin/activate
pip3 install "poetry==$POETRY_VERSION"
pip3 install --break-system-packages --root-user-action=ignore "poetry==$POETRY_VERSION"
cp pyproject.toml poetry.lock /synapse/
poetry export --extras all -o /synapse/requirements.txt
python3 -m pip install --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt
##
# install synapse_stats_exporter
##
$CRAFT_PART_INSTALL/usr/local/bin/poetry export --extras all -o /synapse/requirements.txt
pip3 install --break-system-packages --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt
#
# install synapse stats exporter
git clone https://github.com/canonical/synapse_stats_exporter.git
cd synapse_stats_exporter
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
pip3 install --break-system-packages --prefix="/install" --no-warn-script-location -U .
cd ..
##
# install synapse s3 storage provider
##
#
# install s3 storage provider
git clone --branch v1.4.0 --depth 1 https://github.com/matrix-org/synapse-s3-storage-provider
cd synapse-s3-storage-provider
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
pip3 install --break-system-packages --prefix="/install" --no-warn-script-location -U .
cd ..
##
# copy files to /synapse/
##
cp -r synapse /synapse/
cp -r rust /synapse/
cp pyproject.toml README.rst build_rust.py Cargo.toml Cargo.lock /synapse/
##
# install synapse-invite-checker
##
python3 -m pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all];
#
# install synapse invite checker
git clone https://git.buechner.me/nbuechner/synapse-invite-checker
cd synapse-invite-checker
git checkout ab6c8b78d78c4cbf31e1a30981ae45c09285b34a
##
# install synapse to /install
##
python3 -m pip install --prefix="/install" --no-warn-script-location -U .
pip3 install --break-system-packages --prefix="/install" --no-warn-script-location -U .
cd ..
#
# install synapse
cp -r synapse /synapse/
cp -r rust /synapse/
cp pyproject.toml README.rst build_rust.py Cargo.toml Cargo.lock /synapse/
pip3 install --break-system-packages --prefix="/install" --no-deps --no-warn-script-location /synapse[all];
# fix issue while creating file
# https://github.com/element-hq/synapse/issues/17882
python3 -m pip install --prefix="/install" --force-reinstall -v "Twisted==24.7.0"
##
# copy everything to craft_part_install
##
pip3 install --break-system-packages --prefix="/install" --force-reinstall -v "Twisted==24.7.0"
cp docker/start.py $CRAFT_PART_INSTALL/
chmod 755 $CRAFT_PART_INSTALL/start.py
cp -r docker/conf $CRAFT_PART_INSTALL/
cp -r /usr/local $CRAFT_PART_INSTALL/usr/
cp -r /install/* $CRAFT_PART_INSTALL/usr/local/
cp -r /install/local/* $CRAFT_PART_INSTALL/usr/local/
mkdir -p $CRAFT_PART_INSTALL/usr/local/attributemaps
chmod 755 $CRAFT_PART_INSTALL/usr/local/attributemaps
rm -rf $CRAFT_PART_INSTALL/aws/dist/awscli/examples/
Expand Down

0 comments on commit 8a3eeba

Please sign in to comment.