-
Notifications
You must be signed in to change notification settings - Fork 0
/
do_pkgop
executable file
·111 lines (98 loc) · 2.42 KB
/
do_pkgop
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh
UPDATE_CURRENT=false
forpkg=$1;
ACTION=$2;
. ./packaging.sh
if [ -f state/PKGNAME ]; then
curpkg=$(cat state/PKGNAME);
fi;
if [ -z "${forpkg}" ]; then forpkg=${curpkg}; fi
if [ -z "${ACTION}" ]; then
./setsource ${forpkg};
exit;
elif [ "${curpkg}" != "${forpkg}" ] || ${UPDATE_CURRENT} || [ ! -f work/${forpkg}.tar ] ; then
./setsource ${forpkg};
fi;
import_state
export SUCCESS
pkg_done() {
local op=$1;
if [ -z "${SUCCESS}" ]; then
echo "Failed '${ACTION}' for ${PKGNAME}";
if [ -n "${op}" ]; then
touch ${PACKAGING_ROOT}/output/${PKGNAME}/_failed.${op};
rm -f ${PACKAGING_ROOT}/output/${PKGNAME}/_.${op};
fi;
else
echo "Success with '${ACTION}' for ${PKGNAME}";
if [ -n "${op}" ]; then
touch ${PACKAGING_ROOT}/output/${PKGNAME}/_.${op};
rm -f ${PACKAGING_ROOT}/output/${PKGNAME}/_failed.${op};
fi;
fi;
exit;
}
if [ -z "${PKGTOOL}" ]; then
echo "Couldn't determine package tool!";
exit;
fi;
case ${ACTION} in
prep|prepare)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
pkg_done PREP;
;;
package|create)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
pkg_done BUILD;
;;
install|require)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
pkg_done INSTALL;
;;
push)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
pkg_done PUSHED;
;;
latest|pushup)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
pkg_done UPDATED;
;;
check)
if ${PKGTOOL} check $@; then
echo "Version ${VERSION} of ${PKGNAME} is up to date";
else
echo "Version ${VERSION} of ${PKGNAME} needs to be built";
fi;
;;
clean)
${PKGTOOL} ${ACTION} $@ && SUCCESS=yes;
("cd" output/${PKGNAME}; rm -f FILES INSTALLED PUSHED);
echo "# Contents of output/${PKGNAME}";
ls -l output/${PKGNAME}
;;
make|remake)
done=
${PKGTOOL} prep && ${PKGTOOL} package && SUCCESS=yes;
pkg_done BUILD;
;;
make+|make+install)
${PKGTOOL} prep && ${PKGTOOL} create && ${PKGTOOL} install && SUCCESS=yes;
pkg_done BUILD;
;;
remake+|remake+install)
${PKGTOOL} prep && ${PKGTOOL} rebuild && ${PKGTOOL} install && SUCCESS=yes;
pkg_done BUILD;
;;
make++|make+install+push)
${PKGTOOL} prep && ${PKGTOOL} create && ${PKGTOOL} install && ${PKGTOOL} push && SUCCESS=yes;
pkg_done BUILD;
;;
remake++|remake+install+push)
${PKGTOOL} prep && ${PKGTOOL} rebuild && ${PKGTOOL} install && ${PKGTOOL} push && SUCCESS=yes;
pkg_done BUILD;
;;
*)
echo "Unknown package op ${ACTION}!";
exit 2;
;;
esac