[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100301162733.GB6758@linux.vnet.ibm.com>
Date: Mon, 1 Mar 2010 08:27:33 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Frans Pop <elendil@...net.nl>, linux-kernel@...r.kernel.org,
zippel@...ux-m68k.org, mingo@...e.hu, akpm@...ux-foundation.org,
torvalds@...ux-foundation.org
Subject: Re: [PATCH RFC] kconfig: place git SHA1 in .config output if in
git tree
On Mon, Mar 01, 2010 at 11:10:54AM +0100, Geert Uytterhoeven wrote:
> On Mon, Mar 1, 2010 at 10:42, Frans Pop <elendil@...net.nl> wrote:
> > Paul E. McKenney wrote:
> >> This patch appends the SHA1 hash of the current git tree to the
> >> kernel version line, or "[Not git tree]" if run from a non-git tree.
> >> Uses "git log" to print the hash.
> >
> > Nice idea.
> >
> > However, I gave it a try and got:
> > # Linux kernel version: 2.6.34-rc0 [Not git tree]
> >
> > Even though I *am* building from a git tree. It does not seem to work when
> > building with KBUILD_OUTPUT set or when using 'O='.
> >
> > IMO that makes the practical value of the patch very limited. I'm afraid
> > because of this it will increase confusion rather than add information.
>
> scripts/setlocalversion handles this case correctly, so you may want to
> look there...
Very nice, thank you!!!
Here is the updated patch. Thoughts?
Thanx, Paul
------------------------------------------------------------------------
[PATCH RFC] kconfig: place localversion string in .config output
This patch appends the localversion string to the Linux kernel version.
For example, in a git tree with uncommitted changes, the .config file
might start as follows:
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.33-01836-g90a6501-dirty
# Mon Mar 1 08:21:49 2010
This patch uses the scripts/setlocalversion output, so similar output
is also generated for svn and mercurial.
Suggested-by: Ingo Molnar <mingo@...e.hu>
Suggested-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Roman Zippel <zippel@...ux-m68k.org>
Cc: Frans Pop <elendil@...net.nl>
Signed-off-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
---
confdata.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index c4dec80..fba6b07 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -399,10 +399,11 @@ int conf_read(const char *name)
int conf_write(const char *name)
{
FILE *out;
+ FILE *slv;
struct symbol *sym;
struct menu *menu;
const char *basename;
- char dirname[128], tmpname[128], newname[128];
+ char dirname[128], tmpname[128], newname[128], localversion[128];
int type, l;
const char *str;
time_t now;
@@ -450,12 +451,20 @@ int conf_write(const char *name)
if (env && *env)
use_timestamp = 0;
+ localversion[0] = '\0';
+ slv = popen("scripts/setlocalversion 2> /dev/null", "r");
+ if (slv != NULL) {
+ fscanf(slv, " %127s ", localversion);
+ pclose(slv);
+ }
+
fprintf(out, _("#\n"
"# Automatically generated make config: don't edit\n"
- "# Linux kernel version: %s\n"
+ "# Linux kernel version: %s%s\n"
"%s%s"
"#\n"),
sym_get_string_value(sym),
+ localversion[0] != '\0' ? localversion : "",
use_timestamp ? "# " : "",
use_timestamp ? ctime(&now) : "");
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists