Skip to content

Commit

Permalink
Support source parts directory
Browse files Browse the repository at this point in the history
  • Loading branch information
colincasey committed Mar 20, 2024
1 parent e8b841d commit 5468a46
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ jobs:
runs-on: ubuntu-22.04
container:
image: heroku/heroku:${{ matrix.stack_number }}-build
options: --user root
strategy:
matrix:
stack_number: ["20", "22"]
stack_number: ["20", "22", "24"]
env:
STACK: heroku-${{ matrix.stack_number }}
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Warn when Aptfile contains no packages ([#126](https://github.com/heroku/heroku-buildpack-apt/pull/126))
- Support sources parts directory for Heroku-24 compatibility ([#119](https://github.com/heroku/heroku-buildpack-apt/pull/119))

## 2024-03-14

Expand Down
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
test: heroku-22-build heroku-20-build
test: heroku-24-build heroku-22-build heroku-20-build

shellcheck:
@shellcheck -x bin/compile bin/detect bin/release bin/report

heroku-24-build:
@echo "Running tests in docker (heroku-24-build)..."
@docker run --user root -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-24" heroku/heroku:24-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo ""

heroku-22-build:
@echo "Running tests in docker (heroku-22-build)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=heroku-22" heroku/heroku:22-build bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
Expand Down
4 changes: 3 additions & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ echo "$STACK" > "$CACHE_DIR/.apt/STACK"
APT_CACHE_DIR="$CACHE_DIR/apt/cache"
APT_STATE_DIR="$CACHE_DIR/apt/state"
APT_SOURCELIST_DIR="$CACHE_DIR/apt/sources" # place custom sources.list here
APT_SOURCEPARTS_DIR="$APT_SOURCELIST_DIR/sources.list.d"

APT_SOURCES="$APT_SOURCELIST_DIR/sources.list"

Expand All @@ -75,6 +76,7 @@ else
mkdir -p "$APT_SOURCELIST_DIR" # make dir for sources
cp -f "$BUILD_DIR/Aptfile" "$APT_CACHE_DIR/Aptfile"
cat "/etc/apt/sources.list" > "$APT_SOURCES" # no cp here
cp -R "/etc/apt/sources.list.d" "$APT_SOURCEPARTS_DIR"
# add custom repositories from Aptfile to sources.list
# like>> :repo:deb http://cz.archive.ubuntu.com/ubuntu artful main universe
if grep -q -e "^:repo:" "$BUILD_DIR/Aptfile"; then
Expand All @@ -85,7 +87,7 @@ fi

APT_OPTIONS=("-o" "debug::nolocking=true" "-o" "dir::cache=$APT_CACHE_DIR" "-o" "dir::state=$APT_STATE_DIR")
# Override the use of /etc/apt/sources.list (sourcelist) and /etc/apt/sources.list.d/* (sourceparts).
APT_OPTIONS+=("-o" "dir::etc::sourcelist=$APT_SOURCES" "-o" "dir::etc::sourceparts=/dev/null")
APT_OPTIONS+=("-o" "dir::etc::sourcelist=$APT_SOURCES" "-o" "dir::etc::sourceparts=$APT_SOURCEPARTS_DIR")

topic "Updating apt caches"
apt-get "${APT_OPTIONS[@]}" update 2>&1 | indent
Expand Down

0 comments on commit 5468a46

Please sign in to comment.