[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] rpcgen fixes



john levon sun com wrote:
> # HG changeset patch
> # User john levon sun com
> # Date 1229399266 28800
> # Node ID 12c9b283b11f5e20b9dcc91e3d10a862da5d6e81
> # Parent  1ba824db09286ebc758e035211da2c533bbd1e0f
> rpcgen fixes
>
> quad_t is not a portable type, but rather than force rpcgen
> every build, we just patch in the fixes needed.
>
> Also, since we ship the rpcgen-derived files in CVS, don't leave
> Makefile rules that could trigger during a normal build: make a special
> maintainer target for refreshing the derived sources.

This sounds like an argument for not putting derived sources
in CVS, since derived-for-one-system (linux/gnu) doesn't
work for e.g., Solaris.

> Signed-off-by: John Levon <john levon sun com>
>
> diff --git a/qemud/Makefile.am b/qemud/Makefile.am
> --- a/qemud/Makefile.am
> +++ b/qemud/Makefile.am
> @@ -32,23 +32,23 @@ EXTRA_DIST =						\
>  	$(DAEMON_SOURCES)
>
>  if RPCGEN
> -SUFFIXES = .x
> -.x.c:
> -	rm -f $@ $ -t $ -t2
> -	rpcgen -c -o $ -t $<
> +#
> +# Maintainer-only target for re-generating the derived .c/.h source
> +# files, which are actually derived from the .x file.
> +#
> +rpcgen:
> +	rm -f rp.c-t rp.h-t
> +	rpcgen -h -o rp.h-t @top_srcdir@/qemud/remote_protocol.x
> +	rpcgen -c -o rp.c-t @top_srcdir@/qemud/remote_protocol.x

Use $(srcdir), in place of @top_srcdir@/qemud (and others below).
The latter @var@ syntax is old, if not deprecated,
and $(srcdir) is guaranteed to be safe, while $(top_srcdir)
may be quite nasty (arbitrary abs. dir name) in the worst case.

>  if GLIBC_RPCGEN
> -	perl -w rpcgen_fix.pl $ -t > $ -t2
> -	chmod 444 $ -t2
> -	mv $ -t2 $@
> -endif
> -
> -.x.h:
> -	rm -f $@ $ -t
> -	rpcgen -h -o $ -t $<
> -if GLIBC_RPCGEN
> -	perl -pi -e 's/\t/        /g' $ -t
> -	chmod 444 $ -t
> -	mv $ -t $@
> +	perl -w @top_srcdir@/qemud/rpcgen_fix.pl rp.h-t \
> +	    >@top_srcdir@/qemud/remote_protocol.h

Please don't redirect directly to something used as a build source.
Instead, redirect to a temporary file, and rename that into place
upon successful completion.  That makes it less likely you'll ever
end up with corrupted sources.

> +	perl -w @top_srcdir@/qemud/rpcgen_fix.pl rp.c-t \
> +	    >@top_srcdir@/qemud/remote_protocol.c
> +	rm -f rp.c-t rp.h-t
> +else
> +	mv rp.h-t @top_srcdir@/remote_protocol.h
> +	mv rp.c-t @top_srcdir@/remote_protocol.c
>  endif
>  endif
...


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]