aosp bitmap index

This commit is contained in:
bigeagle 2016-07-27 23:29:25 +08:00
parent b2fc0ebd33
commit 41e933da6a

20
aosp.sh
View File

@ -1,6 +1,8 @@
#!/bin/bash
set -e
REPO=${REPO:-"/usr/local/bin/repo"}
USE_BITMAP_INDEX=${USE_BITMAPT_INDEX:-"0"}
function repo_init() {
mkdir -p $TUNASYNC_WORKING_DIR
@ -13,9 +15,25 @@ function repo_sync() {
$REPO sync -f
}
if [ ! -d "$TUNASYNC_WORKING_DIR/git-repo.git" ]; then
function git_repack() {
echo "Start writing bitmap index"
while read repo; do
cd $repo
size=$(du -sm .|cut -f1)
if [[ "$size" -gt "100" ]]; then
echo $repo, ${size}M
git repack -a -b -d
fi
done < <$(find $TUNASYNC_WORKING_DIR -type d -not -path "*/.repo/*" -name "*.git")
}
if [[ ! -d "$TUNASYNC_WORKING_DIR/git-repo.git" ]]; then
echo "Initializing AOSP mirror"
repo_init
fi
repo_sync
if [[ "$USE_BITMAP_INDEX" == "1" ]]; then
git_repack
do