[util-pkgtree] split from buildtree

This commit is contained in:
udeved 2015-02-16 20:33:20 +01:00
parent 7b90041a92
commit 42cc20c151

48
lib/util-pkgtree.sh Normal file
View file

@ -0,0 +1,48 @@
#!/bin/bash
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
sync_tree(){
cd ${tree_dir}
for repo in ${repo_tree[@]};do
if [[ -d packages-$repo ]];then
cd packages-$repo
if [ "$(git log --pretty=%H ...refs/heads/master^)" = "$(git ls-remote origin -h refs/heads/master |cut -f1)" ]; then
msg "$repo is up to date"
else
msg "Syncing $repo ..."
git pull origin master
fi
cd ..
else
msg "Cloning $repo ..."
git clone ${host_tree}/packages-$repo.git
fi
done
cd ..
}
sync_tree_abs(){
cd ${tree_dir}/abs
if [[ -d packages ]];then
cd packages
if [ "$(git log --pretty=%H ...refs/heads/master^)" = "$(git ls-remote origin -h refs/heads/master |cut -f1)" ]; then
msg "abs is up to date"
else
msg "Syncing abs ..."
git pull origin master
fi
cd ..
else
msg "Cloning abs ..."
git clone ${host_tree_abs}.git
fi
cd ..
}