From 890ffdf9f1265dac7d72c3144078c12dd7a9b886 Mon Sep 17 00:00:00 2001 From: Amanda Hager Lopes de Andrade Katz Date: Thu, 14 Nov 2024 17:41:13 -0300 Subject: [PATCH] not working yet --- synapse_rock/rockcraft.yaml | 52 +++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/synapse_rock/rockcraft.yaml b/synapse_rock/rockcraft.yaml index e91cfd52..f9b02b77 100644 --- a/synapse_rock/rockcraft.yaml +++ b/synapse_rock/rockcraft.yaml @@ -82,6 +82,7 @@ parts: - python3-dev - python3-pip - python3-setuptools + - python3-venv - zlib1g-dev stage-packages: - bash @@ -99,6 +100,7 @@ parts: - libwebp7 - openssl - python3 + - python3-pip - xmlsec1 stage-snaps: - aws-cli @@ -106,48 +108,76 @@ parts: plugin: nil source: https://github.com/element-hq/synapse/ source-type: git - source-tag: v1.118.0 + source-tag: v1.119.0 build-environment: - RUST_VERSION: "1.76.0" - 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 - pip3 install --root-user-action=ignore "poetry==$POETRY_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" cp pyproject.toml poetry.lock /synapse/ - /usr/local/bin/poetry export --extras all -o /synapse/requirements.txt - pip3 install --prefix="/install" --no-deps --no-warn-script-location -r /synapse/requirements.txt + 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 + ## git clone https://github.com/canonical/synapse_stats_exporter.git cd synapse_stats_exporter - pip3 install --prefix="/install" --no-warn-script-location -U . + python3 -m pip install --prefix="/install" --no-warn-script-location -U . cd .. + ## + # install synapse 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 - pip3 install --prefix="/install" --no-warn-script-location -U . + python3 -m pip install --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/ - pip3 install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; + ## + # install synapse-invite-checker + ## + python3 -m pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; git clone https://git.buechner.me/nbuechner/synapse-invite-checker cd synapse-invite-checker git checkout ab6c8b78d78c4cbf31e1a30981ae45c09285b34a - pip3 install --prefix="/install" --no-warn-script-location -U . + ## + # install synapse to /install + ## + python3 -m pip install --prefix="/install" --no-warn-script-location -U . cd .. # fix issue while creating file # https://github.com/element-hq/synapse/issues/17882 - pip3 install --prefix="/install" --force-reinstall -v "Twisted==24.7.0" + python3 -m pip install --prefix="/install" --force-reinstall -v "Twisted==24.7.0" + ## + # copy everything to craft_part_install + ## 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/local/* $CRAFT_PART_INSTALL/usr/local/ + cp -r /install/* $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/