I recently switched pkgin‘s repository from SourceForge‘s CVS to GitHub. Long story short, I heard here and there that SF was considering to drop CVS support and I found GitHub service to be more responsive and elegant. Also, I was looking for an excuse to learn git :)
Anyway, GitHub interface may be sexy, they used to have some kind of “upload” section which has been dropped. That may sound like a simple story, but the fact is when it comes to packaging a GitHub-hosted application, things are not that simple when the author has not explicitly tagged a specific release. Another use case, in which I actually am, is when you have an ongoing development, like pkgin in pkgsrc WIP and do not want to tag every test-release.
The way I found to handle that case with pkgsrc is to use GitHub’s commit archives. In short, I will use that kind of URL:
https://github.com/NetBSDfr/pkgin/archive/34b823c158e62e4d347de74499a075a2259382c5.tar.gz
which is redirected like this by GitHub:
HTTP/1.1 302 Found Server: GitHub.com Date: Sun, 21 Apr 2013 21:05:17 GMT Content-Type: text/html; charset=utf-8 Connection: keep-alive Status: 302 Found Cache-Control: max-age=0, private Strict-Transport-Security: max-age=2592000 X-Frame-Options: deny Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Thu, 21-Apr-2033 21:05:17 GMT; HttpOnly Location: https://nodeload.github.com/NetBSDfr/pkgin/tar.gz/34b823c158e62e4d347de74499a075a2259382c5 X-Runtime: 13 Content-Length: 156 Vary: Accept-Encoding HTTP/1.1 200 OK Server: GitHub.com Date: Sun, 21 Apr 2013 21:05:18 GMT Content-Type: application/x-gzip Connection: keep-alive Content-Length: 187510 Content-Disposition: attachment; filename=pkgin-34b823c158e62e4d347de74499a075a2259382c5.tar.gz Vary: Accept-Encoding
and permits to point to a particular commit, no matter if it has been tagged or not.
A typical pkgsrc Makefile will look like this:
VERSION= 34b823c158e62e4d347de74499a075a2259382c5
DISTNAME= ${VERSION}
PKGNAME= pkgin-20130412
CATEGORIES= pkgtools
MASTER_SITES= https://github.com/NetBSDfr/pkgin/archive/
FETCH_USING= curl
# [...]
WRKSRC= ${WRKDIR}/pkgin-${VERSION}
# [...]
Note that FETCH_USING= curl is mandatory here in order to follow redirect codes along with https.
There you go, happy GitHub packaging!
Update
Here’s another approach pointed out by Amitai Schlair (schmonz@):
GIT_COMMIT= dd51ac5
DISTNAME= ${GIT_COMMIT}
PKGNAME= p5-App-Prove-Plugin-ProgressBar-0.01
CATEGORIES= devel perl5
MASTER_SITES= -http://nodeload.github.com/Ovid/App-Prove-Plugin-ProgressBar/tar.gz/${GIT_COMMIT}
# [...]
WRKSRC= ${WRKDIR}/App-Prove-Plugin-ProgressBar-${GIT_COMMIT}
Here, Amitai doesn’t use HTTPS so specifying curl as the fetch method is not mandatory. The dash before the URL in the MASTER_SITES line means that DISTNAME will not be appended when fetching, which is very handy when it comes to GitHub archives.

Twitter
GooglePlus
GitHub
Recent Comments