aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-30 19:06:33 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-30 19:06:33 +0200
commitcda8a65123b95b1c59fd43cec8a0863b484c5deb (patch)
treec4849b9b21dd475b574302043e1b83ddab85841c
parent3e88cb43928e2368acd669913c3bf32693174764 (diff)
downloaddna-backup-cda8a65123b95b1c59fd43cec8a0863b484c5deb.tar.gz
dna-backup-cda8a65123b95b1c59fd43cec8a0863b484c5deb.zip
move script in its own file for comfort
and start making some stats
-rw-r--r--exp/.gitignore1
-rw-r--r--exp/Makefile31
-rwxr-xr-xexp/exp.sh18
3 files changed, 35 insertions, 15 deletions
diff --git a/exp/.gitignore b/exp/.gitignore
index a0991ff..a29a67a 100644
--- a/exp/.gitignore
+++ b/exp/.gitignore
@@ -1,3 +1,4 @@
*
!.gitignore
+!exp.sh
!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: ;
diff --git a/exp/exp.sh b/exp/exp.sh
new file mode 100755
index 0000000..8cc1fa4
--- /dev/null
+++ b/exp/exp.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+commits_file=$1
+repo_path=$2
+
+temp_templ="dna-backup-bench-XXXXX"
+mktemp="mktemp --tmpdir -d $temp_templ"
+
+temp=$($mktemp)
+echo temp dir: $temp >&2
+
+cat $commits_file | while read i
+do
+ hash=$(echo "$i" | cut -f1)
+ git -C $repo_path checkout $hash
+ ../dna-backup commit -v 2 $repo_path $temp
+done
+du -bad 2 $temp