Packaging Wakatime CLI for ArchLinux

I’ve decided to give Wakatime a second try. It’s a tool that tracks the time you spend programming on different projects by integrating into your IDE. This works well for typical development work where you open your IDE in the morning and type code in it, do commits with it, and everything else related to the project and Wakatime will track that.

I don’t work like that though, so I had two issues with it last time, both resulting in a lower reported time spent working:

  • I spent most of the day working on different remote servers and it would be a hassle to set it up in the text editor on each of them and it would undoubtedly cause slowdown on the older servers
  • I use the command line tools as my IDE, so the time recorded opening the text editor to make some changes is not representative of the time spent working

This time it’s different because nowadays I virtualise most of the services I work with, using Docker on my local machine, and I’m hoping that using the Wakatime Z Shell integration will give a better record of time spent working on a project.

Installing the Wakatime zsh plugin is as easy downloading the script and sourcing it in your .zshrc file. The only issue is it depends on the Wakatime CLI, which is usually bundled with Wakatime integrations, just not this one. The README file instructs you to get the CLI with sudo pip install wakatime but that leads to a system that’s difficult to maintain: Ideally you’d like to be able to install it from your distribution’s package manager but there’s no official ArchLinux Wakatime package and nobody has written a package script for it in the AUR yet. Luckily it turns out to be pretty easy to do.

The CLI is Python based and available for download on pypi (what pip does when you pip install). There are clear instructions on the ArchLinux wiki on how to make a Python package with the distutils tool that comes with Python, and a prototype Python package script you can use as a starting point.

All I had to do was fill out the fields in the example package: The download URL, version number and md5 hash are found in the pipy page. The licence, website, description and everything else is on the GitHub page. The result looks like this:

# Maintainer: Siôn le Roux <sinisterstuf@gmail.com>
pkgname=wakatime
pkgver=10.1.0
pkgrel=1
pkgdesc="Command line interface used by all WakaTime text editor plugins"
arch=('any')
url="https://github.com/wakatime/wakatime"
license=('BSD-3-Clause')
groups=()
depends=('python')
makedepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=(!emptydirs)
install=
source=('https://pypi.python.org/packages/7c/28/7d98467580850eb41d75a6b988fabf68caa0e930882f6f3188fe68a01c8b/wakatime-10.1.0.tar.gz')
md5sums=('e26017168caaf12eafceb129690d97f7')
 
package() {
  cd "$srcdir/$pkgname-$pkgver"
  python setup.py install --root="$pkgdir/" --optimize=1
}
 
# vim:set ts=2 sw=2 et:

After installing the package built from this script, everything works as expected, so I’ve published it to AUR as wakatime. If I’ve made any mistakes packaging this, please report them as issues on the package script’s GitHub repository or leave a comment on its AUR page.

Packaged Tomboy add-ins for Arch Linux

The wiki-like note taking application, Tomboy, maintains a list of user-written add-ins on its website, almost none of which were available in the Arch Linux repositories. Recently I learnt how packages are created for Arch Linux and read up on the standards, so I ‘adopted’ an ownerless add-in package from the Arch Linux User Repository and packaged 6 more.

Finally, I created a meta-package called tomboy-extras which contains nothing but depends on all the working Tomboy add-ins (tested on my laptop) in the AUR, to easily install all add-ins at once. I created a gist on GitHub for each package’s build script and made a repository containing the meta-package’s PKGBUILD file and each gist as a git sub-module named after the package name. The README file in tomboy-extras’ git repository contains links to the gists for the add-ins’ PKGBUILDs so that they can be found easily.

So, if you would like to contribute to one of them, feel free to fork the relevant gist, or leave a comment there, and if you would like to contribute to tomboy-extras itself or have an add-in included, just fork tomboy-extras and send a pull request; I’ll probably be adding more add-ins to it myself already. Also, if you do use any of these packages, please give them a vote on AUR so that we can see how many people use them. If they’re popular, they may be included in the official repositories, who knows!