Skip to contentSkip to conversation

kconfig: save kernel version in .config file

PATCH In review Olaf Hering 4 participants 8 messages Sep 17, 2004 – Oct 16, 2004 Kconfig

lore
Share & tools
lore
#0 lore raw

Randy,

we need a way to turn the timestamp off when running make oldconfig. Running make oldconfig gives always a delta, even if the .config is unchanged. This is bad for cvs repos, it generates conflicts now if 2 people work on the same config file.
Please provide a patch to not call ctime if a non-empty enviroment variable of your choice is set.

http://linux.bkbits.net:8080/linux-2.5/cset@411638e5ljptW-TmFM1SHBiIEg63OA

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#1 lore raw

PATCH 1/1 kconfig: OVERRIDE: save kernel version in .config file

On Fri, 17 Sep 2004 17:43:46 +0200 Olaf Hering wrote:

| Randy,
| 
| we need a way to turn the timestamp off when running make oldconfig.
| Running make oldconfig gives always a delta, even if the .config is
| unchanged. This is bad for cvs repos, it generates conflicts now if 2
| people work on the same config file.
| Please provide a patch to not call ctime if a non-empty enviroment
| variable of your choice is set.

How's this?

Omit .config file timestamp in the file if the environment variable "NOTIMESTAMP" is present (its value is not checked).

diffstat:=

 scripts/kconfig/confdata.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
scripts/kconfig/confdata.c renamed from scripts/kconfig/confdata.c~nostamp +12 -4
diff -Naurp ./scripts/kconfig/confdata.c~nostamp ./scripts/kconfig/confdata.c
@@ -270,6 +270,8 @@ int conf_write(const char *name)
 	int type, l;
 	const char *str;
 	time_t now;
+	int use_timestamp = 1;
+	char *env;
 
 	dirname[0] = 0;
 	if (name && name[0]) {
@@ -306,22 +308,28 @@ int conf_write(const char *name)
 	sym = sym_lookup("KERNELRELEASE", 0);
 	sym_calc_value(sym);
 	time(&now);
+	env = getenv("NOTIMESTAMP");
+	if (env)
+		use_timestamp = 0;
+
 	fprintf(out, "#\n"
 		     "# Automatically generated make config: don't edit\n"
 		     "# Linux kernel version: %s\n"
-		     "# %s"
+		     "%s%s"
 		     "#\n",
 		     sym_get_string_value(sym),
-		     ctime(&now));
+		     use_timestamp ? "# " : "",
+		     use_timestamp ? ctime(&now) : "");
 	if (out_h)
 		fprintf(out_h, "/*\n"
 			       " * Automatically generated C config: don't edit\n"
 			       " * Linux kernel version: %s\n"
-			       " * %s"
+			       "%s%s"
 			       " */\n"
 			       "#define AUTOCONF_INCLUDED\n",
 			       sym_get_string_value(sym),
-			       ctime(&now));
+			       use_timestamp ? " * " : "",
+			       use_timestamp ? ctime(&now) : "");
 
 	if (!sym_change_count)
 		sym_clear_all_valid();

--

#2 lore raw

Re: [PATCH] kconfig: OVERRIDE: save kernel version in .config file

Quoted 11 lines · Randy.Dunlap

On Fri, 17 Sep 2004 17:43:46 +0200 Olaf Hering wrote:

| Randy,
| 
| we need a way to turn the timestamp off when running make oldconfig.
| Running make oldconfig gives always a delta, even if the .config is
| unchanged. This is bad for cvs repos, it generates conflicts now if 2
| people work on the same config file.
| Please provide a patch to not call ctime if a non-empty enviroment
| variable of your choice is set.
Quoted 1 line

How's this?

good, thanks!

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG
#3 lore raw

PATCH 1/1 kconfig: OVERRIDE: save kernel version in .config file

In reply to Randy.Dunlap

On Fri, 17 Sep 2004 10:20:24 -0700 Randy.Dunlap wrote:

| On Fri, 17 Sep 2004 17:43:46 +0200 Olaf Hering wrote:
| 
| | Randy,
| | 
| | we need a way to turn the timestamp off when running make oldconfig.
| | Running make oldconfig gives always a delta, even if the .config is
| | unchanged. This is bad for cvs repos, it generates conflicts now if 2
| | people work on the same config file.
| | Please provide a patch to not call ctime if a non-empty enviroment
| | variable of your choice is set.
| 
| How's this?

Let's be a little safer in checking "NOTIMESTAMP".

Omit .config file timestamp in the file if the environment variable "NOTIMESTAMP" exists and is non-null.

diffstat:=

 scripts/kconfig/confdata.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
