changeset 224:49b5413699d3

added Docker-based builder scripts for Debian 12 (bookworm)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 31 Aug 2024 10:14:37 +0200
parents 9363da60c3c3
children 329a7b9ef091
files NEWS Resources/Builders/Debian/docker-bookworm-compile.sh Resources/Builders/Debian/docker-bullseye-compile.sh Resources/Builders/Debian/docker-buster-compile.sh Resources/Builders/Debian/docker-internal.sh
diffstat 5 files changed, 76 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Thu Aug 08 11:50:52 2024 +0200
+++ b/NEWS	Sat Aug 31 10:14:37 2024 +0200
@@ -3,6 +3,7 @@
 
 * In "orthanc.pyi", enumerations are not tagged as deriving from "enum.Enum" anymore:
   https://github.com/orthanc-server/orthanc-builder/issues/21
+* Docker-based builder scripts for Debian 12 (bookworm)
 
 
 Version 4.3 (2024-07-04)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Builders/Debian/docker-bookworm-compile.sh	Sat Aug 31 10:14:37 2024 +0200
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# SPDX-FileCopyrightText: 2020-2023 Osimis S.A., 2024-2024 Orthanc Team SRL, 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain
+# SPDX-License-Identifier: AGPL-3.0-or-later
+
+##
+## Python plugin for Orthanc
+## Copyright (C) 2020-2023 Osimis S.A., Belgium
+## Copyright (C) 2024-2024 Orthanc Team SRL, Belgium
+## Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium
+##
+## This program is free software: you can redistribute it and/or
+## modify it under the terms of the GNU Affero General Public License
+## as published by the Free Software Foundation, either version 3 of
+## the License, or (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Affero General Public License for more details.
+##
+## You should have received a copy of the GNU Affero General Public License
+## along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+
+
+set -ex
+
+if [ "$1" != "Debug" -a "$1" != "Release" ]; then
+    echo "Please provide build type: Debug or Release"
+    exit -1
+fi
+
+if [ -t 1 ]; then
+    # TTY is available => use interactive mode
+    DOCKER_FLAGS='-i'
+fi
+
+ROOT_DIR=`dirname $(readlink -f $0)`/../../..
+
+mkdir -p ${ROOT_DIR}/docker-build-bookworm/
+
+docker pull debian:bookworm-slim
+
+docker run -t ${DOCKER_FLAGS} --rm \
+    -v ${ROOT_DIR}:/source:ro \
+    -v ${ROOT_DIR}/docker-build-bookworm:/target:rw \
+    debian:bookworm-slim \
+    bash /source/Resources/Builders/Debian/docker-internal.sh $1 bookworm 3.11 $(id -u) $(id -g)
+
+ls -lR ${ROOT_DIR}/docker-build-bookworm/
--- a/Resources/Builders/Debian/docker-bullseye-compile.sh	Thu Aug 08 11:50:52 2024 +0200
+++ b/Resources/Builders/Debian/docker-bullseye-compile.sh	Sat Aug 31 10:14:37 2024 +0200
@@ -46,6 +46,6 @@
     -v ${ROOT_DIR}:/source:ro \
     -v ${ROOT_DIR}/docker-build-bullseye:/target:rw \
     debian:bullseye-slim \
-    bash /source/Resources/Builders/Debian/docker-internal.sh $1 3.9 $(id -u) $(id -g)
+    bash /source/Resources/Builders/Debian/docker-internal.sh $1 bullseye 3.9 $(id -u) $(id -g)
 
 ls -lR ${ROOT_DIR}/docker-build-bullseye/
--- a/Resources/Builders/Debian/docker-buster-compile.sh	Thu Aug 08 11:50:52 2024 +0200
+++ b/Resources/Builders/Debian/docker-buster-compile.sh	Sat Aug 31 10:14:37 2024 +0200
@@ -46,6 +46,6 @@
     -v ${ROOT_DIR}:/source:ro \
     -v ${ROOT_DIR}/docker-build-buster:/target:rw \
     debian:buster-slim \
-    bash /source/Resources/Builders/Debian/docker-internal.sh $1 3.7 $(id -u) $(id -g)
+    bash /source/Resources/Builders/Debian/docker-internal.sh $1 buster 3.7 $(id -u) $(id -g)
 
 ls -lR ${ROOT_DIR}/docker-build-buster/
--- a/Resources/Builders/Debian/docker-internal.sh	Thu Aug 08 11:50:52 2024 +0200
+++ b/Resources/Builders/Debian/docker-internal.sh	Sat Aug 31 10:14:37 2024 +0200
@@ -27,30 +27,39 @@
 set -ex
 
 BUILD_TYPE=$1
-PYTHON_VERSION=$2
-USER_ID=$3
-GROUP_ID=$4
+DEBIAN_VERSION=$2
+PYTHON_VERSION=$3
+USER_ID=$4
+GROUP_ID=$5
 
 # Create the same user and group than the one who is running the
 # "./docker-{distro}-compile.sh" script on the hosting system (*)
 groupadd -g ${GROUP_ID} -r orthanc
 useradd -u ${USER_ID} -r -g orthanc orthanc
 
+if [ "${DEBIAN_VERSION}" = "bullseye" ]; then
+    MERCURIAL_PACKAGES=python
+else
+    MERCURIAL_PACKAGES=mercurial
+fi
+
 apt-get update
-DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config python libpython3-dev curl
+DEBIAN_FRONTEND=noninteractive apt-get -y install nano build-essential unzip cmake pkg-config libpython3-dev curl ${MERCURIAL_PACKAGES}
 apt-get -y clean
 rm -rf /var/lib/apt/lists/*
 
 
-# On Bullseye, we get "stat: cannot statx
-# '/usr/share/mercurial/hgext.rc': Operation not permitted" if
-# installing the "mercurial" package using apt-get. As a consequence,
-# we manually install Mercurial from sources.
-MERCURIAL=mercurial-5.4.1
-cd /tmp
-curl https://www.mercurial-scm.org/release/${MERCURIAL}.tar.gz > ${MERCURIAL}.tar.gz
-tar xvf ${MERCURIAL}.tar.gz
-export PATH=${PATH}:/tmp/${MERCURIAL}/
+if [ "${DEBIAN_VERSION}" = "bullseye" ]; then
+   # On Bullseye, we get "stat: cannot statx
+   # '/usr/share/mercurial/hgext.rc': Operation not permitted" if
+   # installing the "mercurial" package using apt-get. As a consequence,
+   # we manually install Mercurial from sources.
+   MERCURIAL=mercurial-5.4.1
+   cd /tmp
+   curl https://www.mercurial-scm.org/release/${MERCURIAL}.tar.gz > ${MERCURIAL}.tar.gz
+   tar xvf ${MERCURIAL}.tar.gz
+   export PATH=${PATH}:/tmp/${MERCURIAL}/
+fi
 
 
 mkdir /tmp/source-writeable