Python ntpq lands - what to do next?

Hal Murray hmurray at megapathdsl.net
Sun Nov 6 02:10:03 UTC 2016


> What's going on: In fulfilment of a request from Gary to make package
> version information easily accessible from Python, I told waf to generate a
> file pylib/version.py using VERSION as input.  Mine looks like this: 
> ...


> I believe that the production won't fire (and fail) if pylib/version.py
> exists and is newer than VERSION, which I expect to be the case in a tarball
> that prserves dates (because it will always be true after waf runs).

I'm not actually making a tarball, just trying to do something similar.

I have a script to do all the work, mostly so I don't forget a critical step, 
but also to make a log file without extra typing and such.  It should be a 
line or two in the right place if/when I figure out what to do.

> So the first question is, does your unpacked tarball have a pylib/
> version.py? And is it newer or older than VERSION? 

-rw-rw-r-- 1 murray murray   6 Oct 13 01:45 VERSION
-rw-rw-r-- 1 murray murray 408 Nov  5 17:37 pylib/version.py

[100/132] Compiling VERSION
18:11:27 runner ' VERSION=`cat ../VERSION` ../wafhelpers/autorevision.sh -t 
python >version.py '
error: No repo or cache detected.

That's from my attempt at mimicking a tarball process.

So I tried the real things.
./waf distcheck worked and left behind  noname-1.0.tar.bz2
I scp-ed that to another machine that didn't have git, untared, and ...

[ 98/132] Compiling VERSION
error: No repo or cache detected.

Waf: Leaving directory `/home/murray/foo/noname-1.0/build/main'
Build failed
 -> task in '/home/murray/foo/noname-1.0/pylib/version.py' failed with exit 
status 1 (run with -v to display more information)

----------

This is turning into an interesting can of worms.

waf clean doesn't get pylib/ntp_control.py or pylib/ntp_magic.py or 
pylib/version.py
is that a bug or feature?

The parallel non-python version stuff just uses the time if it can't get info 
from git.
You may want to "fix" that to do something similar.
It's only used by ntpd.  (There used to be one for ntpq too.)

There are actually two times of interest.  One is the latest time a source 
file was modified.  The other is the time the package was built.  Python may 
not have the concept of build, but it might come back if you are translating 
from python to c.

If you edit a file, waf doesn't automagically update version.c
So my rebuild script deletes 
  */main/ntpd/version.c
so waf rebuilds it to get the updated build-time.

That version stuff is currently half broken.
  ntpd --version --version
  ntpd 0.9.5-5feab12-glypnod Nov  5 2016 17:37:08
  ntpd CFLAGS=Need-CFLAGS LDFLAGS=Need-LDFLAGS


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list