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

Issue 5620045: code review 5620045: cmd/dist: new command (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by rsc
Modified:
13 years, 1 month ago
Reviewers:
CC:
golang-dev, adg, gri, bradfitz, brainman, dsymonds, iant, ality, frichter
Visibility:
Public.

Description

cmd/dist: new command dist is short for distribution. This is the new Go distribution tool. The plan is to replace the Makefiles with what amounts to 'go tool dist bootstrap', although it cannot be invoked like that since it is in charge of getting us to the point where we can build the go command. It will also add additional commands to replace bash scripts like test/run (go tool dist testrun), eventually eliminating our dependence on not just bash but all the Unix tools and all of cygwin. This is strong enough to build (cc *.c) and run (a.out bootstrap) to build not just the C libraries and tools but also the basic Go packages up to the bootstrap form of the go command (go_bootstrap). I've run it successfully on both Linux and Windows. This means that once we've switched to this tool in the build, we can delete the buildscripts. This tool is not nearly as nice as the go tool. There are many special cases that turn into simple if statements or tables in the code. Please forgive that. C does not enjoy the benefits that we designed into Go. I was planning to wait to do this until after Go 1, but the Windows builders are both broken due to a bug in either make or bash or both involving the parsing of quoted command arguments. Make thinks it is invoking quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c but bash (quietgcc is a bash script) thinks it is being invoked as quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c which obviously does not have the desired effect. Rather than fight these clumsy ports, I accelerated the schedule for the new tool. We should be completely off cygwin (using just the mingw gcc port, which is much more standalone) before Go 1. It is big for a single CL, and for that I apologize. I can cut it into separate CLs along file boundaries if people would prefer that.

Patch Set 1 #

Patch Set 2 : diff -r f79343c8a479 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r f79343c8a479 https://go.googlecode.com/hg/ #

Total comments: 53

Patch Set 4 : diff -r 1a7e26c156b8 https://go.googlecode.com/hg/ #

Total comments: 6

Patch Set 5 : diff -r 7b05b761af6c https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 99fcde03be70 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2850 lines, -0 lines) Patch
A src/cmd/dist/README View 1 2 3 1 chunk +45 lines, -0 lines 0 comments Download
A src/cmd/dist/a.h View 1 2 3 1 chunk +125 lines, -0 lines 0 comments Download
A src/cmd/dist/buf.c View 1 2 3 1 chunk +250 lines, -0 lines 0 comments Download
A src/cmd/dist/build.c View 1 2 3 1 chunk +916 lines, -0 lines 0 comments Download
A src/cmd/dist/buildgc.c View 1 1 chunk +106 lines, -0 lines 0 comments Download
A src/cmd/dist/main.c View 1 1 chunk +38 lines, -0 lines 0 comments Download
A src/cmd/dist/unix.c View 1 2 3 4 1 chunk +596 lines, -0 lines 0 comments Download
A src/cmd/dist/windows.c View 1 2 3 1 chunk +774 lines, -0 lines 0 comments Download

Messages

