diff mbox

[Cbuildv2/get_source,02/17] lib/checkout.sh: checkout should use get_srcdir to reuse code.

Message ID 1382129579-5777-3-git-send-email-ryan.arnold@linaro.org
State New
Headers show

Commit Message

Ryan S. Arnold Oct. 18, 2013, 8:52 p.m. UTC
From: "Ryan S. Arnold" <ryan.arnold@linaro.org>

This also required that get_srcdir knows how to return the srcdir for
eglibc before it's installed and once it's installed (since it's actually
in the eglibc.git/libc directory.
---
 config/gcc.conf |  1 +
 lib/checkout.sh |  3 +--
 lib/common.sh   | 10 +++++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/config/gcc.conf b/config/gcc.conf
index 4cb72f8..0ef697f 100644
--- a/config/gcc.conf
+++ b/config/gcc.conf
@@ -7,6 +7,7 @@  installs="gcc"
 # This is a file that gets installed that is used to determine if the toolchain
 # component is already installed.
 latest="gcc.git/linaro-4.8-branch"
+#latest="gcc.git"
 
 # If yes, only static linking will be used
 static_link=no
diff --git a/lib/checkout.sh b/lib/checkout.sh
index 9842e69..919f8a1 100644
--- a/lib/checkout.sh
+++ b/lib/checkout.sh
@@ -32,8 +32,7 @@  checkout()
 	fi
     fi
 
-    local dir="`echo $1 | sed -e "s:^.*/${tool}.git:${tool}.git:" -e 's:/:-:'`"
-    local srcdir="${local_snapshots}/${dir}"
+    srcdir="`get_srcdir $1`"
     notice "Checking out sources for $1 into ${srcdir}"
 
     case $1 in
diff --git a/lib/common.sh b/lib/common.sh
index e4ec97d..e6655a1 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -482,7 +482,15 @@  get_srcdir()
 	eglibc*)
             # Eglibc has no top level configure script, it's in the libc
 	    # subdirectory.
-	    local srcdir="${srcdir}${branch}${revision}/libc"
+	    if test ! -d "${srcdir}${branch}${revision}/libc"; then
+		# If the directory does not yet exist the caller wants to know
+		# where to put the eglibc sources.
+		local srcdir="${srcdir}${branch}${revision}"
+	    else
+	    	# If the directory already exists the caller wants to know
+		# where the sources are.
+		local srcdir="${srcdir}${branch}${revision}/libc"
+	    fi
 	    ;;
 #	binutils*)
 #	    local srcdir="${srcdir}${branch}${revision}"