build: propagate override information to .packageinfo

Packages overridden with "./scripts/feeds -f" will show up with an
"Override: <original-package-name>" in .packageinfo.

This will be useful to create a corresponding option in .config and
use this information during the build process.

Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com>

SVN-Revision: 44335
master
John Crispin 10 years ago
parent 2e2c04777b
commit b7cf4cc613
  1. 4
      include/scan.awk
  2. 26
      include/scan.mk

@ -4,8 +4,10 @@ $1 !~ /^feeds/ { PKGS[$NF]=$0 }
END { END {
# Filter-out OpenWrt packages which have a feeds equivalent # Filter-out OpenWrt packages which have a feeds equivalent
for (pkg in PKGS) for (pkg in PKGS)
if (pkg in FEEDS) if (pkg in FEEDS) {
print PKGS[pkg] > of
delete PKGS[pkg] delete PKGS[pkg]
}
n = asort(PKGS) n = asort(PKGS)
for (i=1; i <= n; i++) { for (i=1; i <= n; i++) {
print PKGS[i] print PKGS[i]

@ -10,6 +10,7 @@ SCAN_NAME ?= package
SCAN_DIR ?= package SCAN_DIR ?= package
TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp
FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE) FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE)
OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)
ifeq ($(IS_TTY),1) ifeq ($(IS_TTY),1)
define progress define progress
@ -31,6 +32,7 @@ define PackageDir
{ \ { \
$$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \ $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \
echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \ echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \
$(if $(3),echo Override: $(3),true); \
$(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \
mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \ mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \
$(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(SCAN_DIR)/$(2)/dump.txt 2>&1; \
@ -41,17 +43,31 @@ define PackageDir
} > $$@ || true } > $$@ || true
endef endef
$(FILELIST): $(OVERRIDELIST):
rm -f $(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-*
touch $@
$(FILELIST): $(OVERRIDELIST)
rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-* rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*
$(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -HE 'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -f include/scan.awk > $@ $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -HE 'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@
$(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST) $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
( \ ( \
cat $< | awk '{print "$(SCAN_DIR)/" $$0 "/Makefile" }' | xargs grep -HE '^ *SCAN_DEPS *= *' | awk -F: '{ gsub(/^.*DEPS *= */, "", $$2); print "DEPS_" $$1 "=" $$2 }'; \ cat $< | awk '{print "$(SCAN_DIR)/" $$0 "/Makefile" }' | xargs grep -HE '^ *SCAN_DEPS *= *' | awk -F: '{ gsub(/^.*DEPS *= */, "", $$2); print "DEPS_" $$1 "=" $$2 }'; \
awk -v deps="$$DEPS" '{ \ awk -F/ -v deps="$$DEPS" -v of="$(OVERRIDELIST)" ' \
BEGIN { \
while (getline < (of)) \
override[$$NF]=$$0; \
close(of) \
} \
{ \
info=$$0; \ info=$$0; \
gsub(/\//, "_", info); \ gsub(/\//, "_", info); \
print "$$(eval $$(call PackageDir," info "," $$0 "))"; \ dir=$$0; \
pkg=""; \
if($$NF in override) \
pkg=override[$$NF]; \
print "$$(eval $$(call PackageDir," info "," dir "," pkg "))"; \
} ' < $<; \ } ' < $<; \
true; \ true; \
) > $@ ) > $@
@ -61,7 +77,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
$(TARGET_STAMP):: $(TARGET_STAMP)::
+( \ +( \
$(NO_TRACE_MAKE) $(FILELIST); \ $(NO_TRACE_MAKE) $(FILELIST); \
MD5SUM=$$(cat $(FILELIST) | (md5sum || md5) 2>/dev/null | awk '{print $$1}'); \ MD5SUM=$$(cat $(FILELIST) $(OVERRIDELIST) | (md5sum || md5) 2>/dev/null | awk '{print $$1}'); \
[ -f "$@.$$MD5SUM" ] || { \ [ -f "$@.$$MD5SUM" ] || { \
rm -f $@.*; \ rm -f $@.*; \
touch $@.$$MD5SUM; \ touch $@.$$MD5SUM; \

Loading…
Cancel
Save