Bump to head, add skr13
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# Start Jekyll in watch mode to work on Marlin Documentation and preview locally
|
||||
#
|
||||
|
||||
[[ $# == 0 ]] || { echo "usage: `basename $0`" 1>&2 ; exit 1; }
|
||||
[[ $# == 0 ]] || { echo "Usage: `basename $0`" 1>&2 ; exit 1; }
|
||||
|
||||
MFINFO=$(mfinfo "$@") || exit 1
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
@@ -16,10 +16,8 @@ BRANCH=${INFO[5]}
|
||||
[[ $ORG == "MarlinFirmware" && $REPO == "MarlinDocumentation" ]] || { echo "Wrong repository." 1>&2; exit 1; }
|
||||
|
||||
opensite() {
|
||||
which xdg-open >/dev/null && TOOL=xdg-open
|
||||
which gnome-open >/dev/null && TOOL=gnome-open
|
||||
which open >/dev/null && TOOL=open
|
||||
URL="http://127.0.0.1:4000/"
|
||||
OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }')
|
||||
if [ -z "$OPEN" ]; then
|
||||
echo "Can't find a tool to open the URL:"
|
||||
echo $URL
|
||||
|
||||
+30
-43
@@ -5,11 +5,11 @@
|
||||
# Use Jekyll to generate Marlin Documentation, which is then
|
||||
# git-pushed to Github to publish it to the live site.
|
||||
# This publishes the current branch, and doesn't force
|
||||
# changes to be pushed to the 'master' branch. Be sure to push
|
||||
# any permanent changes to 'master'.
|
||||
# changes to be pushed to the 'master' branch. Be sure to
|
||||
# push any permanent changes to 'master'.
|
||||
#
|
||||
|
||||
[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "usage: `basename $0` [branch]" 1>&2 ; exit 1; }
|
||||
[[ $# < 2 && $1 != "-h" && $1 != "--help" ]] || { echo "Usage: `basename $0` [branch]" 1>&2 ; exit 1; }
|
||||
|
||||
MFINFO=$(mfinfo "$@") || exit 1
|
||||
IFS=' ' read -a INFO <<< "$MFINFO"
|
||||
@@ -18,6 +18,7 @@ FORK=${INFO[1]}
|
||||
REPO=${INFO[2]}
|
||||
TARG=${INFO[3]}
|
||||
BRANCH=${INFO[4]}
|
||||
CURR=${INFO[5]}
|
||||
|
||||
if [[ $ORG != "MarlinFirmware" || $REPO != "MarlinDocumentation" ]]; then
|
||||
echo "Wrong repository."
|
||||
@@ -30,34 +31,46 @@ if [[ $BRANCH == "gh-pages" ]]; then
|
||||
fi
|
||||
|
||||
# Check out the named branch (or stay in current)
|
||||
git checkout $BRANCH
|
||||
|
||||
echo "Stashing any changes to files..."
|
||||
echo "Don't forget to update and push 'master'!"
|
||||
# GOJF Card
|
||||
[[ $(git stash) != "No local "* ]] && HAS_STASH=1
|
||||
if [[ $BRANCH != $CURR ]]; then
|
||||
echo "Stashing any changes to files..."
|
||||
[[ $(git stash) != "No local "* ]] && HAS_STASH=1
|
||||
git checkout $BRANCH
|
||||
fi
|
||||
|
||||
COMMIT=$( git log --format="%H" -n 1 )
|
||||
|
||||
# Clean out changes and other junk in the branch
|
||||
git clean -d -f
|
||||
|
||||
opensite() {
|
||||
URL="$1"
|
||||
OPEN=$(echo $(which gnome-open xdg-open open) | awk '{ print $1 }')
|
||||
if [ -z "$OPEN" ]; then
|
||||
echo "Can't find a tool to open the URL:"
|
||||
echo $URL
|
||||
else
|
||||
echo "Opening the site in the browser..."
|
||||
"$OPEN" "$URL"
|
||||
fi
|
||||
}
|
||||
|
||||
# Push 'master' to the fork and make a proper PR...
|
||||
if [[ $BRANCH == "master" ]]; then
|
||||
if [[ $BRANCH == $TARG ]]; then
|
||||
|
||||
# Don't lose upstream changes!
|
||||
git fetch upstream
|
||||
|
||||
# Rebase onto latest master
|
||||
if git rebase upstream/master; then
|
||||
if git rebase upstream/$TARG; then
|
||||
|
||||
# Allow working directly with the main fork
|
||||
echo
|
||||
echo -n "Pushing to origin/master... "
|
||||
echo -n "Pushing to origin/$TARG... "
|
||||
git push -f origin
|
||||
|
||||
echo
|
||||
echo -n "Pushing to upstream/master... "
|
||||
echo -n "Pushing to upstream/$TARG... "
|
||||
git push -f upstream
|
||||
|
||||
else
|
||||
@@ -77,18 +90,7 @@ else
|
||||
git push -f origin
|
||||
fi
|
||||
|
||||
which xdg-open >/dev/null && TOOL=xdg-open
|
||||
which gnome-open >/dev/null && TOOL=gnome-open
|
||||
which open >/dev/null && TOOL=open
|
||||
URL="https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
|
||||
|
||||
if [ -z "$OPEN" ]; then
|
||||
echo "Can't find a tool to open the URL:"
|
||||
echo $URL
|
||||
else
|
||||
echo "Opening a New PR Form..."
|
||||
"$OPEN" "$URL"
|
||||
fi
|
||||
opensite "https://github.com/$ORG/$REPO/compare/$TARG...$FORK:$BRANCH?expand=1"
|
||||
|
||||
fi
|
||||
|
||||
@@ -117,27 +119,14 @@ git clean -d -f
|
||||
git checkout gh-pages || { echo "Something went wrong!"; exit 1; }
|
||||
rsync -av ${TMPFOLDER}/ ./
|
||||
|
||||
opensite() {
|
||||
which xdg-open >/dev/null && TOOL=xdg-open
|
||||
which gnome-open >/dev/null && TOOL=gnome-open
|
||||
which open >/dev/null && TOOL=open
|
||||
URL="http://marlinfw.org/"
|
||||
if [ -z "$OPEN" ]; then
|
||||
echo "Can't find a tool to open the URL:"
|
||||
echo $URL
|
||||
else
|
||||
echo "Opening the site in the browser..."
|
||||
"$OPEN" "$URL"
|
||||
fi
|
||||
}
|
||||
|
||||
# Commit and push the new live site directly
|
||||
git add --all
|
||||
git commit --message "Built from ${COMMIT}"
|
||||
git push upstream | {
|
||||
git push -f origin
|
||||
git push -f upstream | {
|
||||
while IFS= read -r line
|
||||
do
|
||||
[[ $line =~ "gh-pages -> gh-pages" ]] && opensite
|
||||
[[ $line =~ "gh-pages -> gh-pages" ]] && opensite "http://marlinfw.org/"
|
||||
echo "$line"
|
||||
done
|
||||
}
|
||||
@@ -146,6 +135,4 @@ git push upstream | {
|
||||
rm -rf ${TMPFOLDER}
|
||||
|
||||
# Go back to the branch we started from
|
||||
git checkout $BRANCH
|
||||
|
||||
[[ $HAS_STASH == 1 ]] && git stash pop
|
||||
[[ $BRANCH != $CURR ]] && git checkout $BRANCH && [[ $HAS_STASH == 1 ]] && git stash pop
|
||||
|
||||
@@ -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
|
||||
|
||||
+82
-22
@@ -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,16 +11,24 @@ MFINFO=$(mfinfo) || exit 1
|
||||
|
||||
TESTPATH=buildroot/share/tests
|
||||
STATE_FILE=$( echo ./.pio/.mftestrc )
|
||||
SED=$(which gsed || which sed)
|
||||
|
||||
shopt -s extglob nocasematch
|
||||
|
||||
# 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) platformio run --project-dir . -e include_tree ; exit 1 ;;
|
||||
tree) pio run -d . -e include_tree ; exit 1 ;;
|
||||
due) TESTENV='DUE' ;;
|
||||
esp) TESTENV='esp32' ;;
|
||||
lin*) TESTENV='linux_native' ;;
|
||||
@@ -34,6 +41,7 @@ case $TESTENV in
|
||||
f1) TESTENV='STM32F103RE' ;;
|
||||
f4) TESTENV='STM32F4' ;;
|
||||
f7) TESTENV='STM32F7' ;;
|
||||
s6) TESTENV='FYSETC_S6' ;;
|
||||
teensy) TESTENV='teensy31' ;;
|
||||
t31) TESTENV='teensy31' ;;
|
||||
t32) TESTENV='teensy31' ;;
|
||||
@@ -42,22 +50,72 @@ case $TESTENV in
|
||||
# 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
|
||||
pio run -d . -e $TESTENV
|
||||
exit
|
||||
;;
|
||||
# A -y may come first
|
||||
|
||||
-[bu]) MB=$( grep "define MOTHERBOARD" Marlin/Configuration.h | awk '{ print $3 }' | $SED 's/BOARD_//' )
|
||||
[[ -z $MB ]] && { echo "Error - Unable to read MOTHERBOARD setting." ; exit 1 ; }
|
||||
BLINE=$( grep "define BOARD_$MB" Marlin/src/core/boards.h )
|
||||
BNUM=$( $SED -E 's/^.+BOARD_[^ ]+ +([0-9]+).+$/\1/' <<<"$BLINE" )
|
||||
BDESC=$( $SED -E 's/^.+\/\/ *(.+)$/\1/' <<<"$BLINE" )
|
||||
[[ -z $BNUM ]] && { echo "Error - Unable to $MB in boards list." ; exit 1 ; }
|
||||
readarray -t ENVS <<< $( grep -A1 "MB($MB)" Marlin/src/pins/pins.h | $SED -n '2 p' | grep -oE 'env:[^ ]+' | $SED -E 's/env://' )
|
||||
[[ -z $ENVS ]] && { echo "Error - Unable to find target(s) for $MB ($BNUM)." ; exit 1 ; }
|
||||
ECOUNT=${#ENVS[*]}
|
||||
|
||||
if [[ $ECOUNT == 1 ]]; then
|
||||
TARGET=$ENVS
|
||||
else
|
||||
#
|
||||
# List env names and numbers. Get selection.
|
||||
#
|
||||
if [[ $CHOICE == 0 ]]; then
|
||||
echo "Available targets for \"$BDESC\" | $MB ($BNUM):"
|
||||
|
||||
IND=0 ; for ENV in "${ENVS[@]}"; do 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 is 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
|
||||
|
||||
# Matching patterns
|
||||
ISNUM='^[0-9]+$'
|
||||
ISCMD='^(restore|opt|exec|use|pins|env)_'
|
||||
ISEXEC='^exec_'
|
||||
ISCONT='\\ *$'
|
||||
|
||||
#
|
||||
# List available tests and ask for selection
|
||||
#
|
||||
|
||||
if [[ $TESTENV == '-' ]]; then
|
||||
IND=0
|
||||
NAMES=()
|
||||
@@ -85,17 +143,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
|
||||
@@ -112,12 +170,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
|
||||
@@ -135,7 +195,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
|
||||
@@ -153,6 +213,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"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user