Merge ~ahasenack/ubuntu/+source/talloc:disco-talloc-2.1.16 into ubuntu/+source/talloc:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Approved by: Andreas Hasenack
Approved revision: ab509e3b2077326740f1efa27210bc9459247568
Merged at revision: ab509e3b2077326740f1efa27210bc9459247568
Proposed branch: ~ahasenack/ubuntu/+source/talloc:disco-talloc-2.1.16
Merge into: ubuntu/+source/talloc:ubuntu/devel
Diff against target: 65964 lines (+41691/-1176)
251 files modified
ABI/pytalloc-util-2.1.15.sigs (+16/-0)
ABI/pytalloc-util-2.1.16.sigs (+16/-0)
ABI/pytalloc-util.py3-2.1.15.sigs (+15/-0)
ABI/pytalloc-util.py3-2.1.16.sigs (+15/-0)
ABI/talloc-2.1.15.sigs (+65/-0)
ABI/talloc-2.1.16.sigs (+65/-0)
Makefile (+3/-1)
buildtools/bin/waf (+111/-21)
buildtools/examples/run_on_target.py (+1/-1)
buildtools/scripts/abi_gen.sh (+1/-1)
buildtools/wafsamba/configure_file.py (+4/-2)
buildtools/wafsamba/generic_cc.py (+51/-52)
buildtools/wafsamba/pkgconfig.py (+2/-2)
buildtools/wafsamba/samba3.py (+4/-5)
buildtools/wafsamba/samba_abi.py (+22/-14)
buildtools/wafsamba/samba_autoconf.py (+99/-73)
buildtools/wafsamba/samba_autoproto.py (+3/-3)
buildtools/wafsamba/samba_bundled.py (+11/-11)
buildtools/wafsamba/samba_conftests.py (+34/-31)
buildtools/wafsamba/samba_cross.py (+14/-13)
buildtools/wafsamba/samba_deps.py (+23/-14)
buildtools/wafsamba/samba_dist.py (+42/-9)
buildtools/wafsamba/samba_git.py (+1/-1)
buildtools/wafsamba/samba_headers.py (+7/-6)
buildtools/wafsamba/samba_install.py (+6/-5)
buildtools/wafsamba/samba_patterns.py (+10/-3)
buildtools/wafsamba/samba_perl.py (+8/-5)
buildtools/wafsamba/samba_pidl.py (+18/-12)
buildtools/wafsamba/samba_python.py (+31/-21)
buildtools/wafsamba/samba_third_party.py (+7/-7)
buildtools/wafsamba/samba_utils.py (+178/-111)
buildtools/wafsamba/samba_version.py (+8/-5)
buildtools/wafsamba/samba_waf18.py (+429/-0)
buildtools/wafsamba/samba_wildcard.py (+8/-9)
buildtools/wafsamba/stale_files.py (+4/-2)
buildtools/wafsamba/symbols.py (+19/-17)
buildtools/wafsamba/test_duplicate_symbol.sh (+1/-1)
buildtools/wafsamba/tests/test_abi.py (+15/-1)
buildtools/wafsamba/wafsamba.py (+48/-118)
buildtools/wafsamba/wscript (+47/-58)
configure (+1/-1)
debian/changelog (+19/-0)
debian/control (+14/-14)
debian/libtalloc2.symbols (+2/-0)
debian/python3-talloc-dev.install (+4/-0)
debian/python3-talloc.install (+2/-0)
debian/python3-talloc.symbols.amd64 (+3/-0)
debian/python3-talloc.symbols.arm64 (+3/-0)
debian/python3-talloc.symbols.armhf (+3/-0)
debian/python3-talloc.symbols.common (+27/-0)
debian/python3-talloc.symbols.i386 (+3/-0)
debian/python3-talloc.symbols.ppc64el (+3/-0)
debian/python3-talloc.symbols.s390x (+3/-0)
debian/rules (+7/-19)
debian/source/lintian-overrides (+1/-1)
dev/null (+0/-129)
lib/replace/Makefile (+2/-1)
lib/replace/README (+1/-0)
lib/replace/configure (+1/-1)
lib/replace/getifaddrs.c (+1/-1)
lib/replace/replace.c (+109/-0)
lib/replace/replace.h (+52/-27)
lib/replace/snprintf.c (+72/-72)
lib/replace/system/capability.h (+2/-0)
lib/replace/system/dir.h (+2/-2)
lib/replace/system/filesys.h (+4/-12)
lib/replace/system/gssapi.h (+6/-6)
lib/replace/system/kerberos.h (+2/-2)
lib/replace/system/readline.h (+1/-1)
lib/replace/system/threads.h (+27/-0)
lib/replace/wscript (+71/-18)
talloc.c (+7/-2)
talloc.h (+13/-2)
test_pytalloc.py (+3/-2)
third_party/waf/waflib/Build.py (+1474/-0)
third_party/waf/waflib/ConfigSet.py (+361/-0)
third_party/waf/waflib/Configure.py (+638/-0)
third_party/waf/waflib/Context.py (+737/-0)
third_party/waf/waflib/Errors.py (+68/-0)
third_party/waf/waflib/Logs.py (+379/-0)
third_party/waf/waflib/Node.py (+970/-0)
third_party/waf/waflib/Options.py (+342/-0)
third_party/waf/waflib/Runner.py (+586/-0)
third_party/waf/waflib/Scripting.py (+613/-0)
third_party/waf/waflib/Task.py (+1281/-0)
third_party/waf/waflib/TaskGen.py (+917/-0)
third_party/waf/waflib/Tools/__init__.py (+1/-1)
third_party/waf/waflib/Tools/ar.py (+24/-0)
third_party/waf/waflib/Tools/asm.py (+73/-0)
third_party/waf/waflib/Tools/bison.py (+49/-0)
third_party/waf/waflib/Tools/c.py (+39/-0)
third_party/waf/waflib/Tools/c_aliases.py (+144/-0)
third_party/waf/waflib/Tools/c_config.py (+1352/-0)
third_party/waf/waflib/Tools/c_osx.py (+193/-0)
third_party/waf/waflib/Tools/c_preproc.py (+1091/-0)
third_party/waf/waflib/Tools/c_tests.py (+229/-0)
third_party/waf/waflib/Tools/ccroot.py (+775/-0)
third_party/waf/waflib/Tools/clang.py (+29/-0)
third_party/waf/waflib/Tools/clangxx.py (+30/-0)
third_party/waf/waflib/Tools/compiler_c.py (+110/-0)
third_party/waf/waflib/Tools/compiler_cxx.py (+111/-0)
third_party/waf/waflib/Tools/compiler_d.py (+85/-0)
third_party/waf/waflib/Tools/compiler_fc.py (+73/-0)
third_party/waf/waflib/Tools/cs.py (+211/-0)
third_party/waf/waflib/Tools/cxx.py (+40/-0)
third_party/waf/waflib/Tools/d.py (+97/-0)
third_party/waf/waflib/Tools/d_config.py (+64/-0)
third_party/waf/waflib/Tools/d_scan.py (+211/-0)
third_party/waf/waflib/Tools/dbus.py (+70/-0)
third_party/waf/waflib/Tools/dmd.py (+80/-0)
third_party/waf/waflib/Tools/errcheck.py (+237/-0)
third_party/waf/waflib/Tools/fc.py (+187/-0)
third_party/waf/waflib/Tools/fc_config.py (+488/-0)
third_party/waf/waflib/Tools/fc_scan.py (+114/-0)
third_party/waf/waflib/Tools/flex.py (+62/-0)
third_party/waf/waflib/Tools/g95.py (+66/-0)
third_party/waf/waflib/Tools/gas.py (+18/-0)
third_party/waf/waflib/Tools/gcc.py (+156/-0)
third_party/waf/waflib/Tools/gdc.py (+55/-0)
third_party/waf/waflib/Tools/gfortran.py (+93/-0)
third_party/waf/waflib/Tools/glib2.py (+489/-0)
third_party/waf/waflib/Tools/gnu_dirs.py (+131/-0)
third_party/waf/waflib/Tools/gxx.py (+157/-0)
third_party/waf/waflib/Tools/icc.py (+30/-0)
third_party/waf/waflib/Tools/icpc.py (+30/-0)
third_party/waf/waflib/Tools/ifort.py (+413/-0)
third_party/waf/waflib/Tools/intltool.py (+231/-0)
third_party/waf/waflib/Tools/irixcc.py (+66/-0)
third_party/waf/waflib/Tools/javaw.py (+464/-0)
third_party/waf/waflib/Tools/ldc2.py (+56/-0)
third_party/waf/waflib/Tools/lua.py (+38/-0)
third_party/waf/waflib/Tools/md5_tstamp.py (+39/-0)
third_party/waf/waflib/Tools/msvc.py (+1020/-0)
third_party/waf/waflib/Tools/nasm.py (+26/-0)
third_party/waf/waflib/Tools/nobuild.py (+24/-0)
third_party/waf/waflib/Tools/perl.py (+156/-0)
third_party/waf/waflib/Tools/python.py (+627/-0)
third_party/waf/waflib/Tools/qt5.py (+796/-0)
third_party/waf/waflib/Tools/ruby.py (+186/-0)
third_party/waf/waflib/Tools/suncc.py (+67/-0)
third_party/waf/waflib/Tools/suncxx.py (+67/-0)
third_party/waf/waflib/Tools/tex.py (+543/-0)
third_party/waf/waflib/Tools/vala.py (+355/-0)
third_party/waf/waflib/Tools/waf_unit_test.py (+296/-0)
third_party/waf/waflib/Tools/winres.py (+78/-0)
third_party/waf/waflib/Tools/xlc.py (+65/-0)
third_party/waf/waflib/Tools/xlcxx.py (+65/-0)
third_party/waf/waflib/Utils.py (+1021/-0)
third_party/waf/waflib/__init__.py (+1/-1)
third_party/waf/waflib/ansiterm.py (+342/-0)
third_party/waf/waflib/extras/__init__.py (+3/-0)
third_party/waf/waflib/extras/batched_cc.py (+173/-0)
third_party/waf/waflib/extras/biber.py (+58/-0)
third_party/waf/waflib/extras/bjam.py (+128/-0)
third_party/waf/waflib/extras/blender.py (+108/-0)
third_party/waf/waflib/extras/boo.py (+81/-0)
third_party/waf/waflib/extras/boost.py (+525/-0)
third_party/waf/waflib/extras/build_file_tracker.py (+28/-0)
third_party/waf/waflib/extras/build_logs.py (+110/-0)
third_party/waf/waflib/extras/buildcopy.py (+82/-0)
third_party/waf/waflib/extras/c_bgxlc.py (+32/-0)
third_party/waf/waflib/extras/c_dumbpreproc.py (+72/-0)
third_party/waf/waflib/extras/c_emscripten.py (+87/-0)
third_party/waf/waflib/extras/c_nec.py (+74/-0)
third_party/waf/waflib/extras/cabal.py (+152/-0)
third_party/waf/waflib/extras/cfg_altoptions.py (+110/-0)
third_party/waf/waflib/extras/clang_compilation_database.py (+85/-0)
third_party/waf/waflib/extras/codelite.py (+875/-0)
third_party/waf/waflib/extras/color_gcc.py (+39/-0)
third_party/waf/waflib/extras/color_rvct.py (+51/-0)
third_party/waf/waflib/extras/compat15.py (+406/-0)
third_party/waf/waflib/extras/cppcheck.py (+585/-0)
third_party/waf/waflib/extras/cpplint.py (+222/-0)
third_party/waf/waflib/extras/cross_gnu.py (+227/-0)
third_party/waf/waflib/extras/cython.py (+146/-0)
third_party/waf/waflib/extras/dcc.py (+72/-0)
third_party/waf/waflib/extras/distnet.py (+430/-0)
third_party/waf/waflib/extras/doxygen.py (+227/-0)
third_party/waf/waflib/extras/dpapi.py (+87/-0)
third_party/waf/waflib/extras/eclipse.py (+431/-0)
third_party/waf/waflib/extras/erlang.py (+110/-0)
third_party/waf/waflib/extras/fast_partial.py (+518/-0)
third_party/waf/waflib/extras/fc_bgxlf.py (+32/-0)
third_party/waf/waflib/extras/fc_cray.py (+51/-0)
third_party/waf/waflib/extras/fc_nag.py (+61/-0)
third_party/waf/waflib/extras/fc_nec.py (+60/-0)
third_party/waf/waflib/extras/fc_open64.py (+58/-0)
third_party/waf/waflib/extras/fc_pgfortran.py (+68/-0)
third_party/waf/waflib/extras/fc_solstudio.py (+62/-0)
third_party/waf/waflib/extras/fc_xlf.py (+63/-0)
third_party/waf/waflib/extras/file_to_object.py (+137/-0)
third_party/waf/waflib/extras/fluid.py (+13/-9)
third_party/waf/waflib/extras/freeimage.py (+74/-0)
third_party/waf/waflib/extras/fsb.py (+31/-0)
third_party/waf/waflib/extras/fsc.py (+64/-0)
third_party/waf/waflib/extras/gccdeps.py (+214/-0)
third_party/waf/waflib/extras/gdbus.py (+87/-0)
third_party/waf/waflib/extras/gob2.py (+5/-5)
third_party/waf/waflib/extras/halide.py (+151/-0)
third_party/waf/waflib/extras/javatest.py (+118/-0)
third_party/waf/waflib/extras/kde4.py (+93/-0)
third_party/waf/waflib/extras/local_rpath.py (+19/-0)
third_party/waf/waflib/extras/make.py (+142/-0)
third_party/waf/waflib/extras/midl.py (+69/-0)
third_party/waf/waflib/extras/msvcdeps.py (+256/-0)
third_party/waf/waflib/extras/msvs.py (+1048/-0)
third_party/waf/waflib/extras/netcache_client.py (+390/-0)
third_party/waf/waflib/extras/objcopy.py (+50/-0)
third_party/waf/waflib/extras/ocaml.py (+142/-91)
third_party/waf/waflib/extras/package.py (+76/-0)
third_party/waf/waflib/extras/parallel_debug.py (+459/-0)
third_party/waf/waflib/extras/pch.py (+148/-0)
third_party/waf/waflib/extras/pep8.py (+106/-0)
third_party/waf/waflib/extras/pgicc.py (+75/-0)
third_party/waf/waflib/extras/pgicxx.py (+20/-0)
third_party/waf/waflib/extras/proc.py (+54/-0)
third_party/waf/waflib/extras/protoc.py (+243/-0)
third_party/waf/waflib/extras/pyqt5.py (+241/-0)
third_party/waf/waflib/extras/pytest.py (+225/-0)
third_party/waf/waflib/extras/qnxnto.py (+72/-0)
third_party/waf/waflib/extras/qt4.py (+695/-0)
third_party/waf/waflib/extras/relocation.py (+85/-0)
third_party/waf/waflib/extras/remote.py (+327/-0)
third_party/waf/waflib/extras/resx.py (+35/-0)
third_party/waf/waflib/extras/review.py (+325/-0)
third_party/waf/waflib/extras/rst.py (+260/-0)
third_party/waf/waflib/extras/run_do_script.py (+139/-0)
third_party/waf/waflib/extras/run_m_script.py (+88/-0)
third_party/waf/waflib/extras/run_py_script.py (+104/-0)
third_party/waf/waflib/extras/run_r_script.py (+86/-0)
third_party/waf/waflib/extras/sas.py (+71/-0)
third_party/waf/waflib/extras/satellite_assembly.py (+57/-0)
third_party/waf/waflib/extras/scala.py (+128/-0)
third_party/waf/waflib/extras/slow_qt4.py (+96/-0)
third_party/waf/waflib/extras/softlink_libs.py (+76/-0)
third_party/waf/waflib/extras/stale.py (+98/-0)
third_party/waf/waflib/extras/stracedeps.py (+174/-0)
third_party/waf/waflib/extras/swig.py (+237/-0)
third_party/waf/waflib/extras/syms.py (+84/-0)
third_party/waf/waflib/extras/ticgt.py (+300/-0)
third_party/waf/waflib/extras/unity.py (+108/-0)
third_party/waf/waflib/extras/use_config.py (+185/-0)
third_party/waf/waflib/extras/valadoc.py (+127/-99)
third_party/waf/waflib/extras/waf_xattr.py (+150/-0)
third_party/waf/waflib/extras/why.py (+78/-0)
third_party/waf/waflib/extras/win32_opts.py (+170/-0)
third_party/waf/waflib/extras/wix.py (+87/-0)
third_party/waf/waflib/extras/xcode6.py (+727/-0)
third_party/waf/waflib/fixpy2.py (+64/-0)
third_party/waf/waflib/processor.py (+64/-0)
wscript (+20/-22)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Pending
Review via email: mp+364087@code.launchpad.net

Description of the change

PPA with builds: ppa:ahasenack/samba-4.10
https://launchpad.net/~ahasenack/+archive/ubuntu/samba-4.10/

Bileto ticket:
https://bileto.ubuntu.com/#/ticket/3672
It was green, but recent uploads removed the dep8 test history. I have to copy the packages over again.

We are going ahead of Debian.

