<div dir="ltr">I sent this (my first ever) patch in a few weeks ago, has anyone had time to review it? If I did something wrong, please let me know. Thanks.<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><span><p><b><img src="cid:part1.01040207.03090801@caengineering.com" alt="cid:image001.png@01CFCC2A.38674B20" height="48" width="182"></b></p>
<p><b><span style="font-size:9.0pt;color:black"> Ryan Lindeman</span></b><span style="font-size:9.0pt;color:black">, Software Engineer</span></p>
<p><span style="font-size:9.0pt;color:black"> 11778 South
Election Road, Suite 260 <b>|</b> Draper, UT 84020
<b>|</b> USA</span></p>
<p><span style="font-size:9.0pt;color:black"> <a href="tel:801.748.4900" value="+18017484900" target="_blank">801.748.4900</a>,
ext. 38 (<b>office</b>)</span></p>
<p><span style="font-size:9.0pt;color:black"> </span><a href="mailto:rlindeman@caengineering.com" target="_blank"><span style="font-size:9.0pt;color:black">rlindeman@caengineering.com</span></a><span style="font-size:9.0pt;color:black"> | </span><a href="http://www.caengineering.com/" target="_blank"><span style="font-size:9.0pt;color:black">www.caengineering.com</span></a><span style="font-size:9.0pt;color:black"></span></p>
<p><span style="font-size:9.0pt"> </span></p>
<p><b><span style="font-size:9.0pt;color:black">|</span></b><span style="font-size:9.0pt;color:black"> CONFIDENTIALITY
NOTICE <b>|</b></span></p>
<p><span style="font-size:8.0pt;color:black">The information
in this email may be confidential and/or privileged.
This email is intended to be reviewed by only the
individual or organization named as a recipient or
cc:. If you are not the intended recipient or an
authorized representative of the intended recipient,
you are hereby notified that any review,
dissemination or copying of this email and its
attachments, if any, or the information contained
herein is prohibited. If you have received this
email in error, please immediately notify the sender
by return email and delete this email from your
system.</span></p></span></div></div></div>
<br><div class="gmail_quote">On Fri, Aug 28, 2015 at 2:05 PM, Ryan Lindeman <span dir="ltr"><<a href="mailto:rlindeman@caengineering.com" target="_blank">rlindeman@caengineering.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch addresses an error caused by adding feeds that contain a Makefile<br>
in the root directory. The error is typically shown as follows:<br>
.../info/.<a href="http://files-packageinfo.mk:1" rel="noreferrer" target="_blank">files-packageinfo.mk:1</a>: * target pattern contains no `%'. Stop.<br>
OR<br>
.../info/.<a href="http://files-targetinfo.mk:1" rel="noreferrer" target="_blank">files-targetinfo.mk:1</a>: * target pattern contains no `%'. Stop.<br>
<br>
The root cause of the error is due to problems with the $(FILELIST): rule in<br>
the include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> file which attempts to strip off the $(SCAN_DIR)/ and<br>
/Makefile: ... contents of the lines provided by the FIND_L command. When a<br>
feed contains a single Makefile in the root directory the /Makefile: ...<br>
portion is not removed since the $(SCAN_DIR)/ has already removed the<br>
preceding / before the Makefile. This then causes extra characters to be<br>
evaluated by grep in the $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: rule which<br>
is where the above error is eventually reported by Make.<br>
<br>
The solution is to allow for a portion of the $(SCAN_DIR) to be included in the<br>
results produced by the $(FILELIST): rule. This patch creates a new variable<br>
called PREFIX_DIR which becomes the directory portion of $(SCAN_DIR) removed.<br>
This variable is specified by the update_index method of the scripts/feeds<br>
file. Since the include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> file is also used to scan the packages folder<br>
the default value for PREFIX_DIR must be empty (which is specified at the top<br>
of the include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> file). These changes results in the<br>
info/.files-$(SCAN_TARGET).mk files to include the remainder of the<br>
$(SCAN_DIR) path not removed so the $(SCAN_DIR) path information is removed<br>
from the PackageDir rule specified in include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a>. This has the added<br>
benefit of simplifying the readability of this rule IMHO.<br>
<br>
Signed-off-by: Ryan Lindeman <<a href="mailto:rlindeman@caengineering.com">rlindeman@caengineering.com</a>><br>
---<br>
include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> | 21 +++++++++++----------<br>
scripts/feeds | 4 ++--<br>
2 files changed, 13 insertions(+), 12 deletions(-)<br>
<br>
diff --git a/include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> b/include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a><br>
index 5af0359..8561b30 100644<br>
--- a/include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a><br>
+++ b/include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a><br>
@@ -8,6 +8,7 @@ include $(TOPDIR)/include/<a href="http://host.mk" rel="noreferrer" target="_blank">host.mk</a><br>
SCAN_TARGET ?= packageinfo<br>
SCAN_NAME ?= package<br>
SCAN_DIR ?= package<br>
+PREFIX_DIR ?=<br>
TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp<br>
FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE)<br>
OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE)<br>
@@ -28,15 +29,15 @@ endef<br>
<br>
define PackageDir<br>
$(TMP_DIR)/.$(SCAN_TARGET): $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1)<br>
- $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(SCAN_DIR)/$(2)/Makefile $(SCAN_STAMP) $(foreach DEP,$(DEPS_$(SCAN_DIR)/$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(SCAN_DIR)/$(2)/$(DEP))))<br>
+ $(TMP_DIR)/info/.$(SCAN_TARGET)-$(1): $(2)/Makefile $(SCAN_STAMP) $(foreach DEP,$(DEPS_$(2)/Makefile) $(SCAN_DEPS),$(wildcard $(if $(filter /%,$(DEP)),$(DEP),$(2)/$(DEP))))<br>
{ \<br>
- $$(call progress,Collecting $(SCAN_NAME) info: $(SCAN_DIR)/$(2)) \<br>
- echo Source-Makefile: $(SCAN_DIR)/$(2)/Makefile; \<br>
+ $$(call progress,Collecting $(SCAN_NAME) info: $(2)) \<br>
+ echo Source-Makefile: $(2)/Makefile; \<br>
$(if $(3),echo Override: $(3),true); \<br>
- $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(SCAN_DIR)/$(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \<br>
- mkdir -p "$(TOPDIR)/logs/$(SCAN_DIR)/$(2)"; \<br>
- $(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; \<br>
- $$(call progress,ERROR: please fix $(SCAN_DIR)/$(2)/Makefile - see logs/$(SCAN_DIR)/$(2)/dump.txt for details\n) \<br>
+ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(2) $(SCAN_MAKEOPTS) 2>/dev/null || { \<br>
+ mkdir -p "$(TOPDIR)/logs/$(2)"; \<br>
+ $(NO_TRACE_MAKE) --no-print-dir -r DUMP=1 FEED="$(call feedname,$(2))" -C $(2) $(SCAN_MAKEOPTS) > $(TOPDIR)/logs/$(2)/dump.txt 2>&1; \<br>
+ $$(call progress,ERROR: please fix $(2)/Makefile - see logs/$(2)/dump.txt for details\n) \<br>
rm -f $$@; \<br>
}; \<br>
echo; \<br>
@@ -55,11 +56,11 @@ endif<br>
<br>
$(FILELIST): $(OVERRIDELIST)<br>
rm -f $(TMP_DIR)/info/.files-$(SCAN_TARGET)-*<br>
- $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@<br>
+ $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if $(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile | xargs grep -aHE 'call $(GREP_STRING)' | sed -e 's#^$(PREFIX_DIR)/##' -e 's#/Makefile:.*##' | uniq | awk -v of=$(OVERRIDELIST) -f include/scan.awk > $@<br>
<br>
$(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)<br>
( \<br>
- cat $< | awk '{print "$(SCAN_DIR)/" $$0 "/Makefile" }' | xargs grep -HE '^ *SCAN_DEPS *= *' | awk -F: '{ gsub(/^.*DEPS *= */, "", $$2); print "DEPS_" $$1 "=" $$2 }'; \<br>
+ cat $< | awk '{print "$(if $(PREFIX_DIR),$(PREFIX_DIR)/)" $$0 "/Makefile" }' | xargs grep -HE '^ *SCAN_DEPS *= *' | awk -F: '{ gsub(/^.*DEPS *= */, "", $$2); print "DEPS_" $$1 "=" $$2 }'; \<br>
awk -F/ -v deps="$$DEPS" -v of="$(OVERRIDELIST)" ' \<br>
BEGIN { \<br>
while (getline < (of)) \<br>
@@ -73,7 +74,7 @@ $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)<br>
pkg=""; \<br>
if($$NF in override) \<br>
pkg=override[$$NF]; \<br>
- print "$$(eval $$(call PackageDir," info "," dir "," pkg "))"; \<br>
+ print "$$(eval $$(call PackageDir," info ",$(if $(PREFIX_DIR),$(PREFIX_DIR)/)" dir "," pkg "))"; \<br>
} ' < $<; \<br>
true; \<br>
) > $@<br>
diff --git a/scripts/feeds b/scripts/feeds<br>
index 79b5284..ddaf9f5 100755<br>
--- a/scripts/feeds<br>
+++ b/scripts/feeds<br>
@@ -99,8 +99,8 @@ sub update_index($)<br>
-d "./feeds/$name.tmp/info" or mkdir "./feeds/$name.tmp/info" or return 1;<br>
<br>
system("$mk -s prepare-mk OPENWRT_BUILD= TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");<br>
- system("$mk -s -f include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> IS_TTY=1 SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPS=\"$ENV{TOPDIR}/include/package*.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");<br>
- system("$mk -s -f include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> IS_TTY=1 SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPS=\"profiles/*.mk $ENV{TOPDIR}/include/<a href="http://target.mk" rel="noreferrer" target="_blank">target.mk</a>\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");<br>
+ system("$mk -s -f include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> IS_TTY=1 PREFIX_DIR=\"feeds\" SCAN_TARGET=\"packageinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"package\" SCAN_DEPS=\"$ENV{TOPDIR}/include/package*.mk\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");<br>
+ system("$mk -s -f include/<a href="http://scan.mk" rel="noreferrer" target="_blank">scan.mk</a> IS_TTY=1 PREFIX_DIR=\"feeds\" SCAN_TARGET=\"targetinfo\" SCAN_DIR=\"feeds/$name\" SCAN_NAME=\"target\" SCAN_DEPS=\"profiles/*.mk $ENV{TOPDIR}/include/<a href="http://target.mk" rel="noreferrer" target="_blank">target.mk</a>\" SCAN_DEPTH=5 SCAN_EXTRA=\"\" SCAN_MAKEOPTS=\"TARGET_BUILD=1\" TMP_DIR=\"$ENV{TOPDIR}/feeds/$name.tmp\"");<br>
system("ln -sf $name.tmp/.packageinfo ./feeds/$name.index");<br>
system("ln -sf $name.tmp/.targetinfo ./feeds/$name.targetindex");<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
1.7.9.5<br>
<br>
</font></span></blockquote></div><br></div>