Closed Bug 1390772 Opened 7 years ago Closed 7 years ago

bootstrap.py clones mozilla-unified to specified path without creating subdirectory

Categories

(Firefox Build System :: General, defect)

defect
Not set
major

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: arai, Assigned: arai)

References

Details

Attachments

(1 file)

Steps to reproduce:
  1. run bootstrap.py
  2. answer "~/" to the following prompt

> If you would like to clone the canonical Mercurial repository, please
> enter the destination path below.
> 
> (If you prefer to use Git, leave this blank.)
> 
> Destination directory for Mercurial clone (leave empty to not clone):

Actual result:
  it clones mozilla-unified to ~/
  so user get ~/browser etc

Expected result:
  it clones mozilla-unified to ~/mozilla-unified
  or warn if the specified directory exists and not-empty

it's hard to figure out the path asked in the promplt *should* contain the directory for the repository itself.
and it's really hard to recover once it clones into pre-existing not-empty directory.
gps, can I have your opinion about the expected solution, whether adding mozilla-unified to the given path, or warn if the directory exists and not-empty.

IMO, adding more explanation to the prompt is nice to have, but not a sufficient fix.
Flags: needinfo?(gps)
$ hg clone https://hg.mozilla.org/mozilla-unified gecko
abort: destination 'gecko' is not empty
$ git clone hg::https://hg.mozilla.org/mozilla-unified gecko
fatal: destination path 'gecko' already exists and is not an empty directory.

I think you've got your answer there. Whatever bootstrap is doing to do its clone, it shouldn't do it if the directory is not empty.
Flags: needinfo?(gps)
thanks :)

so the remaining design concern is that what to do when the directory is not empty.
it would be nice to allow user to re-enter the path, or offer adding mozilla-unified or something and clone,
instead of just aborting clone and continue.
Assignee: nobody → arai.unmht
Status: NEW → ASSIGNED
Modified it to do the following:
  1. ask the dest path
  2. abort if dest == ''
  3. if dest doesn't exist, clone there
  4. if dest is not a directory, ask again (goto 1)
  5. if dest is a directory:
    5.a. if there's mozilla-unified inside it, ask again (because we cannot fallback) (goto 1)
    5.b. if there's no mozilla-unified inside it, ask whether clone to mozilla-unified, or enter again, or abort cloning

I'll post prompt log in the next comment
Attachment #8897780 - Flags: review?(mh+mozilla)
== case 1 ==

If you would like to clone the canonical Mercurial repository, please
enter the destination path below.

(If you prefer to use Git, leave this blank.)

Destination directory for Mercurial clone (leave empty to not clone): ~/
ERROR! Destination directory '/Users/arai/' is not empty.

Would you like to clone to '/Users/arai/mozilla-unified'?

  1. Yes
  2. No, let me enter another path
  3. No, stop cloning

Please enter your reply: 2
Destination directory for Mercurial clone (leave empty to not clone): ~/.hgrc

ERROR! Destination '/Users/arai/.hgrc' exists but is not a directory.

Destination directory for Mercurial clone (leave empty to not clone): ~/projects/tmp

ERROR! Destination directory '/Users/arai/projects/tmp' is not empty.

Destination directory for Mercurial clone (leave empty to not clone): ~/projects/tmp/xxx
ERROR! Destination directory '/Users/arai/projects/tmp/xxx' is not empty.

Would you like to clone to '/Users/arai/projects/tmp/xxx/mozilla-unified'?

  1. Yes
  2. No, let me enter another path
  3. No, stop cloning

Please enter your reply: 1
Cloning Firefox Mercurial repository to /Users/arai/projects/tmp/xxx/mozilla-unified
pulling from https://hg.mozilla.org/mozilla-unified
...

== case 2 ==

If you would like to clone the canonical Mercurial repository, please
enter the destination path below.

(If you prefer to use Git, leave this blank.)

Destination directory for Mercurial clone (leave empty to not clone): ~/
ERROR! Destination directory '/Users/arai/' is not empty.

Would you like to clone to '/Users/arai/mozilla-unified'?

  1. Yes
  2. No, let me enter another path
  3. No, stop cloning

Please enter your reply: 3

Source code can be obtained by running

    hg clone https://hg.mozilla.org/mozilla-unified

Or, if you prefer Git, you should install git-cinnabar, and follow the
instruction here to clone from the Mercurial repository:

    https://github.com/glandium/git-cinnabar/wiki/Mozilla:-A-git-workflow-for-Gecko-development

Or, if you really prefer vanilla flavor Git:

    git clone https://github.com/mozilla/gecko-dev.git


Installing Stylo packages requires a checkout of mozilla-central. Once you
have such a checkout, please re-run `./mach bootstrap` from the checkout
directory.
Comment on attachment 8897780 [details] [diff] [review]
Check the emptiness of the destination directory for clone.

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

302 gps
Attachment #8897780 - Flags: review?(mh+mozilla) → review?(gps)
Comment on attachment 8897780 [details] [diff] [review]
Check the emptiness of the destination directory for clone.

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

This seems reasonable!
Attachment #8897780 - Flags: review?(gps) → review+
Pushed by arai_a@mac.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/adb7e5939899
Check the emptiness of the destination directory for clone. r=gps
https://hg.mozilla.org/integration/mozilla-inbound/rev/adb7e593989999424e9161a5a20f418edced90bd
Bug 1390772 - Check the emptiness of the destination directory for clone. r=gps
https://hg.mozilla.org/mozilla-central/rev/adb7e5939899
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
Depends on: 1535242
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: