Hi,
In scripts/setlocalversion under linux kernel tree, the scripts seems
a little strange.
# scm version string if not at a tagged commit
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
# full scm version string
res="$res$(scm_version)"
else
# append a plus sign if the repository is not in a clean
# annotated or signed tagged state (as git describe only
# looks at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified
if test "${LOCALVERSION+set}" != "set"; then
scm=$(scm_version --short)
res="$res${scm:++}"
fi
fi
LOCALVERSION isn't assigned in any place. Only CONFIG_LOCALVERSION
can be assigned in .config file.
Why do we need to check LOCALVERSION at here?
Thanks
Haojian
On 19.4.2011 08:42, Haojian Zhuang wrote:
> In scripts/setlocalversion under linux kernel tree, the scripts seems
> a little strange.
[...]
> # append a plus sign if the repository is not in a clean
> # annotated or signed tagged state (as git describe only
> # looks at signed or annotated tags - git tag -a/-s) and
> # LOCALVERSION= is not specified
> if test "${LOCALVERSION+set}" != "set"; then
> scm=$(scm_version --short)
> res="$res${scm:++}"
> fi
> fi
>
> LOCALVERSION isn't assigned in any place. Only CONFIG_LOCALVERSION
> can be assigned in .config file.
> Why do we need to check LOCALVERSION at here?
It can be set on the commandline:
make LOCALVERSION=something
Michal
On Tue, Apr 19, 2011 at 2:58 PM, Michal Marek <[email protected]> wrote:
> On 19.4.2011 08:42, Haojian Zhuang wrote:
>> In scripts/setlocalversion under linux kernel tree, the scripts seems
>> a little strange.
> [...]
>> ? ? ? ? # append a plus sign if the repository is not in a clean
>> ? ? ? ? # annotated or signed tagged state (as git describe only
>> ? ? ? ? # looks at signed or annotated tags - git tag -a/-s) and
>> ? ? ? ? # LOCALVERSION= is not specified
>> ? ? ? ? if test "${LOCALVERSION+set}" != "set"; then
>> ? ? ? ? ? ? ? ? scm=$(scm_version --short)
>> ? ? ? ? ? ? ? ? res="$res${scm:++}"
>> ? ? ? ? fi
>> fi
>>
>> LOCALVERSION isn't assigned in any place. Only CONFIG_LOCALVERSION
>> can be assigned in .config file.
>> Why do we need to check LOCALVERSION at here?
>
> It can be set on the commandline:
>
> make LOCALVERSION=something
>
> Michal
>
Thanks a lot. It works.
I still have a question. I can't find the semantic of
${LOCALVERSION+set} in some
shell tutorials. Could you help me to figure out a link of introducing this?
Best Regards
Haojian
On 19.4.2011 09:35, Haojian Zhuang wrote:
> I still have a question. I can't find the semantic of
> ${LOCALVERSION+set} in some
> shell tutorials. Could you help me to figure out a link of introducing this?
It's a test if LOCALVERSION is set or not. See for instance
http://pubs.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_06_02,
scroll down to the table that explains the various expansions.
Michal