Revert "Change symlink_forest to use relative symlinks."
Revert submission 2673616-relativesymlinks-fix
Reason for revert: this breaks tests verified with go/abtd https://android-build.googleplex.com/builds/abtd/run/L36000000963001181
Bug: 300122962
Reverted changes: /q/submissionid:2673616-relativesymlinks-fix
Change-Id: I5a97c4fbe4df5727c0604a07137093d0f00c7776
diff --git a/bp2build/symlink_forest.go b/bp2build/symlink_forest.go
index a0c7e4c..5c33308 100644
--- a/bp2build/symlink_forest.go
+++ b/bp2build/symlink_forest.go
@@ -190,20 +190,10 @@
// Creates a symbolic link at dst pointing to src
func symlinkIntoForest(topdir, dst, src string) uint64 {
- // b/259191764 - Make all symlinks relative
- dst = shared.JoinPath(topdir, dst)
- src = shared.JoinPath(topdir, src)
- basePath := filepath.Dir(dst)
- var dstPath string
- srcPath, err := filepath.Rel(basePath, src)
- if err != nil {
- fmt.Fprintf(os.Stderr, "Failed to find relative path for symlinking: %s\n", err)
- os.Exit(1)
- } else {
- dstPath = dst
- }
+ srcPath := shared.JoinPath(topdir, src)
+ dstPath := shared.JoinPath(topdir, dst)
- // Check whether a symlink already exists.
+ // Check if a symlink already exists.
if dstInfo, err := os.Lstat(dstPath); err != nil {
if !os.IsNotExist(err) {
fmt.Fprintf(os.Stderr, "Failed to lstat '%s': %s", dst, err)