Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux
Date: Fri, 23 Sep 2016 02:50:11
Message-Id: 20160922195004.37f418e4.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux by Kerin Millar
1 On Fri, 23 Sep 2016 03:22:25 +0100
2 Kerin Millar <kfm@×××××××××.net> wrote:
3
4 > Hi,
5 >
6 > The attached patch renders portage functional under WSL, as tested
7 > with the "current branch" of Windows 10. Further details can be found
8 > in the commit message.
9 >
10
11 commit fc706e5b21829cdeab2c40749639c4fceccd225a
12 Author: Kerin Millar <kfm@×××××××××.net>
13 Date: Fri Sep 23 01:55:10 2016 +0000
14
15 AbstractEbuildProcess: disable ipc_daemon under Windows Subsystem for Linux
16
17 As of Windows 10 build 14393, WSL is unable to support EbuildIpcDaemon
18 correctly. The presence of /dev/lxss - as a character device - indicates that we
19 are running under WSL, in which case the use of the daemon should be disabled.
20
21 Note that stat calls directed at /dev/lxss are currently doomed to fail with
22 EPERM. Thus, this specific error is also used as a means to detect WSL. Should
23 Microsoft render this device node accessible in future builds, WSL will still
24 be detected correctly.
25
26 diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
27 index 8bd30a6..7c8fc18 100644
28 --- a/pym/_emerge/AbstractEbuildProcess.py
29 +++ b/pym/_emerge/AbstractEbuildProcess.py
30 @@ -128,7 +128,17 @@ class AbstractEbuildProcess(SpawnProcess):
31 # since we're not displaying to a terminal anyway.
32 self.settings['NOCOLOR'] = 'true'
33
34 - if self._enable_ipc_daemon:
35 + # Determine whether we are running under WSL (Windows Subsystem for Linux).
36 + # Trying to stat /dev/lxss under WSL will always fail with EPERM (for now).
37 + running_wsl = False
38 + try:
39 + if platform.system() == 'Linux' and stat.S_ISCHR(os.stat('/dev/lxss')):
40
41
42 Using "in" comparisons is faster than doing == comparisons, even for a list or tuple of one length.
43 It also allows easier expansion of the qualifiers.
44
45 if platform.system() in ['Linux'] and ...
46
47
48 + running_wsl = True
49 + except OSError as e:
50 + if (e.errno == errno.EPERM):
51
52 Same for this one ^^
53
54
55 + running_wsl = True
56 +
57 + if self._enable_ipc_daemon and not running_wsl:
58 self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None)
59 if self.phase not in self._phases_without_builddir:
60 if 'PORTAGE_BUILDDIR_LOCKED' not in self.settings:
61
62 --
63 Brian Dolbec <dolsen>