pkg/lists: fix the fix (handle no lists too)

cp(1) would get confusing arguments with no files to copy
if there are no lists to handle; employ xargs(1) as promised
to handle this properly.
This commit is contained in:
Michael Shigorin 2015-02-08 01:32:45 +03:00
parent eadc204b9e
commit 292caede4e

View File

@ -21,12 +21,12 @@ TARGET := $(BUILDDIR)/$(SUFFIX)
all: $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups
@mp-commit "$(TARGET)" "requested $(SUFFIX) copied over"
# env | sort -u | grep _LISTS | xargs cp
# env | sort -u | grep _LISTS | xargs -r cp -t
copy-lists:
@cp --parents -at $(TARGET) -- \
$(foreach V, \
@echo $(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),$($V)))
$(if $(filter environment% file,$(origin $V)),$($V))) \
| xargs -r -- cp --parents -at $(TARGET) --
copy-groups:
@if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \