meta-tizen: e2fsprogs: add git recipe, copy xattrs into filesystem
authorRoss Burton <ross.burton@intel.com>
Mon, 30 Jun 2014 12:17:01 +0000 (13:17 +0100)
committerPatrick Ohly <patrick.ohly@intel.com>
Fri, 9 Jan 2015 17:21:20 +0000 (09:21 -0800)
Fork the recipe in oe-core and fetch source from git master, removing all merged
patches, and add a submitted patch to copy extended attributes from the source
directories into the target filesystem.

Change-Id: I8185be8640a818dff6b74c8e4f2ad19724d97c5e
(From meta-tizen rev: e946e436fd209bf1fdd04f459e004fb671ac9d76)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/cross-compile.patch [new file with mode: 0644]
meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/populate-fs-xattr.patch [new file with mode: 0644]
meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/remove-ldconfig-call.patch [new file with mode: 0644]
meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs_git.bb [new file with mode: 0644]

diff --git a/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/cross-compile.patch b/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/cross-compile.patch
new file mode 100644 (file)
index 0000000..9f9b958
--- /dev/null
@@ -0,0 +1,13 @@
+diff --git a/configure.in b/configure.in
+index 448a292..31ca001 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1382,7 +1382,7 @@ if test $cross_compiling = no; then
+    BUILD_CFLAGS="$CFLAGS $CPPFLAGS $INCLUDES -DHAVE_CONFIG_H"
+    BUILD_LDFLAGS="$LDFLAGS"
+ else
+-   BUILD_CFLAGS=
++   BUILD_CFLAGS='-I. -I$(top_builddir)/lib -I$(top_srcdir)/lib -DHAVE_CONFIG_H'
+    BUILD_LDFLAGS=
+ fi
+ AC_SUBST(BUILD_CFLAGS)
diff --git a/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/populate-fs-xattr.patch b/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/populate-fs-xattr.patch
new file mode 100644 (file)
index 0000000..b6457f1
--- /dev/null
@@ -0,0 +1,88 @@
+Upstream-Status: Submitted
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+commit 582b4ceda06456f8e33492dd0f87a3d2a5ff1514
+Author: Ross Burton <ross.burton@intel.com>
+Date:   Fri Jun 27 19:44:35 2014 +0100
+
+    misc: copy extended attributes in populate_fs
+    
+    When creating a file system using a source directory, also copy any extended
+    attributes that have been set.
+    
+    Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/misc/create_inode.c b/misc/create_inode.c
+index c9c99b5..2795f9e 100644
+--- a/misc/create_inode.c
++++ b/misc/create_inode.c
+@@ -103,6 +103,55 @@ static errcode_t set_inode_extra(ext2_filsys fs, ext2_ino_t cwd,
+       return retval;
+ }
++static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino, const char *filename)
++{
++      errcode_t                       retval;
++      struct ext2_inode               inode;
++      struct ext2_xattr_handle        *handle;
++      ssize_t                         size, value_size;
++      char                            *list;
++      int                             i;
++
++      size = llistxattr(filename, NULL, 0);
++      if (size == -1) {
++              com_err(__func__, errno, "listxattr failed on %s", filename);
++              return errno;
++      } else if (size == 0) {
++              return 0;
++      }
++
++      retval = ext2fs_xattrs_open(fs, ino, &handle);
++      if (retval) {
++              com_err(__func__, errno, "while opening inode %u", ino);
++              return errno;
++      }
++
++      list = malloc(size);
++      size = llistxattr(filename, list, size);
++
++      for (i = 0; i < size; i += strlen(&list[i]) + 1) {
++              const char *name = &list[i];
++              char *value;
++
++              value_size = getxattr(filename, name, NULL, 0);
++              value = malloc(value_size);
++              value_size = getxattr(filename, name, value, value_size);
++
++              retval = ext2fs_xattr_set(handle, name, value, value_size);
++              if (retval)
++                      com_err(__func__, retval, "while writing xattr %u", ino);
++
++              free (value);
++      }
++      free(list);
++
++      retval = ext2fs_xattrs_close(&handle);
++      if (retval)
++              com_err(__func__, errno, "while closing inode %u", ino);
++
++      return retval;
++}
++
+ /* Make a special files (block and character devices), fifo's, and sockets  */
+ errcode_t do_mknod_internal(ext2_filsys fs, ext2_ino_t cwd, const char *name,
+                           struct stat *st)
+@@ -615,6 +664,13 @@ static errcode_t __populate_fs(ext2_filsys fs, ext2_ino_t parent_ino,
+                       goto out;
+               }
++              retval = set_inode_xattr(fs, ino, name);
++              if (retval) {
++                      com_err(__func__, retval,
++                              _("while setting xattrs for \"%s\""), name);
++                      goto out;
++              }
++
+               /* Save the hardlink ino */
+               if (save_inode) {
+                       /*
diff --git a/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/remove-ldconfig-call.patch b/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs/remove-ldconfig-call.patch
new file mode 100644 (file)
index 0000000..66e4e37
--- /dev/null
@@ -0,0 +1,35 @@
+When /etc/ld.so.cache is writeable by user running bitbake then it creates
+invalid cache (in my case libstdc++.so cannot be found after building
+zlib(-native) and I have to call touch */libstdc++.so && /sbin/ldconfig to fix
+it.
+
+So remove ldconfig call from make install-libs
+
+Patch authored by Martin Jansa.
+
+Upstream-Status: Inappropriate [disable feature]
+
+Signed-off-by: Scott Garman <scott.a.garman@intel.com>
+Signed-off-by: Andrei Dinu <andrei.adrianx.dinu@intel.com>
+
+diff --git a/lib/Makefile.elf-lib b/lib/Makefile.elf-lib
+index 78479d3..4a4a5ac 100644
+--- a/lib/Makefile.elf-lib
++++ b/lib/Makefile.elf-lib
+@@ -50,8 +50,6 @@ install-shlibs install:: $(ELF_LIB) installdirs-elf-lib $(DEP_INSTALL_SYMLINK)
+       $(E) "  SYMLINK $(libdir)/$(ELF_IMAGE).so"
+       $(Q) $(INSTALL_SYMLINK) $(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+               $(libdir)/$(ELF_IMAGE).so $(DESTDIR)
+-      $(E) "  LDCONFIG"
+-      $(Q) -$(LDCONFIG)
+ install-strip: install
+       $(E) "  STRIP-LIB $(ELF_INSTALL_DIR)/$(ELF_LIB)"
+@@ -67,7 +65,6 @@ uninstall-shlibs uninstall::
+       $(RM) -f $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_LIB) \
+               $(DESTDIR)$(ELF_INSTALL_DIR)/$(ELF_SONAME) \
+               $(DESTDIR)$(libdir)/$(ELF_IMAGE).so
+-      -$(LDCONFIG)
+ clean::
+       $(RM) -rf elfshared
diff --git a/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs_git.bb b/meta-tizen/recipes-devtools/e2fsprogs/e2fsprogs_git.bb
new file mode 100644 (file)
index 0000000..0e5a7fc
--- /dev/null
@@ -0,0 +1,74 @@
+COREDIR = "${COREBASE}/meta/recipes-devtools/e2fsprogs"
+
+FILESEXTRAPATHS_append := ":${COREDIR}/e2fsprogs"
+
+require ${COREDIR}/e2fsprogs.inc
+
+SRC_URI = "git://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git \
+           file://acinclude.m4 \
+           file://mkdir.patch \
+           file://remove-ldconfig-call.patch \
+           file://quiet-debugfs.patch \
+           file://populate-fs-xattr.patch \
+           file://cross-compile.patch \
+"
+
+SRCREV = "bb9cca2ca91b46e820f77dda38e01fb2860dc5d2"
+PV = "1.42.9+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-elf-shlibs --disable-libuuid --disable-uuidd --enable-verbose-makecmds"
+EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
+
+do_configure_prepend () {
+       cp ${WORKDIR}/acinclude.m4 ${S}/
+}
+
+do_install () {
+       oe_runmake 'DESTDIR=${D}' install
+       oe_runmake 'DESTDIR=${D}' install-libs
+       # We use blkid from util-linux now so remove from here
+       rm -f ${D}${base_libdir}/libblkid*
+       rm -rf ${D}${includedir}/blkid
+       rm -f ${D}${base_libdir}/pkgconfig/blkid.pc
+       rm -f ${D}${base_sbindir}/blkid
+       rm -f ${D}${base_sbindir}/fsck
+       rm -f ${D}${base_sbindir}/findfs
+
+       # e2initrd_helper and the pkgconfig files belong in libdir
+       if [ ! ${D}${libdir} -ef ${D}${base_libdir} ]; then
+               install -d ${D}${libdir}
+               mv ${D}${base_libdir}/e2initrd_helper ${D}${libdir}
+               mv ${D}${base_libdir}/pkgconfig ${D}${libdir}
+       fi
+
+       oe_multilib_header ext2fs/ext2_types.h
+       install -d ${D}${base_bindir}
+       mv ${D}${bindir}/chattr ${D}${base_bindir}/chattr.e2fsprogs
+}
+
+RDEPENDS_e2fsprogs = "e2fsprogs-badblocks"
+RRECOMMENDS_e2fsprogs = "e2fsprogs-mke2fs e2fsprogs-e2fsck"
+
+PACKAGES =+ "e2fsprogs-e2fsck e2fsprogs-mke2fs e2fsprogs-tune2fs e2fsprogs-badblocks"
+PACKAGES =+ "libcomerr libss libe2p libext2fs"
+
+FILES_e2fsprogs-e2fsck = "${base_sbindir}/e2fsck ${base_sbindir}/fsck.ext*"
+FILES_e2fsprogs-mke2fs = "${base_sbindir}/mke2fs ${base_sbindir}/mkfs.ext* ${sysconfdir}/mke2fs.conf"
+FILES_e2fsprogs-tune2fs = "${base_sbindir}/tune2fs ${base_sbindir}/e2label"
+FILES_e2fsprogs-badblocks = "${base_sbindir}/badblocks"
+FILES_libcomerr = "${base_libdir}/libcom_err.so.*"
+FILES_libss = "${base_libdir}/libss.so.*"
+FILES_libe2p = "${base_libdir}/libe2p.so.*"
+FILES_libext2fs = "${libdir}/e2initrd_helper ${base_libdir}/libext2fs.so.*"
+FILES_${PN}-dev += "${datadir}/*/*.awk ${datadir}/*/*.sed ${base_libdir}/*.so"
+
+BBCLASSEXTEND = "native"
+
+inherit update-alternatives
+
+ALTERNATIVE_${PN} = "chattr"
+ALTERNATIVE_PRIORITY = "100"
+ALTERNATIVE_LINK_NAME[chattr] = "${base_bindir}/chattr"
+ALTERNATIVE_TARGET[chattr] = "${base_bindir}/chattr.e2fsprogs"