wafsamba: We need to honor DESTDIR in INSTALL_DIR
authorAndreas Schneider <asn@samba.org>
Tue, 12 Sep 2017 13:56:44 +0000 (15:56 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 16 Sep 2017 02:47:29 +0000 (04:47 +0200)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12957

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Sep 16 04:47:29 CEST 2017 on sn-devel-144

buildtools/wafsamba/wafsamba.py

index f91adca..23fd3c4 100644 (file)
@@ -885,29 +885,30 @@ def INSTALL_WILDCARD(bld, destdir, pattern, chmod=MODE_644, flat=False,
                   python_fixup=python_fixup, base_name=trim_path)
 Build.BuildContext.INSTALL_WILDCARD = INSTALL_WILDCARD
 
-def INSTALL_DIR(bld, path, chmod=0o755):
+def INSTALL_DIR(bld, path, chmod=0o755, env=None):
     """Install a directory if it doesn't exist, always set permissions."""
 
     if not path:
         return []
 
+    destpath = bld.get_install_path(path, env)
+
     if bld.is_install > 0:
-        path = bld.EXPAND_VARIABLES(path)
-        if not os.path.isdir(path):
+        if not os.path.isdir(destpath):
             try:
-                os.makedirs(path)
-                os.chmod(path, chmod)
+                os.makedirs(destpath)
+                os.chmod(destpath, chmod)
             except OSError, e:
-                if not os.path.isdir(path):
+                if not os.path.isdir(destpath):
                     raise Utils.WafError("Cannot create the folder '%s' (error: %s)" % (path, e))
 Build.BuildContext.INSTALL_DIR = INSTALL_DIR
 
-def INSTALL_DIRS(bld, destdir, dirs, chmod=0o755):
+def INSTALL_DIRS(bld, destdir, dirs, chmod=0o755, env=None):
     '''install a set of directories'''
     destdir = bld.EXPAND_VARIABLES(destdir)
     dirs = bld.EXPAND_VARIABLES(dirs)
     for d in TO_LIST(dirs):
-        INSTALL_DIR(bld, os.path.join(destdir, d), chmod)
+        INSTALL_DIR(bld, os.path.join(destdir, d), chmod, env)
 Build.BuildContext.INSTALL_DIRS = INSTALL_DIRS