diff --git a/anaconda.py b/anaconda.py index 39e4a53..a2757ba 100755 --- a/anaconda.py +++ b/anaconda.py @@ -71,9 +71,9 @@ logging.basicConfig( def sizeof_fmt(num, suffix='B'): for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']: if abs(num) < 1024.0: - return "%3.1f%s%s" % (num, unit, suffix) + return "%3.2f %s%s" % (num, unit, suffix) num /= 1024.0 - return "%.1f%s%s" % (num, 'Yi', suffix) + return "%.2f %s%s" % (num, 'Yi', suffix) def md5_check(file: Path, md5: str = None): m = hashlib.md5() diff --git a/cocoapods.sh b/cocoapods.sh index f47aef4..0d4a35c 100755 --- a/cocoapods.sh +++ b/cocoapods.sh @@ -13,11 +13,14 @@ function update_cocoapods_git() { echo "==== SYNC $repo_dir START ====" /usr/bin/timeout -s INT 3600 git remote -v update git repack -a -b -d + sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') + total_size=$(($total_size+1024*$sz)) echo "==== SYNC $repo_dir DONE ====" } UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/CocoaPods"} REPOS=("Specs") +total_size=0 for repo in ${REPOS[@]}; do if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then @@ -26,3 +29,5 @@ for repo in ${REPOS[@]}; do fi update_cocoapods_git "$TUNASYNC_WORKING_DIR/${repo}.git" done + +echo "Total size is" $(numfmt --to=iec $total_size) diff --git a/homebrew.sh b/homebrew.sh index b303966..c304f3a 100755 --- a/homebrew.sh +++ b/homebrew.sh @@ -11,10 +11,13 @@ function update_homebrew_git() { echo "==== SYNC $repo_dir START ====" /usr/bin/timeout -s INT 3600 git remote -v update git repack -a -b -d + sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') + total_size=$(($total_size+1024*$sz)) echo "==== SYNC $repo_dir DONE ====" } brews=("brew" "homebrew-core" "homebrew-cask" "homebrew-cask-fonts" "homebrew-cask-drivers" "linuxbrew-core") +total_size=0 for brew in ${brews[@]}; do if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then @@ -23,3 +26,5 @@ for brew in ${brews[@]}; do fi update_homebrew_git "$TUNASYNC_WORKING_DIR/${brew}.git" done + +echo "Total size is" $(numfmt --to=iec $total_size) diff --git a/llvm.sh b/llvm.sh index aca707d..ab2a649 100755 --- a/llvm.sh +++ b/llvm.sh @@ -11,10 +11,13 @@ function repo_update() { echo "==== SYNC $repo_dir START ====" /usr/bin/timeout -s INT 3600 git remote -v update git repack -a -b -d + sz=$(git count-objects -v|grep -Po '(?<=size-pack: )\d+') + total_size=$(($total_size+1024*$sz)) echo "==== SYNC $repo_dir DONE ====" } repos=("llvm" "clang" "libcxx" "lldb" "clang-tools-extra" "polly" "zorg" "compiler-rt" "libcxxabi" "lld" "lnt") +total_size=0 for repo in ${repos[@]}; do if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then @@ -23,3 +26,5 @@ for repo in ${repos[@]}; do fi repo_update "$TUNASYNC_WORKING_DIR/${repo}.git" done + +echo "Total size is" $(numfmt --to=iec $total_size)