<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"><<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a>></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 <<a href="mailto:abartlet@samba.org" target="_blank">abartlet@samba.org</a><br></div><div class="im">
<mailto:<a href="mailto:abartlet@samba.org" target="_blank">abartlet@samba.org</a>>> wrote:<br>
<br>
On Tue, 2013-05-28 at 17:36 -0400, Anand Avati wrote:<br>
> Implement a Samba VFS plugin for glusterfs based on gluster's gfapi.<br>
> This is a "bottom" vfs plugin (not something to be stacked on top of<br>
> another module), and translates (most) calls into closest actions<br>
> on gfapi.<br>
<br>
Thank you for your patience here.<br>
<br>
> Signed-off-by: Anand Avati <<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a><br></div>
<mailto:<a href="mailto:avati@redhat.com" target="_blank">avati@redhat.com</a>>><div><div class="h5"><br>
> ---<br>
><br>
> Hi,<br>
><br>
> 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('vfs_<u></u>glusterfs',<br>
+ subsystem='vfs',<br>
+ source=VFS_GLUSTERFS_SRC,<br>
+ deps='samba-util',<br>
+ init_function='',<br>
+<br>
internal_module=bld.SAMBA3_IS_<u></u>STATIC_MODULE('vfs_glusterfs')<u></u>,<br>
+<br>
enabled=bld.SAMBA3_IS_ENABLED_<u></u>MODULE('vfs_glusterfs'))<br>
<br>
You should ensure your module depends on glusterfs, by changing that to<br>
adding deps='glusterfs samba-util' (and making that match what the<br>
conf.check_cfg finds and stores).<br>
<br>
<br>
I tried that. I added uselib_store='glusterfs' and included 'glusterfs'<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'<br>
Selected embedded Heimdal build<br>
Checking project rules ...<br>
Unknown dependency 'glusterfs' in 'vfs_glusterfs'<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't understand how the check_cfg() in wscript and<br>
source3/wscript_build's bld.SAMBA3_MODULE() actually integrate internally.<br>
<br>
> diff --git a/source3/wscript b/source3/wscript<br>
> index dba6cdc..0d07692 100644<br>
> --- a/source3/wscript<br>
> +++ b/source3/wscript<br>
> @@ -59,6 +59,11 @@ def set_options(opt):<br>
> help=("Directory under which libcephfs is<br>
installed"),<br>
> action="store", dest='libcephfs_dir',<br>
default=None)<br>
><br>
> + opt.add_option('--enable-<u></u>glusterfs',<br>
> + help=("Enable building vfs_glusterfs module"),<br>
> + action="store_true", dest='enable_glusterfs',<br>
default=True)<br>
> + opt.add_option('--disable-<u></u>glusterfs', help=SUPPRESS_HELP,<br>
> + action="store_false", dest='enable_glusterfs')<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>
> def configure(conf):<br>
> @@ -1709,6 +1714,13 @@ main() {<br>
> if conf.CHECK_HEADERS('cephfs/<u></u>libcephfs.h', False, False,<br>
'cephfs') and conf.CHECK_LIB('cephfs'):<br>
> conf.DEFINE('HAVE_CEPH', '1')<br>
><br>
> + conf.env.enable_glusterfs = Options.options.enable_<u></u>glusterfs<br>
> +<br>
> + if Options.options.enable_<u></u>glusterfs:<br>
> + conf.check_cfg(package='<u></u>glusterfs-api',<br>
args='"glusterfs-api >= 4" --cflags --libs',<br>
> + uselib_store='GLUSTERFS', msg='Checking<br>
for glusterfs-api >= 4',<br>
> + mandatory=False)<br>
> +<br>
> conf.env.build_regedit = False<br>
> if not Options.options.with_regedit == False:<br>
> conf.PROCESS_SEPARATE_RULE('<u></u>system_ncurses')<br>
> @@ -1797,6 +1809,9 @@ main() {<br>
> if conf.CONFIG_SET("HAVE_CEPH"):<br>
> default_shared_modules.extend(<u></u>TO_LIST('vfs_ceph'))<br>
><br>
> + if conf.CONFIG_SET('HAVE_<u></u>GLUSTERFS'):<br>
> + default_shared_modules.extend(<u></u>TO_LIST('vfs_glusterfs'))<br>
> +<br>
> explicit_shared_modules =<br>
TO_LIST(Options.options.<u></u>shared_modules, delimiter=',')<br>
> explicit_static_modules =<br>
TO_LIST(Options.options.<u></u>static_modules, delimiter=',')<br>
<br>
This much looks good, assuming it is tested and works. You might need<br>
to make uselib_store='glusterfs' (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't find anything specific. My understanding so far is:<br>
<br>
conf.check_cfg(...) does the 'detection' 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'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 "not applicable".<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'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>