Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Kochan <vadim4j@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] utils/test-pkg: add option to enable NLS support
Date: Tue, 23 Jul 2019 20:23:36 +0300	[thread overview]
Message-ID: <20190723172336.24010-1-vadim4j@gmail.com> (raw)

Sometimes the package or specific configuration should be build with and
without NLS support which requires additionally append NLS related
config options or to have separate config file or use additional shell
script.

So add helper command line option which appends config file with NLS
options to the final config file which is now always stored in temporary
file before merge it with the default configuration (even only -c was
specified).

Signed-off-by: Vadim Kochan <vadim4j@gmail.com>
---
 utils/test-pkg | 34 ++++++++++++++++++++++++++--------
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/utils/test-pkg b/utils/test-pkg
index f3b34d5d0d..6a48e039e0 100755
--- a/utils/test-pkg
+++ b/utils/test-pkg
@@ -16,9 +16,10 @@ main() {
     local ret nb nb_skip nb_fail nb_legal nb_tc build_dir keep
     local -a toolchains
     local pkg_br_name
+    local with_nls
 
-    o='hakc:d:n:p:r:t:'
-    O='help,all,keep,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
+    o='hakNc:d:n:p:r:t:'
+    O='help,all,keep,with-nls,config-snippet:,build-dir:,number:,package:,random:,toolchains-csv:'
     opts="$(getopt -n "${my_name}" -o "${o}" -l "${O}" -- "${@}")"
     eval set -- "${opts}"
 
@@ -27,6 +28,7 @@ main() {
     keep=0
     number=0
     mode=0
+    with_nls=0
     toolchains_csv="${TOOLCHAINS_CSV}"
     while [ ${#} -gt 0 ]; do
         case "${1}" in
@@ -41,6 +43,10 @@ main() {
             ;;
         (-c|--config-snippet)
             cfg="${2}"; shift 2
+
+            if [ ! -e "${cfg}" ]; then
+                printf "error: %s: no such file\n" "${cfg}" >&2; exit 1
+            fi
             ;;
         (-d|--build-dir)
             dir="${2}"; shift 2
@@ -57,6 +63,9 @@ main() {
         (-t|--toolchains-csv)
             toolchains_csv="${2}"; shift 2
             ;;
+        (-N|--with-nls)
+            with_nls=1; shift 1
+            ;;
         (--)
             shift; break
             ;;
@@ -65,16 +74,21 @@ main() {
 
     trap do_clean INT TERM HUP EXIT
 
+    TEMP_CONF=$(mktemp /tmp/test-${pkg}-config.XXXXXX)
+
     if [ -z "${cfg}" ]; then
         pkg_br_name="${pkg//-/_}"
         pkg_br_name="BR2_PACKAGE_${pkg_br_name^^}"
-        TEMP_CONF=$(mktemp /tmp/test-${pkg}-config.XXXXXX)
-        echo "${pkg_br_name}=y" > ${TEMP_CONF}
-        cfg="${TEMP_CONF}"
+        echo "${pkg_br_name}=y" >> ${TEMP_CONF}
+    else
+        cat "${cfg}" >> ${TEMP_CONF}
     fi
-    if [ ! -e "${cfg}" ]; then
-        printf "error: %s: no such file\n" "${cfg}" >&2; exit 1
+
+    if [ ${with_nls} -eq 1 ]; then
+        echo "BR2_USE_WCHAR=y" >> ${TEMP_CONF}
+        echo "BR2_SYSTEM_ENABLE_NLS=y" >> ${TEMP_CONF}
     fi
+
     if [ -z "${dir}" ]; then
         dir="${HOME}/br-test-pkg"
     fi
@@ -127,7 +141,7 @@ main() {
         toolchain="$(basename "${toolchainconfig}" .config)"
         build_dir="${dir}/${toolchain}"
         printf "%40s [%*d/%d]: " "${toolchain}" ${#nb_tc} ${nb} ${nb_tc}
-        build_one "${build_dir}" "${toolchainconfig}" "${cfg}" "${pkg}" && ret=0 || ret=${?}
+        build_one "${build_dir}" "${toolchainconfig}" "${TEMP_CONF}" "${pkg}" && ret=0 || ret=${?}
         case ${ret} in
         (0) printf "OK\n";;
         (1) : $((nb_skip++)); printf "SKIPPED\n";;
@@ -251,6 +265,10 @@ Options:
         Note: the logfile and configuration is always retained, even without
         this option.
 
+    -N, --with-nls
+        Build with NLS support enabled. Required config options
+        for NLS support will be automatically enabled.
+
 Example:
 
     Testing libcec would require a config snippet that contains:
-- 
2.17.1

             reply	other threads:[~2019-07-23 17:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 17:23 Vadim Kochan [this message]
2019-07-23 22:13 ` [Buildroot] [PATCH 1/1] utils/test-pkg: add option to enable NLS support Thomas Petazzoni
2019-07-24  7:03   ` Vadim Kochan
2019-07-24  7:17     ` Thomas Petazzoni
2019-07-24  7:32       ` Vadim Kochan
2019-08-03  8:22 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723172336.24010-1-vadim4j@gmail.com \
    --to=vadim4j@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox