Skip to content

Commit cf643cb

Browse files
committed
Allow multiple packages on a single Aptfile line
1 parent bf45890 commit cf643cb

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

bin/compile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,12 @@ while IFS= read -r PACKAGE; do
8989
curl --silent --show-error --fail -L -z "$PACKAGE_FILE" -o "$PACKAGE_FILE" "$PACKAGE" 2>&1 | indent
9090
else
9191
topic "Fetching .debs for $PACKAGE"
92-
apt-get "${APT_OPTIONS[@]}" -y "${APT_FORCE_YES[@]}" -d install --reinstall "$PACKAGE" | indent
92+
# while this is not documented behavior, the Aptfile format technically
93+
# did allow for multiple packages separated by spaces to be specified
94+
# on a single line due to how the download command was implemented so we
95+
# should respect that behavior since users are doing this
96+
IFS=$' \t' read -ra PACKAGE_NAMES <<< "$PACKAGE"
97+
apt-get "${APT_OPTIONS[@]}" -y "${APT_FORCE_YES[@]}" -d install --reinstall "${PACKAGE_NAMES[@]}" | indent
9398
fi
9499
done < <(grep --invert-match -e "^#" -e "^\s*$" -e "^:repo:" "${BUILD_DIR}/Aptfile")
95100

bin/report

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ while IFS= read -r line; do
1818
elif [[ $line == *deb ]]; then
1919
custom_packages+=("${line}")
2020
else
21-
# while this is not documented behavior, the Aptfile format technically
22-
# does allow for multiple packages separated by spaces to be specified
23-
# on a single line due to how the download command is implemented
2421
IFS=$' \t' read -ra package_names <<< "${line}"
2522
for package_name in "${package_names[@]}"; do
2623
packages+=("${package_name}")

test/fixtures/package-names/Aptfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ xmlsec1
33

44
# globbed package
55
mysql-client-*
6+
7+
# multiple packages on single line
8+
s3cmd wget

test/run

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ testCompilePackageNames() {
44
compile "package-names"
55
assertCaptured "Updating apt caches"
66
assertCaptured "Fetching .debs for xmlsec1"
7+
assertCaptured "Fetching .debs for s3cmd wget"
78
assertCaptured "Fetching .debs for mysql-client-*"
89
assertCaptured "Installing xmlsec1"
10+
assertCaptured "Installing s3cmd"
11+
assertCaptured "Installing wget"
912
assertCaptured "Installing mysql-client"
1013
assertCaptured "Installing mysql-client-core"
1114
assertCaptured "Writing profile script"
@@ -15,7 +18,7 @@ testCompilePackageNames() {
1518

1619
testReportPackageNames() {
1720
report "package-names"
18-
assertCaptured "packages: \"mysql-client-*,xmlsec1\""
21+
assertCaptured "packages: \"mysql-client-*,s3cmd,wget,xmlsec1\""
1922
assertNotCaptured "custom_packages"
2023
assertNotCaptured "custom_repositories"
2124
assertCapturedSuccess

0 commit comments

Comments
 (0)