A) Use `sort -u` instead of just `uniq`
B) First add kernel packages alphabetically sorted, then all others 
alphabetically sorted.
   This allows other packages to override kernel configs if necessary.

Note: If find has no action for matches then also pruned folders are included 
in the result list, therefore specify the default action -print explicitly.

Signed-off-by: Matthias Bücher <m...@maddes.net>



Additional info:
The current order of packages in tmp/.packageinfo (and targets in 
tmp/.targetinfo) is random.
This is a problem when a package has to override a kernel config.
For example the nfs-root package I currently work on has to set CONFIG_NFS_FS=y 
to work properly, so the package has to be after kmod-fs-nfs (CONFIG_NFS_FS=m) 
which is not possible with a random order.
Patch is attached to avoid mangling (as with first sent mail), and following as 
text for review/comments.


Index: include/scan.mk
===================================================================
--- include/scan.mk     (revision 32786)
+++ include/scan.mk     (working copy)
@@ -39,7 +39,12 @@
 
 $(FILELIST):
        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 > $@
+       rm -f $@
+ifeq ($(SCAN_DIR),package)
+# Special case packages: kernel first; allows other packages to override 
kernel configs
+       $(call FIND_L, 'package/kernel') $(SCAN_EXTRA) -mindepth 1 $(if 
$(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile -print | xargs grep -HE 
'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 
's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | sort -u >> $@
+endif
+       $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if 
$(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -wholename 'package/kernel' -prune -o 
-name Makefile -print | xargs grep -HE 'call 
(Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 
's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | sort -u >> $@
 
 $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
        ( \

Index: include/scan.mk
===================================================================
--- include/scan.mk     (revision 32786)
+++ include/scan.mk     (working copy)
@@ -39,7 +39,12 @@
 
 $(FILELIST):
        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 > $@
+       rm -f $@
+ifeq ($(SCAN_DIR),package)
+# Special case packages: kernel first; allows other packages to override 
kernel configs
+       $(call FIND_L, 'package/kernel') $(SCAN_EXTRA) -mindepth 1 $(if 
$(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -name Makefile -print | xargs grep -HE 
'call (Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 
's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | sort -u >> $@
+endif
+       $(call FIND_L, $(SCAN_DIR)) $(SCAN_EXTRA) -mindepth 1 $(if 
$(SCAN_DEPTH),-maxdepth $(SCAN_DEPTH)) -wholename 'package/kernel' -prune -o 
-name Makefile -print | xargs grep -HE 'call 
(Build/DefaultTargets|Build(Package|Target)|.+Package)' | sed -e 
's#^$(SCAN_DIR)/##' -e 's#/Makefile:.*##' | sort -u >> $@
 
 $(TMP_DIR)/info/.files-$(SCAN_TARGET).mk: $(FILELIST)
        ( \
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to