From 520acf93835bf07cc70113fc8bb7e46c65b3613d Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Wed, 27 Apr 2022 11:59:55 -0400 Subject: [PATCH] Split Debian control files by architecture --- Dockerfile | 30 +++++++++------ Dockerfile.debian | 5 +-- Dockerfile.debian.dockerignore | 2 +- Dockerfile.dist | 11 ++++-- Dockerfile.dist.dockerignore | 1 + Dockerfile.dockerignore | 1 + Dockerfile.sample | 12 ++++-- Dockerfile.sample.dockerignore | 1 + debian/{control.in => control.in.amd64} | 4 +- debian/control.in.arm64 | 9 +++++ debian/control.in.armv7 | 9 +++++ install.sh | 2 +- mimic3-tts/mimic3_tts/voices.json | 50 +++++++++++++++++++++++++ 13 files changed, 111 insertions(+), 26 deletions(-) rename debian/{control.in => control.in.amd64} (71%) create mode 100644 debian/control.in.arm64 create mode 100644 debian/control.in.armv7 diff --git a/Dockerfile b/Dockerfile index f03a0af..46dc5bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,12 +31,16 @@ ENV DEBIAN_FRONTEND=noninteractive RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache +COPY debian/control.in.* ./debian/ + +# Use dependencies from Debian package control file RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \ - mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ - apt-get update && \ - apt-get install --yes --no-install-recommends \ - python3 python3-pip python3-venv \ - build-essential python3-dev + mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ + apt-get update && \ + grep 'Depends:' "debian/control.in.${TARGETARCH}${TARGETVARIANT}" | cut -d' ' -f2- | sed -e 's/,/\n/g' | \ + xargs apt-get install --yes --no-install-recommends \ + python3 python3-pip python3-venv \ + build-essential python3-dev WORKDIR /home/mimic3/app @@ -67,24 +71,28 @@ ENV DEBIAN_FRONTEND=noninteractive RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache +WORKDIR /home/mimic3/app + +COPY debian/control.in.* ./debian/ + +# Use dependencies from Debian package control file RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ apt-get update && \ - apt-get install --yes --no-install-recommends \ - python3 ca-certificates libespeak-ng1 libatomic1 libgomp1 + grep 'Depends:' "debian/control.in.${TARGETARCH}${TARGETVARIANT}" | cut -d' ' -f2- | sed -e 's/,/\n/g' | \ + xargs apt-get install --yes --no-install-recommends \ + python3 ca-certificates RUN useradd -ms /bin/bash mimic3 # Copy virtual environment and source code -COPY --from=build /home/mimic3/app/ /home/mimic3/app/ +COPY --from=build /home/mimic3/app/ ./ # Copy pre-downloaded voice(s) COPY --from=build /root/.local/share/mimic3/voices/ /usr/share/mimic3/voices/ -WORKDIR /home/mimic3/app - # Run test -COPY tests/apope_sample.txt tests/apope_sample_*.wav tests/ +COPY tests/apope_sample.txt tests/apope_sample_*.wav ./tests/ # Generate sample and check RUN export expected_sample="tests/apope_sample_${TARGETARCH}${TARGETVARIANT}.wav" && \ diff --git a/Dockerfile.debian b/Dockerfile.debian index 1a0263a..2c575c8 100644 --- a/Dockerfile.debian +++ b/Dockerfile.debian @@ -56,7 +56,7 @@ RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \ # Install PyInstaller RUN --mount=type=cache,id=pip-venv,target=/root/.cache/pip \ - .venv/bin/pip3 install 'pyinstaller>=4,<5' + .venv/bin/pip3 install -f wheels 'pyinstaller>=4,<5' COPY pyinstaller/mimic3.py ./pyinstaller/ @@ -120,9 +120,8 @@ COPY voices/ voices/ RUN mkdir -p "${package_dir}/DEBIAN" && \ export VERSION="$(cat mimic3-tts/mimic3_tts/VERSION)" && \ - export DEBIAN_ARCH="$(dpkg-architecture | grep '^DEB_HOST_ARCH=' | sed -e 's/^.\+=//')" && \ envsubst \ - < "debian/control.in" \ + < "debian/control.in.${TARGETARCH}${TARGETVARIANT}" \ > "${package_dir}/DEBIAN/control" && \ mkdir -p "${package_dir}/usr/lib/mimic3-tts" && \ rsync -av "dist/mimic3/" "${package_dir}/usr/lib/mimic3-tts/" && \ diff --git a/Dockerfile.debian.dockerignore b/Dockerfile.debian.dockerignore index 5caa72f..25b670a 100644 --- a/Dockerfile.debian.dockerignore +++ b/Dockerfile.debian.dockerignore @@ -9,7 +9,7 @@ !wheels/ # Debian packaging -!debian/control.in +!debian/control.in.* !debian/bin/* # opentts-abc diff --git a/Dockerfile.dist b/Dockerfile.dist index c83a95d..824fe55 100644 --- a/Dockerfile.dist +++ b/Dockerfile.dist @@ -58,12 +58,15 @@ ENV DEBIAN_FRONTEND=noninteractive RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache +COPY debian/control.in.* ./debian/ + +# Use dependencies from Debian package control file RUN --mount=type=cache,id=apt-run,target=/var/cache/apt \ mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ apt-get update && \ - apt-get install --yes --no-install-recommends \ - python3 python3-venv python3-pip \ - libespeak-ng1 libatomic1 libgomp1 + grep 'Depends:' "debian/control.in.${TARGETARCH}${TARGETVARIANT}" | cut -d' ' -f2- | sed -e 's/,/\n/g' | \ + xargs apt-get install --yes --no-install-recommends \ + python3 python3-venv python3-pip WORKDIR /test @@ -75,8 +78,8 @@ COPY --from=build /build/mimic3/dist/*.tar.gz ./dist/ RUN --mount=type=cache,id=pip-requirements,target=/root/.cache/pip \ python3 -m venv .venv && \ .venv/bin/pip3 install \ + -f wheels/ \ -f https://synesthesiam.github.io/prebuilt-apps/ \ - -f https://www.piwheels.hostedpi.com/simple/numpy/ \ -f dist/ \ mimic3-tts diff --git a/Dockerfile.dist.dockerignore b/Dockerfile.dist.dockerignore index b806b3a..66a67fa 100644 --- a/Dockerfile.dist.dockerignore +++ b/Dockerfile.dist.dockerignore @@ -4,6 +4,7 @@ !tests/apope_sample_*.wav !voices/ !wheels/ +!debian/control.in.* # opentts-abc !opentts-abc/setup.py diff --git a/Dockerfile.dockerignore b/Dockerfile.dockerignore index 0e4e897..700654b 100644 --- a/Dockerfile.dockerignore +++ b/Dockerfile.dockerignore @@ -4,6 +4,7 @@ !tests/apope_sample_*.wav !voices/ !wheels/ +!debian/control.in.* # opentts-abc !opentts-abc/setup.py diff --git a/Dockerfile.sample b/Dockerfile.sample index 772fb02..2cd66db 100644 --- a/Dockerfile.sample +++ b/Dockerfile.sample @@ -30,11 +30,15 @@ ENV DEBIAN_FRONTEND=noninteractive RUN echo "Dir::Cache var/cache/apt/${TARGETARCH}${TARGETVARIANT};" > /etc/apt/apt.conf.d/01cache +COPY debian/control.in.* ./debian/ + +# Use dependencies from Debian package control file RUN --mount=type=cache,id=apt-build,target=/var/cache/apt \ - mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ - apt-get update && \ - apt-get install --yes --no-install-recommends \ - python3 python3-pip python3-venv + mkdir -p /var/cache/apt/${TARGETARCH}${TARGETVARIANT}/archives/partial && \ + apt-get update && \ + grep 'Depends:' "debian/control.in.${TARGETARCH}${TARGETVARIANT}" | cut -d' ' -f2- | sed -e 's/,/\n/g' | \ + xargs apt-get install --yes --no-install-recommends \ + python3 python3-pip python3-venv WORKDIR /home/mimic3/app diff --git a/Dockerfile.sample.dockerignore b/Dockerfile.sample.dockerignore index ba9405b..bc1b6b6 100644 --- a/Dockerfile.sample.dockerignore +++ b/Dockerfile.sample.dockerignore @@ -3,6 +3,7 @@ !tests/apope_sample.txt !voices/ !wheels/ +!debian/control.in.* # opentts-abc !opentts-abc/setup.py diff --git a/debian/control.in b/debian/control.in.amd64 similarity index 71% rename from debian/control.in rename to debian/control.in.amd64 index 5f56ad6..d1bdacb 100644 --- a/debian/control.in +++ b/debian/control.in.amd64 @@ -2,8 +2,8 @@ Package: mimic3-tts Version: ${VERSION} Section: utils Priority: optional -Depends: libespeak-ng1,libatomic1,libgomp1 +Depends: libespeak-ng1 Recommends: sox -Architecture: ${DEBIAN_ARCH} +Architecture: amd64 Maintainer: Mycroft AI Description: A fast, local, neural text to speech system for Mycroft diff --git a/debian/control.in.arm64 b/debian/control.in.arm64 new file mode 100644 index 0000000..bdfa955 --- /dev/null +++ b/debian/control.in.arm64 @@ -0,0 +1,9 @@ +Package: mimic3-tts +Version: ${VERSION} +Section: utils +Priority: optional +Depends: libespeak-ng1 +Recommends: sox +Architecture: arm64 +Maintainer: Mycroft AI +Description: A fast, local, neural text to speech system for Mycroft diff --git a/debian/control.in.armv7 b/debian/control.in.armv7 new file mode 100644 index 0000000..88ff411 --- /dev/null +++ b/debian/control.in.armv7 @@ -0,0 +1,9 @@ +Package: mimic3-tts +Version: ${VERSION} +Section: utils +Priority: optional +Depends: libespeak-ng1,libatomic1,libgomp1,libatlas-base-dev +Recommends: sox +Architecture: armhf +Maintainer: Mycroft AI +Description: A fast, local, neural text to speech system for Mycroft diff --git a/install.sh b/install.sh index 71a90f7..ab02d87 100755 --- a/install.sh +++ b/install.sh @@ -35,7 +35,7 @@ this_dir="$( cd "$( dirname "$0" )" && pwd )" # pip install command if [ -z "${PIP_INSTALL}" ]; then - PIP_INSTALL="install -f "${this_dir}/wheels"" + PIP_INSTALL="install -f "${this_dir}/wheels" -f https://synesthesiam.github.io/prebuilt-apps/" fi python_version="$(${PYTHON} --version)" diff --git a/mimic3-tts/mimic3_tts/voices.json b/mimic3-tts/mimic3_tts/voices.json index 81f3161..ab4f130 100644 --- a/mimic3-tts/mimic3_tts/voices.json +++ b/mimic3-tts/mimic3_tts/voices.json @@ -321,6 +321,56 @@ ], "properties": {} }, + "en_US/hifi-tts_low": { + "files": { + "ALIASES": { + "size_bytes": 15, + "sha256_sum": "193592c118c555b769e3b7eeca7ba4325accc7576473cc403b4ff42987643a0e" + }, + "LICENSE": { + "size_bytes": 199, + "sha256_sum": "27a903cab1081b055dba1bcef7b543572318eb2f255ec8999103f368f845df24" + }, + "README.md": { + "size_bytes": 173, + "sha256_sum": "1240c01f4690ae5c9a758562cf61bcc63e83f38c9a553b6f12b7ac450df35d00" + }, + "SOURCE": { + "size_bytes": 28, + "sha256_sum": "dcfc704446de47e8438a04cb4029c0aaa86a4931d10685080b307cec98345862" + }, + "config.json": { + "size_bytes": 3660, + "sha256_sum": "eb5ba8f05a968c8281334912f779566e19d5873f1c999631c65f8a53222744d6" + }, + "generator.onnx": { + "size_bytes": 76329055, + "sha256_sum": "45983e12395beadf7527cf5a043b52c93368f753d21c411ee103a7496c9190cb" + }, + "phoneme_map.txt": { + "size_bytes": 15, + "sha256_sum": "4003f421fc91ed1d5a343442659db6cf9d58bd1c6d8d771abc1999cc24d7694d" + }, + "phonemes.txt": { + "size_bytes": 263, + "sha256_sum": "8f9c3e6ced14d7fc5426e4e1bc7f7cc1037a20a645ca34110abcb76148fa8bfd" + }, + "speaker_map.csv": { + "size_bytes": 49, + "sha256_sum": "265bdaecffe484f41962e78c8cf7f7ef78a43d2de7c10277ca996f874d3146cd" + }, + "speakers.txt": { + "size_bytes": 13, + "sha256_sum": "7dce6a2c4af708b94215d1a4226d5c0d0f48ceded8a3bdd21fb1ef85c216227c" + } + }, + "speakers": [ + "9017", + "6097", + "92" + ], + "properties": {} + }, "en_US/ljspeech_low": { "files": { "ALIASES": {