<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 28, 2013 at 4:47 PM, Anand Avati <span dir="ltr">&lt;<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 05/28/2013 03:42 PM, Anand Avati wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
<br>
On Tue, May 28, 2013 at 2:46 PM, Andrew Bartlett &lt;<a href="mailto:abartlet@samba.org" target="_blank">abartlet@samba.org</a><br></div><div class="im">
&lt;mailto:<a href="mailto:abartlet@samba.org" target="_blank">abartlet@samba.org</a>&gt;&gt; wrote:<br>
<br>
    On Tue, 2013-05-28 at 17:36 -0400, Anand Avati wrote:<br>
     &gt; Implement a Samba VFS plugin for glusterfs based on gluster&#39;s gfapi.<br>
     &gt; This is a &quot;bottom&quot; vfs plugin (not something to be stacked on top of<br>
     &gt; another module), and translates (most) calls into closest actions<br>
     &gt; on gfapi.<br>
<br>
    Thank you for your patience here.<br>
<br>
     &gt; Signed-off-by: Anand Avati &lt;<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a><br></div>
    &lt;mailto:<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a>&gt;&gt;<div><div class="h5"><br>
     &gt; ---<br>
     &gt;<br>
     &gt; Hi,<br>
     &gt;<br>
     &gt; I hope the waf changes are fine. I could not test them because<br>
    builds were failing generally on samba.git master HEAD.<br>
<br>
    You need to resolve whatever is causing your problems here, as it is not<br>
    a general issue. Our autobuild system ensures that git master and<br>
    v4-0-test always compile and test in at least Ubuntu 10.04, and it is<br>
    incredibly rare that it not work on at least Linux without it being a<br>
    specifically local issue.<br>
