File tree Expand file tree Collapse file tree 3 files changed +40
-6
lines changed Expand file tree Collapse file tree 3 files changed +40
-6
lines changed Original file line number Diff line number Diff line change 77# { "builder": {"Entitlements": {"security-insecure": true }} }
88# ```
99# ```
10- # DOCKER_BUILDKIT=1 docker build --allow security.insecure -t IMAGE_NAME /path/to/pgpm
10+ # DOCKER_BUILDKIT=1 docker build --allow security.insecure -t IMAGE_NAME .
1111# ```
1212
1313# This Dockerfile is used to build a Debian image, which includes pbuilder and
@@ -21,8 +21,12 @@ MAINTAINER PGPM Debian Maintainer debian.maintainer@postgres.pm
2121VOLUME /proc
2222ARG DEBIAN_FRONTEND=noninteractive
2323RUN apt update
24- RUN apt install -y build-essential pbuilder fakeroot fakechroot
24+ RUN apt install -y build-essential pbuilder fakeroot fakechroot vim ripgrep
2525RUN echo 'MIRRORSITE=http://deb.debian.org/debian' > /etc/pbuilderrc
2626RUN echo 'AUTO_DEBSIGN=${AUTO_DEBSIGN:-no}' > /root/.pbuilderrc
2727RUN echo 'HOOKDIR=/var/cache/pbuilder/hooks' >> /root/.pbuilderrc
28- RUN --security=insecure pbuilder create
28+ COPY scripts/faketar /usr/bin/
29+ RUN chmod +x /usr/bin/faketar
30+ RUN sed -E -i "s/local TAR=tar/local TAR=faketar/" /usr/lib/pbuilder/pbuilder-modules
31+ RUN sed -E -i "s/if [!] tar -c --use-compress-program/if ! faketar -c --use-compress-program/" /usr/lib/pbuilder/pbuilder-modules
32+ RUN --security=insecure fakeroot pbuilder create
Original file line number Diff line number Diff line change @@ -14,7 +14,6 @@ def initialize(spec)
1414 def build
1515 prepare_image
1616 start_container
17- patch_pbuilder
1817
1918 prepare_versioned_source
2019 generate_deb_src_files ( :versioned )
@@ -127,9 +126,12 @@ def prepare_image
127126
128127 def build_local_image
129128 puts " Building local #{ image_name } ..."
130- system ( "podman create -it --privileged --tmpfs /tmp --name pgpm-deb-tmp #{ base_image_name } " )
129+ container_opts = "-it --privileged --tmpfs /tmp --name pgpm-deb-tmp"
130+ system ( "podman create #{ container_opts } #{ base_image_name } " )
131131 system ( "podman start pgpm-deb-tmp" )
132132
133+ patch_pbuilder
134+
133135 # Generate pbuilder_install script.sh, copy it inside the image
134136 pbuild_install_script_path = "#{ @pgpm_dir } /pbuilder_install_script.sh"
135137 puts " Generating #{ pbuild_install_script_path } ..."
@@ -194,7 +196,9 @@ def start_container
194196 # a result.
195197 def patch_pbuilder
196198 cmd = "sed -E -i \" s/(^function clean_subdirectories.*$)/\\ 1\\ n return/g\" /usr/lib/pbuilder/pbuilder-modules"
197- system ( "podman exec #{ @container_name } /bin/bash -c '#{ cmd } '" )
199+ system ( "podman exec pgpm-deb-tmp /bin/bash -c '#{ cmd } '" )
200+ cmd = "sed -E -i \" s/if [[] [!] -f [\\ \" ]([$]BASETGZ)/if [ ! -d \\ \" \\ 1/\" /usr/lib/pbuilder/pbuilder-modules"
201+ system ( "podman exec pgpm-deb-tmp /bin/bash -c '#{ cmd } '" )
198202 end
199203
200204 def run_build ( pkg_type = :versioned )
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ ARGS=" $@ "
4+ echo " faketar ${ARGS[@]} "
5+
6+ if [[ " ${ARGS[*]} " =~ [[:space:]]-x[[:space:]] ]]; then # compress
7+ # Replacing this command:
8+ # tar -x -p -f "$BASETGZ"
9+ src=" $4 "
10+ echo " Copying $src /* to $( pwd) "
11+ cp -pur $src /* ./
12+ elif [[ " ${ARGS[*]} " =~ [[:space:]]-c[[:space:]] ]]; then # extract
13+ # Replacing this command:
14+ # tar -c --use-compress-program "$COMPRESSPROG" -f "${BASETGZ}.tmp" ./*
15+ target=" $5 "
16+ src=" ."
17+ mkdir $target
18+ echo " Moving $src /* to $target /"
19+ mv $src /* $target /
20+ # Remove existing directory into which we move the contents.
21+ # Otherwise, pbuilder (when it calls `mv`) will move $target inside it,
22+ # instead of copying $target/* into it.
23+ if [[ -d " ${target% " .tmp" } " ]]; then
24+ rm -rf " ${target% " .tmp" } "
25+ fi
26+ fi
You can’t perform that action at this time.
0 commit comments