forked from josch/mmdebstrap
fix --include option for files and add test case
This commit is contained in:
parent
9682e74385
commit
410c5fcb24
3 changed files with 25 additions and 2 deletions
|
@ -330,3 +330,5 @@ Needs-QEMU: true
|
||||||
Test: error-if-stdout-is-tty
|
Test: error-if-stdout-is-tty
|
||||||
|
|
||||||
Test: variant-custom-timeout
|
Test: variant-custom-timeout
|
||||||
|
|
||||||
|
Test: include-deb-file
|
||||||
|
|
|
@ -4282,7 +4282,7 @@ sub main() {
|
||||||
} elsif ($opt_value =~ /^\.?\.?\//) {
|
} elsif ($opt_value =~ /^\.?\.?\//) {
|
||||||
# Treat option as a single path name and don't split by comma
|
# Treat option as a single path name and don't split by comma
|
||||||
# or whitespace -- append the normalized path.
|
# or whitespace -- append the normalized path.
|
||||||
push @{ $options->{include} }, sanitize_path($opt_value);
|
push @{ $options->{include} }, &{$sanitize_path}($opt_value);
|
||||||
} else {
|
} else {
|
||||||
for my $pkg (split /[,\s]+/, $opt_value) {
|
for my $pkg (split /[,\s]+/, $opt_value) {
|
||||||
# strip leading and trailing whitespace
|
# strip leading and trailing whitespace
|
||||||
|
@ -4294,7 +4294,7 @@ sub main() {
|
||||||
# Make paths canonical absolute paths, resolve symlinks
|
# Make paths canonical absolute paths, resolve symlinks
|
||||||
# and check if it's an existing file.
|
# and check if it's an existing file.
|
||||||
if ($pkg =~ /^\.?\.?\//) {
|
if ($pkg =~ /^\.?\.?\//) {
|
||||||
$pkg = sanitize_path($pkg);
|
$pkg = &{$sanitize_path}($pkg);
|
||||||
}
|
}
|
||||||
push @{ $options->{include} }, $pkg;
|
push @{ $options->{include} }, $pkg;
|
||||||
}
|
}
|
||||||
|
|
21
tests/include-deb-file
Normal file
21
tests/include-deb-file
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
|
||||||
|
{{ CMD }} --variant=apt \
|
||||||
|
--customize-hook='mkdir "$1"/tmp/apt' \
|
||||||
|
--customize-hook='chroot "$1" env --chdir=/tmp/apt apt-get download busybox' \
|
||||||
|
--customize-hook='copy-out /tmp/apt /tmp' \
|
||||||
|
{{ DIST }} /dev/null {{ MIRROR }}
|
||||||
|
pkg="$(find /tmp/apt -type f)"
|
||||||
|
# some sanity checks
|
||||||
|
[ -f "$pkg" ]
|
||||||
|
case $pkg in
|
||||||
|
/tmp/apt/busybox*_{{ HOSTARCH }}.deb) : ;;
|
||||||
|
*) exit 1;;
|
||||||
|
esac
|
||||||
|
# now try to install that package
|
||||||
|
{{ CMD }} --variant=apt --include="$pkg" \
|
||||||
|
--customize-hook='chroot "$1" dpkg-query -W -f="\${Status}\n" busybox | grep "^install ok installed$"' \
|
||||||
|
{{ DIST }} /dev/null {{ MIRROR }}
|
Loading…
Reference in a new issue