mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
Merge pull request #7554 from keszybz/autodetect-build
Autodetect build directory ignoring mkosi artefacts
This commit is contained in:
commit
ea781d0dd8
@ -1,14 +0,0 @@
|
||||
# Try to guess the build directory:
|
||||
# we look for subdirectories of ../.. that look like ninja build dirs.
|
||||
|
||||
ifeq ($(BUILD_DIR),)
|
||||
dirs = $(dir $(wildcard ../../*/.ninja_log))
|
||||
ifeq ($(dirs),)
|
||||
$(error Cannot guess build dir, set BUILD_DIR)
|
||||
endif
|
||||
ifneq ($(firstword $(dirs)),$(dirs))
|
||||
$(warning Candidates: $(dirs))
|
||||
$(error Too many build dirs to pick from, set BUILD_DIR)
|
||||
endif
|
||||
BUILD_DIR=$(dirs)
|
||||
endif
|
@ -1,4 +1,4 @@
|
||||
include ../Makefile.guess
|
||||
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup clean run:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
@ -1,4 +1,4 @@
|
||||
include ../Makefile.guess
|
||||
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup run:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
@ -1,4 +1,4 @@
|
||||
include ../Makefile.guess
|
||||
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup clean run:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
@ -1,4 +1,4 @@
|
||||
include ../Makefile.guess
|
||||
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup clean run:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
@ -1,4 +1,4 @@
|
||||
include ../Makefile.guess
|
||||
BUILD_DIR=$(exec ../../tools/find-build-dir.sh)
|
||||
|
||||
all setup clean run:
|
||||
@basedir=../.. TEST_BASE_DIR=../ BUILD_DIR=$(BUILD_DIR) ./test.sh --$@
|
||||
|
@ -1,21 +1,24 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
if ! test -d ../build ; then
|
||||
echo "Expected build directory in ../build, but couldn't find it." >&2
|
||||
exit 1
|
||||
BUILD_DIR="$($(dirname "$0")/../tools/find-build-dir.sh)"
|
||||
if [ $# -gt 0 ]; then
|
||||
args="$@"
|
||||
else
|
||||
args="clean setup run"
|
||||
fi
|
||||
|
||||
ninja -C ../build
|
||||
ninja -C "$BUILD_DIR"
|
||||
|
||||
declare -A results
|
||||
|
||||
RESULT=0
|
||||
FAILURES=0
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
for TEST in TEST-??-* ; do
|
||||
echo -e "\n--x-- Starting $TEST --x--"
|
||||
set +e
|
||||
make -C "$TEST" BUILD_DIR=$(pwd)/../build clean setup run
|
||||
make -C "$TEST" "BUILD_DIR=$BUILD_DIR" $args
|
||||
RESULT=$?
|
||||
set -e
|
||||
echo "--x-- Result of $TEST: $RESULT --x--"
|
||||
|
31
tools/find-build-dir.sh
Executable file
31
tools/find-build-dir.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
# Try to guess the build directory:
|
||||
# we look for subdirectories of the parent directory that look like ninja build dirs.
|
||||
|
||||
if [ -n "$BUILD_DIR" ]; then
|
||||
echo "$(realpath "$BUILD_DIR")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
root="$(dirname "$(realpath "$0")")"
|
||||
|
||||
found=
|
||||
for i in "$root"/../*/build.ninja; do
|
||||
c="$(dirname $i)"
|
||||
[ -d "$c" ] || continue
|
||||
[ "$(basename "$c")" != mkosi.builddir ] || continue
|
||||
|
||||
if [ -n "$found" ]; then
|
||||
echo 'Found multiple candidates, specify build directory with $BUILD_DIR' >&2
|
||||
exit 2
|
||||
fi
|
||||
found="$c"
|
||||
done
|
||||
|
||||
if [ -z "$found" ]; then
|
||||
echo 'Specify build directory with $BUILD_DIR' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "$(realpath $found)"
|
Loading…
Reference in New Issue
Block a user