From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 5/5] RFC: tegra: Convert to using environment files
Date: Tue, 29 Oct 2013 13:38:43 -0600 [thread overview]
Message-ID: <52700EC3.4090304@wwwdotorg.org> (raw)
In-Reply-To: <CAPnjgZ2tQAQcm4HCe9JUZ26-2wMZk=yi=JOBm=aiPyEdfyGRhA@mail.gmail.com>
On 10/28/2013 04:15 PM, Simon Glass wrote:
> Hi Stephen,
>
> On Mon, Oct 28, 2013 at 3:20 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>> On 10/28/2013 02:50 PM, Simon Glass wrote:
>>> Hi Stephen,
>>>
>>> On Mon, Oct 28, 2013 at 2:41 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>> On 10/28/2013 02:34 PM, Simon Glass wrote:
>>>>> Hi Stephen,
>>>>>
>>>>> On Mon, Oct 28, 2013 at 1:59 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>>>>>> On 10/25/2013 11:01 PM, Simon Glass wrote:
>>>>>>> This seems more intuitive that the current #define way of doing things.
>>>>>>> The resulting code is shorter, avoids the quoting and line continuation
>>>>>>> pain, and also improves the clumsy way that stdio variables are created:
>>
>>>>>>> diff --git a/board/nvidia/env/common.env b/board/nvidia/env/common.env
>>>>>>
>>>>>>> +bootcmd_mmc0=setenv devnum 0; run mmc_boot
>>>>>>> +bootcmd_mmc1=setenv devnum 1; run mmc_booxt
>>>>>>> +boot_targets+= mmc1 mmc0
>>>>>>
>>>>>> I still don't see why = needs no space before/after, but += needs no
>>>>>> space before, but a space after. That simply looks like a typo to me,
>>>>>> and I'd be inclined to fix it were I editing this file. If a sed script
>>>>>> can't handle more flexible white-space, perhaps use Python or perhaps
>>>>>> Perl instead?
>>>>>
>>>>> The old code was similar, in that it had a space after the quote.
>>>>>
>>>>> We need the string to contain "mmc0 mmc1 usb0 dhcp" or perhaps "mmc0
>>>>> mmc1". I chose to add a space at the start of each string, but
>>>>> certainly we need a space somewhere, or we get "mmc0mmc1usb0dhcp".
>>>>
>>>> Oh, I see. I thought the space was part of the += syntax, not the value.
>>>> Perhaps to make that more obvious, you could allow:
>>>>
>>>> # No space added to value
>>>> var+=value
>> ...
>>>> var += "value1 value2"
>>>>
>>>> # One space included at start of addition to value
>>>> var+=" value1 value2"
>>>> var+= " value1 value2"
>>>> var +=" value1 value2"
>>>> var += " value1 value2"
>>>
>>> I was deliberately trying to avoid using quotes, since then it is
>>> really hard when you actually mean 'quote'.
>>
>> Hmm. On the other hand, quoting is standard syntax in any scripting
>> language.
>>
>>> For example at present you can put this in an env script at present,
>>> but how would you do it if quotes are special?
>>
>> Just escape it; " goes around the string and \" or "" within the string.
>> This seems pretty common...
>
> Quoting quotes is currently needed for the header file. So how would
> my feature actually improve things?
>
> Between this and Wolfgang's \ at newline I am wondering if this
> feature will actually improve anything? It we are really going to
> insist on making the .env file like a C string then I'm not sure what
> we gain.
I guess I don't really see much wrong with the current header file
approach. The benefits this patch provide are the ability to use += and
omit the \0. Maintaining a more typical " and \ based quoting system
seem fine though. I guess you could avoid the need for \ by using either
shell-style here documents:
var += <<<ENDOFHERE
data
more data
ENDOFHERE
or Python-style triple-quotes:
var += """
data
more data"""
either of which would degenerate to allowing the following when
multi-line and leading/trailing spaces weren't required:
var += value
... although I like the idea of requiring quotes, thus making that:
var += "value"
prev parent reply other threads:[~2013-10-29 19:38 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-26 5:01 [U-Boot] [PATCH v3 1/5] sandbox: Support 'env import' and 'env export' Simon Glass
2013-10-26 5:01 ` [U-Boot] [PATCH v3 2/5] Make 'run' use run_command_list() instead of run_command() Simon Glass
2013-10-26 5:01 ` [U-Boot] [PATCH v3 3/5] Allow U-Boot scripts to be placed in a .env file Simon Glass
2013-10-26 20:26 ` Wolfgang Denk
2013-10-28 20:24 ` Simon Glass
2013-10-28 21:16 ` Wolfgang Denk
2013-10-28 22:22 ` Simon Glass
2013-10-28 23:52 ` Wolfgang Denk
2013-10-28 13:34 ` Otavio Salvador
2013-10-28 20:26 ` Simon Glass
2013-10-26 5:01 ` [U-Boot] [PATCH v3 4/5] env: Allow environment files to use the C preprocessor Simon Glass
2013-10-26 5:01 ` [U-Boot] [PATCH v3 5/5] RFC: tegra: Convert to using environment files Simon Glass
2013-10-28 19:59 ` Stephen Warren
2013-10-28 20:34 ` Simon Glass
2013-10-28 20:41 ` Stephen Warren
2013-10-28 20:50 ` Simon Glass
2013-10-28 21:20 ` Stephen Warren
2013-10-28 22:15 ` Simon Glass
2013-10-29 19:38 ` Stephen Warren [this message]
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=52700EC3.4090304@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.