@@ -11,25 +11,9 @@ ifeq ($(DIRS),)
1111$(error No subdirectories with metadata.hcl files found)
1212endif
1313
14- # Default supported distributions
15- DISTROS := $(shell sed -n '/variable "distributions"/,/}/ { s/^[[:space:]]* "\([^"]* \) ".*/\1/p }' docker-bake.hcl)
16- # Default supported PostgreSQL majors
17- POSTGRES_MAJORS := $(shell sed -n '/variable "pgVersions"/,/]/ { s/^[[:space:]]* "\([^"]* \) ".*/\1/p }' docker-bake.hcl)
18-
19- # Find all extensions with AUTO_UPDATE_OS_LIBS = true
20- EXTENSIONS_WITH_OS_LIBS := $(shell \
21- for dir in $(DIRS ) ; do \
22- value=$$(sed -n 's/.*auto_update_os_libs *= *//p' "$$dir/metadata.hcl" | tr -d ' ' ) ; \
23- if [ "$$value" = "true" ]; then echo "$$dir"; fi; \
24- done \
25- )
26-
2714# Create push targets for each directory
2815PUSH_TARGETS := $(addprefix push-,$(DIRS ) )
2916
30- # Create UPDATE_OS_LIBS targets for each extension
31- UPDATE_OS_LIBS_TARGETS := $(addprefix update-os-libs-,$(EXTENSIONS_WITH_OS_LIBS ) )
32-
3317.PHONY : all check prereqs push $(DIRS ) $(PUSH_TARGETS )
3418
3519# Colours
@@ -64,32 +48,6 @@ check: prereqs
6448 docker buildx bake -f $(dir ) /metadata.hcl -f docker-bake.hcl --check; \
6549 )
6650
67- # --------------------------
68- # Update OS libraries for all images
69- # --------------------------
70- update-os-libs : prereqs $(UPDATE_OS_LIBS_TARGETS )
71- @echo -e " $( GREEN) ======================================================$( NC) "
72- @echo -e " $( GREEN) OS libraries update for all projects: $( EXTENSIONS_WITH_OS_LIBS) $( NC) "
73- @echo -e " $( GREEN) ======================================================$( NC) "
74-
75- # --------------------------
76- # Generic per-project OS libraries update
77- # Usage: make update-os-libs-<project>
78- # --------------------------
79- $(UPDATE_OS_LIBS_TARGETS ) : update-os-libs-% : prereqs
80- @echo -e " $( BLUE) Performing an OS libraries update for $* ...$( NC) "
81- @mkdir -p " $* /system-libs" ; \
82- for DISTRO in $( DISTROS) ; do \
83- for MAJOR in $( POSTGRES_MAJORS) ; do \
84- docker run --rm -u 0 " ghcr.io/cloudnative-pg/postgresql:18-minimal-$$ DISTRO" \
85- bash -c " apt-get update >/dev/null; apt-get install -qq --print-uris --no-install-recommends postgresql-$$ MAJOR-$* " \
86- | cut -d ' ' -f 2,4 \
87- | grep ' ^lib' \
88- | sort \
89- > " $* /system-libs/$$ MAJOR-$$ DISTRO-os-libs.txt" ; \
90- done ; \
91- done
92-
9351# --------------------------
9452# Push all images
9553# --------------------------
0 commit comments