When I started writing FreshPorts (The Place For Ports) back in the late 1990’s, I was under the impression that a port had just one version. The current version. There is only one ports tree. There isn’t one ports tree for FreeBSD 4 and another for FreeBSD 5, and yet another for FreeBSD 6. There’s just one. Yet, I was wrong.
The case in point: x11/nvidia-driver. At that URL, you’ll see that FreshPorts thinks the latest version is 1.0.6113_4
. But if you look at the commit for 15 Dec 2005, you see:
Update to version 1.0-8174, the latest from nVidia.
What? So why is FreshPorts getting it wrong?
First, it’s not getting it wrong. FreshPorts runs on FreeBSD 4.11. Here’s what it sees:
[dan@polo:/usr/ports/x11/nvidia-driver] $ make -V PORTVERSION 1.0.6113 [dan@polo:/usr/ports/x11/nvidia-driver] $
OK, so what version of the Makefile do I have?
# New ports collection makefile for: nvidia-driver # Date created: 4 December 2002 # Whom: Stijn Hoop# # $FreeBSD: ports/x11/nvidia-driver/Makefile,v 1.41 2005/12/15 12:53:50 danfe Exp $ # PORTNAME= nvidia-driver PORTVERSION= 1.0.${NVVERSION} CATEGORIES= x11 [dan@polo:/usr/ports/x11/nvidia-driver] $
Checking with CVSWeb, I know that that is the correct version. So why don’t I see what the commit message says I should see?
Let’s try another machine, one that is running FreeBSD 5.4.
[dan@undef:/usr/ports/x11/nvidia-driver] $ uname -a FreeBSD undef.example.org 5.4-STABLE FreeBSD 5.4-STABLE #0: Sat Sep 3 13:03:52 EDT 2005 root@dfc.example.org:/usr/obj/usr/src/sys/DFC i386 [dan@undef:/usr/ports/x11/nvidia-driver] $ make -V PORTVERSION 1.0.8174 [dan@undef:/usr/ports/x11/nvidia-driver] $
Ahh, there’s the "right" version. Let’s look closer at the Makefile, and you’ll see why this happens:
.if ${OSVERSION} < 503000 NVVERSION= 6113 PORTREVISION= 4 PLIST_SUB+= DIFFS="" DRVSO="@comment " EXTRA_PATCHES+= ${FILESDIR}/${NVVERSION}-* .else .if defined(WITH_LEGACY_GPU_SUPPORT) NVVERSION= 7174 PORTREVISION= 2 EXTRA_PATCHES+= ${FILESDIR}/6113-patch-lib::Makefile .else NVVERSION= 8174 EXTRA_PATCHES+= ${FILESDIR}/7667-* .endif .if ${OSVERSION} >= 600033 LIB_DEPENDS+= m.3:${PORTSDIR}/misc/compat5x .endif PLIST_SUB+= DIFFS="@comment " DRVSO="" .endif
OK, the same port reports different versions on different releases. That’s lovely!
There are very few ports that do this. Thankfully. Granted, FreshPorts is not OSVERSION and ARCH aware, but work is underway to make BROKEN and FORBIDDEN messages specific to the version of FreeBSD you are running and to the platform you are using. Now it seems I must also track PORTVERSION, PORTREVISION, and PORTEPOCH for each OSVERSION and each ARCH.
Oh joy!
Sure, it’s very clever to do things this way. But from a databse design point of view, it’s a huge pain in the ass to cater for an extremely small number of ports.
That’s something for me to look forward to.
Another point: Some (slave-)ports have different versions depending on which master ports they are built with. Consider, for example, x11-toolkits/py-tkinter. According to FreshPorts, its current version is 2.2.2_1, yet if you have Python 2.3 installed, it’s 2.3.5_1. And with Python 2.4, you get 2.4.2_1.
audio/aureal-kmod is also one port abusing of PORTVERSION/PORTREVISION.