Pacman ported to Debian for integration on GitHub Actions + an example of it in use

I've not been posting much recently because I've been working on two projects.

I am now finally at a good enough state on both projects to show them off.

The first project I created is called pacman-utils (GitHub - ThePoorPilot/pacman-utils: Debian package that installs Arch Linux Pacman tools(repo-add, makepkg, etc.))
I created a shell script that builds a version of the Pacman package manager for Debian. I even tested out installing a few packages with pacman.

Here is a cursed image from testing:

You may ask, why would you port pacman to Debian? Is it just a completely idiotic exercise?

There is actually a reason. The main goal is to use all the other tools included in pacman such as repo-add and makepkg in free integration environments such as GitHub Actions.

For example, this allows small-scale projects to have their packages built "nightly" while using the standard GitHub Actions Ubuntu 20.04 Runner!

There are ways to use Arch Linux docker images within Ubuntu, but from what I've read it can be inconsistent to keep running properly.

After creating pacman-utils, I made a project to show what could be done with it: the manjaro-removed-pkgs repository (GitHub - ThePoorPilot/manjaro-removed-pkgs: Repository that hosts all the packages on the Arch repo that are unavailable/removed on Manjaro.)

manjaro-removed-pkgs is a repository that contains all the packages the Manjaro team removes from the Arch Linux Repositories. The main reason I created it is to get linux-zen running on my Manjaro laptop. I've currently got it syncing hourly using GitHub Actions.

GitHub offers a pretty generous "unlimited" actions/minutes per month for public repositories.
With pacman's tools set up to work on Debian, you can effectively get a 24/7 Arch Linux build server for free.

GitHub Actions could even be used as a back up build server of sorts for simple packages on the Chaotic-AUR!

Let me know what you think! My hope is that this project can help people successfully use GitHub Actions for their Arch Linux Projects!

7 Likes

This is interesting. Couple of points:

These are shell scripts; I can run those on an Ubuntu system without pacman having installed.

Would pacman-static not work? AUR (en) - pacman-static

There are Arch Docker images (e.g. archlinux and archlinux:base-devel) - I assume GitHub doesn't provide those as an option?

3 Likes

I initially considered just downloading the Pacman Package from the Arch Linux repo, extracting, and then copying makepkg an repo-add to /usr/bin, but I ran into a few problems.

Although makepkg and repo-add are shell scripts, they make calls to a few .conf files and system libraries provided by pacman. Not to mention a few steps in the script use pacman itself

I considered copying those necessary files as well, but it started to get really unelegant. I also had issues with pacman associated with glibc being older on Ubuntu. At that point, I figured it be worth it to build a package that can easily be installed/removed.

It looks like pacman-static could help address the glibc issue. However, it has a lot of extra steps involved and still requires building anyways. I can just add glibc-source to the Debian package’s package requirements. In addition, it looks like pacman-static would run into a lot of issues with attempting to overwrite pre-existing files on Debian (which apt will refuse).

Finally, you are correct, GitHub does not offer an Arch Linux docker image. However, it is possible to run in docker on their Ubuntu runner. I’ve just heard of it running into issues between shared libraries and the kernel since Docker is a weird sort of limbo land between Virtualization and a container.

1 Like

https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/

:wink:

3 Likes

I’ll take a look at the files for pacman-static when I can. It is nice to just use a pre-compiled package and the convert to deb.

My initial script used the pacman package from the arch repos, but of course ran into problems.

Ubuntu has a lot of packages installed by default (see the manifest at releases.ubuntu.com).

My guess is that it will run into issues overwriting files, but it is perhaps possible to work around.

I think with the script I currently have, I only need to remove a bash completions file to get everything installing properly.

2 Likes

@jonathon
Upon further examination of pacman-static it appears to just be a compiled version of pacman with libraries installed in it. The only commands you can run with it are with "pacman." It does not include repo-add, makepkg, or any other tools.

It could alternatively be used to supply "pacman" in the pacman-utils package, but there isn't a strong benefit in my mind.

To get pacman and all its tools working on Ubuntu all I had to do was compile it from source on Ubuntu (which requires a lot of packages, but isn't too bad). After that, the only necessary dependencies for the actual package are:

"libarchive-tools, libarchive13, colorize, curl, python3, glibc-source, bash, libgpgme11, fakechroot, zstd, tar"

Most of those packages come on Ubuntu already, but I added them all in case an integration environment was stripped down in some way.

In my experience, pacman-utils with all dependencies only takes 5-10 seconds to install on GitHub actions

Let me know if I'm missing something. Otherwise, the "pacman-static" route doesn't seem practical.

3 Likes