Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop parameters page in Wiki from just disappearing #6576

Merged
merged 5 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ def fetch_commit_hash(version_link, board, file):
for i in commits_and_codes:
if commits_and_codes[i][0] != 'error':
commite_and_codes_cleanned[i] = commits_and_codes[i]
if len(commite_and_codes_cleanned) == 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cleaned (spelling) - ok I see it's a pre-existing wierdness, but an opportunity to fix it? (and commite)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a good time to fix this sort of thing. The variable needs a completely new name, not just a spelling fix :-)

... and I don't even know if "commite" comes from a language-other-than-English or is just a typo...

error("Expected at least one commit")
return commite_and_codes_cleanned


Expand Down Expand Up @@ -509,4 +511,4 @@ def print_versions(commits_to_checkout_and_parse):
generate_json(VEHICLES)
move_results(VEHICLES)

# sys.exit(error_count)
sys.exit(error_count)
94 changes: 58 additions & 36 deletions update.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash
# check for changes in docs and run sphinx

set -e
set -x

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I'm leaving it like this deliberately. One of these is even called out in the commit messages...

export PYTHONUNBUFFERED=1

cd $HOME/build_wiki || exit 1
cd $HOME/build_wiki

START=$(date +%s)

Expand Down Expand Up @@ -32,34 +35,49 @@ lock_file build.lck || {
exit 1
}

progress() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] update.sh: $*"
}

LOGFILE="logs/update-latest.log"
progress "update.sh starting (see $LOGFILE)"

