bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

Allow using mach with comm-central after bug 840588

RESOLVED FIXED

Status

Firefox Build System
Mach Core
RESOLVED FIXED
5 years ago
5 months ago

People

(Reporter: InvisibleSmiley, Assigned: mbrubeck)

Tracking

Trunk

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

5 years ago
Since bug 840588, starting mach from the root of comm-central checkout results in the following error message:

Could not run mach: No mach source directory found

This is because there is no "mach" in comm-central, only under "mozilla" which is automatically created by comm-central's client.py.

Maybe we could simply create a "mach" wrapper script at the root of the comm-central repository, doing "exec mozilla/mach $@" or something like that.

Comment 1

5 years ago
Try copying the mach from m-c into c-c and change the path to look for source to include 'mozilla/'.
I copied the mach from m-c to c-c root, and did these changes:
-    mach_path = os.path.join(dir_path, "mozilla/build/mach_bootstrap.py")
+    mach_path = os.path.join(dir_path, "build/mach_bootstrap.py")
     if os.path.isfile(mach_path):
-        mach = load_mach(os.path.join(dir_path, "mozilla"))
+        mach = load_mach(dir_path)

Then calling ./mach in c-c the build runs, but I get:

 0:15.03 configure: error: --enable-application value not recognized (mail/build.mk does not exist).
 0:15.03 *** Fix above errors and then restart with               "/Applications/Xcode.app/Contents/Developer/usr/bin/make -f client.mk build"
 0:15.03 make[2]: *** [configure] Error 1
 0:15.03 make[1]: *** [/Users/kewisch/mozilla/comm-central/mozilla/objdir-tb/Makefile] Error 2
 0:15.03 make: *** [build] Error 2


Looks like its cwd is mozilla/
(Reporter)

Comment 3

5 years ago
Philipp: Same with me (with suite instead of mail). I didn't see how I could change the start path from the wrapper script (so that c-c's configure would be called instead of m-c's) without breaking mach's bootstrapping.

BTW it is enough to add the following line above the mach_path assignment:
    dir_path = os.path.join(dir_path, "mozilla")
since the original dir_path is not needed anymore afterwards.
Forget any previous changes, the trick is to add a custom bootstrap function that calls:

 mach.load_commands_from_file(os.path.join(topsrcdir, "mozilla", path))

mach.main.Mach() needs to be called with the real topsrcdir, but the commands need to be loaded from the mozila subdir.

For fixing this bug I'd probably prefer a more global solution that allows using the mozilla mach directly, but it should be quite easy to create a custom boostrap function in a copy that is in the comm-central repo.
(Assignee)

Comment 5

5 years ago
Created attachment 722362 [details] [diff] [review]
mozilla-central patch

This patch adds an optional mozilla_dir argument to the mozilla-central mach_bootstrap file, for cases where the mozilla directory is not the topsrcdir.
Assignee: nobody → mbrubeck
Status: NEW → ASSIGNED
Attachment #722362 - Flags: review?(gps)
(Assignee)

Comment 6

5 years ago
Created attachment 722363 [details] [diff] [review]
comm-central patch

This adds a mach_bootstrap file to comm-central/build which in turn loads the mozilla/build/mach_bootstrap file.
Attachment #722363 - Flags: review?(bugspam.Callek)

Comment 7

5 years ago
Comment on attachment 722362 [details] [diff] [review]
mozilla-central patch

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

Short and elegant - I like it!
Attachment #722362 - Flags: review?(gps) → review+
Comment on attachment 722363 [details] [diff] [review]
comm-central patch

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

I know nothing about mach, so I'm going to punt review to gps, while not technically a c-c build peer his review will be fine here
Attachment #722363 - Flags: review?(bugspam.Callek) → review?(gps)

Comment 9

5 years ago
Comment on attachment 722363 [details] [diff] [review]
comm-central patch

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

Did you also chmod +x make.py? I was noticing that a few files in comm-central are missing the execute bit. I'm pretty sure this is one of them.
Attachment #722363 - Flags: review?(gps) → review+
(Assignee)

Comment 10

5 years ago
(In reply to Gregory Szorc [:gps] from comment #9)
> Did you also chmod +x make.py? I was noticing that a few files in
> comm-central are missing the execute bit. I'm pretty sure this is one of
> them.

Sorry, I couldn't figure out how to get Mercurial to pick up permission changes on my Windows box.  I'll that for someone to do in a separate bug...

http://hg.mozilla.org/comm-central/rev/4c46112cb677
https://hg.mozilla.org/mozilla-central/rev/0e7639e3bdfb
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
(Assignee)

Comment 12

5 years ago
Follow-up fix for 'make check' error on comm-central:
http://hg.mozilla.org/comm-central/rev/d4e20bfa3cce
(In reply to Matt Brubeck (:mbrubeck) from comment #10)
> Sorry, I couldn't figure out how to get Mercurial to pick up permission
> changes on my Windows box.  I'll that for someone to do in a separate bug...

Yea, thats a problem. You have to use a unix based OS for mercurial to notice chmod changes to existing files. You *might* be able to cheat with some MQ manual munging, but its been a while since I tried that so can't recall if it works.

Updated

5 months ago
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.