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

RESOLVED FIXED in Firefox 57

Status

--
major
RESOLVED FIXED
a year ago
10 months ago

People

(Reporter: arai, Assigned: arai)

Tracking

Trunk
mozilla57

Firefox Tracking Flags

(firefox57 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

a year ago
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.
(Assignee)

Comment 1

a year ago
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)
(Assignee)

Comment 3

a year ago
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
(Assignee)

Comment 4

a year ago
Created attachment 8897780 [details] [diff] [review]
Check the emptiness of the destination directory for clone.

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)
(Assignee)

Comment 5

a year ago
== 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+

Comment 8

a year ago
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
(Assignee)

Comment 9

a year ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/adb7e593989999424e9161a5a20f418edced90bd
Bug 1390772 - Check the emptiness of the destination directory for clone. r=gps

Comment 10

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/adb7e5939899
Status: ASSIGNED → RESOLVED
Last Resolved: a year ago
status-firefox57: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Updated

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