mirror of
https://github.com/tuna/tunasync-scripts.git
synced 2025-04-19 11:42:43 +00:00
calculate the size of some git repos
This commit is contained in:
parent
513ff49b3f
commit
f34df2f0ff
@ -71,9 +71,9 @@ logging.basicConfig(
|
|||||||
def sizeof_fmt(num, suffix='B'):
|
def sizeof_fmt(num, suffix='B'):
|
||||||
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
|
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
|
||||||
if abs(num) < 1024.0:
|
if abs(num) < 1024.0:
|
||||||
return "%3.1f%s%s" % (num, unit, suffix)
|
return "%3.2f %s%s" % (num, unit, suffix)
|
||||||
num /= 1024.0
|
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):
|
def md5_check(file: Path, md5: str = None):
|
||||||
m = hashlib.md5()
|
m = hashlib.md5()
|
||||||
|
@ -13,11 +13,14 @@ function update_cocoapods_git() {
|
|||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update
|
/usr/bin/timeout -s INT 3600 git remote -v update
|
||||||
git repack -a -b -d
|
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 ===="
|
echo "==== SYNC $repo_dir DONE ===="
|
||||||
}
|
}
|
||||||
|
|
||||||
UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/CocoaPods"}
|
UPSTREAM_BASE=${TUNASYNC_UPSTREAM_URL:-"https://github.com/CocoaPods"}
|
||||||
REPOS=("Specs")
|
REPOS=("Specs")
|
||||||
|
total_size=0
|
||||||
|
|
||||||
for repo in ${REPOS[@]}; do
|
for repo in ${REPOS[@]}; do
|
||||||
if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then
|
if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then
|
||||||
@ -26,3 +29,5 @@ for repo in ${REPOS[@]}; do
|
|||||||
fi
|
fi
|
||||||
update_cocoapods_git "$TUNASYNC_WORKING_DIR/${repo}.git"
|
update_cocoapods_git "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
@ -11,10 +11,13 @@ function update_homebrew_git() {
|
|||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update
|
/usr/bin/timeout -s INT 3600 git remote -v update
|
||||||
git repack -a -b -d
|
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 ===="
|
echo "==== SYNC $repo_dir DONE ===="
|
||||||
}
|
}
|
||||||
|
|
||||||
brews=("brew" "homebrew-core" "homebrew-cask" "homebrew-cask-fonts" "homebrew-cask-drivers" "linuxbrew-core")
|
brews=("brew" "homebrew-core" "homebrew-cask" "homebrew-cask-fonts" "homebrew-cask-drivers" "linuxbrew-core")
|
||||||
|
total_size=0
|
||||||
|
|
||||||
for brew in ${brews[@]}; do
|
for brew in ${brews[@]}; do
|
||||||
if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then
|
if [[ ! -d "$TUNASYNC_WORKING_DIR/${brew}.git" ]]; then
|
||||||
@ -23,3 +26,5 @@ for brew in ${brews[@]}; do
|
|||||||
fi
|
fi
|
||||||
update_homebrew_git "$TUNASYNC_WORKING_DIR/${brew}.git"
|
update_homebrew_git "$TUNASYNC_WORKING_DIR/${brew}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
5
llvm.sh
5
llvm.sh
@ -11,10 +11,13 @@ function repo_update() {
|
|||||||
echo "==== SYNC $repo_dir START ===="
|
echo "==== SYNC $repo_dir START ===="
|
||||||
/usr/bin/timeout -s INT 3600 git remote -v update
|
/usr/bin/timeout -s INT 3600 git remote -v update
|
||||||
git repack -a -b -d
|
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 ===="
|
echo "==== SYNC $repo_dir DONE ===="
|
||||||
}
|
}
|
||||||
|
|
||||||
repos=("llvm" "clang" "libcxx" "lldb" "clang-tools-extra" "polly" "zorg" "compiler-rt" "libcxxabi" "lld" "lnt")
|
repos=("llvm" "clang" "libcxx" "lldb" "clang-tools-extra" "polly" "zorg" "compiler-rt" "libcxxabi" "lld" "lnt")
|
||||||
|
total_size=0
|
||||||
|
|
||||||
for repo in ${repos[@]}; do
|
for repo in ${repos[@]}; do
|
||||||
if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then
|
if [[ ! -d "$TUNASYNC_WORKING_DIR/${repo}.git" ]]; then
|
||||||
@ -23,3 +26,5 @@ for repo in ${repos[@]}; do
|
|||||||
fi
|
fi
|
||||||
repo_update "$TUNASYNC_WORKING_DIR/${repo}.git"
|
repo_update "$TUNASYNC_WORKING_DIR/${repo}.git"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Total size is" $(numfmt --to=iec $total_size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user