Skip to content

Commit 115b0f1

Browse files
committed
Arch Linux: make update-aur.sh easier to use: Dockerify
update-aur.sh sucks to use for me because it requires an Arch Linux virtual machine. Simplify usage by creating an Arch Linux-based Docker image and running part of the update-aur.sh script inside a container.
1 parent 3e35fca commit 115b0f1

File tree

4 files changed

+90
-10
lines changed

4 files changed

+90
-10
lines changed

dist/arch/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Copyright (C) 2020 Matthew "strager" Glazar
2+
# See end of file for extended copyright information.
3+
4+
FROM archlinux:base
5+
6+
RUN pacman --sync --refresh --noconfirm binutils pacman-contrib
7+
8+
RUN useradd --create-home --shell /bin/sh qljs-builder
9+
USER qljs-builder
10+
11+
# quick-lint-js finds bugs in JavaScript programs.
12+
# Copyright (C) 2020 Matthew "strager" Glazar
13+
#
14+
# This file is part of quick-lint-js.
15+
#
16+
# quick-lint-js is free software: you can redistribute it and/or modify
17+
# it under the terms of the GNU General Public License as published by
18+
# the Free Software Foundation, either version 3 of the License, or
19+
# (at your option) any later version.
20+
#
21+
# quick-lint-js is distributed in the hope that it will be useful,
22+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
23+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24+
# GNU General Public License for more details.
25+
#
26+
# You should have received a copy of the GNU General Public License
27+
# along with quick-lint-js. If not, see <https://www.gnu.org/licenses/>.

dist/arch/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,18 @@ following commands:
2626
To install the built package, run the following command:
2727

2828
$ sudo pacman -U ./quick-lint-js-*.pkg.tar.zst
29+
30+
## Docker image
31+
32+
For convenience, we have a Docker image based on Arch Linux.
33+
34+
### Updating the Docker image
35+
36+
Pick a version number for the new Docker image (e.g. `v3`), then run the
37+
following commands:
38+
39+
$ docker build --tag ghcr.io/quick-lint/quick-lint-js-dist-arch:VERSION_NUMBER_HERE dist/arch/
40+
$ docker login ghcr.io -u YOUR_GITHUB_USER_NAME_HERE
41+
$ docker push ghcr.io/quick-lint/quick-lint-js-dist-arch:VERSION_NUMBER_HERE
42+
43+
Then, change the container tag in `update-aur.sh` refer to your new version.

dist/arch/update-aur.sh

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,58 @@
66
set -e
77
set -u
88

9-
if [ "${#}" -ne 1 ]; then
10-
printf 'usage: %s /path/to/quick-lint-js-aur\n' "${0}" >&2
9+
here="$(cd "$(dirname "${0}")" && pwd)"
10+
11+
print_usage() {
12+
printf 'usage: %s [--docker] /path/to/quick-lint-js-aur\n' "${0}"
13+
}
14+
15+
docker=0
16+
qljsaur=
17+
18+
docker_image=ghcr.io/quick-lint/quick-lint-js-dist-arch:v1
19+
20+
while [ "${#}" -ne 0 ]; do
21+
case "${1}" in
22+
--docker) docker=1 ;;
23+
-*)
24+
printf 'error: invalid option: %s\n' "${1}"
25+
print_usage >&2
26+
exit 1
27+
;;
28+
*) qljsaur="$(cd "${1}" && pwd)" ;;
29+
esac
30+
shift
31+
done
32+
33+
if [ -z "${qljsaur}" ]; then
34+
print_usage >&2
1135
exit 1
1236
fi
1337

14-
qljsaur="${1}"
15-
here="$(cd "$(dirname "${0}")" && pwd)"
16-
1738
cd "${qljsaur}"
18-
1939
cp "${here}/PKGBUILD-release" PKGBUILD
20-
updpkgsums PKGBUILD
21-
makepkg --printsrcinfo PKGBUILD >.SRCINFO
40+
41+
script="
42+
updpkgsums PKGBUILD
43+
makepkg --printsrcinfo PKGBUILD >.SRCINFO
44+
"
45+
if [ "${docker}" -eq 1 ]; then
46+
docker run -t --mount type=bind,source="${qljsaur}",destination=/qljs-aur "${docker_image}" sh -c "
47+
set -e
48+
set -u
49+
cd /qljs-aur
50+
${script}
51+
"
52+
else
53+
if ! command -v updpkgsums >/dev/null; then
54+
printf "warning: updpkgsums doesn't seem to be installed. Consider using --docker\n" >&2
55+
fi
56+
if ! command -v makepkg >/dev/null; then
57+
printf "warning: makepkg doesn't seem to be installed. Consider using --docker\n" >&2
58+
fi
59+
eval "${script}"
60+
fi
2261

2362
git add PKGBUILD .SRCINFO
2463
printf '\nChanges staged. Please commit and push.\n' >&2

docs/RELEASE.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ Follow the following steps to release a new version of quick-lint-js:
5555
12. Update Arch Linux user repositories (AUR):
5656
1. Clone ssh://[email protected]/quick-lint-js with Git.
5757
2. Update README to point to the tag's commit.
58-
3. On an Arch Linux machine, run `dist/arch/update-aur.sh
59-
/path/to/quick-lint-js-aur-clone`.
58+
3. Run `dist/arch/update-aur.sh --docker /path/to/quick-lint-js-aur-clone`.
6059
4. Commit all files with message "Update quick-lint-js to version
6160
VERSION_NUMBER".
6261
5. On an Arch Linux machine, cd into the quick-lint-js AUR clone and run

0 commit comments

Comments
 (0)