Total messages: 35
rsc
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 1 month ago (2012-02-01 23:25:07 UTC) #1
adg
In the CL description: s/^to build // http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/buf.c File src/cmd/dist/buf.c (right): http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/buf.c#newcode60 src/cmd/dist/buf.c:60: // bwritestr ...
13 years, 1 month ago (2012-02-02 00:02:37 UTC) #2
gri
http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README File src/cmd/dist/README (right): http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README#newcode1 src/cmd/dist/README:1: This program, dist, is the bootstrapping tool for the ...
13 years, 1 month ago (2012-02-02 00:35:56 UTC) #3
gri
PS: C is the lowest common denominator, I guess. I am all for this tool, ...
13 years, 1 month ago (2012-02-02 00:38:39 UTC) #4
bradfitz
Exciting. http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README File src/cmd/dist/README (right): http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README#newcode4 src/cmd/dist/README:4: to replace odd job previously done with shell ...
13 years, 1 month ago (2012-02-02 00:53:10 UTC) #5
brainman
You always find ways! Thank you, Russ. I am just reporting problems. Sorry. 1) building ...
13 years, 1 month ago (2012-02-02 01:06:23 UTC) #6
brainman
Why don't we write this program in Go? We could keep compiled binary in the ...
13 years, 1 month ago (2012-02-02 01:17:51 UTC) #7
dsymonds
On Thu, Feb 2, 2012 at 12:17 PM, <alex.brainman@gmail.com> wrote: > Why don't we write ...
13 years, 1 month ago (2012-02-02 01:34:42 UTC) #8
brainman
On 2012/02/02 01:34:42, dsymonds wrote: > > Because then you have a bootstrapping problem for ...
13 years, 1 month ago (2012-02-02 01:38:27 UTC) #9
iant
http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README File src/cmd/dist/README (right): http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README#newcode1 src/cmd/dist/README:1: This program, dist, is the bootstrapping tool for the ...
13 years, 1 month ago (2012-02-02 01:53:26 UTC) #10
brainman
As far as windows concerned. Perhaps builders mingw are out of date and can be ...
13 years, 1 month ago (2012-02-02 01:54:44 UTC) #11
ality
I can't express how great this is. I've written the Plan 9 support already and ...
13 years, 1 month ago (2012-02-02 13:07:43 UTC) #12
ality
https://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/build.c File src/cmd/dist/build.c (right): https://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/build.c#newcode378 src/cmd/dist/build.c:378: ".go", What about ".y"? How could this have worked ...
13 years, 1 month ago (2012-02-02 13:16:44 UTC) #13
rsc
On Thu, Feb 2, 2012 at 08:16, <ality@pbrane.org> wrote: > What about ".y"? How could ...
13 years, 1 month ago (2012-02-02 15:15:20 UTC) #14
rsc
Plan 9 is beyond the scope of this particular review. However, I would encourage you ...
13 years, 1 month ago (2012-02-02 15:17:25 UTC) #15
rsc
On Wed, Feb 1, 2012 at 19:38, Robert Griesemer <gri@golang.org> wrote: > PS: C is ...
13 years, 1 month ago (2012-02-02 15:22:12 UTC) #16
rsc
On Wed, Feb 1, 2012 at 20:06, <alex.brainman@gmail.com> wrote: > 1) building on linux/386 fails ...
13 years, 1 month ago (2012-02-02 15:24:55 UTC) #17
rsc
On Wed, Feb 1, 2012 at 20:17, <alex.brainman@gmail.com> wrote: > Why don't we write this ...
13 years, 1 month ago (2012-02-02 15:26:00 UTC) #18
rsc
On Wed, Feb 1, 2012 at 20:54, <alex.brainman@gmail.com> wrote: > As far as windows concerned. ...
13 years, 1 month ago (2012-02-02 15:32:11 UTC) #19
frichter
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684139(v=vs.85).aspx use GetProcAddress to check for the existence of IsWow64Process which is only present in ...
13 years, 1 month ago (2012-02-02 16:47:43 UTC) #20
frichter
Duh, "Note that this technique is not a reliable way to detect whether the operating ...
13 years, 1 month ago (2012-02-02 17:18:24 UTC) #21
ality
https://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/unix.c File src/cmd/dist/unix.c (right): https://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/unix.c#newcode151 src/cmd/dist/unix.c:151: char buf[MAXPATHLEN]; Should this be PATH_MAX? I never know ...
13 years, 1 month ago (2012-02-02 17:43:21 UTC) #22
rsc
PTAL On Wed, Feb 1, 2012 at 20:53, <iant@golang.org> wrote: > http://codereview.appspot.com/5620045/diff/4001/src/cmd/dist/README#newcode1 > src/cmd/dist/README:1: This ...
13 years, 1 month ago (2012-02-02 21:06:01 UTC) #23
rsc
Has anyone looked at this enough to LGTM it? Thanks.
13 years, 1 month ago (2012-02-02 23:10:55 UTC) #24
brainman
On 2012/02/02 15:24:55, rsc wrote: > ... If you can tell me how to figure ...
13 years, 1 month ago (2012-02-02 23:12:26 UTC) #25
brainman
Forgot to include http://jesusnjim.com/programming/common-compiler-defines.html. But you could google for more. Alex
13 years, 1 month ago (2012-02-02 23:14:14 UTC) #26
rsc
I don't want to look at the compiler, because sometimes people are running a compiler ...
13 years, 1 month ago (2012-02-02 23:17:16 UTC) #27
brainman
On 2012/02/02 23:17:16, rsc wrote: > I don't want to look at the compiler, because ...
13 years, 1 month ago (2012-02-02 23:32:03 UTC) #28
ality
Russ Cox <rsc@golang.org> once said: > Plan 9 is beyond the scope of this particular ...
13 years, 1 month ago (2012-02-02 23:38:33 UTC) #29
rsc
On Thu, Feb 2, 2012 at 18:32, <alex.brainman@gmail.com> wrote: > If you have Windows 64 ...
13 years, 1 month ago (2012-02-03 00:15:21 UTC) #30
brainman
https://codereview.appspot.com/5620045/diff/1007/src/cmd/dist/windows.c File src/cmd/dist/windows.c (right): https://codereview.appspot.com/5620045/diff/1007/src/cmd/dist/windows.c#newcode316 src/cmd/dist/windows.c:316: n = GetCurrentDirectory(0, nil); s/ry/ryW/ https://codereview.appspot.com/5620045/diff/1007/src/cmd/dist/windows.c#newcode363 src/cmd/dist/windows.c:363: return attr ...
13 years, 1 month ago (2012-02-03 00:17:23 UTC) #31
iant
LGTM This is going to be slower than running a parallel make, perhaps that won't ...
13 years, 1 month ago (2012-02-03 00:30:43 UTC) #32
rsc
On Thu, Feb 2, 2012 at 19:30, <iant@golang.org> wrote: > This is going to be ...
13 years, 1 month ago (2012-02-03 00:38:14 UTC) #33
rsc
On Thu, Feb 2, 2012 at 19:30, <iant@golang.org> wrote: > Why not just call strrchr? ...
13 years, 1 month ago (2012-02-03 00:38:55 UTC) #34
rsc
13 years, 1 month ago (2012-02-03 00:41:44 UTC) #35
*** Submitted as http://code.google.com/p/go/source/detail?r=20324e413be7 ***

cmd/dist: new command

dist is short for distribution.  This is the new Go distribution tool.

The plan is to replace the Makefiles with what amounts to
'go tool dist bootstrap', although it cannot be invoked like
that since it is in charge of getting us to the point where we
can build the go command.

It will also add additional commands to replace bash scripts
like test/run (go tool dist testrun), eventually eliminating our
dependence on not just bash but all the Unix tools and all
of cygwin.

This is strong enough to build (cc *.c) and run (a.out bootstrap)
to build not just the C libraries and tools but also the basic
Go packages up to the bootstrap form of the go command
(go_bootstrap).  I've run it successfully on both Linux and Windows.
This means that once we've switched to this tool in the build,
we can delete the buildscripts.

This tool is not nearly as nice as the go tool.  There are many
special cases that turn into simple if statements or tables in
the code.  Please forgive that.  C does not enjoy the benefits
that we designed into Go.

I was planning to wait to do this until after Go 1, but the
Windows builders are both broken due to a bug in either
make or bash or both involving the parsing of quoted command
arguments.  Make thinks it is invoking

        quietgcc -fno-common -I"c:/go/include" -ggdb -O2 -c foo.c

but bash (quietgcc is a bash script) thinks it is being invoked as

        quietgcc -fno-common '-Ic:/go/include -ggdb' -O2 -c foo.c

which obviously does not have the desired effect.  Rather than fight
these clumsy ports, I accelerated the schedule for the new tool.
We should be completely off cygwin (using just the mingw gcc port,
which is much more standalone) before Go 1.

It is big for a single CL, and for that I apologize.  I can cut it into
separate CLs along file boundaries if people would prefer that.

R=golang-dev, adg, gri, bradfitz, alex.brainman, dsymonds, iant, ality,
hcwfrichter
CC=golang-dev
http://codereview.appspot.com/5620045
Sign in to reply to this message.

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