Skip to content

Commit 59551ad

Browse files
author
qount25
committed
Patch pbuilder for before running it: prevent cleanup
1 parent 3122b37 commit 59551ad

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/pgpm/deb/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN apt install -y build-essential pbuilder fakeroot fakechroot
2525
RUN echo 'MIRRORSITE=http://deb.debian.org/debian' > /etc/pbuilderrc
2626
RUN echo 'AUTO_DEBSIGN=${AUTO_DEBSIGN:-no}' > /root/.pbuilderrc
2727
RUN echo 'HOOKDIR=/var/cache/pbuilder/hooks' >> /root/.pbuilderrc
28-
RUN --security=insecure pbuilder create # --components "main contrib-non-free"
28+
RUN --security=insecure pbuilder create
2929

3030
COPY pbuilder_install_script.sh /root/pbuilder_install_script.sh
3131
RUN --security=insecure pbuilder execute --save-after-exec /root/pbuilder_install_script.sh

lib/pgpm/deb/builder.rb

+13
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ def run_build
7474
exit(1) if $?.to_i > 0
7575

7676
cmds = []
77+
78+
# This line prevents clean-up after pbuilder finishes. There's no option
79+
# in pbuilder to do it, so we have to patch it manually. The issue is
80+
# with pbuilder not being able to delete some directories (presumably,
81+
# due to directory names starting with ".") and returning error.
82+
#
83+
# This little patch avoids the error by returning from the python cleanup
84+
# function early -- because the package itself is built successfully and
85+
# we don't actually care that pbuilder is unable to clean something up.
86+
# The container is going to be removed anyway, so it's even less work as
87+
# a result.
88+
cmds << "sed -E -i \"s/(^function clean_subdirectories.*$)/\\1\\n return/g\" /usr/lib/pbuilderp/builder-modules"
89+
7790
cmds << "dpkg-buildpackage --build=source -d" # -d flag helps with dependencies error
7891
cmds << "fakeroot pbuilder build ../#{dsc_fn}"
7992
cmds << "mv /var/cache/pbuilder/result/#{deb_fn} /root/pgpm/out/"

0 commit comments

Comments
 (0)