]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Disable automatic detection of liblzo2
authorMartin Matuska <martin@matuska.org>
Mon, 30 Jan 2017 00:39:03 +0000 (01:39 +0100)
committerMartin Matuska <martin@matuska.org>
Mon, 30 Jan 2017 02:09:43 +0000 (03:09 +0100)
Replace liblzo with lzop in Travis CI builds
Fix lzop tests

Distribution of libarchive binaries linked against LZO violates
LZO GPL license. liblzo2 can still be linked with --with-lzo2

.travis.yml
CMakeLists.txt
configure.ac
libarchive/test/test_fuzz.c
libarchive/test/test_read_filter_lzop.c
libarchive/test/test_read_filter_lzop_multiple_parts.c
libarchive/test/test_write_filter_lzop.c

index 44cbe21986270d2108a394a5637cd6adb48bf898..d7fe8372e9aca56de14aebfee1692342aad9f683 100644 (file)
@@ -7,8 +7,8 @@ addons:
       - libacl1-dev
       - libbz2-dev
       - liblzma-dev
-      - liblzo2-dev
       - libzip-dev
+      - lzop
 os:
   - linux
   - osx
@@ -25,6 +25,6 @@ matrix:
 before_install:
   - if [ `uname` = "Darwin" ]; then brew update; fi
 install:
-  - if [ `uname` = "Darwin" ]; then brew install xz lzo lz4; fi
+  - if [ `uname` = "Darwin" ]; then brew install xz lzop lz4; fi
 script:
   - build/ci_build.sh
index cda1506f282dbdcb92bb8c38f30f652c3d1ee762..eb36b5b99e44e521b7515f336276b7bcfd6372bf 100644 (file)
@@ -179,13 +179,15 @@ include(CTest)
 
 OPTION(ENABLE_NETTLE "Enable use of Nettle" ON)
 OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
-OPTION(ENABLE_LZMA "Enable the use of the system found LZMA library if found" ON)
-OPTION(ENABLE_ZLIB "Enable the use of the system found ZLIB library if found" ON)
-OPTION(ENABLE_BZip2 "Enable the use of the system found BZip2 library if found" ON)
-OPTION(ENABLE_LIBXML2 "Enable the use of the system found libxml2 library if found" ON)
-OPTION(ENABLE_EXPAT "Enable the use of the system found EXPAT library if found" ON)
-OPTION(ENABLE_PCREPOSIX "Enable the use of the system found PCREPOSIX library if found" ON)
-OPTION(ENABLE_LibGCC "Enable the use of the system found LibGCC library if found" ON)
+OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF)
+OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON)
+
+OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON)
+OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON)
+OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON)
+OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON)
+OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON)
+OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON)
 # CNG is used for encrypt/decrypt Zip archives on Windows.
 OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON)
 
@@ -477,15 +479,19 @@ ENDIF(LIBLZMA_FOUND)
 #
 # Find LZO2
 #
-IF (LZO2_INCLUDE_DIR)
-  # Already in cache, be silent
-  SET(LZO2_FIND_QUIETLY TRUE)
-ENDIF (LZO2_INCLUDE_DIR)
-
-FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h)
-FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2)
-INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR)
+IF(ENABLE_LZO)
+  IF (LZO2_INCLUDE_DIR)
+    # Already in cache, be silent
+    SET(LZO2_FIND_QUIETLY TRUE)
+  ENDIF (LZO2_INCLUDE_DIR)
+
+  FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h)
+  FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2)
+  INCLUDE(FindPackageHandleStandardArgs)
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR)
+ELSE(ENABLE_LZO)
+  SET(LIBZMA_FOUND FALSE) # Override cached value
+ENDIF(ENABLE_LZO)
 IF(LZO2_FOUND)
   SET(HAVE_LIBLZO2 1)
   SET(HAVE_LZO_LZOCONF_H 1)
index 0afb59cef11fe0fc17d948644ba9ca85620bdc06..f3b8fda40d4d0740382fa2778d6d5552481c4b07 100644 (file)
@@ -379,9 +379,9 @@ if test "x$with_lzma" != "xno"; then
 fi
 
 AC_ARG_WITH([lzo2],
-  AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2]))
+  AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2]))
 
-if test "x$with_lzo2" != "xno"; then
+if test "x$with_lzo2" == "xyes"; then
   AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h])
   AC_CHECK_LIB(lzo2,lzo1x_decompress_safe)
 fi
index ff064c07d4983c3b666d4c54a1f7a3650139a9b2..71bf3ffb9b4b6f69441018e5fd96f1534ddc38aa 100644 (file)
@@ -406,10 +406,12 @@ DEFINE_TEST(test_fuzz_tar)
                "test_read_format_tar_empty_filename.tar",
                NULL
        };
+#if HAVE_LIBLZO2 && HAVE_LZO_LZO1X_H && HAVE_LZO_LZOCONF_H
        static const char *fileset9[] = {
                "test_compat_lzop_1.tar.lzo",
                NULL
        };
+#endif
        static const struct files filesets[] = {
                {0, fileset1}, /* Exercise bzip2 decompressor. */
                {1, fileset1},
@@ -420,7 +422,9 @@ DEFINE_TEST(test_fuzz_tar)
                {0, fileset6}, /* Exercise xz decompressor. */
                {0, fileset7},
                {0, fileset8},
+#if HAVE_LIBLZO2 && HAVE_LZO_LZO1X_H && HAVE_LZO_LZOCONF_H
                {0, fileset9}, /* Exercise lzo decompressor. */
+#endif
                {1, NULL}
        };
        test_fuzz(filesets);
index 86a5e6e84482e76e492b487a794ddeed82275850..acce6a4c205292bcae47eb75db3e8eb1eb491612 100644 (file)
@@ -39,13 +39,16 @@ DEFINE_TEST(test_read_filter_lzop)
        assert((a = archive_read_new()) != NULL);
        r = archive_read_support_filter_lzop(a);
        if (r != ARCHIVE_OK) {
-               if (r == ARCHIVE_WARN && !canLzop()) {
+               if (!canLzop()) {
                        assertEqualInt(ARCHIVE_OK, archive_read_free(a));
                        skipping("lzop compression is not supported "
                            "on this platform");
-               } else
+                       return;
+               } else if (r != ARCHIVE_WARN) {
                        assertEqualIntA(a, ARCHIVE_OK, r);
-               return;
+                       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+                       return;
+               }
        }
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
        assertEqualIntA(a, ARCHIVE_OK,
index 3b0febbd785c8b6eaf358550f08db9e962c02bb7..82eaf35394738f0463753ab1b0cd4687c978fb27 100644 (file)
@@ -36,12 +36,16 @@ DEFINE_TEST(test_read_filter_lzop_multiple_parts)
        assert((a = archive_read_new()) != NULL);
        r = archive_read_support_filter_lzop(a);
        if (r != ARCHIVE_OK) {
-               if (r == ARCHIVE_WARN && !canLzop()) {
-                       assertEqualInt(ARCHIVE_OK, archive_read_free(a));
+               if (!canLzop()) {
                        skipping("lzop compression is not supported "
                            "on this platform");
+               } else if (r == ARCHIVE_WARN) {
+                       skipping("lzop multiple parts decoding is not "
+                           "supported via external program");
+
                } else
                        assertEqualIntA(a, ARCHIVE_OK, r);
+               assertEqualInt(ARCHIVE_OK, archive_read_free(a));
                return;
        }
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
index a32932c697738574daeb0d87df4c2d1efceb3cf4..92db7bf3dc43bb7159828fea825a0475a49f7822 100644 (file)
@@ -43,12 +43,12 @@ DEFINE_TEST(test_write_filter_lzop)
 
        assert((a = archive_write_new()) != NULL);
        r = archive_write_add_filter_lzop(a);
+       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
        if (r != ARCHIVE_OK) {
                if (canLzop() && r == ARCHIVE_WARN)
                        use_prog = 1;
                else {
                        skipping("lzop writing not supported on this platform");
-                       assertEqualInt(ARCHIVE_OK, archive_write_free(a));
                        return;
                }
        }
@@ -92,7 +92,7 @@ DEFINE_TEST(test_write_filter_lzop)
        assert((a = archive_read_new()) != NULL);
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
        r = archive_read_support_filter_lzop(a);
-       if (r == ARCHIVE_WARN) {
+       if (r == ARCHIVE_WARN && !use_prog) {
                skipping("Can't verify lzop writing by reading back;"
                    " lzop reading not fully supported on this platform");
        } else {
@@ -212,7 +212,7 @@ DEFINE_TEST(test_write_filter_lzop)
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
        assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
        r = archive_read_support_filter_lzop(a);
-       if (r == ARCHIVE_WARN) {
+       if (r == ARCHIVE_WARN && !use_prog) {
                skipping("lzop reading not fully supported on this platform");
        } else {
                assertEqualIntA(a, ARCHIVE_OK,