scripts/functions: Fix CT_ExtractGit function.
Change CT_ExtractGit so that it clones the repository, instead of just
symlinking it. After cloning, any given ref is checked out, or if no
ref is given, the HEAD of the repository is checked out.
This makes CT_Extract behave similar for git repositories as it does
for tarballs, so that it for example can be used for passing glibc-ports
as a git repository.
Signed-off-by: "Esben Haabendal" <esben.haabendal@prevas.dk>
[yann.morin.1998@anciens.enib.fr: fix incomplete var rename]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
4 # This scripts generates either a choice or a menuconfig
5 # with the specified entries.
9 # gen_in_frags.sh choice <out-file> <label> <config-prefix> <base-dir> <conditionals> entry [entry...]
11 # generate a menuconfig:
12 # gen_in_frags.sh menu <out-file> <label> <config-prefix> <base-dir> entry [entry...]
16 # put the generated choice/menuconfig into that file
17 # for choices, it acts as the base bname of the file, the secondary
18 # parts (the .in.2) are put in out-file.2
21 # name for the entries family
22 # eg. Architecture, Kernel...
25 # prefix for the choice entries
29 # base directory containing config files
30 # eg. config/arch, config/kernel...
32 # conditionals (valid only for choice)
33 # generate backend conditionals if Y/y, don't if anything else
34 # if 'Y' (or 'y'), a dependency on the backen mode will be added
38 # a list of entry/ies toadd to the choice/menuconfig
41 # linux cygwin mingw32 solaris...
44 #------------------------------------------------------------------------------
51 local cfg_prefix="${3}"
55 local file entry _entry
59 printf '# %s menu\n' "${label}"
60 printf '# Generated file, do not edit!!!\n'
62 printf 'choice GEN_CHOICE_%s\n' "${cfg_prefix}"
64 printf ' prompt "%s"\n' "${label}"
66 for entry in "${@}"; do
67 file="${base_dir}/${entry}.in"
68 _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
69 printf 'config %s_%s\n' "${cfg_prefix}" "${_entry}"
71 printf ' prompt "%s"\n' "${entry}"
72 if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
73 printf ' depends on %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
75 "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
76 "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
77 if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
79 "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
85 for entry in "${@}"; do
86 file="${base_dir}/${entry}.in"
87 _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
89 if [ "${cond}" = "Y" -o "${cond}" = "y" ]; then
90 printf 'config %s_%s_AVAILABLE\n' "${cfg_prefix}" "${_entry}"
92 printf ' default y if'
93 printf ' BACKEND_%s = "%s"' "${cfg_prefix}" "${entry}"
94 printf ' || BACKEND_%s = ""' "${cfg_prefix}"
95 printf ' || ! BACKEND\n'
97 printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
98 printf 'config %s\n' "${cfg_prefix}"
99 printf ' default "%s" if %s_%s\n' "${entry}" "${cfg_prefix}" "${_entry}"
100 printf 'source "%s"\n' "${file}"
104 # Generate the part-2
105 exec >"${out_file}.2"
106 printf '# %s second part options\n' "${label}"
107 printf '# Generated file, do not edit!!!\n'
108 for entry in "${@}"; do
109 file="${base_dir}/${entry}.in"
110 _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
111 if [ -f "${file}.2" ]; then
113 printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
114 printf 'comment "%s other options"\n' "${entry}"
115 printf 'source "%s.2"\n' "${file}"
121 # Generate a menuconfig
122 # See above for usage
124 local out_file="${1}"
126 local cfg_prefix="${3}"
127 local base_dir="${4}"
129 local file entry _entry
131 # GEnerate the menuconfig
133 printf '# %s menu\n' "${label}"
134 printf '# Generated file, do not edit!!!\n'
136 for entry in "${@}"; do
137 file="${base_dir}/${entry}.in"
138 _entry=$(printf '%s\n' "${entry}" |"${sed}" -r -s -e 's/[-.+]/_/g;')
139 printf 'menuconfig %s_%s\n' "${cfg_prefix}" "${_entry}"
141 printf ' prompt "%s"\n' "${entry}"
142 "${sed}" -r -e '/^## depends on /!d; s/^## / /;' ${file} 2>/dev/null
143 "${sed}" -r -e '/^## select /!d; s/^## / /;' ${file} 2>/dev/null
144 if "${grep}" -E '^## help' ${file} >/dev/null 2>&1; then
146 "${sed}" -r -e '/^## help ?/!d; s/^## help ?/ /;' ${file} 2>/dev/null
149 printf 'if %s_%s\n' "${cfg_prefix}" "${_entry}"
150 printf 'source "%s"\n' "${file}"