If you pass a non-spec branch location to "mojo run" it raises a non-obvious error:
Traceback (most recent call last):
File "/usr/bin/mojo", line 9, in <module>
load_entry_point('mojo==0.1', 'console_scripts', 'mojo')()
File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 510, in main
run_with_args(args, ap)
File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 485, in run_with_args
args.func(args)
File "/usr/lib/python2.7/dist-packages/mojo/cli.py", line 261, in run_from_manifest
args.name, stage=stage, manifest_file=args.manifest_file)
File "/usr/lib/python2.7/dist-packages/mojo/__init__.py", line 465, in create_workspace
mkdirs(ws_path, self.owner)
File "/usr/lib/python2.7/dist-packages/mojo/utils.py", line 157, in mkdirs
raise OSError("Creation of directory failed: {}".format(path))
It should instead tell you that you've passed it a non-spec branch location, or one it doesn't understand.
This bug has been around since early revisions. Brad Crittenden's revno 120 started on the fix but had the order of operations wrong.
Two problems existed. One the args.spec_ url.rsplit( "/")[-1] was always broken for no trailing slash. And two, if there was a trailing slash the guessed project name superseded the MOJO_PROJECT variable.
Set the priority for acquiring the project name
1) From CLI with --project
2) From MOJO_PROJECT environment variable
3) Guess from the spec url and warn this is a guess
I am tempted to remove 3 altogether but it may be useful and now with better error handling it will be clear if that guess is incorrect.
lp:~thedac/mojo/non-spec-branch-location-fix