]> wimlib.net Git - wimlib/commitdiff
Various packaging issues
authorEric Biggers <ebiggers3@gmail.com>
Mon, 29 Oct 2012 03:23:06 +0000 (22:23 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Mon, 29 Oct 2012 03:23:06 +0000 (22:23 -0500)
- 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

archlinux/PKGBUILD [moved from archlinux/PKGBUILD.in with 98% similarity]
config.h.in
configure.ac
rpm/wimlib-minimal.spec [new file with mode: 0644]
rpm/wimlib-without-ntfs-3g.spec [new file with mode: 0644]
rpm/wimlib.spec [moved from rpm/wimlib.spec.in with 89% similarity]
src/extract.c
src/mount.c
src/symlink.c
tests/test-imagex-mount

similarity index 98%
rename from archlinux/PKGBUILD.in
rename to archlinux/PKGBUILD
index d137fbf16982d5f9c74992e75f179c8652133cca..e692e6596233f2bdaa1a316345442110c2b988be 100644 (file)
@@ -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")
index be7c1d6822ee60a4361cc354a80bdd361f68057f..c67c3226180f12511a481da8b2e17f65897c2e62 100644 (file)
@@ -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 <machine/endian.h> header file. */
 #undef HAVE_MACHINE_ENDIAN_H
 
 /* Define to 1 if you have the <unistd.h> 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 <utime.h> header file. */
+#undef HAVE_UTIME_H
+
 /* Define as const if the declaration of iconv() needs const. */
 #undef ICONV_CONST
 
index 9a07a7c32e2beaea0f7949c9a04e674ce252d510..409205704587de275e3bd84ccfeddab157d440de 100644 (file)
@@ -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 (file)
index 0000000..54dc8c7
--- /dev/null
@@ -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 <ebiggers3@gmail.com>
+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 (file)
index 0000000..f9c5637
--- /dev/null
@@ -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 <ebiggers3@gmail.com>
+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
similarity index 89%
rename from rpm/wimlib.spec.in
rename to rpm/wimlib.spec
index a194e92746a781e7ed506b36283e50ab249981b9..090c7ebbc0186320eb265ade9abd29a12e90e667 100644 (file)
@@ -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
index 054984920de7188ea688dd3d075aadafaff3d62a..7fe23ef76d5380b15164f668549544f2b34c4d5e 100644 (file)
  */
 
 
+#include "config.h"
+
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
 #include <string.h>
 #include <sys/stat.h>
 #include <sys/time.h>
+
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
 #include <unistd.h>
 
-#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));
index e07a11c3fbcfdfbd761d846c255302da75a811dd..f83d73c13227f4f2829f8b8ea810abaa65571212 100644 (file)
@@ -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;
index bed8fc3e06c7774934e54c1c05a42faebd6ed74e..3e89a88eead6cfed31980c86f9f4fd51a2e5ca4e 100644 (file)
@@ -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;
index ebf382ce24e87b835b9b3bf12e9e596682470ee7..0e94af8124a49a531b34918f8b054a3748ae6962 100755 (executable)
@@ -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