diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-12-14 15:06:12 +0100 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-12-14 23:11:12 +0100 |
commit | fdd380dde2ec2cbcecbd20b91cf6b819ef3dc0db (patch) | |
tree | a1a019b8eafe065f814212402db07dac418284af /test | |
parent | test: update comment style & drop one extraneous newline (diff) | |
download | systemd-fdd380dde2ec2cbcecbd20b91cf6b819ef3dc0db.tar.xz systemd-fdd380dde2ec2cbcecbd20b91cf6b819ef3dc0db.zip |
test: install empty directories with NO_BUILD=1
Resolves: #30478
Diffstat (limited to 'test')
-rw-r--r-- | test/test-functions | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/test/test-functions b/test/test-functions index 4606745f10..6a6f624d4c 100644 --- a/test/test-functions +++ b/test/test-functions @@ -1310,19 +1310,35 @@ install_compiled_systemd() { fi } +install_package_file() { + local file="${1:?}" + + # Skip missing files (like /etc/machine-info) + [[ ! -e "$file" ]] && return 0 + # Skip python unit tests, since the image_install machinery will try to pull + # in the whole python stack in a very questionable state, making the tests fail. + # And given we're trying to transition to mkosi-based images anyway I'm not even + # going to bother + [[ "$file" =~ /tests/unit-tests/.*.py$ ]] && return 0 + # If the current file is a directory, create it with the original + # mode; if it's a symlink to a directory, copy it as-is + if [[ -d "$file" ]]; then + inst_dir "$file" + else + inst "$file" + fi +} + install_debian_systemd() { dinfo "Install debian systemd" - local files + local deb file while read -r deb; do - files="$(dpkg-query -L "$deb" 2>/dev/null)" || continue ddebug "Install debian files from package $deb" - for file in $files; do - [ -e "$file" ] || continue - [ ! -L "$file" ] && [ -d "$file" ] && continue - inst "$file" - done + while read -r file; do + install_package_file "$file" + done < <(dpkg-query -L "$deb" 2>/dev/null) done < <(grep -E '^Package:' "${SOURCE_DIR}/debian/control" | cut -d ':' -f 2) } @@ -1337,17 +1353,7 @@ install_rpm() { dinfo "Installing contents of RPM $rpm" while read -r file; do - # Skip missing files (like /etc/machine-info) - [[ ! -e "$file" ]] && continue - # Skip directories unless they are a symlink (both -L and -d pass in this case) - [[ -d "$file" && ! -L "$file" ]] && continue - # Skip python unit tests, since the image_install machinery will try to pull - # in the whole python stack in a very questionable state, making the tests fail. - # And given we're trying to transition to mkosi-based images anyway I'm not even - # going to bother - [[ "$file" =~ /tests/unit-tests/.*.py$ ]] && continue - - image_install "$file" + install_package_file "$file" done < <(rpm -ql "$rpm") } |