[Git][NTPsec/ntpsec][master] 2 commits: Eliminates unnecessary symlink recreation.
Matt Selsky
gitlab at mg.gitlab.com
Thu Jan 10 23:26:53 UTC 2019
Matt Selsky pushed to branch master at NTPsec / ntpsec
Commits:
03d1ef28 by Fred Wright at 2019-01-10T07:38:38Z
Eliminates unnecessary symlink recreation.
This makes two changes to the symlink creation code in tests/wscript:
1) It avoids creating the symlink when it already exists and has the
correct content.
2) It creates it as a relative symlink rather than an absolute
symlink, so that it doesn't clash with the duplicate logic in
"afterparty".
Fixing this is a prerequisite to allowing installs from read-only
trees, though there is still a problem in that area from waf itself.
TESTED:
The correct relative symlink is now constructed prior to "afterparty",
and the tests pass. Running "install" from a read-only mount no
longer crashes in the symlink code, though it still dies from waf's
attempt at some sort of database update.
- - - - -
99943145 by Fred Wright at 2019-01-10T07:38:38Z
Removes gratuitous reruns of pythonize-header.
The code which unconditionally removed the outputs of pythonize-header
was completely unnecessary, and not only caused unnecessary rebuilding
of those files, but also made it impossible to perform an install from
a read-only tree (after building read-write, of course).
Without this code, the targets are still rebuilt whenever the relevant
sources changed, and not rebuilt redundantly.
TESTED:
Verified that the targets are rebuilt when needed, and not rebuilt
when not needed.
- - - - -
2 changed files:
- pylib/wscript
- tests/wscript
Changes:
=====================================
pylib/wscript
=====================================
@@ -33,9 +33,18 @@ def build(ctx):
sources = srcnode.ant_glob('*.py')
builds = [x.get_bld() for x in sources]
- # Remove generated files to ensure they are properly updated
- ctx.exec_command("rm -f %s" % target1.abspath())
- ctx.exec_command("rm -f %s" % target2.abspath())
+ # The rm's here were added to fix a reported (but underdocumented) problem
+ # where the results of pythonize-header were not updated when needed,
+ # though there is as yet no explanation for why this had occurred, and the
+ # alleged failure only occurred when changing the code between 'configure'
+ # and 'build', which is not a legal action, anyway.
+ # These rm's were causing unnecessary reruns of pythonize-header,
+ # including during 'install'. They are now disabled but retained as a
+ # comment.
+
+ ## Remove generated files to ensure they are properly updated
+ #ctx.exec_command("rm -f %s" % target1.abspath())
+ #ctx.exec_command("rm -f %s" % target2.abspath())
# Make sure Python sees .py as well as .pyc/.pyo
ctx(
=====================================
tests/wscript
=====================================
@@ -121,13 +121,15 @@ def build(ctx):
testpylib.get_bld().mkdir()
pypath = pylib.get_bld()
- linkpath = ctx.bldnode.make_node("tests/pylib/ntp")
- if (not linkpath.exists()) or os.readlink(linkpath.abspath()):
+ targdir = "tests/pylib"
+ linkpath = ctx.bldnode.make_node(targdir + "/ntp").abspath()
+ relpath = ("../" * (targdir.count("/")+1)) + pypath.path_from(ctx.bldnode)
+ if (not os.path.exists(linkpath)) or os.readlink(linkpath) != relpath:
try:
- os.remove(linkpath.abspath())
+ os.remove(linkpath)
except OSError:
pass
- os.symlink(pypath.abspath(), linkpath.abspath())
+ os.symlink(relpath, linkpath)
pytests = ["pylib/test_util.py",
"pylib/test_agentx.py",
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/89b1e26db242b2b594d07976b3da3b7251ab066d...99943145e1f663030fe54a0cb6668e7c441f7a66
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/89b1e26db242b2b594d07976b3da3b7251ab066d...99943145e1f663030fe54a0cb6668e7c441f7a66
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20190110/0707354b/attachment-0001.html>
More information about the vc
mailing list