ImportError: No module named hgdemandimport when building
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox-esr78 fixed, firefox81 wontfix, firefox82 wontfix, firefox83 fixed)
People
(Reporter: tnikkel, Assigned: glandium)
References
(Blocks 1 open bug, Regression)
Details
(Keywords: regression)
Attachments
(2 files)
|
47 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-esr78+
|
Details | Review |
|
47 bytes,
text/x-phabricator-request
|
Details | Review |
0:02.81 checking for Mercurial version...
0:02.81 DEBUG: Executing: /usr/local/bin/hg --version
0:02.81 DEBUG: The command returned non-zero exit status 1.
0:02.81 DEBUG: Its error output was:
0:02.81 DEBUG: | Traceback (most recent call last):
0:02.81 DEBUG: | File "/usr/local/bin/hg", line 30, in <module>
0:02.81 DEBUG: | from hgdemandimport import tracing
0:02.81 DEBUG: | ImportError: No module named hgdemandimport
0:02.81 ERROR: Command /usr/local/bin/hg --version failed with exit status 1.
0:02.86 *** Fix above errors and then restart with "./mach build"
0:02.86 make: *** [configure] Error 1
This is on macos.
Bisected to https://hg.mozilla.org/mozilla-central/rev/91f4934e4063 bug 1654457
I took the steps at https://bugzilla.mozilla.org/show_bug.cgi?id=1669934#c2 but that didn't fix it. I've run mach bootstrap as well.
| Assignee | ||
Comment 1•6 years ago
|
||
I can reproduce on a changeset before bug 1654457, and the reason is this hunk in bug 1656993: https://phabricator.services.mozilla.com/D85916#change-AuXbO8dwkvCc
It seems this hunk should be removed, but I also don't know why Ricky added it.
Updated•6 years ago
|
| Reporter | ||
Comment 2•6 years ago
•
|
||
I removed those lines from python/mozbuild/mozbuild/controller/building.py and I still get the same error building. (I repeated the steps https://bugzilla.mozilla.org/show_bug.cgi?id=1669934#c2 just to be sure) Perhaps you are reproducing a different issue (since I bisected it to the specific changeset mentioned)?
| Assignee | ||
Comment 3•6 years ago
|
||
(In reply to Timothy Nikkel (:tnikkel) from comment #2)
I removed those lines from python/mozbuild/mozbuild/controller/building.py and I still get the same error building. (I repeated the steps https://bugzilla.mozilla.org/show_bug.cgi?id=1669934#c2 just to be sure) Perhaps you are reproducing a different issue (since I bisected it to the specific changeset mentioned)?
I bet running /usr/local/bin/hg --version fails with the same error, then.
| Reporter | ||
Comment 4•6 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #3)
(In reply to Timothy Nikkel (:tnikkel) from comment #2)
I removed those lines from python/mozbuild/mozbuild/controller/building.py and I still get the same error building. (I repeated the steps https://bugzilla.mozilla.org/show_bug.cgi?id=1669934#c2 just to be sure) Perhaps you are reproducing a different issue (since I bisected it to the specific changeset mentioned)?
I bet running
/usr/local/bin/hg --versionfails with the same error, then.
It runs fine actually. I checked that before filing and double checked just now.
| Assignee | ||
Comment 5•6 years ago
|
||
So, what I reproduced in comment 1 is a different variant when the hashbang for hg is e.g. /usr/bin/env python, and does point to the building.py hunk. Timothy's variant, though, was reproducible on my MBP when installing mercurial as a python2 app instead of python3, and the problem happens because of PYTHONEXECUTABLE being set in https://searchfox.org/mozilla-central/source/build/moz.configure/init.configure#365
| Assignee | ||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Comment 8•6 years ago
|
||
Set release status flags based on info from the regressing bug 1656993
Updated•6 years ago
|
Comment 9•6 years ago
|
||
The idea was to enable us to do this. Basically, in that patch, it became a little more error-prone to do the "are we in the virtualenv right now?" check, and the version of the code that exists in that function right now (where we try to import mozfile and switch on whether the import succeeded) is the version of that check that works the best that I was able to find.
Two thoughts:
-
If the use of
ImportErrorin this way is problematic we can just add an@imports(_from='six.moves.builtins', _import='ImportError'), which is probably what I "should" have done in the first place tbh. -
Uh, why does this "work"? Looking at it with fresh eyes, this is obviously wrong, we're not supposed to import stuff directly in
configure. Little surprised that this isn't unconditionally broken and that theconfigurelint still passes.
| Assignee | ||
Comment 10•6 years ago
|
||
(In reply to Ricky Stewart from comment #9)
The idea was to enable us to do this.
How is it related to https://phabricator.services.mozilla.com/D85916#change-AuXbO8dwkvCc ?
| Assignee | ||
Comment 11•6 years ago
|
||
Oh I see what's going on, the link is not showing the right thing... sigh... I meant to link the building.py change.
| Assignee | ||
Comment 12•6 years ago
|
||
Although unrelated to this bug...
(In reply to Ricky Stewart from comment #9)
- Uh, why does this "work"? Looking at it with fresh eyes, this is obviously wrong, we're not supposed to import stuff directly in
configure.
It doesn't work. If you look what code path is taken, it's the except ImportError, but if you inspect the error, it's this one: https://searchfox.org/mozilla-central/rev/165e8d8f80c02605c2f3e89c5de462abfce91c32/python/mozbuild/mozbuild/configure/__init__.py#249
| Assignee | ||
Updated•6 years ago
|
Comment 13•6 years ago
|
||
Oh I see what's going on, the link is not showing the right thing... sigh... I meant to link the building.py change.
Okay, I've been playing with this a bit and I have no idea what this was meant to do. I assume it's an unnecessary artifact given how long I was working on this patch. We can delete it (and if something breaks we can deal with the fallout, TBH it's my bad for not commenting this code).
It doesn't work. If you look what code path is taken, it's the except ImportError, but if you inspect the error, it's this one: https://searchfox.org/mozilla-central/rev/165e8d8f80c02605c2f3e89c5de462abfce91c32/python/mozbuild/mozbuild/configure/__init__.py#249
Yes, this is what I was expecting would be the case. That should be fixed.
Comment 14•6 years ago
|
||
Comment 15•6 years ago
|
||
The try: import mozfile; except ImportError: ... thing was completely broken since it unconditionally triggered this exception. The MOZBUILD_VIRTUALENV thing should work now, so just use that as a signal for whether we're already in the virtualenv instead.
Also delete some PATH munging in building.py, which I think should be unnecessary after we make the above change.
Comment 16•6 years ago
|
||
| bugherder | ||
Updated•6 years ago
|
Comment 17•6 years ago
|
||
Comment 18•6 years ago
|
||
| bugherder | ||
Updated•6 years ago
|
| Assignee | ||
Comment 19•5 years ago
|
||
Ricky's landing should have fixed the remaining things I left the bug open for.
Updated•5 years ago
|
Updated•5 years ago
|
Comment 20•5 years ago
|
||
Comment on attachment 9180637 [details]
Bug 1670167 - Unset PYTHONEXECUTABLE once python configure has been reexecuted in the virtualenv.
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: Resolves build-breaking regression from 1654457.
- User impact if declined: Builds will fail unless 1654457 is also declined
- Fix Landed on Version: 83
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Build patch
- String or UUID changes made by this patch:
Updated•5 years ago
|
Comment 21•5 years ago
|
||
Comment on attachment 9180796 [details]
Bug 1670167 - Fix janky Python 3 logic in configure from bug 1656993
I don't think this is needed since bug 1656993 wasn't uplifted to ESR78. It has conflicts anyway.
Comment 22•5 years ago
|
||
Comment on attachment 9180637 [details]
Bug 1670167 - Unset PYTHONEXECUTABLE once python configure has been reexecuted in the virtualenv.
Approved for 78.8esr.
Comment 23•5 years ago
|
||
| bugherder uplift | ||
Comment 24•5 years ago
|
||
That makes sense, thanks!
Updated•5 years ago
|
Description
•