lkhq / debspawn

Debian package builder and build helper using systemd-nspawn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Preventing manpage regeneration by default

fishermans-friend opened this issue · comments

One of the things that tend to take the longest (especially for small packages on foreign arches) when building packages with Debspawn for me is waiting for the container to be prepared every time. In particular, hitting the following line in Installing package build-dependencies:

Setting up man-db (2.8.3-2ubuntu0.1) ...
Building database of manual pages ...

While it's usually not a big deal, it also seems extremely unnecessary for an ephemeral container to build manpages. I think this could be done by default, and you probably don't need any flags for it unless someone complains either, it should pretty much be a free speedup. If you agree, this patch ought to add that functionality:

diff --git a/debspawn/osbase.py b/debspawn/osbase.py
index 3df261d..6612763 100644
--- a/debspawn/osbase.py
+++ b/debspawn/osbase.py
@@ -614,6 +614,20 @@ class OSBase:
                             '--keep-baud - 115200,38400,9600 $TERM\n'
                         )
                     )
+            # prevent manpages from being built in the container
+            dpkg_conf_dir = Path(tdir, 'etc/dpkg/dpkg.conf.d')
+            os.makedirs(dpkg_conf_dir, exist_ok=True)
+            with open(dpkg_conf_dir / '01_nodoc', 'w') as f:
+                f.write(
+                    '''\
+path-exclude /usr/share/doc/*
+# we need to keep copyright files for legal reasons
+path-include /usr/share/doc/*/copyright
+path-exclude /usr/share/man/*
+path-exclude /usr/share/groff/*
+path-exclude /usr/share/info/*
+'''
+                )
 
             # delete unwanted files, especially resolv.conf as a broken one will
             # mess with the next step

Though of course, that doesn't include any of the actual things needed for a release. If you want, I'd be happy to put in a PR for it, but I figure it's probably better to leave that to you, so I don't mess up any conventions for the git log or whatever.