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
pull/13490/head
Eli Schwartz 7 months ago committed by Dylan Baker
parent 077d540c10
commit a05b790d66
  1. 4
      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]:

Loading…
Cancel
Save