blob: 668f955827a214c9f8c76c3c22dbbd3dc3659dbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
#!/bin/bash
# Include this script using these lines at the top of your bash script:
# SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# source ${SCRIPT_DIR}/platforms-common.sh
function quit
{
echo "ERROR: It doesn't look like you're in a platforms repo"
echo "ERROR: This is missing: $1"
exit 1
}
function gitnuke
{
echo "cleaning directory $*"
pushd $*
git reset --hard HEAD && git clean -dfx
popd
}
function clean_workspace
{
export -f gitnuke
find . -name ".git" -type d -exec bash -c 'gitnuke "{}/.."' \;
rm -f prebuilts/android/*/ramdisk.img
}
function check_workspace
{
local debug=$1
local mandatory_dirs=(
.repo
arm-tf
build-scripts
model-scripts
uefi/edk2
uefi/edk2/edk2-platforms
)
for ((i=0;i<${#mandatory_dirs[@]};++i)); do
if [ ! -e ${mandatory_dirs[i]} ]; then
quit ${mandatory_dirs[i]}
else
if [[ "${debug}" == "debug" ]]; then
#debugging - make sure we have what we expected to have in each dir
pushd ${mandatory_dirs[i]}
git log --pretty=format:"%h %ad %s%x09[%an]" --date=short -5
ls -al
popd
fi
fi
done
}
function show_commit
{
gitdir=$1
dir=`echo $gitdir | sed -e "s#^\.\/##g" -e "s#\\/\.git/\.\.##g"`
pushd $dir > /dev/null
#git remote -v | grep fetch
commitid=`git log --oneline -1 --pretty=format:"%h" --date=short 2> /dev/null`
if [ "$?" == "0" ]; then
echo "$commitid $dir"
fi
popd > /dev/null
}
function sha_list
{
export -f show_commit
echo "commit repo"
echo "------- --------------------- "
find . -name ".git" -type d -exec bash -c 'show_commit "{}/.."' \; | sort
}
|