scripts/kconfig/confdata.c renamed from scripts/kconfig/confdata.c~nostamp +12 -4
diff -Naurp ./scripts/kconfig/confdata.c~nostamp ./scripts/kconfig/confdata.c
@@ -270,6 +270,8 @@ int conf_write(const char *name)
 	int type, l;
 	const char *str;
 	time_t now;
+	int use_timestamp = 1;
+	char *env;
 
 	dirname[0] = 0;
 	if (name && name[0]) {
@@ -306,22 +308,28 @@ int conf_write(const char *name)
 	sym = sym_lookup("KERNELRELEASE", 0);
 	sym_calc_value(sym);
 	time(&now);
+	env = getenv("NOTIMESTAMP");
+	if (env && *env)
+		use_timestamp = 0;
+
 	fprintf(out, "#\n"
 		     "# Automatically generated make config: don't edit\n"
 		     "# Linux kernel version: %s\n"
-		     "# %s"
+		     "%s%s"
 		     "#\n",
 		     sym_get_string_value(sym),
-		     ctime(&now));
+		     use_timestamp ? "# " : "",
+		     use_timestamp ? ctime(&now) : "");
 	if (out_h)
 		fprintf(out_h, "/*\n"
 			       " * Automatically generated C config: don't edit\n"
 			       " * Linux kernel version: %s\n"
-			       " * %s"
+			       "%s%s"
 			       " */\n"
 			       "#define AUTOCONF_INCLUDED\n",
 			       sym_get_string_value(sym),
-			       ctime(&now));
+			       use_timestamp ? " * " : "",
+			       use_timestamp ? ctime(&now) : "");
 
 	if (!sym_change_count)
 		sym_clear_all_valid();

--

#4 lore raw

Re: [PATCH] kconfig: OVERRIDE: save kernel version in .config file

Quoted 15 lines · Randy.Dunlap

On Fri, 17 Sep 2004 10:20:24 -0700 Randy.Dunlap wrote:

| On Fri, 17 Sep 2004 17:43:46 +0200 Olaf Hering wrote:
| 
| | Randy,
| | 
| | we need a way to turn the timestamp off when running make oldconfig.
| | Running make oldconfig gives always a delta, even if the .config is
| | unchanged. This is bad for cvs repos, it generates conflicts now if 2
| | people work on the same config file.
| | Please provide a patch to not call ctime if a non-empty enviroment
| | variable of your choice is set.
| 
| How's this?
Quoted 6 lines

Let's be a little safer in checking "NOTIMESTAMP".

Omit .config file timestamp in the file if the environment variable "NOTIMESTAMP" exists and is non-null.

Applied - but I named it KCONFIG_TIMESTAMP so people would not think that kbuild suddenly stopped checking timestamps.

Sam

#5 lore raw

Re: [PATCH] kconfig: OVERRIDE: save kernel version in .config file

Hi,

Quoted 2 lines · Sam Ravnborg

Applied - but I named it KCONFIG_TIMESTAMP so people would not think that kbuild suddenly stopped checking timestamps.

That reminds me, I'm not really happy with this patch, it's a hack not a real solution, either we save the timestamp always or not at all, making it dependent on an environment variable is IMO ugly.
I have a patch which does some tighter checking during config loading, which can be used whether it's needed to write the config. Other front ends could use this as well (e.g. xconfig right now always ask to save the config).

bye, Roman

#6 lore raw

Re: [PATCH] kconfig: OVERRIDE: save kernel version in .config file

Quoted 7 lines · Roman Zippel

Hi,

Quoted 2 lines · Sam Ravnborg

Applied - but I named it KCONFIG_TIMESTAMP so people would not think that kbuild suddenly stopped checking timestamps.

Quoted 7 lines

That reminds me, I'm not really happy with this patch, it's a hack not a real solution, either we save the timestamp always or not at all, making it dependent on an environment variable is IMO ugly.
I have a patch which does some tighter checking during config loading, which can be used whether it's needed to write the config. Other front ends could use this as well (e.g. xconfig right now always ask to save the config).

The better approach for sure. When we have this in place I will delete the KCONFIG_NOTIMESTMAP hack.

Sam

#7 lore raw

Re: [PATCH] kconfig: OVERRIDE: save kernel version in .config file

In reply to Roman Zippel
Quoted 10 lines · Roman Zippel

Hi,

Quoted 2 lines · Sam Ravnborg

Applied - but I named it KCONFIG_TIMESTAMP so people would not think that kbuild suddenly stopped checking timestamps.

That reminds me, I'm not really happy with this patch, it's a hack not a real solution, either we save the timestamp always or not at all, making it dependent on an environment variable is IMO ugly.

The point is: avoid conflicts when 2 people change different parts of the .config.
Just drop the whole thing, I doubt the timestamp matters much.

Signature · 3 lines
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG