pextlib provides 'rpm-vercomp' which probably does what you want.
- Toby
On Jul 1, 2009, at 2:16 PM, Darren Weber wrote:
I need to test if the system has a tar version between 1.14 and
1.14.90, what is the best way to do this in tcl?
I have the following tcl script snippet, but there may be an easier
way.
# tar-1.14 uses --strip-path, tar-1.14.90+ uses --strip-components
set tarArg "--strip-components"
set tarVersion [lrange [split [exec tar --version]] 3 3]
set tarMaj [lrange [split $tarVersion .] 0 0]
set tarMin [lrange [split $tarVersion .] 1 1]
set tarRev [lrange [split $tarVersion .] 2 2]
if ([expr $tarMaj == 1 && $tarMin == 14 && $tarRev < 90]) {
set tarArg "--strip-path"
}
For example, on OSX 10.5.x we get these results from /usr/bin/tar:
% set tarVer [lrange [split [exec tar --version]] 3 3]
1.15.1
% set tarMaj [lrange [split $tarVer .] 0 0]
1
% set tarMin [lrange [split $tarVer .] 1 1]
15
% set tarRev [lrange [split $tarVer .] 2 2]
1
% set tarArg "--strip-components"
--strip-components
% if ([expr $tarMaj == 1 && $tarMin == 14 && $tarRev < 90]) {
set tarArg "--strip-path"
}
% puts $tarArg
--strip-components
0
%
TIA,
Darren
_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev
_______________________________________________
macports-dev mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev