test: (gnu) tar(1) portability

Tomi Ollila tomi.ollila at iki.fi
Sat Jan 11 02:46:03 PST 2014


Hi

Currently performance-test requires GNU tar and the uprgrade test
in progress will (in it's current form) require it too.

>From portability point of view these tests will work only on Linux
by default -- BSD/Mac OS X have libarchive based tar(1) and other
systems something less capable (no -z option, for example).

>From the test point of view we can expect people to install GNU tar
(somewhere) in for their systems but should we provide less "intrusive"
way for having the GNU tar available.

Options:

1) Do nothing, and expect testers to have GNU tar in PATH available
   before any other tar. For example /usr/local/bin/tar could be GNU tar
   and that is put before /bin:/usr/bin in path.

2) Change calls to 'tar' to format ${GNU_TAR:-tar} so testers can set 
   environment variable GNU_TAR to the name/path of gnu tar when running
   tests (like GNU_TAR=/usr/local/bin/gtar make test or GNU_TAR=gtar ...)

3) Check whether 'gtar' is in system and use that. if not use tar:

   # opportunistically check whether 'gtar' is in system and use that if it is
   if hash gtar >/dev/null
   then TAR=gtar
   else TAR=tar
   fi

   and then replate tar with ${TAR} ($ & {} to emphasize the variable usage)
   in the test code.

   Interestingly Fedora 20 installs both /usr/bin/gtar & /usr/bin/tar.
   In one wheezy system I saw only tar. I tried to JFGI 'gnu tar installation'
   but I could not find references to 'gtar' there.

If installing gtar is widespread I'd use option 3. If not, option 2.
It may be that we end up using option 1 ;/

Tomi


More information about the notmuch mailing list