From 9105675405084c459021f990942b4471f81f1e70 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de>
Date: Fri, 20 Oct 2023 14:09:39 +0200
Subject: [PATCH] feat: make changes for enabling the role to be run against
 Debian 12 Bookworm targets

---
 molecule/resources/playbooks/prepare.yml |  2 +-
 molecule/virtualbox/molecule.yml         |  2 +-
 tasks/compile_callas_binaries.yml        | 16 +++++++++++++++-
 tasks/install_callas_pdf_engine.yml      |  2 +-
 tasks/install_packages.yml               |  2 +-
 5 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/molecule/resources/playbooks/prepare.yml b/molecule/resources/playbooks/prepare.yml
index 25f7ac8..69b1475 100644
--- a/molecule/resources/playbooks/prepare.yml
+++ b/molecule/resources/playbooks/prepare.yml
@@ -30,7 +30,7 @@
         become: true
       - name: add repo URL to sources.list
         ansible.builtin.apt_repository:
-          repo: "deb https://sdvdebianrepo.slub-dresden.de/deb-repository bullseye main"
+          repo: "deb https://sdvdebianrepo.slub-dresden.de/deb-repository {{ ansible_distribution_release }} main"
           state: present
           update_cache: true
           mode: "0644"
diff --git a/molecule/virtualbox/molecule.yml b/molecule/virtualbox/molecule.yml
index 3428be2..fdccc94 100644
--- a/molecule/virtualbox/molecule.yml
+++ b/molecule/virtualbox/molecule.yml
@@ -13,7 +13,7 @@ platforms:
   # https://github.com/ansible-community/molecule-vagrant#documentation
   # for more platform parameters.
   - name: mol-validators
-    box: debian/bullseye64
+    box: debian/bookworm64
     memory: 1024
     # List of raw Vagrant `config` options.
     # provider_raw_config_args:
diff --git a/tasks/compile_callas_binaries.yml b/tasks/compile_callas_binaries.yml
index 76612be..45520bc 100644
--- a/tasks/compile_callas_binaries.yml
+++ b/tasks/compile_callas_binaries.yml
@@ -1,10 +1,19 @@
 ---
+# ATTENTION!!!
+# The 'libcgicc-dev' package needs to be a patched version provided by SLUB's
+# own package repository, and of course it needs to be created from the
+# official Debian package for the specific Debian version installed on the
+# target. The patch is necessary to patch the bug described at
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=985941. If the unpatched
+# version is used, the CGI-Binaries for validation and repair fail. Make sure
+# to keep the package on the Debian repo server up to date with the latest
+# Debian releases.
 - name: install prerequisite packages for compilation
   ansible.builtin.apt:
     name: [
       'g++',
       'git',
-      'libcgicc-dev=3.2.19-0.3',
+      'libcgicc-dev=3.2.19-1.1',
       'make',
     ]
     state: present
@@ -52,6 +61,11 @@
     - "var"
   changed_when: false    # This always changes, because the dest path is fresh.
 
+- name: remove libstdc++ that is delivered with CallasSDK to ensure that local system lib is used
+  ansible.builtin.file:
+    name: "/usr/lib/cgi-bin/lib/libstdc++.so.6"
+    state: absent
+
 # We need to use the ansible.builtin.shell module here, because the
 # ansible.builtin.command module does not accept setting environment variables
 # inline. Molecule errors are turned off for this.
diff --git a/tasks/install_callas_pdf_engine.yml b/tasks/install_callas_pdf_engine.yml
index 3900a58..8b56961 100644
--- a/tasks/install_callas_pdf_engine.yml
+++ b/tasks/install_callas_pdf_engine.yml
@@ -67,7 +67,7 @@
 
 - name: install libstdc++
   ansible.builtin.apt:
-    name: "libstdc++-10-dev"
+    name: "libstdc++-11-dev"
     state: present
 
 - name: remove symlinks to distro version of libstdc++, because we need to use what's provided with PDFEngine
diff --git a/tasks/install_packages.yml b/tasks/install_packages.yml
index d1e2273..71e6a8b 100644
--- a/tasks/install_packages.yml
+++ b/tasks/install_packages.yml
@@ -26,7 +26,7 @@
       'logrotate',
       'lsb-release',
       'nfs-common',
-      'openjdk-11-jre',
+      'openjdk-17-jre',
       'perl',
       'perl-base',
       'perl-modules',
-- 
GitLab