aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-07 23:21:23 +0100
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>2005-10-07 23:21:23 +0100
commit635fd50b51f2860400e934fbfa65e71481b8e3d6 (patch)
treec555f3fd5d4273f345e087a14baaa37b00c0f48e /tools
parent3bd6068aaeae76a6538b6875362547919b64efb8 (diff)
downloadxen-635fd50b51f2860400e934fbfa65e71481b8e3d6.tar.gz
xen-635fd50b51f2860400e934fbfa65e71481b8e3d6.tar.bz2
xen-635fd50b51f2860400e934fbfa65e71481b8e3d6.zip
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile2
-rw-r--r--tools/pygrub/Makefile2
-rw-r--r--tools/pygrub/setup.py12
-rw-r--r--tools/pygrub/src/fsys/ext2/ext2module.c5
4 files changed, 19 insertions, 2 deletions
diff --git a/tools/Makefile b/tools/Makefile
index adf56e3b5a..962f7f8ae2 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,7 +22,7 @@ SUBDIRS += xenstat
# These don't cross-compile
ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
SUBDIRS += python
-#SUBDIRS += pygrub
+SUBDIRS += pygrub
endif
.PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index a676cdf0e9..fbe27a9bf1 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -15,4 +15,4 @@ install: all
endif
clean:
- rm -rf build *.pyc *.pyo *.o *.a *~
+ rm -rf build tmp *.pyc *.pyo *.o *.a *~
diff --git a/tools/pygrub/setup.py b/tools/pygrub/setup.py
index 6b32346b06..680535d6cb 100644
--- a/tools/pygrub/setup.py
+++ b/tools/pygrub/setup.py
@@ -1,5 +1,7 @@
from distutils.core import setup, Extension
+from distutils.ccompiler import new_compiler
import os
+import sys
extra_compile_args = [ "-fno-strict-aliasing", "-Wall", "-Werror" ]
@@ -7,9 +9,19 @@ fsys_mods = []
fsys_pkgs = []
if os.path.exists("/usr/include/ext2fs/ext2_fs.h"):
+ ext2defines = []
+ cc = new_compiler()
+ cc.add_library("ext2fs")
+ if cc.has_function("ext2fs_open2"):
+ ext2defines.append( ("HAVE_EXT2FS_OPEN2", None) )
+ else:
+ sys.stderr.write("WARNING: older version of e2fsprogs installed, not building full\n")
+ sys.stderr.write(" disk support for ext2.\n")
+
ext2 = Extension("grub.fsys.ext2._pyext2",
extra_compile_args = extra_compile_args,
libraries = ["ext2fs"],
+ define_macros = ext2defines,
sources = ["src/fsys/ext2/ext2module.c"])
fsys_mods.append(ext2)
fsys_pkgs.append("grub.fsys.ext2")
diff --git a/tools/pygrub/src/fsys/ext2/ext2module.c b/tools/pygrub/src/fsys/ext2/ext2module.c
index f5f95a7aa7..decf1ad652 100644
--- a/tools/pygrub/src/fsys/ext2/ext2module.c
+++ b/tools/pygrub/src/fsys/ext2/ext2module.c
@@ -229,8 +229,13 @@ ext2_fs_open (Ext2Fs *fs, PyObject *args, PyObject *kwargs)
snprintf(offsetopt, 29, "offset=%d", offset);
}
+#ifdef HAVE_EXT2FS_OPEN2
err = ext2fs_open2(name, offsetopt, flags, superblock, block_size,
unix_io_manager, &efs);
+#else
+ err = ext2fs_open(name, flags, superblock, block_size,
+ unix_io_manager, &efs);
+#endif
if (err) {
PyErr_SetString(PyExc_ValueError, "unable to open file");
return NULL;