direct-io.hg

changeset 7261:18f765da2725

Re-enable the pygrub build and fix the build with older
e2fsprogs (tested on RHEL4 with e2fsprogs-1.35 and rawhide
with e2fsprogs-1.38)

Signed-off-by: Jeremy Katz <katzj@redhat.com>
author kaf24@firebug.cl.cam.ac.uk
date Fri Oct 07 23:21:23 2005 +0100 (2005-10-07)
parents 1b4ad6eb6968
children bf07490fab19
files tools/Makefile tools/pygrub/Makefile tools/pygrub/setup.py tools/pygrub/src/fsys/ext2/ext2module.c
line diff
     1.1 --- a/tools/Makefile	Fri Oct 07 23:17:24 2005 +0100
     1.2 +++ b/tools/Makefile	Fri Oct 07 23:21:23 2005 +0100
     1.3 @@ -22,7 +22,7 @@ SUBDIRS += xenstat
     1.4  # These don't cross-compile
     1.5  ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
     1.6  SUBDIRS += python
     1.7 -#SUBDIRS += pygrub
     1.8 +SUBDIRS += pygrub
     1.9  endif
    1.10  
    1.11  .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
     2.1 --- a/tools/pygrub/Makefile	Fri Oct 07 23:17:24 2005 +0100
     2.2 +++ b/tools/pygrub/Makefile	Fri Oct 07 23:21:23 2005 +0100
     2.3 @@ -15,4 +15,4 @@ install: all
     2.4  endif
     2.5  
     2.6  clean:
     2.7 -	rm -rf build *.pyc *.pyo *.o *.a *~
     2.8 +	rm -rf build tmp *.pyc *.pyo *.o *.a *~
     3.1 --- a/tools/pygrub/setup.py	Fri Oct 07 23:17:24 2005 +0100
     3.2 +++ b/tools/pygrub/setup.py	Fri Oct 07 23:21:23 2005 +0100
     3.3 @@ -1,5 +1,7 @@
     3.4  from distutils.core import setup, Extension
     3.5 +from distutils.ccompiler import new_compiler
     3.6  import os
     3.7 +import sys
     3.8  
     3.9  extra_compile_args  = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
    3.10  
    3.11 @@ -7,9 +9,19 @@ fsys_mods = []
    3.12  fsys_pkgs = []
    3.13  
    3.14  if os.path.exists("/usr/include/ext2fs/ext2_fs.h"):
    3.15 +    ext2defines = []
    3.16 +    cc = new_compiler()
    3.17 +    cc.add_library("ext2fs")
    3.18 +    if cc.has_function("ext2fs_open2"):
    3.19 +        ext2defines.append( ("HAVE_EXT2FS_OPEN2", None) )
    3.20 +    else:
    3.21 +        sys.stderr.write("WARNING: older version of e2fsprogs installed, not building full\n")
    3.22 +        sys.stderr.write("         disk support for ext2.\n")
    3.23 +        
    3.24      ext2 = Extension("grub.fsys.ext2._pyext2",
    3.25                       extra_compile_args = extra_compile_args,
    3.26                       libraries = ["ext2fs"],
    3.27 +                     define_macros = ext2defines,
    3.28                       sources = ["src/fsys/ext2/ext2module.c"])
    3.29      fsys_mods.append(ext2)
    3.30      fsys_pkgs.append("grub.fsys.ext2")
     4.1 --- a/tools/pygrub/src/fsys/ext2/ext2module.c	Fri Oct 07 23:17:24 2005 +0100
     4.2 +++ b/tools/pygrub/src/fsys/ext2/ext2module.c	Fri Oct 07 23:21:23 2005 +0100
     4.3 @@ -229,8 +229,13 @@ ext2_fs_open (Ext2Fs *fs, PyObject *args
     4.4          snprintf(offsetopt, 29, "offset=%d", offset);
     4.5      }
     4.6  
     4.7 +#ifdef HAVE_EXT2FS_OPEN2
     4.8      err = ext2fs_open2(name, offsetopt, flags, superblock, block_size, 
     4.9                         unix_io_manager, &efs);
    4.10 +#else
    4.11 +    err = ext2fs_open(name, flags, superblock, block_size,
    4.12 +                      unix_io_manager, &efs);
    4.13 +#endif
    4.14      if (err) {
    4.15          PyErr_SetString(PyExc_ValueError, "unable to open file");
    4.16          return NULL;