glibc: properly handle internal addons
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon May 30 23:05:28 2011 +0200 (2011-05-30)
changeset 2496cc9b84a83b34
parent 2495 98b02f85db29
child 2497 ac4c006c48e4
glibc: properly handle internal addons

Some addons are bundled with glibc/eglibc, so we should not try to
download and extract them.

This is done as thus:
- at download time:
- if the add-on download fails, keep going;
- at extract time:
- if the addon is present in the source tree, ignore it;
- if the addon is missing in the source tree:
- if the archive is present, extract it;
- if the archive is missing, bail out.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/libc/eglibc.sh
scripts/build/libc/glibc-eglibc.sh-common
scripts/build/libc/glibc.sh
     1.1 --- a/scripts/build/libc/eglibc.sh	Tue May 31 00:20:44 2011 +0200
     1.2 +++ b/scripts/build/libc/eglibc.sh	Mon May 30 23:05:28 2011 +0200
     1.3 @@ -26,9 +26,17 @@
     1.4                "${CT_EGLIBC_REVISION:-HEAD}"
     1.5  
     1.6      for addon in $(do_libc_add_ons_list " "); do
     1.7 -        CT_GetSVN "eglibc-${addon}-${CT_LIBC_VERSION}"  \
     1.8 -                  "${svn_base}/${addon}"                \
     1.9 -                  "${CT_EGLIBC_REVISION:-HEAD}"
    1.10 +        # NPTL addon is not to be downloaded, in any case
    1.11 +        [ "${addon}" = "nptl" ] && continue || true
    1.12 +        if ! CT_GetSVN "eglibc-${addon}-${CT_LIBC_VERSION}" \
    1.13 +                       "${svn_base}/${addon}"               \
    1.14 +                       "${CT_EGLIBC_REVISION:-HEAD}"
    1.15 +        then
    1.16 +            # Some add-ons are bundled with the main sources
    1.17 +            # so failure to download them is expected
    1.18 +            CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
    1.19 +            CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
    1.20 +        fi
    1.21      done
    1.22  }
    1.23  
     2.1 --- a/scripts/build/libc/glibc-eglibc.sh-common	Tue May 31 00:20:44 2011 +0200
     2.2 +++ b/scripts/build/libc/glibc-eglibc.sh-common	Mon May 30 23:05:28 2011 +0200
     2.3 @@ -11,8 +11,13 @@
     2.4  
     2.5      # Extract the add-opns
     2.6      for addon in $(do_libc_add_ons_list " "); do
     2.7 -        # NPTL addon is not to be extracted, in any case
     2.8 -        [ "${addon}" = "nptl" ] && continue || true
     2.9 +        # If the addon was bundled with the main archive, we do not
    2.10 +        # need to extract it. Worse, if we were to try to extract
    2.11 +        # it, we'd get an error.
    2.12 +        if [ -d "${addon}" ]; then
    2.13 +            CT_DoLog DEBUG "Add-on already present, spkipping extraction"
    2.14 +            continue
    2.15 +        fi
    2.16  
    2.17          CT_Extract nochdir "${CT_LIBC}-${addon}-${CT_LIBC_VERSION}"
    2.18  
     3.1 --- a/scripts/build/libc/glibc.sh	Tue May 31 00:20:44 2011 +0200
     3.2 +++ b/scripts/build/libc/glibc.sh	Mon May 30 23:05:28 2011 +0200
     3.3 @@ -27,12 +27,19 @@
     3.4  
     3.5      # C library addons
     3.6      for addon in "${addons_list[@]}"; do
     3.7 -        # NPTL addon is not to be downloaded, in any case
     3.8 -        [ "${addon}" = "nptl" ] && continue || true
     3.9 -        CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}"      \
    3.10 -                   {ftp,http}://ftp.gnu.org/gnu/glibc       \
    3.11 -                   ftp://gcc.gnu.org/pub/glibc/releases     \
    3.12 -                   ftp://gcc.gnu.org/pub/glibc/snapshots
    3.13 +        if ! CT_GetFile "glibc-${addon}-${CT_LIBC_VERSION}"     \
    3.14 +                        {ftp,http}://ftp.gnu.org/gnu/glibc      \
    3.15 +                        ftp://gcc.gnu.org/pub/glibc/releases    \
    3.16 +                        ftp://gcc.gnu.org/pub/glibc/snapshots
    3.17 +        then
    3.18 +            # Some add-ons are bundled with glibc, others are
    3.19 +            # bundled in their own tarball. Eg. NPTL is internal,
    3.20 +            # while LinuxThreads was external. Also, for old
    3.21 +            # versions of glibc, the libidn add-on was external,
    3.22 +            # but with version >=2.10, it is internal.
    3.23 +            CT_DoLog DEBUG "Addon '${addon}' could not be downloaded."
    3.24 +            CT_DoLog DEBUG "We'll see later if we can find it in the source tree"
    3.25 +        fi
    3.26      done
    3.27  
    3.28      return 0