common.sh: move get_variable to single user

We migrated all other users of this API to chromite.  Localize
this to the single caller left to get it out of common.sh.

BUG=None
TEST=CQ passes

Change-Id: Ic7329544dc91ac2195aa51445e9cc61e79cb03c9
Reviewed-on: https://chromium-review.googlesource.com/1759161
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh
index 67e7d60..9a43fda 100755
--- a/build_library/base_image_util.sh
+++ b/build_library/base_image_util.sh
@@ -114,11 +114,30 @@
   rm -r "${pkgs_out}"
 }
 
+# Load a single variable from a bash file.
+# $1 - Path to the file.
+# $2 - Variable to get.
+_get_variable() {
+  local filepath=$1
+  local variable=$2
+  local lockfile="${filepath}.lock"
+
+  if [[ -e "${filepath}" ]]; then
+    (
+      flock 201
+      . "${filepath}"
+      if [[ "${!variable+set}" == "set" ]]; then
+        echo "${!variable}"
+      fi
+    ) 201>"${lockfile}"
+  fi
+}
+
 install_libc() {
   root_fs_dir="$1"
   # We need to install libc manually from the cross toolchain.
   # TODO: Improve this? It would be ideal to use emerge to do this.
-  libc_version="$(get_variable "${BOARD_ROOT}/${SYSROOT_SETTINGS_FILE}" \
+  libc_version="$(_get_variable "${BOARD_ROOT}/${SYSROOT_SETTINGS_FILE}" \
     "LIBC_VERSION")"
   PKGDIR="/var/lib/portage/pkgs"
   local libc_atom="cross-${CHOST}/glibc-${libc_version}"
diff --git a/common.sh b/common.sh
index 2531e9a..1ca4d45 100644
--- a/common.sh
+++ b/common.sh
@@ -887,41 +887,6 @@
   print_time_elapsed ${run_time} ${cmd_base}
 }
 
-# Load a single variable from a bash file.
-# $1 - Path to the file.
-# $2 - Variable to get.
-get_variable() {
-  local filepath=$1
-  local variable=$2
-  local lockfile="${filepath}.lock"
-
-  if [[ -e "${filepath}" ]]; then
-    userowned_file "${lockfile}"
-    (
-      flock 201
-      . "${filepath}"
-      if [[ "${!variable+set}" == "set" ]]; then
-        echo "${!variable}"
-      fi
-    ) 201>"${lockfile}"
-  fi
-}
-
-# Creates a user owned file.
-# $1 - Path to the file.
-userowned_file() {
-  local filepath=$1
-
-  if [[ ! -w "${filepath}" ]]; then
-    cmds=(
-      "mkdir -p '$(dirname "${filepath}")'"
-      "touch '${filepath}'"
-      "chown ${USER} '${filepath}'"
-    )
-    sudo_multi "${cmds[@]}"
-  fi
-}
-
 # Load configuration files that allow board-specific overrides of default
 # functionality to be specified in overlays.
 # $1 - File to load.