aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2019-03-08 11:42:28 -0800
committerDan Willemsen <dwillemsen@google.com>2019-03-08 19:56:57 +0000
commit6b783c8391c70a12819750e9806a6930ae0cb8f7 (patch)
tree0419e4909265444077fe7c308e8e44a24416bd4d /cmd
parent8b2244fe280aec1c801293a8ee72273ec2be486a (diff)
downloadbuild_soong-6b783c8391c70a12819750e9806a6930ae0cb8f7.tar.gz
build_soong-6b783c8391c70a12819750e9806a6930ae0cb8f7.tar.bz2
build_soong-6b783c8391c70a12819750e9806a6930ae0cb8f7.zip
Fix recent builds with bad dangling symlinks
It appears that there's a bug in repo where when a linkfile is removed from the manifest, the symlink remains in the source tree. Cleaning this up needs to happen before we start scanning the source tree for Android.bp/Android.mk files, so this has to be done very early -- way before CleanSpec processing could handle it. Bug: https://bugs.chromium.org/p/gerrit/issues/detail?id=10583 Test: ln -s missing hardware/qcom/sdm710/Android.bp; m Change-Id: Ib68f2507ffe58ccdd9fbc88925f8a4f6150f2f7d
Diffstat (limited to 'cmd')
-rw-r--r--cmd/soong_ui/main.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index d6999c57..9f40e33e 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -132,6 +132,11 @@ func main() {
}
}
+ // Fix up the source tree due to a repo bug where it doesn't remove
+ // linkfiles that have been removed
+ fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.bp")
+ fixBadDanglingLink(buildCtx, "hardware/qcom/sdm710/Android.mk")
+
f := build.NewSourceFinder(buildCtx, config)
defer f.Shutdown()
build.FindSources(buildCtx, config, f)
@@ -160,6 +165,20 @@ func main() {
}
}
+func fixBadDanglingLink(ctx build.Context, name string) {
+ _, err := os.Lstat(name)
+ if err != nil {
+ return
+ }
+ _, err = os.Stat(name)
+ if os.IsNotExist(err) {
+ err = os.Remove(name)
+ if err != nil {
+ ctx.Fatalf("Failed to remove dangling link %q: %v", name, err)
+ }
+ }
+}
+
func dumpVar(ctx build.Context, config build.Config, args []string) {
flags := flag.NewFlagSet("dumpvar", flag.ExitOnError)
flags.Usage = func() {