diff mbox

[2,of,6] kernel/linux: Extract custom location function and use generic GetCustom

Message ID b6b1b07f7ab14184f457.1349849275@localhost.localdomain
State Superseded
Headers show

Commit Message

David Holsgrove Oct. 10, 2012, 6:07 a.m. UTC
# HG changeset patch
# User David Holsgrove <david.holsgrove@xilinx.com>
# Date 1349847853 -36000
# Node ID b6b1b07f7ab14184f457e907db6269057cdd6126
# Parent  54e6f8f3b141d3502e51e35cdda8aded03b597f4
kernel/linux: Extract custom location function and use generic GetCustom

Config options remain the same as before, just generalised to be used by other
components also


--
For unsubscribe information see http://sourceware.org/lists.html#faq

Comments

Yann E. MORIN Oct. 10, 2012, 10:25 p.m. UTC | #1
David, Bryan, All,

On Wednesday 10 October 2012 08:07:55 David Holsgrove wrote:
> # HG changeset patch
> # User David Holsgrove <david.holsgrove@xilinx.com>
> # Date 1349847853 -36000
> # Node ID b6b1b07f7ab14184f457e907db6269057cdd6126
> # Parent  54e6f8f3b141d3502e51e35cdda8aded03b597f4
> kernel/linux: Extract custom location function and use generic GetCustom

Nit-picking, but as you need to resend anyway with your SoB-line:

  kernel/linux: use generic custom infrastrcuture

  Config options remain the same as before, just generalised to be used
  by other components also.

  Signed-off-by: You. ;-)
 
> diff -r 54e6f8f3b141 -r b6b1b07f7ab1 scripts/build/kernel/linux.sh
> --- a/scripts/build/kernel/linux.sh	Thu Oct 04 13:26:14 2012 +1000
> +++ b/scripts/build/kernel/linux.sh	Wed Oct 10 15:44:13 2012 +1000
> @@ -29,23 +29,12 @@
[--SNIP--]
> +        CT_TestAndAbort "Custom linux: CT_CUSTOM_LOCATION_ROOT_DIR or CT_KERNEL_LINUX_CUSTOM_LOCATION must be set." \
> +        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"

Can't we do this check only once in the generic CT_GetCustom function,
instead or repeating it in every components?

> +        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
> +            CT_KERNEL_LINUX_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/linux"
>          fi

Ditto: can't we just pass the component's custom location string to
CT_GetCustom; then in CT_GetCustom, if the string is empty, use the
CT_CUSTOM_LOCATION_ROOT_DIR location, instead of repeating it everywher?

Then, you'd just need this one line:

> +        CT_GetCustom "linux-${CT_KERNEL_VERSION}" "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"

... which you be splitted as it is longer than 80 chars.

Regards,
Yann E. MORIN.
diff mbox

Patch

diff -r 54e6f8f3b141 -r b6b1b07f7ab1 scripts/build/kernel/linux.sh
--- a/scripts/build/kernel/linux.sh	Thu Oct 04 13:26:14 2012 +1000
+++ b/scripts/build/kernel/linux.sh	Wed Oct 10 15:44:13 2012 +1000
@@ -29,23 +29,12 @@ 
     fi
 
     if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
-        if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
-            # Wee need to know the custom tarball extension,
-            # so we can create a properly-named symlink, which
-            # we use later on in 'extract'
-            case "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" in
-                *.tar.bz2)      custom_name="linux-custom.tar.bz2";;
-                *.tar.gz|*.tgz) custom_name="linux-custom.tar.gz";;
-                *.tar)          custom_name="linux-custom.tar";;
-                *)  CT_Abort "Unknown extension for custom linux tarball '${CT_KERNEL_LINUX_CUSTOM_LOCATION}'";;
-            esac
-            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
-                                      "${CT_TARBALLS_DIR}/${custom_name}"
-        else
-            custom_name="linux-custom"
-            CT_DoExecLog DEBUG ln -sf "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"  \
-                                      "${CT_SRC_DIR}/${custom_name}"
+        CT_TestAndAbort "Custom linux: CT_CUSTOM_LOCATION_ROOT_DIR or CT_KERNEL_LINUX_CUSTOM_LOCATION must be set." \
+        -z "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
+        if [ -n "${CT_CUSTOM_LOCATION_ROOT_DIR}" -a -z "${CT_KERNEL_LINUX_CUSTOM_LOCATION}" ]; then
+            CT_KERNEL_LINUX_CUSTOM_LOCATION="${CT_CUSTOM_LOCATION_ROOT_DIR}/linux"
         fi
+        CT_GetCustom "linux-${CT_KERNEL_VERSION}" "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
     else # Not a custom tarball
         case "${CT_KERNEL_VERSION}" in
             2.6.*.*|3.*.*)