aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz93@gmail.com>2024-07-29 11:00:54 -0400
committerDylan Baker <dylan@pnwbakers.com>2024-07-30 12:28:43 -0700
commita05b790d6600586449471d3fe957442896dec2a7 (patch)
tree464b73c14c31355cffaffa1263721bc72d788500
parent077d540c10a103fd5a41d0747b8140fef87b02ef (diff)
downloadmeson-a05b790d6600586449471d3fe957442896dec2a7.zip
meson-a05b790d6600586449471d3fe957442896dec2a7.tar.gz
meson-a05b790d6600586449471d3fe957442896dec2a7.tar.bz2
mdist: correctly detect dirty hg repos with non-English locale
The command we use to heuristically parse whether it is dirty by interpreting prose descriptions of the repository state, is vulnerable to changes in locale resulting in failing to match the English word that means it is clean. Unfortunately, I am no mercurial expert so I am unaware if mercurial supports scripting, like git does. Perhaps the technology simply does not exist. A quick attempt at searching for the answer turned nothing up. It appears that #4278 had good cause indeed for using this prose parsing command. So, we simply sanitize the environment due to lack of any better idea. Bug: https://bugs.gentoo.org/936670
-rw-r--r--mesonbuild/mdist.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/mesonbuild/mdist.py b/mesonbuild/mdist.py
index 0c82cd3..8e35bb8 100644
--- a/mesonbuild/mdist.py
+++ b/mesonbuild/mdist.py
@@ -223,7 +223,9 @@ class GitDist(Dist):
class HgDist(Dist):
def have_dirty_index(self) -> bool:
'''Check whether there are uncommitted changes in hg'''
- out = subprocess.check_output(['hg', '-R', self.src_root, 'summary'])
+ env = os.environ.copy()
+ env['LC_ALL'] = 'C'
+ out = subprocess.check_output(['hg', '-R', self.src_root, 'summary'], env=env)
return b'commit: (clean)' not in out
def create_dist(self, archives: T.List[str]) -> T.List[str]: