From: Rob Savoury Date: Wed, 13 Oct 2021 21:43:11 -0700 Subject: Allow setting pbuilder build locale A notable limitation of pbuilder is that the locale cannot be set for the build and defaults to "C" rather than "C.UTF-8" as set by sbuild for all official Debian and Ubuntu package builds. This patch allows setting the locale (both LANG and LC_ALL) via /etc/pbuilderrc or $HOME/.pbuilderrc and thus makes it very easy to use the same locale as for all official builds. --- debian/changelog | 9 +++++++++ pbuilder-buildpackage | 2 +- pbuilderrc | 4 ++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git pbuilder-0.231/debian/changelog pbuilder-0.231ubuntu0/debian/changelog index 08cc375..7ac4322 100644 --- pbuilder-0.231/debian/changelog +++ pbuilder-0.231ubuntu0/debian/changelog @@ -1,3 +1,12 @@ +pbuilder (0.231ubuntu0) UNRELEASED; urgency=medium + + * buildpackage: + + Include LANG and LC_ALL environment variables to use inside pbuilder + * pbuilderrc: + + Default to BUILD_LANG='C.UTF-8' and BUILD_LC_ALL='C.UTF-8' + + -- Rob Savoury Wed, 13 Oct 2021 21:35:26 -0700 + pbuilder (0.231) unstable; urgency=medium [ Mattia Rizzolo ] diff --git pbuilder-0.231/pbuilder-buildpackage pbuilder-0.231ubuntu0/pbuilder-buildpackage index 846ee69..3302bcc 100755 --- pbuilder-0.231/pbuilder-buildpackage +++ pbuilder-0.231ubuntu0/pbuilder-buildpackage @@ -182,7 +182,7 @@ log.i "Building the package" executehooks "A" -ENV_PREFIX="env PATH=\"$PATH\" HOME=\"$BUILD_HOME\"" +ENV_PREFIX="env LANG=\"$BUILD_LANG\" LC_ALL=\"$BUILD_LC_ALL\" PATH=\"$PATH\" HOME=\"$BUILD_HOME\"" DPKG_COMMANDLINE="$ENV_PREFIX dpkg-buildpackage -us -uc $DEBBUILDOPTS" if [ "${SOURCE_ONLY_CHANGES}" = "yes" ]; then diff --git pbuilder-0.231/pbuilderrc pbuilder-0.231ubuntu0/pbuilderrc index a08e896..f5afdd3 100644 --- pbuilder-0.231/pbuilderrc +++ pbuilder-0.231ubuntu0/pbuilderrc @@ -128,6 +128,10 @@ DEBOOTSTRAPOPTS=( # the chroot is used. APTKEYRINGS=() +# Set BUILD_LANG and BUILD_LC_ALL to use inside pbuilder: default for both is "C.UTF-8" +export BUILD_LANG="C.UTF-8" +export BUILD_LC_ALL="C.UTF-8" + # Set the PATH I am going to use inside pbuilder: default is "/usr/sbin:/usr/bin:/sbin:/bin" export PATH="/usr/sbin:/usr/bin:/sbin:/bin"