diff options
author | n-peugnet <n.peugnet@free.fr> | 2021-10-08 15:35:44 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2021-10-08 15:35:44 +0200 |
commit | b3fee746c053990c88c0e067b1a654acbeb1cd1f (patch) | |
tree | de29e4efaaaccab453d321079f06831c41859b50 /exp/Makefile | |
parent | be1ad1c114b77b654bd3e79fdb18b5d5cf93ddd1 (diff) | |
download | dna-backup-b3fee746c053990c88c0e067b1a654acbeb1cd1f.tar.gz dna-backup-b3fee746c053990c88c0e067b1a654acbeb1cd1f.zip |
exp: repo 4k, better summary format, fix diff sizes
Diffstat (limited to 'exp/Makefile')
-rw-r--r-- | exp/Makefile | 46 |
1 files changed, 30 insertions, 16 deletions
diff --git a/exp/Makefile b/exp/Makefile index aaf377c..8fb4ce0 100644 --- a/exp/Makefile +++ b/exp/Makefile @@ -1,48 +1,62 @@ REPO_URL := https://club1.fr/~nicolas/git/dna-backup/ +SHELL := /bin/bash + +# Reset LC_NUMERIC to make printf thousands separator work as expected +export LC_NUMERIC := + export DNA_BACKUP ?= ../dna-backup export MAX_VERSION ?= 5 export COMMITS ?= commits -export BACKUP ?= backup +export DNA_4K ?= dna_4k +export DNA_8K ?= dna_8k export DIFFS ?= diffs export REPO_PATH ?= repo GIT_PATH := git GITC := git -C $(REPO_PATH) -DATADIRS := $(BACKUP) $(DIFFS) -SIZEFILES := $(DATADIRS:%=%-size) +DNADIRS := $(DNA_4K) $(DNA_8K) +DATADIRS := $(DNA_4K) $(DNA_8K) $(DIFFS) +SIZEFILES := $(DATADIRS:%=%.size) .PHONY: all exp all exp: summary.csv $(SIZEFILES) - @echo "============== SUMMARY ==============" - @cat $< | tr ',' '\t' - @echo "============== TOTAL ==============" - @for i in $(SIZEFILES); do cat $$i | paste -sd+ | bc; done | tr '\n' '\t' + @echo "=============== SUMMARY ===============" + @head -n 1 $< | while IFS="," read -r $(DATADIRS); do \ + printf "$(DATADIRS:%=\%13s)\n" $(DATADIRS:%=$$%); \ + done + @tail -n +2 $< | while IFS="," read -r $(DATADIRS); do \ + printf "$(DATADIRS:%=\%'13d)\n" $(DATADIRS:%=$$%); \ + done + @echo "================ TOTAL ================" + @for i in $(SIZEFILES); do cat $$i | paste -sd+ | bc; done | while read j; do \ + printf "%'13d " $$j; \ + done @echo summary.csv: $(SIZEFILES) echo $(DATADIRS) | tr ' ' ',' > $@ paste -d "," $^ >> $@ -backup-size: versions +$(DNADIRS:%=%.size): %.size: %.versions rm -rf $@ for i in $</*; do \ cut -f1 $$i | paste -sd+ | bc >> $@; \ done -diffs-size: diffs run - find $< -type f -exec du -ba {} + | cut -f1 > $@ +%.size: % run + find $< -type f -exec du -ba {} + | sort -k2 | cut -f1 > $@ -versions: results +%.versions: %.results rm -rf $@ mkdir -p $@ - for i in backup/*; do \ + for i in $*/*; do \ v=`echo $$i | cut -d / -f2`; \ grep $$i $< > $@/$$v ; \ done -results: backup run +%.results: % run find $< -type f -exec du -ba {} + \ | grep -v hashes \ | sort -k2 \ @@ -53,7 +67,7 @@ run: $(COMMITS) $(DNA_BACKUP) | $(DATADIRS) ./exp.sh touch $@ -backup diffs: +$(DATADIRS): mkdir $@ $(DNA_BACKUP): .FORCE @@ -75,9 +89,9 @@ clean: mostlyclean rm -f $(COMMITS) mostlyclean: resultsclean - rm -rf $(DATADIRS) versions run + rm -rf $(DATADIRS) $(DNADIRS:%=%.versions) run resultsclean: - rm -f results summary.csv $(SIZEFILES) + rm -f summary.csv $(SIZEFILES) .FORCE: ; |