In a previous howto I showed how to build a .deb installer file for a Python program. This would work for the majority of systems with Debian/Ubuntu/Linux Mint etc. However there are many users on Arch Linux or Manjaro, which do not take this .deb installer file. Some Linux computers such as the popular (and currently out of stock 🙁 ) Pinebook laptop, and Pinephone come with Manjaro Linux, which takes Arch packages. Thankfully there is an easy way to add a package to the AUR for these Arch-based devices.
PKGBUILD file and Python
In most of the documentation for PKGBUILD and building an addition to the AUR (Arch User Repository) it is assuming a build of a compiled source of C++ or similar. What about a program that is simply Python – which should run on just about any system without recompiling? With a previously build .deb that is not built for a specific architecture (intel, arm/other), you can use that as a base to copy the files out to the package. In the following example you can see it unzips the content data which you can see within a .deb by opening it with the archive-manager. I based the build for repeaterSTART Arch on an older program that someone built up on AUR. Check this out as an example:
pkgdesc="Repeater-START (Showing The Amateur Repeaters Tool) is an app to view nearby ham radio repeaters."
depends=("python3" "python-gobject" "osm-gps-map" "geoclue")
tar xvfJ data.tar.xz
mkdir -p $pkgdir/usr/share
rm -Rf share/doc
cp -r usr $pkgdir
chmod -R 755 $pkgdir/usr/bin/repeaterSTART
chmod -R 755 $pkgdir/usr/share/applications/repeaterstart.desktop
chmod -R 755 $pkgdir/usr/share/repeater-START
This includes a sha256 you can get with the sha256sum command:
to get the sha256 output.
Also note that the package dependency names (“depends” line) of any dependencies (such as Geoclue, osm-gps-map) can be searched by name in the packages repo. “python3” would obviously be needed for any Python-based app, and “python-gobject” is the GObject introspection letting you use and access many Gtk features for windowed applications.
Once the adjustments for copy and chmod are set as above, you can build as described in the documentation with the “makepkg” command run in the same directory as the PKGBUILD file. Also note this needs to be done on the Archlinux/Manjaro device and not within a folder that is in a thumbdrive, FAT partition drive or elsewhere where symlinks won’t work!
Distributing in AUR
Distributing involves the steps outlined in their documentation:
- Create an account on https://aur.archlinux.org/, including the new public key aur.pub after running
ssh-keygen -f ~/.ssh/aur
The aur.pub is the public key to share.
- Clone and create your named package with the “git clone ssh://firstname.lastname@example.org/yournamehere.git”, where “yournamehere” is the LOWER-case name of your package and the same as “pkgname” in the file as entered above. Otherwise it will not work!
- Push git changes to the above, master branch, eg:
git push –set-upstream yournamehere master
After the branch is pushed and set up, it should be findable in the AUR and can be enabled within the options to be added on a Manjaro system by turning on the option and then searching by name in the package installer.