summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2017-11-19 08:10:53 (GMT)
committerAlexey Neyman <stilor@att.net>2017-11-20 05:50:28 (GMT)
commit63e91f4eba6fc9ba61be04eda3cc7fae19c827b8 (patch)
treea6dd34002a5704b115b4c464eebb32e6b04e6482
parent5e0d62fac62450c2527b6efaccbc5c5b6aef8c0e (diff)
A few fixes for showSamples
- Use fork's name, not the master package name - Allow to use a choice selector when printing a package - Consider complibs always present (they are, gcc does require gmp/...) Signed-off-by: Alexey Neyman <stilor@att.net>
-rwxr-xr-xbootstrap2
-rw-r--r--maintainer/kconfig-choice.template6
-rw-r--r--maintainer/kconfig-versions.template2
-rw-r--r--scripts/functions43
-rw-r--r--scripts/showSamples.sh94
5 files changed, 61 insertions, 86 deletions
diff --git a/bootstrap b/bootstrap
index 52b27ed..0a7cee0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -697,7 +697,7 @@ gen_selection()
local dir="${2}"
local label="${3}"
- msg "Generating ${dir}.in"
+ msg "Generating ${dir}.in (${type})"
exec >"${config_gen_dir}/${dir}.in"
info=( \
[dir]=${dir} \
diff --git a/maintainer/kconfig-choice.template b/maintainer/kconfig-choice.template
index b2ca217..ec66f74 100644
--- a/maintainer/kconfig-choice.template
+++ b/maintainer/kconfig-choice.template
@@ -25,6 +25,12 @@ config @@dir|@@
default "@@choice@@" if @@dir|@@_@@choice|@@
#!end-foreach
+config @@dir|@@_KSYM
+ string
+#!foreach choice
+ default "@@choice|@@" if @@dir|@@_@@choice|@@
+#!end-foreach
+
#!foreach choice
if @@dir|@@_@@choice|@@
source "config/@@dir@@/@@choice@@.in"
diff --git a/maintainer/kconfig-versions.template b/maintainer/kconfig-versions.template
index e4be903..37461b7 100644
--- a/maintainer/kconfig-versions.template
+++ b/maintainer/kconfig-versions.template
@@ -243,6 +243,8 @@ config @@fork|@@_VERSION
#!foreach version
default "@@ver@@" if @@fork|@@_V_@@ver_sel|@@
#!end-foreach
+ default "new" if @@fork|@@_VERY_NEW
+ default "old" if @@fork|@@_VERY_OLD
default "unknown"
#!if [ "@@#version@@" -gt 0 ]
diff --git a/scripts/functions b/scripts/functions
index 4dd5b7e..5910619 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -1,5 +1,6 @@
# -*- mode: sh; tab-width: 4 -*-
# vi: ts=4:sw=4:sts=4:et
+# vim: filetype=sh :
# This file contains some useful common functions
# Copyright 2007 Yann E. MORIN
# Licensed under the GPL v2. See COPYING in the root of this package
@@ -1891,6 +1892,10 @@ CT_PackageRun()
eval "local ${v}=\${CT_${use}_${v^^}}"
done
+ if [ -z "${pkg_name}" ]; then
+ CT_Abort "Internal ct-ng error: '${sym}' not defined, please report a bug"
+ fi
+
for v in archive_filename archive_dirname; do
# kconfig and shell have different quoting rules, so it seems impossible to make
# kconfig quote '$' properly for eval (i.e. not have it expanded when loading the
@@ -2214,24 +2219,34 @@ CT_GetPkgVersion()
eval "${2}=\"${rv}\""
}
-# Closure of a build version selector.
-CT_DoGetPkgBuildVersion()
-{
- if [ "${src_release}" = "y" ]; then
- build_version="${version}"
- elif [ -z "${devel_revision}" ]; then
- build_version="${devel_branch}"
- else
- build_version="${devel_revision}"
- fi
-}
-
# Get a package version selected to build. May return an empty string.
# Usage: CT_GetPkgBuildVersion PKG VAR
+# where PKG may refer to a specific package (e.g. GCC) or package choice
+# (e.g. LIBC).
CT_GetPkgBuildVersion()
{
+ local pkg="${1}"
+ local tmp
local build_version
- CT_PackageRun "${1}" CT_DoGetPkgBuildVersion
- eval "${2}=\"${build_version}\""
+ # If it is a choice selector, switch to whatever specific package it selects
+ eval "tmp=\${CT_${pkg}_KSYM}"
+ if [ -n "${tmp}" ]; then
+ pkg="${tmp}"
+ fi
+
+ __do_GetPkgBuildVersion() {
+ tmp="${pkg_name}-${version}"
+ if [ "${src_devel}" = "y" ]; then
+ tmp+="-${devel_vcs}"
+ if [ -n "${devel_revision}" ]; then
+ tmp+="-${devel_revision}"
+ fi
+ elif [ "${src_custom}" = "y" ]; then
+ tmp+="-custom"
+ fi
+ }
+
+ CT_PackageRun "${pkg}" __do_GetPkgBuildVersion
+ eval "${2}=\"${tmp}\""
}
diff --git a/scripts/showSamples.sh b/scripts/showSamples.sh
index 601aec3..fee0d44 100644
--- a/scripts/showSamples.sh
+++ b/scripts/showSamples.sh
@@ -15,22 +15,14 @@ export GREP_OPTIONS=
# Dummy version which is invoked from .config
CT_Mirrors() { :; }
-# Dump a package version by a package name.
-dump_pkg_version() {
- local name=$1
- local ksym=$( echo ${name} | ${awk} '{ print toupper($0) }' )
-
- CT_GetPkgBuildVersion "${ksym}" version
- printf "${version}"
-}
-
# Dump a short package description with a name and version in a format
# " <name>[-<version>]"
dump_pkg_desc() {
local name=$1
- local version=$( dump_pkg_version "$name" )
+ local show_version
- printf " ${name}${version:+-}${version}"
+ CT_GetPkgBuildVersion ${1} show_version
+ printf " %s" "${show_version}"
}
# Dump a single sample
@@ -44,28 +36,6 @@ dump_single_sample() {
local sample="$1"
. $(pwd)/.config.sample
- # libc needs some love
- # TBD after conversion of gen-kconfig to template, use CT_LIBC_USE as a selector for other variables
- # (i.e. whether to use CT_GLIBC_VERSION or CT_MUSL_VERSION)
- local libc_name="${CT_LIBC}"
- local libc_ver ksym
-
- ksym=${libc_name//[^0-9A-Za-z_]/_}
- ksym=${ksym^^}
- case ${ksym} in
- GLIBC|NEWLIB)
- if eval "[ \"\${CT_${ksym}_USE_LINARO}\" = y ]"; then
- ksym="${ksym}_LINARO"
- fi
- ;;
- UCLIBC)
- if [ "${CT_UCLIBC_USE_UCLIBC_NG_ORG}" = y ]; then
- ksym="${ksym}_NG"
- fi
- ;;
- esac
- CT_GetPkgBuildVersion "${ksym}" libc_ver
-
case "${sample}" in
current)
sample_type="l"
@@ -98,39 +68,21 @@ dump_single_sample() {
printf " %-*s : %s\n" ${width} "Host" "${CT_HOST}"
;;
esac
- # TBD currently only Linux is used. General handling for single-select (compiler/binutils/libc/os) and multi-select (debug/companions) components?
- printf " %-*s :" ${width} "OS" && dump_pkg_desc "${CT_KERNEL}" && printf "\n"
- if [ -n "${CT_GMP}" \
- -o -n "${CT_MPFR}" \
- -o -n "${CT_ISL}" \
- -o -n "${CT_CLOOG}" \
- -o -n "${CT_MPC}" \
- -o -n "${CT_LIBELF}" \
- -o -n "${CT_EXPAT}" \
- -o -n "${CT_NCURSES}" \
- -o -n "${CT_GMP_TARGET}" \
- -o -n "${CT_MPFR_TARGET}" \
- -o -n "${CT_ISL_TARGET}" \
- -o -n "${CT_CLOOG_TARGET}" \
- -o -n "${CT_MPC_TARGET}" \
- -o -n "${CT_LIBELF_TARGET}" \
- -o -n "${CT_EXPAT_TARGET}" \
- -o -n "${CT_NCURSES_TARGET}" \
- ]; then
- printf " %-*s :" ${width} "Companion libs"
- complibs=1
+ if [ "${CT_KERNEL}" != "bare-metal" ]; then
+ printf " %-*s :" ${width} "OS" && dump_pkg_desc KERNEL && printf "\n"
fi
- [ -z "${CT_GMP}" -a -z "${CT_GMP_TARGET}" ] || dump_pkg_desc "gmp"
- [ -z "${CT_MPFR}" -a -z "${CT_MPFR_TARGET}" ] || dump_pkg_desc "mpfr"
- [ -z "${CT_ISL}" -a -z "${CT_ISL_TARGET}" ] || dump_pkg_desc "isl"
- [ -z "${CT_CLOOG}" -a -z "${CT_CLOOG_TARGET}" ] || dump_pkg_desc "cloog"
- [ -z "${CT_MPC}" -a -z "${CT_MPC_TARGET}" ] || dump_pkg_desc "mpc"
- [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || dump_pkg_desc "libelf"
- [ -z "${CT_EXPAT}" -a -z "${CT_EXPAT_TARGET}" ] || dump_pkg_desc "expat"
- [ -z "${CT_NCURSES}" -a -z "${CT_NCURSES_TARGET}" ] || dump_pkg_desc "ncurses"
- [ -z "${complibs}" ] || printf "\n"
- printf " %-*s :" ${width} "binutils" && dump_pkg_desc "binutils" && printf "\n"
- printf " %-*s :" ${width} "Compilers" && dump_pkg_desc "${CT_CC}" && printf "\n"
+ printf " %-*s :" ${width} "Companion libs"
+ [ -z "${CT_GMP}" ] || dump_pkg_desc GMP
+ [ -z "${CT_MPFR}" ] || dump_pkg_desc MPFR
+ [ -z "${CT_ISL}" ] || dump_pkg_desc ISL
+ [ -z "${CT_CLOOG}" ] || dump_pkg_desc CLOOG
+ [ -z "${CT_MPC}" ] || dump_pkg_desc MPC
+ [ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || dump_pkg_desc LIBELF
+ [ -z "${CT_EXPAT}" -a -z "${CT_EXPAT_TARGET}" ] || dump_pkg_desc EXPAT
+ [ -z "${CT_NCURSES}" -a -z "${CT_NCURSES_TARGET}" ] || dump_pkg_desc NCURSES
+ printf "\n"
+ printf " %-*s :" ${width} "Binutils" && dump_pkg_desc BINUTILS && printf "\n"
+ printf " %-*s :" ${width} "Compilers" && dump_pkg_desc CC && printf "\n"
printf " %-*s : %s" ${width} "Languages" "C"
[ "${CT_CC_LANG_CXX}" = "y" ] && printf ",C++"
[ "${CT_CC_LANG_FORTRAN}" = "y" ] && printf ",Fortran"
@@ -141,12 +93,12 @@ dump_single_sample() {
[ "${CT_CC_LANG_GOLANG}" = "y" ] && printf ",Go"
[ -n "${CT_CC_LANG_OTHERS}" ] && printf ",${CT_CC_LANG_OTHERS}"
printf "\n"
- printf " %-*s : %s (threads: %s)\n" ${width} "C library" "${libc_name}${libc_ver:+-}${libc_ver}" "${CT_THREADS}"
+ printf " %-*s :" ${width} "C library" && dump_pkg_desc LIBC && printf " (threads: %s)\n" "${CT_THREADS}"
printf " %-*s :" ${width} "Tools"
- [ "${CT_DEBUG_DUMA}" ] && dump_pkg_desc "duma"
- [ "${CT_DEBUG_GDB}" ] && dump_pkg_desc "gdb"
- [ "${CT_DEBUG_LTRACE}" ] && dump_pkg_desc "ltrace"
- [ "${CT_DEBUG_STRACE}" ] && dump_pkg_desc "strace"
+ [ "${CT_DEBUG_DUMA}" ] && dump_pkg_desc DUMA
+ [ "${CT_DEBUG_GDB}" ] && dump_pkg_desc GDB
+ [ "${CT_DEBUG_LTRACE}" ] && dump_pkg_desc LTRACE
+ [ "${CT_DEBUG_STRACE}" ] && dump_pkg_desc STRACE
printf "\n"
fi
else
@@ -230,5 +182,5 @@ elif [ "${opt}" = "-W" ]; then
fi
for sample in "${@}"; do
- ( dump_single_sample ${opt} "${sample}" )
+ dump_single_sample ${opt} "${sample}"
done