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 export 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: \(.*\)$#\1#p' .
/control
)
24 PKG_VERSION
="${PKG_VERSION%-[!-]*}"
25 # package source containing test.sh script
26 PKG_SOURCE
=$
(sed -ne 's#^Source: \(.*\)$#\1#p' .
/control
)
27 PKG_SOURCE
="${PKG_SOURCE#/feed/}"
30 echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
32 if ! [ -d "/ci/$PKG_SOURCE" ]; then
33 echo "$PKG_SOURCE is not a directory"
37 PRE_TEST_SCRIPT
="/ci/$PKG_SOURCE/pre-test.sh"
38 TEST_SCRIPT
="/ci/$PKG_SOURCE/test.sh"
40 if ! [ -f "$TEST_SCRIPT" ]; then
41 echo "No test.sh script available"
45 export PKG_NAME PKG_VERSION
47 if [ -f "$PRE_TEST_SCRIPT" ]; then
48 echo "Use package specific pre-test.sh"
49 if sh
"$PRE_TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
50 echo "Pre-test successful"
52 echo "Pre-test failed"
56 echo "No pre-test.sh script available"
61 echo "Use package specific test.sh"
62 if sh
"$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
63 echo "Test successful"
69 opkg remove
"$PKG_NAME" --force-removal-of-dependent-packages --force-remove --autoremove || true