mkimage-profiles/pkg.in/lists/Makefile
Michael Shigorin ac5dbb4bba pkg.in/lists: archdep suffices for pkglists
This is an initial implementation of architecture dependent
contents handling for package lists more or less in the vein
of mkimage-profiles-desktop's one *but* using suffix part to
filter words in or out *not* prefix part to replace it with
a comment marker (thus filtering out lines).

The syntax should be pretty obvious:

  a b@i586 c@x86_64

will get "a b" given ARCH=i586 and "a c" given ARCH=x86_64;
please see doc/archdep.txt for a more elaborate description
and a conversion script.
2015-04-20 23:09:55 +03:00

57 lines
1.4 KiB
Makefile

# step 3: copy package lists referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifndef BUILDDIR
pkgdups:
@find -type f ! -name README ! -name Makefile \
| grep -v '~$$' \
| sed 's,^\./,,g' \
| xargs ../../bin/pkgdups
%:
$(error BUILDDIR not defined)
else
include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
all: | $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) copy-lists copy-groups grep-archdep
@mp-commit "$(TARGET)" "requested $(SUFFIX) copied over"
# env | sort -u | grep _LISTS | xargs -r cp -t
copy-lists:
@echo $(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),$($V))) \
| xargs -r -- cp --parents -at $(TARGET) --
copy-groups:
@if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \
cp -at $(TARGET) -- $(THE_GROUPS) $(MAIN_GROUPS); \
fi
grep-archdep: a = $(ARCH)
grep-archdep: s = [:space:]
grep-archdep:
# xargs -L 1024 -n 1024 ? -- breaks -I
@find $(TARGET) -type f \
| xargs -I '__' sh -c '\
sed -rni "s/\\<([^@ ]*)\\>|\\<([^@ ]*)@$a\\>/\\1\\2/pg" __; \
sed -i -r "s/\\<([^@ ]*)@[^@ ]+\\> *//g" __'
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):
@mkdir -p $(TARGET)
# figure out *_LISTS variables and print them out nicely
debug:
@echo -e $(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\
$(shell echo '\\n"**"' $V: $($V)))) '\n'
endif