From 875d015fc4743a457ca504ccf3ef3a9ae26d0eb3 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 30 Sep 2021 19:29:06 +0200 Subject: simplify exp by not using mktemp --- exp/Makefile | 18 ++++++++++++------ exp/exp.sh | 8 +------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/exp/Makefile b/exp/Makefile index a8f9675..c2e2e3f 100644 --- a/exp/Makefile +++ b/exp/Makefile @@ -4,16 +4,22 @@ REPO_PATH := repo GIT_PATH := git GITC := git -C $(REPO_PATH) +TEMP := temp + .PHONY: all -all: versions - @echo "total size : `awk '{s+=$$1}END{print s}' $<`" - @echo "version count : `wc -l $<`" +all: versions results + @echo "total size : `head --lines=1 results | cut -f1`" + @echo "version count : `wc -l versions`" versions: results grep [0-9]$$ $< | cut -f1 > $@ -results: commits ../dna-backup - ./exp.sh $< $(REPO_PATH) 1| sort -k2 >$@ +results: | $(TEMP) + du -bad 2 $(TEMP) | sort -k2 > $@ + +$(TEMP): commits ../dna-backup + rm -rf $(TEMP) + ./exp.sh $< $(REPO_PATH) $(TEMP) ../dna-backup: .FORCE @$(MAKE) -C .. --no-print-directory dna-backup @@ -30,7 +36,7 @@ repo git: .PHONY: clean clean: - rm -rf $(REPO_PATH) $(GIT_PATH) + rm -rf $(REPO_PATH) $(GIT_PATH) $(TEMP) rm -f commits results versions .FORCE: ; diff --git a/exp/exp.sh b/exp/exp.sh index 8cc1fa4..8c861a3 100755 --- a/exp/exp.sh +++ b/exp/exp.sh @@ -2,12 +2,7 @@ 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 +temp=$3 cat $commits_file | while read i do @@ -15,4 +10,3 @@ do git -C $repo_path checkout $hash ../dna-backup commit -v 2 $repo_path $temp done -du -bad 2 $temp -- cgit v1.2.3