Skip to Content.
Sympa Menu

sm-discuss - [SM-Discuss] proposal for versioned dependencies using regexps

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Seth Woolley <seth AT tautology.org>
  • To: sm-grimoire AT lists.ibiblio.org, <sm-discuss AT lists.ibiblio.org>
  • Subject: [SM-Discuss] proposal for versioned dependencies using regexps
  • Date: Wed, 25 Sep 2002 13:36:34 -0700 (PDT)

Just my two cents.

I think the more direct solution would be to institute versioning in
dependencies and the ability to have more than one version of a
library installed. Having more than one version at a time installed isn't
as critical as to me as simply having better dependency checking.

The fix for the versioning problem of which comes before or after in the
range is to not use ranges, it is to use "egrep" or pcre's. Regular
expressions are much more adept at this kind of pattern matching problem.

It either matches or it doesn't, and if you have a hard time with regexps,
just learn how to do simple alternation to list every version that works.

think how easy:

linux ^2\.4\. #depends on any 2.4 kernel.
linux ^2\.4\.19$ #depends on 2.4.19 exactly.
linux ^(?:2\.4\..*|2\.5\.20)$ #depends on 2.4.x or 2.5.20 kernel
MPlayer ^0\.90pre[678]$ #depends on mplayer 0.90pre6 through pre8

We can even use perl, since wget depends on perl, etc. and it would be
quick to implement.

By doing this, we also force spellwriters to not put in "above 1.6" in
there and then if somebody updates mplayer to pre9, you can check the
dependencies and make sure that the spell depending on it will work for
it. If it won't, sorcery will say: "Spell foo is not confirmed to work
with version 0.90pre9 of MPlayer, however, it is confirmed to work with
versions matching the regexp ^0\.90pre[678], would you like to update
MPlayer anyways? [n]" add an option to change the default from [n] to [y]
called "RISKYDEPS".

If you are depending on something that never changes its api between major
versions, you can use a regular expression that only cares about the major
version. It provides flexibility where it is needed, but restricts people
to not using blanket ranges, which, we have seen, are often not correct.
Most people depending on db 4.0.x would probably say, "works with db
4.0.x or greater" instead of saying "4.0.x" and meaning just that,
unbeknownst to them, in the future, 4.1.x decided to change its API.

The only downsides:

1) no "greater than/less than" ranges will work with it.
Which to me is a good thing as we don't have to implement the comparison
operators for strange spells like MPlayer 0.90pre8 (which is smaller than
0.90).

2) learning curve
People should know the basics of regular expressions anyways.
range system would have some weird syntax, too.

Backwards compatibility can be maintained because en empty regular
expression matches any version. (perl -ne 'print if (//)' and
grep[ -E] "" both match any line). For non-perl people egrep may be
easier to learn for some people than perl regexps.

Any comments?

Seth Woolley





Archive powered by MHonArc 2.6.24.

Top of Page