patches for bug #10472 - pidl / perl lib path

Michael Adam obnox at samba.org
Thu Sep 4 17:53:49 MDT 2014


PS: also in my master-build-perlpath branch in

git://git.samba.org/obnox/samba/samba-obnox.git

https://git.samba.org/?p=obnox/samba/samba-obnox.git;a=shortlog;h=master-build-perlpath

On 2014-09-05 at 01:46 +0200, Michael Adam wrote:
> Hi,
> 
> attached find a two-part patchset to fix bug 10472 for good.
> 
> The problem of bug 10472 is that samba installed the pidl
> perl modules into a hard-wired directory below the prefix,
> which was fine for non-/usr prefix installs but created
> problems with fhs-/usr installs (distro packagers) that
> want the pidl perl modules in a standard perl module path.
> 
> The first patches solved this by introducing
> "--with-perl-lib-install-dir" option to wafadmin,
> by default setting the "perl_lib_install_dir"
> to the perl reportet "vendorlib", "sitelib" or "privlib"
> directory by default.
> Then perl modules would be installed to the perl_lib_install_dir.
> These patches are already upstream.
> 
> While this works, it has the negative effect, that by default,
> the perl modules are not installed into the prefix but into
> a system path. This should not be!
> In particular one can't install as non-root.
> One other problem with the "--with-perl-lib-install-dir"
> option was that pidl would not find the modules
> when installed into an arbitrary path.
> 
> The attached patchset created in pair- and ping-pong-programming
> with Metze, changes the behaviour this way:
> 
> - pidl is adapted at install time to always find
>   the perl modules wherever they are installed.
>   (by replacing the standard "use lib ..." line.
> 
> - perl modules are installed into:
>   - perl's vendorlibdir if prefix equals perl's vendorprefix
>     (usually "/usr")
>   - ${datadir}/perl5 otherwise
>     (datadir is usually $prefix/share)
> 
> - the "--with-perl-lib-install-dir" option is removed again.
>   More precisely, the changes to wafadmin/Tools/perl.py are
>   reverted and the old options from that module are not used
>   any more at all.
> 
> This way, we always have a sane and working installation
> path for the perl modules and these are fhs-compatible
> for distro packagers and don't need to fiddle with the locations
> via configure parameters.
> 
> The patchset comes in two parts:
> 
> - the first part does all the above changes but leaves
>   wafadmin as it is.
> 
> - after pushing the first part, the build farm needs to
>   be adapted (to not use the --with-perl-*-install-dir options)
> 
> - the second part removes the options and reverts the wafadmin
>   changes.
> 
> Review / comment / push appreciated!
> 
> Cheers - Michael
> 
> 
> 
> 

> From 950cbff0b7a0d22b9802bd5750643c8648a41ace Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Mon, 25 Aug 2014 23:38:29 +0200
> Subject: [PATCH 01/21] wafsamba: remove unused variable from
>  copy_and_fix_python_path
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> Reviewed-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index a2b8eea..7cb2653 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -712,8 +712,6 @@ def copy_and_fix_python_path(task):
>          replacement="""sys.path.insert(0, "%s")
>  sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
>  
> -    shebang = None
> -
>      if task.env["PYTHON"][0] == "/":
>          replacement_shebang = "#!%s\n" % task.env["PYTHON"]
>      else:
> -- 
> 1.9.1
> 
> 
> From 276568e4ce6bec4e70d7595f88cc36237765dd7e Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Mon, 25 Aug 2014 23:39:50 +0200
> Subject: [PATCH 02/21] wafsamba: improve wording in a comment
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> Reviewed-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index 7cb2653..109e160 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -744,7 +744,7 @@ def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
>              destname = os.path.basename(destname)
>      dest = os.path.join(destdir, destname)
>      if python_fixup:
> -        # fixup the python path it will use to find Samba modules
> +        # fix the path python will use to find Samba modules
>          inst_file = file + '.inst'
>          bld.SAMBA_GENERATOR('python_%s' % destname,
>                              rule=copy_and_fix_python_path,
> -- 
> 1.9.1
> 
> 
> From 12c2372ca7147dd35555ba8e02f2b13ec2e0017a Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 23:11:39 +0200
> Subject: [PATCH 03/21] wafsamba: fix dependency calculation for
>  SAMBA_GENERATOR()
> 
> We need to checksum the rule as string command of the
> sourcecode of the python function.
> 
> This is stored in the 'ruledeps' envariable on the waf Task.
> See exec_rule() in wafadmin/TaskGen.py.
> 
>     dep_vars = getattr(self, 'dep_vars', ['ruledeps'])
>     if dep_vars:
>         tsk.dep_vars = dep_vars
>     if isinstance(self.rule, str):
>         tsk.env.ruledeps = self.rule
>     else:
>         # only works if the function is in a global module such as a waf tool
>         tsk.env.ruledeps = Utils.h_fun(self.rule)
> 
> If there's no 'dep_vars' it defaults to ['ruledeps'].
> As we pass our own 'dep_vars' we need to explicitly add
> 'ruledeps'.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index 109e160..ba34fe5 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -603,6 +603,7 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>          dep_vars = vars.keys()
>      elif isinstance(vars, list):
>          dep_vars = vars
> +    dep_vars.append('ruledeps')
>  
>      bld.SET_BUILD_GROUP(group)
>      t = bld(
> @@ -614,7 +615,7 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>          before='cc',
>          ext_out='.c',
>          samba_type='GENERATOR',
> -        dep_vars = [rule] + dep_vars,
> +        dep_vars = dep_vars,
>          name=name)
>  
>      if always:
> -- 
> 1.9.1
> 
> 
> From c0a58c926bf96b73bc077eb2a2e0be2f9ccdb86e Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 23:11:39 +0200
> Subject: [PATCH 04/21] wafsamba: fix dependency for SAMBA_GENERATOR() when
>  passing vars!=None
> 
> vars can only be a dictionary as that's the only thing bld.EXPAND_VARIABLES()
> accepts.
> 
> We need to checksum the whole vars dictionary into the dependencies.
> 
> We set task.env.SAMBA_GENERATOR_VARS = vars and add SAMBA_GENERATOR_VARS
> to the dep_vars.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index ba34fe5..ce391a2 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -599,11 +599,8 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>          return
>  
>      dep_vars = []
> -    if isinstance(vars, dict):
> -        dep_vars = vars.keys()
> -    elif isinstance(vars, list):
> -        dep_vars = vars
>      dep_vars.append('ruledeps')
> +    dep_vars.append('SAMBA_GENERATOR_VARS')
>  
>      bld.SET_BUILD_GROUP(group)
>      t = bld(
> @@ -618,6 +615,10 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>          dep_vars = dep_vars,
>          name=name)
>  
> +    if vars is None:
> +        vars = {}
> +    t.env.SAMBA_GENERATOR_VARS = vars
> +
>      if always:
>          t.always = True
>  
> -- 
> 1.9.1
> 
> 
> From 4f3c9195c5e64e85247b7cb2a018f9920dbdb2f4 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 23:11:39 +0200
> Subject: [PATCH 05/21] wafsamba: allow an optional dep_vars list to be passed
>  to SAMBA_GENERATOR()
> 
> This can be used to checksum variables used in the rule function.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index ce391a2..a9a192b 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -589,6 +589,7 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>                      public_headers_install=True,
>                      header_path=None,
>                      vars=None,
> +                    dep_vars=[],
>                      always=False):
>      '''A generic source generator target'''
>  
> @@ -598,7 +599,6 @@ def SAMBA_GENERATOR(bld, name, rule, source='', target='',
>      if not enabled:
>          return
>  
> -    dep_vars = []
>      dep_vars.append('ruledeps')
>      dep_vars.append('SAMBA_GENERATOR_VARS')
>  
> -- 
> 1.9.1
> 
> 
> From 063054040914e590461c2a52eed6637cc11c2a7c Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 23:14:23 +0200
> Subject: [PATCH 06/21] wafsamba: fix dependencies on environment variables for
>  python_fixup
> 
> We now checksum the sourcecode of copy_and_fix_python_path()
> and the env variables used by this function.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index a9a192b..a884d6d 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -750,12 +750,9 @@ def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
>          inst_file = file + '.inst'
>          bld.SAMBA_GENERATOR('python_%s' % destname,
>                              rule=copy_and_fix_python_path,
> +                            dep_vars=["PYTHON","PYTHON_SPECIFIED","PYTHONDIR","PYTHONARCHDIR"],
>                              source=file,
>                              target=inst_file)
> -        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONARCHDIR"])
> -        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHONDIR"])
> -        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), str(bld.env["PYTHON_SPECIFIED"]))
> -        bld.add_manual_dependency(bld.path.find_or_declare(inst_file), bld.env["PYTHON"])
>          file = inst_file
>      if base_name:
>          file = os.path.join(base_name, file)
> -- 
> 1.9.1
> 
> 
> From a7e6f6174bdf3412fe77a6a4ecdba79c15c07610 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 27 Aug 2014 10:08:21 +0200
> Subject: [PATCH 07/21] wafsamba: let SAMBA_BLDOPTIONS() use
>  dep_vars=['defines'] instead of always=True
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafsamba/samba_patterns.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py
> index 9c0f653..b4427d3 100644
> --- a/buildtools/wafsamba/samba_patterns.py
> +++ b/buildtools/wafsamba/samba_patterns.py
> @@ -205,6 +205,6 @@ def SAMBA_BLDOPTIONS(bld, target):
>      '''generate the bld_options.c for Samba'''
>      t = bld.SAMBA_GENERATOR(target,
>                              rule=write_build_options,
> -                            target=target,
> -                            always=True)
> +                            dep_vars=['defines'],
> +                            target=target)
>  Build.BuildContext.SAMBA_BLDOPTIONS = SAMBA_BLDOPTIONS
> -- 
> 1.9.1
> 
> 
> From 2dcacd92669b6f0f43ac29950bbedb3985a9bdbf Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 27 Aug 2014 10:10:34 +0200
> Subject: [PATCH 08/21] ctdb/wscript: pass dep_vars=['VERSION'] to
>  SAMBA_GENERATOR()
> 
> This avoid the use of always=True.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  ctdb/wscript | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/ctdb/wscript b/ctdb/wscript
> index 9c7d697..9fc9671 100755
> --- a/ctdb/wscript
> +++ b/ctdb/wscript
> @@ -171,10 +171,11 @@ def build(bld):
>      bld.RECURSE('lib/tdb')
>      bld.RECURSE('lib/socket_wrapper')
>  
> -    bld.SAMBA_GENERATOR('ctdb-version-header',
> -                        target='include/ctdb_version.h',
> -                        rule='../packaging/mkversion.sh ${TGT} %s' % (VERSION),
> -                        always=True)
> +    t = bld.SAMBA_GENERATOR('ctdb-version-header',
> +                            target='include/ctdb_version.h',
> +                            rule='../packaging/mkversion.sh ${TGT} %s' % (VERSION),
> +                            dep_vars=['VERSION'])
> +    t.env.VERSION = VERSION
>  
>      bld.SAMBA_SUBSYSTEM('ctdb-util',
>                          source=bld.SUBDIR('lib/util',
> @@ -414,10 +415,12 @@ def build(bld):
>      bld.install_dir(bld.env.CTDB_VARDIR)
>  
>      sed_expr = 's/@PACKAGE_VERSION@/%s/g' % VERSION
> -    bld.SAMBA_GENERATOR('ctdb-pc',
> -                        source='ctdb.pc.in',
> -                        target='ctdb.pc',
> -                        rule='sed -e "%s" ${SRC} > ${TGT}' % sed_expr)
> +    t = bld.SAMBA_GENERATOR('ctdb-pc',
> +                            source='ctdb.pc.in',
> +                            target='ctdb.pc',
> +                            rule='sed -e "%s" ${SRC} > ${TGT}' % sed_expr,
> +                            dep_vars=['VERSION'])
> +    t.env.VERSION = VERSION
>      bld.INSTALL_FILES('${LIBDIR}/pkgconfig', 'ctdb.pc')
>  
>      # Test binaries
> -- 
> 1.9.1
> 
> 
> From e9327f0356358c1d2c37a3d049d08333c8093010 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 27 Aug 2014 10:13:09 +0200
> Subject: [PATCH 09/21] dynconfig/wscript: add dynconfig_varnames()
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  dynconfig/wscript | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/dynconfig/wscript b/dynconfig/wscript
> index a7cfa0a..1be6aaa 100755
> --- a/dynconfig/wscript
> +++ b/dynconfig/wscript
> @@ -372,6 +372,16 @@ def dynconfig_cflags(bld, list=None):
>      return cflags
>  Build.BuildContext.dynconfig_cflags = dynconfig_cflags
>  
> +def dynconfig_varnames(bld, list=None):
> +    '''work out the dynconfig variables'''
> +    varnames = []
> +    for varname in dynconfig.keys():
> +        if list and not varname in list:
> +            continue
> +        varnames.append(varname)
> +    return varnames
> +Build.BuildContext.dynconfig_varnames = dynconfig_varnames
> +
>  def pathconfig_entities(bld, list=None):
>      '''work out the extra entities for the docs'''
>      entities = []
> -- 
> 1.9.1
> 
> 
> From b628f22124863d576a2a0bc5c017ee043110b74c Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 27 Aug 2014 10:15:56 +0200
> Subject: [PATCH 10/21] docs-xml/wscript_build: pass
>  dep_vars=bld.dynconfig_varnames() to SAMBA_GENERATOR()
> 
> This avoids the use of always=True.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  docs-xml/wscript_build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/docs-xml/wscript_build b/docs-xml/wscript_build
> index e7c8931..f7d0db8 100644
> --- a/docs-xml/wscript_build
> +++ b/docs-xml/wscript_build
> @@ -123,7 +123,7 @@ bld.SAMBA_GENERATOR(parameter_all,
>                      source=articles,
>                      target=parameter_all,
>                      rule=smbdotconf_generate_parameter_list,
> -                    always=True)
> +                    dep_vars=bld.dynconfig_varnames())
>  
>  def SMBDOTCONF_MANPAGE(bld, target):
>      ''' assemble and build smb.conf.5 manual page'''
> -- 
> 1.9.1
> 
> 
> From c23ee5bf9693a6eb58db2245f8426bfd58f06423 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Wed, 27 Aug 2014 10:29:50 +0200
> Subject: [PATCH 11/21] lib/ldb/wscript: pass dep_vars=['LDB_VERSION'] to
>  SAMBA_GENERATOR()
> 
> bld.add_manual_dependency() only works for files not for environment variables.
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  lib/ldb/wscript | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/ldb/wscript b/lib/ldb/wscript
> index 6d9e845..027c8cb 100755
> --- a/lib/ldb/wscript
> +++ b/lib/ldb/wscript
> @@ -161,12 +161,11 @@ def build(bld):
>          # generate a include/ldb_version.h
>          t = bld.SAMBA_GENERATOR('ldb_version.h',
>                                  rule='echo "#define LDB_VERSION \\"${LDB_VERSION}\\"" > ${TGT}',
> +                                dep_vars=['LDB_VERSION'],
>                                  target='include/ldb_version.h',
>                                  public_headers='include/ldb_version.h',
>                                  public_headers_install=not private_library)
>          t.env.LDB_VERSION = VERSION
> -        bld.add_manual_dependency(bld.path.find_or_declare('include/ldb_version.h'), VERSION)
> -
>  
>  
>          bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
> -- 
> 1.9.1
> 
> 
> From 6b9c3c1026bddaf6d35bbd50f5657acf564d305e Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Mon, 25 Aug 2014 23:59:46 +0200
> Subject: [PATCH 12/21] dynconfig: implement PERL_LIB_INSTALL_DIR.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
> Signed-off-by: Michael Adam <obnox at samba.org>
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  dynconfig/wscript | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/dynconfig/wscript b/dynconfig/wscript
> index 1be6aaa..1304bd3 100755
> --- a/dynconfig/wscript
> +++ b/dynconfig/wscript
> @@ -111,6 +111,11 @@ dynconfig = {
>           'FHS-PATH':  '${PYTHONARCHDIR}',
>           'OVERWRITE': True,
>      },
> +    'PERL_LIB_INSTALL_DIR' : {
> +         'STD-PATH':  '${PERL_LIB_INSTALL_DIR}',
> +         'FHS-PATH':  '${PERL_LIB_INSTALL_DIR}',
> +         'OVERWRITE': True,
> +    },
>      'INCLUDEDIR' : {
>           'STD-PATH':  '${INCLUDEDIR}',
>           'FHS-PATH':  '${INCLUDEDIR}/samba-4.0',
> -- 
> 1.9.1
> 
> 
> From 59b88aa5dcac8a148a558ae3d3e4381a2551735c Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Tue, 26 Aug 2014 00:41:54 +0200
> Subject: [PATCH 13/21] dynconfig: implement PERL_ARCH_INSTALL_DIR
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> Reviewed-by: Stefan Metzmacher <metze at samba.org>
> ---
>  dynconfig/wscript | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/dynconfig/wscript b/dynconfig/wscript
> index 1304bd3..6410c38 100755
> --- a/dynconfig/wscript
> +++ b/dynconfig/wscript
> @@ -116,6 +116,11 @@ dynconfig = {
>           'FHS-PATH':  '${PERL_LIB_INSTALL_DIR}',
>           'OVERWRITE': True,
>      },
> +    'PERL_ARCH_INSTALL_DIR' : {
> +         'STD-PATH':  '${PERL_ARCH_INSTALL_DIR}',
> +         'FHS-PATH':  '${PERL_ARCH_INSTALL_DIR}',
> +         'OVERWRITE': True,
> +    },
>      'INCLUDEDIR' : {
>           'STD-PATH':  '${INCLUDEDIR}',
>           'FHS-PATH':  '${INCLUDEDIR}/samba-4.0',
> -- 
> 1.9.1
> 
> 
> From 956d7f7fbb46eae53d8190138e4c7f6da3e098e8 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Tue, 26 Aug 2014 01:29:57 +0200
> Subject: [PATCH 14/21] wafsamba: add samba_perl.py with SAMBA_CHECK_PERL()
>  higher level check.
> 
> This checks for the perl binary, sets PERL and PERL_SPECIFIED
> as well es the PERL_ARCH_INSTALL_DIR and PERL_LIB_INSTALL_DIR.
> 
> We want to avoid installing the perl modules outside the prefix.
> I.e. generally,the perl modules should be installed
> under "$prefix/share/perl5".
> 
> This improves the fixes for bug #10472.
> 
> The new strategy for automatically setting the paths is this:
> 
> - if the prefix equals perl's vendorprefix, then
>   - PERL_LIB_INSTALL_DIR is set to perl's vendorlib dir
>   - PERL_ARCH_INSTALL_DIR is set to perl's vendorarch dir
> - otherwise:
>   - PERL_LIB_INSTALL_DIR is set to ${DATADIR}/perl5
>     (usually ${PREFIX}/share/perl5)
>   - PERL_ARCH_INSTALL_DIR is set to ${LIBDIR}/perl5
>     (usually ${PREFIX}/lib/perl5)
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
> Signed-off-by: Michael Adam <obnox at samba.org>
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/samba_perl.py | 62 +++++++++++++++++++++++++++++++++++++++
>  buildtools/wafsamba/wafsamba.py   |  1 +
>  2 files changed, 63 insertions(+)
>  create mode 100644 buildtools/wafsamba/samba_perl.py
> 
> diff --git a/buildtools/wafsamba/samba_perl.py b/buildtools/wafsamba/samba_perl.py
> new file mode 100644
> index 0000000..3909aba
> --- /dev/null
> +++ b/buildtools/wafsamba/samba_perl.py
> @@ -0,0 +1,62 @@
> +import Build
> +from samba_utils import *
> +from Configure import conf
> +
> +done = {}
> +
> + at conf
> +def SAMBA_CHECK_PERL(conf, mandatory=True, version=(5,0,0)):
> +    #
> +    # TODO: use the @runonce mechanism for this.
> +    # The problem is that @runonce currently does
> +    # not seem to work together with @conf...
> +    # So @runonce (and/or) @conf needs fixing.
> +    #
> +    if "done" in done:
> +        return
> +    done["done"] = True
> +    conf.find_program('perl', var='PERL', mandatory=mandatory)
> +    conf.check_tool('perl')
> +    path_perl = conf.find_program('perl')
> +    conf.env.PERL_SPECIFIED = (conf.env.PERL != path_perl)
> +    conf.check_perl_version(version)
> +
> +    def read_perl_config_var(cmd):
> +        return Utils.to_list(Utils.cmd_output([conf.env.PERL, '-MConfig', '-e', cmd]))
> +
> +    def check_perl_config_var(var):
> +        conf.start_msg("Checking for perl $Config{%s}:" % var)
> +        try:
> +            v = read_perl_config_var('print $Config{%s}' % var)[0]
> +            conf.end_msg("'%s'" % (v), 'GREEN')
> +            return v
> +        except IndexError:
> +            conf.end_msg(False, 'YELLOW')
> +            pass
> +        return None
> +
> +    vendor_prefix = check_perl_config_var('vendorprefix')
> +
> +    perl_arch_install_dir = None
> +    if vendor_prefix == conf.env.PREFIX:
> +        perl_arch_install_dir = check_perl_config_var('vendorarch');
> +    if perl_arch_install_dir is None:
> +        perl_arch_install_dir = "${LIBDIR}/perl5";
> +    conf.start_msg("PERL_ARCH_INSTALL_DIR: ")
> +    conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN')
> +    conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir
> +
> +    perl_lib_install_dir = None
> +    if vendor_prefix == conf.env.PREFIX:
> +        perl_lib_install_dir = check_perl_config_var('vendorlib');
> +    if perl_lib_install_dir is None:
> +        perl_lib_install_dir = "${DATADIR}/perl5";
> +    conf.start_msg("PERL_LIB_INSTALL_DIR: ")
> +    conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN')
> +    conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
> +
> +    perl_inc = read_perl_config_var('print "@INC"')
> +    perl_inc.remove('.')
> +    conf.start_msg("PERL_INC: ")
> +    conf.end_msg("%s" % (perl_inc), 'GREEN')
> +    conf.env.PERL_INC = perl_inc
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index a884d6d..bb06541 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -16,6 +16,7 @@ from samba_patterns import *
>  from samba_pidl import *
>  from samba_autoproto import *
>  from samba_python import *
> +from samba_perl import *
>  from samba_deps import *
>  from samba_bundled import *
>  from samba_third_party import *
> -- 
> 1.9.1
> 
> 
> From ffd1bb87ea7d9d40fd2d72cc013a072729eda3f9 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Tue, 26 Aug 2014 01:31:17 +0200
> Subject: [PATCH 15/21] build: do full SAMBA_CHECK_PERL() check in configure
> 
> ...instead of only checking for the perl binary
> 
> This autodetects PERL_LIB_INSTALL_DIR and removes the
> need of the --with-perl-lib-install-dir when using a --prefix!=/usr.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  wscript | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/wscript b/wscript
> index 7b43c58..73c113c 100644
> --- a/wscript
> +++ b/wscript
> @@ -99,7 +99,7 @@ def configure(conf):
>      conf.env.replace_add_global_pthread = True
>      conf.RECURSE('lib/replace')
>  
> -    conf.find_program('perl', var='PERL', mandatory=True)
> +    conf.SAMBA_CHECK_PERL(mandatory=True)
>      conf.find_program('xsltproc', var='XSLTPROC')
>  
>      conf.SAMBA_CHECK_PYTHON(mandatory=True, version=(2,5,0))
> -- 
> 1.9.1
> 
> 
> From fb34ee336ec61929d7cd9d815456a61d882c9299 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 4 Sep 2014 01:38:14 +0200
> Subject: [PATCH 16/21] pidl/wscript: don't check for perl again.
> 
> This is done at the toplevel now.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
> Signed-off-by: Michael Adam <obnox at samba.org>
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  pidl/wscript | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/pidl/wscript b/pidl/wscript
> index 4965870..c4edf57 100644
> --- a/pidl/wscript
> +++ b/pidl/wscript
> @@ -29,9 +29,6 @@ def set_options(opt):
>      opt.tool_options('perl')
>  
>  def configure(conf):
> -    conf.check_tool('perl')
> -    conf.check_perl_ext_devel()
> -
>      # Check if perl(Parse::Yapp::Driver) is available.
>      check_system_perl_module(conf, "Parse::Yapp::Driver", 1.05)
>  
> -- 
> 1.9.1
> 
> 
> From d5c893f4007fcd1f9b0846242332196c3674de8c Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Wed, 27 Aug 2014 22:19:38 +0200
> Subject: [PATCH 17/21] s3:build: don't detect perl in source3/wscript again.
> 
> This is done in the top level now.
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  source3/wscript | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/source3/wscript b/source3/wscript
> index dce5da2..44cce16 100644
> --- a/source3/wscript
> +++ b/source3/wscript
> @@ -586,7 +586,6 @@ msg.msg_accrightslen = sizeof(fd);
>          conf.DEFINE('WITH_WINBIND', '1')
>  
>      conf.find_program('awk', var='AWK')
> -    conf.find_program('perl', var='PERL')
>  
>      conf.CHECK_HEADERS('asm/types.h')
>  
> -- 
> 1.9.1
> 
> 
> From 80825dd0b06dc572aff6ed908e30544caaa6395b Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 17 Jul 2014 16:54:54 +0200
> Subject: [PATCH 18/21] wafsamba: add perl_fixup parameter to INSTALL_FILES
> 
> This fixes the search path for modules when installing
> a perl "binary" by replacing a line 'use lib "$RealBin/lib";'
> which works for the build directory with the appropriate
> "use lib" line.
> 
> This is a step in allowing to install perl modules under the
> prefix directory again.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
> Signed-off-by: Michael Adam <obnox at samba.org>
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/wafsamba.py | 47 +++++++++++++++++++++++++++++++++++++----
>  1 file changed, 43 insertions(+), 4 deletions(-)
> 
> diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
> index bb06541..f86ac61 100644
> --- a/buildtools/wafsamba/wafsamba.py
> +++ b/buildtools/wafsamba/wafsamba.py
> @@ -736,9 +736,38 @@ sys.path.insert(1, "%s")""" % (task.env["PYTHONARCHDIR"], task.env["PYTHONDIR"])
>      os.chmod(installed_location, 0755)
>      return 0
>  
> +def copy_and_fix_perl_path(task):
> +    pattern='use lib "$RealBin/lib";'
> +
> +    replacement = ""
> +    if not task.env["PERL_LIB_INSTALL_DIR"] in task.env["PERL_INC"]:
> +         replacement = 'use lib "%s";' % task.env["PERL_LIB_INSTALL_DIR"]
> +
> +    if task.env["PERL"][0] == "/":
> +        replacement_shebang = "#!%s\n" % task.env["PERL"]
> +    else:
> +        replacement_shebang = "#!/usr/bin/env %s\n" % task.env["PERL"]
> +
> +    installed_location=task.outputs[0].bldpath(task.env)
> +    source_file = open(task.inputs[0].srcpath(task.env))
> +    installed_file = open(installed_location, 'w')
> +    lineno = 0
> +    for line in source_file:
> +        newline = line
> +        if lineno == 0 and task.env["PERL_SPECIFIED"] == True and line[:2] == "#!":
> +            newline = replacement_shebang
> +        elif pattern in line:
> +            newline = line.replace(pattern, replacement)
> +        installed_file.write(newline)
> +        lineno = lineno + 1
> +    installed_file.close()
> +    os.chmod(installed_location, 0755)
> +    return 0
> +
>  
>  def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
> -                 python_fixup=False, destname=None, base_name=None):
> +                 python_fixup=False, perl_fixup=False,
> +                 destname=None, base_name=None):
>      '''install a file'''
>      destdir = bld.EXPAND_VARIABLES(destdir)
>      if not destname:
> @@ -755,18 +784,28 @@ def install_file(bld, destdir, file, chmod=MODE_644, flat=False,
>                              source=file,
>                              target=inst_file)
>          file = inst_file
> +    if perl_fixup:
> +        # fix the path perl will use to find Samba modules
> +        inst_file = file + '.inst'
> +        bld.SAMBA_GENERATOR('perl_%s' % destname,
> +                            rule=copy_and_fix_perl_path,
> +                            dep_vars=["PERL","PERL_SPECIFIED","PERL_LIB_INSTALL_DIR"],
> +                            source=file,
> +                            target=inst_file)
> +        file = inst_file
>      if base_name:
>          file = os.path.join(base_name, file)
>      bld.install_as(dest, file, chmod=chmod)
>  
>  
>  def INSTALL_FILES(bld, destdir, files, chmod=MODE_644, flat=False,
> -                  python_fixup=False, destname=None, base_name=None):
> +                  python_fixup=False, perl_fixup=False,
> +                  destname=None, base_name=None):
>      '''install a set of files'''
>      for f in TO_LIST(files):
>          install_file(bld, destdir, f, chmod=chmod, flat=flat,
> -                     python_fixup=python_fixup, destname=destname,
> -                     base_name=base_name)
> +                     python_fixup=python_fixup, perl_fixup=perl_fixup,
> +                     destname=destname, base_name=base_name)
>  Build.BuildContext.INSTALL_FILES = INSTALL_FILES
>  
>  
> -- 
> 1.9.1
> 
> 
> From 2532bd69d2bb601a74d1975c4c92bbe0c371a31b Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Mon, 25 Aug 2014 23:57:23 +0200
> Subject: [PATCH 19/21] pidl: fix the perl module search path (use lib ...)
>  when installing pidl.
> 
> This way, pidl can also run with modules installed under the $prefix.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  pidl/wscript | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pidl/wscript b/pidl/wscript
> index c4edf57..0d7626c 100644
> --- a/pidl/wscript
> +++ b/pidl/wscript
> @@ -43,7 +43,7 @@ def configure(conf):
>      conf.find_program('pod2man', var='POD2MAN')
>  
>  def build(bld):
> -    bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755)
> +    bld.INSTALL_FILES('${BINDIR}', 'pidl', chmod=MODE_755, perl_fixup=True)
>  
>      bld.RECURSE('lib')
>  
> -- 
> 1.9.1
> 
> 
> From ef5a081ab6ccc9d80a3753dd8352bd4e4180edb8 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Mon, 25 Aug 2014 23:58:48 +0200
> Subject: [PATCH 20/21] pidl: remove superfluous "use lib ...".
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  pidl/pidl | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/pidl/pidl b/pidl/pidl
> index c65092e..b7dcc2a 100755
> --- a/pidl/pidl
> +++ b/pidl/pidl
> @@ -404,7 +404,6 @@ pidl README by Andrew Tridgell.
>  use strict;
>  use FindBin qw($RealBin $Script);
>  use lib "$RealBin/lib";
> -use lib "$RealBin/../share/perl5";
>  use Getopt::Long;
>  use File::Basename;
>  use Parse::Pidl qw ( $VERSION );
> -- 
> 1.9.1
> 
> 
> From 1f083f73e5ba95c07cca8cde099f820036412024 Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 21:32:17 +0200
> Subject: [PATCH 21/21] script/autobuild.py: remove explicit
>  --with-perl-*-install-dir options
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  script/autobuild.py | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/script/autobuild.py b/script/autobuild.py
> index 786286b..c5d3cad 100755
> --- a/script/autobuild.py
> +++ b/script/autobuild.py
> @@ -44,7 +44,7 @@ tasks = {
>                 ("clean", "make clean", "text/plain") ],
>  
>      # We have 'test' before 'install' because, 'test' should work without 'install'
> -    "samba" : [ ("configure", "./configure.developer ${PREFIX} ${PERL_VENDOR_LIB} --with-selftest-prefix=./bin/ab", "text/plain"),
> +    "samba" : [ ("configure", "./configure.developer ${PREFIX} --with-selftest-prefix=./bin/ab", "text/plain"),
>                  ("make", "make -j", "text/plain"),
>                  ("test", "make test FAIL_IMMEDIATELY=1", "text/plain"),
>                  ("install", "make install", "text/plain"),
> @@ -65,7 +65,7 @@ tasks = {
>                       ("ctdb-header-ls", "ls ${PREFIX_DIR}/include/ctdb.h", "text/plain"),
>  
>                       # build samba with cluster support against this ctdb:
> -                     ("samba-configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} ./configure.developer ${PREFIX} ${PERL_VENDOR_LIB} --with-selftest-prefix=./bin/ab --with-cluster-support --with-ctdb-dir=${PREFIX_DIR} --bundled-libraries=!tdb", "text/plain"),
> +                     ("samba-configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=${PREFIX_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH} ./configure.developer ${PREFIX} --with-selftest-prefix=./bin/ab --with-cluster-support --with-ctdb-dir=${PREFIX_DIR} --bundled-libraries=!tdb", "text/plain"),
>                       ("samba-make", "make", "text/plain"),
>                       ("samba-check", "./bin/smbd -b | grep CLUSTER_SUPPORT", "text/plain"),
>                       ("samba-install", "make install", "text/plain"),
> @@ -97,7 +97,7 @@ tasks = {
>                        ("ldb-make", "cd lib/ldb && make", "text/plain"),
>                        ("ldb-install", "cd lib/ldb && make install", "text/plain"),
>  
> -                      ("configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PREFIX_DIR}/lib/pkgconfig ./configure --bundled-libraries=!talloc,!tdb,!pytdb,!ntdb,!pyntdb,!ldb,!pyldb,!tevent,!pytevent --abi-check --enable-debug -C ${PREFIX} ${PERL_VENDOR_LIB}", "text/plain"),
> +                      ("configure", "PYTHONPATH=${PYTHON_PREFIX}/site-packages:$PYTHONPATH PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${PREFIX_DIR}/lib/pkgconfig ./configure --bundled-libraries=!talloc,!tdb,!pytdb,!ntdb,!pyntdb,!ldb,!pyldb,!tevent,!pytevent --abi-check --enable-debug -C ${PREFIX}", "text/plain"),
>                        ("make", "make", "text/plain"),
>                        ("install", "make install", "text/plain"),
>                        ("dist", "make dist", "text/plain")],
> @@ -228,9 +228,6 @@ class builder(object):
>          self.cmd = self.cmd.replace("${PYTHON_PREFIX}", get_python_lib(standard_lib=1, prefix=self.prefix))
>          self.cmd = self.cmd.replace("${PREFIX}", "--prefix=%s" % self.prefix)
>          self.cmd = self.cmd.replace("${PREFIX_DIR}", "%s" % self.prefix)
> -        perl_vendor_lib = "--with-perl-arch-install-dir=%s/share/perl5 " % self.prefix
> -        perl_vendor_lib += "--with-perl-lib-install-dir=%s/lib/perl5" % self.prefix
> -        self.cmd = self.cmd.replace("${PERL_VENDOR_LIB}", perl_vendor_lib)
>  #        if self.output_mime_type == "text/x-subunit":
>  #            self.cmd += " | %s --immediate" % (os.path.join(os.path.dirname(__file__), "selftest/format-subunit"))
>          print '%s: [%s] Running %s' % (self.name, self.stage, self.cmd)
> -- 
> 1.9.1
> 

> From c27ce53616f6dd70a7b84bc85226d387037a9e3e Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 26 Aug 2014 21:33:05 +0200
> Subject: [PATCH 1/5] pidl/wscript: remove --with-perl-* options
> 
> These are not needed anymore as we have useful defaults now.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> Reviewed-by: Michael Adam <obnox at samba.org>
> ---
>  pidl/wscript | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/pidl/wscript b/pidl/wscript
> index 0d7626c..27cb230 100644
> --- a/pidl/wscript
> +++ b/pidl/wscript
> @@ -26,7 +26,7 @@ def check_system_perl_module(conf, module, version=None):
>      return True
>  
>  def set_options(opt):
> -    opt.tool_options('perl')
> +    return
>  
>  def configure(conf):
>      # Check if perl(Parse::Yapp::Driver) is available.
> -- 
> 1.9.1
> 
> 
> From 2133b0a1d21ad93e047cebfdcb7c4e101a60c0b8 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 4 Sep 2014 12:45:21 +0200
> Subject: [PATCH 2/5] Revert "wafsamba: Fail with error message if perl doesn't
>  provide valid dirs."
> 
> This reverts commit 2637890ef42a238093f0f3cbdda0d621d5f9b2e2.
> 
> We are reverting buildtools/wafadmin/Tools/perl.py back to upstream state.
> Everything special is now in buildtools/wafsamba/samba_perl.py.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafadmin/Tools/perl.py | 58 +++++++++++++--------------------------
>  1 file changed, 19 insertions(+), 39 deletions(-)
> 
> diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py
> index 0f34e79..e65ee5c 100644
> --- a/buildtools/wafadmin/Tools/perl.py
> +++ b/buildtools/wafadmin/Tools/perl.py
> @@ -98,53 +98,33 @@ def check_perl_ext_devel(conf):
>  	conf.env.EXTUTILS_TYPEMAP  = read_out('print "$Config{privlib}/ExtUtils/typemap"')
>  	conf.env.perlext_PATTERN   = '%s.' + read_out('print $Config{dlext}')[0]
>  
> -	def try_any(keys):
> -		for k in keys:
> -			conf.start_msg("Checking for perl $Config{%s}:" % k)
> -			try:
> -				v = read_out('print $Config{%s}' % k)[0]
> -				conf.end_msg("'%s'" % (v), 'GREEN')
> -				return v
> -			except IndexError:
> -				conf.end_msg(False, 'YELLOW')
> -				pass
> -		return None
> -
> -	perl_arch_install_dir = None
> -	if getattr(Options.options, 'perl_arch_install_dir', None):
> -		perl_arch_install_dir = Options.options.perl_arch_install_dir
> -	if perl_arch_install_dir is None:
> -		perl_arch_install_dir = try_any(['vendorarch', 'sitearch', 'archlib'])
> -	if perl_arch_install_dir is None:
> -		conf.fatal('No perl arch install directory autodetected.' +
> -			   'Please define it with --with-perl-arch-install-dir.')
> -	conf.start_msg("PERL_ARCH_INSTALL_DIR: ")
> -	conf.end_msg("'%s'" % (perl_arch_install_dir), 'GREEN')
> -	conf.env.PERL_ARCH_INSTALL_DIR = perl_arch_install_dir
> -
> -	perl_lib_install_dir = None
> -	if getattr(Options.options, 'perl_lib_install_dir', None):
> -		perl_lib_install_dir = Options.options.perl_lib_install_dir
> -	if perl_lib_install_dir is None:
> -		perl_lib_install_dir = try_any(['vendorlib', 'sitelib', 'privlib'])
> -	if perl_lib_install_dir is None:
> -		conf.fatal('No perl lib install directory autodetected. ' +
> -			   'Please define it with --with-perl-lib-install-dir.')
> -	conf.start_msg("PERL_LIB_INSTALL_DIR: ")
> -	conf.end_msg("'%s'" % (perl_lib_install_dir), 'GREEN')
> -	conf.env.PERL_LIB_INSTALL_DIR = perl_lib_install_dir
> +	if getattr(Options.options, 'perl_vendorarch_dir', None):
> +		conf.env.PERL_VENDORARCH_DIR = Options.options.perl_vendorarch_dir
> +	else:
> +		try:
> +			conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
> +		except IndexError:
> +			conf.env.PERL_VENDORARCH_DIR = "${DATADIR}/perl5"
> +
> +	if getattr(Options.options, 'perl_vendorlib_dir', None):
> +		conf.env.PERL_VENDORLIB_DIR = Options.options.perl_vendorlib_dir
> +	else:
> +		try:
> +			conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0]
> +		except IndexError:
> +			conf.env.PERL_VENDORLIB_DIR = "${LIBDIR}/perl5"
>  
>  def set_options(opt):
>  	opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None)
>  
> -	opt.add_option("--with-perl-arch-install-dir",
> +	opt.add_option("--with-perl-vendorarch",
>  		       type="string",
> -		       dest="perl_arch_install_dir",
> +		       dest="perl_vendorarch_dir",
>  		       help = ('Specify directory where to install arch specific files'),
>  		       default=None)
>  
> -	opt.add_option("--with-perl-lib-install-dir",
> +	opt.add_option("--with-perl-vendorlib",
>  		       type="string",
> -		       dest="perl_lib_install_dir",
> +		       dest="perl_vendorlib_dir",
>  		       help = ('Specify directory where to install vendor specific files'),
>  		       default=None)
> -- 
> 1.9.1
> 
> 
> From ffdc8f60b213920f45562422fe4008bcc479cbe4 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 4 Sep 2014 12:45:32 +0200
> Subject: [PATCH 3/5] Revert "wafsamba: If perl can't provide defaults, define
>  them."
> 
> This reverts commit 0ba276ebad57d75a769e22414f94acbe8c177d97.
> 
> We are reverting buildtools/wafadmin/Tools/perl.py back to upstream state.
> Everything special is now in buildtools/wafsamba/samba_perl.py.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafadmin/Tools/perl.py | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py
> index e65ee5c..8f13e28 100644
> --- a/buildtools/wafadmin/Tools/perl.py
> +++ b/buildtools/wafadmin/Tools/perl.py
> @@ -101,18 +101,12 @@ def check_perl_ext_devel(conf):
>  	if getattr(Options.options, 'perl_vendorarch_dir', None):
>  		conf.env.PERL_VENDORARCH_DIR = Options.options.perl_vendorarch_dir
>  	else:
> -		try:
> -			conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
> -		except IndexError:
> -			conf.env.PERL_VENDORARCH_DIR = "${DATADIR}/perl5"
> +		conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
>  
>  	if getattr(Options.options, 'perl_vendorlib_dir', None):
>  		conf.env.PERL_VENDORLIB_DIR = Options.options.perl_vendorlib_dir
>  	else:
> -		try:
> -			conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0]
> -		except IndexError:
> -			conf.env.PERL_VENDORLIB_DIR = "${LIBDIR}/perl5"
> +		conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0]
>  
>  def set_options(opt):
>  	opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None)
> -- 
> 1.9.1
> 
> 
> From 00da650dd0c76b1f3dc0a9ef6a27cf5e959d380e Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 4 Sep 2014 12:45:40 +0200
> Subject: [PATCH 4/5] Revert "buildtools: Add perl vendorlib configure option."
> 
> This reverts commit 48f0183dbeddd7bdf333a40fe0d3e1c7e7fe00f2.
> 
> We are reverting buildtools/wafadmin/Tools/perl.py back to upstream state.
> Everything special is now in buildtools/wafsamba/samba_perl.py.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafadmin/Tools/perl.py | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py
> index 8f13e28..99e0540 100644
> --- a/buildtools/wafadmin/Tools/perl.py
> +++ b/buildtools/wafadmin/Tools/perl.py
> @@ -103,11 +103,6 @@ def check_perl_ext_devel(conf):
>  	else:
>  		conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
>  
> -	if getattr(Options.options, 'perl_vendorlib_dir', None):
> -		conf.env.PERL_VENDORLIB_DIR = Options.options.perl_vendorlib_dir
> -	else:
> -		conf.env.PERL_VENDORLIB_DIR = read_out('print $Config{vendorlib}')[0]
> -
>  def set_options(opt):
>  	opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None)
>  
> @@ -117,8 +112,3 @@ def set_options(opt):
>  		       help = ('Specify directory where to install arch specific files'),
>  		       default=None)
>  
> -	opt.add_option("--with-perl-vendorlib",
> -		       type="string",
> -		       dest="perl_vendorlib_dir",
> -		       help = ('Specify directory where to install vendor specific files'),
> -		       default=None)
> -- 
> 1.9.1
> 
> 
> From 7f294ca58ad104d2889e40f6b48aa446f4d92160 Mon Sep 17 00:00:00 2001
> From: Michael Adam <obnox at samba.org>
> Date: Thu, 4 Sep 2014 12:45:48 +0200
> Subject: [PATCH 5/5] Revert "buildtools: Rename perl vendorarch configure
>  option."
> 
> This reverts commit 04685ff4eed9535769d6a5feee7353f1796a4389.
> 
> We are reverting buildtools/wafadmin/Tools/perl.py back to upstream state.
> Everything special is now in buildtools/wafsamba/samba_perl.py.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=10472
> 
> Signed-off-by: Michael Adam <obnox at samba.org>
> ---
>  buildtools/wafadmin/Tools/perl.py | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/buildtools/wafadmin/Tools/perl.py b/buildtools/wafadmin/Tools/perl.py
> index 99e0540..a6787a8 100644
> --- a/buildtools/wafadmin/Tools/perl.py
> +++ b/buildtools/wafadmin/Tools/perl.py
> @@ -98,17 +98,12 @@ def check_perl_ext_devel(conf):
>  	conf.env.EXTUTILS_TYPEMAP  = read_out('print "$Config{privlib}/ExtUtils/typemap"')
>  	conf.env.perlext_PATTERN   = '%s.' + read_out('print $Config{dlext}')[0]
>  
> -	if getattr(Options.options, 'perl_vendorarch_dir', None):
> -		conf.env.PERL_VENDORARCH_DIR = Options.options.perl_vendorarch_dir
> +	if getattr(Options.options, 'perlarchdir', None):
> +		conf.env.ARCHDIR_PERL = Options.options.perlarchdir
>  	else:
> -		conf.env.PERL_VENDORARCH_DIR = read_out('print $Config{vendorarch}')[0]
> +		conf.env.ARCHDIR_PERL = read_out('print $Config{sitearch}')[0]
>  
>  def set_options(opt):
>  	opt.add_option("--with-perl-binary", type="string", dest="perlbinary", help = 'Specify alternate perl binary', default=None)
> -
> -	opt.add_option("--with-perl-vendorarch",
> -		       type="string",
> -		       dest="perl_vendorarch_dir",
> -		       help = ('Specify directory where to install arch specific files'),
> -		       default=None)
> +	opt.add_option("--with-perl-archdir", type="string", dest="perlarchdir", help = 'Specify directory where to install arch specific files', default=None)
>  
> -- 
> 1.9.1
> 



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140905/c4155fa6/attachment.pgp>


More information about the samba-technical mailing list