Skip to content

Commit

Permalink
avoid force-yes with newer version of apt-get (heroku#51)
Browse files Browse the repository at this point in the history
force-yes was deprecated with 1.1, and split up into three new options.
Keep the same behavior by enabling all 3 options when a newer version is
detected.

This should fix errors at install time, which are tripping up the
current tests.

Fixes heroku#16.
  • Loading branch information
imirkin authored and EtienneM committed Dec 16, 2022
1 parent e80f456 commit ad5df5a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ APT_SOURCELIST_DIR="$CACHE_DIR/apt/sources" # place custom sources.list here
APT_SOURCES="$APT_SOURCELIST_DIR/sources.list"
APT_FILE_MANIFEST="${APT_FILE_MANIFEST:-Aptfile}"

APT_VERSION=$(apt-get -v | awk 'NR == 1{ print $2 }')

case "$APT_VERSION" in
0* | 1.0*) APT_FORCE_YES="--force-yes";;
*) APT_FORCE_YES="--allow-downgrades --allow-remove-essential --allow-change-held-packages";;
esac

if [ -f $APT_CACHE_DIR/$APT_FILE_MANIFEST ] && cmp -s $BUILD_DIR/$APT_FILE_MANIFEST $APT_CACHE_DIR/$APT_FILE_MANIFEST ; then
# Old Aptfile is the same as new
topic "Reusing cache"
Expand Down Expand Up @@ -72,7 +79,7 @@ for PACKAGE in $(cat $BUILD_DIR/$APT_FILE_MANIFEST | grep -v -s -e '^#' | grep -
curl -s -L -z $PACKAGE_FILE -o $PACKAGE_FILE $PACKAGE 2>&1 | indent
else
topic "Fetching .debs for $PACKAGE"
apt-get $APT_OPTIONS -y --allow-downgrades -d install --reinstall $PACKAGE | indent
apt-get $APT_OPTIONS -y $APT_FORCE_YES -d install --reinstall $PACKAGE | indent
fi
done

Expand Down

0 comments on commit ad5df5a

Please sign in to comment.