public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0 of 2] Add support for retrieving needed custom tarballs
@ 2013-05-04 11:30 Jerzy Grzegorek
  2013-05-04 11:30 ` [PATCH 2 of 2] scripts/functions: change a debug info for " Jerzy Grzegorek
  2013-05-04 11:30 ` [PATCH 1 of 2] kernel/linux: add a check for existance of linux-custom tarball Jerzy Grzegorek
  0 siblings, 2 replies; 3+ messages in thread
From: Jerzy Grzegorek @ 2013-05-04 11:30 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

After selecting CT_KERNEL_LINUX_CUSTOM kernel configuration item,
softlink in function scripts/functions:CT_GetCustom() is created
and if linux custom tarball does not locally exist, this leads
subsequently to extracting error.

These patches:
1) Check if linux custom tarball locally exists
2) If does not exist, retrieve it
3) Change its debug info
   for example: from  linux-3.4  to  linux-custom

Currently there is not possible to choose custom version for other
tarballs: gdb, uClibc, newlib, gcc, binutils.
They all call function - scripts/functions:CT_GetCustom()

Regards,

Jerzy



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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1 of 2] kernel/linux: add a check for existance of linux-custom tarball
  2013-05-04 11:30 [PATCH 0 of 2] Add support for retrieving needed custom tarballs Jerzy Grzegorek
  2013-05-04 11:30 ` [PATCH 2 of 2] scripts/functions: change a debug info for " Jerzy Grzegorek
@ 2013-05-04 11:30 ` Jerzy Grzegorek
  1 sibling, 0 replies; 3+ messages in thread
From: Jerzy Grzegorek @ 2013-05-04 11:30 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

# HG changeset patch
# User "Jerzy Grzegorek" <jerzy.grzegorek@trzebnica.net>
# Date 1367665469 -7200
# Node ID 722db80eb1f5c5189699ae471a52c78366dccf78
# Parent  285b83c60e29fe0b733404b22cfd743b926d47ad
kernel/linux: add a check for existance of linux-custom tarball

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

diff -r 285b83c60e29 -r 722db80eb1f5 scripts/build/kernel/linux.sh
--- a/scripts/build/kernel/linux.sh	Fri May 03 15:36:11 2013 +0000
+++ b/scripts/build/kernel/linux.sh	Sat May 04 13:04:29 2013 +0200
@@ -23,37 +23,50 @@
     local custom_name
     local rel_dir
     local korg_base mirror_base
+    local kernel_version
 
     if [ "${CT_KERNEL_LINUX_USE_CUSTOM_HEADERS}" = "y"  ]; then
         return 0
     fi
 
     if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
+        # linux-custom
+        # example: /dir/linux-3.4.tar.xz -> 3.4.tar.xz
+        kernel_version="${CT_KERNEL_LINUX_CUSTOM_LOCATION##*-}"
+        # example: 3.4.tar.xz -> 3.4.tar
+        kernel_version="${kernel_version%.*}"
+        # example: 3.4.tar -> 3.4
+        kernel_version="${kernel_version%.*}"
+    else
+        kernel_version="${CT_KERNEL_VERSION}"
+    fi
+
+    case "${kernel_version}" in
+        2.6.*.*|3.*.*)
+            # 4-part versions (for 2.6 stables and long-terms), and
+            # 3-part versions (for 3.x.y stables and long-terms),
+            # we need to trash the last digit
+            k_ver="${kernel_version%.*}"
+            ;;
+        2.6.*|3.*)
+            # 3-part version (for 2.6.x initial releases), and 2-part
+            # versions (for 3.x initial releases), use all of it
+            k_ver="${kernel_version}"
+            ;;
+    esac
+    case "${kernel_version}" in
+        2.6.*)  rel_dir=v2.6;;
+        3.*)    rel_dir=v3.x;;
+    esac
+    korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
+    CT_GetFile "linux-${kernel_version}"            \
+               "${korg_base}"                       \
+               "${korg_base}/longterm/v${k_ver}"    \
+               "${korg_base}/longterm"
+
+    if [ "${CT_KERNEL_LINUX_CUSTOM}" = "y" ]; then
         CT_GetCustom "linux" "${CT_KERNEL_VERSION}"     \
                      "${CT_KERNEL_LINUX_CUSTOM_LOCATION}"
-    else # Not a custom tarball
-        case "${CT_KERNEL_VERSION}" in
-            2.6.*.*|3.*.*)
-                # 4-part versions (for 2.6 stables and long-terms), and
-                # 3-part versions (for 3.x.y stables and long-terms),
-                # we need to trash the last digit
-                k_ver="${CT_KERNEL_VERSION%.*}"
-                ;;
-            2.6.*|3.*)
-                # 3-part version (for 2.6.x initial releases), and 2-part
-                # versions (for 3.x initial releases), use all of it
-                k_ver="${CT_KERNEL_VERSION}"
-                ;;
-        esac
-        case "${CT_KERNEL_VERSION}" in
-            2.6.*)  rel_dir=v2.6;;
-            3.*)    rel_dir=v3.x;;
-        esac
-        korg_base="http://ftp.kernel.org/pub/linux/kernel/${rel_dir}"
-        CT_GetFile "linux-${CT_KERNEL_VERSION}"         \
-                   "${korg_base}"                       \
-                   "${korg_base}/longterm/v${k_ver}"    \
-                   "${korg_base}/longterm"
     fi
 }
 

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2 of 2] scripts/functions: change a debug info for custom tarballs
  2013-05-04 11:30 [PATCH 0 of 2] Add support for retrieving needed custom tarballs Jerzy Grzegorek
@ 2013-05-04 11:30 ` Jerzy Grzegorek
  2013-05-04 11:30 ` [PATCH 1 of 2] kernel/linux: add a check for existance of linux-custom tarball Jerzy Grzegorek
  1 sibling, 0 replies; 3+ messages in thread
From: Jerzy Grzegorek @ 2013-05-04 11:30 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

# 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>

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

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-05-04 11:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-04 11:30 [PATCH 0 of 2] Add support for retrieving needed custom tarballs Jerzy Grzegorek
2013-05-04 11:30 ` [PATCH 2 of 2] scripts/functions: change a debug info for " Jerzy Grzegorek
2013-05-04 11:30 ` [PATCH 1 of 2] kernel/linux: add a check for existance of linux-custom tarball Jerzy Grzegorek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).