Accéder au contenu.
Menu Sympa

starpu-devel - Re: [Starpu-devel] doc/Makefile.am: replace stat(1) by something portable.

Objet : Developers list for StarPU

Archives de la liste

Re: [Starpu-devel] doc/Makefile.am: replace stat(1) by something portable.


Chronologique Discussions 
  • From: Nathalie Furmento <nathalie.furmento@labri.fr>
  • To: starpu-devel@lists.gforge.inria.fr
  • Subject: Re: [Starpu-devel] doc/Makefile.am: replace stat(1) by something portable.
  • Date: Fri, 13 Jul 2012 11:51:08 +0200
  • List-archive: <http://lists.gforge.inria.fr/pipermail/starpu-devel>
  • List-id: "Developers list. For discussion of new features, code changes, etc." <starpu-devel.lists.gforge.inria.fr>

Cyril,

I like the idea. I actually wanted to do something similar, but my office mate said it was better to do it through the stat command. You would need to convince him that your solution is better.

Cheers,

Nathalie

On 12/07/2012 17:42, Cyril Roelandt wrote:
4FFEF080.2010905@inria.fr">
Hey !

Here is an excerpt from doc/Makefile.am:


#TODO: when stat is not available on the machine, insert "unknown date"
chapters/version.texi:
       @for f in $(starpu_TEXINFOS) ; do \
               if test -f $(top_srcdir)/doc/$$f ; then stat --format=%Y
$(top_srcdir)/doc/$$f ; fi \
       done | sort -r | head -1 > timestamp
       @LC_ALL=C date --date=@`cat timestamp` +"%d %B %Y" >
timestamp_updated
       @LC_ALL=C date --date=@`cat timestamp` +"%B %Y" >
timestamp_updated_month


A few things to notice:
* the TODO: stat(1) may not be available on all platforms.
* stat(1) does not seem to be a POSIX utility (I could not find it in
the "Shell & Utilities" section)
* date(1) only has only one option specified by POSIX (-u). Here, we use
date --date, but on NetBSD, one would use date -r, and on other Unices,
well, there might be another option...

Basically, we need a portable way of generating the latest time at which
a .texi file was modified. We cannot write a one-liner in a very nice
language such as Perl, Python or Scheme, becasue that would add a new
dependency.

The attached patch adds a starpu_stat.c program, that uses the following
calls:

- stat(2)
- difftime(3)
- localtime(3)
- strftime(3)

All these functions are POSIX-compliant. Should one of them be missing
on a platform, it would be easy to just use an #ifdef HAVE_FUNCTION to
fix it.

So far, I have only tested the patch on Linux and NetBSD, but I think it
should work on FreeBSD, Hurd and Mac OS.

What do you think ?


Cyril.


_______________________________________________
Starpu-devel mailing list
Starpu-devel@lists.gforge.inria.fr
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/starpu-devel




Archives gérées par MHonArc 2.6.19+.

Haut de le page