Update branch from Devel

This commit is contained in:
InsanityAutomation
2020-06-15 09:33:18 -04:00
parent f1649d7846
commit 366ad20dfe
1321 changed files with 34363 additions and 22873 deletions
+12 -8
View File
@@ -1,20 +1,24 @@
#!/usr/bin/env bash
#
# mfadd (user|ref) [copyname]
# mfadd user[:branch] [copyname]
#
# Add a remote and fetch it. Optionally copy a branch.
#
# Example: mfadd myfork:patch-1 copy_of_patch-1
# Examples:
# mfadd thefork
# mfadd thefork:patch-1
# mfadd thefork:patch-1 the_patch_12345
#
[[ $# > 0 && $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` (user|ref) [copyname]" 1>&2 ; exit 1; }
[[ $# > 0 && $# < 3 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` user[:branch] [copyname]" 1>&2 ; exit 1; }
# If a colon is included, split the parts
if [[ $1 =~ ":" ]]; then
IFS=':' read -a DATA <<< "$1"
# If a colon or slash is included, split the parts
if [[ $1 =~ ":" || $1 =~ "/" ]]; then
[[ $1 =~ ":" ]] && IFS=':' || IFS="/"
read -a DATA <<< "$1"
USER=${DATA[0]}
BRANCH=${DATA[1]}
NAME=$2
NAME=${2:-$BRANCH}
else
USER=$1
fi
@@ -29,4 +33,4 @@ echo "Adding and fetching $USER..."
git remote add "$USER" "git@github.com:$USER/$REPO.git" >/dev/null 2>&1 || echo "Remote exists."
git fetch "$USER"
[[ ! -z "$BRANCH" && ! -z "$NAME" ]] && git checkout $USER/$BRANCH -b $NAME
[[ ! -z "$BRANCH" && ! -z "$NAME" ]] && git checkout -b "$NAME" --track "$USER/$BRANCH"
+7 -17
View File
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
#
# mfqp [-q|--quick] [1|2|3]
# mfqp [1|2|3]
#
# Add all changed files, commit as "patch", do `mfrb` and `git push -f`
# - git add .
# - git commit --amend
# - ghpc
#
MFINFO=$(mfinfo "$@") || exit 1
@@ -15,26 +17,14 @@ IND=6
while [ $IND -lt ${#INFO[@]} ]; do
ARG=${INFO[$IND]}
case "$ARG" in
-q|--quick ) QUICK="-q" ;;
-h|--help ) USAGE=1 ;;
* ) USAGE=1 ; echo "unknown option: $ARG" ;;
esac
let IND+=1
done
[[ ${INFO[4]} =~ [0-9] ]] && USAGE=1
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [1|2|3]" 1>&2 ; exit 1 ; }
[[ $USAGE == 1 ]] && { echo "usage: `basename $0` [-hq] [1|2|3]" 1>&2 ; exit 1 ; }
[[ $CURR == $TARG && $REPO != "MarlinDocumentation" ]] && { echo "Don't alter the PR Target branch."; exit 1 ; }
git add .
git commit -m "patch"
if [[ $CURR == $TARG ]]; then
if [[ $REPO == "MarlinDocumentation" ]]; then
git rebase -i HEAD~2 && git push -f
else
echo "Don't alter the PR Target branch."; exit 1
fi
else
mfrb $QUICK "$@" && git push -f
fi
git add . && git commit --amend && git push -f
+124 -50
View File
@@ -1,10 +1,9 @@
#!/usr/bin/env bash
#
# mftest [name] [index]
#
# Set configuration options based on a test
# By default it will do megaatmega2560
# Use 'mftest -' to pick from the list.
# mftest Select a test to apply and build
# mftest -b [#] Build the auto-detected environment
# mftest -u [#] Upload the auto-detected environment
# mftest [name] [index] [-y] Set config options and optionally build a test
#
MFINFO=$(mfinfo) || exit 1
@@ -12,53 +11,123 @@ MFINFO=$(mfinfo) || exit 1
TESTPATH=buildroot/share/tests
STATE_FILE=$( echo ./.pio/.mftestrc )
SED=$(which gsed || which sed)
shopt -s extglob nocasematch
# Get the environment and test number from the command
TESTENV=${1:-'-'}
CHOICE=${2:-0}
# Allow shorthand for test name
case $TESTENV in
tree) platformio run --project-dir . -e include_tree ; exit 1 ;;
due) TESTENV='DUE' ;;
esp) TESTENV='esp32' ;;
lin*) TESTENV='linux_native' ;;
lpc?(8)) TESTENV='LPC1768' ;;
lpc9) TESTENV='LPC1769' ;;
m128) TESTENV='megaatmega1280' ;;
m256) TESTENV='megaatmega2560' ;;
mega) TESTENV='megaatmega2560' ;;
stm) TESTENV='STM32F103RE' ;;
f1) TESTENV='STM32F103RE' ;;
f4) TESTENV='STM32F4' ;;
f7) TESTENV='STM32F7' ;;
s6) TESTENV='FYSETC_S6' ;;
teensy) TESTENV='teensy31' ;;
t31) TESTENV='teensy31' ;;
t32) TESTENV='teensy31' ;;
t35) TESTENV='teensy35' ;;
t36) TESTENV='teensy35' ;;
# Build with the last-built env
-r) [[ -f "$STATE_FILE" ]] || { echo "No previous (-r) build state found." ; exit 1 ; }
read TESTENV <"$STATE_FILE"
platformio run --project-dir . -e $TESTENV
exit
;;
# A -y may come first
-y) TESTENV=${2:-'-'} ; CHOICE=${3:-0} ;;
-[a-z]) echo "Unknown flag $TESTENV" ; exit 1 ;;
-) ;;
esac
# Matching patterns
ISNUM='^[0-9]+$'
ISCMD='^(restore|opt|exec|use|pins|env)_'
ISEXEC='^exec_'
ISCONT='\\ *$'
# Get the environment and test number from the command
TESTENV=${1:-'-'}
CHOICE=${2:-0}
AUTOENV=0
# Allow shorthand for test name
case $TESTENV in
tree) pio run -d . -e include_tree ; exit 1 ;;
due) TESTENV='DUE' ;;
esp) TESTENV='esp32' ;;
lin*) TESTENV='linux_native' ;;
lpc?(8)) TESTENV='LPC1768' ;;
lpc9) TESTENV='LPC1769' ;;
m128) TESTENV='mega1280' ;;
m256) TESTENV='mega2560' ;;
mega) TESTENV='mega2560' ;;
stm) TESTENV='STM32F103RE' ;;
f1) TESTENV='STM32F103RE' ;;
f4) TESTENV='STM32F4' ;;
f7) TESTENV='STM32F7' ;;
s6) TESTENV='FYSETC_S6' ;;
teensy) TESTENV='teensy31' ;;
t31) TESTENV='teensy31' ;;
t32) TESTENV='teensy31' ;;
t35) TESTENV='teensy35' ;;
t36) TESTENV='teensy35' ;;
-h|--help) echo -e "$(basename $0) : Marlin Firmware test, build, and upload\n"
echo "Usage: $(basename $0) ................. Select env and test to apply / run"
echo " $(basename $0) [-y] env ........ Select a test for env to apply / run"
echo " $(basename $0) [-y] env test ... Apply / run the specified env test"
echo " $(basename $0) -b [variant] .... Auto-build the specified variant"
echo " $(basename $0) -u [variant] .... Auto-build and upload the specified variant"
echo
echo "env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36"
exit
;;
# Build with the last-built env
-r) [[ -f "$STATE_FILE" ]] || { echo "No previous (-r) build state found." ; exit 1 ; }
read TESTENV <"$STATE_FILE"
pio run -d . -e $TESTENV
exit
;;
-[bu]) MB=$( grep -E "^\s*#define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//' )
[[ -z $MB ]] && { echo "Error - Can't read MOTHERBOARD setting." ; exit 1 ; }
BLINE=$( grep -E "define\s+BOARD_$MB\b" Marlin/src/core/boards.h )
BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
[[ -z $BNUM ]] && { echo "Error - Can't find $MB in boards list." ; exit 1 ; }
readarray -t ENVS <<< $( grep -EA1 "MB\(.*\b$MB\b.*\)" Marlin/src/pins/pins.h | grep -E '#include.+//.+env:.+' | grep -oE 'env:[^ ]+' | $SED -E 's/env://' )
[[ -z $ENVS ]] && { echo "Error - Can't find target(s) for $MB ($BNUM)." ; exit 1 ; }
ECOUNT=${#ENVS[*]}
if [[ $ECOUNT == 1 ]]; then
TARGET=$ENVS
else
if [[ $CHOICE == 0 ]]; then
#
# List env names and numbers. Get selection.
#
echo "Available targets for \"$BDESC\" | $MB ($BNUM):"
IND=0 ; for ENV in "${ENVS[@]}"; do let IND++ ; echo " $IND) $ENV" ; done
if [[ $ECOUNT > 1 ]]; then
for (( ; ; ))
do
read -p "Select a target for '$MB' (1-$ECOUNT) : " CHOICE
[[ -z "$CHOICE" ]] && { echo '(canceled)' ; exit 1 ; }
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= ECOUNT)) && break
echo ">>> Invalid environment choice '$CHOICE'."
done
echo
fi
else
echo "Detected \"$BDESC\" | $MB ($BNUM)."
[[ $CHOICE > $ECOUNT ]] && { echo "Environment selection out of range." ; exit 1 ; }
fi
TARGET="${ENVS[$CHOICE-1]}"
echo "Selected $TARGET"
fi
echo "$TARGET" >"$STATE_FILE"
if [[ $TESTENV == "-u" ]]; then
echo "Build/Uploading environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -t upload -e $TARGET
else
echo "Building environment $TARGET for board $MB ($BNUM)..." ; echo
pio run -e $TARGET
fi
exit
;;
# The -y flag may come first
-y) TESTENV=${2:-'-'} ; CHOICE=${3:-0} ;;
-[a-z]) echo "Unknown flag $TESTENV" ; exit 1 ;;
-) ;;
esac
#
# List available tests and ask for selection
#
if [[ $TESTENV == '-' ]]; then
IND=0
NAMES=()
@@ -86,17 +155,17 @@ fi
OUT=$( cat $TESTPATH/$TESTENV-tests 2>/dev/null ) || { echo "Can't find test '$TESTENV'." ; exit 1 ; }
# Count up the number of tests
# TODO: List test descriptions with numbers
TESTCOUNT=$( awk "/$ISEXEC/{a++}END{print a}" <<<"$OUT" )
# User entered a number?
(( CHOICE && CHOICE > TESTCOUNT )) && { echo "Invalid test index '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
(( CHOICE && CHOICE > TESTCOUNT )) && { echo "Invalid test selection '$CHOICE' (1-$TESTCOUNT)." ; exit 1 ; }
if [[ $CHOICE == 0 ]]; then
# List test descriptions with numbers
#
# List test descriptions with numbers and get selection
#
echo "Available '$TESTENV' tests:" ; echo "$OUT" | {
IND=0
SED=$(which gsed || which sed)
while IFS= read -r LINE
do
if [[ $LINE =~ $ISEXEC ]]; then
@@ -113,12 +182,14 @@ if [[ $CHOICE == 0 ]]; then
read -p "Select a '$TESTENV' test (1-$TESTCOUNT) : " CHOICE
[[ -z "$CHOICE" ]] && { echo '(canceled)' ; exit 1 ; }
[[ $CHOICE =~ $ISNUM ]] && ((CHOICE >= 1 && CHOICE <= TESTCOUNT)) && break
echo ">>> Invalid test index '$CHOICE'."
echo ">>> Invalid test selection '$CHOICE'."
done
fi
fi
# Finally, run the specified test lines
#
# Run the specified test lines
#
echo "$OUT" | {
IND=0
GOTX=0
@@ -136,7 +207,7 @@ echo "$OUT" | {
}
((IND == CHOICE)) && {
GOTX=1
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | sed -e 's/\\//g' )
[[ $CMD == "" ]] && CMD="$LINE" || CMD=$( echo -e "$CMD$LINE" | $SED -e 's/\\//g' )
[[ $LINE =~ $ISCONT ]] || { echo $CMD ; eval "$CMD" ; CMD="" ; }
}
fi
@@ -144,6 +215,9 @@ echo "$OUT" | {
done
}
# Make clear it's a TEST
opt_set CUSTOM_MACHINE_NAME "\"$TESTENV-tests ($CHOICE)\""
# Get a -y parameter the lazy way
[[ "$2" == "-y" || "$3" == "-y" ]] && BUILD_YES='Y'
@@ -154,6 +228,6 @@ if [[ $BUILD_YES != 'Y' ]]; then
fi
[[ $BUILD_YES == 'Y' || $BUILD_YES == 'Yes' ]] && {
platformio run --project-dir . -e $TESTENV
pio run -d . -e $TESTENV
echo "$TESTENV" >"$STATE_FILE"
}