From: Eric Biggers Date: Mon, 29 Oct 2012 03:23:06 +0000 (-0500) Subject: Various packaging issues X-Git-Tag: v1.0.4~6 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=a2c56fd332b6c37026b24c8a216e0ff0bf140d80 Various packaging issues - Use utime() instead of lutimes() if lutimes() is not available or is not implemented - Add a spec file for building without libntfs-3g, and a spec file for building with neither fuse nor libntfs-3g - Print some possibly helpful text if mounting a WIM for the first time fails in the test script --- diff --git a/archlinux/PKGBUILD.in b/archlinux/PKGBUILD similarity index 98% rename from archlinux/PKGBUILD.in rename to archlinux/PKGBUILD index d137fbf1..e692e659 100644 --- a/archlinux/PKGBUILD.in +++ b/archlinux/PKGBUILD @@ -3,7 +3,7 @@ # Add md5sum and delete this line to complete the PKGBUILD pkgname=wimlib -pkgver=@VERSION@ +pkgver=1.0.4 pkgrel=1 pkgdesc="A library to extract, create, and modify WIM files" arch=("i686" "x86_64") diff --git a/config.h.in b/config.h.in index be7c1d68..c67c3226 100644 --- a/config.h.in +++ b/config.h.in @@ -54,6 +54,9 @@ /* Define to 1 if you have the `ntfs-3g' library (-lntfs-3g). */ #undef HAVE_LIBNTFS_3G +/* Define to 1 if you have the `lutimes' function. */ +#undef HAVE_LUTIMES + /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H @@ -93,9 +96,15 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if you have the `utime' function. */ +#undef HAVE_UTIME + /* Define to 1 if you have the `utimensat' function. */ #undef HAVE_UTIMENSAT +/* Define to 1 if you have the header file. */ +#undef HAVE_UTIME_H + /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST diff --git a/configure.ac b/configure.ac index 9a07a7c3..40920570 100644 --- a/configure.ac +++ b/configure.ac @@ -24,16 +24,14 @@ AC_CONFIG_FILES([Makefile doc/imagex-split.1 doc/imagex-unmount.1 doc/mkwinpeimg.1 - rpm/wimlib.spec - archlinux/PKGBUILD ]) AC_PROG_CC AM_PROG_CC_C_O -AC_CHECK_FUNCS([utimensat]) +AC_CHECK_FUNCS([utimensat lutimes utime]) AC_CHECK_HEADERS([endian.h byteswap.h sys/byteorder.h sys/endian.h \ sys/param.h machine/endian.h alloca.h stdlib.h stdarg.h \ - errno.h attr/xattr.h]) + errno.h attr/xattr.h utime.h]) AM_ICONV diff --git a/rpm/wimlib-minimal.spec b/rpm/wimlib-minimal.spec new file mode 100644 index 00000000..54dc8c7a --- /dev/null +++ b/rpm/wimlib-minimal.spec @@ -0,0 +1,71 @@ +Summary: Library to extract, create, and modify WIM files +Name: wimlib +Version: 1.0.4 +Release: 1 +License: GPLv3+ +Group: System/Libraries +URL: http://wimlib.sourceforge.net +Packager: Eric Biggers +Source: http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +Requires: libxml2, openssl +BuildRequires: libxml2-devel, openssl-devel +%description +wimlib is a library that can be used to create, extract, and modify files in the +Windows Imaging Format. These files are normally created by the 'imagex.exe' +program on Windows, but this library provides a free implementation of 'imagex' +for UNIX-based systems. wimlib supports mounting WIM files, just like +imagex.exe. + +%package devel +Summary: Development files for wimlib +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +%description devel +Development files for wimlib + +%prep +%setup -q -n %{name}-%{version} + +%build +%configure --prefix=/usr \ + --disable-rpath \ + --with-libcrypto \ + --without-ntfs-3g \ + --without-fuse \ + --disable-xattr \ + --disable-verify-compression \ + --disable-custom-memory-allocator \ + --disable-assertions +%__make %{?_smp_mflags} + +%check +make check + +%install +%__rm -rf %{buildroot} +%__make DESTDIR=%{buildroot} install + +%clean +%__rm -rf %{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%doc AUTHORS COPYING README TODO +%{_bindir}/imagex +%{_bindir}/mkwinpeimg +%{_libdir}/libwim.so +%{_libdir}/libwim.so.0 +%{_libdir}/libwim.so.0.0.0 +%doc %{_mandir}/man1/*.1.gz + +%files devel +%defattr(-, root, root) +%{_libdir}/libwim.a +%{_libdir}/libwim.la +%{_includedir}/wimlib.h +%{_libdir}/pkgconfig/wimlib.pc diff --git a/rpm/wimlib-without-ntfs-3g.spec b/rpm/wimlib-without-ntfs-3g.spec new file mode 100644 index 00000000..f9c5637d --- /dev/null +++ b/rpm/wimlib-without-ntfs-3g.spec @@ -0,0 +1,68 @@ +Summary: Library to extract, create, and modify WIM files +Name: wimlib +Version: 1.0.4 +Release: 1 +License: GPLv3+ +Group: System/Libraries +URL: http://wimlib.sourceforge.net +Packager: Eric Biggers +Source: http://downloads.sourceforge.net/wimlib/wimlib-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + +Requires: libxml2, fuse-libs, fuse, openssl +BuildRequires: libxml2-devel, fuse-devel, openssl-devel, libattr-devel, fuse +%description +wimlib is a library that can be used to create, extract, and modify files in the +Windows Imaging Format. These files are normally created by the 'imagex.exe' +program on Windows, but this library provides a free implementation of 'imagex' +for UNIX-based systems. wimlib supports mounting WIM files, just like +imagex.exe. + +%package devel +Summary: Development files for wimlib +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} +%description devel +Development files for wimlib + +%prep +%setup -q -n %{name}-%{version} + +%build +%configure --prefix=/usr \ + --disable-rpath \ + --with-libcrypto \ + --without-ntfs-3g \ + --enable-xattr \ + --disable-verify-compression +%__make %{?_smp_mflags} + +%check +make check + +%install +%__rm -rf %{buildroot} +%__make DESTDIR=%{buildroot} install + +%clean +%__rm -rf %{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(-, root, root) +%doc AUTHORS COPYING README TODO +%{_bindir}/imagex +%{_bindir}/mkwinpeimg +%{_libdir}/libwim.so +%{_libdir}/libwim.so.0 +%{_libdir}/libwim.so.0.0.0 +%doc %{_mandir}/man1/*.1.gz + +%files devel +%defattr(-, root, root) +%{_libdir}/libwim.a +%{_libdir}/libwim.la +%{_includedir}/wimlib.h +%{_libdir}/pkgconfig/wimlib.pc diff --git a/rpm/wimlib.spec.in b/rpm/wimlib.spec similarity index 89% rename from rpm/wimlib.spec.in rename to rpm/wimlib.spec index a194e927..090c7ebb 100644 --- a/rpm/wimlib.spec.in +++ b/rpm/wimlib.spec @@ -1,6 +1,6 @@ Summary: Library to extract, create, and modify WIM files Name: wimlib -Version: @VERSION@ +Version: 1.0.4 Release: 1 License: GPLv3+ Group: System/Libraries @@ -11,7 +11,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root Requires: libxml2, fuse-libs, fuse, openssl Requires: ntfs-3g >= 2:2011.4.12 -BuildRequires: libxml2-devel, fuse-devel, openssl-devel, libattr-devel +BuildRequires: libxml2-devel, fuse, fuse-devel, openssl-devel, libattr-devel BuildRequires: ntfs-3g-devel >= 2:2011.4.12, ntfsprogs %description wimlib is a library that can be used to create, extract, and modify files in the @@ -28,7 +28,7 @@ Requires: %{name} = %{version}-%{release} Development files for wimlib %prep -%setup -q -n %{name}-${version} +%setup -q -n %{name}-%{version} %build %configure --prefix=/usr \ @@ -43,11 +43,11 @@ Development files for wimlib make check %install -%__rm -rf ${buildroot} -%__make DESTDIR=${buildroot} install +%__rm -rf %{buildroot} +%__make DESTDIR=%{buildroot} install %clean -%__rm -rf ${buildroot} +%__rm -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig diff --git a/src/extract.c b/src/extract.c index 05498492..7fe23ef7 100644 --- a/src/extract.c +++ b/src/extract.c @@ -30,15 +30,21 @@ */ +#include "config.h" + #include #include #include #include #include #include + +#ifdef HAVE_UTIME_H +#include +#endif + #include -#include "config.h" #include "dentry.h" #include "lookup_table.h" #include "timestamp.h" @@ -319,15 +325,32 @@ static int apply_dentry_timestamps(struct dentry *dentry, void *arg) struct extract_args *args = arg; size_t len = strlen(args->output_dir); char output_path[len + dentry->full_path_utf8_len + 1]; + const struct inode *inode = dentry->d_inode; + int ret; memcpy(output_path, args->output_dir, len); memcpy(output_path + len, dentry->full_path_utf8, dentry->full_path_utf8_len); output_path[len + dentry->full_path_utf8_len] = '\0'; struct timeval tv[2]; - wim_timestamp_to_timeval(dentry->d_inode->last_access_time, &tv[0]); - wim_timestamp_to_timeval(dentry->d_inode->last_write_time, &tv[1]); - if (lutimes(output_path, tv) != 0) { + wim_timestamp_to_timeval(inode->last_access_time, &tv[0]); + wim_timestamp_to_timeval(inode->last_write_time, &tv[1]); + #ifdef HAVE_LUTIMES + ret = lutimes(output_path, tv); + #else + ret = -1; + errno = ENOSYS; + #endif + if (ret != 0) { + #ifdef HAVE_UTIME + if (errno == ENOSYS) { + struct utimbuf buf; + buf.actime = wim_timestamp_to_unix(inode->last_access_time); + buf.modtime = wim_timestamp_to_unix(inode->last_write_time); + if (utime(output_path, &buf) == 0) + return 0; + } + #endif if (errno != ENOSYS || args->num_lutimes_warnings < 10) { WARNING("Failed to set timestamp on file `%s': %s", output_path, strerror(errno)); diff --git a/src/mount.c b/src/mount.c index e07a11c3..f83d73c1 100644 --- a/src/mount.c +++ b/src/mount.c @@ -1692,6 +1692,8 @@ static int wimfs_utime(const char *path, struct utimbuf *times) { struct dentry *dentry; struct inode *inode; + WIMStruct *w = wimfs_get_WIMStruct(); + dentry = get_dentry(w, path); if (!dentry) return -ENOENT; diff --git a/src/symlink.c b/src/symlink.c index bed8fc3e..3e89a88e 100644 --- a/src/symlink.c +++ b/src/symlink.c @@ -248,9 +248,6 @@ int inode_set_symlink(struct inode *inode, const char *target, if (lte_ret) *lte_ret = lte; return 0; -out_free_lte: - if (lte != existing_lte) - FREE(lte); out_free_symlink_buf: FREE(symlink_buf); return ret; diff --git a/tests/test-imagex-mount b/tests/test-imagex-mount index ebf382ce..0e94af81 100755 --- a/tests/test-imagex-mount +++ b/tests/test-imagex-mount @@ -6,6 +6,12 @@ set -e srcdir=`pwd` cd tests +if [ ! -r /dev/fuse ]; then + echo "WARNING: /dev/fuse is not readable." + echo "Skipping WIM mounting checks" + exit 0 +fi + imagex() { echo "imagex $@" ../imagex $@ > /dev/null @@ -49,10 +55,13 @@ init() { } error() { - echo "**********************************************" - echo " Test failure " - echo $* - echo "**********************************************" + echo "****************************************************************" + echo " Test failure " + while [ $# -gt 0 ]; do + echo $1 + shift + done + echo "****************************************************************" exit 1 } @@ -69,7 +78,10 @@ for flag in "--compress=none" "--compress=maximum" "--compress=fast"; do fi mkdir tmp if ! imagex mount dir.wim dir tmp; then - error "Failde to mount test WIM read-only" + error "Failed to mount test WIM read-only" \ + "Please read any error messages above before reporting this test failure."\ + "Perhaps you don't have FUSE installed, or the FUSE kernel module isn't" \ + "loaded, or you aren't a member of the FUSE group?" fi echo "Testing extracting file from mounted read-only WIM" if ! cp tmp/lz.c lz.c; then