Skip to content

Commit 3f5929a

Browse files
author
Sergei Kuvakin
committed
feat: qemu 5.2.0-11
1 parent d9c81fc commit 3f5929a

File tree

6 files changed

+55
-118
lines changed

6 files changed

+55
-118
lines changed

.github/workflows/actions.yml

+39-27
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,51 @@
11
name: actions
2-
on: push
2+
on:
3+
push:
4+
branches:
5+
- master
6+
paths:
7+
- containers/**
8+
- .github/workflows/actions.yml
9+
- "*.sh"
10+
pull_request:
11+
branches:
12+
- master
13+
paths:
14+
- containers/**
15+
- .github/workflows/actions.yml
16+
- "*.sh"
317
jobs:
418
qemu-user-static:
519
runs-on: ubuntu-latest
20+
env:
21+
VERSION: 5.2.0-11
22+
ORIGIN_VERSION: 5.2+dfsg-11
623
steps:
724
- uses: actions/checkout@v2
825
- name: Set variables
926
run: |
10-
echo "VERSION=${VERSION}" >> $GITHUB_ENV
11-
echo "ORIGIN_VERSION=${ORIGIN_VERSION}" >> $GITHUB_ENV
12-
echo "DOCKER_REPO=${DOCKER_REPO}/$GITHUB_REPOSITORY" >> $GITHUB_ENV
13-
env:
14-
VERSION: 5.2.0-2
15-
ORIGIN_VERSION: 5.2+dfsg-3
16-
DOCKER_REPO: docker.io
17-
- name: Build releases
27+
echo "DOCKER_REPO=docker.io/$GITHUB_REPOSITORY" >> $GITHUB_ENV
28+
- name: Build
1829
run: |
19-
wget --content-disposition http://ftp.de.debian.org/debian/pool/main/q/qemu/qemu-user-static_${ORIGIN_VERSION}_amd64.deb
20-
dpkg-deb -R qemu-user-static_*.deb .
21-
./generate_tarballs.sh
22-
- name: Publish releases
23-
if: github.ref == 'refs/heads/master'
24-
run: |
25-
sudo apt install jq
26-
./publish.sh -v "$VERSION" -t ${{ secrets.GITHUB_TOKEN }} -r "$GITHUB_REPOSITORY"
27-
- name: Build images
28-
if: github.ref == 'refs/heads/master'
29-
run: |
30-
./update.sh -v "$VERSION" -t "$VERSION" -r "$GITHUB_REPOSITORY" -d "$DOCKER_REPO"
31-
- name: Test images
32-
run: |
33-
docker images
34-
./test.sh -d "$DOCKER_REPO"
35-
- name: Publish images
30+
wget --content-disposition http://ftp.de.debian.org/debian/pool/main/q/qemu/qemu-user-static_${{ env.ORIGIN_VERSION }}_amd64.deb
31+
dpkg-deb -R qemu-user-static_*.deb releases
32+
./run.sh -t "${{ env.VERSION }}" -r "${{ env.GITHUB_REPOSITORY }}" -d "${{ env.DOCKER_REPO }}"
33+
- name: Test
34+
run: ./test.sh -d "${{ env.DOCKER_REPO }}"
35+
- name: Publish
3636
if: github.ref == 'refs/heads/master'
3737
run: |
3838
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_TOKEN }}
39-
docker push $DOCKER_REPO
39+
docker push ${{ env.DOCKER_REPO }}
40+
- name: Create Release
41+
if: github.ref == 'refs/heads/master'
42+
uses: ncipollo/release-action@v1
43+
with:
44+
name: "v${{ env.VERSION }}"
45+
tag: "v${{ env.VERSION }}"
46+
body: |
47+
# `qemu-*-static` @ ${{ env.VERSION }}
48+
artifacts: "releases/usr/bin/*.tar.gz"
49+
draft: false
50+
prerelease: false
51+
token: ${{ secrets.GITHUB_TOKEN }}

containers/latest/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM busybox
22
ENV QEMU_BIN_DIR=/usr/bin
33
ADD ./register.sh /register
4-
ADD https://raw.githubusercontent.com/qemu/qemu/master/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
4+
ADD https://raw.githubusercontent.com/qemu/qemu/7c81570d932268a9626457a662f1c5046ebc455e/scripts/qemu-binfmt-conf.sh /qemu-binfmt-conf.sh
55
RUN chmod +x /qemu-binfmt-conf.sh
66
COPY qemu-*-static /usr/bin/
77
ENTRYPOINT ["/register"]

generate_tarballs.sh

-11
This file was deleted.

publish.sh

-52
This file was deleted.

update.sh run.sh

+13-25
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,31 @@ set -xe
44
# A POSIX variable
55
OPTIND=1 # Reset in case getopts has been used previously in the shell.
66

7-
while getopts "r:v:t:d:" opt; do
7+
while getopts "r:t:d:" opt; do
88
case "$opt" in
99
r) REPO=$OPTARG
1010
;;
11-
v) VERSION=$OPTARG
12-
;;
1311
t) TAG_VER=$OPTARG
1412
;;
1513
d) DOCKER_REPO=$OPTARG
1614
;;
1715
esac
1816
done
1917

20-
if [ -z "$VERSION" ]; then
21-
echo "usage: $0 -v VERSION" 2>&1
22-
echo "check https://github.com/${REPO}/releases for available versions" 2>&1
23-
exit 1
24-
fi
25-
2618
shift $((OPTIND-1))
2719

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

22+
base_path=$(pwd)
23+
cd releases/usr/bin/
24+
for file in *; do
25+
tar -czf $file.tar.gz $file;
26+
mv $file.tar.gz x86_64_$file.tar.gz
27+
done
28+
cd ${base_path}
29+
3030
from_arch="x86_64"
3131
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"
32-
# For casual test
33-
# to_archs="aarch64"
3432

3533
# Build container images creating the directory.
3634
# containers/
@@ -49,18 +47,8 @@ for to_arch in $to_archs; do
4947
if [ "$from_arch" != "$to_arch" ]; then
5048
work_dir="${out_dir}/${from_arch}_qemu-${to_arch}"
5149
mkdir -p "${work_dir}"
52-
tar_gz_url="https://github.com/${REPO}/releases/download/v${VERSION}/${from_arch}_qemu-${to_arch}-static.tar.gz"
53-
http_status="$(curl -s -o /dev/null -w "%{http_code}" "${tar_gz_url}")"
54-
if [ "${http_status}" = 404 ]; then
55-
echo "URL not found: ${tar_gz_url}" 1>&2
56-
exit 1
57-
fi
58-
curl -sSL -o "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" "${tar_gz_url}"
59-
tar xzvf "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz" -C "${work_dir}"
60-
rm -f "${work_dir}/${from_arch}_qemu-${to_arch}-static.tar.gz"
61-
50+
cp -p "releases/usr/bin/qemu-${to_arch}-static" ${work_dir}
6251
cp -p "${work_dir}/qemu-${to_arch}-static" "${out_dir}/latest/"
63-
6452
cat > ${work_dir}/Dockerfile -<<EOF
6553
FROM scratch
6654
COPY qemu-${to_arch}-static /usr/bin/
@@ -69,12 +57,12 @@ EOF
6957
for target in "${DOCKER_REPO}:$from_arch-$to_arch" \
7058
"${DOCKER_REPO}:$to_arch-${TAG_VER}" \
7159
"${DOCKER_REPO}:$to_arch" ; do
72-
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} "${target}"
60+
docker tag ${DOCKER_REPO}:$from_arch-$to_arch-${TAG_VER} ${target}
7361
done
7462
rm -rf "${work_dir}"
7563
fi
7664
done
7765

78-
docker build -t ${DOCKER_REPO}:${TAG_VER} "${out_dir}/latest"
66+
docker build -t ${DOCKER_REPO}:${TAG_VER} ${out_dir}/latest
7967
docker tag ${DOCKER_REPO}:${TAG_VER} ${DOCKER_REPO}:latest
80-
docker build -t ${DOCKER_REPO}:register "${out_dir}/register"
68+
docker build -t ${DOCKER_REPO}:register ${out_dir}/register

test.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fi
2323

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

@@ -53,7 +53,7 @@ docker run --rm -t arm64v8/fedora uname -m
5353

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

0 commit comments

Comments
 (0)