From c0e3e542ffeca81a47c0ff9ed8f4e3a34a88110a Mon Sep 17 00:00:00 2001 From: Benjamin Bohard Date: Tue, 2 Aug 2022 16:29:39 +0200 Subject: [PATCH] =?UTF-8?q?Profil=20g=C3=A9n=C3=A9rique=20pour=20la=20comp?= =?UTF-8?q?ilation=20de=20documents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/build/doc-compiler/compile | 5 ++++ .../containerbuild/doc-compiler/add-packages | 10 +++++++ .../containerbuild/doc-compiler/add-resources | 13 ++++++++ hooks/postbuild/doc-compiler/export-dist | 14 +++++++++ .../prebuild/doc-compiler/complete-project-db | 4 +++ profiles/doc-compiler.conf | 29 ++++++++++++++++++ profiles/eole-2.9.0.conf | 30 +++++++++++++++++++ profiles/pypi-2.7.2.conf | 28 +++++++++++++++++ 8 files changed, 133 insertions(+) create mode 100644 hooks/build/doc-compiler/compile create mode 100644 hooks/containerbuild/doc-compiler/add-packages create mode 100644 hooks/containerbuild/doc-compiler/add-resources create mode 100644 hooks/postbuild/doc-compiler/export-dist create mode 100644 hooks/prebuild/doc-compiler/complete-project-db create mode 100644 profiles/doc-compiler.conf create mode 100644 profiles/eole-2.9.0.conf create mode 100644 profiles/pypi-2.7.2.conf diff --git a/hooks/build/doc-compiler/compile b/hooks/build/doc-compiler/compile new file mode 100644 index 0000000..53aa284 --- /dev/null +++ b/hooks/build/doc-compiler/compile @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +pushd /src +make build +popd diff --git a/hooks/containerbuild/doc-compiler/add-packages b/hooks/containerbuild/doc-compiler/add-packages new file mode 100644 index 0000000..4394297 --- /dev/null +++ b/hooks/containerbuild/doc-compiler/add-packages @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e + +echo 'ENV DEBIAN_FRONTEND=noninteractive' >> Dockerfile +echo 'RUN apt-get update && apt-get install --yes make' >> Dockerfile +echo 'RUN apt-get update && apt-get install --yes texlive-full python3-setuptools python-setuptools python3-pygments python-pygments fonts-liberation fonts-liberation2 rubber' >> Dockerfile +echo 'RUN apt-get update && apt-get install --yes pandoc' >> Dockerfile +echo 'ENV DEBIAN_FRONTEND=' >> Dockerfile + diff --git a/hooks/containerbuild/doc-compiler/add-resources b/hooks/containerbuild/doc-compiler/add-resources new file mode 100644 index 0000000..db4e23b --- /dev/null +++ b/hooks/containerbuild/doc-compiler/add-resources @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +set -e + + +if [ -e './datasets/fonts' ] +then +for font_file in $(find . -wholename "./datasets/fonts/*.ttf") +do +echo 'COPY datasets/fonts/$font_file /root/.fonts/$font_file' >> Dockerfile +done +fi +exit 0 diff --git a/hooks/postbuild/doc-compiler/export-dist b/hooks/postbuild/doc-compiler/export-dist new file mode 100644 index 0000000..20b912e --- /dev/null +++ b/hooks/postbuild/doc-compiler/export-dist @@ -0,0 +1,14 @@ +#!/bin/bash + +function move_output_to_dist { + find . -name "$1" -type f -print0 | xargs -0r mv -t /dist/ +} + +# Create new directory +mkdir -p /dist + +# Move generated files +move_output_to_dist "*.pdf" + +tamarin_success "Done :-)" + diff --git a/hooks/prebuild/doc-compiler/complete-project-db b/hooks/prebuild/doc-compiler/complete-project-db new file mode 100644 index 0000000..708a6ca --- /dev/null +++ b/hooks/prebuild/doc-compiler/complete-project-db @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +cd src + diff --git a/profiles/doc-compiler.conf b/profiles/doc-compiler.conf new file mode 100644 index 0000000..8eb5266 --- /dev/null +++ b/profiles/doc-compiler.conf @@ -0,0 +1,29 @@ +# Configuration générale du profil +[profile] +# Image Docker par défaut +default_image=ubuntu:focal + +# Configuration de l’étape de pré-construction du conteneur +[containerbuild] +hooks= + containerbuild/doc-compiler/add-packages, + containerbuild/doc-compiler/add-resources, + +# Configuration de l’étape de pré-compilation des documents +[prebuild] +hooks= + prebuild/debian/copy-sources-to-workspace, + prebuild/debian/run-project-hooks, + prebuild/debian/load-project-db, + prebuild/doc-compiler/complete-project-db, + +# Configuration de l’étape de compilation du document +[build] +hooks=build/doc-compiler/compile + +# Configuration de l’étape de post-compilation du document +[postbuild] +hooks= + postbuild/debian/run-project-hooks, + postbuild/doc-compiler/export-dist, + diff --git a/profiles/eole-2.9.0.conf b/profiles/eole-2.9.0.conf new file mode 100644 index 0000000..fcd1fa0 --- /dev/null +++ b/profiles/eole-2.9.0.conf @@ -0,0 +1,30 @@ +# Configuration générale du profil +[profile] +# Image Docker par défaut +default_image=ubuntu:jammy + +# Configuration de l'étape de pré-construction du conteneur +[containerbuild] +hooks= + containerbuild/debian/install-build-essential, + containerbuild/debian/install-git, + +# Configuration de l'étape de pré-construction du paquet +[prebuild] +hooks= + prebuild/debian/copy-sources-to-workspace, + prebuild/debian/run-project-hooks, + prebuild/debian/load-project-db, + prebuild/debian/complete-project-db, + prebuild/eole/create-changelog, + prebuild/debian/install-build-depends + +# Configuration de l'étape de construction du paquet +[build] +hooks=build/debian/build + +# Configuration de l'étape de post-construction du paquet +[postbuild] +hooks= + postbuild/debian/run-project-hooks, + postbuild/debian/export-dist diff --git a/profiles/pypi-2.7.2.conf b/profiles/pypi-2.7.2.conf new file mode 100644 index 0000000..103d5ab --- /dev/null +++ b/profiles/pypi-2.7.2.conf @@ -0,0 +1,28 @@ +# Configuration générale du profil +[profile] +# Image Docker par défaut +default_image=ubuntu:bionic + +# Configuration de l'étape de pré-construction du conteneur +[containerbuild] +hooks= + containerbuild/debian/install-build-essential, + containerbuild/ubuntu/install-stdeb, + +# Configuration de l'étape de pré-construction du paquet +[prebuild] +hooks= + prebuild/debian/copy-sources-to-workspace, + prebuild/debian/run-project-hooks, + prebuild/debian/load-project-db, + +# Configuration de l'étape de construction du paquet +[build] +hooks=build/stdeb/build + +# Configuration de l'étape de post-construction du paquet +[postbuild] +hooks= + postbuild/debian/run-project-hooks, + postbuild/debian/export-dist +