Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(46)

Issue 11326043: Use pre-built jujud if found.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 9 months ago by thumper
Modified:
10 years, 9 months ago
Reviewers:
gz, mp+174918, fwereade
Visibility:
Public.

Description

Use pre-built jujud if found. Instead of rebuilding jujud everytime we want to upload some tools, try to find jujud next to the juju being executed. When we are uploading tools, we are running the juju command. The juju executable is normally (when we build it and in the package version) next to the jujud executable. So, what we do is start with os.Args[0] and try to find the full path for it. There are three situations here: 1. arg[0] is an absolute path, if so, return it 2. arg[0] is a relative path, if so, join it to the current working directory, clean that and return it 3. arg[0] is just the command, in which case, walk the path looking for an executable file that matches. Amazingly, there is no os.CopyFile, so you have to mangle it yourself. https://code.launchpad.net/~thumper/juju-core/find-jujud/+merge/174918 Requires: https://code.launchpad.net/~thumper/juju-core/local-provider-bootstrap/+merge/174913 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 14

Patch Set 2 : Use pre-built jujud if found. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+236 lines, -24 lines) Patch
A [revision details] View 1 1 chunk +2 lines, -0 lines 0 comments Download
M environs/localstorage/storage.go View 1 chunk +7 lines, -1 line 0 comments Download
M environs/localstorage/storage_test.go View 1 3 chunks +18 lines, -1 line 0 comments Download
M environs/tools/build.go View 1 4 chunks +106 lines, -15 lines 0 comments Download
A environs/tools/build_test.go View 1 1 chunk +93 lines, -0 lines 0 comments Download
M environs/tools/export_test.go View 1 1 chunk +2 lines, -0 lines 0 comments Download
M environs/tools/storage.go View 5 chunks +8 lines, -7 lines 0 comments Download

Messages

Total messages: 6
thumper
Please take a look.
10 years, 9 months ago (2013-07-16 04:25:46 UTC) #1
gz
LGTM https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go File environs/localstorage/storage.go (right): https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go#newcode95 environs/localstorage/storage.go:95: // struct so the Close method is not ...
10 years, 9 months ago (2013-07-16 09:43:00 UTC) #2
fwereade
LGTM with mgz's comments taken into account https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go File environs/localstorage/storage.go (right): https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go#newcode95 environs/localstorage/storage.go:95: // struct ...
10 years, 9 months ago (2013-07-16 11:09:50 UTC) #3
fwereade
https://codereview.appspot.com/11326043/diff/1/environs/tools/build.go File environs/tools/build.go (right): https://codereview.appspot.com/11326043/diff/1/environs/tools/build.go#newcode212 environs/tools/build.go:212: if err := copyExistingJujud(dir); err != nil { Actually, ...
10 years, 9 months ago (2013-07-16 11:21:32 UTC) #4
thumper
Working on writing extra tests now. https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go File environs/localstorage/storage.go (right): https://codereview.appspot.com/11326043/diff/1/environs/localstorage/storage.go#newcode95 environs/localstorage/storage.go:95: // struct so ...
10 years, 9 months ago (2013-07-17 01:02:31 UTC) #5
thumper
10 years, 9 months ago (2013-07-17 01:41:52 UTC) #6
Please take a look.

https://codereview.appspot.com/11326043/diff/1/environs/tools/build.go
File environs/tools/build.go (right):

https://codereview.appspot.com/11326043/diff/1/environs/tools/build.go#newcod...
environs/tools/build.go:112: func findExecutable(execFile string) (string,
error) {
On 2013/07/16 09:43:00, gz wrote:
> Would like some tests for this function.

Done.

https://codereview.appspot.com/11326043/diff/1/environs/tools/build.go#newcod...
environs/tools/build.go:161: // copy the file into the dir.
On 2013/07/16 09:43:00, gz wrote:
> I'd factor this out to a seperate function. Just 'cos go doesn't include it
> doesn't mean we can't reuse it.

I'll add a TODO.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b