blob: 29a63984de57ed67a80a00939f6d82cdc4c99df1 (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/sh
get_buildfiles () {
${QUIET} || printf "${BLUE}Syncing sources..."
[ -d "$BUILDFILES_DIR" ] ||
mkdir -p $BUILDFILES_DIR
cd $BUILDFILES_DIR
{
git rev-parse --git-dir &&
git pull ||
git clone $BUILDFILES_GIT .
} > $(${VERBOSE}&&echo "/dev/stdout" || echo "/dev/null") 2>&1 && {
${QUIET} || printf "${GREEN}${CHECKMARK}\n"
}
}
get_deps () {
for f in $BUILDFILES_DIR/repo/*/$1/*.xibuild; do
sed -rn "s/^.*DEPS=\"(.*)\"/\1/p" $f
done
}
build_order () {
while [ "$#" != "0" ]; do
name=$1
shift
for dep in $(get_deps $name); do
set -- $@ $dep
echo $name $dep
done
done | tsort | reverse_lines
}
# get the revision hash of a given builddir
#
get_revision () {
cat $1/*.xibuild | sha512sum | cut -d' ' -f1
}
# return the installed revision of the given package
#
get_installed_revision () {
local infofile=${INSTALLED_DIR}/$1/info
[ -f $infofile ] && {
sed -rn "s/^REVISION=(.*)$/\1/p" $infofile
}
}
# test if the given package by name needs to be rebuilt
#
needs_build () {
[ "$(get_revision $(get_package_build $1))" != "$(get_installed_revision $1)" ]
}
get_package_build () {
local buildfile=$(find $BUILDFILES_DIR/repo -name "$1.xibuild" | head -1)
echo ${buildfile%/*}
}
build_package () {
local name=$(basename $1)
local builddir=$(get_package_build $1)
[ -d "$builddir" ] && {
xibuild -ci -r ${SYSROOT} $builddir
} || {
${QUIET} || printf "${RED}Package $1 does not exist!\n"
}
}
build () {
$DO_SYNC && get_buildfiles
mentioned=$@
pkgs=$(build_order $@)
set --
for p in $pkgs; do
needs_build $p && set -- $@ $p
done
printf "${LIGHT_BLUE}The following packages will be built: \n"
echo "\t${BLUE}$@\n"
prompt_question "${WHITE} Continue?" &&
for package in $@; do
build_package $package || return 1
done
}
|