When version is nil, (version <==> other.version) also returns nil
and then the nill object doesn't have a nonzero? method.
I'm not sure what package put me into this state, but, this fix repaired
my environment.
Also, there is probably a more ruby-esque way to do this, but, I'm not a
ruby expert ;-)
Comparing PkgVersion and Version objects can produce nonsensical
results. For example, equality is not symmetric:
irb(main):002:0> PkgVersion.new("1.0", 0) == Version.new("1.0")
=> false
irb(main):003:0> Version.new("1.0") == PkgVersion.new("1.0", 0)
=> true
Rather than attempt to deal with subclass-superclass equality, let's use
composition and punt on the problem altogether.
In order to allow kegs built with the same version but differing formula
revisions to coexist, we must encode the revision as part of the keg's
name. This is necessary to actually perform an upgrade, as we cannot
upgrade a keg in-place, and temporarily moving it pending the result of
the upgrade is error-prone and potentially slow.
To accomplish this, we introduce a new Formula#pkg_version method that
concatenates the active_spec version with the formula revision. An
exception is made for a formula that has no revision: the tag is
omitted. This preserves compatibility with existing installations.