[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XEN PATCH v9 07/30] build: rework cloc recipe


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 25 Jan 2022 11:00:40 +0000
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Anthony PERARD <anthony.perard@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 25 Jan 2022 11:01:34 +0000
  • Ironport-data: A9a23:+pfh7aibXfA2Km5e4+tRgMcqX161nBcKZh0ujC45NGQN5FlHY01je htvDG6PbPfcNGLxc9xxbYvkoU8PvJCEydMySARtriA9Eigb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0GE/NtTo5w7Rj2tcy3IDga++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1rm8TvbjUlJpTSs7wNAkRJNQxfY4l/reqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHiOp8fvXdxiynUF/88TbjIQrnQ5M8e1zA17ixLNaiCN 5RBOWAxBPjGSyBIF1QrIaMkpcCho1TgcyZXrFKKpZNitgA/yyQuieOwYbI5YOeiXt5Jl0yVo mbH+WXRARwAMtGbjz2f/RqEmevnjS79HoUIG9WQ9ONugVCV7nweDlsRT1TTiem0jAuyVsxSL 2QQ+zEytu4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7ZEmPH7P+VEssR4b+OxoVJPsfZq+z+8W3WByB9eftWDd0QPCRr2KhbGSpwEIcBeRygcy78 tdmtBFeb7NMWQ=
  • Ironport-sdr: NtsLjjrdj9hPcGsdnFY8PJKFM2i5xELmVlA0+3s0vj3JFOnztbnpPRgBNwZrw8ebzViEt0DDdR SPyTdw4Sb/pHBl0/SrpGjKU0H0HHRAeHnDoctYyEXiaUbfAPr7ZlPvmsO2zJH7jCV4AA5LNtHY j1NNxZmKVvgp/zXBvBzu/5SEz9oqDid/m5IDf+mxQ1D3gYV/pMgNLeN7IVvni4Zu39z1jTSmCB +eAOxXFrohnDAGMs02yDRqap9+I/lkOBtd+Iuy18kGJI6M3lryzLty1UVz6ThECSqrc8BOcMyQ Yllp7LZfcaS/x5M8RrwH46a8
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

We are going to make other modifications to the cloc recipe, so this
patch prepare make those modification easier.

We replace the Makefile meta programming by just a shell script which
should be easier to read and is actually faster to execute.

Instead of looking for files in "$(BASEDIR)", we use "." which is give
the same result overall. We also avoid the need for a temporary file
as cloc can read the list of files from stdin.

No change intended to the output of `cloc`.

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---

Notes:
    v9:
    - acked
    
    v8:
    - rework cloc patch, move it ahead of problematic changes
      this is only a convertion to shell script with a single other change.

 xen/Makefile | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index d953dc50ac6a..ec24856a5d46 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -473,14 +473,12 @@ _MAP:
 
 .PHONY: cloc
 cloc:
-       $(eval tmpfile := $(shell mktemp))
-       $(foreach f, $(shell find $(BASEDIR) -name *.o.d), \
-               $(eval path := $(dir $(f))) \
-               $(eval names := $(shell grep -o "[a-zA-Z0-9_/-]*\.[cS]" $(f))) \
-               $(foreach sf, $(names), \
-                       $(shell if test -f $(path)/$(sf) ; then echo 
$(path)/$(sf) >> $(tmpfile); fi;)))
-       cloc --list-file=$(tmpfile)
-       rm $(tmpfile)
+       find . -name '*.o.d' | while read f; do \
+           for sf in $$(grep -o "[a-zA-Z0-9_/-]*\.[cS]" $$f); do \
+               sf="$$(dirname $$f)/$$sf"; \
+               test -f "$$sf" && echo "$$sf"; \
+           done; \
+       done | cloc --list-file=-
 
 endif #config-build
 
-- 
Anthony PERARD




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.