From 2b2825560e3ce0bb5b9894efe2d626bf24b427b6 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 15 Jan 2025 15:32:37 -0800 Subject: [PATCH] Simplify autogen The autogen script is doing too many things. The tests that are set up in the git hooks are already tested by GitHub with actions on branch push. Also they don't work if you install wolfSSL somewhere specific. All one needs to do is run `autoreconf -ivf` to make the configure script. This is all autogen does now, with the addition of warnings. --- autogen.sh | 46 +---------------------------------------- scripts/commit-tests.sh | 42 ------------------------------------- scripts/pre-commit.sh | 34 ------------------------------ 3 files changed, 1 insertion(+), 121 deletions(-) delete mode 100755 scripts/commit-tests.sh delete mode 100755 scripts/pre-commit.sh diff --git a/autogen.sh b/autogen.sh index 86a4be674..8873c4d0b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -2,52 +2,8 @@ # # Create configure and makefile stuff... -# Check environment -if [ -n "$WSL_DISTRO_NAME" ]; then - # we found a non-blank WSL environment distro name - current_path="$(pwd)" - pattern="/mnt/?" - if [ "$(echo "$current_path" | grep -E "^$pattern")" ]; then - # if we are in WSL and shared Windows file system, 'ln' does not work. - no_links=true - else - no_links= - fi -fi - -# Git hooks should come before autoreconf. -if [ -d .git ]; then - if [ ! -d .git/hooks ]; then - mkdir .git/hooks || exit $? - fi - - if [ -n "$no_links" ]; then - echo "Linux ln does not work on shared Windows file system in WSL." - if [ ! -e .git/hooks/pre-commit ]; then - echo "The pre-commit.sh file will not be copied to .git/hooks/pre-commit" - # shell scripts do not work on Windows; TODO create equivalent batch file - # cp ./pre-commit.sh .git/hooks/pre-commit || exit $? - fi - # unlike wolfssl, wolfssh is not using pre-push.sh at this time. Enable as needed: - # if [ ! -e .git/hooks/pre-push ]; then - # echo "The pre-push.sh file will not be copied to .git/hooks/pre-commit" - # # shell scripts do not work on Windows; TODO create equivalent batch file - # # cp ./pre-push.sh .git/hooks/pre-push || exit $? - # fi - else - if [ ! -e .git/hooks/pre-commit ]; then - ln -sf ../../scripts/pre-commit.sh .git/hooks/pre-commit || exit $? - fi - # unlike wolfssl, wolfssh is not using pre-push.sh at this time Enable as needed: - # if [ ! -e .git/hooks/pre-push ]; then - # ln -s ../../pre-push.sh .git/hooks/pre-push || exit $? - # fi - fi -fi - # If this is a source checkout then call autoreconf with error as well -if test -e .git -then +if [ -e .git ]; then WARNINGS="all,error" else WARNINGS="all" diff --git a/scripts/commit-tests.sh b/scripts/commit-tests.sh deleted file mode 100755 index 360001ed8..000000000 --- a/scripts/commit-tests.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# commit-tests.sh - -# make sure current config is ok -echo "Testing current config..." -if ! make clean check -then - echo "Current config make test failed" - exit 1 -fi - - -# make sure basic config is ok -echo "Testing basic config..." -if ! ./configure -then - echo "Basic config ./configure failed" - exit 1 -fi - -if ! make check -then - echo "Basic config make test failed" - exit 1 -fi - -# make sure the all enabled config is ok -echo "Testing enabled all config..." -if ! ./configure --enable-all -then - echo "Enabled all config ./configure failed" - exit 1 -fi - -if ! make check -then - echo "Enabled all config make test failed" - exit 1 -fi - -exit 0 diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh deleted file mode 100755 index 7eab14cfc..000000000 --- a/scripts/pre-commit.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -# -# Our "pre-commit" hook. - -# save current config -echo "\n\nSaving current config\n\n" -cp config.status tmp.status - -# stash modified files not part of this commit, don't test them -echo "\n\nStashing any modified files not part of commit\n\n" -git stash -q --keep-index - -# do the commit tests -echo "\n\nRunning commit tests...\n\n" -./scripts/commit-tests.sh -RESULT=$? - -# restore modified files not part of this commit -echo "\n\nPopping any stashed modified files not part of commit\n" -git stash pop -q - -# restore current config -echo "\nRestoring current config\n" -mv tmp.status config.status -# don't show output incase error from above -./config.status >/dev/null 2>&1 -make clean >/dev/null 2>&1 -make -j 8 >/dev/null 2>&1 - -[ $RESULT -ne 0 ] && echo "\nOops, your commit failed\n" && exit 1 - -echo "\nCommit tests passed!\n" -exit 0