-
Guilhem Saurel authoredGuilhem Saurel authored
get_deps_rpkg.sh 1.30 KiB
#!/bin/bash -eux
# Get dependencies from robotpkg
# eg. ./get_deps_rpkg.sh py-pinocchio math
ROBOTPKG=$1
CATEGORY=$2
INSTALL=()
cd "$CATEGORY/$ROBOTPKG"
make show-depends > /deps
deps=$(grep ../../ /deps | sed 's/.*install //' | sort -u | grep -v "../../${CATEGORY}/${ROBOTPKG/py-}" || true)
sysdeps=$(grep missing /deps | grep package | sed 's/.*package //;s/[><=].*//' | cut -d' ' -f1 || true)
apt-get update -qqy
for dep in $deps
do
cd "$dep"
echo "robotpkg-$(make show-var VARNAME=PKGBASE | tr '[:upper:]' '[:lower:]')" >> /install-candidates
echo "PREFER.$(echo "$dep" | cut -d/ -f4) = system" >> /opt/openrobots/etc/robotpkg.conf
done
for dep in $sysdeps
do
if apt show "robotpkg-$dep" > /dev/null
then
echo "robotpkg-$dep" >> /install-candidates
echo "PREFER.$(echo "$dep" | sed "s/${PY//.}//") = system" >> /opt/openrobots/etc/robotpkg.conf
else
echo "$dep" >> /install-candidates
fi
done
if [[ -f /install-candidates ]]
then
while read -r pkg
do apt depends "$pkg"
done < /install-candidates | grep Depends | awk '{ print $2}' | sort -u >> /dependencies
while read -r pkg
do grep -q "$pkg" /dependencies || INSTALL+=("$pkg")
done < /install-candidates
apt-get install -qqy "${INSTALL[@]}"
fi
cd "../../$CATEGORY/$ROBOTPKG"
make clean