Closed Bug 1513775 Opened 5 years ago Closed 4 years ago

mach bootstrap on Fedora 29 fails to install mercurial

Categories

(Firefox Build System :: Bootstrap Configuration, defect)

defect
Not set
normal

Tracking

(firefox73 fixed)

RESOLVED FIXED
mozilla73
Tracking Status
firefox73 --- fixed

People

(Reporter: heycam, Assigned: kuleshovmail)

Details

Attachments

(2 files)

Part way through the mach bootstrap process on a fresh Fedora 29 installation, it failed to install mercurial:

<<<
Could not find Mercurial (hg) in the current shell's path. Try starting a new
shell and running the bootstrapper again.

You do not have Mercurial installed
Executing as root: sudo dnf update mercurial
Last metadata expiration check: 0:06:49 ago on Thu 13 Dec 2018 15:22:42 AEDT.
Package mercurial available, but not installed.
No match for argument: mercurial
Error: No packages marked for upgrade.
Error running mach:

    ['bootstrap']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

CalledProcessError: Command '[u'sudo', u'dnf', u'update', 'mercurial']' returned non-zero exit status 1

  File "/home/cam/z/central/python/mozboot/mozboot/mach_commands.py", line 43, in bootstrap
    bootstrapper.bootstrap()
  File "/home/cam/z/central/python/mozboot/mozboot/bootstrap.py", line 438, in bootstrap
    hg_installed, hg_modern = self.instance.ensure_mercurial_modern()
  File "/home/cam/z/central/python/mozboot/mozboot/base.py", line 542, in ensure_mercurial_modern
    if self.upgrade_mercurial(version) is False:
  File "/home/cam/z/central/python/mozboot/mozboot/centosfedora.py", line 136, in upgrade_mercurial
    self.dnf_update('mercurial')
  File "/home/cam/z/central/python/mozboot/mozboot/base.py", line 374, in dnf_update
    self.run_as_root(command)
  File "/home/cam/z/central/python/mozboot/mozboot/base.py", line 338, in run_as_root
    subprocess.check_call(command, stdin=sys.stdin)
  File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
>>>

This appears to be a mismatch between what the parent mozboot.base.BaseBootstrapper class and the CentOSFedoraBootstrapper subclass assume the upgrade_mercurial() method's responsibilities are.

Looking at "python/mozboot/mozboot/base.py", line 542, in ensure_mercurial_modern(): I'd guess the method assumes that the upgrade_mercurial() method not only updates Mercurial but also installs Mercurial if it is missing. It calls the upgrade_mercurial() method regardless of whether Mercurial is already installed and regardless of how it was installed.

The overridden method in CentOSFedoraBootstrapper always runs dnf update mercurial. It's assuming that Mercurial is already present and was installed via the package manager. It fails if neither of those are true, causing the error.

Fix Firefox bootstrap on Centos/Fedora

Attachment #9113171 - Flags: review?(cmanchester)
Comment on attachment 9113171 [details] [diff] [review]
replace dnf update with dnf install as other distro do it

>diff --git a/python/mozboot/mozboot/centosfedora.py b/python/mozboot/mozboot/centosfedora.py
>index a8b4c86a42ec..18adee32a7b1 100644
>--- a/python/mozboot/mozboot/centosfedora.py
>+++ b/python/mozboot/mozboot/centosfedora.py
>@@ -165,4 +165,4 @@ class CentOSFedoraBootstrapper(NasmInstall, NodeInstall, StyloInstall,
>         self.suggest_mobile_android_mozconfig(artifact_mode=True)
> 
>     def upgrade_mercurial(self, current):
>-        self.dnf_update('mercurial')
>+        self.dnf_install('mercurial')
Attachment #9113171 - Attachment description: firefox-bootstrap-fedora-install-mercurial.patch → Hello, here is the simple patch which replaces `dnf update` with `dnf install` as other systems do. Probably it would be better to rely on `current` variable there to check the installed version and try to execute `dnf update mercurial` there. The …
Attachment #9113171 - Attachment description: Hello, here is the simple patch which replaces `dnf update` with `dnf install` as other systems do. Probably it would be better to rely on `current` variable there to check the installed version and try to execute `dnf update mercurial` there. The → replace dnf update with dnf install as other distro do it

If Mercurial (hg) is not installed on a Centos/Fedora system, execution
of:

$ ./mach bootstrap

will be failed as the bootstrap script tries to execute:

dnf update mercurial

This commit replaces 'dnf update' with 'dnf install' command
to install but not upgrade mercurial version.

Assignee: nobody → kuleshovmail
Pushed by nfroyd@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/debcd50d8712
fix mach bootstrap on Fedora when mercurial is not installed r=froydnj
Comment on attachment 9113171 [details] [diff] [review]
replace dnf update with dnf install as other distro do it

Review of attachment 9113171 [details] [diff] [review]:
-----------------------------------------------------------------

It looks like this got moved to phabricator and already reviewed there.
Attachment #9113171 - Flags: review?(cmanchester)
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla73
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: