#1136 Patch for bootstrap.fan

tcolar Fri 2 Jul 2010

The bootstrap.fan script always fails on my machine(linux)

Continue with these settings? [y|n] y
hg clone http://hg.fantom.org/repos/fan-1.0 /home/thibautc/fan
abort: destination '/home/thibautc/fan/' already exists

Basically hg clone don't want to create a folder that already exists, but the way the script was made, it was being creating first - and needed it to exits as the working directory, so couldn't just skip the creation step.

Here is a replacement for the hgPull method of bootstrap.fan with which it works (both clone and pull):

Void hgPull()
{
  if (skipPull) return

  // clone or pull+update
  if(devHome.plus(`.hg/`).exists)
    runCmd(["hg", "pull", "-u", hgRepo], devHome)
  else
    runCmd(["hg", "clone", hgRepo, devHome.osPath], devHome.parent)
}

Void runCmd(Str[] cmd, File workDir)
{
  echo("")
  echo(cmd.join(" "))
  r := Process(cmd, workDir).run.join
  if (r != 0) fatal("could not hg clone/pull repo")
}

tcolar Fri 2 Jul 2010

Also while on that topic: Even though I have swt.jar in lib/java/ext/linux-x86_64/swt.jar, and I can run the FWT examples, the bootsrap fails because it can't find the SWT java classes ... I guess classloader for fan runtime and bootsrip aren't the same ??

I had to copy swt.jar in JDK_HOME/jre/lib/ext/ to make it work.

brian Fri 2 Jul 2010

Not sure I follow why setting the working directory fixes that (I suspect I put that create dir to make it work on Windows or OS X). But I pushed your patch. If anyone has trouble with that change let me know.

tcolar Fri 2 Jul 2010

The way the code WAS, it was using devHome as the workDir of the Process.

If devHome existed hg clone would fail, but if devHome did NOT exist, the process would fail because the work dir did not exists.

hg clone creates the dir, and for hg pull bootsrap.fan just checked that the dir exists, so there should be no need to ever create it manually.

Login or Signup to reply.