3 # not enabling `errtrace` and `pipefail` since those are bash specific
4 set -o errexit
# failing commands causes script to fail
5 set -o nounset
# undefined variables causes script to fail
7 echo "src/gz packages_ci file:///ci" >> /etc
/opkg
/distfeeds.conf
9 FINGERPRINT
="$(usign -F -p /ci/packages_ci.pub)"
10 cp /ci
/packages_ci.pub
"/etc/opkg/keys/$FINGERPRINT"
16 [ -n "${CI_HELPER:=''}" ] || CI_HELPER
="/ci/.github/workflows/ci_helpers.sh"
18 for PKG
in /ci
/*.ipk
; do
19 tar -xzOf "$PKG" .
/control.
tar.gz |
tar xzf
- .
/control
20 # package name including variant
21 PKG_NAME
=$
(sed -ne 's#^Package: \(.*\)$#\1#p' .
/control
)
22 # package version without release
23 PKG_VERSION
=$
(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' .
/control
)
24 # package source contianing test.sh script
25 PKG_SOURCE
=$
(sed -ne 's#^Source: .*/\(.*\)$#\1#p' .
/control
)
27 echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
29 export PKG_NAME PKG_VERSION CI_HELPER
31 PRE_TEST_SCRIPT
=$
(find /ci
/ -name "$PKG_SOURCE" -type d
)/pre-test.sh
33 if [ -f "$PRE_TEST_SCRIPT" ]; then
34 echo "Use package specific pre-test.sh"
35 if sh
"$PRE_TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
36 echo "Pre-test successful"
38 echo "Pre-test failed"
42 echo "No pre-test.sh script available"
47 TEST_SCRIPT
=$
(find /ci
/ -name "$PKG_SOURCE" -type d
)/test.sh
49 if [ -f "$TEST_SCRIPT" ]; then
50 echo "Use package specific test.sh"
51 if sh
"$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
58 echo "No test.sh script available"
61 opkg remove
"$PKG_NAME" --force-removal-of-dependent-packages --force-remove --autoremove || true