test -n "$FORCEBUILD" || {
(cd ardupilot_wiki && git fetch > /dev/null 2>&1)
(cd sphinx_rtd_theme && git fetch > /dev/null 2>&1)
progress "Fetching ardupilot_wiki"
(cd ardupilot_wiki && git fetch)
progress "Fetching sphinx_rtd_theme"
(cd sphinx_rtd_theme && git fetch)

changed=0
progress "Getting oldhash for ardupilot_wiki"
oldhash=$(cd ardupilot_wiki && git rev-parse origin/master)
progress "Getting newhash for ardupilot_wiki"
newhash=$(cd ardupilot_wiki && git rev-parse HEAD)
[ "$oldhash" = "$newhash" ] || {
echo "ardupilot_wiki has changed $newhash $oldhash"
progress "ardupilot_wiki has changed $newhash $oldhash"
changed=1
}

progress "Getting oldhash for sphinx_rtd_theme"
oldhash=$(cd sphinx_rtd_theme && git rev-parse origin/master)
progress "Getting newhash for sphinx_rtd_theme"
newhash=$(cd sphinx_rtd_theme && git rev-parse HEAD)
[ "$oldhash" = "$newhash" ] || {
echo "sphinx_rtd_theme has changed $newhash $oldhash"
progress "sphinx_rtd_theme has changed $newhash $oldhash"
changed=1
}

progress "Fetching parameters"
PARAMSITES="ArduPlane ArduCopter AntennaTracker Rover AP_Periph Blimp"
mkdir -p old_params new_params
for site in $PARAMSITES; do
wget "https://autotest.ardupilot.org/Parameters/$site/Parameters.rst" -O new_params/$site.rst 2> /dev/null
wget "https://autotest.ardupilot.org/Parameters/$site/Parameters.rst" -O new_params/$site.rst
done

progress "Comparing parameters"
for site in $PARAMSITES; do
if ! cmp new_params/$site.rst old_params/$site.rst; then
echo "$site.rst has changed"
progress "$site.rst has changed"
cp new_params/$site.rst old_params/$site.rst
changed=1
fi
Expand All @@ -68,30 +86,29 @@ test -n "$FORCEBUILD" || {
LOGMESSAGESITES="Plane Copter Tracker Rover Blimp"
mkdir -p old_logmessages new_logmessages
for site in $LOGMESSAGESITES; do
wget "https://autotest.ardupilot.org/LogMessages/$site/LogMessages.rst" -O new_logmessages/$site.rst 2> /dev/null
wget "https://autotest.ardupilot.org/LogMessages/$site/LogMessages.rst" -O new_logmessages/$site.rst
done

for site in $LOGMESSAGESITES; do
if ! cmp new_logmessages/$site.rst old_logmessages/$site.rst; then
echo "$site.rst has changed"
progress "$site.rst has changed"
cp new_logmessages/$site.rst old_logmessages/$site.rst
changed=1
fi
done

[ $changed = 1 ] || exit 0
[ $changed = 1 ] || {
progress "Nothing changed; no rebuild required, exiting"
exit 0
}
}

progress "update.sh starting build"

(
date

report() {
cat <<EOF | mail -s 'wiki build failed' [email protected]
A wiki build failed
EOF
}

echo "[Buildlog] Updating ardupilot_wiki at $(date '+%Y-%m-%d-%H-%M-%S')"
progress "Updating ardupilot_wiki"
pushd ardupilot_wiki
git checkout -f master
git fetch origin
Expand All @@ -100,7 +117,7 @@ git reset --hard origin/master
git clean -f -f -x -d -d
popd

echo "[Buildlog] Updating sphinx_rtd_theme at $(date '+%Y-%m-%d-%H-%M-%S')"
progress "Updating sphinx_rtd_theme"
pushd sphinx_rtd_theme
git checkout -f master
git fetch origin
Expand All @@ -115,28 +132,33 @@ find -name "parameters*rst" -delete # Clean possible built and cached parameters

END_UPDATES=$(date +%s)

DO_PARAM_VERSIONING=true
if $DO_PARAM_VERSIONING; then
echo "[Buildlog] Starting to build multiple parameters pages at $(date '+%Y-%m-%d-%H-%M-%S')"
python3 build_parameters.py
END_BUILD_MPARAMS=$(date +%s)
MPARAMS_TIME=$(echo "($END_BUILD_MPARAMS - $END_UPDATES)" | bc)
echo "[Buildlog] Time to run build_parameters.py: $MPARAMS_TIME seconds"
else
# we use this hwne calculating times, below
END_BUILD_MPARAMS=$END_UPDATES
fi

echo "[Buildlog] Starting to build the wiki at $(date '+%Y-%m-%d-%H-%M-%S')"
# python3 update.py --clean --parallel 4 # Build without versioning for parameters. It is better for editing wiki.
python3 update.py --destdir /var/sites/wiki/web --clean --paramversioning --parallel 4 --enablebackups --verbose # Enables parameters versioning and backups, should be used only on the wiki server
progress "Starting to build multiple parameters pages"
python3 build_parameters.py || {
progress "build_parameters.py failed"
exit 1
}
END_BUILD_MPARAMS=$(date +%s)
MPARAMS_TIME=$(echo "($END_BUILD_MPARAMS - $END_UPDATES)" | bc)
progress "Time to run build_parameters.py: $MPARAMS_TIME seconds"

progress "Starting to build the wiki"
# python3 update.py --clean --parallel 4 # Build without versioning for parameters. It is better for editing wiki.
python3 update.py --destdir /var/sites/wiki/web --clean --paramversioning --parallel 1 --enablebackups --verbose || {
progress "update.py failed"
exit 1
}

END_BUILD_WIKI=$(date +%s)
WIKI_TIME=$(echo "($END_BUILD_WIKI - $END_BUILD_MPARAMS)/60" | bc)
echo "[Buildlog] Time to build the wiki itself: $WIKI_TIME minutes"
progress "Time to build the wiki itself: $WIKI_TIME minutes"
SCRIPT_TIME=$(echo "($END_BUILD_WIKI - $START)/60" | bc)
echo "[Buildlog] Time to run the full script: $SCRIPT_TIME minutes"
progress "Time to run the full script: $SCRIPT_TIME minutes"


) >$LOGFILE 2>&1 || {
progress "update.sh failed; see $LOGFILE"
}

cat $LOGFILE >> logs/update.log

) >> update.log 2>&1
progress "update.sh finished"