From 0a03f7cff7b6892ca93333fa5061c1ca454de0cb Mon Sep 17 00:00:00 2001 From: zvecr Date: Wed, 5 Jun 2019 01:17:01 +0100 Subject: Update docker util script and travis to use new base container --- util/docker_build.sh | 2 +- util/travis_build.sh | 2 +- util/travis_test.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/docker_build.sh b/util/docker_build.sh index c573ebcae2..6feeb1f5d2 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -46,5 +46,5 @@ fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware -docker run --rm -it $usb_args -v "$dir":/qmk_firmware qmkfm/qmk_firmware \ +docker run --rm -it $usb_args -w /qmk_firmware/ -v "$dir":/qmk_firmware qmkfm/base_container \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" diff --git a/util/travis_build.sh b/util/travis_build.sh index 554ec8b689..fd5511a72b 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -3,7 +3,7 @@ # if docker is installed - call make within the qmk docker image if command -v docker >/dev/null; then function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/qmk_firmware make "$@" + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" } fi diff --git a/util/travis_test.sh b/util/travis_test.sh index 3be4afff7a..e6a50ac165 100644 --- a/util/travis_test.sh +++ b/util/travis_test.sh @@ -22,7 +22,7 @@ fi # if docker is installed - call make within the qmk docker image if command -v docker >/dev/null; then function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/qmk_firmware make "$@" + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" } fi -- cgit v1.2.3 From a25dd58bc56b0c4010673723ac44eaff914979bb Mon Sep 17 00:00:00 2001 From: skullydazed Date: Mon, 15 Jul 2019 12:14:27 -0700 Subject: QMK CLI and JSON keymap support (#6176) * Script to generate keymap.c from JSON file. * Support for keymap.json * Add a warning about the keymap.c getting overwritten. * Fix keymap generating * Install the python deps * Flesh out more of the python environment * Remove defunct json2keymap * Style everything with yapf * Polish up python support * Hide json keymap.c into the .build dir * Polish up qmk-compile-json * Make milc work with positional arguments * Fix a couple small things * Fix some errors and make the CLI more understandable * Make the qmk wrapper more robust * Add basic QMK Doctor * Clean up docstrings and flesh them out as needed * remove unused compile_firmware() function --- util/freebsd_install.sh | 2 ++ util/linux_install.sh | 5 +++++ util/macos_install.sh | 3 +++ util/msys2_install.sh | 3 +++ util/wsl_install.sh | 5 ++++- 5 files changed, 17 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/freebsd_install.sh b/util/freebsd_install.sh index c8696e8cc7..8157592031 100755 --- a/util/freebsd_install.sh +++ b/util/freebsd_install.sh @@ -1,4 +1,5 @@ #!/bin/sh +util_dir=$(dirname "$0") pkg update pkg install -y \ git \ @@ -17,3 +18,4 @@ pkg install -y \ arm-none-eabi-newlib \ diffutils \ python3 +pip3 install -r ${util_dir}/../requirements.txt diff --git a/util/linux_install.sh b/util/linux_install.sh index 4731ec0156..d21cd3c1c9 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -8,6 +8,8 @@ SLACKWARE_WARNING="You will need the following packages from slackbuilds.org:\n\ SOLUS_INFO="Your tools are now installed. To start using them, open new terminal or source these scripts:\n\t/usr/share/defaults/etc/profile.d/50-arm-toolchain-path.sh\n\t/usr/share/defaults/etc/profile.d/50-avr-toolchain-path.sh" +util_dir=$(dirname "$0") + if grep ID /etc/os-release | grep -qE "fedora"; then sudo dnf install \ arm-none-eabi-binutils-cs \ @@ -183,3 +185,6 @@ else echo echo "https://docs.qmk.fm/#/contributing" fi + +# Global install tasks +pip3 install -r ${util_dir}/../requirements.txt diff --git a/util/macos_install.sh b/util/macos_install.sh index 915ff3143c..f7e3044249 100755 --- a/util/macos_install.sh +++ b/util/macos_install.sh @@ -1,5 +1,7 @@ #!/bin/bash +util_dir=$(dirname "$0") + if ! brew --version 2>&1 > /dev/null; then echo "Error! Homebrew not installed or broken!" echo -n "Would you like to install homebrew now? [y/n] " @@ -24,3 +26,4 @@ brew tap PX4/homebrew-px4 brew update brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude dfu-util python3 brew link --force avr-gcc@8 +pip3 install -r ${util_dir}/../requirements.txt diff --git a/util/msys2_install.sh b/util/msys2_install.sh index bcb628ab21..bed176da66 100755 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -5,6 +5,7 @@ download_dir=~/qmk_utils avrtools=avr8-gnu-toolchain armtools=gcc-arm-none-eabi installflip=false +util_dir=$(dirname "$0") echo "Installing dependencies needed for the installation (quazip)" pacman --needed -S base-devel mingw-w64-x86_64-toolchain msys/git msys/p7zip msys/python3 msys/unzip @@ -92,6 +93,8 @@ else fi popd +pip3 install -r ${util_dir}/../requirements.txt + cp -f "$dir/activate_msys2.sh" "$download_dir/" if grep "^source ~/qmk_utils/activate_msys2.sh$" ~/.bashrc diff --git a/util/wsl_install.sh b/util/wsl_install.sh index c2c206d2b9..197d9f089e 100755 --- a/util/wsl_install.sh +++ b/util/wsl_install.sh @@ -1,6 +1,7 @@ #!/bin/bash -dir=$(cd -P -- "$(dirname -- "$0")" && pwd -P) +util_dir=$(dirname "$0") +dir=$(cd -P -- "$util_dir" && pwd -P) pushd "$dir"; if [[ $dir != /mnt/* ]]; @@ -28,6 +29,8 @@ download_dir=wsl_downloaded source "$dir/win_shared_install.sh" +pip3 install -r ${util_dir}/../requirements.txt + pushd "$download_dir" while true; do echo -- cgit v1.2.3 From 29e9caa82bdfe898dd7fca82fcecf0cae2374859 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 16 Jul 2019 09:20:34 +0100 Subject: Configure Vagrant to use qmk_base_container (#6194) * Initial conversion of vagrant to use qmkfm/base_container * Fix vagrant when using docker provider * Workaround for VirtualBox VM restarts * Generalise Vagrant docs slightly and add FAQ --- util/vagrant/Dockerfile | 33 +++++++++++++++++++++++++++++++++ util/vagrant/readme.md | 12 ++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 util/vagrant/Dockerfile create mode 100644 util/vagrant/readme.md (limited to 'util') diff --git a/util/vagrant/Dockerfile b/util/vagrant/Dockerfile new file mode 100644 index 0000000000..1936ee023a --- /dev/null +++ b/util/vagrant/Dockerfile @@ -0,0 +1,33 @@ +FROM qmkfm/base_container + +# Basic upgrades; install sudo and SSH. +RUN apt-get update && apt-get install --no-install-recommends -y \ + sudo \ + openssh-server \ + && rm -rf /var/lib/apt/lists/* +RUN mkdir /var/run/sshd +RUN sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config +RUN echo 'UseDNS no' >> /etc/ssh/sshd_config + +# Remove the policy file once we're finished installing software. +# This allows invoke-rc.d and friends to work as expected. +RUN rm /usr/sbin/policy-rc.d + +# Add the Vagrant user and necessary passwords. +RUN groupadd vagrant +RUN useradd -c "Vagrant" -g vagrant -d /home/vagrant -m -s /bin/bash vagrant +RUN echo 'root:vagrant' | chpasswd +RUN echo 'vagrant:vagrant' | chpasswd + +# Allow the vagrant user to use sudo without a password. +RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant + +# Install Vagrant's insecure public key so provisioning and 'vagrant ssh' work. +RUN mkdir /home/vagrant/.ssh +ADD https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub /home/vagrant/.ssh/authorized_keys +RUN chmod 0600 /home/vagrant/.ssh/authorized_keys +RUN chown -R vagrant:vagrant /home/vagrant/.ssh +RUN chmod 0700 /home/vagrant/.ssh + +EXPOSE 22 +CMD ["/usr/sbin/sshd", "-D"] diff --git a/util/vagrant/readme.md b/util/vagrant/readme.md new file mode 100644 index 0000000000..e4b870a642 --- /dev/null +++ b/util/vagrant/readme.md @@ -0,0 +1,12 @@ +# QMK Vagrant Utilities + +## Dockerfile +Vagrant-friendly `qmkfm/base_container`. + +In order for the Docker provider and `vagrant ssh` to function the container has a few extra requirements. + +* vagrant user +* ssh server + * configured with expected public key +* sudo + * passwordless for vagrant user -- cgit v1.2.3 From 59d3b37130fc08caf0ed2926332e8741d5fd8517 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 7 Aug 2019 04:20:53 +1000 Subject: Fix qmk_install.sh on Windows dropping to command prompt (#6488) --- util/win_shared_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/win_shared_install.sh b/util/win_shared_install.sh index c7517881ee..f8fc9308f4 100755 --- a/util/win_shared_install.sh +++ b/util/win_shared_install.sh @@ -34,7 +34,7 @@ function install_drivers { pushd "$download_dir" cp -f "$dir/drivers.txt" . echo - cmd.exe /c "qmk_driver_installer.exe $1 $2 drivers.txt" + cmd.exe //c "qmk_driver_installer.exe $1 $2 drivers.txt" popd > /dev/null } -- cgit v1.2.3 From 9813a6f950b46277eb29c54105809767cc0daa65 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Thu, 15 Aug 2019 22:03:26 +0100 Subject: Add an alternative method for keyboard discovery to speed up build (#6073) * Add an alternative method for keyboard discovery to speed up build * Chain MAKEFLAGS for docker_build.sh * Slight improvement to number of items sent to sort * Remove debug line * Fix line escape --- util/docker_build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/docker_build.sh b/util/docker_build.sh index 6feeb1f5d2..f36d5bcde5 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -46,5 +46,11 @@ fi dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware -docker run --rm -it $usb_args -w /qmk_firmware/ -v "$dir":/qmk_firmware qmkfm/base_container \ +docker run --rm -it $usb_args \ + -w /qmk_firmware/ \ + -v "$dir":/qmk_firmware \ + -e ALT_GET_KEYBOARDS=true \ + -e SKIP_GIT="$SKIP_GIT" \ + -e MAKEFLAGS="$MAKEFLAGS" \ + qmkfm/base_container \ make "$keyboard${keymap:+:$keymap}${target:+:$target}" -- cgit v1.2.3 From 9e20478e6bdebc9cea49204482992471bccaf6a1 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Tue, 9 Jul 2019 15:47:18 -0700 Subject: Enforce clang-format (#6293) * Enforce clang-format on commit for core files * forgot about tests --- util/linux_install.sh | 6 ++++++ util/macos_install.sh | 2 +- util/msys2_install.sh | 2 +- util/travis_compiled_push.sh | 3 ++- 4 files changed, 10 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/linux_install.sh b/util/linux_install.sh index d21cd3c1c9..5f29cad941 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -19,6 +19,7 @@ if grep ID /etc/os-release | grep -qE "fedora"; then avr-gcc \ avr-libc \ binutils-avr32-linux-gnu \ + clang \ dfu-util \ dfu-programmer \ diffutils \ @@ -44,6 +45,7 @@ elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then avr-libc \ binutils-arm-none-eabi \ binutils-avr \ + clang-format \ dfu-programmer \ dfu-util \ diffutils \ @@ -68,6 +70,7 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then avr-libc \ avr-gcc \ base-devel \ + clang \ dfu-util \ diffutils \ gcc \ @@ -96,6 +99,7 @@ elif grep ID /etc/os-release | grep -q gentoo; then dev-embedded/avrdude \ dev-lang/python:3.5 \ net-misc/wget \ + sys-devel/clang \ sys-devel/gcc \ sys-devel/crossdev sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr @@ -112,6 +116,7 @@ elif grep ID /etc/os-release | grep -q sabayon; then dev-embedded/avrdude \ dev-lang/python \ net-misc/wget \ + sys-devel/clang \ sys-devel/gcc \ sys-devel/crossdev sudo crossdev -s4 --stable --g =4.9.4 --portage --verbose --target avr @@ -126,6 +131,7 @@ elif grep ID /etc/os-release | grep -qE "opensuse|tumbleweed"; then fi sudo zypper install \ avr-libc \ + clang \ $CROSS_AVR_GCC \ $CROSS_ARM_GCC \ cross-avr-binutils \ diff --git a/util/macos_install.sh b/util/macos_install.sh index f7e3044249..d9ec50a7e2 100755 --- a/util/macos_install.sh +++ b/util/macos_install.sh @@ -24,6 +24,6 @@ fi brew tap osx-cross/avr brew tap PX4/homebrew-px4 brew update -brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude dfu-util python3 +brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude clang-format dfu-util python3 brew link --force avr-gcc@8 pip3 install -r ${util_dir}/../requirements.txt diff --git a/util/msys2_install.sh b/util/msys2_install.sh index bed176da66..ac9a6c7694 100755 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -8,7 +8,7 @@ installflip=false util_dir=$(dirname "$0") echo "Installing dependencies needed for the installation (quazip)" -pacman --needed -S base-devel mingw-w64-x86_64-toolchain msys/git msys/p7zip msys/python3 msys/unzip +pacman --needed -S base-devel mingw-w64-x86_64-toolchain msys/clang msys/git msys/p7zip msys/python3 msys/unzip source "$dir/win_shared_install.sh" diff --git a/util/travis_compiled_push.sh b/util/travis_compiled_push.sh index 04021ae7c2..f20e30cdb3 100755 --- a/util/travis_compiled_push.sh +++ b/util/travis_compiled_push.sh @@ -9,9 +9,10 @@ echo "Using git hash ${rev}" if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then -# convert to unix line-endings +# fix formatting git checkout master git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix +git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | xargs -0 clang-format git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add git commit -m "convert to unix line-endings [skip ci]" && git push git@github.com:qmk/qmk_firmware.git master -- cgit v1.2.3 From 210da974a071ca4df810e5330bdaf10ef0c6dfef Mon Sep 17 00:00:00 2001 From: skullydazed Date: Wed, 10 Jul 2019 16:24:48 -0700 Subject: Add new files to the list of files that are formatted. (#6296) --- util/travis_compiled_push.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util') diff --git a/util/travis_compiled_push.sh b/util/travis_compiled_push.sh index f20e30cdb3..4737d693b8 100755 --- a/util/travis_compiled_push.sh +++ b/util/travis_compiled_push.sh @@ -11,10 +11,10 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; the # fix formatting git checkout master -git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix -git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | xargs -0 clang-format -git diff --diff-filter=M --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add -git commit -m "convert to unix line-endings [skip ci]" && git push git@github.com:qmk/qmk_firmware.git master +git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix +git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | xargs -0 clang-format +git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add +git commit -m "format code according to conventions [skip ci]" && git push git@github.com:qmk/qmk_firmware.git master increment_version () { -- cgit v1.2.3 From 5095a999b7e99c2a087837ea4360b8e53c11f219 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 3 Sep 2019 00:09:09 +1000 Subject: Fix msys2 not installing any packages because it can't find clang (#6655) --- util/msys2_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/msys2_install.sh b/util/msys2_install.sh index ac9a6c7694..58397c7a3f 100755 --- a/util/msys2_install.sh +++ b/util/msys2_install.sh @@ -8,7 +8,7 @@ installflip=false util_dir=$(dirname "$0") echo "Installing dependencies needed for the installation (quazip)" -pacman --needed -S base-devel mingw-w64-x86_64-toolchain msys/clang msys/git msys/p7zip msys/python3 msys/unzip +pacman --needed -S base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang msys/git msys/p7zip msys/python3 msys/unzip source "$dir/win_shared_install.sh" -- cgit v1.2.3 From 05d0e8c09eb972e654e15936aa0118add35f6376 Mon Sep 17 00:00:00 2001 From: Cory Watson Date: Mon, 2 Sep 2019 10:32:14 -0400 Subject: Add `dfu-programmer` to `pacman -S` (#6619) * Add `dfu-programmer` to `pacman -S` (#6618) `dfu-programmer` now resides at `extra/dfu-programmer` and is no longer in the AUR * Add `--needed` option to `pacman -S` for efficiency * Fix * Update util/linux_install.sh Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> --- util/linux_install.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/linux_install.sh b/util/linux_install.sh index 5f29cad941..73ba25e13b 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -61,7 +61,7 @@ elif grep ID /etc/os-release | grep -qE 'debian|ubuntu'; then elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then sudo pacman -U https://archive.archlinux.org/packages/a/avr-gcc/avr-gcc-8.3.0-1-x86_64.pkg.tar.xz - sudo pacman -S \ + sudo pacman -S --needed \ arm-none-eabi-binutils \ arm-none-eabi-gcc \ arm-none-eabi-newlib \ @@ -71,6 +71,7 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then avr-gcc \ base-devel \ clang \ + dfu-programmer \ dfu-util \ diffutils \ gcc \ @@ -79,10 +80,6 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then unzip \ wget \ zip - git clone https://aur.archlinux.org/dfu-programmer.git /tmp/dfu-programmer - cd /tmp/dfu-programmer || exit 1 - makepkg -sic - rm -rf /tmp/dfu-programmer/ elif grep ID /etc/os-release | grep -q gentoo; then echo "$GENTOO_WARNING" | fmt -- cgit v1.2.3 From 4d339b7b5d1ecc2320080798d7e07e2d43675578 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20=C4=90or=C4=91evi=C4=87?= Date: Sat, 7 Sep 2019 10:17:54 +0200 Subject: Update docker_build.sh: indentation fix, error echo function (#6659) * Replace spaces with tab in docker_build.sh * Use errcho instead of echo >&2 --- util/docker_build.sh | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'util') diff --git a/util/docker_build.sh b/util/docker_build.sh index f36d5bcde5..99d59d1696 100755 --- a/util/docker_build.sh +++ b/util/docker_build.sh @@ -1,6 +1,10 @@ #!/bin/sh # NOTE: This script uses tabs for indentation +errcho() { + echo "$@" >&2 +} + USAGE="Usage: $0 [keyboard[:keymap[:target]]]" # Check preconditions @@ -11,11 +15,11 @@ for arg; do fi done if [ $# -gt 1 ]; then - echo "$USAGE" >&2 + errcho "$USAGE" exit 1 elif ! command -v docker >/dev/null 2>&1; then - echo "Error: docker not found" >&2 - echo "See https://docs.docker.com/install/#supported-platforms for installation instructions" >&2 + errcho "Error: docker not found" + errcho "See https://docs.docker.com/install/#supported-platforms for installation instructions" exit 2 fi @@ -29,7 +33,7 @@ else $1 EOF if [ -n "$x" ]; then - echo "$USAGE" >&2 + errcho "$USAGE" exit 1 fi fi @@ -37,9 +41,9 @@ if [ -n "$target" ]; then if [ "$(uname)" = "Linux" ] || docker-machine active >/dev/null 2>&1; then usb_args="--privileged -v /dev:/dev" else - echo "Error: target requires docker-machine to work on your platform" >&2 - echo "See http://gw.tnode.com/docker/docker-machine-with-usb-support-on-windows-macos" >&2 - echo "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" >&2 + 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" + errcho "Consider flashing with QMK Toolbox (https://github.com/qmk/qmk_toolbox) instead" exit 3 fi fi @@ -47,7 +51,7 @@ dir=$(pwd -W 2>/dev/null) || dir=$PWD # Use Windows path if on Windows # Run container and build firmware docker run --rm -it $usb_args \ - -w /qmk_firmware/ \ + -w /qmk_firmware \ -v "$dir":/qmk_firmware \ -e ALT_GET_KEYBOARDS=true \ -e SKIP_GIT="$SKIP_GIT" \ -- cgit v1.2.3 From 1013ae2d34dc34e0e7d63fe875e70801ded3673c Mon Sep 17 00:00:00 2001 From: skullY Date: Thu, 29 Aug 2019 12:24:27 -0700 Subject: Add python tests to the travis check --- util/travis_build.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index fd5511a72b..3fff768f6f 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -22,7 +22,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then eval $MAKE_ALL : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | wc -l) + NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | wc -l) BRANCH=$(git rev-parse --abbrev-ref HEAD) # is this branch master or a "non docs, non keyboards" change if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then @@ -51,6 +51,14 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then fi done fi + # Check and run python tests if necessary + PFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -E '^(lib/python/)' | wc -l) + if [ $PFM -gt 0 -o "$BRANCH" = "master" ]; then + echo + echo "Running python tests." + bin/qmk nose2 + : $((exit_code = $exit_code + $?)) + fi fi exit $exit_code fi -- cgit v1.2.3 From 18690ddaeaa66de91bcd635fb2eeee4364e1d162 Mon Sep 17 00:00:00 2001 From: skullY Date: Thu, 29 Aug 2019 12:31:16 -0700 Subject: filter python from the list of things that trigger default builds --- util/travis_build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 3fff768f6f..81546c1156 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -22,7 +22,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then eval $MAKE_ALL : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | wc -l) + NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev (^bin/qmk) | wc -l) BRANCH=$(git rev-parse --abbrev-ref HEAD) # is this branch master or a "non docs, non keyboards" change if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then @@ -52,7 +52,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then done fi # Check and run python tests if necessary - PFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -E '^(lib/python/)' | wc -l) + PFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -E -e '^(lib/python/)' -e '^(bin/qmk)' | wc -l) if [ $PFM -gt 0 -o "$BRANCH" = "master" ]; then echo echo "Running python tests." -- cgit v1.2.3 From 16366dd23d2c37932e2c0975800f0a8b30d53863 Mon Sep 17 00:00:00 2001 From: skullY Date: Thu, 29 Aug 2019 12:44:08 -0700 Subject: add missing apostrophes --- util/travis_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 81546c1156..9ea0c5c4b9 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -22,7 +22,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then eval $MAKE_ALL : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev (^bin/qmk) | wc -l) + NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev '(^bin/qmk)' | wc -l) BRANCH=$(git rev-parse --abbrev-ref HEAD) # is this branch master or a "non docs, non keyboards" change if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then -- cgit v1.2.3 From 6ca29f2b9b02763aa3de607e8d08f14d5284918f Mon Sep 17 00:00:00 2001 From: skullY Date: Thu, 29 Aug 2019 13:05:11 -0700 Subject: Run the python tests inside docker --- util/travis_build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 9ea0c5c4b9..605b6d5f05 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -2,9 +2,9 @@ # if docker is installed - call make within the qmk docker image if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } + function make() { + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" + } fi # test force push @@ -30,7 +30,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then eval $MAKE_ALL : $((exit_code = $exit_code + $?)) else - # keyboards project format + # keyboards project format # /keyboards/board1/rev/keymaps/ # /keyboards/board2/keymaps/ # ensure we strip everything off after and including the keymaps folder to get board and/or revision @@ -56,7 +56,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then if [ $PFM -gt 0 -o "$BRANCH" = "master" ]; then echo echo "Running python tests." - bin/qmk nose2 + docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk nose2 : $((exit_code = $exit_code + $?)) fi fi -- cgit v1.2.3 From 7f65323e101a911fb64abc49ff3c81f8ed7656a7 Mon Sep 17 00:00:00 2001 From: Sorixelle <38685302+Sorixelle@users.noreply.github.com> Date: Sat, 21 Sep 2019 16:55:51 +1000 Subject: Add support for Void Linux systems to the qmk_install.sh script (#5526) * Add support for Void Linux systems to the qmk_install.sh script * Fix typos + grammatical edits in comments * Sort distributions by alphabetical order in linux_install.sh * Revert previous commit and sort Void packages in alphabetical order * Fix permissions on `util/linux_install.sh` --- util/linux_install.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'util') diff --git a/util/linux_install.sh b/util/linux_install.sh index 73ba25e13b..dca0110a5d 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -183,6 +183,29 @@ elif grep ID /etc/os-release | grep -q solus; then unzip printf "\n$SOLUS_INFO\n" +elif grep ID /etc/os-release | grep -q void; then + # musl Void systems don't have glibc cross compilers avaliable in their repos. + # glibc Void systems do have musl cross compilers though, for some reason. + # So, default to musl, and switch to glibc if it is installed. + CROSS_ARM=cross-arm-linux-musleabi + if xbps-query glibc > /dev/null; then # Check is glibc if installed + CROSS_ARM=cross-arm-linux-gnueabi + fi + + sudo xbps-install \ + avr-binutils \ + avr-gcc \ + avr-libc \ + $CROSS_ARM \ + dfu-programmer \ + dfu-util \ + gcc \ + git \ + make \ + wget \ + unzip \ + zip + else echo "Sorry, we don't recognize your OS. Help us by contributing support!" echo -- cgit v1.2.3 From d569f0877155efc752994f8a21f5cf001f9d6ae6 Mon Sep 17 00:00:00 2001 From: skullydazed Date: Sun, 22 Sep 2019 13:25:33 -0700 Subject: Configuration system for CLI (#6708) * Rework how bin/qmk handles subcommands * qmk config wip * Code to show all configs * Fully working `qmk config` command * Mark some CLI arguments so they don't pollute the config file * Fleshed out config support, nicer subcommand support * sync with installable cli * pyformat * Add a test for subcommand_modules * Documentation for the `qmk config` command * split config_token on space so qmk config is more predictable * Rework how subcommands are imported * Document `arg_only` * Document deleting from CLI * Document how multiple operations work * Add cli config to the doc index * Add tests for the cli commands * Make running the tests more reliable * Be more selective about building all default keymaps * Update new-keymap to fit the new subcommand style * Add documentation about writing CLI scripts * Document new-keyboard * Update docs/cli_configuration.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update docs/cli_development.md Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Address yan's comments. * Apply suggestions from code review suggestions from @noahfrederick Co-Authored-By: Noah Frederick * Apply suggestions from code review Co-Authored-By: Noah Frederick * Remove pip3 from the test runner --- util/travis_build.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 605b6d5f05..2bc1ccd62f 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -18,11 +18,12 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then exit_code=0 git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} if [ $? -eq 128 ]; then - echo "Making default keymaps for all keyboards" + # We don't know what changed so just build the default keymaps + echo "Making default keymaps for all keyboards (fallback)" eval $MAKE_ALL : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev '(^bin/qmk)' | wc -l) + NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev '^(bin/qmk)' | grep -Ev '^(requirements.txt)' | grep -Ev '^(util/)' | wc -l) BRANCH=$(git rev-parse --abbrev-ref HEAD) # is this branch master or a "non docs, non keyboards" change if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then @@ -56,7 +57,7 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then if [ $PFM -gt 0 -o "$BRANCH" = "master" ]; then echo echo "Running python tests." - docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk nose2 + docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container 'bin/qmk pytest' : $((exit_code = $exit_code + $?)) fi fi -- cgit v1.2.3 From c47fa31a0031a911eb4d97a043fe32792a57eba6 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Tue, 1 Oct 2019 10:45:44 +1000 Subject: Port drivers.txt changes from the Toolbox (#6786) --- util/drivers.txt | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) (limited to 'util') diff --git a/util/drivers.txt b/util/drivers.txt index 4e5439c39b..71d99eaa90 100644 --- a/util/drivers.txt +++ b/util/drivers.txt @@ -3,45 +3,12 @@ # Use a comma as a separator without spaces # Driver can be one of winusb,libusb,libusbk # Use Windows Powershell and type [guid]::NewGuid() to generate guids +winusb,STM32 Bootloader,0483,DF11,6d98a87f-4ecf-464d-89ed-8c684d857a75 +libusb,USBaspLoader,16C0,05DC,e69affdc-0ef0-427c-aefb-4e593c9d2724 winusb,Kiibohd DFU Bootloader,1C11,B007,aa5a3f86-b81e-4416-89ad-0c1ea1ed63af -winusb,STM32 Bootloader,0483,df11,6d98a87f-4ecf-464d-89ed-8c684d857a75 -libusb,ATxmega16C4,03EB,2FD8,23266ee7-5423-4cc4-993b-034571c43a90 -libusb,ATxmega32C4,03EB,2FD9,d4b62886-2ac8-4534-aa24-eae0a2c3ce43 -libusb,ATxmega64C3,03EB,2FD6,08467ca7-9b5a-41d2-8d8a-4a26d0b5285b -libusb,ATxmega128C3,03EB,2FD7,1ca69799-6d95-46cf-be69-5b3d0eb915e6 -libusb,ATxmega256C3,03EB,2FDA,216ddc8b-6c67-4cc0-b934-482829a483a0 -libusb,ATxmega384C3,03EB,2FDB,0e4e3347-6025-4d49-ba80-2375ea690c28 -libusb,ATxmega64A1U,03EB,2FE8,2553d8fa-7de1-44a6-bdbf-57be8bb37e28 -libusb,ATxmega128A1U,03EB,2FED,6d9fd0ff-755d-4e29-bd29-df0a9a7544b9 -libusb,ATxmega64A4U,03EB,2FDD,bcf5e7c3-44a1-4fd1-971f-9ef9843f6291 -libusb,ATxmega128A4U,03EB,2FDE,3f976bb6-36ca-44cc-a728-844bc1d0d168 -libusb,ATxmega64B3,03EB,2FDF,de280c81-c12a-4ca7-bf34-566151786418 -libusb,ATxmega128B3,03EB,2FE0,2ad1ffeb-eb83-4e78-b34a-d5633771991f -libusb,ATxmega64B1,03EB,2FE1,002874a6-7fc7-413b-9ac4-2b52c5a230bd -libusb,ATxmega128B1,03EB,2FEA,60ea9d08-2ae6-4434-b743-ce6f73537136 -libusb,ATxmega256A3BU,03EB,2FE2,5949bd0a-8bd4-417b-b1c5-7d249836bf0d -libusb,ATxmega16A4U,03EB,2FE3,cc3172b0-e86a-4758-914e-951bca6ca7f5 -libusb,ATxmega32A4U,03EB,2FE4,f44c515f-7d17-4612-a532-ee620afb22b2 -libusb,ATxmega64A4U,03EB,2FE5,c1af4f1c-045f-40c9-893a-3ad4adb2e67d -libusb,ATxmega128A3U,03EB,2FE6,26f275f0-d6b2-46d8-8334-e4de66996c74 -libusb,ATxmega192A3U,03EB,2FE7,b7b50d98-0429-4235-8f08-5466e4f83ed4 -libusb,UC3,03EB,2FDC,972d9af7-d71b-44c7-a895-9340b362f545 -libusb,ATUC3,03EB,2FE9,d5855d0a-f82e-4df5-9c14-2b0b1dcb65bd -libusb,AT32UC3C,03EB,2FEB,1eeb52aa-fd24-47fd-8a76-056446d1a54f -libusb,ATxmega256A3U,03EB,2FEC,198fa8ea-3157-4863-b9a8-a3f6fe027367 -libusb,ATmega8U2,03EB,2FEE,14018055-46f4-4c62-aa03-e8fafeedaf72 libusb,ATmega16U2,03EB,2FEF,007274da-b75f-492e-a288-8fc0aff8339f libusb,ATmega32U2,03EB,2FF0,ddc2c572-cb6e-4f61-a6cc-1a5de941f063 -libusb,AT32UC3A3,03EB,2FF1,8b614283-36c0-46a2-890d-65f61b5b6201 -libusb,ATmega32U6,03EB,2FF2,a207dd90-2814-4418-b5b7-4b708fdf1bfd libusb,ATmega16U4,03EB,2FF3,3180d426-bf93-4578-a693-2efbc337da8e libusb,ATmega32U4,03EB,2FF4,5f9726fd-f9de-487a-9fbd-8b3524a7a56a -libusb,AT32UC3B,03EB,2FF6,ef90068a-277a-44db-805a-9b83a6beb29a -libusb,AT90USB82,03EB,2FF7,062fa2ab-f9d8-4a0d-83c1-df0521cfd0f6 -libusb,AT32UC3A,03EB,2FF8,24080a67-3874-4fb8-8808-fb4cc297c466 libusb,AT90USB64,03EB,2FF9,c6a708ad-e97d-43cd-b04a-3180d737a71b -libusb,AT90USB162,03EB,2FFA,de67bff5-6e39-4e9c-8dfe-de7fce113716 libusb,AT90USB128,03EB,2FFB,fd217df3-59d0-440a-a8f3-4c0c8c84daa3 -libusb,AT89C5130,03EB,2FFD,31b69a56-9ac0-4fab-a3ae-cd7bb7021ec5 -libusb,AT8XC5122,03EB,2FFE,395a6118-8568-41b2-913a-d16912722342 -libusb,AT89C5132,03EB,2FFF,266ca4bc-5e59-4a7b-82dc-6e8732373d40 -- cgit v1.2.3 From ed1bf3afa25d7e7674df7e8618dfaf243de3058b Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 10 Oct 2019 21:48:37 +1100 Subject: Prevent clang-format messing up placeholder tokens within keyboard templates (#6790) * Use .template file extension for keyboard template files * Filter out .template files completely before passing to clang-format * Undo file extension stuff; just ignore quantum/template dir --- util/new_keyboard.sh | 4 ++-- util/travis_compiled_push.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'util') diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh index 35d89e4026..fe7c1a8299 100755 --- a/util/new_keyboard.sh +++ b/util/new_keyboard.sh @@ -41,8 +41,8 @@ copy_templates() { echo " done" echo -n "Renaming keyboard files..." - mv "${keyboard_dir}/template.c" "${keyboard_dir}/${keyboard_name}.c" - mv "${keyboard_dir}/template.h" "${keyboard_dir}/${keyboard_name}.h" + mv "${keyboard_dir}/keyboard.c" "${keyboard_dir}/${keyboard_name}.c" + mv "${keyboard_dir}/keyboard.h" "${keyboard_dir}/${keyboard_name}.h" echo " done" } diff --git a/util/travis_compiled_push.sh b/util/travis_compiled_push.sh index 4737d693b8..8ca65f21a0 100755 --- a/util/travis_compiled_push.sh +++ b/util/travis_compiled_push.sh @@ -12,7 +12,7 @@ if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; the # fix formatting git checkout master git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix -git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | xargs -0 clang-format +git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | grep -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | grep -v 'quantum/template' | xargs -0 clang-format git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add git commit -m "format code according to conventions [skip ci]" && git push git@github.com:qmk/qmk_firmware.git master -- cgit v1.2.3 From e1de0d74a6f6c4bdc762b32fb78e449aed0fcecb Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Mon, 14 Oct 2019 17:57:53 +0100 Subject: Move running pytest to travis_test (#7005) --- util/travis_build.sh | 10 +--------- util/travis_test.sh | 36 ++++++++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 19 deletions(-) (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 2bc1ccd62f..225c8548f5 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -1,6 +1,6 @@ #!/bin/bash -# if docker is installed - call make within the qmk docker image +# if docker is installed - patch calls to within the qmk docker image if command -v docker >/dev/null; then function make() { docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" @@ -52,14 +52,6 @@ if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then fi done fi - # Check and run python tests if necessary - PFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -E -e '^(lib/python/)' -e '^(bin/qmk)' | wc -l) - if [ $PFM -gt 0 -o "$BRANCH" = "master" ]; then - echo - echo "Running python tests." - docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container 'bin/qmk pytest' - : $((exit_code = $exit_code + $?)) - fi fi exit $exit_code fi diff --git a/util/travis_test.sh b/util/travis_test.sh index e6a50ac165..9b7402c282 100644 --- a/util/travis_test.sh +++ b/util/travis_test.sh @@ -1,29 +1,45 @@ #!/bin/bash +# if docker is installed - patch calls to within the qmk docker image +if command -v docker >/dev/null; then + function make() { + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" + } + function qmk() { + docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" + } +fi + TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" # test force push #TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" -NUM_IMPACTING_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ecv '^(docs/)') BRANCH=$(git rev-parse --abbrev-ref HEAD) +CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) + +NUM_CORE_CHANGES=$(echo "$CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)') +NUM_PY_CHANGES=$(echo "$CHANGES" | grep -Ec -e '^(lib/python/)' -e '^(bin/qmk)') if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then echo "Skipping due to commit message" exit 0 fi -if [ "$BRANCH" != "master" ] && [ "$NUM_IMPACTING_CHANGES" == "0" ]; then - echo "Skipping due to changes not impacting tests" - exit 0 +exit_code=0 + +if [ "$BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then + echo "Running tests." + make test:all + : $((exit_code = $exit_code + $?)) + fi -# if docker is installed - call make within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } +if [ "$BRANCH" == "master" ] || [ "$NUM_PY_CHANGES" != "0" ]; then + echo "Running python tests." + qmk pytest + : $((exit_code = $exit_code + $?)) fi -make test:all +exit $exit_code -- cgit v1.2.3 From 5c1b7fb5021646d05014a89ec1b8ccf458e4f50e Mon Sep 17 00:00:00 2001 From: Yang Li Date: Sat, 19 Oct 2019 08:22:54 +0800 Subject: Add python-pip as package dependency for archlinux (#7041) --- util/linux_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/linux_install.sh b/util/linux_install.sh index dca0110a5d..c54a806234 100755 --- a/util/linux_install.sh +++ b/util/linux_install.sh @@ -77,6 +77,7 @@ elif grep ID /etc/os-release | grep -q 'arch\|manjaro'; then gcc \ git \ python \ + python-pip \ unzip \ wget \ zip @@ -213,4 +214,4 @@ else fi # Global install tasks -pip3 install -r ${util_dir}/../requirements.txt +pip3 install --user -r ${util_dir}/../requirements.txt -- cgit v1.2.3 From b23f6011c34dcb471c312655f7af37c0a0f5f779 Mon Sep 17 00:00:00 2001 From: Amber Holly Date: Sat, 19 Oct 2019 02:14:49 +0100 Subject: Remove build option firmware size impacts (#6947) * Update rules.mk template to remove build option size impacts * Add rules.mk cleaning script * Update all rules.mk files to remove build option firmware size impact messages * Remove references to feature filesize in documentation * Revert "Update all rules.mk files to remove build option firmware size impact messages" This reverts commit 7cfe70976bcc223bf47c960b2e6af8596df80a32. * Fix regex in cleanup script and exclude keymaps/ directories * Update quantum/template/avr/rules.mk Fixed missing tabs/spaces. Co-Authored-By: fauxpark --- util/rules_cleaner.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 util/rules_cleaner.sh (limited to 'util') diff --git a/util/rules_cleaner.sh b/util/rules_cleaner.sh new file mode 100755 index 0000000000..ac27c2b09b --- /dev/null +++ b/util/rules_cleaner.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# This script finds all rules.mk files in keyboards/ subdirectories, +# and deletes the build option filesize impacts from them. + +# Print an error message with the word "ERROR" in red. +echo_error() { + echo -e "[\033[0;91mERROR\033[m]: $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 + +# 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 +} +set_sed_i + +# Exclude keyamps/ directories +files=$(find keyboards -type f -name 'rules.mk' -not \( -path '*/keymaps*' -prune \)) + +# Edit rules.mk files +for file in $files; do + sed "${sed_i[@]}" -e "s/(+[0-9].*)$//g" "$file" +done + +echo "Cleaned up rules.mk files." -- cgit v1.2.3 From 917ab71c52111c5ca89382eba74e08e616264d59 Mon Sep 17 00:00:00 2001 From: Yadunand Prem Date: Tue, 29 Oct 2019 09:13:07 +1100 Subject: Clean macos install script (#7186) --- util/macos_install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'util') diff --git a/util/macos_install.sh b/util/macos_install.sh index d9ec50a7e2..c5c27d1670 100755 --- a/util/macos_install.sh +++ b/util/macos_install.sh @@ -2,20 +2,20 @@ util_dir=$(dirname "$0") -if ! brew --version 2>&1 > /dev/null; then +if ! brew --version >/dev/null 2>&1; then echo "Error! Homebrew not installed or broken!" echo -n "Would you like to install homebrew now? [y/n] " - while read ANSWER; do + while read -r ANSWER; do case $ANSWER in - y|Y) - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" - break + y | Y) + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" + break ;; - n|N) - exit 1 + n | N) + exit 1 ;; - *) - echo -n "Would you like to install homebrew now? [y/n] " + *) + echo -n "Would you like to install homebrew now? [y/n] " ;; esac done @@ -26,4 +26,4 @@ brew tap PX4/homebrew-px4 brew update brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude clang-format dfu-util python3 brew link --force avr-gcc@8 -pip3 install -r ${util_dir}/../requirements.txt +pip3 install -r "${util_dir}/../requirements.txt" -- cgit v1.2.3 From e6cc9cc78d40af1386f9a116d5fcc95c20233110 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Sat, 2 Nov 2019 13:06:03 +1100 Subject: Template updates (#7221) * Template updates * Flesh out info.json & keymap.c, and turn double spaces section into a list * Add enum to demonstrate layer naming * Semicolon --- util/new_keyboard.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'util') diff --git a/util/new_keyboard.sh b/util/new_keyboard.sh index fe7c1a8299..11c6497e23 100755 --- a/util/new_keyboard.sh +++ b/util/new_keyboard.sh @@ -86,6 +86,7 @@ replace_year_placeholders() { replace_keyboard_placeholders() { local replace_keyboard_filenames=( "${keyboard_dir}/config.h" + "${keyboard_dir}/info.json" "${keyboard_dir}/readme.md" "${keyboard_dir}/${keyboard_name}.c" "${keyboard_dir}/keymaps/default/readme.md" @@ -97,6 +98,7 @@ replace_keyboard_placeholders() { replace_name_placeholders() { local replace_name_filenames=( "${keyboard_dir}/config.h" + "${keyboard_dir}/info.json" "${keyboard_dir}/readme.md" "${keyboard_dir}/${keyboard_name}.c" "${keyboard_dir}/${keyboard_name}.h" -- cgit v1.2.3 From d382eeeb9d3b795c16533c5f64ab1455e774f925 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Tue, 5 Nov 2019 00:18:57 +0000 Subject: CI - Fix change detection (#7038) * Fix travis change detection * Fix travis change detection - add back python ignore --- util/travis_build.sh | 79 ++++++++++++++++++-------------------------- util/travis_compiled_push.sh | 1 + util/travis_docs.sh | 1 + util/travis_push.sh | 5 --- util/travis_test.sh | 27 +++------------ util/travis_utils.sh | 24 ++++++++++++++ 6 files changed, 63 insertions(+), 74 deletions(-) create mode 100755 util/travis_utils.sh (limited to 'util') diff --git a/util/travis_build.sh b/util/travis_build.sh index 225c8548f5..6d5dbed684 100755 --- a/util/travis_build.sh +++ b/util/travis_build.sh @@ -1,57 +1,42 @@ #!/bin/bash -# if docker is installed - patch calls to within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } +source util/travis_utils.sh + +NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)' -e '^(util/)' -e '^(lib/python/)' -e '^(bin/qmk)' -e '^(requirements.txt)' -e '(.travis.yml)') + +if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip build]"* ]]; then + echo "Skipping due to commit message" + exit 0 fi -# test force push -#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then + echo "Making default keymaps for all keyboards" + make all:default + exit $? +fi -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" -MAKE_ALL="make all:default" +exit_code=0 -if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then - exit_code=0 - git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} - if [ $? -eq 128 ]; then - # We don't know what changed so just build the default keymaps - echo "Making default keymaps for all keyboards (fallback)" - eval $MAKE_ALL +for KB in $(make list-keyboards); do + KEYBOARD_CHANGES=$(echo "$QMK_CHANGES" | grep -E '^(keyboards/'${KB}'/)') + if [[ -z "$KEYBOARD_CHANGES" ]]; then + # skip as no changes for this keyboard + continue + fi + + KEYMAP_ONLY=$(echo "$KEYBOARD_CHANGES" | grep -cv /keymaps/) + if [[ $KEYMAP_ONLY -gt 0 ]]; then + echo "Making all keymaps for $KB" + make ${KB}:all : $((exit_code = $exit_code + $?)) else - NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(lib/python/)' | grep -Ev '^(bin/qmk)' | grep -Ev '^(requirements.txt)' | grep -Ev '^(util/)' | wc -l) - BRANCH=$(git rev-parse --abbrev-ref HEAD) - # is this branch master or a "non docs, non keyboards" change - if [ $NEFM -gt 0 -o "$BRANCH" = "master" ]; then - echo "Making default keymaps for all keyboards" - eval $MAKE_ALL + CHANGED_KEYMAPS=$(echo "$KEYBOARD_CHANGES" | grep -oP '(?<=keyboards/'${KB}'/keymaps/)([a-zA-Z0-9_-]+)(?=\/)') + for KM in $CHANGED_KEYMAPS ; do + echo "Making $KM for $KB" + make ${KB}:${KM} : $((exit_code = $exit_code + $?)) - else - # keyboards project format - # /keyboards/board1/rev/keymaps/ - # /keyboards/board2/keymaps/ - # ensure we strip everything off after and including the keymaps folder to get board and/or revision - MKB=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards\/)([a-zA-Z0-9_\/]+)(?=\/)' | sed 's^/keymaps/.*^^' | sort -u) - for KB in $MKB ; do - KEYMAP_ONLY=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/'${KB}'/keymaps/)' | wc -l) - if [[ $KEYMAP_ONLY -gt 0 ]]; then - echo "Making all keymaps for $KB" - make ${KB}:all - : $((exit_code = $exit_code + $?)) - else - MKM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -oP '(?<=keyboards/'${KB}'/keymaps/)([a-zA-Z0-9_]+)(?=\/)' | sort -u) - for KM in $MKM ; do - echo "Making $KM for $KB" - make ${KB}:${KM} - : $((exit_code = $exit_code + $?)) - done - fi - done - fi + done fi - exit $exit_code -fi +done + +exit $exit_code diff --git a/util/travis_compiled_push.sh b/util/travis_compiled_push.sh index 8ca65f21a0..e0490cd702 100755 --- a/util/travis_compiled_push.sh +++ b/util/travis_compiled_push.sh @@ -1,5 +1,6 @@ #!/bin/bash +source util/travis_utils.sh source util/travis_push.sh set -o errexit -o nounset diff --git a/util/travis_docs.sh b/util/travis_docs.sh index 5cfd63466d..93c2d71867 100755 --- a/util/travis_docs.sh +++ b/util/travis_docs.sh @@ -1,5 +1,6 @@ #!/bin/bash +source util/travis_utils.sh source util/travis_push.sh if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip docs]"* ]] ; then diff --git a/util/travis_push.sh b/util/travis_push.sh index d100f9d48f..7f7d4c2c64 100755 --- a/util/travis_push.sh +++ b/util/travis_push.sh @@ -1,10 +1,5 @@ # Use this by sourcing it in your script. -TRAVIS_BRANCH="${TRAVIS_BRANCH:master}" -TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}" -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" - if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then git config --global user.name "QMK Bot" git config --global user.email "hello@qmk.fm" diff --git a/util/travis_test.sh b/util/travis_test.sh index 9b7402c282..95991907ef 100644 --- a/util/travis_test.sh +++ b/util/travis_test.sh @@ -1,26 +1,9 @@ #!/bin/bash -# if docker is installed - patch calls to within the qmk docker image -if command -v docker >/dev/null; then - function make() { - docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" - } - function qmk() { - docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" - } -fi - -TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" -TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" - -# test force push -#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" - -BRANCH=$(git rev-parse --abbrev-ref HEAD) -CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) +source util/travis_utils.sh -NUM_CORE_CHANGES=$(echo "$CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)') -NUM_PY_CHANGES=$(echo "$CHANGES" | grep -Ec -e '^(lib/python/)' -e '^(bin/qmk)') +NUM_CORE_CHANGES=$(echo "$QMK_CHANGES" | grep -Ecv -e '^(docs/)' -e '^(keyboards/)' -e '^(layouts/)' -e '^(util/)' -e '^(lib/python/)' -e '^(bin/qmk)' -e '^(requirements.txt)' -e '(.travis.yml)') +NUM_PY_CHANGES=$(echo "$QMK_CHANGES" | grep -Ec -e '^(lib/python/)' -e '^(bin/qmk)') if [[ "$TRAVIS_COMMIT_MESSAGE" == *"[skip test]"* ]]; then echo "Skipping due to commit message" @@ -29,14 +12,14 @@ fi exit_code=0 -if [ "$BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_CORE_CHANGES" != "0" ]; then echo "Running tests." make test:all : $((exit_code = $exit_code + $?)) fi -if [ "$BRANCH" == "master" ] || [ "$NUM_PY_CHANGES" != "0" ]; then +if [ "$LOCAL_BRANCH" == "master" ] || [ "$NUM_PY_CHANGES" != "0" ]; then echo "Running python tests." qmk pytest : $((exit_code = $exit_code + $?)) diff --git a/util/travis_utils.sh b/util/travis_utils.sh new file mode 100755 index 0000000000..031bcda1a8 --- /dev/null +++ b/util/travis_utils.sh @@ -0,0 +1,24 @@ +# Use this by sourcing it in your script. + +# Provide sane defaults for travis environment +TRAVIS_BRANCH="${TRAVIS_BRANCH:master}" +TRAVIS_PULL_REQUEST="${TRAVIS_PULL_REQUEST:false}" +TRAVIS_COMMIT_MESSAGE="${TRAVIS_COMMIT_MESSAGE:-none}" +TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" + +# test force push +#TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" + +# Extra variables +LOCAL_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}} +QMK_CHANGES=$(git diff --name-only HEAD ${TRAVIS_BRANCH}) + +# if docker is installed - patch calls to within the qmk docker image +if command -v docker >/dev/null; then + function make() { + docker run --rm -e MAKEFLAGS="$MAKEFLAGS" -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container make "$@" + } + function qmk() { + docker run --rm -w /qmk_firmware/ -v "$PWD":/qmk_firmware --user $(id -u):$(id -g) qmkfm/base_container bin/qmk "$@" + } +fi -- cgit v1.2.3 From 7e8f239c2e15091bca82f69c3982e585814c0f70 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Wed, 13 Nov 2019 07:53:05 +0000 Subject: [CI] Revert to previous logic for branch name and changes (#7343) --- util/travis_utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/travis_utils.sh b/util/travis_utils.sh index 031bcda1a8..e3d806dfba 100755 --- a/util/travis_utils.sh +++ b/util/travis_utils.sh @@ -10,8 +10,8 @@ TRAVIS_COMMIT_RANGE="${TRAVIS_COMMIT_RANGE:-HEAD~1..HEAD}" #TRAVIS_COMMIT_RANGE="c287f1bfc5c8...81f62atc4c1d" # Extra variables -LOCAL_BRANCH=${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}} -QMK_CHANGES=$(git diff --name-only HEAD ${TRAVIS_BRANCH}) +LOCAL_BRANCH=$(git rev-parse --abbrev-ref HEAD) +QMK_CHANGES=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}) # if docker is installed - patch calls to within the qmk docker image if command -v docker >/dev/null; then -- cgit v1.2.3 From fc867422a3d8f72eca2589b450f46da48e891fee Mon Sep 17 00:00:00 2001 From: fauxpark Date: Thu, 14 Nov 2019 05:13:27 +1100 Subject: Update ARM GCC on macOS to 8.3 (#7318) --- util/macos_install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/macos_install.sh b/util/macos_install.sh index c5c27d1670..f993003f09 100755 --- a/util/macos_install.sh +++ b/util/macos_install.sh @@ -22,8 +22,8 @@ if ! brew --version >/dev/null 2>&1; then fi brew tap osx-cross/avr -brew tap PX4/homebrew-px4 +brew tap osx-cross/arm brew update -brew install avr-gcc@8 gcc-arm-none-eabi dfu-programmer avrdude clang-format dfu-util python3 +brew install avr-gcc@8 arm-gcc-bin dfu-programmer avrdude clang-format dfu-util python3 brew link --force avr-gcc@8 pip3 install -r "${util_dir}/../requirements.txt" -- cgit v1.2.3