Closed Bug 1728194 Opened 3 years ago Closed 3 years ago

Bootstrap not upgrading mercurial extensions outside .mozbuild leads to misleading errors

Categories

(Developer Services :: Mercurial: configwizard, enhancement)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: jbauman, Assigned: sheehan)

References

Details

Attachments

(2 files)

Not realizing bootstrap installs its own version of the evolve extension, I had pointed my .hgrc to the one I installed via pip, like so:

evolve = /usr/local/lib/python2.7/site-packages/hgext3rd/evolve

As such, running mach bootstrap didn't upgrade it when it updated mercurial to 5.9, which is incompatible with hg-evolve 10.3.2. This led to errors that misleadingly implied other extensions like so:

** Unknown exception encountered with possibly-broken third-party extension "push-to-try" (version N/A)

These seems like a common enough footgun that it might be worth a warning, or offer to change the .hgrc config to point to the .mozbuild version.

See full discussion on Matrix #developers.

Assignee: nobody → sheehan
Component: Bootstrap Configuration → Mercurial: configwizard
Product: Firefox Build System → Developer Services

Currently when configwizard detects an evolve extension that is not
in the managed ~/.mozbuild directory, we take no action to update
or otherwise touch the extension for the user. This commit changes
this behaviour to instead print a small warning message, indicating
that we have detected an externally managed evolve that will require
manual intervention to update. We also leave instructions on how to
switch to an evolve extension managed by the setup wizard.

Pushed by cosheehan@mozilla.com:
https://hg.mozilla.org/hgcustom/version-control-tools/rev/a8f02f4aaa5e
configwizard: print a warning about an un-managed evolve extension r=mhentges,zeid

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Not sure what's going on here

I tried this out and the warning worked perfectly:

WARNING: your copy of the evolve extension is not managed by this wizard.
Please update evolve manually when upgrading your Mercurial version.

To allow this wizard to manage evolve on your behalf, remove `evolve` from
your hgrc files `extensions` section and re-run the wizard.

But when I removed the evolve section from my .hgrc and re-ran it, then answered Y to the prompt:

Would you like to enable the evolve extension? (Yn)  

I got

destination '/Users/jbauman/.mozbuild/evolve' is not empty
Could not clone the evolve extension for installation.
You can install evolve yourself with

  $ pip install --user hg-evolve

and then enable the extension via

  $ hg config -e

So I added to my .hgrc manually:

[extensions]
#evolve = /usr/local/lib/python2.7/site-packages/hgext3rd/evolve
evolve = /Users/jbauman/.mozbuild/evolve/hgext3rd/evolve

But afterward I got an error that is confusing me:

$ hg help -e evolve
Traceback (most recent call last):
  File "/usr/local/Cellar/mercurial/5.9/lib/python3.9/site-packages/mercurial/extensions.py", line 267, in _runextsetup
    extsetup(ui)
  File "/Users/jbauman/.mozbuild/evolve/hgext3rd/evolve/exthelper.py", line 182, in finalextsetup
    knownexts[ext] = e.cmdtable
AttributeError: module 'hgext.strip' has no attribute 'cmdtable'
*** failed to set up extension evolve: module 'hgext.strip' has no attribute 'cmdtable'
abort: no such help topic: evolve
(try 'hg help --keyword evolve')

I don't get the error when I switch back to my original evolve = /usr/local/lib/python2.7/site-packages/hgext3rd/evolve installation.

I also tried running bootstrap again after setting evolve = /Users/jbauman/.mozbuild/evolve/hgext3rd/evolve, and got an unexpected error (attached).

The fix for me was to move that directory away and run the wizard again, which led to a new clone which works.

Maybe it would be nice to change the wizard to be able to use a checkout that's already there, but not in the .hgrc? Seems like updating the .hgrc to point to it would be doable, but the mere presence of a too old evolve directory causes things to fail before it can even get there:

mach.util.UserError: Could not identify the root directory of your checkout! Are you running `mach bootstrap` in an hg or git clone?

  File "/Users/jbauman/src/mozilla-unified/python/mozboot/mozboot/mach_commands.py", line 47, in bootstrap
    bootstrapper.bootstrap(command_context.settings)
  File "/Users/jbauman/src/mozilla-unified/python/mozboot/mozboot/bootstrap.py", line 345, in bootstrap
    (checkout_type, checkout_root) = current_firefox_checkout(
  File "/Users/jbauman/src/mozilla-unified/python/mozboot/mozboot/bootstrap.py", line 595, in current_firefox_checkout
    raise UserError(
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: