From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7072EC433EF for ; Fri, 19 Nov 2021 04:37:13 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 946A661A8A for ; Fri, 19 Nov 2021 04:37:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 946A661A8A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5145982FCD; Fri, 19 Nov 2021 05:37:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="R8GjXqMr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9494D82FCF; Fri, 19 Nov 2021 05:37:08 +0100 (CET) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5116280615 for ; Fri, 19 Nov 2021 05:37:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=email2tema@gmail.com Received: by mail-pl1-x62d.google.com with SMTP id z6so5986500plk.6 for ; Thu, 18 Nov 2021 20:37:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u2nWKxqTDNCDoddC5Kdvctrsoecpbbl2kNJTWreOBUg=; b=R8GjXqMrtjrZFzF7bJneHXaCKyN9hVVSTWwMKI+IwqVdD1N/q2Uz1BP4Um+htxwRgE ghWZBtTXVF2K9h4hBZX+Nc4dZ9Pfb/8kfhSPZwUWmWbPJkZKu+B3VcPIpjCvHxsFyoRP VXwKjDNozPH77sul6yysR01uK9ueJ1KZv6zSUg5qul0l/9S/rCFFIhEdpYnlIFhHmryQ BtII92DxsDDCxA/eXY4IkhsBXdlDxRHXHPsU7X+GPJgdBr0f+bvdiDUNIAZGIKm7NqMH EOFcTUkA5/LT3RTQT2gIVXyzIEPNKzHUI8G0k7ckMilDF3lntRu2/EhVM8cjPS4jdaVB X1hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u2nWKxqTDNCDoddC5Kdvctrsoecpbbl2kNJTWreOBUg=; b=vKR7dzuXtDPDucSNCR73D9s3ZtlKQlWzYVaO1p3rlLyx89YtZ7XYc3HDjc637CSFbA SB0dCjPGk/EXw9rT3aRdyCiUUQpE1OWg/5vPKCXOEkQiyk6AhJDRq0c86BmKjS6Ffc08 yP2NaBqDyP57hHvmhjvOmyxkxrgvx0/ZJBy7OD3ndJMfD77TuhJzuqIP4qMdEsLZ8WFV K9K+9V1SVdHhJ1YAcExaz/ZF9S7pmORnULSA/UU3/jT3EymExuvxBxvHvSPWDDvUG/q2 pcyTS2JcqcVt2lwbT1qF442mlWrbzyHxfAhIEIJKIFkdmKNnEeqvmmJGd9++beOE4ieL M7tA== X-Gm-Message-State: AOAM532/kLLFV2ivYue5Jfl8VWjmvlv+ONnwMFPEaRyRWK8PT/NVz+SW 6P6ZnEgqJHMqltLSLJ856k8= X-Google-Smtp-Source: ABdhPJzzrNv+nbM+K+gjWpMEPHmhrNXJCCORfyD0BTm8gRDYTudmyr7zooAYZTvGxeEThzffRM/kxA== X-Received: by 2002:a17:902:a5c5:b0:143:c3cf:739b with SMTP id t5-20020a170902a5c500b00143c3cf739bmr49159519plq.9.1637296623749; Thu, 18 Nov 2021 20:37:03 -0800 (PST) Received: from localhost.localdomain ([2409:8929:1a0b:9314:3a1e:44db:1de0:ce09]) by smtp.gmail.com with ESMTPSA id u23sm1113089pfl.185.2021.11.18.20.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 20:37:03 -0800 (PST) From: Artem Lapkin X-Google-Original-From: Artem Lapkin To: sjg@chromium.org Cc: trini@konsulko.com, marek.behun@nic.cz, narmstrong@baylibre.com, twarren@nvidia.com, andre.przywara@arm.com, u-boot@lists.denx.de, u-boot-amlogic@groups.io, christianshewitt@gmail.com, art@khadas.com, nick@khadas.com, gouwa@khadas.com Subject: [PATCH v2 0/2] env: setenv add resolve value option Date: Fri, 19 Nov 2021 12:36:45 +0800 Message-Id: <20211119043647.1251416-1-art@khadas.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.35 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Add possibility setup env variable with additional resolving vars inside value. Usage examples: => setenv a hello; setenv b world; setenv c '${a} ${b}' => setenv -r d '${c}! ${a}...' => printenv d d=hello world! hello... /* internal usage example */ env_resolve("d", "${c}! ${a}..."); /* d="hello world! hello..." */ Artem Lapkin (2): env: setenv add resolve value option test: env: deep resolve value testing --- V2 changes: _ fix comments style _ add comment include/exports.h _ remake strcpy to strdup _ env_resolve minimize _ test added: test/py/tests/test_env.py: test_env_resovle --- cmd/nvedit.c | 43 ++++++++++++++++++++++++++++++++++++++- include/_exports.h | 1 + include/env.h | 11 ++++++++++ include/exports.h | 2 ++ test/py/tests/test_env.py | 24 ++++++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-) -- 2.25.1