Patchwork [1,of,6] config+scripts: Extract CUSTOM / CUSTOM_LOCATION currently in linux.sh

login
register
mail settings
Submitter David Holsgrove
Date Oct. 10, 2012, 6:07 a.m.
Message ID <54e6f8f3b141d3502e51.1349849274@localhost.localdomain>
Download mbox | patch
Permalink /patch/190550/
State Superseded
Headers show

Comments

David Holsgrove - Oct. 10, 2012, 6:07 a.m.
# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1349321174 -36000
# Node ID 54e6f8f3b141d3502e51e35cdda8aded03b597f4
# Parent  43ace4bb005eef085437e3d4fbaef528ef0ef005
config+scripts: Extract CUSTOM / CUSTOM_LOCATION currently in linux.sh

Generalise in scripts/functions as GetCustom

Add CUSTOM_LOCATION_ROOT_DIR to config/paths.in as a root directory
which will be used if CUSTOM is selected as version, and no CUSTOM_LOCATION
given for a component.


--
For unsubscribe information see http://sourceware.org/lists.html#faq
Yann E. MORIN - Oct. 10, 2012, 10:19 p.m.
David, Bryan, All,

On Wednesday 10 October 2012 08:07:54 David Holsgrove wrote:
> config+scripts: Extract CUSTOM / CUSTOM_LOCATION currently in linux.sh

What about this commit log:

  scripts/functions: add a generic custom location infrastructure

  Add a generic custom location infrastructure (inspired by the one in
  kernel/linux) to allow the user to use custom tarballs or dorectories
  for any component.

  Signed-off-by: You.

[--SNIP--]
> diff -r 43ace4bb005e -r 54e6f8f3b141 config/global/paths.in
[--SNIP--]
> +config CUSTOM_LOCATION_ROOT_DIR
> +    string
> +    depends on EXPERIMENTAL
> +    prompt "directory containing custom source components"

Nit-picking: upper-case for first letter of first word.

Regards,
Yann E. MORIN.

Patch

diff -r 43ace4bb005e -r 54e6f8f3b141 config/global/paths.in
--- a/config/global/paths.in	Wed Sep 26 16:37:31 2012 +0200
+++ b/config/global/paths.in	Thu Oct 04 13:26:14 2012 +1000
@@ -60,6 +60,15 @@ 
 #      The reason you might also want to install elsewhere is if you are going
 #      to package your shinny new toolchain for distribution.
 
+
+config CUSTOM_LOCATION_ROOT_DIR
+    string
+    depends on EXPERIMENTAL
+    prompt "directory containing custom source components"
+    help
+      This is the path CT-NG will attempt to use as a root for locating
+      local copies of source components (CUSTOM_LOCATION_ROOT_DIR/component)
+
 config RM_RF_PREFIX_DIR
     bool
     prompt "|  Remove the prefix dir prior to building"
diff -r 43ace4bb005e -r 54e6f8f3b141 scripts/functions
--- a/scripts/functions	Wed Sep 26 16:37:31 2012 +0200
+++ b/scripts/functions	Thu Oct 04 13:26:14 2012 +1000
@@ -516,6 +516,32 @@ 
     return 1
 }
 
+# This function gets the custom source from either a tarball or directory
+# Usage: CT_GetCustom custom_name <custom_location>
+CT_GetCustom() {
+    local custom_name="$1"
+    local custom_location="$2"
+
+    if [ ! -d "${custom_location}" ]; then
+        # We need to know the custom tarball extension,
+        # so we can create a properly-named symlink, which
+        # we use later on in 'extract'
+        case "${custom_location}" in
+            *.tar.bz2)      custom_name="${custom_name}.tar.bz2";;
+            *.tar.gz|*.tgz) custom_name="${custom_name}.tar.gz";;
+            *.tar)          custom_name="${custom_name}.tar";;
+            *)  CT_Abort "Unknown extension for custom tarball '${custom_location}'";;
+        esac
+        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
+        CT_DoExecLog DEBUG ln -sf "${custom_location}"  \
+                                  "${CT_TARBALLS_DIR}/${custom_name}"
+    else
+        CT_DoLog EXTRA "Using '${custom_name}' from local storage"
+        CT_DoExecLog DEBUG ln -snf "${custom_location}"  \
+                                  "${CT_SRC_DIR}/${custom_name}"
+    fi
+}
+
 # This function saves the specified to local storage if possible,
 # and if so, symlinks it for later usage
 # Usage: CT_SaveLocal </full/path/file.name>