Skip to content

Commit d4390e0

Browse files
committed
Repoman in alpine docker container
1 parent 29470e6 commit d4390e0

3 files changed

Lines changed: 105 additions & 0 deletions

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM alpine:latest
2+
COPY entrypoint.sh /entrypoint.sh
3+
ENTRYPOINT ["/entrypoint.sh"]

action.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: 'Repoman Ebuild QA'
2+
description: 'Run repoman to find ebuild QA issues'
3+
inputs:
4+
repoman_args:
5+
description: >
6+
Additional arguments to pass after `repoman full`.
7+
Defaults to `-dx`. Note: This parameter will undergo shell
8+
wordsplitting and globbing.
9+
default: '-dx'
10+
path:
11+
description: >
12+
Path to cd to before starting repoman. The path is relative
13+
to the checked out repository. If unspecified or empty,
14+
repoman runs in the root of the repository.
15+
default: ''
16+
portage_version:
17+
description: >
18+
The portage version to download containing repoman e.g.
19+
`2.3.80`. `latest` is the default value, which uses the latest
20+
released version.
21+
default: 'latest'
22+
profile:
23+
description: >
24+
The gentoo profile to set before running repoman. The default
25+
value is `latest`, which will result in using the first
26+
profile in `profiles.desc` listed under `SYMLINK_LIB=no`
27+
e.g. `default/linux/amd64/17.1`.
28+
default: 'latest'
29+
gentoo_repo:
30+
description: >
31+
Location to install the gentoo ebuild repository. This could
32+
be useful if using an old portage version that expects a
33+
different location. Default value is `/var/db/repos/gentoo`.
34+
default: '/var/db/repos/gentoo'
35+
runs:
36+
using: 'docker'
37+
image: 'Dockerfile'
38+
branding:
39+
color: 'purple'
40+
icon: 'search'

entrypoint.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/sh -l
2+
3+
set -e
4+
5+
repoman_args="$INPUT_REPOMAN_ARGS"
6+
path="$INPUT_PATH"
7+
profile="$INPUT_PROFILE"
8+
portage_version="$INPUT_PORTAGE_VERSION"
9+
gentoo_repo="$INPUT_GENTOO_REPO"
10+
11+
apk add python3 py3-yaml py3-lxml git bash
12+
ln -s /usr/bin/python3 /usr/bin/python
13+
mkdir -p /etc/portage /var/cache/distfiles "$gentoo_repo"
14+
echo "portage:x:250:250:portage:/var/tmp/portage:/bin/false" >> /etc/passwd
15+
echo "portage::250:portage" >> /etc/group
16+
wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
17+
wget -O - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | tar xz -C "$gentoo_repo" --strip-components=1
18+
19+
if [ "$profile" = "latest" ]; then
20+
profile="$(sed "1,/SYMLINK_LIB=no/d" < "$gentoo_repo/profiles/profiles.desc" | grep stable | head -1 | awk '{print $2}')"
21+
fi
22+
echo "Using profile \"$profile\""
23+
24+
if [ ! -e "$gentoo_repo/profiles/$profile" ]; then
25+
echo "Profile \"$profile\" not found in $gentoo_repo/profiles/"
26+
exit 2
27+
fi
28+
ln -s "$gentoo_repo/profiles/$profile" /etc/portage/make.profile
29+
30+
if [ "$portage_version" = "latest" ]; then
31+
portage_version=$(grep DIST "$gentoo_repo/sys-apps/portage/Manifest" | tail -1 | cut -d ' ' -f 2)
32+
portage_version=${portage_version%.tar.bz2}
33+
portage_version=${portage_version#portage-} # e.g. "2.3.20"
34+
fi
35+
echo "Using portage version \"$portage_version\""
36+
37+
if [ -z "$portage_version" ]; then
38+
echo "Unable to determine portage version."
39+
exit 3
40+
fi
41+
42+
wget -O - "https://github.com/gentoo/portage/archive/portage-${portage_version}.tar.gz" | tar xz -C /
43+
ln -s "/portage-portage-${portage_version}/cnf/repos.conf" /etc/portage/repos.conf
44+
ln -s "/portage-portage-${portage_version}/repoman/bin/repoman" /usr/bin/repoman
45+
46+
if [ ! -d ".git" ]; then
47+
echo
48+
echo "Found no git repository."
49+
echo "Did you forget the actions/checkout step in your workflow job?"
50+
echo
51+
echo " steps:"
52+
echo " - uses: actions/checkout@v2"
53+
echo
54+
fi
55+
56+
if [ -n "$path" ]; then
57+
cd "$path"
58+
fi
59+
60+
echo "Running 'repoman full $repoman_args' from $(pwd)"
61+
# shellcheck disable=SC2086
62+
repoman full $repoman_args

0 commit comments

Comments
 (0)