Hi

On Fri, Sep 23, 2016 at 12:38 AM Eric Blake <ebl...@redhat.com> wrote:

> On 09/22/2016 03:19 PM, Marc-André Lureau wrote:
> > It's too easy to forget about updating the .gitignore, so this is an
> > attempt at generating it instead.
> >
> > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com>
> > ---
> >  tests/Makefile.include | 23 ++++++++++++--
> >  tests/.gitignore       | 82
> --------------------------------------------------
> >  2 files changed, 20 insertions(+), 85 deletions(-)
> >  delete mode 100644 tests/.gitignore
>
> Interesting that applying this to an incremental tree will show lots of
> unignored files until the next 'make check' run.  But once that is done,
> I can confirm that it did result in the same 'git status' as pre-patch.
>
>
The next 'make' should be enough.


> >
> > diff --git a/tests/Makefile.include b/tests/Makefile.include
> > index 93f2ba1..339126d 100644
> > --- a/tests/Makefile.include
> > +++ b/tests/Makefile.include
> > @@ -785,6 +785,19 @@ $(patsubst %, check-%, $(check-qapi-schema-y)):
> check-%.json: $(SRC_PATH)/%.json
> >       @diff -q $(SRC_PATH)/$*.exit $*.test.exit
> >
> >  # Consolidated targets
> > +tests-cleanfiles = *.o
> > +tests-cleanfiles = .gitignore
> > +tests-cleanfiles += qht-bench$(EXESUF)
> > +tests-cleanfiles += qapi-schema/*.test.*
> > +tests-cleanfiles += test-qapi-event.[ch]
> > +tests-cleanfiles += test-qapi-types.[ch]
> > +tests-cleanfiles += test-qapi-visit.[ch]
> > +tests-cleanfiles += test-qmp-introspect.[ch]
> > +tests-cleanfiles += test-qmp-commands.h
> > +tests-cleanfiles += test-qmp-marshal.c
> > +tests-cleanfiles += $(subst tests/,,$(check-unit-y))
> > +tests-cleanfiles += $(subst tests/,,$(check-qtest-y))
> > +tests-cleanfiles += qemu-iotests/socket_scm_helper$(EXESUF)
> >
> >  .PHONY: check-qapi-schema check-qtest check-unit check check-clean
> >  check-qapi-schema: $(patsubst %,check-%, $(check-qapi-schema-y))
> > @@ -794,14 +807,18 @@ check-block: $(patsubst %,check-%,
> $(check-block-y))
> >  check: check-qapi-schema check-unit check-qtest
> >  check-clean:
> >       $(MAKE) -C tests/tcg clean
> > -     rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
> > -     rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST),
> $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
> > -
> > +     (cd tests && echo rm -rf $(tests-cleanfiles))
> >  clean: check-clean
> >
> >  # Build the help program automatically
> >
> >  all: $(QEMU_IOTESTS_HELPERS-y)
> >
> > +ifneq ($(filter-out $(UNCHECKED_GOALS),$(MAKECMDGOALS)),$(if
> $(MAKECMDGOALS),,fail))
> > +$(SRC_PATH)/tests/.gitignore:
> > +     echo "$(tests-cleanfiles)" | xargs -n1 | sort > $@
>
> This line is TOO noisy; you'll want to wrap it into a $(call
> quiet-command...).
>

Yep


>
> You could also do it with fewer processes and less typing, as:
>
> printf %s\\n $(tests-cleanfiles) | sort > $@
>

Is there a way for printf to split the variable?

echo "*.o foo" | xargs -n1
*.o
foo

vs

pritnf %s\\n "*.o foo"
*.o foo

If I remove the quote in the Makefile, then it will expand to all the
non/exisiting .o files.


>
> > +Makefile: $(SRC_PATH)/tests/.gitignore
> > +endif
> > +
> >  -include $(wildcard tests/*.d)
> >  -include $(wildcard tests/libqos/*.d)
>
> But the idea seems interesting; looking forward to v2 and comments from
> anyone else.
>
> --
> Eric Blake   eblake redhat com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
> --
Marc-André Lureau

Reply via email to