pkgpriorities: add main subprofile support
Fix stage2 meta-subprofile support while at that: it was a questionable idea to use "/" as a delimiter when part of the substitution is a pathname.
This commit is contained in:
parent
75c28d412c
commit
6e53db42a9
26
features.in/pkgpriorities/main/lib/50-pkgpriorities.mk
Normal file
26
features.in/pkgpriorities/main/lib/50-pkgpriorities.mk
Normal file
@ -0,0 +1,26 @@
|
||||
_IMAGE_APTBOX_ = $(WORKDIR)/aptbox
|
||||
|
||||
# Add prerequisite to the copy-packages target of
|
||||
# $(MKIMAGE_PREFIX)/targets.mk.
|
||||
copy-packages: $(_IMAGE_APTBOX_)/etc/apt/pkgpriorities
|
||||
|
||||
_PINNED_PACKAGES_ = $(foreach pp,$(PINNED_PACKAGES),$(if $(findstring :,$(pp)),$(pp),$(pp):$(PIN_PRIORITY)))
|
||||
_PIN_PRIORITIES_ = $(sort $(foreach pp,$(_PINNED_PACKAGES_),$(lastword $(subst :, ,$(pp)))))
|
||||
_PKGPRIORITIES_ = $(subst \n ,\n,$(foreach pri,$(_PIN_PRIORITIES_),$(pri):$(patsubst %:$(pri),\n %,$(filter %:$(pri),$(_PINNED_PACKAGES_)))\n))
|
||||
|
||||
$(_IMAGE_APTBOX_)/etc/apt/pkgpriorities: prepare-workdir
|
||||
@echo -e '$(_PKGPRIORITIES_)' | sed -e 's,[[:space:]]\+$$,,' >$@
|
||||
@if [ -s $@ ]; then \
|
||||
if grep -q '^\(APT::\)\?Dir::Etc::pkgpriorities[[:space:]]' \
|
||||
$(_IMAGE_APTBOX_)/etc/apt/apt.conf; \
|
||||
then \
|
||||
sed -i -e 's,\(Dir::Etc::pkgpriorities\)[[:space:]].*$$,\1 "$@";,g' \
|
||||
$(_IMAGE_APTBOX_)/etc/apt/apt.conf; \
|
||||
else \
|
||||
echo 'Dir::Etc::pkgpriorities "$@";' \
|
||||
>>$(_IMAGE_APTBOX_)/etc/apt/apt.conf; \
|
||||
fi; \
|
||||
echo "--- Package priorities ---" >&2; \
|
||||
cat $@ >&2; \
|
||||
echo "---" >&2; \
|
||||
fi
|
@ -1,6 +1,6 @@
|
||||
_IMAGE_APTBOX_ = $(WORKDIR)/chroot/$(WORKDIRNAME)/aptbox
|
||||
|
||||
# Add prerequisite to the `build-image` target of
|
||||
# Add prerequisite to the build-image target of
|
||||
# $(MKIMAGE_PREFIX)/targets.mk.
|
||||
build-image: $(_IMAGE_APTBOX_)/etc/apt/pkgpriorities
|
||||
|
||||
@ -9,12 +9,12 @@ _PIN_PRIORITIES_ = $(sort $(foreach pp,$(_PINNED_PACKAGES_),$(lastword $(subst :
|
||||
_PKGPRIORITIES_ = $(subst \n ,\n,$(foreach pri,$(_PIN_PRIORITIES_),$(pri):$(patsubst %:$(pri),\n %,$(filter %:$(pri),$(_PINNED_PACKAGES_)))\n))
|
||||
|
||||
$(_IMAGE_APTBOX_)/etc/apt/pkgpriorities: prepare-image-workdir
|
||||
@echo -e '$(_PKGPRIORITIES_)' | sed -e 's/[[:space:]]\+$$//' >$@
|
||||
@echo -e '$(_PKGPRIORITIES_)' | sed -e 's,[[:space:]]\+$$,,' >$@
|
||||
@if [ -s $@ ]; then \
|
||||
if grep -q '^\(APT::\)\?Dir::Etc::pkgpriorities[[:space:]]' \
|
||||
$(_IMAGE_APTBOX_)/etc/apt/apt.conf; \
|
||||
then \
|
||||
sed -i -e 's/\(Dir::Etc::pkgpriorities\)[[:space:]].*$$/\1 "$@";/g' \
|
||||
sed -i -e 's,\(Dir::Etc::pkgpriorities\)[[:space:]].*$$,\1 "$@";,g' \
|
||||
$(_IMAGE_APTBOX_)/etc/apt/apt.conf; \
|
||||
else \
|
||||
echo 'Dir::Etc::pkgpriorities "$@";' \
|
||||
|
Loading…
Reference in New Issue
Block a user