Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ argh = "^0.1.12"
alpm = "^4.0.1"
command-extra = "^1.0.0"
git2 = "^0.20.0"
hex_fmt = "^0.3.0"
hex-literal = "^1.0.0"
indexmap = "^2.2.5"
itertools = "^0.14.0"
num-bigint = "^0.4.6"
Expand All @@ -46,7 +44,6 @@ pipe-trait = "^0.4.0"
rayon = "^1.10.0"
reflink = "^0.1.3"
serde_yaml = "^0.9.34"
sha-1 = "^0.10.1"
smart-default = "^0.7.1"

[dependencies.serde]
Expand Down
15 changes: 5 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Build a custom pacman repository from a collection of PKGBUILD directories.

* pacman
* makepkg
* sudo
* libalpm.so.13
* libgit2.so

Expand Down Expand Up @@ -122,16 +123,10 @@ _Note:_ Replace `$repo_dir` with path of your repository directory. This directo
_Note:_ Replace `$repo_name` with name of your repository file. This file will be fetched by `pacman` to check for
updates.

### Replace `/usr/bin/makepkg` with one that allows running as root
### Build a pacman repository

The normal `makepkg` script does not allow running as root. While it may make sense in a user's machine,
it inconveniences a Docker container.

```sh
build-pacman-repo patch-makepkg --replace
```

### Build a pacman repositories
The normal `makepkg` script does not allow running as root. To handle this, the build command automatically creates
a `builder` user and runs all makepkg commands as that user (using `sudo -u builder makepkg`).

```sh
build-pacman-repo build
Expand Down Expand Up @@ -171,5 +166,5 @@ from either `.SRCINFO` or `PKGBUILD`, sort them by their dependency relationship
### Why does this need to be run inside a container?

In order for this program to function properly, it must make several changes to the host system, such as:
* Replace `/usr/bin/makepkg` with one that allows running as root, so that it may be used in a CI environment.
* Create a `builder` user to run makepkg commands, as makepkg refuses to run as root.
* Install every built package just in case it may be depended upon by another package.
10 changes: 9 additions & 1 deletion ci/github-actions/arch-run/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ RUN pacman -Syu --noconfirm && \
gcc \
llvm \
pkgconf \
rustup
rustup \
sudo

# Create builder user with UID 1001 to match GitHub Actions runner
# This ensures the builder user can access mounted volumes from GitHub Actions
RUN useradd -m -u 1001 -s /bin/bash builder && \
echo "builder ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/builder && \
chmod 0440 /etc/sudoers.d/builder

COPY run.bash /run.bash


ENTRYPOINT ["/run.bash"]
3 changes: 0 additions & 3 deletions ci/github-actions/arch-run/run.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#! /bin/bash
set -o errexit -o pipefail -o nounset

# Patch makepkg
cargo run --bin=build-pacman-repo -- patch-makepkg --replace

eval "$INPUT_COMMAND"
Loading
Loading