mirror of
https://github.com/YunoHost/package_check.git
synced 2024-09-03 20:06:20 +02:00
Restructure some stuff to improve UX, ideally don't want to wait for the apt deps to install before being able to know which yunohost version is running and package linter ...
This commit is contained in:
parent
1dda43eef4
commit
8e267559a7
3 changed files with 13 additions and 10 deletions
|
@ -48,8 +48,7 @@ LXC_CREATE () {
|
||||||
log_critical "Failed to run 'test -e /etc/yunohost' on the container ... either the container did not start, or YunoHost doesn't exists yet in the container :/"
|
log_critical "Failed to run 'test -e /etc/yunohost' on the container ... either the container did not start, or YunoHost doesn't exists yet in the container :/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set_witness_files
|
_STUFF_TO_RUN_BEFORE_INITIAL_SNAPSHOT
|
||||||
_PREINSTALL_APT_DEPS
|
|
||||||
|
|
||||||
sleep 3
|
sleep 3
|
||||||
log_info "Creating initial snapshot $LXC_NAME ..."
|
log_info "Creating initial snapshot $LXC_NAME ..."
|
||||||
|
|
15
lib/tests.sh
15
lib/tests.sh
|
@ -4,13 +4,23 @@
|
||||||
# "Low-level" logistic helpers
|
# "Low-level" logistic helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
_PREINSTALL_APT_DEPS()
|
_STUFF_TO_RUN_BEFORE_INITIAL_SNAPSHOT()
|
||||||
{
|
{
|
||||||
|
# Print the version of YunoHost from the LXC container
|
||||||
|
log_small_title "YunoHost versions"
|
||||||
|
lxc exec $LXC_NAME -t -- /bin/bash -c "yunohost --version" | tee -a "$full_log" >/dev/null
|
||||||
|
|
||||||
|
log_title "Package linter"
|
||||||
|
./package_linter/package_linter.py "$package_path" | tee -a "$full_log"
|
||||||
|
|
||||||
|
# Set witness files
|
||||||
|
set_witness_files
|
||||||
|
|
||||||
[[ -e $package_path/manifest.toml ]] || return
|
[[ -e $package_path/manifest.toml ]] || return
|
||||||
|
|
||||||
local apt_deps=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); p = t['resources'].get('apt', {}).get('packages', ''); print(p.replace(',', ' ')) if isinstance(p, str) else print(' '.join(p));" < $package_path/manifest.toml)
|
local apt_deps=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); p = t['resources'].get('apt', {}).get('packages', ''); print(p.replace(',', ' ')) if isinstance(p, str) else print(' '.join(p));" < $package_path/manifest.toml)
|
||||||
|
|
||||||
log_small_title "Preinstalling apt dependencies before creating the initial snapshot..."
|
log_title "Preinstalling apt dependencies before creating the initial snapshot..."
|
||||||
|
|
||||||
apt="LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0"
|
apt="LC_ALL=C DEBIAN_FRONTEND=noninteractive apt-get --assume-yes --quiet -o=Acquire::Retries=3 -o=Dpkg::Use-Pty=0"
|
||||||
# Execute the command given in argument in the container and log its results.
|
# Execute the command given in argument in the container and log its results.
|
||||||
|
@ -371,7 +381,6 @@ TEST_PACKAGE_LINTER () {
|
||||||
start_test "Package linter"
|
start_test "Package linter"
|
||||||
|
|
||||||
# Execute package linter and linter_result gets the return code of the package linter
|
# Execute package linter and linter_result gets the return code of the package linter
|
||||||
./package_linter/package_linter.py "$package_path" | tee -a "$full_log"
|
|
||||||
./package_linter/package_linter.py "$package_path" --json | tee -a "$full_log" > $current_test_results
|
./package_linter/package_linter.py "$package_path" --json | tee -a "$full_log" > $current_test_results
|
||||||
|
|
||||||
return ${PIPESTATUS[0]}
|
return ${PIPESTATUS[0]}
|
||||||
|
|
|
@ -72,12 +72,7 @@ run_all_tests() {
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
LXC_RESET
|
LXC_RESET
|
||||||
LXC_CREATE
|
LXC_CREATE
|
||||||
# Be sure that the container is running
|
|
||||||
LXC_EXEC "true"
|
|
||||||
|
|
||||||
# Print the version of YunoHost from the LXC container
|
|
||||||
log_small_title "YunoHost versions"
|
|
||||||
LXC_EXEC "yunohost --version"
|
|
||||||
LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.version >> $TEST_CONTEXT/ynh_version
|
LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.version >> $TEST_CONTEXT/ynh_version
|
||||||
LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.repo >> $TEST_CONTEXT/ynh_branch
|
LXC_EXEC "yunohost --version --output-as json" | jq -r .yunohost.repo >> $TEST_CONTEXT/ynh_branch
|
||||||
echo $ARCH > $TEST_CONTEXT/architecture
|
echo $ARCH > $TEST_CONTEXT/architecture
|
||||||
|
|
Loading…
Add table
Reference in a new issue