From cda8a65123b95b1c59fd43cec8a0863b484c5deb Mon Sep 17 00:00:00 2001
From: n-peugnet <n.peugnet@free.fr>
Date: Thu, 30 Sep 2021 19:06:33 +0200
Subject: move script in its own file for comfort

and start making some stats
---
 exp/Makefile | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

(limited to 'exp/Makefile')

diff --git a/exp/Makefile b/exp/Makefile
index f5a9a4c..a8f9675 100644
--- a/exp/Makefile
+++ b/exp/Makefile
@@ -1,23 +1,24 @@
 REPO_URL  := https://club1.fr/~nicolas/git/dna-backup/
 
-TEMP_TEMPLATE := dna-backup-bench-XXXXX
-MKTEMP        := mktemp --tmpdir -d $(TEMP_TEMPLATE)
-
 REPO_PATH := repo
 GIT_PATH  := git
 GITC      := git -C $(REPO_PATH)
 
-.PHONY: apply
-apply: TEMP := $(shell $(MKTEMP))
-apply: commits
-	$(MAKE) -C .. dna-backup
-	cat $< | while read i; do \
-		$(GITC) checkout `echo "$$i" | cut -f1`; \
-		../dna-backup commit -v 2 $(REPO_PATH) $(TEMP); \
-	done
-	du -bad 2 $(TEMP)
-
-commits: Makefile | repo git
+.PHONY: all
+all: versions
+	@echo "total size    : `awk '{s+=$$1}END{print s}' $<`"
+	@echo "version count : `wc -l $<`"
+
+versions: results
+	grep [0-9]$$ $< | cut -f1 > $@
+
+results: commits ../dna-backup
+	./exp.sh $< $(REPO_PATH) 1| sort -k2 >$@
+
+../dna-backup: .FORCE
+	@$(MAKE) -C .. --no-print-directory dna-backup
+
+commits: | repo git
 	$(GITC) log --reverse --no-merges --pretty=tformat:"%H	%as" \
 	| sort --unique --key=2 \
 	> $@
@@ -30,6 +31,6 @@ repo git:
 .PHONY: clean
 clean:
 	rm -rf $(REPO_PATH) $(GIT_PATH)
-	rm -f commits
+	rm -f commits results versions
 
 .FORCE: ;
-- 
cgit v1.2.3