This is part of the effort to remove python2 from the desktop iso. That requires samba to be updated to 4.10 (bug #1818518), and a newer talloc is needed by samba 4.10. The other requirement is to start building python3 packages for talloc, which this branch does.

Of note in this branch is that the python3 symbols have the architecture in their names, which required me to create per-arch symbols packages. To reduce duplication, I used the #include directive to include the common set of symbols that does not have the arch in their names.

This branch is also removing the python2 packages: python-talloc and python-talloc-dev. Their reverse-depends in disco is as follows:

$ reverse-depends python-talloc
Reverse-Depends
===============
* python-samba
* python-talloc-dev
* samba-libs

$ reverse-depends python-talloc-dev
No reverse dependencies found

We should be good then, since the reverse depends are packages we are touching in this effort already.

To post a comment you must log in.
Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I'll keep the repeated feedback short - indents in changelog

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I was wondering before already on your arch specific symbols files.
Would something like [1] allow you to get away with less files and therefore also reduce churn on a merge? It might end up being a style question and is up to you.

[1]: https://git.launchpad.net/ubuntu/+source/dpdk/tree/debian/librte-eal18.11.symbols?h=applied/ubuntu/disco#n229

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Again you remove python2 here - while on e.g. tdb you reverted that change.
Which way do you want to go?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

OTOH the py2 removal is a nice cleanup in d/rules - so I like it in general

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

And the same wondering as on other MPs on cpython related .symbols files - do we really want/need them?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Commits and build log LGTM - none of the comments I had is blocking.
Ack on the current state of the MP

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

just tdb needs python2, because of bzr-git. The others don't have outside reverse-depends.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

debian was including symbols for python-talloc (python2), I kept doing the same for the python3 package. I pinged doko, and I'm doing a quick search in the archive for other python3 extensions that have (or not) symbols files.

regarding this:
 (arch=!arm64 !armhf !ppc64el)rte_rtm_supported@DPDK_16.07 16.07~rc3

problem is that the filename also has the arch in it in my case, it's not just the symbol:
libpytalloc-util.cpython-37m-x86-64-linux-gnu.so.2 python3-talloc #MINVER#
PYTALLOC_UTIL.CPYTHON_37M_X86_64_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_X86_64_LINUX_GNU_2.1.16 2.1.16

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Tagged and uploaded:

$ git push pkg upload/2.1.16-0ubuntu1
Enumerating objects: 369, done.
Counting objects: 100% (369/369), done.
Delta compression using up to 4 threads
Compressing objects: 100% (223/223), done.
Writing objects: 100% (297/297), 430.40 KiB | 263.00 KiB/s, done.
Total 297 (delta 100), reused 253 (delta 69)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/talloc
 * [new tag] upload/2.1.16-0ubuntu1 -> upload/2.1.16-0ubuntu1

$ dput ubuntu ../talloc_2.1.16-0ubuntu1_source.changes
Checking signature on .changes
gpg: ../talloc_2.1.16-0ubuntu1_source.changes: Valid signature from AC983EB5BF6BCBA9
Checking signature on .dsc
gpg: ../talloc_2.1.16-0ubuntu1.dsc: Valid signature from AC983EB5BF6BCBA9
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading talloc_2.1.16-0ubuntu1.dsc: done.
  Uploading talloc_2.1.16.orig.tar.gz: done.
  Uploading talloc_2.1.16-0ubuntu1.debian.tar.xz: done.
  Uploading talloc_2.1.16-0ubuntu1_source.buildinfo: done.
  Uploading talloc_2.1.16-0ubuntu1_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/ABI/pytalloc-util-2.1.15.sigs b/ABI/pytalloc-util-2.1.15.sigs
2new file mode 100644
3index 0000000..9d4d4d1
4--- /dev/null
5+++ b/ABI/pytalloc-util-2.1.15.sigs
6@@ -0,0 +1,16 @@
7+_pytalloc_check_type: int (PyObject *, const char *)
8+_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
9+_pytalloc_get_ptr: void *(PyObject *)
10+_pytalloc_get_type: void *(PyObject *, const char *)
11+pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
12+pytalloc_BaseObject_check: int (PyObject *)
13+pytalloc_BaseObject_size: size_t (void)
14+pytalloc_CObject_FromTallocPtr: PyObject *(void *)
15+pytalloc_Check: int (PyObject *)
16+pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *)
17+pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *)
18+pytalloc_GetBaseObjectType: PyTypeObject *(void)
19+pytalloc_GetObjectType: PyTypeObject *(void)
20+pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
21+pytalloc_steal: PyObject *(PyTypeObject *, void *)
22+pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
23diff --git a/ABI/pytalloc-util-2.1.16.sigs b/ABI/pytalloc-util-2.1.16.sigs
24new file mode 100644
25index 0000000..9d4d4d1
26--- /dev/null
27+++ b/ABI/pytalloc-util-2.1.16.sigs
28@@ -0,0 +1,16 @@
29+_pytalloc_check_type: int (PyObject *, const char *)
30+_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
31+_pytalloc_get_ptr: void *(PyObject *)
32+_pytalloc_get_type: void *(PyObject *, const char *)
33+pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
34+pytalloc_BaseObject_check: int (PyObject *)
35+pytalloc_BaseObject_size: size_t (void)
36+pytalloc_CObject_FromTallocPtr: PyObject *(void *)
37+pytalloc_Check: int (PyObject *)
38+pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *)
39+pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *)
40+pytalloc_GetBaseObjectType: PyTypeObject *(void)
41+pytalloc_GetObjectType: PyTypeObject *(void)
42+pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
43+pytalloc_steal: PyObject *(PyTypeObject *, void *)
44+pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
45diff --git a/ABI/pytalloc-util.py3-2.1.15.sigs b/ABI/pytalloc-util.py3-2.1.15.sigs
46new file mode 100644
47index 0000000..62f066f
48--- /dev/null
49+++ b/ABI/pytalloc-util.py3-2.1.15.sigs
50@@ -0,0 +1,15 @@
51+_pytalloc_check_type: int (PyObject *, const char *)
52+_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
53+_pytalloc_get_ptr: void *(PyObject *)
54+_pytalloc_get_type: void *(PyObject *, const char *)
55+pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
56+pytalloc_BaseObject_check: int (PyObject *)
57+pytalloc_BaseObject_size: size_t (void)
58+pytalloc_Check: int (PyObject *)
59+pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *)
60+pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *)
61+pytalloc_GetBaseObjectType: PyTypeObject *(void)
62+pytalloc_GetObjectType: PyTypeObject *(void)
63+pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
64+pytalloc_steal: PyObject *(PyTypeObject *, void *)
65+pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
66diff --git a/ABI/pytalloc-util.py3-2.1.16.sigs b/ABI/pytalloc-util.py3-2.1.16.sigs
67new file mode 100644
68index 0000000..62f066f
69--- /dev/null
70+++ b/ABI/pytalloc-util.py3-2.1.16.sigs
71@@ -0,0 +1,15 @@
72+_pytalloc_check_type: int (PyObject *, const char *)
73+_pytalloc_get_mem_ctx: TALLOC_CTX *(PyObject *)
74+_pytalloc_get_ptr: void *(PyObject *)
75+_pytalloc_get_type: void *(PyObject *, const char *)
76+pytalloc_BaseObject_PyType_Ready: int (PyTypeObject *)
77+pytalloc_BaseObject_check: int (PyObject *)
78+pytalloc_BaseObject_size: size_t (void)
79+pytalloc_Check: int (PyObject *)
80+pytalloc_GenericObject_reference_ex: PyObject *(TALLOC_CTX *, void *)
81+pytalloc_GenericObject_steal_ex: PyObject *(TALLOC_CTX *, void *)
82+pytalloc_GetBaseObjectType: PyTypeObject *(void)
83+pytalloc_GetObjectType: PyTypeObject *(void)
84+pytalloc_reference_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
85+pytalloc_steal: PyObject *(PyTypeObject *, void *)
86+pytalloc_steal_ex: PyObject *(PyTypeObject *, TALLOC_CTX *, void *)
87diff --git a/ABI/talloc-2.1.15.sigs b/ABI/talloc-2.1.15.sigs
88new file mode 100644
89index 0000000..9969ce3
90--- /dev/null
91+++ b/ABI/talloc-2.1.15.sigs
92@@ -0,0 +1,65 @@
93+_talloc: void *(const void *, size_t)
94+_talloc_array: void *(const void *, size_t, unsigned int, const char *)
95+_talloc_free: int (void *, const char *)
96+_talloc_get_type_abort: void *(const void *, const char *, const char *)
97+_talloc_memdup: void *(const void *, const void *, size_t, const char *)
98+_talloc_move: void *(const void *, const void *)
99+_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t)
100+_talloc_realloc: void *(const void *, void *, size_t, const char *)
101+_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *)
102+_talloc_reference_loc: void *(const void *, const void *, const char *)
103+_talloc_set_destructor: void (const void *, int (*)(void *))
104+_talloc_steal_loc: void *(const void *, const void *, const char *)
105+_talloc_zero: void *(const void *, size_t, const char *)
106+_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *)
107+talloc_asprintf: char *(const void *, const char *, ...)
108+talloc_asprintf_append: char *(char *, const char *, ...)
109+talloc_asprintf_append_buffer: char *(char *, const char *, ...)
110+talloc_autofree_context: void *(void)
111+talloc_check_name: void *(const void *, const char *)
112+talloc_disable_null_tracking: void (void)
113+talloc_enable_leak_report: void (void)
114+talloc_enable_leak_report_full: void (void)
115+talloc_enable_null_tracking: void (void)
116+talloc_enable_null_tracking_no_autofree: void (void)
117+talloc_find_parent_byname: void *(const void *, const char *)
118+talloc_free_children: void (void *)
119+talloc_get_name: const char *(const void *)
120+talloc_get_size: size_t (const void *)
121+talloc_increase_ref_count: int (const void *)
122+talloc_init: void *(const char *, ...)
123+talloc_is_parent: int (const void *, const void *)
124+talloc_named: void *(const void *, size_t, const char *, ...)
125+talloc_named_const: void *(const void *, size_t, const char *)
126+talloc_parent: void *(const void *)
127+talloc_parent_name: const char *(const void *)
128+talloc_pool: void *(const void *, size_t)
129+talloc_realloc_fn: void *(const void *, void *, size_t)
130+talloc_reference_count: size_t (const void *)
131+talloc_reparent: void *(const void *, const void *, const void *)
132+talloc_report: void (const void *, FILE *)
133+talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *)
134+talloc_report_depth_file: void (const void *, int, int, FILE *)
135+talloc_report_full: void (const void *, FILE *)
136+talloc_set_abort_fn: void (void (*)(const char *))
137+talloc_set_log_fn: void (void (*)(const char *))
138+talloc_set_log_stderr: void (void)
139+talloc_set_memlimit: int (const void *, size_t)
140+talloc_set_name: const char *(const void *, const char *, ...)
141+talloc_set_name_const: void (const void *, const char *)
142+talloc_show_parents: void (const void *, FILE *)
143+talloc_strdup: char *(const void *, const char *)
144+talloc_strdup_append: char *(char *, const char *)
145+talloc_strdup_append_buffer: char *(char *, const char *)
146+talloc_strndup: char *(const void *, const char *, size_t)
147+talloc_strndup_append: char *(char *, const char *, size_t)
148+talloc_strndup_append_buffer: char *(char *, const char *, size_t)
149+talloc_test_get_magic: int (void)
150+talloc_total_blocks: size_t (const void *)
151+talloc_total_size: size_t (const void *)
152+talloc_unlink: int (const void *, void *)
153+talloc_vasprintf: char *(const void *, const char *, va_list)
154+talloc_vasprintf_append: char *(char *, const char *, va_list)
155+talloc_vasprintf_append_buffer: char *(char *, const char *, va_list)
156+talloc_version_major: int (void)
157+talloc_version_minor: int (void)
158diff --git a/ABI/talloc-2.1.16.sigs b/ABI/talloc-2.1.16.sigs
159new file mode 100644
160index 0000000..9969ce3
161--- /dev/null
162+++ b/ABI/talloc-2.1.16.sigs
163@@ -0,0 +1,65 @@
164+_talloc: void *(const void *, size_t)
165+_talloc_array: void *(const void *, size_t, unsigned int, const char *)
166+_talloc_free: int (void *, const char *)
167+_talloc_get_type_abort: void *(const void *, const char *, const char *)
168+_talloc_memdup: void *(const void *, const void *, size_t, const char *)
169+_talloc_move: void *(const void *, const void *)
170+_talloc_pooled_object: void *(const void *, size_t, const char *, unsigned int, size_t)
171+_talloc_realloc: void *(const void *, void *, size_t, const char *)
172+_talloc_realloc_array: void *(const void *, void *, size_t, unsigned int, const char *)
173+_talloc_reference_loc: void *(const void *, const void *, const char *)
174+_talloc_set_destructor: void (const void *, int (*)(void *))
175+_talloc_steal_loc: void *(const void *, const void *, const char *)
176+_talloc_zero: void *(const void *, size_t, const char *)
177+_talloc_zero_array: void *(const void *, size_t, unsigned int, const char *)
178+talloc_asprintf: char *(const void *, const char *, ...)
179+talloc_asprintf_append: char *(char *, const char *, ...)
180+talloc_asprintf_append_buffer: char *(char *, const char *, ...)
181+talloc_autofree_context: void *(void)
182+talloc_check_name: void *(const void *, const char *)
183+talloc_disable_null_tracking: void (void)
184+talloc_enable_leak_report: void (void)
185+talloc_enable_leak_report_full: void (void)
186+talloc_enable_null_tracking: void (void)
187+talloc_enable_null_tracking_no_autofree: void (void)
188+talloc_find_parent_byname: void *(const void *, const char *)
189+talloc_free_children: void (void *)
190+talloc_get_name: const char *(const void *)
191+talloc_get_size: size_t (const void *)
192+talloc_increase_ref_count: int (const void *)
193+talloc_init: void *(const char *, ...)
194+talloc_is_parent: int (const void *, const void *)
195+talloc_named: void *(const void *, size_t, const char *, ...)
196+talloc_named_const: void *(const void *, size_t, const char *)
197+talloc_parent: void *(const void *)
198+talloc_parent_name: const char *(const void *)
199+talloc_pool: void *(const void *, size_t)
200+talloc_realloc_fn: void *(const void *, void *, size_t)
201+talloc_reference_count: size_t (const void *)
202+talloc_reparent: void *(const void *, const void *, const void *)
203+talloc_report: void (const void *, FILE *)
204+talloc_report_depth_cb: void (const void *, int, int, void (*)(const void *, int, int, int, void *), void *)
205+talloc_report_depth_file: void (const void *, int, int, FILE *)
206+talloc_report_full: void (const void *, FILE *)
207+talloc_set_abort_fn: void (void (*)(const char *))
208+talloc_set_log_fn: void (void (*)(const char *))
209+talloc_set_log_stderr: void (void)
210+talloc_set_memlimit: int (const void *, size_t)
211+talloc_set_name: const char *(const void *, const char *, ...)
212+talloc_set_name_const: void (const void *, const char *)
213+talloc_show_parents: void (const void *, FILE *)
214+talloc_strdup: char *(const void *, const char *)
215+talloc_strdup_append: char *(char *, const char *)
216+talloc_strdup_append_buffer: char *(char *, const char *)
217+talloc_strndup: char *(const void *, const char *, size_t)
218+talloc_strndup_append: char *(char *, const char *, size_t)
219+talloc_strndup_append_buffer: char *(char *, const char *, size_t)
220+talloc_test_get_magic: int (void)
221+talloc_total_blocks: size_t (const void *)
222+talloc_total_size: size_t (const void *)
223+talloc_unlink: int (const void *, void *)
224+talloc_vasprintf: char *(const void *, const char *, va_list)
225+talloc_vasprintf_append: char *(char *, const char *, va_list)
226+talloc_vasprintf_append_buffer: char *(char *, const char *, va_list)
227+talloc_version_major: int (void)
228+talloc_version_minor: int (void)
229diff --git a/Makefile b/Makefile
230index 4c28653..db2275c 100644
231--- a/Makefile
232+++ b/Makefile
233@@ -1,6 +1,8 @@
234 # simple makefile wrapper to run waf
235
236-WAF=WAF_MAKE=1 PATH=buildtools/bin:../../buildtools/bin:$$PATH waf
237+WAF_BIN=`PATH=buildtools/bin:../../buildtools/bin:$$PATH which waf`
238+WAF_BINARY=$(PYTHON) $(WAF_BIN)
239+WAF=PYTHONHASHSEED=1 WAF_MAKE=1 $(WAF_BINARY)
240
241 all:
242 $(WAF) build
243diff --git a/buildtools/bin/waf b/buildtools/bin/waf
244index 1b0f466..3ee4d5b 100755
245--- a/buildtools/bin/waf
246+++ b/buildtools/bin/waf
247@@ -1,7 +1,7 @@
248-#!/usr/bin/env python
249-# encoding: ISO-8859-1
250-# Thomas Nagy, 2005-2010
251-
252+#!/usr/bin/env python3
253+# encoding: latin-1
254+# Thomas Nagy, 2005-2018
255+#
256 """
257 Redistribution and use in source and binary forms, with or without
258 modification, are permitted provided that the following conditions
259@@ -30,25 +30,24 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
260 POSSIBILITY OF SUCH DAMAGE.
261 """
262
263-import os, sys
264-if sys.hexversion<0x203000f: raise ImportError("Waf requires Python >= 2.3")
265-
266-if 'PSYCOWAF' in os.environ:
267- try:import psyco;psyco.full()
268- except:pass
269+import os, sys, inspect
270
271-VERSION="1.5.19"
272+VERSION="2.0.8"
273 REVISION="x"
274+GIT="x"
275 INSTALL="x"
276 C1='x'
277 C2='x'
278+C3='x'
279 cwd = os.getcwd()
280 join = os.path.join
281
282+if sys.hexversion<0x206000f:
283+ raise ImportError('Python >= 2.6 is required to create the waf file')
284+
285 WAF='waf'
286 def b(x):
287 return x
288-
289 if sys.hexversion>0x300000f:
290 WAF='waf3'
291 def b(x):
292@@ -58,20 +57,111 @@ def err(m):
293 print(('\033[91mError: %s\033[0m' % m))
294 sys.exit(1)
295
296-def test(dir):
297- try: os.stat(join(dir, 'wafadmin')); return os.path.abspath(dir)
298+def unpack_wafdir(dir, src):
299+ f = open(src,'rb')
300+ c = 'corrupt archive (%d)'
301+ while 1:
302+ line = f.readline()
303+ if not line: err('run waf-light from a folder containing waflib')
304+ if line == b('#==>\n'):
305+ txt = f.readline()
306+ if not txt: err(c % 1)
307+ if f.readline() != b('#<==\n'): err(c % 2)
308+ break
309+ if not txt: err(c % 3)
310+ txt = txt[1:-1].replace(b(C1), b('\n')).replace(b(C2), b('\r')).replace(b(C3), b('\x00'))
311+
312+ import shutil, tarfile
313+ try: shutil.rmtree(dir)
314 except OSError: pass
315+ try:
316+ for x in ('Tools', 'extras'):
317+ os.makedirs(join(dir, 'waflib', x))
318+ except OSError:
319+ err("Cannot unpack waf lib into %s\nMove waf in a writable directory" % dir)
320+
321+ os.chdir(dir)
322+ tmp = 't.bz2'
323+ t = open(tmp,'wb')
324+ try: t.write(txt)
325+ finally: t.close()
326+
327+ try:
328+ t = tarfile.open(tmp)
329+ except:
330+ try:
331+ os.system('bunzip2 t.bz2')
332+ t = tarfile.open('t')
333+ tmp = 't'
334+ except:
335+ os.chdir(cwd)
336+ try: shutil.rmtree(dir)
337+ except OSError: pass
338+ err("Waf cannot be unpacked, check that bzip2 support is present")
339+
340+ try:
341+ for x in t: t.extract(x)
342+ finally:
343+ t.close()
344+
345+ for x in ('Tools', 'extras'):
346+ os.chmod(join('waflib',x), 493)
347+
348+ if sys.hexversion<0x300000f:
349+ sys.path = [join(dir, 'waflib')] + sys.path
350+ import fixpy2
351+ fixpy2.fixdir(dir)
352+
353+ os.remove(tmp)
354+ os.chdir(cwd)
355+
356+ try: dir = unicode(dir, 'mbcs')
357+ except: pass
358+ try:
359+ from ctypes import windll
360+ windll.kernel32.SetFileAttributesW(dir, 2)
361+ except:
362+ pass
363+
364+def test(dir):
365+ try:
366+ os.stat(join(dir, 'waflib'))
367+ return os.path.abspath(dir)
368+ except OSError:
369+ pass
370
371 def find_lib():
372- return os.path.abspath(os.path.join(os.path.dirname(__file__), '../../third_party/waf'))
373+ path = '../../third_party/waf'
374+ paths = [path, path+'/waflib']
375+ return [os.path.abspath(os.path.join(os.path.dirname(__file__), x)) for x in paths]
376
377 wafdir = find_lib()
378-w = join(wafdir, 'wafadmin')
379-t = join(w, 'Tools')
380-f = join(w, '3rdparty')
381-sys.path = [w, t, f] + sys.path
382+for p in wafdir:
383+ sys.path.insert(0, p)
384
385 if __name__ == '__main__':
386- import Scripting
387- Scripting.prepare(t, cwd, VERSION, wafdir)
388+ #import extras.compat15#PRELUDE
389+ import sys
390+
391+ from waflib.Tools import ccroot, c, ar, compiler_c, gcc
392+ sys.modules['cc'] = c
393+ sys.modules['ccroot'] = ccroot
394+ sys.modules['ar'] = ar
395+ sys.modules['compiler_cc'] = compiler_c
396+ sys.modules['gcc'] = gcc
397+
398+ from waflib import Options
399+ Options.lockfile = os.environ.get('WAFLOCK', '.lock-wscript')
400+ if os.path.isfile(Options.lockfile) and os.stat(Options.lockfile).st_size == 0:
401+ os.environ['NOCLIMB'] = "1"
402+ # there is a single top-level, but libraries must build independently
403+ os.environ['NO_LOCK_IN_TOP'] = "1"
404+
405+ from waflib import Task
406+ class o(object):
407+ display = None
408+ Task.classes['cc_link'] = o
409+
410+ from waflib import Scripting
411+ Scripting.waf_entry_point(cwd, VERSION, wafdir[0])
412
413diff --git a/buildtools/examples/run_on_target.py b/buildtools/examples/run_on_target.py
414index 8322759..79c5730 100755
415--- a/buildtools/examples/run_on_target.py
416+++ b/buildtools/examples/run_on_target.py
417@@ -1,4 +1,4 @@
418-#!/usr/bin/env python
419+#!/usr/bin/env python3
420
421 #
422 # Sample run-on-target script
423diff --git a/buildtools/scripts/abi_gen.sh b/buildtools/scripts/abi_gen.sh
424index 787718c..6dd6d32 100755
425--- a/buildtools/scripts/abi_gen.sh
426+++ b/buildtools/scripts/abi_gen.sh
427@@ -17,5 +17,5 @@ done
428 ) > $GDBSCRIPT
429
430 # forcing the terminal avoids a problem on Fedora12
431-TERM=none gdb -batch -x $GDBSCRIPT "$SHAREDLIB" < /dev/null
432+TERM=none gdb -n -batch -x $GDBSCRIPT "$SHAREDLIB" < /dev/null
433 rm -f $GDBSCRIPT
434diff --git a/buildtools/wafsamba/configure_file.py b/buildtools/wafsamba/configure_file.py
435index e28282b..6ad4354 100644
436--- a/buildtools/wafsamba/configure_file.py
437+++ b/buildtools/wafsamba/configure_file.py
438@@ -1,7 +1,9 @@
439 # handle substitution of variables in .in files
440
441-import re, os
442-import Build, sys, Logs
443+import sys
444+import re
445+import os
446+from waflib import Build, Logs
447 from samba_utils import SUBST_VARS_RECURSIVE
448
449 def subst_at_vars(task):
450diff --git a/buildtools/wafsamba/generic_cc.py b/buildtools/wafsamba/generic_cc.py
451index 504e902..1352c54 100644
452--- a/buildtools/wafsamba/generic_cc.py
453+++ b/buildtools/wafsamba/generic_cc.py
454@@ -3,69 +3,68 @@
455 # based on suncc.py from waf
456
457 import os, optparse
458-import Utils, Options, Configure
459-import ccroot, ar
460-from Configure import conftest
461+from waflib import Errors
462+from waflib.Tools import ccroot, ar
463+from waflib.Configure import conf
464
465-from compiler_cc import c_compiler
466+#
467+# Let waflib provide useful defaults, but
468+# provide generic_cc as last resort fallback on
469+# all platforms
470+#
471+from waflib.Tools.compiler_c import c_compiler
472+for key in c_compiler.keys():
473+ c_compiler[key].append('generic_cc')
474
475-c_compiler['default'] = ['gcc', 'generic_cc']
476-c_compiler['hpux'] = ['gcc', 'generic_cc']
477-
478-@conftest
479+@conf
480 def find_generic_cc(conf):
481 v = conf.env
482 cc = None
483- if v['CC']: cc = v['CC']
484- elif 'CC' in conf.environ: cc = conf.environ['CC']
485- if not cc: cc = conf.find_program('cc', var='CC')
486- if not cc: conf.fatal('generic_cc was not found')
487- cc = conf.cmd_to_list(cc)
488- v['CC'] = cc
489- v['CC_NAME'] = 'generic'
490-
491-@conftest
492-def generic_cc_common_flags(conf):
493- v = conf.env
494+ if v.CC:
495+ cc = v.CC
496+ elif 'CC' in conf.environ:
497+ cc = conf.environ['CC']
498+ if not cc:
499+ cc = conf.find_program('cc', var='CC')
500+ if not cc:
501+ conf.fatal('generic_cc was not found')
502
503- v['CC_SRC_F'] = ''
504- v['CC_TGT_F'] = ['-c', '-o', '']
505- v['CPPPATH_ST'] = '-I%s' # template for adding include paths
506+ try:
507+ conf.cmd_and_log(cc + ['--version'])
508+ except Errors.WafError:
509+ conf.fatal('%r --version could not be executed' % cc)
510
511- # linker
512- if not v['LINK_CC']: v['LINK_CC'] = v['CC']
513- v['CCLNK_SRC_F'] = ''
514- v['CCLNK_TGT_F'] = ['-o', '']
515+ v.CC = cc
516+ v.CC_NAME = 'generic_cc'
517
518- v['LIB_ST'] = '-l%s' # template for adding libs
519- v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
520- v['STATICLIB_ST'] = '-l%s'
521- v['STATICLIBPATH_ST'] = '-L%s'
522- v['CCDEFINES_ST'] = '-D%s'
523+@conf
524+def generic_cc_common_flags(conf):
525+ v = conf.env
526
527-# v['SONAME_ST'] = '-Wl,-h -Wl,%s'
528-# v['SHLIB_MARKER'] = '-Bdynamic'
529-# v['STATICLIB_MARKER'] = '-Bstatic'
530+ v.CC_SRC_F = ''
531+ v.CC_TGT_F = ['-c', '-o']
532+ v.CPPPATH_ST = '-I%s'
533+ v.DEFINES_ST = '-D%s'
534
535- # program
536- v['program_PATTERN'] = '%s'
537+ if not v.LINK_CC:
538+ v.LINK_CC = v.CC
539
540- # shared library
541-# v['shlib_CCFLAGS'] = ['-Kpic', '-DPIC']
542-# v['shlib_LINKFLAGS'] = ['-G']
543- v['shlib_PATTERN'] = 'lib%s.so'
544+ v.CCLNK_SRC_F = ''
545+ v.CCLNK_TGT_F = ['-o']
546
547- # static lib
548-# v['staticlib_LINKFLAGS'] = ['-Bstatic']
549-# v['staticlib_PATTERN'] = 'lib%s.a'
550+ v.LIB_ST = '-l%s' # template for adding libs
551+ v.LIBPATH_ST = '-L%s' # template for adding libpaths
552+ v.STLIB_ST = '-l%s'
553+ v.STLIBPATH_ST = '-L%s'
554
555-detect = '''
556-find_generic_cc
557-find_cpp
558-find_ar
559-generic_cc_common_flags
560-cc_load_tools
561-cc_add_flags
562-link_add_flags
563-'''
564+ v.cprogram_PATTERN = '%s'
565+ v.cshlib_PATTERN = 'lib%s.so'
566+ v.cstlib_PATTERN = 'lib%s.a'
567
568+def configure(conf):
569+ conf.find_generic_cc()
570+ conf.find_ar()
571+ conf.generic_cc_common_flags()
572+ conf.cc_load_tools()
573+ conf.cc_add_flags()
574+ conf.link_add_flags()
575diff --git a/buildtools/wafsamba/hpuxcc.py b/buildtools/wafsamba/hpuxcc.py
576deleted file mode 100644
577index c263556..0000000
578--- a/buildtools/wafsamba/hpuxcc.py
579+++ /dev/null
580@@ -1,56 +0,0 @@
581-# compiler definition for HPUX
582-# based on suncc.py from waf
583-
584-import os, optparse, sys
585-import Utils, Options, Configure
586-import ccroot, ar
587-from Configure import conftest
588-import gcc
589-
590-
591-@conftest
592-def gcc_modifier_hpux(conf):
593- v=conf.env
594- v['CCFLAGS_DEBUG']=['-g']
595- v['CCFLAGS_RELEASE']=['-O2']
596- v['CC_SRC_F']=''
597- v['CC_TGT_F']=['-c','-o','']
598- v['CPPPATH_ST']='-I%s'
599- if not v['LINK_CC']:v['LINK_CC']=v['CC']
600- v['CCLNK_SRC_F']=''
601- v['CCLNK_TGT_F']=['-o','']
602- v['LIB_ST']='-l%s'
603- v['LIBPATH_ST']='-L%s'
604- v['STATICLIB_ST']='-l%s'
605- v['STATICLIBPATH_ST']='-L%s'
606- v['RPATH_ST']='-Wl,-rpath,%s'
607- v['CCDEFINES_ST']='-D%s'
608- v['SONAME_ST']='-Wl,-h,%s'
609- v['SHLIB_MARKER']=[]
610-# v['STATICLIB_MARKER']='-Wl,-Bstatic'
611- v['FULLSTATIC_MARKER']='-static'
612- v['program_PATTERN']='%s'
613- v['shlib_CCFLAGS']=['-fPIC','-DPIC']
614- v['shlib_LINKFLAGS']=['-shared']
615- v['shlib_PATTERN']='lib%s.sl'
616-# v['staticlib_LINKFLAGS']=['-Wl,-Bstatic']
617- v['staticlib_PATTERN']='lib%s.a'
618-
619-gcc.gcc_modifier_hpux = gcc_modifier_hpux
620-
621-from TaskGen import feature, after
622-@feature('cprogram', 'cshlib')
623-@after('apply_link', 'apply_lib_vars', 'apply_obj_vars')
624-def hpux_addfullpath(self):
625- if sys.platform == 'hp-ux11':
626- link = getattr(self, 'link_task', None)
627- if link:
628- lst = link.env.LINKFLAGS
629- buf = []
630- for x in lst:
631- if x.startswith('-L'):
632- p2 = x[2:]
633- if not os.path.isabs(p2):
634- x = x[:2] + self.bld.srcnode.abspath(link.env) + "/../" + x[2:].lstrip('.')
635- buf.append(x)
636- link.env.LINKFLAGS = buf
637diff --git a/buildtools/wafsamba/irixcc.py b/buildtools/wafsamba/irixcc.py
638deleted file mode 100644
639index f3cb451..0000000
640--- a/buildtools/wafsamba/irixcc.py
641+++ /dev/null
642@@ -1,79 +0,0 @@
643-
644-# compiler definition for irix/MIPSpro cc compiler
645-# based on suncc.py from waf
646-
647-import os, optparse
648-import Utils, Options, Configure
649-import ccroot, ar
650-from Configure import conftest
651-
652-from compiler_cc import c_compiler
653-
654-c_compiler['irix'] = ['gcc', 'irixcc']
655-
656-@conftest
657-def find_irixcc(conf):
658- v = conf.env
659- cc = None
660- if v['CC']: cc = v['CC']
661- elif 'CC' in conf.environ: cc = conf.environ['CC']
662- if not cc: cc = conf.find_program('cc', var='CC')
663- if not cc: conf.fatal('irixcc was not found')
664- cc = conf.cmd_to_list(cc)
665-
666- try:
667- if Utils.cmd_output(cc + ['-c99'] + ['-version']) != '':
668- conf.fatal('irixcc %r was not found' % cc)
669- except ValueError:
670- conf.fatal('irixcc -v could not be executed')
671-
672- conf.env.append_unique('CCFLAGS', '-c99')
673-
674- v['CC'] = cc
675- v['CC_NAME'] = 'irix'
676-
677-@conftest
678-def irixcc_common_flags(conf):
679- v = conf.env
680-
681- v['CC_SRC_F'] = ''
682- v['CC_TGT_F'] = ['-c', '-o', '']
683- v['CPPPATH_ST'] = '-I%s' # template for adding include paths
684-
685- # linker
686- if not v['LINK_CC']: v['LINK_CC'] = v['CC']
687- v['CCLNK_SRC_F'] = ''
688- v['CCLNK_TGT_F'] = ['-o', '']
689-
690- v['LIB_ST'] = '-l%s' # template for adding libs
691- v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
692- v['STATICLIB_ST'] = '-l%s'
693- v['STATICLIBPATH_ST'] = '-L%s'
694- v['CCDEFINES_ST'] = '-D%s'
695-
696-# v['SONAME_ST'] = '-Wl,-h -Wl,%s'
697-# v['SHLIB_MARKER'] = '-Bdynamic'
698-# v['STATICLIB_MARKER'] = '-Bstatic'
699-
700- # program
701- v['program_PATTERN'] = '%s'
702-
703- # shared library
704-# v['shlib_CCFLAGS'] = ['-Kpic', '-DPIC']
705-# v['shlib_LINKFLAGS'] = ['-G']
706- v['shlib_PATTERN'] = 'lib%s.so'
707-
708- # static lib
709-# v['staticlib_LINKFLAGS'] = ['-Bstatic']
710-# v['staticlib_PATTERN'] = 'lib%s.a'
711-
712-detect = '''
713-find_irixcc
714-find_cpp
715-find_ar
716-irixcc_common_flags
717-cc_load_tools
718-cc_add_flags
719-link_add_flags
720-'''
721-
722diff --git a/buildtools/wafsamba/nothreads.py b/buildtools/wafsamba/nothreads.py
723deleted file mode 100644
724index 9bd33e8..0000000
725--- a/buildtools/wafsamba/nothreads.py
726+++ /dev/null
727@@ -1,219 +0,0 @@
728-# encoding: utf-8
729-# Thomas Nagy, 2005-2008 (ita)
730-
731-# this replaces the core of Runner.py in waf with a varient that works
732-# on systems with completely broken threading (such as Python 2.5.x on
733-# AIX). For simplicity we enable this when JOBS=1, which is triggered
734-# by the compatibility makefile used for the waf build. That also ensures
735-# this code is tested, as it means it is used in the build farm, and by
736-# anyone using 'make' to build Samba with waf
737-
738-"Execute the tasks"
739-
740-import sys, random, threading
741-try: from Queue import Queue
742-except ImportError: from queue import Queue
743-import Utils, Options
744-from Constants import EXCEPTION, CRASHED, MAXJOBS, ASK_LATER, SKIPPED, SKIP_ME, SUCCESS
745-
746-GAP = 15
747-
748-run_old = threading.Thread.run
749-def run(*args, **kwargs):
750- try:
751- run_old(*args, **kwargs)
752- except (KeyboardInterrupt, SystemExit):
753- raise
754- except:
755- sys.excepthook(*sys.exc_info())
756-threading.Thread.run = run
757-
758-
759-class TaskConsumer(object):
760- consumers = 1
761-
762-def process(tsk):
763- m = tsk.master
764- if m.stop:
765- m.out.put(tsk)
766- return
767-
768- try:
769- tsk.generator.bld.printout(tsk.display())
770- if tsk.__class__.stat: ret = tsk.__class__.stat(tsk)
771- # actual call to task's run() function
772- else: ret = tsk.call_run()
773- except Exception as e:
774- tsk.err_msg = Utils.ex_stack()
775- tsk.hasrun = EXCEPTION
776-
777- # TODO cleanup
778- m.error_handler(tsk)
779- m.out.put(tsk)
780- return
781-
782- if ret:
783- tsk.err_code = ret
784- tsk.hasrun = CRASHED
785- else:
786- try:
787- tsk.post_run()
788- except Utils.WafError:
789- pass
790- except Exception:
791- tsk.err_msg = Utils.ex_stack()
792- tsk.hasrun = EXCEPTION
793- else:
794- tsk.hasrun = SUCCESS
795- if tsk.hasrun != SUCCESS:
796- m.error_handler(tsk)
797-
798- m.out.put(tsk)
799-
800-class Parallel(object):
801- """
802- keep the consumer threads busy, and avoid consuming cpu cycles
803- when no more tasks can be added (end of the build, etc)
804- """
805- def __init__(self, bld, j=2):
806-
807- # number of consumers
808- self.numjobs = j
809-
810- self.manager = bld.task_manager
811- self.manager.current_group = 0
812-
813- self.total = self.manager.total()
814-
815- # tasks waiting to be processed - IMPORTANT
816- self.outstanding = []
817- self.maxjobs = MAXJOBS
818-
819- # tasks that are awaiting for another task to complete
820- self.frozen = []
821-
822- # tasks returned by the consumers
823- self.out = Queue(0)
824-
825- self.count = 0 # tasks not in the producer area
826-
827- self.processed = 1 # progress indicator
828-
829- self.stop = False # error condition to stop the build
830- self.error = False # error flag
831-
832- def get_next(self):
833- "override this method to schedule the tasks in a particular order"
834- if not self.outstanding:
835- return None
836- return self.outstanding.pop(0)
837-
838- def postpone(self, tsk):
839- "override this method to schedule the tasks in a particular order"
840- # TODO consider using a deque instead
841- if random.randint(0, 1):
842- self.frozen.insert(0, tsk)
843- else:
844- self.frozen.append(tsk)
845-
846- def refill_task_list(self):
847- "called to set the next group of tasks"
848-
849- while self.count > self.numjobs + GAP or self.count >= self.maxjobs:
850- self.get_out()
851-
852- while not self.outstanding:
853- if self.count:
854- self.get_out()
855-
856- if self.frozen:
857- self.outstanding += self.frozen
858- self.frozen = []
859- elif not self.count:
860- (jobs, tmp) = self.manager.get_next_set()
861- if jobs is not None:
862- self.maxjobs = jobs
863- if tmp:
864- self.outstanding += tmp
865- break
866-
867- def get_out(self):
868- "the tasks that are put to execute are all collected using get_out"
869- ret = self.out.get()
870- self.manager.add_finished(ret)
871- if not self.stop and getattr(ret, 'more_tasks', None):
872- self.outstanding += ret.more_tasks
873- self.total += len(ret.more_tasks)
874- self.count -= 1
875-
876- def error_handler(self, tsk):
877- "by default, errors make the build stop (not thread safe so be careful)"
878- if not Options.options.keep:
879- self.stop = True
880- self.error = True
881-
882- def start(self):
883- "execute the tasks"
884-
885- while not self.stop:
886-
887- self.refill_task_list()
888-
889- # consider the next task
890- tsk = self.get_next()
891- if not tsk:
892- if self.count:
893- # tasks may add new ones after they are run
894- continue
895- else:
896- # no tasks to run, no tasks running, time to exit
897- break
898-
899- if tsk.hasrun:
900- # if the task is marked as "run", just skip it
901- self.processed += 1
902- self.manager.add_finished(tsk)
903- continue
904-
905- try:
906- st = tsk.runnable_status()
907- except Exception as e:
908- self.processed += 1
909- if self.stop and not Options.options.keep:
910- tsk.hasrun = SKIPPED
911- self.manager.add_finished(tsk)
912- continue
913- self.error_handler(tsk)
914- self.manager.add_finished(tsk)
915- tsk.hasrun = EXCEPTION
916- tsk.err_msg = Utils.ex_stack()
917- continue
918-
919- if st == ASK_LATER:
920- self.postpone(tsk)
921- elif st == SKIP_ME:
922- self.processed += 1
923- tsk.hasrun = SKIPPED
924- self.manager.add_finished(tsk)
925- else:
926- # run me: put the task in ready queue
927- tsk.position = (self.processed, self.total)
928- self.count += 1
929- self.processed += 1
930- tsk.master = self
931-
932- process(tsk)
933-
934- # self.count represents the tasks that have been made available to the consumer threads
935- # collect all the tasks after an error else the message may be incomplete
936- while self.error and self.count:
937- self.get_out()
938-
939- #print loop
940- assert (self.count == 0 or self.stop)
941-
942-
943-# enable nothreads
944-import Runner
945-Runner.process = process
946-Runner.Parallel = Parallel
947diff --git a/buildtools/wafsamba/pkgconfig.py b/buildtools/wafsamba/pkgconfig.py
948index 999bad4..b83d5f3 100644
949--- a/buildtools/wafsamba/pkgconfig.py
950+++ b/buildtools/wafsamba/pkgconfig.py
951@@ -1,7 +1,7 @@
952 # handle substitution of variables in pc files
953
954 import os, re, sys
955-import Build, Logs
956+from waflib import Build, Logs
957 from samba_utils import SUBST_VARS_RECURSIVE, TO_LIST
958
959 def subst_at_vars(task):
960@@ -52,7 +52,7 @@ def PKG_CONFIG_FILES(bld, pc_files, vnum=None, extra_name=None):
961 rule=subst_at_vars,
962 source=f+'.in',
963 target=target)
964- bld.add_manual_dependency(bld.path.find_or_declare(f), bld.env['PREFIX'])
965+ bld.add_manual_dependency(bld.path.find_or_declare(f), bld.env['PREFIX'].encode('utf8'))
966 t.vars = []
967 if t.env.RPATH_ON_INSTALL:
968 t.env.LIB_RPATH = t.env.RPATH_ST % t.env.LIBDIR
969diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
970index 44daff9..5aab250 100644
971--- a/buildtools/wafsamba/samba3.py
972+++ b/buildtools/wafsamba/samba3.py
973@@ -1,12 +1,11 @@
974 # a waf tool to add autoconf-like macros to the configure section
975 # and for SAMBA_ macros for building libraries, binaries etc
976
977-import Options, Build, os
978-from samba_utils import os_path_relpath, TO_LIST, samba_add_onoff_option
979+import os
980+from waflib import Build
981+from samba_utils import os_path_relpath, TO_LIST
982 from samba_autoconf import library_flags
983
984-Options.Handler.SAMBA3_ADD_OPTION = samba_add_onoff_option
985-
986 def SAMBA3_IS_STATIC_MODULE(bld, module):
987 '''Check whether module is in static list'''
988 if module in bld.env['static_modules']:
989@@ -32,7 +31,7 @@ def s3_fix_kwargs(bld, kwargs):
990 '''fix the build arguments for s3 build rules to include the
991 necessary includes, subdir and cflags options '''
992 s3dir = os.path.join(bld.env.srcdir, 'source3')
993- s3reldir = os_path_relpath(s3dir, bld.curdir)
994+ s3reldir = os_path_relpath(s3dir, bld.path.abspath())
995
996 # the extra_includes list is relative to the source3 directory
997 extra_includes = [ '.', 'include', 'lib' ]
998diff --git a/buildtools/wafsamba/samba_abi.py b/buildtools/wafsamba/samba_abi.py
999index 196b468..5e7686d 100644
1000--- a/buildtools/wafsamba/samba_abi.py
1001+++ b/buildtools/wafsamba/samba_abi.py
1002@@ -1,7 +1,13 @@
1003 # functions for handling ABI checking of libraries
1004
1005-import Options, Utils, os, Logs, samba_utils, sys, Task, fnmatch, re, Build
1006-from TaskGen import feature, before, after
1007+import os
1008+import sys
1009+import re
1010+import fnmatch
1011+
1012+from waflib import Options, Utils, Logs, Task, Build, Errors
1013+from waflib.TaskGen import feature, before, after
1014+from wafsamba import samba_utils
1015
1016 # these type maps cope with platform specific names for common types
1017 # please add new type mappings into the list below
1018@@ -10,7 +16,7 @@ abi_type_maps = {
1019 'struct __va_list_tag *' : 'va_list'
1020 }
1021
1022-version_key = lambda x: map(int, x.split("."))
1023+version_key = lambda x: list(map(int, x.split(".")))
1024
1025 def normalise_signature(sig):
1026 '''normalise a signature from gdb'''
1027@@ -79,7 +85,7 @@ def abi_check_task(self):
1028 libpath = self.inputs[0].abspath(self.env)
1029 libname = os.path.basename(libpath)
1030
1031- sigs = Utils.cmd_output([abi_gen, libpath])
1032+ sigs = samba_utils.get_string(Utils.cmd_output([abi_gen, libpath]))
1033 parsed_sigs = parse_sigs(sigs, self.ABI_MATCH)
1034
1035 sig_file = self.ABI_FILE
1036@@ -87,7 +93,7 @@ def abi_check_task(self):
1037 old_sigs = samba_utils.load_file(sig_file)
1038 if old_sigs is None or Options.options.ABI_UPDATE:
1039 if not save_sigs(sig_file, parsed_sigs):
1040- raise Utils.WafError('Failed to save ABI file "%s"' % sig_file)
1041+ raise Errors.WafError('Failed to save ABI file "%s"' % sig_file)
1042 Logs.warn('Generated ABI signatures %s' % sig_file)
1043 return
1044
1045@@ -112,14 +118,14 @@ def abi_check_task(self):
1046 got_error = True
1047
1048 if got_error:
1049- raise Utils.WafError('ABI for %s has changed - please fix library version then build with --abi-update\nSee http://wiki.samba.org/index.php/Waf#ABI_Checking for more information\nIf you have not changed any ABI, and your platform always gives this error, please configure with --abi-check-disable to skip this check' % libname)
1050+ raise Errors.WafError('ABI for %s has changed - please fix library version then build with --abi-update\nSee http://wiki.samba.org/index.php/Waf#ABI_Checking for more information\nIf you have not changed any ABI, and your platform always gives this error, please configure with --abi-check-disable to skip this check' % libname)
1051
1052
1053-t = Task.task_type_from_func('abi_check', abi_check_task, color='BLUE', ext_in='.bin')
1054+t = Task.task_factory('abi_check', abi_check_task, color='BLUE', ext_in='.bin')
1055 t.quiet = True
1056 # allow "waf --abi-check" to force re-checking the ABI
1057 if '--abi-check' in sys.argv:
1058- Task.always_run(t)
1059+ t.always_run = True
1060
1061 @after('apply_link')
1062 @feature('abi_check')
1063@@ -184,18 +190,20 @@ def abi_write_vscript(f, libname, current_version, versions, symmap, abi_match):
1064 f.write("}%s;\n\n" % last_key)
1065 last_key = " %s" % symver
1066 f.write("%s {\n" % current_version)
1067- local_abi = filter(lambda x: x[0] == '!', abi_match)
1068- global_abi = filter(lambda x: x[0] != '!', abi_match)
1069+ local_abi = list(filter(lambda x: x[0] == '!', abi_match))
1070+ global_abi = list(filter(lambda x: x[0] != '!', abi_match))
1071 f.write("\tglobal:\n")
1072 if len(global_abi) > 0:
1073 for x in global_abi:
1074 f.write("\t\t%s;\n" % x)
1075 else:
1076 f.write("\t\t*;\n")
1077- if abi_match != ["*"]:
1078- f.write("\tlocal:\n")
1079- for x in local_abi:
1080- f.write("\t\t%s;\n" % x[1:])
1081+ # Always hide symbols that must be local if exist
1082+ local_abi.extend(["!_end", "!__bss_start", "!_edata"])
1083+ f.write("\tlocal:\n")
1084+ for x in local_abi:
1085+ f.write("\t\t%s;\n" % x[1:])
1086+ if global_abi != ["*"]:
1087 if len(global_abi) > 0:
1088 f.write("\t\t*;\n")
1089 f.write("};\n")
1090diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
1091index c4391d0..ee1fc23 100644
1092--- a/buildtools/wafsamba/samba_autoconf.py
1093+++ b/buildtools/wafsamba/samba_autoconf.py
1094@@ -1,9 +1,10 @@
1095 # a waf tool to add autoconf-like macros to the configure section
1096
1097 import os, sys
1098-import Build, Options, preproc, Logs
1099-from Configure import conf
1100-from TaskGen import feature
1101+from waflib import Build, Options, Logs, Context
1102+from waflib.Configure import conf
1103+from waflib.TaskGen import feature
1104+from waflib.Tools import c_preproc as preproc
1105 from samba_utils import TO_LIST, GET_TARGET_TYPE, SET_TARGET_TYPE, unique_list, mkdir_p
1106
1107 missing_headers = set()
1108@@ -18,7 +19,7 @@ def DEFINE(conf, d, v, add_to_cflags=False, quote=False):
1109 '''define a config option'''
1110 conf.define(d, v, quote=quote)
1111 if add_to_cflags:
1112- conf.env.append_value('CCDEFINES', d + '=' + str(v))
1113+ conf.env.append_value('CFLAGS', '-D%s=%s' % (d, str(v)))
1114
1115 def hlist_to_string(conf, headers=None):
1116 '''convert a headers list to a set of #include lines'''
1117@@ -44,11 +45,11 @@ def COMPOUND_START(conf, msg):
1118 if v != [] and v != 0:
1119 conf.env.in_compound = v + 1
1120 return
1121- conf.check_message_1(msg)
1122- conf.saved_check_message_1 = conf.check_message_1
1123- conf.check_message_1 = null_check_message_1
1124- conf.saved_check_message_2 = conf.check_message_2
1125- conf.check_message_2 = null_check_message_2
1126+ conf.start_msg(msg)
1127+ conf.saved_check_message_1 = conf.start_msg
1128+ conf.start_msg = null_check_message_1
1129+ conf.saved_check_message_2 = conf.end_msg
1130+ conf.end_msg = null_check_message_2
1131 conf.env.in_compound = 1
1132
1133
1134@@ -58,9 +59,9 @@ def COMPOUND_END(conf, result):
1135 conf.env.in_compound -= 1
1136 if conf.env.in_compound != 0:
1137 return
1138- conf.check_message_1 = conf.saved_check_message_1
1139- conf.check_message_2 = conf.saved_check_message_2
1140- p = conf.check_message_2
1141+ conf.start_msg = conf.saved_check_message_1
1142+ conf.end_msg = conf.saved_check_message_2
1143+ p = conf.end_msg
1144 if result is True:
1145 p('ok')
1146 elif not result:
1147@@ -96,10 +97,10 @@ def CHECK_HEADER(conf, h, add_headers=False, lib=None):
1148 hdrs = hlist_to_string(conf, headers=h)
1149 if lib is None:
1150 lib = ""
1151- ret = conf.check(fragment='%s\nint main(void) { return 0; }' % hdrs,
1152+ ret = conf.check(fragment='%s\nint main(void) { return 0; }\n' % hdrs,
1153 type='nolink',
1154 execute=0,
1155- ccflags=ccflags,
1156+ cflags=ccflags,
1157 mandatory=False,
1158 includes=cpppath,
1159 uselib=lib.upper(),
1160@@ -250,7 +251,10 @@ def CHECK_FUNC(conf, f, link=True, lib=None, headers=None):
1161
1162 ret = False
1163
1164- conf.COMPOUND_START('Checking for %s' % f)
1165+ in_lib_str = ""
1166+ if lib:
1167+ in_lib_str = " in %s" % lib
1168+ conf.COMPOUND_START('Checking for %s%s' % (f, in_lib_str))
1169
1170 if link is None or link:
1171 ret = CHECK_CODE(conf,
1172@@ -322,7 +326,7 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True):
1173 ret = False
1174 if v_define is None:
1175 v_define = 'SIZEOF_%s' % v.upper().replace(' ', '_')
1176- for size in list((1, 2, 4, 8, 16, 32)):
1177+ for size in list((1, 2, 4, 8, 16, 32, 64)):
1178 if CHECK_CODE(conf,
1179 'static int test_array[1 - 2 * !(((long int)(sizeof(%s))) <= %d)];' % (v, size),
1180 define=v_define,
1181@@ -383,12 +387,10 @@ def CHECK_CODE(conf, code, define,
1182 else:
1183 execute = 0
1184
1185- defs = conf.get_config_header()
1186-
1187 if addmain:
1188- fragment='%s\n%s\n int main(void) { %s; return 0; }\n' % (defs, hdrs, code)
1189+ fragment='%s\n int main(void) { %s; return 0; }\n' % (hdrs, code)
1190 else:
1191- fragment='%s\n%s\n%s\n' % (defs, hdrs, code)
1192+ fragment='%s\n%s\n' % (hdrs, code)
1193
1194 if msg is None:
1195 msg="Checking for %s" % define
1196@@ -398,15 +400,11 @@ def CHECK_CODE(conf, code, define,
1197 # Be strict when relying on a compiler check
1198 # Some compilers (e.g. xlc) ignore non-supported features as warnings
1199 if strict:
1200- extra_cflags = None
1201- if conf.env["CC_NAME"] == "gcc":
1202- extra_cflags = "-Werror"
1203- elif conf.env["CC_NAME"] == "xlc":
1204- extra_cflags = "-qhalt=w"
1205- cflags.append(extra_cflags)
1206+ if 'WERROR_CFLAGS' in conf.env:
1207+ cflags.extend(conf.env['WERROR_CFLAGS'])
1208
1209 if local_include:
1210- cflags.append('-I%s' % conf.curdir)
1211+ cflags.append('-I%s' % conf.path.abspath())
1212
1213 if not link:
1214 type='nolink'
1215@@ -431,11 +429,11 @@ def CHECK_CODE(conf, code, define,
1216
1217 conf.COMPOUND_START(msg)
1218
1219- ret = conf.check(fragment=fragment,
1220+ try:
1221+ ret = conf.check(fragment=fragment,
1222 execute=execute,
1223 define_name = define,
1224- mandatory = mandatory,
1225- ccflags=cflags,
1226+ cflags=cflags,
1227 ldflags=ldflags,
1228 includes=includes,
1229 uselib=uselib,
1230@@ -444,22 +442,30 @@ def CHECK_CODE(conf, code, define,
1231 quote=quote,
1232 exec_args=exec_args,
1233 define_ret=define_ret)
1234- if not ret and CONFIG_SET(conf, define):
1235- # sometimes conf.check() returns false, but it
1236- # sets the define. Maybe a waf bug?
1237- ret = True
1238- if ret:
1239+ except Exception:
1240+ if always:
1241+ conf.DEFINE(define, 0)
1242+ else:
1243+ conf.undefine(define)
1244+ conf.COMPOUND_END(False)
1245+ if mandatory:
1246+ raise
1247+ return False
1248+ else:
1249+ # Success is indicated by ret but we should unset
1250+ # defines set by WAF's c_config.check() because it
1251+ # defines it to int(ret) and we want to undefine it
1252+ if not ret:
1253+ conf.undefine(define)
1254+ conf.COMPOUND_END(False)
1255+ return False
1256 if not define_ret:
1257 conf.DEFINE(define, 1)
1258 conf.COMPOUND_END(True)
1259 else:
1260- conf.COMPOUND_END(conf.env[define])
1261+ conf.DEFINE(define, ret, quote=quote)
1262+ conf.COMPOUND_END(ret)
1263 return True
1264- if always:
1265- conf.DEFINE(define, 0)
1266- conf.COMPOUND_END(False)
1267- return False
1268-
1269
1270
1271 @conf
1272@@ -490,8 +496,9 @@ def CHECK_CFLAGS(conf, cflags, fragment='int main(void) { return 0; }\n'):
1273 check_cflags.extend(conf.env['WERROR_CFLAGS'])
1274 return conf.check(fragment=fragment,
1275 execute=0,
1276+ mandatory=False,
1277 type='nolink',
1278- ccflags=check_cflags,
1279+ cflags=check_cflags,
1280 msg="Checking compiler accepts %s" % cflags)
1281
1282 @conf
1283@@ -547,12 +554,15 @@ def library_flags(self, libs):
1284 # note that we do not add the -I and -L in here, as that is added by the waf
1285 # core. Adding it here would just change the order that it is put on the link line
1286 # which can cause system paths to be added before internal libraries
1287- extra_ccflags = TO_LIST(getattr(self.env, 'CCFLAGS_%s' % lib.upper(), []))
1288+ extra_ccflags = TO_LIST(getattr(self.env, 'CFLAGS_%s' % lib.upper(), []))
1289 extra_ldflags = TO_LIST(getattr(self.env, 'LDFLAGS_%s' % lib.upper(), []))
1290 extra_cpppath = TO_LIST(getattr(self.env, 'CPPPATH_%s' % lib.upper(), []))
1291 ccflags.extend(extra_ccflags)
1292 ldflags.extend(extra_ldflags)
1293 cpppath.extend(extra_cpppath)
1294+
1295+ extra_cpppath = TO_LIST(getattr(self.env, 'INCLUDES_%s' % lib.upper(), []))
1296+ cpppath.extend(extra_cpppath)
1297 if 'EXTRA_LDFLAGS' in self.env:
1298 ldflags.extend(self.env['EXTRA_LDFLAGS'])
1299
1300@@ -585,9 +595,9 @@ int foo()
1301
1302 (ccflags, ldflags, cpppath) = library_flags(conf, lib)
1303 if shlib:
1304- res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
1305+ res = conf.check(features='c cshlib', fragment=fragment, lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
1306 else:
1307- res = conf.check(lib=lib, uselib_store=lib, ccflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
1308+ res = conf.check(lib=lib, uselib_store=lib, cflags=ccflags, ldflags=ldflags, uselib=lib.upper(), mandatory=False)
1309
1310 if not res:
1311 if mandatory:
1312@@ -661,8 +671,8 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False,
1313 @conf
1314 def IN_LAUNCH_DIR(conf):
1315 '''return True if this rule is being run from the launch directory'''
1316- return os.path.realpath(conf.curdir) == os.path.realpath(Options.launch_dir)
1317-Options.Handler.IN_LAUNCH_DIR = IN_LAUNCH_DIR
1318+ return os.path.realpath(conf.path.abspath()) == os.path.realpath(Context.launch_dir)
1319+Options.OptionsContext.IN_LAUNCH_DIR = IN_LAUNCH_DIR
1320
1321
1322 @conf
1323@@ -674,23 +684,42 @@ def SAMBA_CONFIG_H(conf, path=None):
1324 return
1325
1326 # we need to build real code that can't be optimized away to test
1327- if conf.check(fragment='''
1328- #include <stdio.h>
1329-
1330- int main(void)
1331- {
1332- char t[100000];
1333- while (fgets(t, sizeof(t), stdin));
1334- return 0;
1335- }
1336- ''',
1337- execute=0,
1338- ccflags='-fstack-protector',
1339- ldflags='-fstack-protector',
1340- mandatory=False,
1341- msg='Checking if toolchain accepts -fstack-protector'):
1342- conf.ADD_CFLAGS('-fstack-protector')
1343- conf.ADD_LDFLAGS('-fstack-protector')
1344+ stack_protect_list = ['-fstack-protector-strong', '-fstack-protector']
1345+ for stack_protect_flag in stack_protect_list:
1346+ flag_supported = conf.check(fragment='''
1347+ #include <stdio.h>
1348+
1349+ int main(void)
1350+ {
1351+ char t[100000];
1352+ while (fgets(t, sizeof(t), stdin));
1353+ return 0;
1354+ }
1355+ ''',
1356+ execute=0,
1357+ cflags=[ '-Werror', '-Wp,-D_FORTIFY_SOURCE=2', stack_protect_flag],
1358+ mandatory=False,
1359+ msg='Checking if compiler accepts %s' % (stack_protect_flag))
1360+ if flag_supported:
1361+ conf.ADD_CFLAGS('%s' % (stack_protect_flag))
1362+ break
1363+
1364+ flag_supported = conf.check(fragment='''
1365+ #include <stdio.h>
1366+
1367+ int main(void)
1368+ {
1369+ char t[100000];
1370+ while (fgets(t, sizeof(t), stdin));
1371+ return 0;
1372+ }
1373+ ''',
1374+ execute=0,
1375+ cflags=[ '-Werror', '-fstack-clash-protection'],
1376+ mandatory=False,
1377+ msg='Checking if compiler accepts -fstack-clash-protection')
1378+ if flag_supported:
1379+ conf.ADD_CFLAGS('-fstack-clash-protection')
1380
1381 if Options.options.debug:
1382 conf.ADD_CFLAGS('-g', testflags=True)
1383@@ -774,9 +803,12 @@ int main(void) {
1384 conf.env['EXTRA_LDFLAGS'].extend(conf.env['ADDITIONAL_LDFLAGS'])
1385
1386 if path is None:
1387- conf.write_config_header('config.h', top=True)
1388+ conf.write_config_header('default/config.h', top=True, remove=False)
1389 else:
1390- conf.write_config_header(path)
1391+ conf.write_config_header(os.path.join(conf.variant, path), remove=False)
1392+ for key in conf.env.define_key:
1393+ conf.undefine(key, from_env=False)
1394+ conf.env.define_key = []
1395 conf.SAMBA_CROSS_CHECK_COMPLETE()
1396
1397
1398@@ -863,9 +895,6 @@ def CHECK_CC_ENV(conf):
1399 The build farm sometimes puts a space at the start"""
1400 if os.environ.get('CC'):
1401 conf.env.CC = TO_LIST(os.environ.get('CC'))
1402- if len(conf.env.CC) == 1:
1403- # make for nicer logs if just a single command
1404- conf.env.CC = conf.env.CC[0]
1405
1406
1407 @conf
1408@@ -875,7 +904,7 @@ def SETUP_CONFIGURE_CACHE(conf, enable):
1409 # when -C is chosen, we will use a private cache and will
1410 # not look into system includes. This roughtly matches what
1411 # autoconf does with -C
1412- cache_path = os.path.join(conf.blddir, '.confcache')
1413+ cache_path = os.path.join(conf.bldnode.abspath(), '.confcache')
1414 mkdir_p(cache_path)
1415 Options.cache_global = os.environ['WAFCACHE'] = cache_path
1416 else:
1417@@ -899,6 +928,3 @@ def SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS(conf):
1418 if conf.CHECK_LDFLAGS(['-undefined', 'dynamic_lookup']):
1419 conf.env.undefined_ignore_ldflags = ['-undefined', 'dynamic_lookup']
1420
1421-@conf
1422-def CHECK_CFG(self, *k, **kw):
1423- return self.check_cfg(*k, **kw)
1424diff --git a/buildtools/wafsamba/samba_autoproto.py b/buildtools/wafsamba/samba_autoproto.py
1425index b2b5233..ace434f 100644
1426--- a/buildtools/wafsamba/samba_autoproto.py
1427+++ b/buildtools/wafsamba/samba_autoproto.py
1428@@ -1,13 +1,13 @@
1429 # waf build tool for building automatic prototypes from C source
1430
1431 import os
1432-import Build
1433+from waflib import Build
1434 from samba_utils import SET_TARGET_TYPE, os_path_relpath
1435
1436 def SAMBA_AUTOPROTO(bld, header, source):
1437 '''rule for samba prototype generation'''
1438 bld.SET_BUILD_GROUP('prototypes')
1439- relpath = os_path_relpath(bld.curdir, bld.srcnode.abspath())
1440+ relpath = os_path_relpath(bld.path.abspath(), bld.srcnode.abspath())
1441 name = os.path.join(relpath, header)
1442 SET_TARGET_TYPE(bld, name, 'PROTOTYPE')
1443 t = bld(
1444@@ -16,7 +16,7 @@ def SAMBA_AUTOPROTO(bld, header, source):
1445 target = header,
1446 update_outputs=True,
1447 ext_out='.c',
1448- before ='cc',
1449+ before ='c',
1450 rule = '${PERL} "${SCRIPT}/mkproto.pl" --srcdir=.. --builddir=. --public=/dev/null --private="${TGT}" ${SRC}'
1451 )
1452 t.env.SCRIPT = os.path.join(bld.srcnode.abspath(), 'source4/script')
1453diff --git a/buildtools/wafsamba/samba_bundled.py b/buildtools/wafsamba/samba_bundled.py
1454index 253d604..60ce7da 100644
1455--- a/buildtools/wafsamba/samba_bundled.py
1456+++ b/buildtools/wafsamba/samba_bundled.py
1457@@ -1,9 +1,9 @@
1458 # functions to support bundled libraries
1459
1460 import sys
1461-import Build, Options, Logs
1462-from Configure import conf
1463-from samba_utils import TO_LIST
1464+from waflib import Build, Options, Logs
1465+from waflib.Configure import conf
1466+from wafsamba import samba_utils
1467
1468 def PRIVATE_NAME(bld, name, private_extension, private_library):
1469 '''possibly rename a library to include a bundled extension'''
1470@@ -51,19 +51,19 @@ Build.BuildContext.BUILTIN_LIBRARY = BUILTIN_LIBRARY
1471
1472 def BUILTIN_DEFAULT(opt, builtins):
1473 '''set a comma separated default list of builtin libraries for this package'''
1474- if 'BUILTIN_LIBRARIES_DEFAULT' in Options.options:
1475+ if 'BUILTIN_LIBRARIES_DEFAULT' in Options.options.__dict__:
1476 return
1477- Options.options['BUILTIN_LIBRARIES_DEFAULT'] = builtins
1478-Options.Handler.BUILTIN_DEFAULT = BUILTIN_DEFAULT
1479+ Options.options.__dict__['BUILTIN_LIBRARIES_DEFAULT'] = builtins
1480+Options.OptionsContext.BUILTIN_DEFAULT = BUILTIN_DEFAULT
1481
1482
1483 def PRIVATE_EXTENSION_DEFAULT(opt, extension, noextension=''):
1484 '''set a default private library extension'''
1485- if 'PRIVATE_EXTENSION_DEFAULT' in Options.options:
1486+ if 'PRIVATE_EXTENSION_DEFAULT' in Options.options.__dict__:
1487 return
1488- Options.options['PRIVATE_EXTENSION_DEFAULT'] = extension
1489- Options.options['PRIVATE_EXTENSION_EXCEPTION'] = noextension
1490-Options.Handler.PRIVATE_EXTENSION_DEFAULT = PRIVATE_EXTENSION_DEFAULT
1491+ Options.options.__dict__['PRIVATE_EXTENSION_DEFAULT'] = extension
1492+ Options.options.__dict__['PRIVATE_EXTENSION_EXCEPTION'] = noextension
1493+Options.OptionsContext.PRIVATE_EXTENSION_DEFAULT = PRIVATE_EXTENSION_DEFAULT
1494
1495
1496 def minimum_library_version(conf, libname, default):
1497@@ -139,7 +139,7 @@ def CHECK_BUNDLED_SYSTEM(conf, libname, minversion='0.0.0',
1498 # We always do a logic validation of 'onlyif' first
1499 missing = []
1500 if onlyif:
1501- for l in TO_LIST(onlyif):
1502+ for l in samba_utils.TO_LIST(onlyif):
1503 f = 'FOUND_SYSTEMLIB_%s' % l
1504 if not f in conf.env:
1505 Logs.error('ERROR: CHECK_BUNDLED_SYSTEM(%s) - ' % (libname) +
1506diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
1507index b52727b..ef632ba 100644
1508--- a/buildtools/wafsamba/samba_conftests.py
1509+++ b/buildtools/wafsamba/samba_conftests.py
1510@@ -2,34 +2,35 @@
1511 # to test for commonly needed configuration options
1512
1513 import os, shutil, re
1514-import Build, Configure, Utils, Options, Logs
1515-from Configure import conf
1516-from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH
1517+from waflib import Build, Configure, Utils, Options, Logs, Errors
1518+from waflib.Configure import conf
1519+from samba_utils import TO_LIST, ADD_LD_LIBRARY_PATH, get_string
1520
1521
1522 def add_option(self, *k, **kw):
1523 '''syntax help: provide the "match" attribute to opt.add_option() so that folders can be added to specific config tests'''
1524+ Options.OptionsContext.parser = self
1525 match = kw.get('match', [])
1526 if match:
1527 del kw['match']
1528 opt = self.parser.add_option(*k, **kw)
1529 opt.match = match
1530 return opt
1531-Options.Handler.add_option = add_option
1532+Options.OptionsContext.add_option = add_option
1533
1534 @conf
1535 def check(self, *k, **kw):
1536 '''Override the waf defaults to inject --with-directory options'''
1537
1538 if not 'env' in kw:
1539- kw['env'] = self.env.copy()
1540+ kw['env'] = self.env.derive()
1541
1542 # match the configuration test with specific options, for example:
1543 # --with-libiconv -> Options.options.iconv_open -> "Checking for library iconv"
1544 additional_dirs = []
1545 if 'msg' in kw:
1546 msg = kw['msg']
1547- for x in Options.Handler.parser.parser.option_list:
1548+ for x in Options.OptionsContext.parser.parser.option_list:
1549 if getattr(x, 'match', None) and msg in x.match:
1550 d = getattr(Options.options, x.dest, '')
1551 if d:
1552@@ -46,12 +47,12 @@ def check(self, *k, **kw):
1553 add_options_dir(additional_dirs, kw['env'])
1554
1555 self.validate_c(kw)
1556- self.check_message_1(kw['msg'])
1557+ self.start_msg(kw['msg'])
1558 ret = None
1559 try:
1560 ret = self.run_c_code(*k, **kw)
1561 except Configure.ConfigurationError as e:
1562- self.check_message_2(kw['errmsg'], 'YELLOW')
1563+ self.end_msg(kw['errmsg'], 'YELLOW')
1564 if 'mandatory' in kw and kw['mandatory']:
1565 if Logs.verbose > 1:
1566 raise
1567@@ -59,7 +60,7 @@ def check(self, *k, **kw):
1568 self.fatal('the configuration failed (see %r)' % self.log.name)
1569 else:
1570 kw['success'] = ret
1571- self.check_message_2(self.ret_msg(kw['okmsg'], kw))
1572+ self.end_msg(self.ret_msg(kw['okmsg'], kw))
1573
1574 # success! keep the CPPPATH/LIBPATH
1575 add_options_dir(additional_dirs, self.env)
1576@@ -85,7 +86,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
1577 '''see what we need for largefile support'''
1578 getconf_cflags = conf.CHECK_COMMAND(['getconf', 'LFS_CFLAGS']);
1579 if getconf_cflags is not False:
1580- if (conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
1581+ if (conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
1582 define='WORKING_GETCONF_LFS_CFLAGS',
1583 execute=True,
1584 cflags=getconf_cflags,
1585@@ -100,13 +101,13 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
1586 else:
1587 conf.DEFINE(flag_split[0], flag_split[1])
1588
1589- if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
1590+ if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
1591 define,
1592 execute=True,
1593 msg='Checking for large file support without additional flags'):
1594 return True
1595
1596- if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
1597+ if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
1598 define,
1599 execute=True,
1600 cflags='-D_FILE_OFFSET_BITS=64',
1601@@ -114,7 +115,7 @@ def CHECK_LARGEFILE(conf, define='HAVE_LARGEFILE'):
1602 conf.DEFINE('_FILE_OFFSET_BITS', 64)
1603 return True
1604
1605- if conf.CHECK_CODE('return !(sizeof(off_t) >= 8)',
1606+ if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
1607 define,
1608 execute=True,
1609 cflags='-D_LARGE_FILES',
1610@@ -162,7 +163,7 @@ def find_config_dir(conf):
1611 '''find a directory to run tests in'''
1612 k = 0
1613 while k < 10000:
1614- dir = os.path.join(conf.blddir, '.conf_check_%d' % k)
1615+ dir = os.path.join(conf.bldnode.abspath(), '.conf_check_%d' % k)
1616 try:
1617 shutil.rmtree(dir)
1618 except OSError:
1619@@ -257,7 +258,8 @@ int foo(int v) {
1620 environ[0] = 1;
1621 ldb_module = PyImport_ImportModule("ldb");
1622 return v * 2;
1623-}'''
1624+}
1625+'''
1626 return conf.check(features='c cshlib',uselib='PYEMBED',fragment=snip,msg=msg, mandatory=False)
1627
1628 # this one is quite complex, and should probably be broken up
1629@@ -337,7 +339,8 @@ def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
1630
1631 # we need to run the program, try to get its result
1632 args = conf.SAMBA_CROSS_ARGS(msg=msg)
1633- proc = Utils.pproc.Popen([lastprog] + args, stdout=Utils.pproc.PIPE, stderr=Utils.pproc.PIPE)
1634+ proc = Utils.subprocess.Popen([lastprog] + args,
1635+ stdout=Utils.subprocess.PIPE, stderr=Utils.subprocess.PIPE)
1636 (out, err) = proc.communicate()
1637 w = conf.log.write
1638 w(str(out))
1639@@ -364,7 +367,7 @@ def CHECK_PERL_MANPAGE(conf, msg=None, section=None):
1640 else:
1641 msg = "perl manpage generation"
1642
1643- conf.check_message_1(msg)
1644+ conf.start_msg(msg)
1645
1646 dir = find_config_dir(conf)
1647
1648@@ -381,28 +384,28 @@ WriteMakefile(
1649 """)
1650 back = os.path.abspath('.')
1651 os.chdir(bdir)
1652- proc = Utils.pproc.Popen(['perl', 'Makefile.PL'],
1653- stdout=Utils.pproc.PIPE,
1654- stderr=Utils.pproc.PIPE)
1655+ proc = Utils.subprocess.Popen(['perl', 'Makefile.PL'],
1656+ stdout=Utils.subprocess.PIPE,
1657+ stderr=Utils.subprocess.PIPE)
1658 (out, err) = proc.communicate()
1659 os.chdir(back)
1660
1661 ret = (proc.returncode == 0)
1662 if not ret:
1663- conf.check_message_2('not found', color='YELLOW')
1664+ conf.end_msg('not found', color='YELLOW')
1665 return
1666
1667 if section:
1668 man = Utils.readf(os.path.join(bdir,'Makefile'))
1669 m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
1670 if not m:
1671- conf.check_message_2('not found', color='YELLOW')
1672+ conf.end_msg('not found', color='YELLOW')
1673 return
1674 ext = m.group(1)
1675- conf.check_message_2(ext)
1676+ conf.end_msg(ext)
1677 return ext
1678
1679- conf.check_message_2('ok')
1680+ conf.end_msg('ok')
1681 return True
1682
1683
1684@@ -416,7 +419,7 @@ def CHECK_COMMAND(conf, cmd, msg=None, define=None, on_target=True, boolean=Fals
1685 if on_target:
1686 cmd.extend(conf.SAMBA_CROSS_ARGS(msg=msg))
1687 try:
1688- ret = Utils.cmd_output(cmd)
1689+ ret = get_string(Utils.cmd_output(cmd))
1690 except:
1691 conf.COMPOUND_END(False)
1692 return False
1693@@ -461,7 +464,7 @@ def CHECK_INLINE(conf):
1694 ret = conf.CHECK_CODE('''
1695 typedef int foo_t;
1696 static %s foo_t static_foo () {return 0; }
1697- %s foo_t foo () {return 0; }''' % (i, i),
1698+ %s foo_t foo () {return 0; }\n''' % (i, i),
1699 define='INLINE_MACRO',
1700 addmain=False,
1701 link=False)
1702@@ -486,13 +489,13 @@ def CHECK_XSLTPROC_MANPAGES(conf):
1703 return False
1704
1705 s='http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl'
1706- conf.CHECK_COMMAND('%s --nonet %s 2> /dev/null' % (conf.env.XSLTPROC, s),
1707+ conf.CHECK_COMMAND('%s --nonet %s 2> /dev/null' % (conf.env.get_flat('XSLTPROC'), s),
1708 msg='Checking for stylesheet %s' % s,
1709 define='XSLTPROC_MANPAGES', on_target=False,
1710 boolean=True)
1711 if not conf.CONFIG_SET('XSLTPROC_MANPAGES'):
1712- print "A local copy of the docbook.xsl wasn't found on your system" \
1713- " consider installing package like docbook-xsl"
1714+ print("A local copy of the docbook.xsl wasn't found on your system" \
1715+ " consider installing package like docbook-xsl")
1716
1717 #
1718 # Determine the standard libpath for the used compiler,
1719@@ -506,12 +509,12 @@ def CHECK_STANDARD_LIBPATH(conf):
1720 # at least gcc and clang support this:
1721 try:
1722 cmd = conf.env.CC + ['-print-search-dirs']
1723- out = Utils.cmd_output(cmd).split('\n')
1724+ out = get_string(Utils.cmd_output(cmd)).split('\n')
1725 except ValueError:
1726 # option not supported by compiler - use a standard list of directories
1727 dirlist = [ '/usr/lib', '/usr/lib64' ]
1728 except:
1729- raise Utils.WafError('Unexpected error running "%s"' % (cmd))
1730+ raise Errors.WafError('Unexpected error running "%s"' % (cmd))
1731 else:
1732 dirlist = []
1733 for line in out:
1734diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
1735index b8f2000..8863c2c 100644
1736--- a/buildtools/wafsamba/samba_cross.py
1737+++ b/buildtools/wafsamba/samba_cross.py
1738@@ -1,8 +1,9 @@
1739 # functions for handling cross-compilation
1740
1741 import os, sys, re, shlex
1742-import Utils, Logs, Options
1743-from Configure import conf
1744+from waflib import Utils, Logs, Options, Errors, Context
1745+from waflib.Configure import conf
1746+from wafsamba import samba_utils
1747
1748 real_Popen = None
1749
1750@@ -81,12 +82,12 @@ def cross_answer(ca_file, msg):
1751 f.close()
1752 return (int(m.group(1)), m.group(2))
1753 else:
1754- raise Utils.WafError("Bad answer format '%s' in %s" % (line, ca_file))
1755+ raise Errors.WafError("Bad answer format '%s' in %s" % (line, ca_file))
1756 f.close()
1757 return ANSWER_UNKNOWN
1758
1759
1760-class cross_Popen(Utils.pproc.Popen):
1761+class cross_Popen(Utils.subprocess.Popen):
1762 '''cross-compilation wrapper for Popen'''
1763 def __init__(*k, **kw):
1764 (obj, args) = k
1765@@ -118,10 +119,10 @@ class cross_Popen(Utils.pproc.Popen):
1766 newargs.extend(args[0:i])
1767 if use_answers:
1768 p = real_Popen(newargs,
1769- stdout=Utils.pproc.PIPE,
1770- stderr=Utils.pproc.PIPE)
1771+ stdout=Utils.subprocess.PIPE,
1772+ stderr=Utils.subprocess.PIPE)
1773 ce_out, ce_err = p.communicate()
1774- ans = (p.returncode, ce_out)
1775+ ans = (p.returncode, samba_utils.get_string(ce_out))
1776 add_answer(ca_file, msg, ans)
1777 else:
1778 args = newargs
1779@@ -144,8 +145,8 @@ def SAMBA_CROSS_ARGS(conf, msg=None):
1780
1781 global real_Popen
1782 if real_Popen is None:
1783- real_Popen = Utils.pproc.Popen
1784- Utils.pproc.Popen = cross_Popen
1785+ real_Popen = Utils.subprocess.Popen
1786+ Utils.subprocess.Popen = cross_Popen
1787
1788 ret = []
1789
1790@@ -154,11 +155,11 @@ def SAMBA_CROSS_ARGS(conf, msg=None):
1791
1792 if conf.env.CROSS_ANSWERS:
1793 if msg is None:
1794- raise Utils.WafError("Cannot have NULL msg in cross-answers")
1795- ret.extend(['--cross-answers', os.path.join(Options.launch_dir, conf.env.CROSS_ANSWERS), msg])
1796+ raise Errors.WafError("Cannot have NULL msg in cross-answers")
1797+ ret.extend(['--cross-answers', os.path.join(Context.launch_dir, conf.env.CROSS_ANSWERS), msg])
1798
1799 if ret == []:
1800- raise Utils.WafError("Cannot cross-compile without either --cross-execute or --cross-answers")
1801+ raise Errors.WafError("Cannot cross-compile without either --cross-execute or --cross-answers")
1802
1803 return ret
1804
1805@@ -167,5 +168,5 @@ def SAMBA_CROSS_CHECK_COMPLETE(conf):
1806 '''check if we have some unanswered questions'''
1807 global cross_answers_incomplete
1808 if conf.env.CROSS_COMPILE and cross_answers_incomplete:
1809- raise Utils.WafError("Cross answers file %s is incomplete" % conf.env.CROSS_ANSWERS)
1810+ raise Errors.WafError("Cross answers file %s is incomplete" % conf.env.CROSS_ANSWERS)
1811 return True
1812diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py
1813index 978a5e9..f8c3880 100644
1814--- a/buildtools/wafsamba/samba_deps.py
1815+++ b/buildtools/wafsamba/samba_deps.py
1816@@ -2,9 +2,10 @@
1817
1818 import os, sys, re, time
1819
1820-import Build, Environment, Options, Logs, Utils
1821-from Logs import debug
1822-from Configure import conf
1823+from waflib import Build, Options, Logs, Utils, Errors
1824+from waflib.Logs import debug
1825+from waflib.Configure import conf
1826+from waflib import ConfigSet
1827
1828 from samba_bundled import BUILTIN_LIBRARY
1829 from samba_utils import LOCAL_CACHE, TO_LIST, get_tgt_list, unique_list, os_path_relpath
1830@@ -85,7 +86,7 @@ def build_dependencies(self):
1831 # extra link flags from pkg_config
1832 libs = self.final_syslibs.copy()
1833
1834- (ccflags, ldflags, cpppath) = library_flags(self, list(libs))
1835+ (cflags, ldflags, cpppath) = library_flags(self, list(libs))
1836 new_ldflags = getattr(self, 'samba_ldflags', [])[:]
1837 new_ldflags.extend(ldflags)
1838 self.ldflags = new_ldflags
1839@@ -102,7 +103,7 @@ def build_dependencies(self):
1840 self.sname, self.uselib, self.uselib_local, self.add_objects)
1841
1842 if self.samba_type in ['SUBSYSTEM']:
1843- # this is needed for the ccflags of libs that come from pkg_config
1844+ # this is needed for the cflags of libs that come from pkg_config
1845 self.uselib = list(self.final_syslibs)
1846 self.uselib.extend(list(self.direct_syslibs))
1847 for lib in self.final_libs:
1848@@ -235,7 +236,7 @@ def add_init_functions(self):
1849 if sentinel == 'NULL':
1850 proto = "extern void __%s_dummy_module_proto(void)" % (sname)
1851 cflags.append('-DSTATIC_%s_MODULES_PROTO=%s' % (sname, proto))
1852- self.ccflags = cflags
1853+ self.cflags = cflags
1854 return
1855
1856 for m in modules:
1857@@ -257,7 +258,7 @@ def add_init_functions(self):
1858 proto += '_MODULE_PROTO(%s)' % f
1859 proto += "extern void __%s_dummy_module_proto(void)" % (m)
1860 cflags.append('-DSTATIC_%s_MODULES_PROTO=%s' % (m, proto))
1861- self.ccflags = cflags
1862+ self.cflags = cflags
1863
1864
1865 def check_duplicate_sources(bld, tgt_list):
1866@@ -271,6 +272,9 @@ def check_duplicate_sources(bld, tgt_list):
1867 tpath = os.path.normpath(os_path_relpath(t.path.abspath(bld.env), t.env.BUILD_DIRECTORY + '/default'))
1868 obj_sources = set()
1869 for s in source_list:
1870+ if not isinstance(s, str):
1871+ print('strange path in check_duplicate_sources %r' % s)
1872+ s = s.abspath()
1873 p = os.path.normpath(os.path.join(tpath, s))
1874 if p in obj_sources:
1875 Logs.error("ERROR: source %s appears twice in target '%s'" % (p, t.sname))
1876@@ -299,7 +303,7 @@ def check_duplicate_sources(bld, tgt_list):
1877 Logs.warn("WARNING: source %s is in more than one target: %s" % (s, subsystems[s].keys()))
1878 for tname in subsystems[s]:
1879 if len(subsystems[s][tname]) > 1:
1880- raise Utils.WafError("ERROR: source %s is in more than one subsystem of target '%s': %s" % (s, tname, subsystems[s][tname]))
1881+ raise Errors.WafError("ERROR: source %s is in more than one subsystem of target '%s': %s" % (s, tname, subsystems[s][tname]))
1882
1883 return True
1884
1885@@ -372,7 +376,7 @@ def add_samba_attributes(bld, tgt_list):
1886 t.samba_abspath = t.path.abspath(bld.env)
1887 t.samba_deps_extended = t.samba_deps[:]
1888 t.samba_includes_extended = TO_LIST(t.samba_includes)[:]
1889- t.ccflags = getattr(t, 'samba_cflags', '')
1890+ t.cflags = getattr(t, 'samba_cflags', '')
1891
1892 def replace_grouping_libraries(bld, tgt_list):
1893 '''replace dependencies based on grouping libraries
1894@@ -715,6 +719,11 @@ def reduce_objects(bld, tgt_list):
1895 if t.sname in rely_on:
1896 dup = dup.difference(rely_on[t.sname])
1897 if dup:
1898+ # Do not remove duplicates of BUILTINS
1899+ d = next(iter(dup))
1900+ if BUILTIN_LIBRARY(bld, d):
1901+ continue
1902+
1903 debug('deps: removing dups from %s of type %s: %s also in %s %s',
1904 t.sname, t.samba_type, dup, t2.samba_type, l)
1905 new = new.difference(dup)
1906@@ -951,7 +960,7 @@ savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_incl
1907 'source', 'grouping_library', 'samba_ldflags', 'allow_undefined_symbols',
1908 'use_global_deps', 'global_include' ]
1909 savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes',
1910- 'ccflags', 'ldflags', 'samba_deps_extended', 'final_libs']
1911+ 'cflags', 'ldflags', 'samba_deps_extended', 'final_libs']
1912 savedeps_outenv = ['INC_PATHS']
1913 savedeps_envvars = ['NONSHARED_BINARIES', 'GLOBAL_DEPENDENCIES', 'EXTRA_CFLAGS', 'EXTRA_LDFLAGS', 'EXTRA_INCLUDES' ]
1914 savedeps_caches = ['GLOBAL_DEPENDENCIES', 'TARGET_TYPE', 'INIT_FUNCTIONS', 'SYSLIB_DEPS']
1915@@ -960,7 +969,7 @@ savedeps_files = ['buildtools/wafsamba/samba_deps.py']
1916 def save_samba_deps(bld, tgt_list):
1917 '''save the dependency calculations between builds, to make
1918 further builds faster'''
1919- denv = Environment.Environment()
1920+ denv = ConfigSet.ConfigSet()
1921
1922 denv.version = savedeps_version
1923 denv.savedeps_inputs = savedeps_inputs
1924@@ -1007,15 +1016,15 @@ def save_samba_deps(bld, tgt_list):
1925 if tdeps != {}:
1926 denv.outenv[t.sname] = tdeps
1927
1928- depsfile = os.path.join(bld.bdir, "sambadeps")
1929+ depsfile = os.path.join(bld.cache_dir, "sambadeps")
1930 denv.store_fast(depsfile)
1931
1932
1933
1934 def load_samba_deps(bld, tgt_list):
1935 '''load a previous set of build dependencies if possible'''
1936- depsfile = os.path.join(bld.bdir, "sambadeps")
1937- denv = Environment.Environment()
1938+ depsfile = os.path.join(bld.cache_dir, "sambadeps")
1939+ denv = ConfigSet.ConfigSet()
1940 try:
1941 debug('deps: checking saved dependencies')
1942 denv.load_fast(depsfile)
1943diff --git a/buildtools/wafsamba/samba_dist.py b/buildtools/wafsamba/samba_dist.py
1944index 8d51632..6af7bb4 100644
1945--- a/buildtools/wafsamba/samba_dist.py
1946+++ b/buildtools/wafsamba/samba_dist.py
1947@@ -2,13 +2,41 @@
1948 # uses git ls-files to get file lists
1949
1950 import os, sys, tarfile
1951-import Utils, Scripting, Logs, Options
1952-from Configure import conf
1953-from samba_utils import os_path_relpath
1954+from waflib import Utils, Scripting, Logs, Options
1955+from waflib.Configure import conf
1956+from samba_utils import os_path_relpath, get_string
1957+from waflib import Context
1958
1959 dist_dirs = None
1960 dist_files = None
1961 dist_blacklist = ""
1962+dist_archive = None
1963+
1964+class Dist(Context.Context):
1965+ # TODO remove
1966+ cmd = 'dist'
1967+ fun = 'dist'
1968+ def execute(self):
1969+ Context.g_module.dist()
1970+
1971+class DistCheck(Scripting.DistCheck):
1972+ fun = 'distcheck'
1973+ cmd = 'distcheck'
1974+ def execute(self):
1975+ Options.options.distcheck_args = ''
1976+ if Context.g_module.distcheck is Scripting.distcheck:
1977+ # default
1978+ Context.g_module.distcheck(self)
1979+ else:
1980+ Context.g_module.distcheck()
1981+ Context.g_module.dist()
1982+ self.check()
1983+ def get_arch_name(self):
1984+ global dist_archive
1985+ return dist_archive
1986+ def make_distcheck_cmd(self, tmpdir):
1987+ waf = os.path.abspath(sys.argv[0])
1988+ return [sys.executable, waf, 'configure', 'build', 'install', 'uninstall', '--destdir=' + tmpdir]
1989
1990 def add_symlink(tar, fname, abspath, basedir):
1991 '''handle symlinks to directories that may move during packaging'''
1992@@ -69,7 +97,7 @@ def add_tarfile(tar, fname, abspath, basedir):
1993 tinfo.gid = 0
1994 tinfo.uname = 'root'
1995 tinfo.gname = 'root'
1996- fh = open(abspath)
1997+ fh = open(abspath, "rb")
1998 tar.addfile(tinfo, fileobj=fh)
1999 fh.close()
2000
2001@@ -91,7 +119,7 @@ def vcs_dir_contents(path):
2002 repo = os.path.dirname(repo)
2003 if repo == "/":
2004 raise Exception("unsupported or no vcs for %s" % path)
2005- return Utils.cmd_output(ls_files_cmd, cwd=cwd, env=env).split()
2006+ return get_string(Utils.cmd_output(ls_files_cmd, cwd=cwd, env=env)).split('\n')
2007
2008
2009 def dist(appname='', version=''):
2010@@ -136,12 +164,14 @@ def dist(appname='', version=''):
2011
2012 if not isinstance(appname, str) or not appname:
2013 # this copes with a mismatch in the calling arguments for dist()
2014- appname = Utils.g_module.APPNAME
2015- version = Utils.g_module.VERSION
2016+ appname = Context.g_module.APPNAME
2017+ version = Context.g_module.VERSION
2018 if not version:
2019- version = Utils.g_module.VERSION
2020+ version = Context.g_module.VERSION
2021
2022- srcdir = os.path.normpath(os.path.join(os.path.dirname(Utils.g_module.root_path), Utils.g_module.srcdir))
2023+ srcdir = os.path.normpath(
2024+ os.path.join(os.path.dirname(Context.g_module.root_path),
2025+ Context.g_module.top))
2026
2027 if not dist_dirs:
2028 Logs.error('You must use samba_dist.DIST_DIRS() to set which directories to package')
2029@@ -218,6 +248,9 @@ def dist(appname='', version=''):
2030 else:
2031 Logs.info('Created %s' % dist_name)
2032
2033+ # TODO use the ctx object instead
2034+ global dist_archive
2035+ dist_archive = dist_name
2036 return dist_name
2037
2038
2039diff --git a/buildtools/wafsamba/samba_git.py b/buildtools/wafsamba/samba_git.py
2040index c58a579..09a204f 100644
2041--- a/buildtools/wafsamba/samba_git.py
2042+++ b/buildtools/wafsamba/samba_git.py
2043@@ -4,7 +4,7 @@ import subprocess
2044 def find_git(env=None):
2045 """Find the git binary."""
2046 if env is not None and 'GIT' in env:
2047- return env['GIT']
2048+ return env.get_flat('GIT')
2049
2050 # Get version from GIT
2051 if os.path.exists("/usr/bin/git"):
2052diff --git a/buildtools/wafsamba/samba_headers.py b/buildtools/wafsamba/samba_headers.py
2053index 0a80082..a268c01 100644
2054--- a/buildtools/wafsamba/samba_headers.py
2055+++ b/buildtools/wafsamba/samba_headers.py
2056@@ -1,7 +1,7 @@
2057 # specialist handling of header files for Samba
2058
2059 import os, re, sys, fnmatch
2060-import Build, Logs, Utils
2061+from waflib import Build, Logs, Utils, Errors
2062 from samba_utils import TO_LIST, os_path_relpath
2063
2064
2065@@ -99,7 +99,7 @@ def create_public_header(task):
2066 os.unlink(tgt)
2067 sys.stderr.write("%s:%u:Error: unable to resolve public header %s (maybe try one of %s)\n" % (
2068 os.path.relpath(src, os.getcwd()), linenumber, hpath, suggested))
2069- raise Utils.WafError("Unable to resolve header path '%s' in public header '%s' in directory %s" % (
2070+ raise Errors.WafError("Unable to resolve header path '%s' in public header '%s' in directory %s" % (
2071 hpath, relsrc, task.env.RELPATH))
2072 infile.close()
2073 outfile.close()
2074@@ -148,11 +148,12 @@ def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install
2075 else:
2076 h_name = h
2077 inst_name = os.path.basename(h)
2078- relpath1 = os_path_relpath(bld.srcnode.abspath(), bld.curdir)
2079- relpath2 = os_path_relpath(bld.curdir, bld.srcnode.abspath())
2080+ curdir = bld.path.abspath()
2081+ relpath1 = os_path_relpath(bld.srcnode.abspath(), curdir)
2082+ relpath2 = os_path_relpath(curdir, bld.srcnode.abspath())
2083 targetdir = os.path.normpath(os.path.join(relpath1, bld.env.build_public_headers, inst_path))
2084- if not os.path.exists(os.path.join(bld.curdir, targetdir)):
2085- raise Utils.WafError("missing source directory %s for public header %s" % (targetdir, inst_name))
2086+ if not os.path.exists(os.path.join(curdir, targetdir)):
2087+ raise Errors.WafError("missing source directory %s for public header %s" % (targetdir, inst_name))
2088 target = os.path.join(targetdir, inst_name)
2089
2090 # the source path of the header, relative to the top of the source tree
2091diff --git a/buildtools/wafsamba/samba_install.py b/buildtools/wafsamba/samba_install.py
2092index 21035bf..47bc0cb 100644
2093--- a/buildtools/wafsamba/samba_install.py
2094+++ b/buildtools/wafsamba/samba_install.py
2095@@ -4,8 +4,8 @@
2096 # library use
2097
2098 import os
2099-import Utils
2100-from TaskGen import feature, before, after
2101+from waflib import Utils, Errors
2102+from waflib.TaskGen import feature, before, after
2103 from samba_utils import LIB_PATH, MODE_755, install_rpath, build_rpath
2104
2105 @feature('install_bin')
2106@@ -45,7 +45,7 @@ def install_binary(self):
2107
2108 # tell waf to install the right binary
2109 bld.install_as(os.path.join(install_path, orig_target),
2110- os.path.join(self.path.abspath(bld.env), self.target),
2111+ self.path.find_or_declare(self.target),
2112 chmod=MODE_755)
2113
2114
2115@@ -143,8 +143,9 @@ def install_library(self):
2116
2117 # tell waf to install the library
2118 bld.install_as(os.path.join(install_path, install_name),
2119- os.path.join(self.path.abspath(bld.env), inst_name),
2120+ self.path.find_or_declare(inst_name),
2121 chmod=MODE_755)
2122+
2123 if install_link and install_link != install_name:
2124 # and the symlink if needed
2125 bld.symlink_as(os.path.join(install_path, install_link), os.path.basename(install_name))
2126@@ -227,7 +228,7 @@ def symlink_bin(self):
2127 return
2128
2129 if not self.link_task.outputs or not self.link_task.outputs[0]:
2130- raise Utils.WafError('no outputs found for %s in symlink_bin' % self.name)
2131+ raise Errors.WafError('no outputs found for %s in symlink_bin' % self.name)
2132 binpath = self.link_task.outputs[0].abspath(self.env)
2133 bldpath = os.path.join(self.bld.env.BUILD_DIRECTORY, self.link_task.outputs[0].name)
2134
2135diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py
2136deleted file mode 100644
2137index 5008f83..0000000
2138--- a/buildtools/wafsamba/samba_optimisation.py
2139+++ /dev/null
2140@@ -1,269 +0,0 @@
2141-# This file contains waf optimisations for Samba
2142-
2143-# most of these optimisations are possible because of the restricted build environment
2144-# that Samba has. For example, Samba doesn't attempt to cope with Win32 paths during the
2145-# build, and Samba doesn't need build varients
2146-
2147-# overall this makes some build tasks quite a bit faster
2148-
2149-import os
2150-import Build, Utils, Node
2151-from TaskGen import feature, after, before
2152-import preproc
2153-
2154-@feature('c', 'cc', 'cxx')
2155-@after('apply_type_vars', 'apply_lib_vars', 'apply_core')
2156-def apply_incpaths(self):
2157- lst = []
2158-
2159- try:
2160- kak = self.bld.kak
2161- except AttributeError:
2162- kak = self.bld.kak = {}
2163-
2164- # TODO move the uselib processing out of here
2165- for lib in self.to_list(self.uselib):
2166- for path in self.env['CPPPATH_' + lib]:
2167- if not path in lst:
2168- lst.append(path)
2169- if preproc.go_absolute:
2170- for path in preproc.standard_includes:
2171- if not path in lst:
2172- lst.append(path)
2173-
2174- for path in self.to_list(self.includes):
2175- if not path in lst:
2176- if preproc.go_absolute or path[0] != '/': # os.path.isabs(path):
2177- lst.append(path)
2178- else:
2179- self.env.prepend_value('CPPPATH', path)
2180-
2181- for path in lst:
2182- node = None
2183- if path[0] == '/': # os.path.isabs(path):
2184- if preproc.go_absolute:
2185- node = self.bld.root.find_dir(path)
2186- elif path[0] == '#':
2187- node = self.bld.srcnode
2188- if len(path) > 1:
2189- try:
2190- node = kak[path]
2191- except KeyError:
2192- kak[path] = node = node.find_dir(path[1:])
2193- else:
2194- try:
2195- node = kak[(self.path.id, path)]
2196- except KeyError:
2197- kak[(self.path.id, path)] = node = self.path.find_dir(path)
2198-
2199- if node:
2200- self.env.append_value('INC_PATHS', node)
2201-
2202-@feature('c', 'cc')
2203-@after('apply_incpaths')
2204-def apply_obj_vars_cc(self):
2205- """after apply_incpaths for INC_PATHS"""
2206- env = self.env
2207- app = env.append_unique
2208- cpppath_st = env['CPPPATH_ST']
2209-
2210- lss = env['_CCINCFLAGS']
2211-
2212- try:
2213- cac = self.bld.cac
2214- except AttributeError:
2215- cac = self.bld.cac = {}
2216-
2217- # local flags come first
2218- # set the user-defined includes paths
2219- for i in env['INC_PATHS']:
2220-
2221- try:
2222- lss.extend(cac[i.id])
2223- except KeyError:
2224-
2225- cac[i.id] = [cpppath_st % i.bldpath(env), cpppath_st % i.srcpath(env)]
2226- lss.extend(cac[i.id])
2227-
2228- env['_CCINCFLAGS'] = lss
2229- # set the library include paths
2230- for i in env['CPPPATH']:
2231- app('_CCINCFLAGS', cpppath_st % i)
2232-
2233-import Node, Environment
2234-
2235-def vari(self):
2236- return "default"
2237-Environment.Environment.variant = vari
2238-
2239-def variant(self, env):
2240- if not env: return 0
2241- elif self.id & 3 == Node.FILE: return 0
2242- else: return "default"
2243-Node.Node.variant = variant
2244-
2245-
2246-import TaskGen, Task
2247-
2248-def create_task(self, name, src=None, tgt=None):
2249- task = Task.TaskBase.classes[name](self.env, generator=self)
2250- if src:
2251- task.set_inputs(src)
2252- if tgt:
2253- task.set_outputs(tgt)
2254- return task
2255-TaskGen.task_gen.create_task = create_task
2256-
2257-def hash_constraints(self):
2258- a = self.attr
2259- sum = hash((str(a('before', '')),
2260- str(a('after', '')),
2261- str(a('ext_in', '')),
2262- str(a('ext_out', '')),
2263- self.__class__.maxjobs))
2264- return sum
2265-Task.TaskBase.hash_constraints = hash_constraints
2266-
2267-def hash_env_vars(self, env, vars_lst):
2268- idx = str(id(env)) + str(vars_lst)
2269- try:
2270- return self.cache_sig_vars[idx]
2271- except KeyError:
2272- pass
2273-
2274- m = Utils.md5()
2275- m.update(''.join([str(env[a]) for a in vars_lst]))
2276-
2277- ret = self.cache_sig_vars[idx] = m.digest()
2278- return ret
2279-Build.BuildContext.hash_env_vars = hash_env_vars
2280-
2281-
2282-def store_fast(self, filename):
2283- file = open(filename, 'wb')
2284- data = self.get_merged_dict()
2285- try:
2286- Build.cPickle.dump(data, file, -1)
2287- finally:
2288- file.close()
2289-Environment.Environment.store_fast = store_fast
2290-
2291-def load_fast(self, filename):
2292- file = open(filename, 'rb')
2293- try:
2294- data = Build.cPickle.load(file)
2295- finally:
2296- file.close()
2297- self.table.update(data)
2298-Environment.Environment.load_fast = load_fast
2299-
2300-def is_this_a_static_lib(self, name):
2301- try:
2302- cache = self.cache_is_this_a_static_lib
2303- except AttributeError:
2304- cache = self.cache_is_this_a_static_lib = {}
2305- try:
2306- return cache[name]
2307- except KeyError:
2308- ret = cache[name] = 'cstaticlib' in self.bld.get_tgen_by_name(name).features
2309- return ret
2310-TaskGen.task_gen.is_this_a_static_lib = is_this_a_static_lib
2311-
2312-def shared_ancestors(self):
2313- try:
2314- cache = self.cache_is_this_a_static_lib
2315- except AttributeError:
2316- cache = self.cache_is_this_a_static_lib = {}
2317- try:
2318- return cache[id(self)]
2319- except KeyError:
2320-
2321- ret = []
2322- if 'cshlib' in self.features: # or 'cprogram' in self.features:
2323- if getattr(self, 'uselib_local', None):
2324- lst = self.to_list(self.uselib_local)
2325- ret = [x for x in lst if not self.is_this_a_static_lib(x)]
2326- cache[id(self)] = ret
2327- return ret
2328-TaskGen.task_gen.shared_ancestors = shared_ancestors
2329-
2330-@feature('c', 'cc', 'cxx')
2331-@after('apply_link', 'init_cc', 'init_cxx', 'apply_core')
2332-def apply_lib_vars(self):
2333- """after apply_link because of 'link_task'
2334- after default_cc because of the attribute 'uselib'"""
2335-
2336- # after 'apply_core' in case if 'cc' if there is no link
2337-
2338- env = self.env
2339- app = env.append_value
2340- seen_libpaths = set([])
2341-
2342- # OPTIMIZATION 1: skip uselib variables already added (700ms)
2343- seen_uselib = set([])
2344-
2345- # 1. the case of the libs defined in the project (visit ancestors first)
2346- # the ancestors external libraries (uselib) will be prepended
2347- self.uselib = self.to_list(self.uselib)
2348- names = self.to_list(self.uselib_local)
2349-
2350- seen = set([])
2351- tmp = Utils.deque(names) # consume a copy of the list of names
2352- while tmp:
2353- lib_name = tmp.popleft()
2354- # visit dependencies only once
2355- if lib_name in seen:
2356- continue
2357-
2358- y = self.get_tgen_by_name(lib_name)
2359- if not y:
2360- raise Utils.WafError('object %r was not found in uselib_local (required by %r)' % (lib_name, self.name))
2361- y.post()
2362- seen.add(lib_name)
2363-
2364- # OPTIMIZATION 2: pre-compute ancestors shared libraries (100ms)
2365- tmp.extend(y.shared_ancestors())
2366-
2367- # link task and flags
2368- if getattr(y, 'link_task', None):
2369-
2370- link_name = y.target[y.target.rfind('/') + 1:]
2371- if 'cstaticlib' in y.features:
2372- app('STATICLIB', link_name)
2373- elif 'cshlib' in y.features or 'cprogram' in y.features:
2374- # WARNING some linkers can link against programs
2375- app('LIB', link_name)
2376-
2377- # the order
2378- self.link_task.set_run_after(y.link_task)
2379-
2380- # for the recompilation
2381- dep_nodes = getattr(self.link_task, 'dep_nodes', [])
2382- self.link_task.dep_nodes = dep_nodes + y.link_task.outputs
2383-
2384- # OPTIMIZATION 3: reduce the amount of function calls
2385- # add the link path too
2386- par = y.link_task.outputs[0].parent
2387- if id(par) not in seen_libpaths:
2388- seen_libpaths.add(id(par))
2389- tmp_path = par.bldpath(self.env)
2390- if not tmp_path in env['LIBPATH']:
2391- env.prepend_value('LIBPATH', tmp_path)
2392-
2393-
2394- # add ancestors uselib too - but only propagate those that have no staticlib
2395- for v in self.to_list(y.uselib):
2396- if v not in seen_uselib:
2397- seen_uselib.add(v)
2398- if not env['STATICLIB_' + v]:
2399- if not v in self.uselib:
2400- self.uselib.insert(0, v)
2401-
2402- # 2. the case of the libs defined outside
2403- for x in self.uselib:
2404- for v in self.p_flag_vars:
2405- val = self.env[v + '_' + x]
2406- if val:
2407- self.env.append_value(v, val)
2408-
2409-
2410diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
2411index 2b93937..d0fe965 100644
2412--- a/buildtools/wafsamba/samba_patterns.py
2413+++ b/buildtools/wafsamba/samba_patterns.py
2414@@ -1,6 +1,7 @@
2415 # a waf tool to add extension based build patterns for Samba
2416
2417-import Build
2418+import sys
2419+from waflib import Build
2420 from wafsamba import samba_version_file
2421
2422 def write_version_header(task):
2423@@ -146,13 +147,19 @@ def write_build_options_section(fp, keys, section):
2424 fp.write("\n")
2425
2426 def write_build_options(task):
2427- tbl = task.env['defines']
2428+ tbl = task.env
2429 keys_option_with = []
2430 keys_option_utmp = []
2431 keys_option_have = []
2432 keys_header_sys = []
2433 keys_header_other = []
2434 keys_misc = []
2435+ if sys.hexversion>0x300000f:
2436+ trans_table = bytes.maketrans(b'.-()', b'____')
2437+ else:
2438+ import string
2439+ trans_table = string.maketrans('.-()', '____')
2440+
2441 for key in tbl:
2442 if key.startswith("HAVE_UT_UT_") or key.find("UTMP") >= 0:
2443 keys_option_utmp.append(key)
2444@@ -169,7 +176,7 @@ def write_build_options(task):
2445 l = key.split("(")
2446 keys_misc.append(l[0])
2447 else:
2448- keys_misc.append(key)
2449+ keys_misc.append(key.translate(trans_table))
2450
2451 tgt = task.outputs[0].bldpath(task.env)
2452 f = open(tgt, 'w')
2453diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py
2454index 2e9a53a..e019acb 100644
2455--- a/buildtools/wafsamba/samba_perl.py
2456+++ b/buildtools/wafsamba/samba_perl.py
2457@@ -1,6 +1,6 @@
2458-import Utils
2459-from Configure import conf
2460-
2461+from waflib import Utils
2462+from waflib.Configure import conf
2463+from samba_utils import get_string
2464 done = {}
2465
2466 @conf
2467@@ -9,13 +9,16 @@ def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
2468 return
2469 done["done"] = True
2470 conf.find_program('perl', var='PERL', mandatory=mandatory)
2471- conf.check_tool('perl')
2472+ conf.load('perl')
2473 path_perl = conf.find_program('perl')
2474 conf.env.PERL_SPECIFIED = (conf.env.PERL != path_perl)
2475 conf.check_perl_version(version)
2476
2477 def read_perl_config_var(cmd):
2478- return Utils.to_list(Utils.cmd_output([conf.env.PERL, '-MConfig', '-e', cmd]))
2479+ output = Utils.cmd_output([conf.env.get_flat('PERL'), '-MConfig', '-e', cmd])
2480+ if not isinstance(output, str):
2481+ output = get_string(output)
2482+ return Utils.to_list(output)
2483
2484 def check_perl_config_var(var):
2485 conf.start_msg("Checking for perl $Config{%s}:" % var)
2486diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
2487index 9651e4d..3fecfa9 100644
2488--- a/buildtools/wafsamba/samba_pidl.py
2489+++ b/buildtools/wafsamba/samba_pidl.py
2490@@ -1,8 +1,8 @@
2491 # waf build tool for building IDL files with pidl
2492
2493 import os
2494-import Build
2495-from TaskGen import feature, before
2496+from waflib import Build, Utils
2497+from waflib.TaskGen import feature, before
2498 from samba_utils import SET_TARGET_TYPE, TO_LIST, LOCAL_CACHE
2499
2500 def SAMBA_PIDL(bld, pname, source,
2501@@ -76,9 +76,9 @@ def SAMBA_PIDL(bld, pname, source,
2502 else:
2503 cc = 'CC="%s"' % bld.CONFIG_GET("CC")
2504
2505- t = bld(rule='cd .. && %s %s ${PERL} "${PIDL}" --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${SRC[0].abspath(env)}"' % (cpp, cc),
2506+ t = bld(rule='cd ${PIDL_LAUNCH_DIR} && %s %s ${PERL} ${PIDL} --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- "${IDLSRC}"' % (cpp, cc),
2507 ext_out = '.c',
2508- before = 'cc',
2509+ before = 'c',
2510 update_outputs = True,
2511 shell = True,
2512 source = source,
2513@@ -86,18 +86,22 @@ def SAMBA_PIDL(bld, pname, source,
2514 name = name,
2515 samba_type = 'PIDL')
2516
2517- # prime the list of nodes we are dependent on with the cached pidl sources
2518- t.allnodes = pidl_src_nodes
2519
2520- t.env.PIDL = os.path.join(bld.srcnode.abspath(), 'pidl/pidl')
2521+ t.env.PIDL_LAUNCH_DIR = bld.srcnode.path_from(bld.bldnode)
2522+ pnode = bld.srcnode.find_resource('pidl/pidl')
2523+ t.env.PIDL = pnode.path_from(bld.srcnode)
2524 t.env.OPTIONS = TO_LIST(options)
2525- t.env.OUTPUTDIR = bld.bldnode.name + '/' + bld.path.find_dir(output_dir).bldpath(t.env)
2526+ snode = t.path.find_resource(source[0])
2527+ t.env.IDLSRC = snode.path_from(bld.srcnode)
2528+ t.env.OUTPUTDIR = bld.bldnode.path_from(bld.srcnode) + '/' + bld.path.find_dir(output_dir).path_from(bld.srcnode)
2529+
2530+ bld.add_manual_dependency(snode, pidl_src_nodes)
2531
2532 if generate_tables and table_header_idx is not None:
2533 pidl_headers = LOCAL_CACHE(bld, 'PIDL_HEADERS')
2534 pidl_headers[name] = [bld.path.find_or_declare(out_files[table_header_idx])]
2535
2536- t.more_includes = '#' + bld.path.relpath_gen(bld.srcnode)
2537+ t.more_includes = '#' + bld.path.path_from(bld.srcnode)
2538 Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
2539
2540
2541@@ -117,13 +121,15 @@ Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
2542 @before('exec_rule')
2543 def collect(self):
2544 pidl_headers = LOCAL_CACHE(self.bld, 'PIDL_HEADERS')
2545+ # The first source is tables.pl itself
2546+ self.source = Utils.to_list(self.source)
2547 for (name, hd) in pidl_headers.items():
2548 y = self.bld.get_tgen_by_name(name)
2549 self.bld.ASSERT(y is not None, 'Failed to find PIDL header %s' % name)
2550 y.post()
2551 for node in hd:
2552 self.bld.ASSERT(node is not None, 'Got None as build node generating PIDL table for %s' % name)
2553- self.source += " " + node.relpath_gen(self.path)
2554+ self.source.append(node)
2555
2556
2557 def SAMBA_PIDL_TABLES(bld, name, target):
2558@@ -131,9 +137,9 @@ def SAMBA_PIDL_TABLES(bld, name, target):
2559 bld.SET_BUILD_GROUP('main')
2560 t = bld(
2561 features = 'collect',
2562- rule = '${PERL} ${SRC} --output ${TGT} | sed "s|default/||" > ${TGT}',
2563+ rule = '${PERL} ${SRC} > ${TGT}',
2564 ext_out = '.c',
2565- before = 'cc',
2566+ before = 'c',
2567 update_outputs = True,
2568 shell = True,
2569 source = '../../librpc/tables.pl',
2570diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
2571index cb99fe9..fac0e34 100644
2572--- a/buildtools/wafsamba/samba_python.py
2573+++ b/buildtools/wafsamba/samba_python.py
2574@@ -1,11 +1,11 @@
2575 # waf build tool for building IDL files with pidl
2576
2577-import os
2578-import Build, Logs, Utils, Configure
2579-from Configure import conf
2580+import os, sys
2581+from waflib import Build, Logs, Utils, Configure, Errors
2582+from waflib.Configure import conf
2583
2584 @conf
2585-def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
2586+def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,6,0)):
2587 # enable tool to build python extensions
2588 if conf.env.HAVE_PYTHON_H:
2589 conf.check_python_version(version)
2590@@ -14,23 +14,25 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
2591 interpreters = []
2592
2593 if conf.env['EXTRA_PYTHON']:
2594- conf.all_envs['extrapython'] = conf.env.copy()
2595+ conf.all_envs['extrapython'] = conf.env.derive()
2596 conf.setenv('extrapython')
2597 conf.env['PYTHON'] = conf.env['EXTRA_PYTHON']
2598 conf.env['IS_EXTRA_PYTHON'] = 'yes'
2599 conf.find_program('python', var='PYTHON', mandatory=True)
2600- conf.check_tool('python')
2601+ conf.load('python')
2602 try:
2603- conf.check_python_version((3, 3, 0))
2604+ conf.check_python_version(version)
2605 except Exception:
2606- Logs.warn('extra-python needs to be Python 3.3 or later')
2607+ Logs.warn('extra-python needs to be Python %s.%s.%s or later' %
2608+ (version[0], version[1], version[2]))
2609 raise
2610 interpreters.append(conf.env['PYTHON'])
2611 conf.setenv('default')
2612
2613- conf.find_program('python', var='PYTHON', mandatory=mandatory)
2614- conf.check_tool('python')
2615- path_python = conf.find_program('python')
2616+ conf.find_program('python3', var='PYTHON', mandatory=mandatory)
2617+ conf.load('python')
2618+ path_python = conf.find_program('python3')
2619+
2620 conf.env.PYTHON_SPECIFIED = (conf.env.PYTHON != path_python)
2621 conf.check_python_version(version)
2622
2623@@ -42,14 +44,16 @@ def SAMBA_CHECK_PYTHON(conf, mandatory=True, version=(2,4,2)):
2624 def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
2625 if conf.env.disable_python:
2626 if mandatory:
2627- raise Utils.WafError("Cannot check for python headers when "
2628+ raise Errors.WafError("Cannot check for python headers when "
2629 "--disable-python specified")
2630
2631 conf.msg("python headers", "Check disabled due to --disable-python")
2632 # we don't want PYTHONDIR in config.h, as otherwise changing
2633 # --prefix causes a complete rebuild
2634- del(conf.env.defines['PYTHONDIR'])
2635- del(conf.env.defines['PYTHONARCHDIR'])
2636+ conf.env.DEFINES = [x for x in conf.env.DEFINES
2637+ if not x.startswith('PYTHONDIR=')
2638+ and not x.startswith('PYTHONARCHDIR=')]
2639+
2640 return
2641
2642 if conf.env["python_headers_checked"] == []:
2643@@ -64,21 +68,22 @@ def SAMBA_CHECK_PYTHON_HEADERS(conf, mandatory=True):
2644 if conf.env['EXTRA_PYTHON']:
2645 extraversion = conf.all_envs['extrapython']['PYTHON_VERSION']
2646 if extraversion == conf.env['PYTHON_VERSION']:
2647- raise Utils.WafError("extrapython %s is same as main python %s" % (
2648+ raise Errors.WafError("extrapython %s is same as main python %s" % (
2649 extraversion, conf.env['PYTHON_VERSION']))
2650 else:
2651 conf.msg("python headers", "using cache")
2652
2653 # we don't want PYTHONDIR in config.h, as otherwise changing
2654 # --prefix causes a complete rebuild
2655- del(conf.env.defines['PYTHONDIR'])
2656- del(conf.env.defines['PYTHONARCHDIR'])
2657+ conf.env.DEFINES = [x for x in conf.env.DEFINES
2658+ if not x.startswith('PYTHONDIR=')
2659+ and not x.startswith('PYTHONARCHDIR=')]
2660
2661 def _check_python_headers(conf, mandatory):
2662 try:
2663- Configure.ConfigurationError
2664- conf.check_python_headers(mandatory=mandatory)
2665- except Configure.ConfigurationError:
2666+ conf.errors.ConfigurationError
2667+ conf.check_python_headers()
2668+ except conf.errors.ConfigurationError:
2669 if mandatory:
2670 raise
2671
2672@@ -95,6 +100,11 @@ def _check_python_headers(conf, mandatory):
2673 conf.env.append_unique('LIBPATH_PYEMBED', lib[2:]) # strip '-L'
2674 conf.env['LINKFLAGS_PYEMBED'].remove(lib)
2675
2676+ # same as in waf 1.5, keep only '-fno-strict-aliasing'
2677+ # and ignore defines such as NDEBUG _FORTIFY_SOURCE=2
2678+ conf.env.DEFINES_PYEXT = []
2679+ conf.env.CFLAGS_PYEXT = ['-fno-strict-aliasing']
2680+
2681 return
2682
2683 def PYTHON_BUILD_IS_ENABLED(self):
2684@@ -145,7 +155,7 @@ def SAMBA_PYTHON(bld, name,
2685 source = bld.EXPAND_VARIABLES(source, vars=vars)
2686
2687 if realname is not None:
2688- link_name = 'python_modules/%s' % realname
2689+ link_name = 'python/%s' % realname
2690 else:
2691 link_name = None
2692
2693diff --git a/buildtools/wafsamba/samba_third_party.py b/buildtools/wafsamba/samba_third_party.py
2694index 1144f81..e0dd3e1 100644
2695--- a/buildtools/wafsamba/samba_third_party.py
2696+++ b/buildtools/wafsamba/samba_third_party.py
2697@@ -1,12 +1,12 @@
2698 # functions to support third party libraries
2699
2700 import os
2701-import Utils, Build
2702-from Configure import conf
2703+from waflib import Utils, Build, Context
2704+from waflib.Configure import conf
2705
2706 @conf
2707 def CHECK_FOR_THIRD_PARTY(conf):
2708- return os.path.exists(os.path.join(Utils.g_module.srcdir, 'third_party'))
2709+ return os.path.exists(os.path.join(Context.g_module.top, 'third_party'))
2710
2711 Build.BuildContext.CHECK_FOR_THIRD_PARTY = CHECK_FOR_THIRD_PARTY
2712
2713@@ -36,18 +36,18 @@ Build.BuildContext.CHECK_POPT = CHECK_POPT
2714
2715 @conf
2716 def CHECK_CMOCKA(conf):
2717- return conf.CHECK_BUNDLED_SYSTEM_PKG('cmocka', minversion='1.1.1')
2718+ return conf.CHECK_BUNDLED_SYSTEM_PKG('cmocka', minversion='1.1.3')
2719
2720 Build.BuildContext.CHECK_CMOCKA = CHECK_CMOCKA
2721
2722 @conf
2723 def CHECK_SOCKET_WRAPPER(conf):
2724- return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.1.9')
2725+ return conf.CHECK_BUNDLED_SYSTEM_PKG('socket_wrapper', minversion='1.2.1')
2726 Build.BuildContext.CHECK_SOCKET_WRAPPER = CHECK_SOCKET_WRAPPER
2727
2728 @conf
2729 def CHECK_NSS_WRAPPER(conf):
2730- return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.3')
2731+ return conf.CHECK_BUNDLED_SYSTEM_PKG('nss_wrapper', minversion='1.1.5')
2732 Build.BuildContext.CHECK_NSS_WRAPPER = CHECK_NSS_WRAPPER
2733
2734 @conf
2735@@ -62,5 +62,5 @@ Build.BuildContext.CHECK_UID_WRAPPER = CHECK_UID_WRAPPER
2736
2737 @conf
2738 def CHECK_PAM_WRAPPER(conf):
2739- return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.0.4')
2740+ return conf.CHECK_BUNDLED_SYSTEM_PKG('pam_wrapper', minversion='1.0.7')
2741 Build.BuildContext.CHECK_PAM_WRAPPER = CHECK_PAM_WRAPPER
2742diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
2743index 0f95c12..ad97de1 100644
2744--- a/buildtools/wafsamba/samba_utils.py
2745+++ b/buildtools/wafsamba/samba_utils.py
2746@@ -1,30 +1,92 @@
2747 # a waf tool to add autoconf-like macros to the configure section
2748 # and for SAMBA_ macros for building libraries, binaries etc
2749
2750-import os, sys, re, fnmatch, shlex
2751+import errno
2752+import os, sys, re, fnmatch, shlex, inspect
2753 from optparse import SUPPRESS_HELP
2754-import Build, Options, Utils, Task, Logs, Configure
2755-from TaskGen import feature, before, after
2756-from Configure import conf, ConfigurationContext
2757-from Logs import debug
2758+from waflib import Build, Options, Utils, Task, Logs, Configure, Errors, Context
2759+from waflib import Scripting
2760+from waflib.TaskGen import feature, before, after
2761+from waflib.Configure import ConfigurationContext
2762+from waflib.Logs import debug
2763+from waflib import ConfigSet
2764+from waflib.Build import CACHE_SUFFIX
2765
2766 # TODO: make this a --option
2767 LIB_PATH="shared"
2768
2769
2770+PY3 = sys.version_info[0] == 3
2771+
2772+if PY3:
2773+
2774+ # helper function to get a string from a variable that maybe 'str' or
2775+ # 'bytes' if 'bytes' then it is decoded using 'utf8'. If 'str' is passed
2776+ # it is returned unchanged
2777+ # Using this function is PY2/PY3 code should ensure in most cases
2778+ # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
2779+ # decodes the variable (see PY2 implementation of this function below)
2780+ def get_string(bytesorstring):
2781+ tmp = bytesorstring
2782+ if isinstance(bytesorstring, bytes):
2783+ tmp = bytesorstring.decode('utf8')
2784+ elif not isinstance(bytesorstring, str):
2785+ raise ValueError('Expected byte of string for %s:%s' % (type(bytesorstring), bytesorstring))
2786+ return tmp
2787+
2788+else:
2789+
2790+ # Helper function to return string.
2791+ # if 'str' or 'unicode' passed in they are returned unchanged
2792+ # otherwise an exception is generated
2793+ # Using this function is PY2/PY3 code should ensure in most cases
2794+ # the PY2 code runs unchanged in PY2 whereas the code in PY3 possibly
2795+ # decodes the variable (see PY3 implementation of this function above)
2796+ def get_string(bytesorstring):
2797+ tmp = bytesorstring
2798+ if not(isinstance(bytesorstring, str) or isinstance(bytesorstring, unicode)):
2799+ raise ValueError('Expected str or unicode for %s:%s' % (type(bytesorstring), bytesorstring))
2800+ return tmp
2801+
2802 # sigh, python octal constants are a mess
2803 MODE_644 = int('644', 8)
2804+MODE_744 = int('744', 8)
2805 MODE_755 = int('755', 8)
2806+MODE_777 = int('777', 8)
2807+
2808+def conf(f):
2809+ # override in order to propagate the argument "mandatory"
2810+ def fun(*k, **kw):
2811+ mandatory = True
2812+ if 'mandatory' in kw:
2813+ mandatory = kw['mandatory']
2814+ del kw['mandatory']
2815+
2816+ try:
2817+ return f(*k, **kw)
2818+ except Errors.ConfigurationError:
2819+ if mandatory:
2820+ raise
2821+
2822+ fun.__name__ = f.__name__
2823+ if 'mandatory' in inspect.getsource(f):
2824+ fun = f
2825+
2826+ setattr(Configure.ConfigurationContext, f.__name__, fun)
2827+ setattr(Build.BuildContext, f.__name__, fun)
2828+ return f
2829+Configure.conf = conf
2830+Configure.conftest = conf
2831
2832 @conf
2833 def SET_TARGET_TYPE(ctx, target, value):
2834 '''set the target type of a target'''
2835 cache = LOCAL_CACHE(ctx, 'TARGET_TYPE')
2836 if target in cache and cache[target] != 'EMPTY':
2837- Logs.error("ERROR: Target '%s' in directory %s re-defined as %s - was %s" % (target, ctx.curdir, value, cache[target]))
2838+ Logs.error("ERROR: Target '%s' in directory %s re-defined as %s - was %s" % (target, ctx.path.abspath(), value, cache[target]))
2839 sys.exit(1)
2840 LOCAL_CACHE_SET(ctx, 'TARGET_TYPE', target, value)
2841- debug("task_gen: Target '%s' created of type '%s' in %s" % (target, value, ctx.curdir))
2842+ debug("task_gen: Target '%s' created of type '%s' in %s" % (target, value, ctx.path.abspath()))
2843 return True
2844
2845
2846@@ -101,7 +163,7 @@ def LOCAL_CACHE_SET(ctx, cachename, key, value):
2847 def ASSERT(ctx, expression, msg):
2848 '''a build assert call'''
2849 if not expression:
2850- raise Utils.WafError("ERROR: %s\n" % msg)
2851+ raise Errors.WafError("ERROR: %s\n" % msg)
2852 Build.BuildContext.ASSERT = ASSERT
2853
2854
2855@@ -122,9 +184,9 @@ def dict_concat(d1, d2):
2856
2857 def ADD_COMMAND(opt, name, function):
2858 '''add a new top level command to waf'''
2859- Utils.g_module.__dict__[name] = function
2860+ Context.g_module.__dict__[name] = function
2861 opt.name = function
2862-Options.Handler.ADD_COMMAND = ADD_COMMAND
2863+Options.OptionsContext.ADD_COMMAND = ADD_COMMAND
2864
2865
2866 @feature('c', 'cc', 'cshlib', 'cprogram')
2867@@ -199,8 +261,10 @@ def subst_vars_error(string, env):
2868 if re.match('\$\{\w+\}', v):
2869 vname = v[2:-1]
2870 if not vname in env:
2871- raise KeyError("Failed to find variable %s in %s" % (vname, string))
2872+ raise KeyError("Failed to find variable %s in %s in env %s <%s>" % (vname, string, env.__class__, str(env)))
2873 v = env[vname]
2874+ if isinstance(v, list):
2875+ v = ' '.join(v)
2876 out.append(v)
2877 return ''.join(out)
2878
2879@@ -212,51 +276,6 @@ def SUBST_ENV_VAR(ctx, varname):
2880 Build.BuildContext.SUBST_ENV_VAR = SUBST_ENV_VAR
2881
2882
2883-def ENFORCE_GROUP_ORDERING(bld):
2884- '''enforce group ordering for the project. This
2885- makes the group ordering apply only when you specify
2886- a target with --target'''
2887- if Options.options.compile_targets:
2888- @feature('*')
2889- @before('exec_rule', 'apply_core', 'collect')
2890- def force_previous_groups(self):
2891- if getattr(self.bld, 'enforced_group_ordering', False):
2892- return
2893- self.bld.enforced_group_ordering = True
2894-
2895- def group_name(g):
2896- tm = self.bld.task_manager
2897- return [x for x in tm.groups_names if id(tm.groups_names[x]) == id(g)][0]
2898-
2899- my_id = id(self)
2900- bld = self.bld
2901- stop = None
2902- for g in bld.task_manager.groups:
2903- for t in g.tasks_gen:
2904- if id(t) == my_id:
2905- stop = id(g)
2906- debug('group: Forcing up to group %s for target %s',
2907- group_name(g), self.name or self.target)
2908- break
2909- if stop is not None:
2910- break
2911- if stop is None:
2912- return
2913-
2914- for i in xrange(len(bld.task_manager.groups)):
2915- g = bld.task_manager.groups[i]
2916- bld.task_manager.current_group = i
2917- if id(g) == stop:
2918- break
2919- debug('group: Forcing group %s', group_name(g))
2920- for t in g.tasks_gen:
2921- if not getattr(t, 'forced_groups', False):
2922- debug('group: Posting %s', t.name or t.target)
2923- t.forced_groups = True
2924- t.post()
2925-Build.BuildContext.ENFORCE_GROUP_ORDERING = ENFORCE_GROUP_ORDERING
2926-
2927-
2928 def recursive_dirlist(dir, relbase, pattern=None):
2929 '''recursive directory list'''
2930 ret = []
2931@@ -271,6 +290,18 @@ def recursive_dirlist(dir, relbase, pattern=None):
2932 return ret
2933
2934
2935+def symlink(src, dst, force=True):
2936+ """Can create symlink by force"""
2937+ try:
2938+ os.symlink(src, dst)
2939+ except OSError as exc:
2940+ if exc.errno == errno.EEXIST and force:
2941+ os.remove(dst)
2942+ os.symlink(src, dst)
2943+ else:
2944+ raise
2945+
2946+
2947 def mkdir_p(dir):
2948 '''like mkdir -p'''
2949 if not dir:
2950@@ -312,8 +343,7 @@ def EXPAND_VARIABLES(ctx, varstr, vars=None):
2951 if not isinstance(varstr, str):
2952 return varstr
2953
2954- import Environment
2955- env = Environment.Environment()
2956+ env = ConfigSet.ConfigSet()
2957 ret = varstr
2958 # substitute on user supplied dict if avaiilable
2959 if vars is not None:
2960@@ -345,16 +375,18 @@ def RUN_COMMAND(cmd,
2961 return os.WEXITSTATUS(status)
2962 if os.WIFSIGNALED(status):
2963 return - os.WTERMSIG(status)
2964- Logs.error("Unknown exit reason %d for command: %s" (status, cmd))
2965+ Logs.error("Unknown exit reason %d for command: %s" % (status, cmd))
2966 return -1
2967
2968
2969 def RUN_PYTHON_TESTS(testfiles, pythonpath=None, extra_env=None):
2970 env = LOAD_ENVIRONMENT()
2971 if pythonpath is None:
2972- pythonpath = os.path.join(Utils.g_module.blddir, 'python')
2973+ pythonpath = os.path.join(Context.g_module.out, 'python')
2974 result = 0
2975 for interp in env.python_interpreters:
2976+ if not isinstance(interp, str):
2977+ interp = ' '.join(interp)
2978 for testfile in testfiles:
2979 cmd = "PYTHONPATH=%s %s %s" % (pythonpath, interp, testfile)
2980 if extra_env:
2981@@ -374,16 +406,15 @@ try:
2982 # Even if hashlib.md5 exists, it may be unusable.
2983 # Try to use MD5 function. In FIPS mode this will cause an exception
2984 # and we'll get to the replacement code
2985- foo = md5('abcd')
2986+ foo = md5(b'abcd')
2987 except:
2988 try:
2989 import md5
2990 # repeat the same check here, mere success of import is not enough.
2991 # Try to use MD5 function. In FIPS mode this will cause an exception
2992- foo = md5.md5('abcd')
2993+ foo = md5.md5(b'abcd')
2994 except:
2995- import Constants
2996- Constants.SIG_NIL = hash('abcd')
2997+ Context.SIG_NIL = hash('abcd')
2998 class replace_md5(object):
2999 def __init__(self):
3000 self.val = None
3001@@ -409,20 +440,20 @@ except:
3002 def LOAD_ENVIRONMENT():
3003 '''load the configuration environment, allowing access to env vars
3004 from new commands'''
3005- import Environment
3006- env = Environment.Environment()
3007+ env = ConfigSet.ConfigSet()
3008 try:
3009- env.load('.lock-wscript')
3010- env.load(env.blddir + '/c4che/default.cache.py')
3011- except:
3012+ p = os.path.join(Context.g_module.out, 'c4che/default'+CACHE_SUFFIX)
3013+ env.load(p)
3014+ except (OSError, IOError):
3015 pass
3016 return env
3017
3018
3019 def IS_NEWER(bld, file1, file2):
3020 '''return True if file1 is newer than file2'''
3021- t1 = os.stat(os.path.join(bld.curdir, file1)).st_mtime
3022- t2 = os.stat(os.path.join(bld.curdir, file2)).st_mtime
3023+ curdir = bld.path.abspath()
3024+ t1 = os.stat(os.path.join(curdir, file1)).st_mtime
3025+ t2 = os.stat(os.path.join(curdir, file2)).st_mtime
3026 return t1 > t2
3027 Build.BuildContext.IS_NEWER = IS_NEWER
3028
3029@@ -432,47 +463,46 @@ def RECURSE(ctx, directory):
3030 '''recurse into a directory, relative to the curdir or top level'''
3031 try:
3032 visited_dirs = ctx.visited_dirs
3033- except:
3034+ except AttributeError:
3035 visited_dirs = ctx.visited_dirs = set()
3036- d = os.path.join(ctx.curdir, directory)
3037+ d = os.path.join(ctx.path.abspath(), directory)
3038 if os.path.exists(d):
3039 abspath = os.path.abspath(d)
3040 else:
3041- abspath = os.path.abspath(os.path.join(Utils.g_module.srcdir, directory))
3042+ abspath = os.path.abspath(os.path.join(Context.g_module.top, directory))
3043 ctxclass = ctx.__class__.__name__
3044 key = ctxclass + ':' + abspath
3045 if key in visited_dirs:
3046 # already done it
3047 return
3048 visited_dirs.add(key)
3049- relpath = os_path_relpath(abspath, ctx.curdir)
3050- if ctxclass == 'Handler':
3051- return ctx.sub_options(relpath)
3052- if ctxclass == 'ConfigurationContext':
3053- return ctx.sub_config(relpath)
3054- if ctxclass == 'BuildContext':
3055- return ctx.add_subdirs(relpath)
3056- Logs.error('Unknown RECURSE context class', ctxclass)
3057+ relpath = os_path_relpath(abspath, ctx.path.abspath())
3058+ if ctxclass in ['tmp', 'OptionsContext', 'ConfigurationContext', 'BuildContext']:
3059+ return ctx.recurse(relpath)
3060+ if 'waflib.extras.compat15' in sys.modules:
3061+ return ctx.recurse(relpath)
3062+ Logs.error('Unknown RECURSE context class: {}'.format(ctxclass))
3063 raise
3064-Options.Handler.RECURSE = RECURSE
3065+Options.OptionsContext.RECURSE = RECURSE
3066 Build.BuildContext.RECURSE = RECURSE
3067
3068
3069-def CHECK_MAKEFLAGS(bld):
3070+def CHECK_MAKEFLAGS(options):
3071 '''check for MAKEFLAGS environment variable in case we are being
3072 called from a Makefile try to honor a few make command line flags'''
3073 if not 'WAF_MAKE' in os.environ:
3074 return
3075 makeflags = os.environ.get('MAKEFLAGS')
3076 if makeflags is None:
3077- return
3078+ makeflags = ""
3079 jobs_set = False
3080+ jobs = None
3081 # we need to use shlex.split to cope with the escaping of spaces
3082 # in makeflags
3083 for opt in shlex.split(makeflags):
3084 # options can come either as -x or as x
3085 if opt[0:2] == 'V=':
3086- Options.options.verbose = Logs.verbose = int(opt[2:])
3087+ options.verbose = Logs.verbose = int(opt[2:])
3088 if Logs.verbose > 0:
3089 Logs.zones = ['runner']
3090 if Logs.verbose > 2:
3091@@ -486,22 +516,53 @@ def CHECK_MAKEFLAGS(bld):
3092 # this is also how "make test TESTS=testpattern" works, and
3093 # "make VERBOSE=1" as well as things like "make SYMBOLCHECK=1"
3094 loc = opt.find('=')
3095- setattr(Options.options, opt[0:loc], opt[loc+1:])
3096+ setattr(options, opt[0:loc], opt[loc+1:])
3097 elif opt[0] != '-':
3098 for v in opt:
3099- if v == 'j':
3100+ if re.search(r'j[0-9]*$', v):
3101 jobs_set = True
3102+ jobs = opt.strip('j')
3103 elif v == 'k':
3104- Options.options.keep = True
3105- elif opt == '-j':
3106+ options.keep = True
3107+ elif re.search(r'-j[0-9]*$', opt):
3108 jobs_set = True
3109+ jobs = opt.strip('-j')
3110 elif opt == '-k':
3111- Options.options.keep = True
3112+ options.keep = True
3113 if not jobs_set:
3114 # default to one job
3115- Options.options.jobs = 1
3116-
3117-Build.BuildContext.CHECK_MAKEFLAGS = CHECK_MAKEFLAGS
3118+ options.jobs = 1
3119+ elif jobs_set and jobs:
3120+ options.jobs = int(jobs)
3121+
3122+waflib_options_parse_cmd_args = Options.OptionsContext.parse_cmd_args
3123+def wafsamba_options_parse_cmd_args(self, _args=None, cwd=None, allow_unknown=False):
3124+ (options, commands, envvars) = \
3125+ waflib_options_parse_cmd_args(self,
3126+ _args=_args,
3127+ cwd=cwd,
3128+ allow_unknown=allow_unknown)
3129+ CHECK_MAKEFLAGS(options)
3130+ if options.jobs == 1:
3131+ #
3132+ # waflib.Runner.Parallel processes jobs inline if the possible number
3133+ # of jobs is just 1. But (at least in waf <= 2.0.12) it still calls
3134+ # create a waflib.Runner.Spawner() which creates a single
3135+ # waflib.Runner.Consumer() thread that tries to process jobs from the
3136+ # queue.
3137+ #
3138+ # This has strange effects, which are not noticed typically,
3139+ # but at least on AIX python has broken threading and fails
3140+ # in random ways.
3141+ #
3142+ # So we just add a dummy Spawner class.
3143+ class NoOpSpawner(object):
3144+ def __init__(self, master):
3145+ return
3146+ from waflib import Runner
3147+ Runner.Spawner = NoOpSpawner
3148+ return options, commands, envvars
3149+Options.OptionsContext.parse_cmd_args = wafsamba_options_parse_cmd_args
3150
3151 option_groups = {}
3152
3153@@ -513,7 +574,7 @@ def option_group(opt, name):
3154 gr = opt.add_option_group(name)
3155 option_groups[name] = gr
3156 return gr
3157-Options.Handler.option_group = option_group
3158+Options.OptionsContext.option_group = option_group
3159
3160
3161 def save_file(filename, contents, create_dir=False):
3162@@ -542,9 +603,9 @@ def load_file(filename):
3163
3164 def reconfigure(ctx):
3165 '''rerun configure if necessary'''
3166- import Configure, samba_wildcard, Scripting
3167- if not os.path.exists(".lock-wscript"):
3168- raise Utils.WafError('configure has not been run')
3169+ if not os.path.exists(os.environ.get('WAFLOCK', '.lock-wscript')):
3170+ raise Errors.WafError('configure has not been run')
3171+ import samba_wildcard
3172 bld = samba_wildcard.fake_build_environment()
3173 Configure.autoconfig = True
3174 Scripting.check_configured(bld)
3175@@ -561,7 +622,7 @@ def map_shlib_extension(ctx, name, python=False):
3176 if python:
3177 return ctx.env.pyext_PATTERN % root1
3178 else:
3179- (root2, ext2) = os.path.splitext(ctx.env.shlib_PATTERN)
3180+ (root2, ext2) = os.path.splitext(ctx.env.cshlib_PATTERN)
3181 return root1+ext2
3182 Build.BuildContext.map_shlib_extension = map_shlib_extension
3183
3184@@ -583,7 +644,7 @@ def make_libname(ctx, name, nolibprefix=False, version=None, python=False):
3185 if python:
3186 libname = apply_pattern(name, ctx.env.pyext_PATTERN)
3187 else:
3188- libname = apply_pattern(name, ctx.env.shlib_PATTERN)
3189+ libname = apply_pattern(name, ctx.env.cshlib_PATTERN)
3190 if nolibprefix and libname[0:3] == 'lib':
3191 libname = libname[3:]
3192 if version:
3193@@ -617,7 +678,7 @@ def get_tgt_list(bld):
3194 tgt_list.append(t)
3195 return tgt_list
3196
3197-from Constants import WSCRIPT_FILE
3198+from waflib.Context import WSCRIPT_FILE
3199 def PROCESS_SEPARATE_RULE(self, rule):
3200 ''' cause waf to process additional script based on `rule'.
3201 You should have file named wscript_<stage>_rule in the current directory
3202@@ -628,15 +689,21 @@ def PROCESS_SEPARATE_RULE(self, rule):
3203 stage = 'configure'
3204 elif isinstance(self, Build.BuildContext):
3205 stage = 'build'
3206- file_path = os.path.join(self.curdir, WSCRIPT_FILE+'_'+stage+'_'+rule)
3207- txt = load_file(file_path)
3208- if txt:
3209- dc = {'ctx': self}
3210- if getattr(self.__class__, 'pre_recurse', None):
3211- dc = self.pre_recurse(txt, file_path, self.curdir)
3212- exec(compile(txt, file_path, 'exec'), dc)
3213- if getattr(self.__class__, 'post_recurse', None):
3214- dc = self.post_recurse(txt, file_path, self.curdir)
3215+ file_path = os.path.join(self.path.abspath(), WSCRIPT_FILE+'_'+stage+'_'+rule)
3216+ node = self.root.find_node(file_path)
3217+ if node:
3218+ try:
3219+ cache = self.recurse_cache
3220+ except AttributeError:
3221+ cache = self.recurse_cache = {}
3222+ if node not in cache:
3223+ cache[node] = True
3224+ self.pre_recurse(node)
3225+ try:
3226+ function_code = node.read('rU', None)
3227+ exec(compile(function_code, node.abspath(), 'exec'), self.exec_dict)
3228+ finally:
3229+ self.post_recurse(node)
3230
3231 Build.BuildContext.PROCESS_SEPARATE_RULE = PROCESS_SEPARATE_RULE
3232 ConfigurationContext.PROCESS_SEPARATE_RULE = PROCESS_SEPARATE_RULE
3233@@ -693,4 +760,4 @@ def samba_add_onoff_option(opt, option, help=(), dest=None, default=True,
3234 default=default)
3235 opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
3236 dest=dest)
3237-Options.Handler.samba_add_onoff_option = samba_add_onoff_option
3238+Options.OptionsContext.samba_add_onoff_option = samba_add_onoff_option
3239diff --git a/buildtools/wafsamba/samba_version.py b/buildtools/wafsamba/samba_version.py
3240index be26439..f0e7b4d 100644
3241--- a/buildtools/wafsamba/samba_version.py
3242+++ b/buildtools/wafsamba/samba_version.py
3243@@ -1,5 +1,5 @@
3244-import os
3245-import Utils
3246+import os, sys
3247+from waflib import Utils, Context
3248 import samba_utils
3249 from samba_git import find_git
3250
3251@@ -14,7 +14,7 @@ def git_version_summary(path, env=None):
3252 environ = dict(os.environ)
3253 environ["GIT_DIR"] = '%s/.git' % path
3254 environ["GIT_WORK_TREE"] = path
3255- git = Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ)
3256+ git = samba_utils.get_string(Utils.cmd_output(env.GIT + ' show --pretty=format:"%h%n%ct%n%H%n%cd" --stat HEAD', silent=True, env=environ))
3257
3258 lines = git.splitlines()
3259 if not lines or len(lines) < 4:
3260@@ -198,7 +198,10 @@ also accepted as dictionary entries here
3261 for name in sorted(self.vcs_fields.keys()):
3262 string+="#define SAMBA_VERSION_%s " % name
3263 value = self.vcs_fields[name]
3264- if isinstance(value, basestring):
3265+ string_types = str
3266+ if sys.version_info[0] < 3:
3267+ string_types = basestring
3268+ if isinstance(value, string_types):
3269 string += "\"%s\"" % value
3270 elif type(value) is int:
3271 string += "%d" % value
3272@@ -260,5 +263,5 @@ def load_version(env=None, is_install=True):
3273 env = samba_utils.LOAD_ENVIRONMENT()
3274
3275 version = samba_version_file("./VERSION", ".", env, is_install=is_install)
3276- Utils.g_module.VERSION = version.STRING
3277+ Context.g_module.VERSION = version.STRING
3278 return version
3279diff --git a/buildtools/wafsamba/samba_waf18.py b/buildtools/wafsamba/samba_waf18.py
3280new file mode 100644
3281index 0000000..cc310fb
3282--- /dev/null
3283+++ b/buildtools/wafsamba/samba_waf18.py
3284@@ -0,0 +1,429 @@
3285+# compatibility layer for building with more recent waf versions
3286+
3287+import os, shlex, sys
3288+from waflib import Build, Configure, Node, Utils, Options, Logs, TaskGen
3289+from waflib import ConfigSet
3290+from waflib.TaskGen import feature, after
3291+from waflib.Configure import conf, ConfigurationContext
3292+
3293+from waflib.Tools.flex import decide_ext
3294+
3295+# This version of flexfun runs in tsk.get_cwd() as opposed to the
3296+# bld.variant_dir: since input paths adjusted against tsk.get_cwd(), we have to
3297+# use tsk.get_cwd() for the work directory as well.
3298+def flexfun(tsk):
3299+ env = tsk.env
3300+ bld = tsk.generator.bld
3301+ def to_list(xx):
3302+ if isinstance(xx, str):
3303+ return [xx]
3304+ return xx
3305+ tsk.last_cmd = lst = []
3306+ lst.extend(to_list(env.FLEX))
3307+ lst.extend(to_list(env.FLEXFLAGS))
3308+ inputs = [a.path_from(tsk.get_cwd()) for a in tsk.inputs]
3309+ if env.FLEX_MSYS:
3310+ inputs = [x.replace(os.sep, '/') for x in inputs]
3311+ lst.extend(inputs)
3312+ lst = [x for x in lst if x]
3313+ txt = bld.cmd_and_log(lst, cwd=tsk.get_cwd(), env=env.env or None, quiet=0)
3314+ tsk.outputs[0].write(txt.replace('\r\n', '\n').replace('\r', '\n')) # issue #1207
3315+
3316+TaskGen.declare_chain(
3317+ name = 'flex',
3318+ rule = flexfun, # issue #854
3319+ ext_in = '.l',
3320+ decider = decide_ext,
3321+)
3322+
3323+
3324+for y in (Build.BuildContext, Build.CleanContext, Build.InstallContext, Build.UninstallContext, Build.ListContext):
3325+ class tmp(y):
3326+ variant = 'default'
3327+
3328+def abspath(self, env=None):
3329+ if env and hasattr(self, 'children'):
3330+ return self.get_bld().abspath()
3331+ return self.old_abspath()
3332+Node.Node.old_abspath = Node.Node.abspath
3333+Node.Node.abspath = abspath
3334+
3335+def bldpath(self, env=None):
3336+ return self.abspath()
3337+ #return self.path_from(self.ctx.bldnode.parent)
3338+Node.Node.bldpath = bldpath
3339+
3340+def srcpath(self, env=None):
3341+ return self.abspath()
3342+ #return self.path_from(self.ctx.bldnode.parent)
3343+Node.Node.srcpath = srcpath
3344+
3345+def store_fast(self, filename):
3346+ file = open(filename, 'wb')
3347+ data = self.get_merged_dict()
3348+ try:
3349+ Build.cPickle.dump(data, file, -1)
3350+ finally:
3351+ file.close()
3352+ConfigSet.ConfigSet.store_fast = store_fast
3353+
3354+def load_fast(self, filename):
3355+ file = open(filename, 'rb')
3356+ try:
3357+ data = Build.cPickle.load(file)
3358+ finally:
3359+ file.close()
3360+ self.table.update(data)
3361+ConfigSet.ConfigSet.load_fast = load_fast
3362+
3363+@feature('c', 'cxx', 'd', 'asm', 'fc', 'includes')
3364+@after('propagate_uselib_vars', 'process_source')
3365+def apply_incpaths(self):
3366+ lst = self.to_incnodes(self.to_list(getattr(self, 'includes', [])) + self.env['INCLUDES'])
3367+ self.includes_nodes = lst
3368+ cwdx = getattr(self.bld, 'cwdx', self.bld.bldnode)
3369+ self.env['INCPATHS'] = [x.path_from(cwdx) for x in lst]
3370+
3371+@conf
3372+def define(self, key, val, quote=True, comment=None):
3373+ assert key and isinstance(key, str)
3374+
3375+ if val is None:
3376+ val = ()
3377+ elif isinstance(val, bool):
3378+ val = int(val)
3379+
3380+ # waf 1.5
3381+ self.env[key] = val
3382+
3383+ if isinstance(val, int) or isinstance(val, float):
3384+ s = '%s=%s'
3385+ else:
3386+ s = quote and '%s="%s"' or '%s=%s'
3387+ app = s % (key, str(val))
3388+
3389+ ban = key + '='
3390+ lst = self.env.DEFINES
3391+ for x in lst:
3392+ if x.startswith(ban):
3393+ lst[lst.index(x)] = app
3394+ break
3395+ else:
3396+ self.env.append_value('DEFINES', app)
3397+
3398+ self.env.append_unique('define_key', key)
3399+
3400+# compat15 removes this but we want to keep it
3401+@conf
3402+def undefine(self, key, from_env=True, comment=None):
3403+ assert key and isinstance(key, str)
3404+
3405+ ban = key + '='
3406+ self.env.DEFINES = [x for x in self.env.DEFINES if not x.startswith(ban)]
3407+ self.env.append_unique('define_key', key)
3408+ # waf 1.5
3409+ if from_env:
3410+ self.env[key] = ()
3411+
3412+class ConfigurationContext(Configure.ConfigurationContext):
3413+ def init_dirs(self):
3414+ self.setenv('default')
3415+ self.env.merge_config_header = True
3416+ return super(ConfigurationContext, self).init_dirs()
3417+
3418+def find_program_samba(self, *k, **kw):
3419+ kw['mandatory'] = False
3420+ ret = self.find_program_old(*k, **kw)
3421+ return ret
3422+Configure.ConfigurationContext.find_program_old = Configure.ConfigurationContext.find_program
3423+Configure.ConfigurationContext.find_program = find_program_samba
3424+
3425+Build.BuildContext.ENFORCE_GROUP_ORDERING = Utils.nada
3426+Build.BuildContext.AUTOCLEANUP_STALE_FILES = Utils.nada
3427+
3428+@conf
3429+def check(self, *k, **kw):
3430+ '''Override the waf defaults to inject --with-directory options'''
3431+
3432+ # match the configuration test with speficic options, for example:
3433+ # --with-libiconv -> Options.options.iconv_open -> "Checking for library iconv"
3434+ self.validate_c(kw)
3435+
3436+ additional_dirs = []
3437+ if 'msg' in kw:
3438+ msg = kw['msg']
3439+ for x in Options.OptionsContext.parser.parser.option_list:
3440+ if getattr(x, 'match', None) and msg in x.match:
3441+ d = getattr(Options.options, x.dest, '')
3442+ if d:
3443+ additional_dirs.append(d)
3444+
3445+ # we add the additional dirs twice: once for the test data, and again if the compilation test suceeds below
3446+ def add_options_dir(dirs, env):
3447+ for x in dirs:
3448+ if not x in env.CPPPATH:
3449+ env.CPPPATH = [os.path.join(x, 'include')] + env.CPPPATH
3450+ if not x in env.LIBPATH:
3451+ env.LIBPATH = [os.path.join(x, 'lib')] + env.LIBPATH
3452+
3453+ add_options_dir(additional_dirs, kw['env'])
3454+
3455+ self.start_msg(kw['msg'], **kw)
3456+ ret = None
3457+ try:
3458+ ret = self.run_build(*k, **kw)
3459+ except self.errors.ConfigurationError:
3460+ self.end_msg(kw['errmsg'], 'YELLOW', **kw)
3461+ if Logs.verbose > 1:
3462+ raise
3463+ else:
3464+ self.fatal('The configuration failed')
3465+ else:
3466+ kw['success'] = ret
3467+ # success! time for brandy
3468+ add_options_dir(additional_dirs, self.env)
3469+
3470+ ret = self.post_check(*k, **kw)
3471+ if not ret:
3472+ self.end_msg(kw['errmsg'], 'YELLOW', **kw)
3473+ self.fatal('The configuration failed %r' % ret)
3474+ else:
3475+ self.end_msg(self.ret_msg(kw['okmsg'], kw), **kw)
3476+ return ret
3477+
3478+@conf
3479+def CHECK_LIBRARY_SUPPORT(conf, rpath=False, version_script=False, msg=None):
3480+ '''see if the platform supports building libraries'''
3481+
3482+ if msg is None:
3483+ if rpath:
3484+ msg = "rpath library support"
3485+ else:
3486+ msg = "building library support"
3487+
3488+ def build(bld):
3489+ lib_node = bld.srcnode.make_node('libdir/liblc1.c')
3490+ lib_node.parent.mkdir()
3491+ lib_node.write('int lib_func(void) { return 42; }\n', 'w')
3492+ main_node = bld.srcnode.make_node('main.c')
3493+ main_node.write('int main(void) {return !(lib_func() == 42);}', 'w')
3494+ linkflags = []
3495+ if version_script:
3496+ script = bld.srcnode.make_node('ldscript')
3497+ script.write('TEST_1.0A2 { global: *; };\n', 'w')
3498+ linkflags.append('-Wl,--version-script=%s' % script.abspath())
3499+ bld(features='c cshlib', source=lib_node, target='lib1', linkflags=linkflags, name='lib1')
3500+ o = bld(features='c cprogram', source=main_node, target='prog1', uselib_local='lib1')
3501+ if rpath:
3502+ o.rpath = [lib_node.parent.abspath()]
3503+ def run_app(self):
3504+ args = conf.SAMBA_CROSS_ARGS(msg=msg)
3505+ env = dict(os.environ)
3506+ env['LD_LIBRARY_PATH'] = self.inputs[0].parent.abspath() + os.pathsep + env.get('LD_LIBRARY_PATH', '')
3507+ self.generator.bld.cmd_and_log([self.inputs[0].abspath()] + args, env=env)
3508+ o.post()
3509+ bld(rule=run_app, source=o.link_task.outputs[0])
3510+
3511+ # ok, so it builds
3512+ try:
3513+ conf.check(build_fun=build, msg='Checking for %s' % msg)
3514+ except conf.errors.ConfigurationError:
3515+ return False
3516+ return True
3517+
3518+@conf
3519+def CHECK_NEED_LC(conf, msg):
3520+ '''check if we need -lc'''
3521+ def build(bld):
3522+ lib_node = bld.srcnode.make_node('libdir/liblc1.c')
3523+ lib_node.parent.mkdir()
3524+ lib_node.write('#include <stdio.h>\nint lib_func(void) { FILE *f = fopen("foo", "r");}\n', 'w')
3525+ bld(features='c cshlib', source=[lib_node], linkflags=conf.env.EXTRA_LDFLAGS, target='liblc')
3526+ try:
3527+ conf.check(build_fun=build, msg=msg, okmsg='-lc is unnecessary', errmsg='-lc is necessary')
3528+ except conf.errors.ConfigurationError:
3529+ return False
3530+ return True
3531+
3532+# already implemented on "waf -v"
3533+def order(bld, tgt_list):
3534+ return True
3535+Build.BuildContext.check_group_ordering = order
3536+
3537+@conf
3538+def CHECK_CFG(self, *k, **kw):
3539+ if 'args' in kw:
3540+ kw['args'] = shlex.split(kw['args'])
3541+ if not 'mandatory' in kw:
3542+ kw['mandatory'] = False
3543+ kw['global_define'] = True
3544+ return self.check_cfg(*k, **kw)
3545+
3546+def cmd_output(cmd, **kw):
3547+
3548+ silent = False
3549+ if 'silent' in kw:
3550+ silent = kw['silent']
3551+ del(kw['silent'])
3552+
3553+ if 'e' in kw:
3554+ tmp = kw['e']
3555+ del(kw['e'])
3556+ kw['env'] = tmp
3557+
3558+ kw['shell'] = isinstance(cmd, str)
3559+ kw['stdout'] = Utils.subprocess.PIPE
3560+ if silent:
3561+ kw['stderr'] = Utils.subprocess.PIPE
3562+
3563+ try:
3564+ p = Utils.subprocess.Popen(cmd, **kw)
3565+ output = p.communicate()[0]
3566+ except OSError as e:
3567+ raise ValueError(str(e))
3568+
3569+ if p.returncode:
3570+ if not silent:
3571+ msg = "command execution failed: %s -> %r" % (cmd, str(output))
3572+ raise ValueError(msg)
3573+ output = ''
3574+ return output
3575+Utils.cmd_output = cmd_output
3576+
3577+
3578+@TaskGen.feature('c', 'cxx', 'd')
3579+@TaskGen.before('apply_incpaths', 'propagate_uselib_vars')
3580+@TaskGen.after('apply_link', 'process_source')
3581+def apply_uselib_local(self):
3582+ """
3583+ process the uselib_local attribute
3584+ execute after apply_link because of the execution order set on 'link_task'
3585+ """
3586+ env = self.env
3587+ from waflib.Tools.ccroot import stlink_task
3588+
3589+ # 1. the case of the libs defined in the project (visit ancestors first)
3590+ # the ancestors external libraries (uselib) will be prepended
3591+ self.uselib = self.to_list(getattr(self, 'uselib', []))
3592+ self.includes = self.to_list(getattr(self, 'includes', []))
3593+ names = self.to_list(getattr(self, 'uselib_local', []))
3594+ get = self.bld.get_tgen_by_name
3595+ seen = set()
3596+ seen_uselib = set()
3597+ tmp = Utils.deque(names) # consume a copy of the list of names
3598+ if tmp:
3599+ if Logs.verbose:
3600+ Logs.warn('compat: "uselib_local" is deprecated, replace by "use"')
3601+ while tmp:
3602+ lib_name = tmp.popleft()
3603+ # visit dependencies only once
3604+ if lib_name in seen:
3605+ continue
3606+
3607+ y = get(lib_name)
3608+ y.post()
3609+ seen.add(lib_name)
3610+
3611+ # object has ancestors to process (shared libraries): add them to the end of the list
3612+ if getattr(y, 'uselib_local', None):
3613+ for x in self.to_list(getattr(y, 'uselib_local', [])):
3614+ obj = get(x)
3615+ obj.post()
3616+ if getattr(obj, 'link_task', None):
3617+ if not isinstance(obj.link_task, stlink_task):
3618+ tmp.append(x)
3619+
3620+ # link task and flags
3621+ if getattr(y, 'link_task', None):
3622+
3623+ link_name = y.target[y.target.rfind(os.sep) + 1:]
3624+ if isinstance(y.link_task, stlink_task):
3625+ env.append_value('STLIB', [link_name])
3626+ else:
3627+ # some linkers can link against programs
3628+ env.append_value('LIB', [link_name])
3629+
3630+ # the order
3631+ self.link_task.set_run_after(y.link_task)
3632+
3633+ # for the recompilation
3634+ self.link_task.dep_nodes += y.link_task.outputs
3635+
3636+ # add the link path too
3637+ tmp_path = y.link_task.outputs[0].parent.bldpath()
3638+ if not tmp_path in env['LIBPATH']:
3639+ env.prepend_value('LIBPATH', [tmp_path])
3640+
3641+ # add ancestors uselib too - but only propagate those that have no staticlib defined
3642+ for v in self.to_list(getattr(y, 'uselib', [])):
3643+ if v not in seen_uselib:
3644+ seen_uselib.add(v)
3645+ if not env['STLIB_' + v]:
3646+ if not v in self.uselib:
3647+ self.uselib.insert(0, v)
3648+
3649+ # if the library task generator provides 'export_includes', add to the include path
3650+ # the export_includes must be a list of paths relative to the other library
3651+ if getattr(y, 'export_includes', None):
3652+ self.includes.extend(y.to_incnodes(y.export_includes))
3653+
3654+@TaskGen.feature('cprogram', 'cxxprogram', 'cstlib', 'cxxstlib', 'cshlib', 'cxxshlib', 'dprogram', 'dstlib', 'dshlib')
3655+@TaskGen.after('apply_link')
3656+def apply_objdeps(self):
3657+ "add the .o files produced by some other object files in the same manner as uselib_local"
3658+ names = getattr(self, 'add_objects', [])
3659+ if not names:
3660+ return
3661+ names = self.to_list(names)
3662+
3663+ get = self.bld.get_tgen_by_name
3664+ seen = []
3665+ while names:
3666+ x = names[0]
3667+
3668+ # visit dependencies only once
3669+ if x in seen:
3670+ names = names[1:]
3671+ continue
3672+
3673+ # object does not exist ?
3674+ y = get(x)
3675+
3676+ # object has ancestors to process first ? update the list of names
3677+ if getattr(y, 'add_objects', None):
3678+ added = 0
3679+ lst = y.to_list(y.add_objects)
3680+ lst.reverse()
3681+ for u in lst:
3682+ if u in seen:
3683+ continue
3684+ added = 1
3685+ names = [u]+names
3686+ if added:
3687+ continue # list of names modified, loop
3688+
3689+ # safe to process the current object
3690+ y.post()
3691+ seen.append(x)
3692+
3693+ for t in getattr(y, 'compiled_tasks', []):
3694+ self.link_task.inputs.extend(t.outputs)
3695+
3696+@TaskGen.after('apply_link')
3697+def process_obj_files(self):
3698+ if not hasattr(self, 'obj_files'):
3699+ return
3700+ for x in self.obj_files:
3701+ node = self.path.find_resource(x)
3702+ self.link_task.inputs.append(node)
3703+
3704+@TaskGen.taskgen_method
3705+def add_obj_file(self, file):
3706+ """Small example on how to link object files as if they were source
3707+ obj = bld.create_obj('cc')
3708+ obj.add_obj_file('foo.o')"""
3709+ if not hasattr(self, 'obj_files'):
3710+ self.obj_files = []
3711+ if not 'process_obj_files' in self.meths:
3712+ self.meths.append('process_obj_files')
3713+ self.obj_files.append(file)
3714diff --git a/buildtools/wafsamba/samba_wildcard.py b/buildtools/wafsamba/samba_wildcard.py
3715index ed3e0c2..6173ce8 100644
3716--- a/buildtools/wafsamba/samba_wildcard.py
3717+++ b/buildtools/wafsamba/samba_wildcard.py
3718@@ -1,15 +1,15 @@
3719 # based on playground/evil in the waf svn tree
3720
3721 import os, datetime, fnmatch
3722-import Scripting, Utils, Options, Logs, Environment
3723-from Constants import SRCDIR, BLDDIR
3724+from waflib import Scripting, Utils, Options, Logs, Errors
3725+from waflib import ConfigSet, Context
3726 from samba_utils import LOCAL_CACHE, os_path_relpath
3727
3728 def run_task(t, k):
3729 '''run a single build task'''
3730 ret = t.run()
3731 if ret:
3732- raise Utils.WafError("Failed to build %s: %u" % (k, ret))
3733+ raise Errors.WafError("Failed to build %s: %u" % (k, ret))
3734
3735
3736 def run_named_build_task(cmd):
3737@@ -45,7 +45,7 @@ def run_named_build_task(cmd):
3738
3739
3740 if not found:
3741- raise Utils.WafError("Unable to find build target matching %s" % cmd)
3742+ raise Errors.WafError("Unable to find build target matching %s" % cmd)
3743
3744
3745 def rewrite_compile_targets():
3746@@ -125,7 +125,7 @@ def wildcard_main(missing_cmd_fn):
3747 def fake_build_environment(info=True, flush=False):
3748 """create all the tasks for the project, but do not run the build
3749 return the build context in use"""
3750- bld = getattr(Utils.g_module, 'build_context', Utils.Context)()
3751+ bld = getattr(Context.g_module, 'build_context', Utils.Context)()
3752 bld = Scripting.check_configured(bld)
3753
3754 Options.commands['install'] = False
3755@@ -134,16 +134,15 @@ def fake_build_environment(info=True, flush=False):
3756 bld.is_install = 0 # False
3757
3758 try:
3759- proj = Environment.Environment(Options.lockfile)
3760+ proj = ConfigSet.ConfigSet(Options.lockfile)
3761 except IOError:
3762- raise Utils.WafError("Project not configured (run 'waf configure' first)")
3763+ raise Errors.WafError("Project not configured (run 'waf configure' first)")
3764
3765- bld.load_dirs(proj[SRCDIR], proj[BLDDIR])
3766 bld.load_envs()
3767
3768 if info:
3769 Logs.info("Waf: Entering directory `%s'" % bld.bldnode.abspath())
3770- bld.add_subdirs([os.path.split(Utils.g_module.root_path)[0]])
3771+ bld.add_subdirs([os.path.split(Context.g_module.root_path)[0]])
3772
3773 bld.pre_build()
3774 if flush:
3775diff --git a/buildtools/wafsamba/stale_files.py b/buildtools/wafsamba/stale_files.py
3776index 2dd08e1..175f573 100644
3777--- a/buildtools/wafsamba/stale_files.py
3778+++ b/buildtools/wafsamba/stale_files.py
3779@@ -14,7 +14,9 @@ nodes/tasks, in which case the method will have to be modified
3780 to exclude some folders for example.
3781 """
3782
3783-import Logs, Build, os, samba_utils, Options, Utils
3784+from waflib import Logs, Build, Options, Utils, Errors
3785+import os
3786+from wafsamba import samba_utils
3787 from Runner import Parallel
3788
3789 old_refill_task_list = Parallel.refill_task_list
3790@@ -46,7 +48,7 @@ def replace_refill_task_list(self):
3791
3792 # paranoia
3793 if bin_base[-4:] != '/bin':
3794- raise Utils.WafError("Invalid bin base: %s" % bin_base)
3795+ raise Errors.WafError("Invalid bin base: %s" % bin_base)
3796
3797 # obtain the expected list of files
3798 expected = []
3799diff --git a/buildtools/wafsamba/symbols.py b/buildtools/wafsamba/symbols.py
3800index 7ff4bac..3eca3d4 100644
3801--- a/buildtools/wafsamba/symbols.py
3802+++ b/buildtools/wafsamba/symbols.py
3803@@ -2,8 +2,8 @@
3804 # using nm, producing a set of exposed defined/undefined symbols
3805
3806 import os, re, subprocess
3807-import Utils, Build, Options, Logs
3808-from Logs import debug
3809+from waflib import Utils, Build, Options, Logs, Errors
3810+from waflib.Logs import debug
3811 from samba_utils import TO_LIST, LOCAL_CACHE, get_tgt_list, os_path_relpath
3812
3813 # these are the data structures used in symbols.py:
3814@@ -59,12 +59,12 @@ def symbols_extract(bld, objfiles, dynamic=False):
3815
3816 for line in nmpipe:
3817 line = line.strip()
3818- if line.endswith(':'):
3819+ if line.endswith(b':'):
3820 filename = line[:-1]
3821 ret[filename] = { "PUBLIC": set(), "UNDEFINED" : set() }
3822 continue
3823- cols = line.split(" ")
3824- if cols == ['']:
3825+ cols = line.split(b" ")
3826+ if cols == [b'']:
3827 continue
3828 # see if the line starts with an address
3829 if len(cols) == 3:
3830@@ -73,10 +73,10 @@ def symbols_extract(bld, objfiles, dynamic=False):
3831 else:
3832 symbol_type = cols[0]
3833 symbol = cols[1]
3834- if symbol_type in "BDGTRVWSi":
3835+ if symbol_type in b"BDGTRVWSi":
3836 # its a public symbol
3837 ret[filename]["PUBLIC"].add(symbol)
3838- elif symbol_type in "U":
3839+ elif symbol_type in b"U":
3840 ret[filename]["UNDEFINED"].add(symbol)
3841
3842 # add to the cache
3843@@ -106,10 +106,10 @@ def find_ldd_path(bld, libname, binary):
3844 lddpipe = subprocess.Popen(['ldd', binary], stdout=subprocess.PIPE).stdout
3845 for line in lddpipe:
3846 line = line.strip()
3847- cols = line.split(" ")
3848- if len(cols) < 3 or cols[1] != "=>":
3849+ cols = line.split(b" ")
3850+ if len(cols) < 3 or cols[1] != b"=>":
3851 continue
3852- if cols[0].startswith("libc."):
3853+ if cols[0].startswith(b"libc."):
3854 # save this one too
3855 bld.env.libc_path = cols[2]
3856 if cols[0].startswith(libname):
3857@@ -119,8 +119,9 @@ def find_ldd_path(bld, libname, binary):
3858
3859
3860 # some regular expressions for parsing readelf output
3861-re_sharedlib = re.compile('Shared library: \[(.*)\]')
3862-re_rpath = re.compile('Library rpath: \[(.*)\]')
3863+re_sharedlib = re.compile(b'Shared library: \[(.*)\]')
3864+# output from readelf could be `Library rpath` or `Libray runpath`
3865+re_rpath = re.compile(b'Library (rpath|runpath): \[(.*)\]')
3866
3867 def get_libs(bld, binname):
3868 '''find the list of linked libraries for any binary or library
3869@@ -146,7 +147,8 @@ def get_libs(bld, binname):
3870 libs.add(m.group(1))
3871 m = re_rpath.search(line)
3872 if m:
3873- rpath.extend(m.group(1).split(":"))
3874+ # output from Popen is always bytestr even in py3
3875+ rpath.extend(m.group(2).split(b":"))
3876
3877 ret = set()
3878 for lib in libs:
3879@@ -410,7 +412,7 @@ def check_library_deps(bld, t):
3880 if dep2 == name and t.in_library != t2.in_library:
3881 Logs.warn("WARNING: mutual dependency %s <=> %s" % (name, real_name(t2.sname)))
3882 Logs.warn("Libraries should match. %s != %s" % (t.in_library, t2.in_library))
3883- # raise Utils.WafError("illegal mutual dependency")
3884+ # raise Errors.WafError("illegal mutual dependency")
3885
3886
3887 def check_syslib_collisions(bld, tgt_list):
3888@@ -430,7 +432,7 @@ def check_syslib_collisions(bld, tgt_list):
3889 Logs.error("ERROR: Target '%s' has symbols '%s' which is also in syslib '%s'" % (t.sname, common, lib))
3890 has_error = True
3891 if has_error:
3892- raise Utils.WafError("symbols in common with system libraries")
3893+ raise Errors.WafError("symbols in common with system libraries")
3894
3895
3896 def check_dependencies(bld, t):
3897@@ -546,7 +548,7 @@ def symbols_whyneeded(task):
3898
3899 why = Options.options.WHYNEEDED.split(":")
3900 if len(why) != 2:
3901- raise Utils.WafError("usage: WHYNEEDED=TARGET:DEPENDENCY")
3902+ raise Errors.WafError("usage: WHYNEEDED=TARGET:DEPENDENCY")
3903 target = why[0]
3904 subsystem = why[1]
3905
3906@@ -579,7 +581,7 @@ def report_duplicate(bld, binname, sym, libs, fail_on_error):
3907 else:
3908 libnames.append(lib)
3909 if fail_on_error:
3910- raise Utils.WafError("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
3911+ raise Errors.WafError("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
3912 else:
3913 print("%s: Symbol %s linked in multiple libraries %s" % (binname, sym, libnames))
3914
3915diff --git a/buildtools/wafsamba/test_duplicate_symbol.sh b/buildtools/wafsamba/test_duplicate_symbol.sh
3916index 89a4027..46f44a6 100755
3917--- a/buildtools/wafsamba/test_duplicate_symbol.sh
3918+++ b/buildtools/wafsamba/test_duplicate_symbol.sh
3919@@ -5,7 +5,7 @@
3920
3921 subunit_start_test duplicate_symbols
3922
3923-if ./buildtools/bin/waf build --dup-symbol-check; then
3924+if $PYTHON ./buildtools/bin/waf build --dup-symbol-check; then
3925 subunit_pass_test duplicate_symbols
3926 else
3927 echo | subunit_fail_test duplicate_symbols
3928diff --git a/buildtools/wafsamba/tests/test_abi.py b/buildtools/wafsamba/tests/test_abi.py
3929index bba78c1..d6bdb04 100644
3930--- a/buildtools/wafsamba/tests/test_abi.py
3931+++ b/buildtools/wafsamba/tests/test_abi.py
3932@@ -21,7 +21,7 @@ from wafsamba.samba_abi import (
3933 normalise_signature,
3934 )
3935
3936-from cStringIO import StringIO
3937+from samba.compat import StringIO
3938
3939
3940 class NormaliseSignatureTests(TestCase):
3941@@ -66,6 +66,10 @@ class WriteVscriptTests(TestCase):
3942 1.0 {
3943 \tglobal:
3944 \t\t*;
3945+\tlocal:
3946+\t\t_end;
3947+\t\t__bss_start;
3948+\t\t_edata;
3949 };
3950 """)
3951
3952@@ -84,6 +88,10 @@ MYLIB_0.1 {
3953 1.0 {
3954 \tglobal:
3955 \t\t*;
3956+\tlocal:
3957+\t\t_end;
3958+\t\t__bss_start;
3959+\t\t_edata;
3960 };
3961 """)
3962
3963@@ -99,6 +107,9 @@ MYLIB_0.1 {
3964 \t\t*;
3965 \tlocal:
3966 \t\texc_*;
3967+\t\t_end;
3968+\t\t__bss_start;
3969+\t\t_edata;
3970 };
3971 """)
3972
3973@@ -115,6 +126,9 @@ MYLIB_0.1 {
3974 \t\tpub_*;
3975 \tlocal:
3976 \t\texc_*;
3977+\t\t_end;
3978+\t\t__bss_start;
3979+\t\t_edata;
3980 \t\t*;
3981 };
3982 """)
3983diff --git a/buildtools/wafsamba/tru64cc.py b/buildtools/wafsamba/tru64cc.py
3984deleted file mode 100644
3985index e1bbb1d..0000000
3986--- a/buildtools/wafsamba/tru64cc.py
3987+++ /dev/null
3988@@ -1,77 +0,0 @@
3989-
3990-# compiler definition for tru64/OSF1 cc compiler
3991-# based on suncc.py from waf
3992-
3993-import os, optparse
3994-import Utils, Options, Configure
3995-import ccroot, ar
3996-from Configure import conftest
3997-
3998-from compiler_cc import c_compiler
3999-
4000-c_compiler['osf1V'] = ['gcc', 'tru64cc']
4001-
4002-@conftest
4003-def find_tru64cc(conf):
4004- v = conf.env
4005- cc = None
4006- if v['CC']: cc = v['CC']
4007- elif 'CC' in conf.environ: cc = conf.environ['CC']
4008- if not cc: cc = conf.find_program('cc', var='CC')
4009- if not cc: conf.fatal('tru64cc was not found')
4010- cc = conf.cmd_to_list(cc)
4011-
4012- try:
4013- if not Utils.cmd_output(cc + ['-V']):
4014- conf.fatal('tru64cc %r was not found' % cc)
4015- except ValueError:
4016- conf.fatal('tru64cc -V could not be executed')
4017-
4018- v['CC'] = cc
4019- v['CC_NAME'] = 'tru64'
4020-
4021-@conftest
4022-def tru64cc_common_flags(conf):
4023- v = conf.env
4024-
4025- v['CC_SRC_F'] = ''
4026- v['CC_TGT_F'] = ['-c', '-o', '']
4027- v['CPPPATH_ST'] = '-I%s' # template for adding include paths
4028-
4029- # linker
4030- if not v['LINK_CC']: v['LINK_CC'] = v['CC']
4031- v['CCLNK_SRC_F'] = ''
4032- v['CCLNK_TGT_F'] = ['-o', '']
4033-
4034- v['LIB_ST'] = '-l%s' # template for adding libs
4035- v['LIBPATH_ST'] = '-L%s' # template for adding libpaths
4036- v['STATICLIB_ST'] = '-l%s'
4037- v['STATICLIBPATH_ST'] = '-L%s'
4038- v['CCDEFINES_ST'] = '-D%s'
4039-
4040-# v['SONAME_ST'] = '-Wl,-h -Wl,%s'
4041-# v['SHLIB_MARKER'] = '-Bdynamic'
4042-# v['STATICLIB_MARKER'] = '-Bstatic'
4043-
4044- # program
4045- v['program_PATTERN'] = '%s'
4046-
4047- # shared library
4048-# v['shlib_CCFLAGS'] = ['-Kpic', '-DPIC']
4049- v['shlib_LINKFLAGS'] = ['-shared']
4050- v['shlib_PATTERN'] = 'lib%s.so'
4051-
4052- # static lib
4053-# v['staticlib_LINKFLAGS'] = ['-Bstatic']
4054-# v['staticlib_PATTERN'] = 'lib%s.a'
4055-
4056-detect = '''
4057-find_tru64cc
4058-find_cpp
4059-find_ar
4060-tru64cc_common_flags
4061-cc_load_tools
4062-cc_add_flags
4063-link_add_flags
4064-'''
4065-
4066diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
4067index 12d5421..1b98e1c 100644
4068--- a/buildtools/wafsamba/wafsamba.py
4069+++ b/buildtools/wafsamba/wafsamba.py
4070@@ -1,15 +1,16 @@
4071 # a waf tool to add autoconf-like macros to the configure section
4072 # and for SAMBA_ macros for building libraries, binaries etc
4073
4074-import Build, os, sys, Options, Task, Utils, cc, TaskGen, fnmatch, re, shutil, Logs, Constants
4075-from Configure import conf
4076-from Logs import debug
4077+import os, sys, re, shutil, fnmatch
4078+from waflib import Build, Options, Task, Utils, TaskGen, Logs, Context, Errors
4079+from waflib.Configure import conf
4080+from waflib.Logs import debug
4081 from samba_utils import SUBST_VARS_RECURSIVE
4082 TaskGen.task_gen.apply_verif = Utils.nada
4083
4084 # bring in the other samba modules
4085-from samba_optimisation import *
4086 from samba_utils import *
4087+from samba_utils import symlink
4088 from samba_version import *
4089 from samba_autoconf import *
4090 from samba_patterns import *
4091@@ -25,27 +26,19 @@ import samba_install
4092 import samba_conftests
4093 import samba_abi
4094 import samba_headers
4095-import tru64cc
4096-import irixcc
4097-import hpuxcc
4098 import generic_cc
4099 import samba_dist
4100 import samba_wildcard
4101-import stale_files
4102 import symbols
4103 import pkgconfig
4104 import configure_file
4105-
4106-# some systems have broken threading in python
4107-if os.environ.get('WAF_NOTHREADS') == '1':
4108- import nothreads
4109+import samba_waf18
4110
4111 LIB_PATH="shared"
4112
4113 os.environ['PYTHONUNBUFFERED'] = '1'
4114
4115-
4116-if Constants.HEXVERSION < 0x105019:
4117+if Context.HEXVERSION not in (0x2000800,):
4118 Logs.error('''
4119 Please use the version of waf that comes with Samba, not
4120 a system installed version. See http://wiki.samba.org/index.php/Waf
4121@@ -55,26 +48,25 @@ Alternatively, please run ./configure and make as usual. That will
4122 call the right version of waf.''')
4123 sys.exit(1)
4124
4125-
4126 @conf
4127 def SAMBA_BUILD_ENV(conf):
4128 '''create the samba build environment'''
4129- conf.env.BUILD_DIRECTORY = conf.blddir
4130- mkdir_p(os.path.join(conf.blddir, LIB_PATH))
4131- mkdir_p(os.path.join(conf.blddir, LIB_PATH, "private"))
4132- mkdir_p(os.path.join(conf.blddir, "modules"))
4133- mkdir_p(os.path.join(conf.blddir, 'python/samba/dcerpc'))
4134+ conf.env.BUILD_DIRECTORY = conf.bldnode.abspath()
4135+ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH))
4136+ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, LIB_PATH, "private"))
4137+ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, "modules"))
4138+ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'python/samba/dcerpc'))
4139 # this allows all of the bin/shared and bin/python targets
4140 # to be expressed in terms of build directory paths
4141- mkdir_p(os.path.join(conf.blddir, 'default'))
4142- for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python_modules')]:
4143- link_target = os.path.join(conf.blddir, 'default/' + target)
4144+ mkdir_p(os.path.join(conf.env.BUILD_DIRECTORY, 'default'))
4145+ for (source, target) in [('shared', 'shared'), ('modules', 'modules'), ('python', 'python')]:
4146+ link_target = os.path.join(conf.env.BUILD_DIRECTORY, 'default/' + target)
4147 if not os.path.lexists(link_target):
4148- os.symlink('../' + source, link_target)
4149+ symlink('../' + source, link_target)
4150
4151 # get perl to put the blib files in the build directory
4152- blib_bld = os.path.join(conf.blddir, 'default/pidl/blib')
4153- blib_src = os.path.join(conf.srcdir, 'pidl/blib')
4154+ blib_bld = os.path.join(conf.env.BUILD_DIRECTORY, 'default/pidl/blib')
4155+ blib_src = os.path.join(conf.srcnode.abspath(), 'pidl/blib')
4156 mkdir_p(blib_bld + '/man1')
4157 mkdir_p(blib_bld + '/man3')
4158 if os.path.islink(blib_src):
4159@@ -148,7 +140,7 @@ def SAMBA_LIBRARY(bld, libname, source,
4160 public_headers = None
4161
4162 if private_library and public_headers:
4163- raise Utils.WafError("private library '%s' must not have public header files" %
4164+ raise Errors.WafError("private library '%s' must not have public header files" %
4165 libname)
4166
4167 if LIB_MUST_BE_PRIVATE(bld, libname):
4168@@ -225,13 +217,13 @@ def SAMBA_LIBRARY(bld, libname, source,
4169 # we don't want any public libraries without version numbers
4170 if (not private_library and target_type != 'PYTHON' and not realname):
4171 if vnum is None and soname is None:
4172- raise Utils.WafError("public library '%s' must have a vnum" %
4173+ raise Errors.WafError("public library '%s' must have a vnum" %
4174 libname)
4175 if pc_files is None:
4176- raise Utils.WafError("public library '%s' must have pkg-config file" %
4177+ raise Errors.WafError("public library '%s' must have pkg-config file" %
4178 libname)
4179 if public_headers is None and not bld.env['IS_EXTRA_PYTHON']:
4180- raise Utils.WafError("public library '%s' must have header files" %
4181+ raise Errors.WafError("public library '%s' must have header files" %
4182 libname)
4183
4184 if bundled_name is not None:
4185@@ -273,7 +265,7 @@ def SAMBA_LIBRARY(bld, libname, source,
4186 vscript = None
4187 if bld.env.HAVE_LD_VERSION_SCRIPT:
4188 if private_library:
4189- version = "%s_%s" % (Utils.g_module.APPNAME, Utils.g_module.VERSION)
4190+ version = "%s_%s" % (Context.g_module.APPNAME, Context.g_module.VERSION)
4191 elif vnum:
4192 version = "%s_%s" % (libname, vnum)
4193 else:
4194@@ -282,17 +274,17 @@ def SAMBA_LIBRARY(bld, libname, source,
4195 vscript = "%s.vscript" % libname
4196 bld.ABI_VSCRIPT(version_libname, abi_directory, version, vscript,
4197 abi_match)
4198- fullname = apply_pattern(bundled_name, bld.env.shlib_PATTERN)
4199+ fullname = apply_pattern(bundled_name, bld.env.cshlib_PATTERN)
4200 fullpath = bld.path.find_or_declare(fullname)
4201 vscriptpath = bld.path.find_or_declare(vscript)
4202 if not fullpath:
4203- raise Utils.WafError("unable to find fullpath for %s" % fullname)
4204+ raise Errors.WafError("unable to find fullpath for %s" % fullname)
4205 if not vscriptpath:
4206- raise Utils.WafError("unable to find vscript path for %s" % vscript)
4207+ raise Errors.WafError("unable to find vscript path for %s" % vscript)
4208 bld.add_manual_dependency(fullpath, vscriptpath)
4209 if bld.is_install:
4210 # also make the .inst file depend on the vscript
4211- instname = apply_pattern(bundled_name + '.inst', bld.env.shlib_PATTERN)
4212+ instname = apply_pattern(bundled_name + '.inst', bld.env.cshlib_PATTERN)
4213 bld.add_manual_dependency(bld.path.find_or_declare(instname), bld.path.find_or_declare(vscript))
4214 vscript = os.path.join(bld.path.abspath(bld.env), vscript)
4215
4216@@ -327,10 +319,12 @@ def SAMBA_LIBRARY(bld, libname, source,
4217 link_name = 'shared/%s' % realname
4218
4219 if link_name:
4220+ if 'waflib.extras.compat15' in sys.modules:
4221+ link_name = 'default/' + link_name
4222 t.link_name = link_name
4223
4224 if pc_files is not None and not private_library:
4225- if pyembed and bld.env['IS_EXTRA_PYTHON']:
4226+ if pyembed:
4227 bld.PKG_CONFIG_FILES(pc_files, vnum=vnum, extra_name=bld.env['PYTHON_SO_ABI_FLAG'])
4228 else:
4229 bld.PKG_CONFIG_FILES(pc_files, vnum=vnum)
4230@@ -674,7 +668,7 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
4231 target=target,
4232 shell=isinstance(rule, str),
4233 update_outputs=True,
4234- before='cc',
4235+ before='c',
4236 ext_out='.c',
4237 samba_type='GENERATOR',
4238 dep_vars = dep_vars,
4239@@ -728,22 +722,6 @@ Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
4240
4241
4242
4243-@conf
4244-def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
4245- """use timestamps instead of file contents for deps
4246- this currently doesn't work"""
4247- def h_file(filename):
4248- import stat
4249- st = os.stat(filename)
4250- if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
4251- m = Utils.md5()
4252- m.update(str(st.st_mtime))
4253- m.update(str(st.st_size))
4254- m.update(filename)
4255- return m.digest()
4256- Utils.h_file = h_file
4257-
4258-
4259 def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
4260 '''used to copy scripts from the source tree into the build directory
4261 for use by selftest'''
4262@@ -758,14 +736,14 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None):
4263 target = os.path.join(installdir, iname)
4264 tgtdir = os.path.dirname(os.path.join(bld.srcnode.abspath(bld.env), '..', target))
4265 mkdir_p(tgtdir)
4266- link_src = os.path.normpath(os.path.join(bld.curdir, s))
4267+ link_src = os.path.normpath(os.path.join(bld.path.abspath(), s))
4268 link_dst = os.path.join(tgtdir, os.path.basename(iname))
4269 if os.path.islink(link_dst) and os.readlink(link_dst) == link_src:
4270 continue
4271- if os.path.exists(link_dst):
4272+ if os.path.islink(link_dst):
4273 os.unlink(link_dst)
4274 Logs.info("symlink: %s -> %s/%s" % (s, installdir, iname))
4275- os.symlink(link_src, link_dst)
4276+ symlink(link_src, link_dst)
4277 Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT
4278
4279
4280@@ -779,10 +757,10 @@ def copy_and_fix_python_path(task):
4281 replacement="""sys.path.insert(0, "%s")
4282 sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
4283
4284- if task.env["PYTHON"][0] == "/":
4285- replacement_shebang = "#!%s\n" % task.env["PYTHON"]
4286+ if task.env["PYTHON"][0].startswith("/"):
4287+ replacement_shebang = "#!%s\n" % task.env["PYTHON"][0]
4288 else:
4289- replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PYTHON"]
4290+ replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PYTHON"][0]
4291
4292 installed_location=task.outputs[0].bldpath(task.env)
4293 source_file = open(task.inputs[0].srcpath(task.env))
4294@@ -790,7 +768,7 @@ sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
4295 lineno = 0
4296 for line in source_file:
4297 newline = line
4298- if (lineno == 0 and task.env["PYTHON_SPECIFIED"] is True and
4299+ if (lineno == 0 and
4300 line[:2] == "#!"):
4301 newline = replacement_shebang
4302 elif pattern in line:
4303@@ -798,7 +776,7 @@ sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
4304 installed_file.write(newline)
4305 lineno = lineno + 1
4306 installed_file.close()
4307- os.chmod(installed_location, 0755)
4308+ os.chmod(installed_location, 0o755)
4309 return 0
4310
4311 def copy_and_fix_perl_path(task):
4312@@ -826,7 +804,7 @@ def copy_and_fix_perl_path(task):
4313 installed_file.write(newline)
4314 lineno = lineno + 1
4315 installed_file.close()
4316- os.chmod(installed_location, 0755)
4317+ os.chmod(installed_location, 0o755)
4318 return 0
4319
4320
4321@@ -834,6 +812,8 @@ def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
4322 python_fixup=False, perl_fixup=False,
4323 destname=None, base_name=None):
4324 '''install a file'''
4325+ if not isinstance(file, str):
4326+ file = file.abspath()
4327 destdir = bld.EXPAND_VARIABLES(destdir)
4328 if not destname:
4329 destname = file
4330@@ -898,16 +878,19 @@ def INSTALL_DIR(bld, path, chmod=0o755, env=None):
4331 if not path:
4332 return []
4333
4334- destpath = bld.get_install_path(path, env)
4335+ destpath = bld.EXPAND_VARIABLES(path)
4336+ if Options.options.destdir:
4337+ destpath = os.path.join(Options.options.destdir, destpath.lstrip(os.sep))
4338
4339 if bld.is_install > 0:
4340 if not os.path.isdir(destpath):
4341 try:
4342+ Logs.info('* create %s', destpath)
4343 os.makedirs(destpath)
4344 os.chmod(destpath, chmod)
4345 except OSError as e:
4346 if not os.path.isdir(destpath):
4347- raise Utils.WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
4348+ raise Errors.WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
4349 Build.BuildContext.INSTALL_DIR = INSTALL_DIR
4350
4351 def INSTALL_DIRS(bld, destdir, dirs, chmod=0o755, env=None):
4352@@ -938,7 +921,7 @@ def SAMBAMANPAGES(bld, manpages, extra_source=None):
4353 '''build and install manual pages'''
4354 bld.env.SAMBA_EXPAND_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/expand-sambadoc.xsl'
4355 bld.env.SAMBA_MAN_XSL = bld.srcnode.abspath() + '/docs-xml/xslt/man.xsl'
4356- bld.env.SAMBA_CATALOG = bld.srcnode.abspath() + '/bin/default/docs-xml/build/catalog.xml'
4357+ bld.env.SAMBA_CATALOG = bld.bldnode.abspath() + '/docs-xml/build/catalog.xml'
4358 bld.env.SAMBA_CATALOGS = 'file:///etc/xml/catalog file:///usr/local/share/xml/catalog file://' + bld.env.SAMBA_CATALOG
4359
4360 for m in manpages.split():
4361@@ -958,59 +941,6 @@ def SAMBAMANPAGES(bld, manpages, extra_source=None):
4362 bld.INSTALL_FILES('${MANDIR}/man%s' % m[-1], m, flat=True)
4363 Build.BuildContext.SAMBAMANPAGES = SAMBAMANPAGES
4364
4365-#############################################################
4366-# give a nicer display when building different types of files
4367-def progress_display(self, msg, fname):
4368- col1 = Logs.colors(self.color)
4369- col2 = Logs.colors.NORMAL
4370- total = self.position[1]
4371- n = len(str(total))
4372- fs = '[%%%dd/%%%dd] %s %%s%%s%%s\n' % (n, n, msg)
4373- return fs % (self.position[0], self.position[1], col1, fname, col2)
4374-
4375-def link_display(self):
4376- if Options.options.progress_bar != 0:
4377- return Task.Task.old_display(self)
4378- fname = self.outputs[0].bldpath(self.env)
4379- return progress_display(self, 'Linking', fname)
4380-Task.TaskBase.classes['cc_link'].display = link_display
4381-
4382-def samba_display(self):
4383- if Options.options.progress_bar != 0:
4384- return Task.Task.old_display(self)
4385-
4386- targets = LOCAL_CACHE(self, 'TARGET_TYPE')
4387- if self.name in targets:
4388- target_type = targets[self.name]
4389- type_map = { 'GENERATOR' : 'Generating',
4390- 'PROTOTYPE' : 'Generating'
4391- }
4392- if target_type in type_map:
4393- return progress_display(self, type_map[target_type], self.name)
4394-
4395- if len(self.inputs) == 0:
4396- return Task.Task.old_display(self)
4397-
4398- fname = self.inputs[0].bldpath(self.env)
4399- if fname[0:3] == '../':
4400- fname = fname[3:]
4401- ext_loc = fname.rfind('.')
4402- if ext_loc == -1:
4403- return Task.Task.old_display(self)
4404- ext = fname[ext_loc:]
4405-
4406- ext_map = { '.idl' : 'Compiling IDL',
4407- '.et' : 'Compiling ERRTABLE',
4408- '.asn1': 'Compiling ASN1',
4409- '.c' : 'Compiling' }
4410- if ext in ext_map:
4411- return progress_display(self, ext_map[ext], fname)
4412- return Task.Task.old_display(self)
4413-
4414-Task.TaskBase.classes['Task'].old_display = Task.TaskBase.classes['Task'].display
4415-Task.TaskBase.classes['Task'].display = samba_display
4416-
4417-
4418 @after('apply_link')
4419 @feature('cshlib')
4420 def apply_bundle_remove_dynamiclib_patch(self):
4421diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
4422index 0eef330..ab19859 100644
4423--- a/buildtools/wafsamba/wscript
4424+++ b/buildtools/wafsamba/wscript
4425@@ -3,7 +3,8 @@
4426 # this is a base set of waf rules that everything else pulls in first
4427
4428 import os, sys
4429-import wafsamba, Configure, Logs, Options, Utils
4430+from waflib import Configure, Logs, Options, Utils, Context, Errors
4431+import wafsamba
4432 from samba_utils import os_path_relpath
4433 from optparse import SUPPRESS_HELP
4434
4435@@ -14,12 +15,17 @@ from optparse import SUPPRESS_HELP
4436 # are resolved related to WAFCACHE. It will need a lot of testing
4437 # before it is enabled by default.
4438 if '--enable-auto-reconfigure' in sys.argv:
4439- Configure.autoconfig = True
4440+ Configure.autoconfig = 'clobber'
4441
4442-def set_options(opt):
4443- opt.tool_options('compiler_cc')
4444+def default_value(option, default=''):
4445+ if option in Options.options.__dict__:
4446+ return Options.options.__dict__[option]
4447+ return default
4448
4449- opt.tool_options('gnu_dirs')
4450+def options(opt):
4451+ opt.load('compiler_cc')
4452+
4453+ opt.load('gnu_dirs')
4454
4455 gr = opt.option_group('library handling options')
4456
4457@@ -31,17 +37,17 @@ def set_options(opt):
4458 help=("comma separated list of normally public libraries to build instead as private libraries. May include !LIBNAME to disable making a library private. Can be 'NONE' or 'ALL' [auto]"),
4459 action="store", dest='PRIVATE_LIBS', default='')
4460
4461- extension_default = Options.options['PRIVATE_EXTENSION_DEFAULT']
4462+ extension_default = default_value('PRIVATE_EXTENSION_DEFAULT')
4463 gr.add_option('--private-library-extension',
4464 help=("name extension for private libraries [%s]" % extension_default),
4465 action="store", dest='PRIVATE_EXTENSION', default=extension_default)
4466
4467- extension_exception = Options.options['PRIVATE_EXTENSION_EXCEPTION']
4468+ extension_exception = default_value('PRIVATE_EXTENSION_EXCEPTION')
4469 gr.add_option('--private-extension-exception',
4470 help=("comma separated list of libraries to not apply extension to [%s]" % extension_exception),
4471 action="store", dest='PRIVATE_EXTENSION_EXCEPTION', default=extension_exception)
4472
4473- builtin_default = Options.options['BUILTIN_LIBRARIES_DEFAULT']
4474+ builtin_default = default_value('BUILTIN_LIBRARIES_DEFAULT')
4475 gr.add_option('--builtin-libraries',
4476 help=("command separated list of libraries to build directly into binaries [%s]" % builtin_default),
4477 action="store", dest='BUILTIN_LIBRARIES', default=builtin_default)
4478@@ -71,7 +77,7 @@ def set_options(opt):
4479 action="store", dest='MODULESDIR', default='${PREFIX}/modules')
4480
4481 opt.add_option('--with-privatelibdir',
4482- help=("private library directory [PREFIX/lib/%s]" % Utils.g_module.APPNAME),
4483+ help=("private library directory [PREFIX/lib/%s]" % Context.g_module.APPNAME),
4484 action="store", dest='PRIVATELIBDIR', default=None)
4485
4486 opt.add_option('--with-libiconv',
4487@@ -109,9 +115,6 @@ def set_options(opt):
4488 gr.add_option('--enable-gccdeps',
4489 help=("Enable use of gcc -MD dependency module"),
4490 action="store_true", dest='enable_gccdeps', default=True)
4491- gr.add_option('--timestamp-dependencies',
4492- help=("use file timestamps instead of content for build dependencies (BROKEN)"),
4493- action="store_true", dest='timestamp_dependencies', default=False)
4494 gr.add_option('--pedantic',
4495 help=("Enable even more compiler warnings"),
4496 action='store_true', dest='pedantic', default=False)
4497@@ -210,23 +213,19 @@ def set_options(opt):
4498 @Utils.run_once
4499 def configure(conf):
4500 conf.env.hlist = []
4501- conf.env.srcdir = conf.srcdir
4502+ conf.env.srcdir = conf.srcnode.abspath()
4503
4504 conf.define('SRCDIR', conf.env['srcdir'])
4505
4506- if Options.options.timestamp_dependencies:
4507- conf.ENABLE_TIMESTAMP_DEPENDENCIES()
4508-
4509 conf.SETUP_CONFIGURE_CACHE(Options.options.enable_configure_cache)
4510
4511 # load our local waf extensions
4512- conf.check_tool('gnu_dirs')
4513- conf.check_tool('wafsamba')
4514- conf.check_tool('print_commands')
4515+ conf.load('gnu_dirs')
4516+ conf.load('wafsamba')
4517
4518 conf.CHECK_CC_ENV()
4519
4520- conf.check_tool('compiler_cc')
4521+ conf.load('compiler_c')
4522
4523 conf.CHECK_STANDARD_LIBPATH()
4524
4525@@ -236,31 +235,10 @@ def configure(conf):
4526 # older gcc versions (< 4.4) does not work with gccdeps, so we have to see if the .d file is generated
4527 if Options.options.enable_gccdeps:
4528 # stale file removal - the configuration may pick up the old .pyc file
4529- p = os.path.join(conf.srcdir, 'buildtools/wafsamba/gccdeps.pyc')
4530+ p = os.path.join(conf.env.srcdir, 'buildtools/wafsamba/gccdeps.pyc')
4531 if os.path.exists(p):
4532 os.remove(p)
4533-
4534- from TaskGen import feature, after
4535- @feature('testd')
4536- @after('apply_core')
4537- def check_d(self):
4538- tsk = self.compiled_tasks[0]
4539- tsk.outputs.append(tsk.outputs[0].change_ext('.d'))
4540-
4541- import Task
4542- cc = Task.TaskBase.classes['cc']
4543- oldmeth = cc.run
4544-
4545- cc.run = Task.compile_fun_noshell('cc', '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT[0].abspath(env)}')[0]
4546- try:
4547- try:
4548- conf.check(features='c testd', fragment='int main() {return 0;}\n', ccflags=['-MD'], mandatory=True, msg='Check for -MD')
4549- except:
4550- pass
4551- else:
4552- conf.check_tool('gccdeps', tooldir=conf.srcdir + "/buildtools/wafsamba")
4553- finally:
4554- cc.run = oldmeth
4555+ conf.load('gccdeps')
4556
4557 # make the install paths available in environment
4558 conf.env.LIBDIR = Options.options.LIBDIR or '${PREFIX}/lib'
4559@@ -330,15 +308,16 @@ def configure(conf):
4560 "-qhalt=w", # IBM xlc
4561 "-w2", # Tru64
4562 ]:
4563- if conf.CHECK_CFLAGS([f], '''
4564-'''):
4565+ if conf.CHECK_CFLAGS([f]):
4566 if not 'WERROR_CFLAGS' in conf.env:
4567 conf.env['WERROR_CFLAGS'] = []
4568 conf.env['WERROR_CFLAGS'].extend([f])
4569 break
4570
4571 # check which compiler/linker flags are needed for rpath support
4572- if not conf.CHECK_LDFLAGS(['-Wl,-rpath,.']) and conf.CHECK_LDFLAGS(['-Wl,-R,.']):
4573+ if conf.CHECK_LDFLAGS(['-Wl,-rpath,.']):
4574+ conf.env['RPATH_ST'] = '-Wl,-rpath,%s'
4575+ elif conf.CHECK_LDFLAGS(['-Wl,-R,.']):
4576 conf.env['RPATH_ST'] = '-Wl,-R,%s'
4577
4578 # check for rpath
4579@@ -348,7 +327,7 @@ def configure(conf):
4580 conf.env.RPATH_ON_INSTALL = (conf.env.RPATH_ON_BUILD and
4581 not Options.options.disable_rpath_install)
4582 if not conf.env.PRIVATELIBDIR:
4583- conf.env.PRIVATELIBDIR = '%s/%s' % (conf.env.LIBDIR, Utils.g_module.APPNAME)
4584+ conf.env.PRIVATELIBDIR = '%s/%s' % (conf.env.LIBDIR, Context.g_module.APPNAME)
4585 conf.env.RPATH_ON_INSTALL_PRIVATE = (
4586 not Options.options.disable_rpath_private_install)
4587 else:
4588@@ -370,10 +349,10 @@ def configure(conf):
4589 else:
4590 conf.env.HAVE_LD_VERSION_SCRIPT = False
4591
4592- if conf.CHECK_CFLAGS(['-fvisibility=hidden'] + conf.env.WERROR_CFLAGS):
4593+ if conf.CHECK_CFLAGS(['-fvisibility=hidden']):
4594 conf.env.VISIBILITY_CFLAGS = '-fvisibility=hidden'
4595 conf.CHECK_CODE('''int main(void) { return 0; }
4596- __attribute__((visibility("default"))) void vis_foo2(void) {}''',
4597+ __attribute__((visibility("default"))) void vis_foo2(void) {}\n''',
4598 cflags=conf.env.VISIBILITY_CFLAGS,
4599 strict=True,
4600 define='HAVE_VISIBILITY_ATTR', addmain=False)
4601@@ -466,6 +445,15 @@ def configure(conf):
4602 conf.DEFINE('_GNU_SOURCE', 1, add_to_cflags=True)
4603 conf.DEFINE('_XOPEN_SOURCE_EXTENDED', 1, add_to_cflags=True)
4604
4605+ #
4606+ # Needs to be defined before std*.h and string*.h are included
4607+ # As Python.h already brings string.h we need it in CFLAGS.
4608+ # See memset_s() details here:
4609+ # https://en.cppreference.com/w/c/string/byte/memset
4610+ #
4611+ if conf.CHECK_CFLAGS(['-D__STDC_WANT_LIB_EXT1__=1']):
4612+ conf.ADD_CFLAGS('-D__STDC_WANT_LIB_EXT1__=1')
4613+
4614 # on Tru64 certain features are only available with _OSF_SOURCE set to 1
4615 # and _XOPEN_SOURCE set to 600
4616 if conf.env['SYSTEM_UNAME_SYSNAME'] == 'OSF1':
4617@@ -501,7 +489,7 @@ struct foo bar = { .y = 'X', .x = 1 };
4618
4619 # see if we need special largefile flags
4620 if not conf.CHECK_LARGEFILE():
4621- raise Utils.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8')
4622+ raise Errors.WafError('Samba requires large file support support, but not available on this platform: sizeof(off_t) < 8')
4623
4624 if conf.env.HAVE_STDDEF_H and conf.env.HAVE_STDLIB_H:
4625 conf.DEFINE('STDC_HEADERS', 1)
4626@@ -512,7 +500,7 @@ struct foo bar = { .y = 'X', .x = 1 };
4627 conf.DEFINE('TIME_WITH_SYS_TIME', 1)
4628
4629 # cope with different extensions for libraries
4630- (root, ext) = os.path.splitext(conf.env.shlib_PATTERN)
4631+ (root, ext) = os.path.splitext(conf.env.cshlib_PATTERN)
4632 if ext[0] == '.':
4633 conf.define('SHLIBEXT', ext[1:], quote=True)
4634 else:
4635@@ -534,7 +522,7 @@ struct foo bar = { .y = 'X', .x = 1 };
4636 #if !defined(LITTLE) || !defined(B) || LITTLE != B
4637 #error Not little endian.
4638 #endif
4639- int main(void) { return 0; }""",
4640+ int main(void) { return 0; }\n""",
4641 addmain=False,
4642 headers="endian.h sys/endian.h",
4643 define="HAVE_LITTLE_ENDIAN")
4644@@ -553,7 +541,7 @@ struct foo bar = { .y = 'X', .x = 1 };
4645 #if !defined(BIG) || !defined(B) || BIG != B
4646 #error Not big endian.
4647 #endif
4648- int main(void) { return 0; }""",
4649+ int main(void) { return 0; }\n""",
4650 addmain=False,
4651 headers="endian.h sys/endian.h",
4652 define="HAVE_BIG_ENDIAN")
4653@@ -576,7 +564,7 @@ struct foo bar = { .y = 'X', .x = 1 };
4654 # Extra sanity check.
4655 if conf.CONFIG_SET("HAVE_BIG_ENDIAN") == conf.CONFIG_SET("HAVE_LITTLE_ENDIAN"):
4656 Logs.error("Failed endian determination. The PDP-11 is back?")
4657- sys.exit(1)
4658+ sys.exit(1)
4659 else:
4660 if conf.CONFIG_SET("HAVE_BIG_ENDIAN"):
4661 conf.DEFINE('WORDS_BIGENDIAN', 1)
4662@@ -607,12 +595,13 @@ struct foo bar = { .y = 'X', .x = 1 };
4663
4664 def build(bld):
4665 # give a more useful message if the source directory has moved
4666- relpath = os_path_relpath(bld.curdir, bld.srcnode.abspath())
4667+ curdir = bld.path.abspath()
4668+ srcdir = bld.srcnode.abspath()
4669+ relpath = os_path_relpath(curdir, srcdir)
4670 if relpath.find('../') != -1:
4671- Logs.error('bld.curdir %s is not a child of %s' % (bld.curdir, bld.srcnode.abspath()))
4672- raise Utils.WafError('''The top source directory has moved. Please run distclean and reconfigure''')
4673+ Logs.error('bld.path %s is not a child of %s' % (curdir, srcdir))
4674+ raise Errors.WafError('''The top source directory has moved. Please run distclean and reconfigure''')
4675
4676- bld.CHECK_MAKEFLAGS()
4677 bld.SETUP_BUILD_GROUPS()
4678 bld.ENFORCE_GROUP_ORDERING()
4679 bld.CHECK_PROJECT_RULES()
4680diff --git a/configure b/configure
4681index 6a9f875..d8a8d2a 100755
4682--- a/configure
4683+++ b/configure
4684@@ -17,5 +17,5 @@ JOBS=1
4685 export JOBS
4686
4687 cd . || exit 1
4688-$WAF configure "$@" || exit 1
4689+$PYTHON $WAF configure "$@" || exit 1
4690 cd $PREVPATH
4691diff --git a/debian/changelog b/debian/changelog
4692index 0a7a16e..32c51cd 100644
4693--- a/debian/changelog
4694+++ b/debian/changelog
4695@@ -1,3 +1,22 @@
4696+talloc (2.1.16-0ubuntu1) disco; urgency=medium
4697+
4698+ * New upstream version: 2.1.16 (LP: #1818522):
4699+ - d/rules: cleanup more directories and pyc files waf is leaving behind
4700+ - d/rules: fix globbing for talloc static library creation
4701+ - d/libtalloc2.symbols: updated symbols for 2.1.16
4702+ - d/control, d/rules, d/python3-talloc{,-dev}.install: new python3 packages
4703+ (LP: #1440381)
4704+ - d/s/lintian-overrides: change old PY2 variable override to the PY3
4705+ one we are using.
4706+ - d/python3-talloc.symbols.{common,amd64,armhf,arm64,s390x,ppc64el,
4707+ i386}: use per-arch symbols file
4708+ - d/rules: check python3-talloc symbols
4709+ - d/rules: remove change to keep python2 from desktop images, no longer
4710+ needed
4711+ - d/control, d/python-talloc*, d/rules: remove python2 packages
4712+
4713+ -- Andreas Hasenack <andreas@canonical.com> Sat, 09 Mar 2019 16:40:52 +0000
4714+
4715 talloc (2.1.14-1ubuntu1) cosmic; urgency=medium
4716
4717 * Merge with Debian unstable. Remaining changes:
4718diff --git a/debian/control b/debian/control
4719index a9bd75d..167443a 100644
4720--- a/debian/control
4721+++ b/debian/control
4722@@ -13,7 +13,7 @@ Build-Depends: debhelper (>= 11),
4723 docbook-xml,
4724 docbook-xsl,
4725 libpopt-dev,
4726- python-dev (>= 2.6.6-3),
4727+ python3-dev,
4728 xsltproc
4729 Rules-Requires-Root: no
4730 Standards-Version: 4.1.5
4731@@ -42,27 +42,27 @@ Description: hierarchical pool based memory allocator - development files
4732 .
4733 This package contains the development files.
4734
4735-Package: python-talloc
4736-Pre-Depends: ${misc:Pre-Depends}
4737-Architecture: any
4738-Multi-Arch: same
4739+Package: python3-talloc
4740 Section: python
4741-Provides: ${python:Provides}
4742-Depends: ${misc:Depends}, ${python:Depends}, ${shlibs:Depends}
4743-Breaks: python-samba (<< 2:4.3.6+dfsg-2)
4744-Description: hierarchical pool based memory allocator - Python bindings
4745+Architecture: linux-any kfreebsd-any
4746+Depends: libtalloc2 (= ${binary:Version}),
4747+ ${misc:Depends},
4748+ ${python3:Depends},
4749+ ${shlibs:Depends}
4750+Provides: ${python3:Provides}
4751+Description: hierarchical pool based memory allocator - Python3 bindings
4752 A hierarchical pool based memory allocator with destructors. It uses
4753 reference counting to determine when memory should be freed.
4754 .
4755- This package contains the Python bindings.
4756+ This package contains the Python 3 bindings.
4757
4758-Package: python-talloc-dev
4759+Package: python3-talloc-dev
4760 Architecture: any
4761 Multi-Arch: same
4762 Section: libdevel
4763-Depends: pkg-config, python-talloc (= ${binary:Version}), ${misc:Depends}, ${python:Depends}
4764-Description: talloc Python bindings - development files
4765+Depends: pkg-config, python3-talloc (= ${binary:Version}), ${misc:Depends}, ${python3:Depends}
4766+Description: talloc Python 3 bindings - development files
4767 A hierarchical pool based memory allocator with destructors. It uses
4768 reference counting to determine when memory should be freed.
4769 .
4770- This package contains the development files for the Python bindings.
4771+ This package contains the development files for the Python 3 bindings.
4772diff --git a/debian/libtalloc2.symbols b/debian/libtalloc2.symbols
4773index b6a92be..bf5c4a3 100644
4774--- a/debian/libtalloc2.symbols
4775+++ b/debian/libtalloc2.symbols
4776@@ -21,6 +21,8 @@ libtalloc.so.2 #PACKAGE# #MINVER#
4777 TALLOC_2.1.12@TALLOC_2.1.12 2.1.12
4778 TALLOC_2.1.13@TALLOC_2.1.13 2.1.13
4779 TALLOC_2.1.14@TALLOC_2.1.14 2.1.14
4780+ TALLOC_2.1.15@TALLOC_2.1.15 2.1.15
4781+ TALLOC_2.1.16@TALLOC_2.1.16 2.1.16
4782 _talloc@TALLOC_2.0.2 2.0.4~git20101213
4783 _talloc_array@TALLOC_2.0.2 2.0.4~git20101213
4784 _talloc_free@TALLOC_2.0.2 2.0.4~git20101213
4785diff --git a/debian/python-talloc-dev.install b/debian/python-talloc-dev.install
4786deleted file mode 100755
4787index 52c6289..0000000
4788--- a/debian/python-talloc-dev.install
4789+++ /dev/null
4790@@ -1,4 +0,0 @@
4791-#! /usr/bin/dh-exec
4792-usr/include/pytalloc.h ${DEB_PY2_INCDIR}
4793-usr/lib/*/pkgconfig/pytalloc-util.pc
4794-usr/lib/*/libpytalloc-util.so
4795diff --git a/debian/python-talloc-dev.lintian-overrides b/debian/python-talloc-dev.lintian-overrides
4796deleted file mode 100644
4797index ed4653d..0000000
4798--- a/debian/python-talloc-dev.lintian-overrides
4799+++ /dev/null
4800@@ -1 +0,0 @@
4801-python-talloc-dev binary: wrong-section-according-to-package-name python-talloc-dev => python
4802diff --git a/debian/python-talloc.install b/debian/python-talloc.install
4803deleted file mode 100644
4804index 0b5a9ee..0000000
4805--- a/debian/python-talloc.install
4806+++ /dev/null
4807@@ -1,2 +0,0 @@
4808-usr/lib/*/libpytalloc-util.so.*
4809-usr/lib/python2*/*-packages/talloc.so
4810diff --git a/debian/python-talloc.lintian-overrides b/debian/python-talloc.lintian-overrides
4811deleted file mode 100644
4812index 09fabcf..0000000
4813--- a/debian/python-talloc.lintian-overrides
4814+++ /dev/null
4815@@ -1 +0,0 @@
4816-python-talloc binary: package-name-doesnt-match-sonames libpytalloc-util2
4817diff --git a/debian/python-talloc.symbols b/debian/python-talloc.symbols
4818deleted file mode 100644
4819index a7ea9b2..0000000
4820--- a/debian/python-talloc.symbols
4821+++ /dev/null
4822@@ -1,35 +0,0 @@
4823-libpytalloc-util.so.2 #PACKAGE# #MINVER#
4824- PYTALLOC_UTIL_2.0.6@PYTALLOC_UTIL_2.0.6 2.0.6
4825- PYTALLOC_UTIL_2.0.7@PYTALLOC_UTIL_2.0.7 2.0.7
4826- PYTALLOC_UTIL_2.0.8@PYTALLOC_UTIL_2.0.8 2.0.8
4827- PYTALLOC_UTIL_2.1.0@PYTALLOC_UTIL_2.1.0 2.1.0
4828- PYTALLOC_UTIL_2.1.1@PYTALLOC_UTIL_2.1.1 2.1.1
4829- PYTALLOC_UTIL_2.1.2@PYTALLOC_UTIL_2.1.2 2.1.2
4830- PYTALLOC_UTIL_2.1.3@PYTALLOC_UTIL_2.1.3 2.1.3
4831- PYTALLOC_UTIL_2.1.4@PYTALLOC_UTIL_2.1.4 2.1.4
4832- PYTALLOC_UTIL_2.1.5@PYTALLOC_UTIL_2.1.5 2.1.5
4833- PYTALLOC_UTIL_2.1.6@PYTALLOC_UTIL_2.1.6 2.1.6
4834- PYTALLOC_UTIL_2.1.7@PYTALLOC_UTIL_2.1.7 2.1.7
4835- PYTALLOC_UTIL_2.1.8@PYTALLOC_UTIL_2.1.8 2.1.8
4836- PYTALLOC_UTIL_2.1.9@PYTALLOC_UTIL_2.1.9 2.1.9
4837- PYTALLOC_UTIL_2.1.10@PYTALLOC_UTIL_2.1.10 2.1.10
4838- PYTALLOC_UTIL_2.1.11@PYTALLOC_UTIL_2.1.11 2.1.11
4839- PYTALLOC_UTIL_2.1.12@PYTALLOC_UTIL_2.1.12 2.1.12
4840- PYTALLOC_UTIL_2.1.13@PYTALLOC_UTIL_2.1.13 2.1.13
4841- PYTALLOC_UTIL_2.1.14@PYTALLOC_UTIL_2.1.14 2.1.14
4842- _pytalloc_check_type@PYTALLOC_UTIL_2.1.9 2.1.9
4843- pytalloc_CObject_FromTallocPtr@PYTALLOC_UTIL_2.0.6 2.0.6
4844- pytalloc_Check@PYTALLOC_UTIL_2.0.6 2.0.6
4845- pytalloc_GenericObject_reference_ex@PYTALLOC_UTIL_2.1.9 2.1.9
4846- pytalloc_GenericObject_steal_ex@PYTALLOC_UTIL_2.1.9 2.1.9
4847- pytalloc_GetObjectType@PYTALLOC_UTIL_2.0.6 2.0.6
4848- pytalloc_reference_ex@PYTALLOC_UTIL_2.0.6 2.0.6
4849- pytalloc_steal@PYTALLOC_UTIL_2.0.6 2.0.6
4850- pytalloc_steal_ex@PYTALLOC_UTIL_2.0.6 2.0.6
4851- _pytalloc_get_mem_ctx@PYTALLOC_UTIL_2.1.6 2.1.6
4852- _pytalloc_get_ptr@PYTALLOC_UTIL_2.1.6 2.1.6
4853- _pytalloc_get_type@PYTALLOC_UTIL_2.1.6 2.1.6
4854- pytalloc_BaseObject_PyType_Ready@PYTALLOC_UTIL_2.1.6 2.1.6
4855- pytalloc_BaseObject_check@PYTALLOC_UTIL_2.1.6 2.1.6
4856- pytalloc_BaseObject_size@PYTALLOC_UTIL_2.1.6 2.1.6
4857- pytalloc_GetBaseObjectType@PYTALLOC_UTIL_2.1.6 2.1.6
4858diff --git a/debian/python3-talloc-dev.install b/debian/python3-talloc-dev.install
4859new file mode 100755
4860index 0000000..92837be
4861--- /dev/null
4862+++ b/debian/python3-talloc-dev.install
4863@@ -0,0 +1,4 @@
4864+#! /usr/bin/dh-exec
4865+usr/include/pytalloc.h ${DEB_PY3_INCDIR}
4866+usr/lib/*/pkgconfig/pytalloc-util.cpython-*.pc
4867+usr/lib/*/libpytalloc-util.cpython-*.so
4868diff --git a/debian/python3-talloc.install b/debian/python3-talloc.install
4869new file mode 100644
4870index 0000000..0f4359e
4871--- /dev/null
4872+++ b/debian/python3-talloc.install
4873@@ -0,0 +1,2 @@
4874+usr/lib/*/libpytalloc-util.cpython-37m-*.so.*
4875+usr/lib/python3*
4876diff --git a/debian/python3-talloc.symbols.amd64 b/debian/python3-talloc.symbols.amd64
4877new file mode 100644
4878index 0000000..b51112e
4879--- /dev/null
4880+++ b/debian/python3-talloc.symbols.amd64
4881@@ -0,0 +1,3 @@
4882+libpytalloc-util.cpython-37m-x86-64-linux-gnu.so.2 python3-talloc #MINVER#
4883+ PYTALLOC_UTIL.CPYTHON_37M_X86_64_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_X86_64_LINUX_GNU_2.1.16 2.1.16
4884+#include "python3-talloc.symbols.common"
4885diff --git a/debian/python3-talloc.symbols.arm64 b/debian/python3-talloc.symbols.arm64
4886new file mode 100644
4887index 0000000..b2f9f67
4888--- /dev/null
4889+++ b/debian/python3-talloc.symbols.arm64
4890@@ -0,0 +1,3 @@
4891+libpytalloc-util.cpython-37m-aarch64-linux-gnu.so.2 python3-talloc #MINVER#
4892+ PYTALLOC_UTIL.CPYTHON_37M_AARCH64_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_AARCH64_LINUX_GNU_2.1.16 2.1.16
4893+#include "python3-talloc.symbols.common"
4894diff --git a/debian/python3-talloc.symbols.armhf b/debian/python3-talloc.symbols.armhf
4895new file mode 100644
4896index 0000000..11fe2a5
4897--- /dev/null
4898+++ b/debian/python3-talloc.symbols.armhf
4899@@ -0,0 +1,3 @@
4900+libpytalloc-util.cpython-37m-arm-linux-gnueabihf.so.2 python3-talloc #MINVER#
4901+ PYTALLOC_UTIL.CPYTHON_37M_ARM_LINUX_GNUEABIHF_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_ARM_LINUX_GNUEABIHF_2.1.16 2.1.16
4902+#include "python3-talloc.symbols.common"
4903diff --git a/debian/python3-talloc.symbols.common b/debian/python3-talloc.symbols.common
4904new file mode 100644
4905index 0000000..e8d4966
4906--- /dev/null
4907+++ b/debian/python3-talloc.symbols.common
4908@@ -0,0 +1,27 @@
4909+ PYTALLOC_UTIL.PY3_2.1.10@PYTALLOC_UTIL.PY3_2.1.10 2.1.16
4910+ PYTALLOC_UTIL.PY3_2.1.11@PYTALLOC_UTIL.PY3_2.1.11 2.1.16
4911+ PYTALLOC_UTIL.PY3_2.1.12@PYTALLOC_UTIL.PY3_2.1.12 2.1.16
4912+ PYTALLOC_UTIL.PY3_2.1.13@PYTALLOC_UTIL.PY3_2.1.13 2.1.16
4913+ PYTALLOC_UTIL.PY3_2.1.14@PYTALLOC_UTIL.PY3_2.1.14 2.1.16
4914+ PYTALLOC_UTIL.PY3_2.1.15@PYTALLOC_UTIL.PY3_2.1.15 2.1.16
4915+ PYTALLOC_UTIL.PY3_2.1.16@PYTALLOC_UTIL.PY3_2.1.16 2.1.16
4916+ PYTALLOC_UTIL.PY3_2.1.5@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4917+ PYTALLOC_UTIL.PY3_2.1.6@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4918+ PYTALLOC_UTIL.PY3_2.1.7@PYTALLOC_UTIL.PY3_2.1.7 2.1.16
4919+ PYTALLOC_UTIL.PY3_2.1.8@PYTALLOC_UTIL.PY3_2.1.8 2.1.16
4920+ PYTALLOC_UTIL.PY3_2.1.9@PYTALLOC_UTIL.PY3_2.1.9 2.1.16
4921+ _pytalloc_check_type@PYTALLOC_UTIL.PY3_2.1.9 2.1.16
4922+ _pytalloc_get_mem_ctx@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4923+ _pytalloc_get_ptr@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4924+ _pytalloc_get_type@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4925+ pytalloc_BaseObject_PyType_Ready@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4926+ pytalloc_BaseObject_check@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4927+ pytalloc_BaseObject_size@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4928+ pytalloc_Check@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4929+ pytalloc_GenericObject_reference_ex@PYTALLOC_UTIL.PY3_2.1.9 2.1.16
4930+ pytalloc_GenericObject_steal_ex@PYTALLOC_UTIL.PY3_2.1.9 2.1.16
4931+ pytalloc_GetBaseObjectType@PYTALLOC_UTIL.PY3_2.1.6 2.1.16
4932+ pytalloc_GetObjectType@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4933+ pytalloc_reference_ex@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4934+ pytalloc_steal@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4935+ pytalloc_steal_ex@PYTALLOC_UTIL.PY3_2.1.5 2.1.16
4936diff --git a/debian/python3-talloc.symbols.i386 b/debian/python3-talloc.symbols.i386
4937new file mode 100644
4938index 0000000..1474f56
4939--- /dev/null
4940+++ b/debian/python3-talloc.symbols.i386
4941@@ -0,0 +1,3 @@
4942+libpytalloc-util.cpython-37m-i386-linux-gnu.so.2 python3-talloc #MINVER#
4943+ PYTALLOC_UTIL.CPYTHON_37M_I386_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_I386_LINUX_GNU_2.1.16 2.1.16
4944+#include "python3-talloc.symbols.common"
4945diff --git a/debian/python3-talloc.symbols.ppc64el b/debian/python3-talloc.symbols.ppc64el
4946new file mode 100644
4947index 0000000..61a4cad
4948--- /dev/null
4949+++ b/debian/python3-talloc.symbols.ppc64el
4950@@ -0,0 +1,3 @@
4951+libpytalloc-util.cpython-37m-powerpc64le-linux-gnu.so.2 python3-talloc #MINVER#
4952+ PYTALLOC_UTIL.CPYTHON_37M_POWERPC64LE_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_POWERPC64LE_LINUX_GNU_2.1.16 2.1.16
4953+#include "python3-talloc.symbols.common"
4954diff --git a/debian/python3-talloc.symbols.s390x b/debian/python3-talloc.symbols.s390x
4955new file mode 100644
4956index 0000000..a2f3d19
4957--- /dev/null
4958+++ b/debian/python3-talloc.symbols.s390x
4959@@ -0,0 +1,3 @@
4960+libpytalloc-util.cpython-37m-s390x-linux-gnu.so.2 python3-talloc #MINVER#
4961+ PYTALLOC_UTIL.CPYTHON_37M_S390X_LINUX_GNU_2.1.16@PYTALLOC_UTIL.CPYTHON_37M_S390X_LINUX_GNU_2.1.16 2.1.16
4962+#include "python3-talloc.symbols.common"
4963diff --git a/debian/rules b/debian/rules
4964index c28863a..f444220 100755
4965--- a/debian/rules
4966+++ b/debian/rules
4967@@ -19,20 +19,11 @@ conf_args += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
4968 conf_args += --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)
4969 conf_args += -v
4970
4971-export PYTHON="$(shell which `pyversions -d`)"
4972-
4973 %:
4974- dh $* --with python2
4975-
4976-override_dh_python2:
4977- dh_python2 --no-guessing-versions
4978- : # this is a hack ... to keep python off the desktop image
4979- -grep '^python:Depends=' \
4980- debian/python-talloc.substvars >> debian/python-talloc-dev.substvars
4981- sed -i -e '/^python:Depends=/d' debian/python-talloc.substvars
4982+ dh $* --with python3
4983
4984 override_dh_auto_configure:
4985- LDFLAGS="$(LDFLAGS)" PYTHON="$(PYTHON)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" ./configure $(conf_args)
4986+ LDFLAGS="$(LDFLAGS)" CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" ./configure $(conf_args)
4987
4988 override_dh_auto_build:
4989 $(MAKE) all V=1
4990@@ -43,7 +34,7 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
4991 endif
4992
4993 override_dh_install:
4994- DEB_PY2_INCDIR=$(shell python-config --includes | sed 's,^-I\([^ ]*\).*,\1,') \
4995+ DEB_PY3_INCDIR=$(shell python3-config --includes | sed 's,^-I\([^ ]*\).*,\1,') \
4996 dh_install --list-missing
4997
4998 get-packaged-orig-source:
4999@@ -56,20 +47,17 @@ override_dh_auto_clean:
5000 rm -f .lock-wscript
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches