[fedfs-utils] [fedfs-utils PATCH v2] Remove use of __DATE__ and __TIME__ when building.

Chuck Lever chuck.lever at oracle.com
Thu Feb 27 08:46:19 PST 2014


On Feb 26, 2014, at 7:54 PM, NeilBrown <neilb at suse.de> wrote:

> 
> Use of __DATE__ and __TIME__ makes it impossible to recompile after
> possibly changing context, and see the context made any real change in
> the resulting build.
> The Open Build Service can do this (to optimise rebuilds) and so
> discourages the use of __DATE__ and __TIME__
> 
> This patch removes the __DATE__ and __TIME__ leaving just the VERSION.
> 
> Signed-off-by: NeilBrown <neilb at suse.de>
> 
> --
> p.s. I'm not subscribed so didn't get your reply ... but I
> checked the archive just in case and found it there.

Applied this patch to my private tree.  If all goes well, you should see it in 0.10.1.

> For some of my projects I include e.g.
> 
> VERSION = $(shell [ -d .git ] && git describe HEAD | sed 's/mdadm-//')
> CFLAGS += $(if $(VERSION),-DVERSION=\"$(VERSION)\",)
> 
> in the Makefile which makes the version message slightly more useful.
> I don't know how to integrate that with autoconf.

The VERSION macro is defined by the second argument of the AC_INIT macro in configure.ac:

  AC_INIT([fedfs-utils], [0.10.0], [fedfs-utils-devel at oss.oracle.com])

Then config.h has “#define VERSION 0.10.0”.

> Thanks,
> NeilBrown
> 
> 
> diff --git a/src/fedfsd/main.c b/src/fedfsd/main.c
> index f6ca61f7d6e8..4980dc3b09e1 100644
> --- a/src/fedfsd/main.c
> +++ b/src/fedfsd/main.c
> @@ -164,9 +164,7 @@ int main(int argc, char **argv)
> 			gid = grp->gr_gid;
> 			break;
> 		case '?':
> -			fprintf(stderr, "Version " VERSION
> -					", built on %s at %s\n\n",
> -					__DATE__, __TIME__);
> +			fprintf(stderr, "Version " VERSION "\n\n");
> 			fedfsd_usage(progname);
> 			break;
> 		case 'o':
> @@ -230,8 +228,7 @@ int main(int argc, char **argv)
> 		}
> 	}
> 
> -	xlog(L_NOTICE, "Version " VERSION " (built %s at %s) starting",
> -			__DATE__, __TIME__);
> +	xlog(L_NOTICE, "Version " VERSION " starting");
> 
> 	if (!fedfsd_set_up_authenticators())
> 		exit(EXIT_FAILURE);

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com






More information about the fedfs-utils-devel mailing list