aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-30 19:29:06 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-30 19:29:06 +0200
commit875d015fc4743a457ca504ccf3ef3a9ae26d0eb3 (patch)
treefd945ca25d3a278231a675ca7497542917af53d9
parentcda8a65123b95b1c59fd43cec8a0863b484c5deb (diff)
downloaddna-backup-875d015fc4743a457ca504ccf3ef3a9ae26d0eb3.tar.gz
dna-backup-875d015fc4743a457ca504ccf3ef3a9ae26d0eb3.zip
simplify exp by not using mktemp
-rw-r--r--exp/Makefile18
-rwxr-xr-xexp/exp.sh8
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