From e09954cf5fa25fa500f2842175b5905394cd9f9d Mon Sep 17 00:00:00 2001 From: Kuvakin Sergey Date: Wed, 8 Mar 2017 02:33:15 +0300 Subject: [PATCH] refactoring --- .gitignore | 1 + .travis.yml | 17 ++++++++++ all-archs | 29 ----------------- archs/x86_64-aarch64/Dockerfile | 2 -- archs/x86_64-alpha/Dockerfile | 2 -- archs/x86_64-arm/Dockerfile | 2 -- archs/x86_64-armeb/Dockerfile | 2 -- archs/x86_64-cris/Dockerfile | 2 -- archs/x86_64-i386/Dockerfile | 2 -- archs/x86_64-m68k/Dockerfile | 2 -- archs/x86_64-microblaze/Dockerfile | 2 -- archs/x86_64-microblazeel/Dockerfile | 2 -- archs/x86_64-mips/Dockerfile | 2 -- archs/x86_64-mips64/Dockerfile | 2 -- archs/x86_64-mips64el/Dockerfile | 2 -- archs/x86_64-mipsel/Dockerfile | 2 -- archs/x86_64-mipsn32/Dockerfile | 2 -- archs/x86_64-mipsn32el/Dockerfile | 2 -- archs/x86_64-or32/Dockerfile | 2 -- archs/x86_64-ppc/Dockerfile | 2 -- archs/x86_64-ppc64/Dockerfile | 2 -- archs/x86_64-ppc64abi32/Dockerfile | 2 -- archs/x86_64-ppc64le/Dockerfile | 2 -- archs/x86_64-s390x/Dockerfile | 2 -- archs/x86_64-sh4/Dockerfile | 2 -- archs/x86_64-sh4eb/Dockerfile | 2 -- archs/x86_64-sparc/Dockerfile | 2 -- archs/x86_64-sparc32plus/Dockerfile | 2 -- archs/x86_64-sparc64/Dockerfile | 2 -- archs/x86_64-tilegx/Dockerfile | 2 -- archs/x86_64-unicore32/Dockerfile | 2 -- archs/x86_64-x86_64/Dockerfile | 2 -- build.sh | 6 ---- publish.sh | 48 ++++++++++++++++++++++++++++ update.sh | 39 ++++++++++++++-------- 35 files changed, 92 insertions(+), 106 deletions(-) create mode 100644 .travis.yml delete mode 100644 all-archs delete mode 100644 archs/x86_64-aarch64/Dockerfile delete mode 100644 archs/x86_64-alpha/Dockerfile delete mode 100644 archs/x86_64-arm/Dockerfile delete mode 100644 archs/x86_64-armeb/Dockerfile delete mode 100644 archs/x86_64-cris/Dockerfile delete mode 100644 archs/x86_64-i386/Dockerfile delete mode 100644 archs/x86_64-m68k/Dockerfile delete mode 100644 archs/x86_64-microblaze/Dockerfile delete mode 100644 archs/x86_64-microblazeel/Dockerfile delete mode 100644 archs/x86_64-mips/Dockerfile delete mode 100644 archs/x86_64-mips64/Dockerfile delete mode 100644 archs/x86_64-mips64el/Dockerfile delete mode 100644 archs/x86_64-mipsel/Dockerfile delete mode 100644 archs/x86_64-mipsn32/Dockerfile delete mode 100644 archs/x86_64-mipsn32el/Dockerfile delete mode 100644 archs/x86_64-or32/Dockerfile delete mode 100644 archs/x86_64-ppc/Dockerfile delete mode 100644 archs/x86_64-ppc64/Dockerfile delete mode 100644 archs/x86_64-ppc64abi32/Dockerfile delete mode 100644 archs/x86_64-ppc64le/Dockerfile delete mode 100644 archs/x86_64-s390x/Dockerfile delete mode 100644 archs/x86_64-sh4/Dockerfile delete mode 100644 archs/x86_64-sh4eb/Dockerfile delete mode 100644 archs/x86_64-sparc/Dockerfile delete mode 100644 archs/x86_64-sparc32plus/Dockerfile delete mode 100644 archs/x86_64-sparc64/Dockerfile delete mode 100644 archs/x86_64-tilegx/Dockerfile delete mode 100644 archs/x86_64-unicore32/Dockerfile delete mode 100644 archs/x86_64-x86_64/Dockerfile delete mode 100755 build.sh create mode 100755 publish.sh diff --git a/.gitignore b/.gitignore index c00df13..5f81895 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ *.deb +archs diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c85f13c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,17 @@ +sudo: required +services: docker +language: bash +env: + - VERSION=2.8.1 +branches: + only: + - master +before_script: + - sudo apt-get install jq + - wget -N http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user-static_2.8+dfsg-3_amd64.deb + - sudo dpkg -i qemu-user-static_2.8+dfsg-3_amd64.deb +script: + - sudo ./publish.sh -v "$VERSION" -t "$GITHUB_TOKEN" + - sudo ./update.sh -v "$VERSION" +after_success: + - if [[ $TRAVIS_PULL_REQUEST == 'false' ]]; then docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD" && docker push multiarch/qemu-user-static; fi \ No newline at end of file diff --git a/all-archs b/all-archs deleted file mode 100644 index 9060550..0000000 --- a/all-archs +++ /dev/null @@ -1,29 +0,0 @@ -aarch64 -alpha -arm -armeb -cris -i386 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -or32 -ppc -ppc64 -ppc64abi32 -ppc64le -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -tilegx -unicore32 -x86_64 diff --git a/archs/x86_64-aarch64/Dockerfile b/archs/x86_64-aarch64/Dockerfile deleted file mode 100644 index 261a2a3..0000000 --- a/archs/x86_64-aarch64/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-aarch64-static.tar.gz /usr/bin diff --git a/archs/x86_64-alpha/Dockerfile b/archs/x86_64-alpha/Dockerfile deleted file mode 100644 index d4286ec..0000000 --- a/archs/x86_64-alpha/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-alpha-static.tar.gz /usr/bin diff --git a/archs/x86_64-arm/Dockerfile b/archs/x86_64-arm/Dockerfile deleted file mode 100644 index b54acee..0000000 --- a/archs/x86_64-arm/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-arm-static.tar.gz /usr/bin diff --git a/archs/x86_64-armeb/Dockerfile b/archs/x86_64-armeb/Dockerfile deleted file mode 100644 index ef779d7..0000000 --- a/archs/x86_64-armeb/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-armeb-static.tar.gz /usr/bin diff --git a/archs/x86_64-cris/Dockerfile b/archs/x86_64-cris/Dockerfile deleted file mode 100644 index 99da535..0000000 --- a/archs/x86_64-cris/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-cris-static.tar.gz /usr/bin diff --git a/archs/x86_64-i386/Dockerfile b/archs/x86_64-i386/Dockerfile deleted file mode 100644 index f1d5db5..0000000 --- a/archs/x86_64-i386/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-i386-static.tar.gz /usr/bin diff --git a/archs/x86_64-m68k/Dockerfile b/archs/x86_64-m68k/Dockerfile deleted file mode 100644 index 150210c..0000000 --- a/archs/x86_64-m68k/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-m68k-static.tar.gz /usr/bin diff --git a/archs/x86_64-microblaze/Dockerfile b/archs/x86_64-microblaze/Dockerfile deleted file mode 100644 index 0a7fd26..0000000 --- a/archs/x86_64-microblaze/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-microblaze-static.tar.gz /usr/bin diff --git a/archs/x86_64-microblazeel/Dockerfile b/archs/x86_64-microblazeel/Dockerfile deleted file mode 100644 index 5a27105..0000000 --- a/archs/x86_64-microblazeel/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-microblazeel-static.tar.gz /usr/bin diff --git a/archs/x86_64-mips/Dockerfile b/archs/x86_64-mips/Dockerfile deleted file mode 100644 index 049e329..0000000 --- a/archs/x86_64-mips/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mips-static.tar.gz /usr/bin diff --git a/archs/x86_64-mips64/Dockerfile b/archs/x86_64-mips64/Dockerfile deleted file mode 100644 index 32439d0..0000000 --- a/archs/x86_64-mips64/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mips64-static.tar.gz /usr/bin diff --git a/archs/x86_64-mips64el/Dockerfile b/archs/x86_64-mips64el/Dockerfile deleted file mode 100644 index 3e462d4..0000000 --- a/archs/x86_64-mips64el/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mips64el-static.tar.gz /usr/bin diff --git a/archs/x86_64-mipsel/Dockerfile b/archs/x86_64-mipsel/Dockerfile deleted file mode 100644 index c68ac97..0000000 --- a/archs/x86_64-mipsel/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mipsel-static.tar.gz /usr/bin diff --git a/archs/x86_64-mipsn32/Dockerfile b/archs/x86_64-mipsn32/Dockerfile deleted file mode 100644 index f12a57a..0000000 --- a/archs/x86_64-mipsn32/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mipsn32-static.tar.gz /usr/bin diff --git a/archs/x86_64-mipsn32el/Dockerfile b/archs/x86_64-mipsn32el/Dockerfile deleted file mode 100644 index de0787f..0000000 --- a/archs/x86_64-mipsn32el/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-mipsn32el-static.tar.gz /usr/bin diff --git a/archs/x86_64-or32/Dockerfile b/archs/x86_64-or32/Dockerfile deleted file mode 100644 index 92ab816..0000000 --- a/archs/x86_64-or32/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-or32-static.tar.gz /usr/bin diff --git a/archs/x86_64-ppc/Dockerfile b/archs/x86_64-ppc/Dockerfile deleted file mode 100644 index b217778..0000000 --- a/archs/x86_64-ppc/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-ppc-static.tar.gz /usr/bin diff --git a/archs/x86_64-ppc64/Dockerfile b/archs/x86_64-ppc64/Dockerfile deleted file mode 100644 index b18cbd9..0000000 --- a/archs/x86_64-ppc64/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-ppc64-static.tar.gz /usr/bin diff --git a/archs/x86_64-ppc64abi32/Dockerfile b/archs/x86_64-ppc64abi32/Dockerfile deleted file mode 100644 index 3398f5b..0000000 --- a/archs/x86_64-ppc64abi32/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-ppc64abi32-static.tar.gz /usr/bin diff --git a/archs/x86_64-ppc64le/Dockerfile b/archs/x86_64-ppc64le/Dockerfile deleted file mode 100644 index 5a40716..0000000 --- a/archs/x86_64-ppc64le/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-ppc64le-static.tar.gz /usr/bin diff --git a/archs/x86_64-s390x/Dockerfile b/archs/x86_64-s390x/Dockerfile deleted file mode 100644 index 0c4009c..0000000 --- a/archs/x86_64-s390x/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-s390x-static.tar.gz /usr/bin diff --git a/archs/x86_64-sh4/Dockerfile b/archs/x86_64-sh4/Dockerfile deleted file mode 100644 index 3b87dbe..0000000 --- a/archs/x86_64-sh4/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-sh4-static.tar.gz /usr/bin diff --git a/archs/x86_64-sh4eb/Dockerfile b/archs/x86_64-sh4eb/Dockerfile deleted file mode 100644 index 6559a6e..0000000 --- a/archs/x86_64-sh4eb/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-sh4eb-static.tar.gz /usr/bin diff --git a/archs/x86_64-sparc/Dockerfile b/archs/x86_64-sparc/Dockerfile deleted file mode 100644 index 80a3527..0000000 --- a/archs/x86_64-sparc/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-sparc-static.tar.gz /usr/bin diff --git a/archs/x86_64-sparc32plus/Dockerfile b/archs/x86_64-sparc32plus/Dockerfile deleted file mode 100644 index 99f92de..0000000 --- a/archs/x86_64-sparc32plus/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-sparc32plus-static.tar.gz /usr/bin diff --git a/archs/x86_64-sparc64/Dockerfile b/archs/x86_64-sparc64/Dockerfile deleted file mode 100644 index 21bdf84..0000000 --- a/archs/x86_64-sparc64/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-sparc64-static.tar.gz /usr/bin diff --git a/archs/x86_64-tilegx/Dockerfile b/archs/x86_64-tilegx/Dockerfile deleted file mode 100644 index ce178b0..0000000 --- a/archs/x86_64-tilegx/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-tilegx-static.tar.gz /usr/bin diff --git a/archs/x86_64-unicore32/Dockerfile b/archs/x86_64-unicore32/Dockerfile deleted file mode 100644 index 82c91f1..0000000 --- a/archs/x86_64-unicore32/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-unicore32-static.tar.gz /usr/bin diff --git a/archs/x86_64-x86_64/Dockerfile b/archs/x86_64-x86_64/Dockerfile deleted file mode 100644 index 3ff04a1..0000000 --- a/archs/x86_64-x86_64/Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM scratch -ADD https://github.com/multiarch/qemu-user-static/releases/download/v2.8.0/x86_64_qemu-x86_64-static.tar.gz /usr/bin diff --git a/build.sh b/build.sh deleted file mode 100755 index 5b531a2..0000000 --- a/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -set -xe - -wget -N http://ftp.fr.debian.org/debian/pool/main/q/qemu/qemu-user-static_2.8+dfsg-1_amd64.deb -dpkg -i qemu-user-static_2.8+dfsg-1_amd64.deb diff --git a/publish.sh b/publish.sh new file mode 100755 index 0000000..63008b1 --- /dev/null +++ b/publish.sh @@ -0,0 +1,48 @@ +#!/bin/bash +set -e + +# A POSIX variable +OPTIND=1 # Reset in case getopts has been used previously in the shell. + +while getopts "v:t:" opt; do + case "$opt" in + v) VERSION=$OPTARG + ;; + t) GITHUB_TOKEN=$OPTARG + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + +mkdir releases +cp /usr/bin/qemu-*-static releases/ +cd releases/ +for file in *; do + tar -czf $file.tar.gz $file; + cp $file.tar.gz x86_64_$file.tar.gz +done + +release_id=$(curl -sL -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Cache-Control: no-cache" -d "{ + \"tag_name\": \"v${VERSION}\", + \"target_commitish\": \"master\", + \"name\": \"v${VERSION}\", + \"body\": \"# \`qemu-*-static\` @ ${VERSION}\", + \"draft\": false, + \"prerelease\": false +}" "https://api.github.com/repos/multiarch/qemu-user-static/releases" | jq -r ".id") + +for file in *; do + content_type=$(file --mime-type -b ${file}) + curl -sL \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: ${content_type}" \ + --upload-file ${file} \ + "https://uploads.github.com/repos/multiarch/qemu-user-static/releases/${release_id}/assets?name=${file}" +done diff --git a/update.sh b/update.sh index a234f7c..719a226 100755 --- a/update.sh +++ b/update.sh @@ -1,20 +1,33 @@ -#!/bin/sh +#!/bin/bash +set -e -from_archs="x86_64" -to_archs="$(cat all-archs)" +# A POSIX variable +OPTIND=1 # Reset in case getopts has been used previously in the shell. -for from_arch in $from_archs; do - for to_arch in $to_archs; do - mkdir -p archs/$from_arch-$to_arch - cat > archs/$from_arch-$to_arch/Dockerfile < archs/$from_arch-$to_arch/Dockerfile <