From 30f0bbe079003fb18764f9026a8eed7464efb216 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Thu, 9 Dec 2021 07:42:21 +1100 Subject: Add support for 21.11.x, remove 21.6.x as ChibiOS "canceled" it. (#15435) --- util/update_chibios_mirror.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util') diff --git a/util/update_chibios_mirror.sh b/util/update_chibios_mirror.sh index 0bf648ebfd..e6666c55c9 100755 --- a/util/update_chibios_mirror.sh +++ b/util/update_chibios_mirror.sh @@ -4,13 +4,13 @@ # Configuration # The ChibiOS branches to mirror -chibios_branches="trunk stable_20.3.x stable_21.6.x" +chibios_branches="trunk stable_20.3.x stable_21.11.x" # The ChibiOS tags to mirror -chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver20.3.4 ver21.6.0" +chibios_tags="ver20.3.1 ver20.3.2 ver20.3.3 ver20.3.4 ver21.11.1" # The ChibiOS-Contrib branches to mirror -contrib_branches="chibios-20.3.x chibios-21.6.x" +contrib_branches="chibios-20.3.x chibios-21.11.x" ################################ # Actions @@ -88,5 +88,5 @@ echo "Updating ChibiOS-Contrib branches..." for branch in $contrib_branches ; do echo "Creating branch 'mirror/$branch' from 'upstream/$branch'..." git branch -f mirror/$branch upstream/$branch \ - && git push qmk mirror/$branch + && git push qmk mirror/$branch || true # Allow for nonexistent ChibiOS-Contrib branches -- they'll turn up eventually. done -- cgit v1.2.3 From 61f0292f11abbfc2665e4bf6414fcd4352a46365 Mon Sep 17 00:00:00 2001 From: Ryan Date: Sat, 15 Jan 2022 01:46:47 +1100 Subject: Remove network drive mapping comment for WSL (#15871) --- util/qmk_install.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 'util') diff --git a/util/qmk_install.sh b/util/qmk_install.sh index 5f22ba0ad5..3f49bd255a 100755 --- a/util/qmk_install.sh +++ b/util/qmk_install.sh @@ -53,8 +53,6 @@ case $(uname -a) in echo "* *" echo "* Please install the QMK Toolbox instead: *" echo "* https://github.com/qmk/qmk_toolbox/releases *" - echo "* Then, map your WSL filesystem as a network drive: *" - echo "* \\\\\\\\wsl$\\ *" echo "********************************************************************************" echo fi -- cgit v1.2.3 From 5f233458869bc5fd2d91b24f59c8519d5f99c9a6 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Tue, 25 Jan 2022 10:58:53 +1100 Subject: Add a script that simplifies running commands under docker. (#16028) --- util/docker_cmd.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 util/docker_cmd.sh (limited to 'util') diff --git a/util/docker_cmd.sh b/util/docker_cmd.sh new file mode 100755 index 0000000000..2ea113d24a --- /dev/null +++ b/util/docker_cmd.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# NOTE: This script uses tabs for indentation + +errcho() { + echo "$@" >&2 +} + +USAGE="Usage: $0 " + +# Check preconditions +for arg; do + if [ "$arg" = "--help" ]; then + echo "$USAGE" + exit 0 + fi +done + +# Allow $RUNTIME to be overriden by the user as an environment variable +# Else check if either docker or podman exit and set them as runtime +# if none are found error out +if [ -z "$RUNTIME" ]; then + if command -v docker >/dev/null 2>&1; then + RUNTIME="docker" + elif command -v podman >/dev/null 2>&1; then + RUNTIME="podman" + else + errcho "Error: no compatible container runtime found." + errcho "Either podman or docker are required." + errcho "See https://podman.io/getting-started/installation" + errcho "or https://docs.docker.com/install/#supported-platforms" + errcho "for installation instructions." + exit 2 + fi +fi + + +# IF we are using docker on non Linux and docker-machine isn't working print an error +# ELSE set usb_args +if [ ! "$(uname)" = "Linux" ] && [ "$RUNTIME" = "docker" ] && ! docker-machine active >/dev/null 2>&1; then + errcho "Error: target requires docker-machine to work on your platform" + errcho "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" + exit 3 +else + usb_args="--privileged -v /dev:/dev" +fi +dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows + +if [ "$RUNTIME" = "docker" ]; then + uid_arg="--user $(id -u):$(id -g)" +fi + +# Run container and build firmware +"$RUNTIME" run --rm -it \ + $usb_args \ + $uid_arg \ + -w /qmk_firmware \ + -v "$dir":/qmk_firmware \ + qmkfm/qmk_cli \ + "$@" -- cgit v1.2.3 From a239051c4a4779767059140892144dedea09aaf2 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 9 Feb 2022 03:25:55 +1100 Subject: Misc size regression script improvements. (#16268) * Misc size regression script improvements. - Sets environment variable SIZE_REGRESSION_EXECUTING during execution so hook scripts like `post-checkout` may skip processing. - Forces checkout of the target branch, including removal of all temporary object files in the process. - Prints out a warning on exit stating that the git repository is in an indeterminate state, and the user needs to swap back to whatever intended branch they were working with originally. * Remove `git clean` --- util/size_regression.sh | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/size_regression.sh b/util/size_regression.sh index 988d1d9b5b..d474d8d0d5 100755 --- a/util/size_regression.sh +++ b/util/size_regression.sh @@ -11,6 +11,8 @@ dest_ref="develop" ignore_ref="master" unset skip_zero +export SIZE_REGRESSION_EXECUTING=1 + function usage() { echo "Usage: $(basename "$0") [-h] [-j ] [-s ] [-d ] [-n] planck/rev6:default" echo " -h : Shows this usage page." @@ -23,9 +25,24 @@ function usage() { } if [[ ${#} -eq 0 ]]; then - usage + usage + exit 0 fi +unset cleanup_completed +_internal_cleanup() { + if [[ -z "${cleanup_completed:-}" ]] ; then + echo + echo + echo 'Your git repository is in an indeterminate state!' >&2 + echo 'Make sure you swap to your intended branch.' >&2 + echo + unset SIZE_REGRESSION_EXECUTING + fi + cleanup_completed=1 +} +trap _internal_cleanup EXIT HUP INT + while getopts "hj:s:d:i:n" opt "$@" ; do case "$opt" in h) usage; exit 0;; @@ -49,7 +66,8 @@ function build_executor() { revision=$(echo $line | cut -d' ' -f1) make distclean >/dev/null 2>&1 - git checkout $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; } + + git checkout -f $revision >/dev/null 2>&1 || { echo "Failed to check out revision ${revision}" >&2 ; exit 1 ; } make -j${job_count} $keyboard_target >/dev/null 2>&1 || true file_size=$(arm-none-eabi-size .build/*.elf 2>/dev/null | awk '/elf/ {print $1}' 2>/dev/null || true) -- cgit v1.2.3 From 2e279f1b889a59156f30524cc83358f64ee53287 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 8 Feb 2022 19:03:30 +0000 Subject: Initial pass at data driven new-keyboard subcommand (#12795) * Initial pass at a data driven keyboard subcommand * format * lint * Handle bootloader now its mandatory --- util/new_keyboard.sh | 181 --------------------------------------------------- util/new_keymap.sh | 40 ------------ 2 files changed, 221 deletions(-) delete mode 100755 util/new_keyboard.sh delete mode 100755 util/new_keymap.sh (limited to 'util') diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh deleted file mode 100755 index 62e8cb9e13..0000000000 --- a/util/new_keyboard.sh +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env bash - -# This script generates a new keyboard directory under keyboards/, -# and copies the template files from data/templates/ into it. - -# Print an error message with the word "ERROR" in red. -echo_error() { - echo -e "[\033[0;91mERROR\033[m]: $1" -} - -# Print a message in bold. -echo_bold() { - echo -e "\033[1m$1\033[m" -} - -# Prompt the user for information, showing the default value in brackets. -prompt() { - local message="$1" - local default="$2" - - [ -n "$default" ] && message+=" [$default]" - message+=": " - - read -rp "$message" prompt_return - [ -z "$prompt_return" ] && prompt_return="$default" -} - -# Grab a username from Git config. -set_git_username() { - git_username="$(git config --get user.name)" -} - -# Copy the template files to the new keyboard directory. -copy_templates() { - mkdir -p "$keyboard_dir" - - echo -n "Copying base template files..." - cp -r "data/templates/base/." "${keyboard_dir}" - echo " done" - - echo -n "Copying $keyboard_type template files..." - cp -r "data/templates/${keyboard_type}/." "${keyboard_dir}" - echo " done" - - echo -n "Renaming keyboard files..." - mv "${keyboard_dir}/keyboard.c" "${keyboard_dir}/${keyboard_base_name}.c" - mv "${keyboard_dir}/keyboard.h" "${keyboard_dir}/${keyboard_base_name}.h" - echo " done" -} - -# Set the inplace editing parameter for sed. -# macOS/BSD sed expects a file extension immediately following -i. -set_sed_i() { - sed_i=(-i) - - case $(uname -a) in - *Darwin*) sed_i=(-i "") - esac -} - -# Replace a token with a value in the given list of files. -replace_placeholders() { - local replace_token="$1" - local replace_value="$2" - shift 2 - local replace_filenames=("$@") - - echo -n "Replacing $replace_token with $replace_value..." - for replace_filename in "${replace_filenames[@]}"; do - sed "${sed_i[@]}" -e "s/${replace_token}/${replace_value}/g" "$replace_filename" - done - echo " done" -} - -# Replace %YEAR% with the current year. -replace_year_placeholders() { - local replace_year_filenames=( - "${keyboard_dir}/config.h" - "${keyboard_dir}/${keyboard_base_name}.c" - "${keyboard_dir}/${keyboard_base_name}.h" - "${keyboard_dir}/keymaps/default/keymap.c" - ) - replace_placeholders "%YEAR%" "$(date +%Y)" "${replace_year_filenames[@]}" -} - -# Replace %KEYBOARD% with the keyboard name. -replace_keyboard_placeholders() { - local replace_keyboard_filenames=( - "${keyboard_dir}/config.h" - "${keyboard_dir}/info.json" - "${keyboard_dir}/readme.md" - "${keyboard_dir}/${keyboard_base_name}.c" - "${keyboard_dir}/keymaps/default/readme.md" - ) - replace_placeholders "%KEYBOARD%" "$keyboard_base_name" "${replace_keyboard_filenames[@]}" -} - -# Replace %YOUR_NAME% with the username. -replace_name_placeholders() { - local replace_name_filenames=( - "${keyboard_dir}/config.h" - "${keyboard_dir}/info.json" - "${keyboard_dir}/readme.md" - "${keyboard_dir}/${keyboard_base_name}.c" - "${keyboard_dir}/${keyboard_base_name}.h" - "${keyboard_dir}/keymaps/default/keymap.c" - ) - replace_placeholders "%YOUR_NAME%" "$username" "${replace_name_filenames[@]}" -} - -# Check if an array contains an element. -array_contains() { - local e match="$1" - shift - for e; do - [[ "$e" == "$match" ]] && return 0; - done - - return 1 -} - -# If we've been started from util/, we want to be in qmk_firmware/ -[[ "$PWD" == *util ]] && cd .. - -# The root qmk_firmware/ directory should have a subdirectory called quantum/ -if [ ! -d "quantum" ]; then - echo_error "Could not detect the QMK firmware directory!" - echo_error "Are you sure you're in the right place?" - exit 1 -fi - -echo_bold "########################################" -echo_bold "# NOTICE #" -echo_bold "# This script has been deprecated. #" -echo_bold "# Please use qmk new-keyboard instead. #" -echo_bold "########################################" -echo -echo_bold "Generating a new QMK keyboard directory" -echo - -# Keyboard name is required, so keep prompting until we get one -while [ -z "$keyboard_name" ]; do - prompt "Keyboard Name" "" - keyboard_name=$prompt_return - keyboard_base_name=$(basename $keyboard_name) -done - -keyboard_dir="keyboards/$keyboard_name" - -if [ -d "$keyboard_dir" ]; then - echo_error "Keyboard $keyboard_name already exists!" - exit 1 -fi - -KEYBOARD_TYPES=("avr" "ps2avrgb") - -prompt "Keyboard Type" "avr" -keyboard_type=$prompt_return - -if ! array_contains "$keyboard_type" "${KEYBOARD_TYPES[@]}"; then - echo_error "Keyboard type must be one of: ${KEYBOARD_TYPES[*]}" - exit 1 -fi - -set_git_username -prompt "Your Name" "$git_username" -username=$prompt_return - -echo - -copy_templates -set_sed_i -replace_year_placeholders -replace_keyboard_placeholders -[ -n "$username" ] && replace_name_placeholders - -echo -echo_bold "Created a new keyboard called $keyboard_name." -echo -echo_bold "To start working on things, cd into keyboards/$keyboard_name," -echo_bold "or open the directory in your favourite text editor." diff --git a/util/new_keymap.sh b/util/new_keymap.sh deleted file mode 100755 index c483314fdb..0000000000 --- a/util/new_keymap.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Script to make a new keymap for a keyboard of your choosing -# This script automates the copying of the default keymap into -# your own keymap - -KB_PATH=$(echo "$1" | tr 'A-Z' 'a-z') -USERNAME=$(echo "$2" | tr 'A-Z' 'a-z') - -if [ -z "$KB_PATH" ]; then - printf "Usage: %s \n" "$0" - printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0" - exit 1 -fi - -if [ -z "$USERNAME" ]; then - printf "Usage: %s \n" "$0" - printf "Example: %s 1upkeyboards/1up60hse yourname\n" "$0" - exit 1 -fi - -cd "$(dirname "$0")/.." - -if [ ! -d "keyboards/$KB_PATH" ]; then - printf "Error! keyboards/%s does not exist!\n" "$KB_PATH" - exit 1 -fi - -if [ -d "keyboards/$KB_PATH/keymaps/$USERNAME" ]; then - printf "Error! keyboards/%s/keymaps/%s already exists!\n" "$KB_PATH" "$USERNAME" - exit 1 -fi - -# Recursively copy the chosen keyboard's default keymap -cp -r keyboards/"$KB_PATH"/keymaps/default keyboards/"$KB_PATH"/keymaps/"$USERNAME" - -printf "%s keymap directory created in: qmk_firmware/keyboards/%s/keymaps/\n\n" "$USERNAME" "$KB_PATH" - -printf "Compile a firmware file with your new keymap by typing: \n" -printf " make %s:%s\n" "$KB_PATH" "$USERNAME" -printf "from the qmk_firmware directory\n" -- cgit v1.2.3