[PATCH 4/4] Invoke apt-cache only once
"apt-cache show" accepts several packages at once; as the setup cost for
apt-cache loading is quiet high, this reduces the time needed for
"make correctstatus" significantly.
---
Makefile | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
index 70b1a41..75d622f 100755
--- a/Makefile
+++ b/Makefile
@@ -291,13 +291,11 @@ correctstatus: status apt-update
if [ "$(ARCHES)" != "source" ] ; then \
for ARCH in $(ARCHES_NOSRC); do \
export ARCH=$$ARCH; \
- for i in `$(apt) selected -f install`; do \
- echo $$ARCH:$$i; \
- $(apt) cache dumpavail | perl -000 -ne \
- "s/^(Package: .*)\$$/\$$1\nStatus: install ok installed/m; \
- print if /^Package: \Q$$i\E\s*\$$/m;" \
- >> $(ADIR)/$(CODENAME)-$$ARCH/status; \
- done; \
+ $(apt) selected -f install | \
+ xargs --no-run-if-empty $(apt) cache show | \
+ perl -000 -npe \
+ "s/^(Package: \S+)\$$/\$$1\nStatus: install ok installed/m;" \
+ >> $(ADIR)/$(CODENAME)-$$ARCH/status; \
done; \
fi
#
--
2.1.4
Reply to: