From: Bhaskar Chowdhury <unixbhaskar@gmail.com>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: linux-kbuild@vger.kernel.org
Subject: Re: [PATCH] Modern Bash syntax, replace backquote to dollar parenthesis
Date: Fri, 11 Oct 2019 09:58:43 +0530 [thread overview]
Message-ID: <20191011042840.GA11550@Gentoo> (raw)
In-Reply-To: <369b1248-fd80-11e2-d879-d5943f9659f4@infradead.org>
[-- Attachment #1: Type: text/plain, Size: 6929 bytes --]
On 20:04 Thu 10 Oct 2019, Randy Dunlap wrote:
>On 10/10/19 7:17 PM, Bhaskar Chowdhury wrote:
>> Signed-off-by: Bhaskar Chowdhury <unixbhaskar@gmail.com>
>> ---
>> setlocalversion | 183 ++++++++++++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 183 insertions(+)
>> create mode 100755 setlocalversion
>
>Hi,
>I'm pretty sure something is mucked up here.
>
>> diff --git a/setlocalversion b/setlocalversion
>
>but this isn't a diff between those 2 files.
>
>And this diff should be from the top level of the kernel source tree, so it
>should be a diff between a/scripts/setlocalversion and b/scripts/setlocalversion.
>
Right. I have move the original file to top level dir then ...
>> new file mode 100755
>
>There is already a file scripts/setlocalversion, so this "new file" is strange.
>
It is indeed..because of my stupidity ..as I said removed that file and
made the patch...heck
>Also, the patch subject should be something like:
>[PATCH] scripts: fix shell syntax
>
Doesn't the subject catch it from commit message??
>And note that the shell in this case is /bin/sh, not necessarily bash.
>Actually we prefer to make patches that remove bashisms in many cases.
>
Do you want me drop this one ? Can you be specific Randy, please, if it
is not what is need , no point wasting time on it.
>One more: you should Cc: the kbuild maintainer on patches that he might apply/merge.
>
I did , I believe ..both the maintainers .
>Thanks.
>
>> index 000000000000..220dae0db3f1
>> --- /dev/null
>> +++ b/setlocalversion
>> @@ -0,0 +1,183 @@
>> +#!/bin/sh
>> +# SPDX-License-Identifier: GPL-2.0
>> +#
>> +# This scripts adds local version information from the version
>> +# control systems git, mercurial (hg) and subversion (svn).
>> +#
>> +# If something goes wrong, send a mail the kernel build mailinglist
>> +# (see MAINTAINERS) and CC Nico Schottelius
>> +# <nico-linuxsetlocalversion -at- schottelius.org>.
>> +#
>> +#
>> +
>> +usage() {
>> + echo "Usage: $0 [--save-scmversion] [srctree]" >&2
>> + exit 1
>> +}
>> +
>> +scm_only=false
>> +srctree=.
>> +if test "$1" = "--save-scmversion"; then
>> + scm_only=true
>> + shift
>> +fi
>> +if test $# -gt 0; then
>> + srctree=$1
>> + shift
>> +fi
>> +if test $# -gt 0 -o ! -d "$srctree"; then
>> + usage
>> +fi
>> +
>> +scm_version()
>> +{
>> + local short
>> + short=false
>> +
>> + cd "$srctree"
>> + if test -e .scmversion; then
>> + cat .scmversion
>> + return
>> + fi
>> + if test "$1" = "--short"; then
>> + short=true
>> + fi
>> +
>> + # Check for git and a git repo.
>> + if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
>> + head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
>> +
>> + # If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
>> + # it, because this version is defined in the top level Makefile.
>> + if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
>> +
>> + # If only the short version is requested, don't bother
>> + # running further git commands
>> + if $short; then
>> + echo "+"
>> + return
>> + fi
>> + # If we are past a tagged commit (like
>> + # "v2.6.30-rc5-302-g72357d5"), we pretty print it.
>> + if atag="`git describe 2>/dev/null`"; then
>> + echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
>> +
>> + # If we don't have a tag at all we print -g{commitish}.
>> + else
>> + printf '%s%s' -g $head
>> + fi
>> + fi
>> +
>> + # Is this git on svn?
>> + if git config --get svn-remote.svn.url >/dev/null; then
>> + printf -- '-svn%s' "`git svn find-rev $head`"
>> + fi
>> +
>> + # Check for uncommitted changes.
>> + # First, with git-status, but --no-optional-locks is only
>> + # supported in git >= 2.14, so fall back to git-diff-index if
>> + # it fails. Note that git-diff-index does not refresh the
>> + # index, so it may give misleading results. See
>> + # git-update-index(1), git-diff-index(1), and git-status(1).
>> + if {
>> + git --no-optional-locks status -uno --porcelain 2>/dev/null ||
>> + git diff-index --name-only HEAD
>> + } | grep -qvE '^(.. )?scripts/package'; then
>> + printf '%s' -dirty
>> + fi
>> +
>> + # All done with git
>> + return
>> + fi
>> +
>> + # Check for mercurial and a mercurial repo.
>> + if test -d .hg && hgid=`hg id 2>/dev/null`; then
>> + # Do we have an tagged version? If so, latesttagdistance == 1
>> + if [ "`hg log -r . --template '{latesttagdistance}'`" == "1" ]; then
>> + id=`hg log -r . --template '{latesttag}'`
>> + printf '%s%s' -hg "$id"
>> + else
>> + tag=`printf '%s' "$hgid" | cut -d' ' -f2`
>> + if [ -z "$tag" -o "$tag" = tip ]; then
>> + id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
>> + printf '%s%s' -hg "$id"
>> + fi
>> + fi
>> +
>> + # Are there uncommitted changes?
>> + # These are represented by + after the changeset id.
>> + case "$hgid" in
>> + *+|*+\ *) printf '%s' -dirty ;;
>> + esac
>> +
>> + # All done with mercurial
>> + return
>> + fi
>> +
>> + # Check for svn and a svn repo.
>> + if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
>> + rev=`echo $rev | awk '{print $NF}'`
>> + printf -- '-svn%s' "$rev"
>> +
>> + # All done with svn
>> + return
>> + fi
>> +}
>> +
>> +collect_files()
>> +{
>> + local file res=
>> +
>> + for file; do
>> + case "$file" in
>> + *\~*)
>> + continue
>> + ;;
>> + esac
>> + if test -e "$file"; then
>> + res="$res$(cat "$file")"
>> + fi
>> + done
>> + echo "$res"
>> +}
>> +
>> +if $scm_only; then
>> + if test ! -e .scmversion; then
>> + res=$(scm_version)
>> + echo "$res" >.scmversion
>> + fi
>> + exit
>> +fi
>> +
>> +if test -e include/config/auto.conf; then
>> + . include/config/auto.conf
>> +else
>> + echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
>> + exit 1
>> +fi
>> +
>> +# localversion* files in the build and source directory
>> +res="$(collect_files localversion*)"
>> +if test ! "$srctree" -ef .; then
>> + res="$res$(collect_files "$srctree"/localversion*)"
>> +fi
>> +
>> +# CONFIG_LOCALVERSION and LOCALVERSION (if set)
>> +res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
>> +
>> +# 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
>> +
>> +echo "$res"
>>
>
>
>--
>~Randy
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-10-11 4:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <yamada.masahiro@socionext.com,michal.lkml@markovi.net,linux-kbuild@vger.kernel.org>
2019-10-11 2:17 ` [PATCH] Modern Bash syntax, replace backquote to dollar parenthesis Bhaskar Chowdhury
2019-10-11 3:04 ` Randy Dunlap
2019-10-11 4:28 ` Bhaskar Chowdhury [this message]
2019-10-11 6:25 ` Randy Dunlap
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=20191011042840.GA11550@Gentoo \
--to=unixbhaskar@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=rdunlap@infradead.org \
/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.