mirror of
https://github.com/openwrt/packages.git
synced 2026-01-10 03:41:29 +00:00
836b4e1c73added --force-removal-of-dependent-packages but it does not do what the commit message says it does. When package A depends on package B (package B is a dependency of package A; package A is a dependent of package B), trying to remove package B while package A is installed will result in an error. Adding --force-removal-of-dependent-packages in this case will cause the removal of package B and package A (package B's dependent). But in the case of the CI testing step, it is package A that is being installed and removed. Removing package A with --force-removal-of-dependent-packages will not cause package B (package A's dependency) to be removed. This adds --autoremove to actually remove the package's dependencies. This also ignores any errors returned by opkg remove as --autoremove can sometimes falsely return an error[1]. [1]: https://github.com/openwrt/openwrt/issues/12241 Fixes:836b4e1c73("github-ci: add --force-removal-of-dependent-packages") Signed-off-by: Jeffery To <jeffery.to@gmail.com>
44 lines
1.2 KiB
Bash
Executable File
44 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# not enabling `errtrace` and `pipefail` since those are bash specific
|
|
set -o errexit # failing commands causes script to fail
|
|
set -o nounset # undefined variables causes script to fail
|
|
|
|
mkdir -p /var/lock/
|
|
|
|
opkg update
|
|
|
|
[ -n "${CI_HELPER:=''}" ] || CI_HELPER="/ci/.github/workflows/ci_helpers.sh"
|
|
|
|
for PKG in /ci/*.ipk; do
|
|
tar -xzOf "$PKG" ./control.tar.gz | tar xzf - ./control
|
|
# package name including variant
|
|
PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
|
|
# package version without release
|
|
PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
|
|
# package source contianing test.sh script
|
|
PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
|
|
|
|
echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
|
|
|
|
opkg install "$PKG"
|
|
|
|
export PKG_NAME PKG_VERSION CI_HELPER
|
|
|
|
TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
|
|
|
|
if [ -f "$TEST_SCRIPT" ]; then
|
|
echo "Use package specific test.sh"
|
|
if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
|
|
echo "Test successful"
|
|
else
|
|
echo "Test failed"
|
|
exit 1
|
|
fi
|
|
else
|
|
echo "No test.sh script available"
|
|
fi
|
|
|
|
opkg remove "$PKG_NAME" --force-removal-of-dependent-packages --force-remove --autoremove || true
|
|
done
|