tar version comparison

Darren Weber dweber at macports.org
Thu Jul 2 14:19:34 PDT 2009


Oh, great.  That should save a bunch of this sort of stuff:

#if [file exists ${prefix}/bin/gnutar] {
#  set gnutar ${prefix}/bin/gnutar
#} elseif [file exists ${prefix}/bin/tar] {
#  set gnutar ${prefix}/bin/tar
#}
#set tarVer [lrange [split [exec $gnutar --version]] 3 3]
#rpm-vercomp $tarVer 1.14.90

# rpm-vercomp versionA versionB
# rpm-vercomp works like strcmp() in that it returns -1, 0, or 1 when
versionA is
# earlier, equal, or later than versionB.

Thanks, everyone!
Darren



On Thu, Jul 2, 2009 at 1:27 PM, Kristofer Henriksson <kthenriksson at gmail.com
> wrote:

> Even with that variant, gnutar will still be available under the name
> gnutar, so you can always run gnutar without worrying about whether
> you have that variant or not. The variant just adds symlinks for
> everything.
>
> Regards,
> Kristofer
>
> On Thu, Jul 2, 2009 at 2:54 PM, Darren Weber<dweber at macports.org> wrote:
> >
> >
> > On Wed, Jul 1, 2009 at 3:57 PM, Joshua Root <jmr at macports.org> wrote:
> >>
> >> On 2009-7-2 07:16, 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?
> >>
> >> Toby has answered your question, but it seems like you'd be better off
> >> just depending on gnutar rather than messing around doing different
> >> things for different tar versions.
> >>
> >> - Josh
> >
> >
> > Yes, so a dependency on gnutar is an option, but what if it's installed
> with
> > the variant,
> >
> >   with_default_names: Install files without 'gnu' prefix
> >
> > I suppose then the script has to check for the right command - tar or
> gnutar
> > - and if it uses tar there will have to be a check for the version of tar
> > that's called (or at least a check for `which tar` to confirm that it's
> > $prefix/bin/tar).
> >
> > Thanks,
> > Darren
> >
> >
> > _______________________________________________
> > macports-dev mailing list
> > macports-dev at lists.macosforge.org
> > http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20090702/426e54ab/attachment-0001.html>


More information about the macports-dev mailing list