mirror of
https://github.com/golang/go
synced 2024-11-25 16:57:58 -07:00
goinstall: add -clean flag
R=adg, rsc CC=golang-dev https://golang.org/cl/3821042
This commit is contained in:
parent
c22c6daca0
commit
ddc2710d69
@ -41,6 +41,7 @@ var (
|
|||||||
reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL)
|
reportToDashboard = flag.Bool("dashboard", true, "report public packages at "+dashboardURL)
|
||||||
logPkgs = flag.Bool("log", true, "log installed packages to $GOROOT/goinstall.log for use by -a")
|
logPkgs = flag.Bool("log", true, "log installed packages to $GOROOT/goinstall.log for use by -a")
|
||||||
update = flag.Bool("u", false, "update already-downloaded packages")
|
update = flag.Bool("u", false, "update already-downloaded packages")
|
||||||
|
clean = flag.Bool("clean", false, "clean the package directory before installing")
|
||||||
verbose = flag.Bool("v", false, "verbose")
|
verbose = flag.Bool("v", false, "verbose")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,18 +17,27 @@ import (
|
|||||||
// For non-local packages or packages without Makefiles,
|
// For non-local packages or packages without Makefiles,
|
||||||
// domake generates a standard Makefile and passes it
|
// domake generates a standard Makefile and passes it
|
||||||
// to make on standard input.
|
// to make on standard input.
|
||||||
func domake(dir, pkg string, local bool) os.Error {
|
func domake(dir, pkg string, local bool) (err os.Error) {
|
||||||
|
needMakefile := true
|
||||||
if local {
|
if local {
|
||||||
_, err := os.Stat(dir + "/Makefile")
|
_, err := os.Stat(dir + "/Makefile")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return run(dir, nil, "gomake", "install")
|
needMakefile = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
makefile, err := makeMakefile(dir, pkg)
|
cmd := []string{"gomake"}
|
||||||
if err != nil {
|
var makefile []byte
|
||||||
|
if needMakefile {
|
||||||
|
if makefile, err = makeMakefile(dir, pkg); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return run(dir, makefile, "gomake", "-f-", "install")
|
cmd = append(cmd, "-f-")
|
||||||
|
}
|
||||||
|
if *clean {
|
||||||
|
cmd = append(cmd, "clean")
|
||||||
|
}
|
||||||
|
cmd = append(cmd, "install")
|
||||||
|
return run(dir, makefile, cmd...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeMakefile computes the standard Makefile for the directory dir
|
// makeMakefile computes the standard Makefile for the directory dir
|
||||||
|
Loading…
Reference in New Issue
Block a user