diff mbox

[2,of,2] scripts/functions: change a debug info for custom tarballs

Message ID 40af5e881617b6109c34.1367666988@NX5000
State New
Headers show

Commit Message

Jerzy Grzegorek May 4, 2013, 11:29 a.m. UTC
# HG changeset patch
# User "Jerzy Grzegorek" <jerzy.grzegorek@trzebnica.net>
# Date 1367665576 -7200
# Node ID 40af5e881617b6109c34f1d084bba3041e3c240e
# Parent  722db80eb1f5c5189699ae471a52c78366dccf78
scripts/functions: change a debug info for custom tarballs

Signed-off-by: Jerzy Grzegorek <jerzy.grzegorek@trzebnica.net>


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

Patch

diff -r 722db80eb1f5 -r 40af5e881617 scripts/functions
--- a/scripts/functions	Sat May 04 13:04:29 2013 +0200
+++ b/scripts/functions	Sat May 04 13:06:16 2013 +0200
@@ -587,6 +587,25 @@ 
     fi
 }
 
+# This function checks if we work with custom tarball
+# and if yes, changes debug info; for example:
+# from  linux-3.4  to  linux-custom
+# Usage: CT_CheckCustom <basename> <check>
+# or     CT_CheckCustom <basename>
+CT_CheckCustom() {
+    local basename="$1"
+
+    case "${basename}" in
+        linux-*) if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
+		     if [ "$#" == 2 ]; then return 1; fi
+                     basename='linux-custom'
+                 fi
+                 ;;
+    esac
+
+    if [ "$#" == 1 ]; then echo "${basename}"; fi
+}
+
 # This function tries to retrieve a tarball form a local directory
 # Usage: CT_GetLocal <basename> [.extension]
 CT_GetLocal() {
@@ -601,15 +620,18 @@ 
     fi
 
     if [ -n "${CT_LOCAL_TARBALLS_DIR}" ]; then
-        CT_DoLog DEBUG "Trying to retrieve an already downloaded copy of '${basename}'"
+        CT_DoLog DEBUG "Trying to retrieve an already downloaded copy of '$( CT_CheckCustom ${basename} )'"
         # We'd rather have a bzip2'ed tarball, then gzipped tarball, plain tarball,
         # or, as a failover, a file without extension.
         for ext in ${first_ext} $(CT_DoListTarballExt) ''; do
             CT_DoLog DEBUG "Trying '${CT_LOCAL_TARBALLS_DIR}/${basename}${ext}'"
             if [ -r "${CT_LOCAL_TARBALLS_DIR}/${basename}${ext}" -a \
                  "${CT_FORCE_DOWNLOAD}" != "y" ]; then
-                CT_DoLog DEBUG "Got '${basename}' from local storage"
-                CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}${ext}" "${CT_TARBALLS_DIR}/${basename}${ext}"
+                CT_DoLog DEBUG "Got '$( CT_CheckCustom ${basename} )' from local storage"
+                # Do not create symlink for custom tarball here
+                if CT_CheckCustom "${basename}" "check"; then
+                     CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}${ext}" "${CT_TARBALLS_DIR}/${basename}${ext}"
+                fi
                 return 0
             fi
         done
@@ -645,6 +667,7 @@ 
             *.tar)          custom_name="${custom_name}.tar";;
             *)  CT_Abort "Unknown extension for custom tarball '${custom_location}'";;
         esac
+        CT_DoLog DEBUG "Already have '${custom_name}'"
         CT_DoExecLog DEBUG ln -sf "${custom_location}"  \
                                   "${CT_TARBALLS_DIR}/${custom_name}"
     else
@@ -661,11 +684,14 @@ 
     local basename="${file##*/}"
 
     if [ "${CT_SAVE_TARBALLS}" = "y" ]; then
-        CT_DoLog EXTRA "Saving '${basename}' to local storage"
+        CT_DoLog EXTRA "Saving '$( CT_CheckCustom ${basename} )' to local storage"
         # The file may already exist if downloads are forced: remove it first
         CT_DoExecLog ALL rm -f "${CT_LOCAL_TARBALLS_DIR}/${basename}"
         CT_DoExecLog ALL mv -f "${file}" "${CT_LOCAL_TARBALLS_DIR}"
-        CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}"
+        # Do not create symlink for custom tarball here
+        if CT_CheckCustom "${basename}" "check"; then
+            CT_DoExecLog ALL ln -s "${CT_LOCAL_TARBALLS_DIR}/${basename}" "${file}"
+        fi
     fi
 }
 
@@ -694,12 +720,12 @@ 
 
     # If not allowed to download from the Internet, don't
     if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
-        CT_DoLog DEBUG "Not allowed to download from the Internet, aborting ${file} download"
+        CT_DoLog DEBUG "Not allowed to download from the Internet, aborting '$( CT_CheckCustom ${file} )' download"
         return 1
     fi
 
     # Try to retrieve the file
-    CT_DoLog EXTRA "Retrieving '${file}'"
+    CT_DoLog EXTRA "Retrieving '$( CT_CheckCustom ${file} )'"
 
     # Add URLs on the LAN mirror
     if [ "${CT_USE_MIRROR}" = "y" ]; then
@@ -722,7 +748,7 @@ 
             CT_DoLog DEBUG "Trying '${url}/${file}${ext}'"
             CT_DoGetFile "${url}/${file}${ext}"
             if [ -f "${CT_TARBALLS_DIR}/${file}${ext}" ]; then
-                CT_DoLog DEBUG "Got '${file}' from the Internet"
+                CT_DoLog DEBUG "Got '$( CT_CheckCustom ${file} )' from the Internet"
                 CT_SaveLocal "${CT_TARBALLS_DIR}/${file}${ext}"
                 return 0
             fi