Skip to content

Commit

Permalink
feat: qemu 5.2.0-11
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei Kuvakin committed Jul 20, 2021
1 parent d9c81fc commit 3f5929a
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 118 deletions.
66 changes: 39 additions & 27 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,51 @@
name: actions
on: push
on:
push:
branches:
- master
paths:
- containers/**
- .github/workflows/actions.yml
- "*.sh"
pull_request:
branches:
- master
paths:
- containers/**
- .github/workflows/actions.yml
- "*.sh"
jobs:
qemu-user-static:
runs-on: ubuntu-latest
env:
VERSION: 5.2.0-11
ORIGIN_VERSION: 5.2+dfsg-11
steps:
- uses: actions/checkout@v2
- name: Set variables
run: |
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "ORIGIN_VERSION=${ORIGIN_VERSION}" >> $GITHUB_ENV
echo "DOCKER_REPO=${DOCKER_REPO}/$GITHUB_REPOSITORY" >> $GITHUB_ENV
env:
VERSION: 5.2.0-2
ORIGIN_VERSION: 5.2+dfsg-3
DOCKER_REPO: docker.io
- name: Build releases
echo "DOCKER_REPO=docker.io/$GITHUB_REPOSITORY" >> $GITHUB_ENV
- name: Build
run: |
wget --content-disposition http://ftp.de.debian.org/debian/pool/main/q/qemu/qemu-user-static_${ORIGIN_VERSION}_amd64.deb
dpkg-deb -R qemu-user-static_*.deb .
./generate_tarballs.sh
- name: Publish releases
if: github.ref == 'refs/heads/master'
run: |
sudo apt install jq
./publish.sh -v "$VERSION" -t ${{ secrets.GITHUB_TOKEN }} -r "$GITHUB_REPOSITORY"
- name: Build images
if: github.ref == 'refs/heads/master'
run: |
./update.sh -v "$VERSION" -t "$VERSION" -r "$GITHUB_REPOSITORY" -d "$DOCKER_REPO"
- name: Test images
run: |
docker images
./test.sh -d "$DOCKER_REPO"
- name: Publish images
wget --content-disposition http://ftp.de.debian.org/debian/pool/main/q/qemu/qemu-user-static_${{ env.ORIGIN_VERSION }}_amd64.deb
dpkg-deb -R qemu-user-static_*.deb releases
./run.sh -t "${{ env.VERSION }}" -r "${{ env.GITHUB_REPOSITORY }}" -d "${{ env.DOCKER_REPO }}"
- name: Test
run: ./test.sh -d "${{ env.DOCKER_REPO }}"
- name: Publish
if: github.ref == 'refs/heads/master'
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
docker push $DOCKER_REPO
docker push ${{ env.DOCKER_REPO }}
- name: Create Release
if: github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
name: "v${{ env.VERSION }}"
tag: "v${{ env.VERSION }}"
body: |
# `qemu-*-static` @ ${{ env.VERSION }}
artifacts: "releases/usr/bin/*.tar.gz"
draft: false
prerelease: false
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion containers/latest/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM busybox
ENV QEMU_BIN_DIR=/usr/bin
ADD ./register.sh /register
ADD https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
ADD https://raw.githubusercontent.com/qemu/qemu/7c81570d932268a9626457a662f1c5046ebc455e/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
RUN chmod +x /qemu-binfmt-conf.sh
COPY qemu-*-static /usr/bin/
ENTRYPOINT ["/register"]
11 changes: 0 additions & 11 deletions generate_tarballs.sh

This file was deleted.

52 changes: 0 additions & 52 deletions publish.sh

This file was deleted.

38 changes: 13 additions & 25 deletions update.sh → run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,31 @@ set -xe
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.

while getopts "r:v:t:d:" opt; do
while getopts "r:t:d:" opt; do
case "$opt" in
r) REPO=$OPTARG
;;
v) VERSION=$OPTARG
;;
t) TAG_VER=$OPTARG
;;
d) DOCKER_REPO=$OPTARG
;;
esac
done

if [ -z "$VERSION" ]; then
echo "usage: $0 -v VERSION" 2>&1
echo "check https://github.com/${REPO}/releases for available versions" 2>&1
exit 1
fi

shift $((OPTIND-1))

[ "$1" = "--" ] && shift

base_path=$(pwd)
cd releases/usr/bin/
for file in *; do
tar -czf $file.tar.gz $file;
mv $file.tar.gz x86_64_$file.tar.gz
done
cd ${base_path}

from_arch="x86_64"
to_archs="aarch64 aarch64_be alpha arm armeb cris hppa i386 m68k microblaze microblazeel mips mips64 mips64el mipsel mipsn32 mipsn32el nios2 or1k ppc ppc64 ppc64le riscv32 riscv64 s390x sh4 sh4eb sparc sparc32plus sparc64 x86_64 xtensa xtensaeb"
# For casual test
# to_archs="aarch64"

# Build container images creating the directory.
# containers/
Expand All @@ -49,18 +47,8 @@ for to_arch in $to_archs; do
if [ "$from_arch" != "$to_arch" ]; then
work_dir="${out_dir}/${from_arch}_qemu-${to_arch}"
mkdir -p "${work_dir}"
tar_gz_url="https://github.com/${REPO}/releases/download/v${VERSION}/${from_arch}_qemu-${to_arch}-static.tar.gz"
http_status="$(curl -s -o /dev/null -w "%{http_code}" "${tar_gz_url}")"
if [ "${http_status}" = 404 ]; then
echo "URL not found: ${tar_gz_url}" 1>&2
exit 1
fi
curl -sSL -o "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" "${tar_gz_url}"
tar xzvf "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" -C "${work_dir}"
rm -f "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz"

cp -p "releases/usr/bin/qemu-${to_arch}-static" ${work_dir}
cp -p "${work_dir}/qemu-${to_arch}-static" "${out_dir}/latest/"

cat > ${work_dir}/Dockerfile -<<EOF
FROM scratch
COPY qemu-${to_arch}-static /usr/bin/
Expand All @@ -69,12 +57,12 @@ EOF
for target in "${DOCKER_REPO}:$from_arch-$to_arch" \
"${DOCKER_REPO}:$to_arch-${TAG_VER}" \
"${DOCKER_REPO}:$to_arch" ; do
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} "${target}"
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${target}
done
rm -rf "${work_dir}"
fi
done

docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
docker build -t ${DOCKER_REPO}:${TAG_VER} ${out_dir}/latest
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"
docker build -t ${DOCKER_REPO}:register ${out_dir}/register
4 changes: 2 additions & 2 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

# It should register binfmt_misc entry with 'flags: F'
# by given "-p yes" option.
sudo docker run --rm --privileged ${DOCKER_REPO} --reset -p yes
docker run --rm --privileged ${DOCKER_REPO} --reset -p yes
cat /proc/sys/fs/binfmt_misc/qemu-aarch64
grep -q '^flags: F$' /proc/sys/fs/binfmt_misc/qemu-aarch64

Expand Down Expand Up @@ -53,7 +53,7 @@ docker run --rm -t arm64v8/fedora uname -m

# It should register binfmt_misc entry with 'flags: '
# by given no "-p yes" option.
sudo docker run --rm --privileged ${DOCKER_REPO}:register --reset
docker run --rm --privileged ${DOCKER_REPO}:register --reset
cat /proc/sys/fs/binfmt_misc/qemu-aarch64
grep -q '^flags: $' /proc/sys/fs/binfmt_misc/qemu-aarch64

Expand Down

0 comments on commit 3f5929a

Please sign in to comment.