Can't build kanidmd using the Ubuntu docker builder scripts - cleanup (#2154)

This commit is contained in:
James Hodgkinson 2023-09-27 14:08:20 +10:00 committed by GitHub
parent c7a269575c
commit 034ddd624a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 28 additions and 108 deletions

View file

@ -7,10 +7,9 @@ This happens in Docker currently, and here's some instructions for doing it for
1. Start in the root directory of the repository. 1. Start in the root directory of the repository.
2. Run `./platform/debian/ubuntu_docker_builder.sh` This'll start a container, mounting the 2. Run `./platform/debian/ubuntu_docker_builder.sh` This'll start a container, mounting the
repository in `~/kanidm/`. repository in `~/kanidm/`.
3. Install the required dependencies by running `./platform/debian/install_deps.sh`. 3. Install the required dependencies by running `./scripts/install_ubuntu_dependencies.sh`.
4. Building packages uses make, get a list by running `make -f ./platform/debian/Makefile help` 4. Building packages uses make, get a list by running `make -f ./platform/debian/Makefile help`
```
➜ make -f platform/debian/Makefile help ➜ make -f platform/debian/Makefile help
debs/kanidm: debs/kanidm:
build a .deb for the Kanidm CLI build a .deb for the Kanidm CLI
@ -20,7 +19,6 @@ debs/kanidm-unixd:
build a .deb for the Kanidm UNIX tools (PAM/NSS, unixd and related tools) and SSH tools build a .deb for the Kanidm UNIX tools (PAM/NSS, unixd and related tools) and SSH tools
debs/all: debs/all:
build all the debs build all the debs
```
5. So if you wanted to build the package for the Kanidm CLI, run 5. So if you wanted to build the package for the Kanidm CLI, run
`make -f ./platform/debian/Makefile debs/kanidm`. `make -f ./platform/debian/Makefile debs/kanidm`.

View file

@ -26,11 +26,7 @@ fi
BUILD_DIR="$HOME/build" BUILD_DIR="$HOME/build"
if [ -z "${SKIP_DEPS}" ]; then if [ -z "${SKIP_DEPS}" ]; then
if [ "$(whoami)" != "root" ]; then PACKAGING=1 ./scripts/install_ubuntu_dependencies.sh
sudo ./platform/debian/install_deps.sh
else
./platform/debian/install_deps.sh
fi
else else
echo "SKIP_DEPS configured, skipping install of rust and packages" echo "SKIP_DEPS configured, skipping install of rust and packages"
fi fi

View file

@ -1,21 +0,0 @@
#!/bin/bash
# This is a hack to work around the fact that wasm-opt isn't available on
# Linux + aarch64
if [ "$(uname -m)" = "aarch64" ] && [ "$(uname -s)" = "Linux" ]; then
echo "#####################################"
echo " WASM-OPT NOT AVAILABLE"
echo ""
echo " Large WASM ahead."
echo "#####################################"
if [ "$(grep -oE 'wasm-opt.*' server/web_ui/Cargo.toml | awk '{print $NF}')" != "false" ]; then
echo "Updating server/web_ui/Cargo.toml to disable wasm-opt"
cat >> server/web_ui/Cargo.toml <<-EOM
[package.metadata.wasm-pack.profile.release]
wasm-opt = false
EOM
fi
fi

View file

@ -1,65 +0,0 @@
#!/usr/bin/env bash
set -e
echo "Updating local packages"
if [ "$(whoami)" == "root" ]; then
apt-get update
else
sudo apt-get update
fi
echo "Installing build dependencies"
if [ "$(whoami)" == "root" ]; then
apt-get install -y \
libpam0g-dev \
libudev-dev \
libssl-dev \
pkg-config \
make \
devscripts \
fakeroot \
dh-make \
debmake
else
sudo apt-get install -y \
libpam0g-dev \
libudev-dev \
libssl-dev \
pkg-config \
make \
devscripts \
fakeroot \
dh-make \
debmake
fi
if [ -f "$HOME/.cargo/env" ]; then
# shellcheck disable=SC1091
source "$HOME/.cargo/env"
fi
if [ "$(which cargo | wc -l)" -ne 1 ]; then
echo "Installing rust"
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > "$TMPDIR/rustup.sh"
chmod +x "${TMPDIR}/rustup.sh"
"${TMPDIR}/rustup.sh" -y
echo "Done installing rust!"
else
echo "rust already installed!"
fi
if [ "$1" == "kanidmd" ] && [ "$(which wasm-pack | wc -l)" -eq 0 ]; then
echo "Installing wasm-pack"
echo "Downloading script to ~/install-wasm-pack"
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf > "${HOME}/install-wasm-pack"
chmod +x "${HOME}/install-wasm-pack"
if [ "$(whoami)" == "root" ]; then
"${HOME}/install-wasm-pack"
else
sudo "${HOME}/install-wasm-pack"
fi
rm "${HOME}/install-wasm-pack"
else
echo "wasm-pack already installed"
fi

View file

@ -28,9 +28,6 @@ override_dh_autoreconf:
override_dh_auto_build: override_dh_auto_build:
KANIDM_BUILD_PROFILE=release_suse_generic dh_auto_build -- release/${PACKAGE} KANIDM_BUILD_PROFILE=release_suse_generic dh_auto_build -- release/${PACKAGE}
./platform/debian/fix_wasm_opt.sh
cargo install wasm-pack --force
cd server/web_ui && ./build_wasm.sh
override_dh_auto_test: override_dh_auto_test:
override_dh_shlibdeps: override_dh_shlibdeps:

View file

@ -10,6 +10,8 @@ fi
echo "Starting base ubuntu container" echo "Starting base ubuntu container"
echo "Repository is in ~/kanidm/" echo "Repository is in ~/kanidm/"
docker run --rm -it \ docker run --rm -it \
-e "INSTALL_RUST=1" \
-e "PACKAGING=1" \
-v "$(pwd):/root/kanidm/" \ -v "$(pwd):/root/kanidm/" \
--workdir "/root/kanidm/" \ --workdir "/root/kanidm/" \
ubuntu:latest "$@" ubuntu:latest "$@"

View file

@ -16,14 +16,27 @@ ${SUDOCMD} apt-get install -y \
pkg-config \ pkg-config \
curl \ curl \
rsync \ rsync \
build-essential git \
build-essential \
if [ "${PACKAGING}" -eq 1 ]; then
${SUDOCMD} apt-get install -y \
devscripts \
fakeroot \
dh-make \
debmake
fi
if [ "${PACKAGING}" -eq 1 ]; then
export INSTALL_RUST=1
fi
if [ -z "$(which cargo)" ]; then if [ -z "$(which cargo)" ]; then
if [ -f "$HOME/.cargo/env" ]; then if [ -f "$HOME/.cargo/env" ]; then
#shellcheck disable=SC1091 #shellcheck disable=SC1091
source "$HOME/.cargo/env" source "$HOME/.cargo/env"
elif [ "${INSTALL_RUST}" == "1" ]; then elif [ "${INSTALL_RUST}" == "1" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
#shellcheck disable=SC1091 #shellcheck disable=SC1091
source "$HOME/.cargo/env" source "$HOME/.cargo/env"
fi fi