Make the code that is using execRoot paths use execRoot paths

Chipping away at making the big CL for #1262 smaller. Only runfiles paths
are different right now, so this makes getPathUnderExecRoot and getSourceRoot
return the same thing. Also corrected a couple places where
Label.EXTERNAL_PATH_PREFIX and Label.EXTERNAL_PACKAGE_NAME were being used
incorrectly.

--
MOS_MIGRATED_REVID=132671081
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
index a20ea18..905866f 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/PackageIdentifier.java
@@ -123,12 +123,16 @@
     return repository.getSourceRoot().getRelative(pkgName);
   }
 
+  public PathFragment getPathUnderExecRoot() {
+    return getSourceRoot();
+  }
+
   /**
    * Returns the runfiles/execRoot path for this repository (relative to the x.runfiles/main-repo/
    * directory).
    */
-  public PathFragment getPathUnderExecRoot() {
-    return getRepository().getPathUnderExecRoot().getRelative(getPackageFragment());
+  public PathFragment getRunfilesPath() {
+    return repository.getRunfilesPath().getRelative(pkgName);
   }
 
   public PackageIdentifier makeAbsolute() {
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
index 25332b3..ba0f6b4 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/RepositoryName.java
@@ -210,16 +210,24 @@
    */
   public PathFragment getSourceRoot() {
     return isDefault() || isMain()
+        ? PathFragment.EMPTY_FRAGMENT : Label.EXTERNAL_PACKAGE_NAME.getRelative(strippedName());
+  }
+
+  /**
+   * Returns the runfiles/execRoot path for this repository. If we don't know the name of this repo
+   * (i.e., it is in the main repository), return an empty path fragment.
+   */
+  public PathFragment getPathUnderExecRoot() {
+    return isDefault() || isMain()
         ? PathFragment.EMPTY_FRAGMENT
         : new PathFragment(Label.EXTERNAL_PATH_PREFIX).getRelative(strippedName());
   }
 
   /**
-   * Returns the runfiles/execRoot path for this repository (relative to the x.runfiles/main-repo/
-   * directory). If we don't know the name of this repo (i.e., it is in the main repository),
-   * return an empty path fragment.
+   * Returns the runfiles path relative to the x.runfiles/main-repo directory.
    */
-  public PathFragment getPathUnderExecRoot() {
+  // TODO(kchodorow): remove once execroot is reorg-ed.
+  public PathFragment getRunfilesPath() {
     return isDefault() || isMain()
         ? PathFragment.EMPTY_FRAGMENT : new PathFragment("..").getRelative(strippedName());
   }