<br>
    +<br>
    +bld.SAMBA3_MODULE(&#39;vfs_<u></u>glusterfs&#39;,<br>
    +                  subsystem=&#39;vfs&#39;,<br>
    +                  source=VFS_GLUSTERFS_SRC,<br>
    +                  deps=&#39;samba-util&#39;,<br>
    +                  init_function=&#39;&#39;,<br>
    +<br>
      internal_module=bld.SAMBA3_IS_<u></u>STATIC_MODULE(&#39;vfs_glusterfs&#39;)<u></u>,<br>
    +<br>
      enabled=bld.SAMBA3_IS_ENABLED_<u></u>MODULE(&#39;vfs_glusterfs&#39;))<br>
<br>
    You should ensure your module depends on glusterfs, by changing that to<br>
    adding deps=&#39;glusterfs samba-util&#39; (and making that match what the<br>
    conf.check_cfg finds and stores).<br>
<br>
<br>
I tried that. I added uselib_store=&#39;glusterfs&#39; and included &#39;glusterfs&#39;<br>
in deps= line. However while building I get this error:<br>
<br>
[avati@blackbox samba]$ make<br>
WAF_MAKE=1 python ./buildtools/bin/waf build<br>
./buildtools/wafsamba/samba_<u></u>utils.py:397: DeprecationWarning: the md5<br>
module is deprecated; use hashlib instead<br>
   import md5<br>
Waf: Entering directory `/home/avati/work/samba/bin&#39;<br>
Selected embedded Heimdal build<br>
Checking project rules ...<br>
Unknown dependency &#39;glusterfs&#39; in &#39;vfs_glusterfs&#39;<br>
make: *** [all] Error 1<br>
<br>
<br>
I am not familiar with waf, and trying to figure out how it works. I<br>
don&#39;t understand how the check_cfg() in wscript and<br>
source3/wscript_build&#39;s bld.SAMBA3_MODULE() actually integrate internally.<br>
<br>
     &gt; diff --git a/source3/wscript b/source3/wscript<br>
     &gt; index dba6cdc..0d07692 100644<br>
     &gt; --- a/source3/wscript<br>
     &gt; +++ b/source3/wscript<br>
     &gt; @@ -59,6 +59,11 @@ def set_options(opt):<br>
     &gt;                     help=(&quot;Directory under which libcephfs is<br>
    installed&quot;),<br>
     &gt;                     action=&quot;store&quot;, dest=&#39;libcephfs_dir&#39;,<br>
    default=None)<br>
     &gt;<br>
     &gt; +    opt.add_option(&#39;--enable-<u></u>glusterfs&#39;,<br>
     &gt; +                   help=(&quot;Enable building vfs_glusterfs module&quot;),<br>
     &gt; +                   action=&quot;store_true&quot;, dest=&#39;enable_glusterfs&#39;,<br>
    default=True)<br>
     &gt; +    opt.add_option(&#39;--disable-<u></u>glusterfs&#39;, help=SUPPRESS_HELP,<br>
     &gt; +                   action=&quot;store_false&quot;, dest=&#39;enable_glusterfs&#39;)<br>
<br>
    In general we would prefer not to have options for every possible<br>
    module.  Instead, please just make it automatic based on finding<br>
    glusterfs.<br>
<br>
<br>
OK, I will just leave things to check_cfg() detection then?<br>
<br>
     &gt;  def configure(conf):<br>
     &gt; @@ -1709,6 +1714,13 @@ main() {<br>
     &gt;      if conf.CHECK_HEADERS(&#39;cephfs/<u></u>libcephfs.h&#39;, False, False,<br>
    &#39;cephfs&#39;) and conf.CHECK_LIB(&#39;cephfs&#39;):<br>
     &gt;          conf.DEFINE(&#39;HAVE_CEPH&#39;, &#39;1&#39;)<br>
     &gt;<br>
     &gt; +    conf.env.enable_glusterfs = Options.options.enable_<u></u>glusterfs<br>
     &gt; +<br>
     &gt; +    if Options.options.enable_<u></u>glusterfs:<br>
     &gt; +        conf.check_cfg(package=&#39;<u></u>glusterfs-api&#39;,<br>
    args=&#39;&quot;glusterfs-api &gt;= 4&quot; --cflags --libs&#39;,<br>
     &gt; +                       uselib_store=&#39;GLUSTERFS&#39;, msg=&#39;Checking<br>
    for glusterfs-api &gt;= 4&#39;,<br>
     &gt; +                       mandatory=False)<br>
     &gt; +<br>
     &gt;      conf.env.build_regedit = False<br>
     &gt;      if not Options.options.with_regedit == False:<br>
     &gt;          conf.PROCESS_SEPARATE_RULE(&#39;<u></u>system_ncurses&#39;)<br>
     &gt; @@ -1797,6 +1809,9 @@ main() {<br>
     &gt;      if conf.CONFIG_SET(&quot;HAVE_CEPH&quot;):<br>
     &gt;          default_shared_modules.extend(<u></u>TO_LIST(&#39;vfs_ceph&#39;))<br>
     &gt;<br>
     &gt; +    if conf.CONFIG_SET(&#39;HAVE_<u></u>GLUSTERFS&#39;):<br>
     &gt; +        default_shared_modules.extend(<u></u>TO_LIST(&#39;vfs_glusterfs&#39;))<br>
     &gt; +<br>
     &gt;      explicit_shared_modules =<br>
    TO_LIST(Options.options.<u></u>shared_modules, delimiter=&#39;,&#39;)<br>
     &gt;      explicit_static_modules =<br>
    TO_LIST(Options.options.<u></u>static_modules, delimiter=&#39;,&#39;)<br>
<br>
    This much looks good, assuming it is tested and works.   You might need<br>
    to make uselib_store=&#39;glusterfs&#39; (not sure).<br>
<br>
<br>
As mentioned above, I tried this but still get the dependency error. Not<br>
sure what I am missing..<br>
<br>
</div></div></blockquote>
<br>
I tried to look up documentation on the web, but I couldn&#39;t find anything specific. My understanding so far is:<br>
<br>
conf.check_cfg(...) does the &#39;detection&#39; and stores the result in variables. You can specify a variable name prefix with uselib_store=NAME parameter.<br>
<br>
You can then use the test results while building, with a construct like:<br>
<br>
bld.new_task_gen(..., uselib=NAME, ...)<br>
<br>
However, samba is using bld.SAMBA3_MODULE(...) for building, and that does not seem to be accepting uselib= parameter.<br>
<br>
What I am trying to achieve is:<br>
<br>
- detect for presence of glusterfs headers/libs in the buildsystem. This is detected with the presence of glusterfs-api.pc<br>
<br>
- use the --libs and --cflags from pkg-config on glusterfs-api.pc to build vfs_glusterfs.c<br>
<br>
I know how to do this in autotools. I am not familiar with waf, and it doesn&#39;t seem to be intuitive enough to be self understood. There seems to be quite a lot of macro hackery around it which makes the techniques you get from a google search &quot;not applicable&quot;.<br>

<br>
Any help from the waf experts will be most appreciated!</blockquote><div><br></div><div style>Looks like the issue was that there had to be atleast one call to conf.CHECK_HEADER in context of the package (unlike autotools where this doesn&#39;t seem to be necessary). After adding a line to CHECK_HEADERS (in v8 patch) everything else just worked.</div>
<div style><br></div><div style>Avati </div></div></div></div>