[libvirt] [PATCH] Autogenerate AUTHORS

Eric Blake eblake at redhat.com
Thu Oct 18 21:59:26 UTC 2012


On 10/18/2012 02:23 PM, Cole Robinson wrote:
> AUTHORS.in tracks the maintainers, as well as some folks who were
> previously in AUTHORS but don't have a git commit with proper
> attribution.
> 
> Generated output is sorted alphabetically and lacks pretty spacing, so
> tweak AUTHORS.in to follow the same format.
> 
> Additionally, drop the syntax-check rule that previously validated
> AUTHORS against git log.
> ---

> 
> +The primary maintainers and people with commit access rights:
> +
> +Daniel Veillard <veillard at redhat.com>
> +Daniel Berrange <berrange at redhat.com>
> +Richard W.M. Jones <rjones at redhat.com>

Can we sort this portions of AUTHORS.in, to match the fact that the rest
of our file will be in sorted order?

> @@ -91,3 +92,12 @@ gen-ChangeLog:
>  	  rm -f $(distdir)/ChangeLog;				\
>  	  mv $(distdir)/cl-t $(distdir)/ChangeLog;		\
>  	fi
> +
> +.PHONY: gen-AUTHORS
> +gen-AUTHORS:
> +	if test -d .git; then \
> +	    out="$$(git log --pretty=format:'%aN <%aE>' | sort | uniq)" && \

I know we require POSIX sh in our GNUmakefile, but in Makefile.am, it's
probably still safer to use `` instead of $().

Why not use 'sort -u' and shave off a process?

> +	    cat AUTHORS.in | perl -p -e "s/#authorlist#/$$out/" > \

VPATH build needs $(srcdir)/AUTHORS.in.  Useless use of cat.

> +	        $(distdir)/AUTHORS-tmp && \
> +	    mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ; \
> +	fi

I think the use of perl is overkill; sed can do the same.  Oh, and sed
can also get us to aligned columns, by exploiting the fact that none of
our names contain ~ (admittedly, my sed script now looks like line noise):

	if test -d .git; then					\
	  out=`git log						\
	    --pretty='%aN~~~~~~~~~~~~~~~~~~~~~~~~<%aE>\' |	\
	    sort -u |						\
	    sed 's/^\(.\{24\}[^~]*\)~*</\1~</; s/~/ /g'` &&	\
	  sed -e '/#authorlist#/ c\' -e "$$out" -e''		\
	    < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp &&	\
	  mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS	\
	fi

For that matter, we can even get fancy with sed to merge both the list
of git authors and old authors from AUTHORS.in in one go.  First, prep
AUTHORS.in correctly:
...
Patches have also been contributed by:

#1#
older names
#2#
[....send patches to get your name here....]

then you can do something like:

	if test -d .git; then					\
	  out=`{ sed -n '/#1#/,/#2#/ < $(srcdir)/AUTHORS.in;	\
	      git log						\
	      --pretty='%aN~~~~~~~~~~~~~~~~~~~~~~~~<%aE>\'; } |	\
	    sort -u |						\
	    sed 's/^\(.\{24\}[^~]*\)~*</\1~</; s/~/ /g'` &&	\
	  sed -e '/#1#/,/#2#/ c\' -e "$$out" -e''		\
	    < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp &&	\
	  mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS	\
	fi

(I only lightly tested the above, it may still need tweaks)

> diff --git a/bootstrap.conf b/bootstrap.conf
> index f8b7c4d..c40db3d 100644
> --- a/bootstrap.conf
> +++ b/bootstrap.conf
> @@ -223,7 +223,8 @@ if `(${PYTHON_CONFIG-python-config} --version;
>    PYTHON_CONFIG=true
>  fi
>  
> -# Automake requires that ChangeLog exist.
> +# Automake requires that ChangeLog and AUTHORS exist.
> +touch AUTHORS || exit 1
>  touch ChangeLog || exit 1

Merge these two lines into one:

touch AUTHORS ChangeLog || exit 1

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 617 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20121018/81e65b7f/attachment-0001.sig>


More information about the libvir-list mailing list