@@ -78,13 +78,6 @@ AC_ARG_ENABLE(tar,
ENABLE_TAR=$enableval,
ENABLE_TAR=auto)
-AC_ARG_ENABLE(zip-archive,
- AS_HELP_STRING([--enable-zip-archive=yes|no|auto],
- [enable bundling of TUs in zip archives (default is no)]),
- ENABLE_ZIP_ARCHIVE=$enableval,
- ENABLE_ZIP_ARCHIVE=no)
-
-
AC_ARG_ENABLE(apidoc,
AS_HELP_STRING([--enable-apidoc=yes|no|auto],
[enable generation of the apidoc in html]),
@@ -542,49 +535,7 @@ AM_CONDITIONAL(ENABLE_RUNNING_TESTS_WITH_PY3, test x$RUN_TESTS_WITH_PY3 = xyes)
AM_CONDITIONAL(ENABLE_PYTHON3_INTERPRETER, test x$PYTHON3_INTERPRETER != xno)
AC_SUBST(PYTHON)
-dnl Check for dependency: libzip
-LIBZIP_VERSION=0.10.1
-
-HAS_LIBZIP=no
-# The below doesn't seem to work on my box for a reason. Let's write
-# the damn thing by hand:
-# PKG_CHECK_EXISTS([libzip >= $LIBZIP_VERSION], [HAS_LIBZIP=yes], [HAS_LIBZIP=no])
-
-if $PKG_CONFIG --exists --print-errors "libzip >= $LIBZIP_VERSION"; then
- AC_MSG_NOTICE(found libzip version $LIBZIP_VERSION)
- HAS_LIBZIP=yes
-else
- AC_MSG_NOTICE(no libzip >= $LIBZIP_VERSION has been found)
- HAS_LIBZIP=no
-fi
-
-if test x$ENABLE_ZIP_ARCHIVE = xauto; then
- if test x$HAS_LIBZIP = xyes; then
- ENABLE_ZIP_ARCHIVE=yes;
- else
- ENABLE_ZIP_ARCHIVE=no
- fi
-fi
-
-if test x$ENABLE_ZIP_ARCHIVE = xyes; then
- AC_MSG_NOTICE(the zip-archive feature is enabled)
-else
- AC_MSG_NOTICE(the zip-archive feature is disabled)
-fi
-
-FOUND_LIBZIP=no
-if test x$ENABLE_ZIP_ARCHIVE = xyes; then
- PKG_CHECK_MODULES(LIBZIP, libzip >= $LIBZIP_VERSION)
- FOUND_LIBZIP=yes
- AC_SUBST(LIBZIP_VERSION)
- AC_SUBST(LIBZIP_LIBS)
- AC_SUBST(LIBZIP_CFLAGS)
- AC_DEFINE([WITH_ZIP_ARCHIVE], 1, [compile the zip archive support])
- AC_DEFINE([HAVE_LIBZIP], 1, [Defined to 1 if the libzip library is available])
-fi
-
-AM_CONDITIONAL(ENABLE_ZIP_ARCHIVE, test x$ENABLE_ZIP_ARCHIVE = xyes)
-DEPS_CPPFLAGS="$XML_CFLAGS $LIBZIP_CFLAGS"
+DEPS_CPPFLAGS="$XML_CFLAGS"
AC_SUBST(DEPS_CPPFLAGS)
dnl Check for the presence of doxygen program
@@ -626,7 +577,7 @@ AX_VALGRIND_CHECK
dnl Set the list of libraries libabigail depends on
-DEPS_LIBS="$XML_LIBS $LIBZIP_LIBS $ELF_LIBS $DW_LIBS"
+DEPS_LIBS="$XML_LIBS $ELF_LIBS $DW_LIBS"
AC_SUBST(DEPS_LIBS)
if test x$ABIGAIL_DEVEL != x; then
@@ -959,7 +910,6 @@ AC_MSG_NOTICE([
Python : ${PYTHON}
OPTIONAL FEATURES:
- Enable zip archives : ${ENABLE_ZIP_ARCHIVE}
C++ standard level : ${CXX_STANDARD}
libdw has the dwarf_getalt function : ${FOUND_DWARF_GETALT_IN_LIBDW}
Enable rpm support in abipkgdiff : ${ENABLE_RPM}
@@ -13,7 +13,6 @@ abg-suppression.h \
abg-comp-filter.h \
abg-diff-utils.h \
abg-libxml-utils.h \
-abg-libzip-utils.h \
abg-fwd.h \
abg-hash.h \
abg-tools-utils.h \
deleted file mode 100644
@@ -1,61 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// -*- mode: C++ -*-
-//
-// Copyright (C) 2013-2020 Red Hat, Inc.
-
-/// @file
-
-#ifndef __ABG_LIBZIP_UTILS_H__
-#define __ABG_LIBZIP_UTILS_H__
-
-#include <zip.h>
-#include <memory>
-
-namespace abigail
-{
-
-namespace zip_utils
-{
-
-using std::shared_ptr;
-using std::string;
-
-/// @brief Functor passed to shared_ptr constructor during
-/// instantiation with zip*
-///
-/// Its aim is to delete zip* managed by shared_ptr.
-struct archive_deleter
-{
- void
- operator()(zip* archive)
- {
- /// ??? Maybe check the return code of close and throw if the
- /// close fails? But then callers must be prepared to handle
- /// this.
- zip_close(archive);
- }
-};//end archive_deleter
-
-/// @brief Functor passed to shared_ptr<zip_file>'s constructor.
-///
-/// Its aim is to close (actually delete) the zip_file* managed by the
-/// shared_ptr.
-struct zip_file_deleter
-{
- void
- operator()(zip_file*f)
- {
- zip_fclose(f);
- }
-};
-
-typedef shared_ptr<zip> zip_sptr;
-zip_sptr open_archive(const string& path, int flags, int *errorp);
-
-typedef shared_ptr<zip_file> zip_file_sptr;
-zip_file_sptr open_file_in_archive(zip_sptr archive,
- int file_index);
-
-}// end namespace zip
-}// end namespace abigail
-#endif //__ABG_LIBZIP_UTILS_H__
@@ -52,18 +52,6 @@ create_native_xml_read_context(std::istream* in, environment* env);
const string&
read_context_get_path(const read_context&);
-#ifdef WITH_ZIP_ARCHIVE
-corpus_sptr
-read_corpus_from_file(const string& path);
-
-int
-read_corpus_from_file(corpus_sptr& corp,
- const string& path);
-
-int
-read_corpus_from_file(corpus_sptr& corp);
-#endif //WITH_ZIP_ARCHIVE
-
corpus_sptr
read_corpus_from_native_xml(std::istream* in,
environment* env);
@@ -180,9 +180,6 @@ enum file_type
// A native abixml file format representing a corpus group of one or
// several corpora.
FILE_TYPE_XML_CORPUS_GROUP,
- // A zip file, possibly containing a corpus of one of several
- // translation units.
- FILE_TYPE_ZIP_CORPUS,
/// An RPM (.rpm) binary file
FILE_TYPE_RPM,
/// An SRPM (.src.rpm) file
@@ -26,7 +26,6 @@
./include/abg-interned-str.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./include/abg-ir.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./include/abg-libxml-utils.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
-./include/abg-libzip-utils.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./include/abg-regex.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./include/abg-reporter.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./include/abg-sptr-utils.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
@@ -57,7 +56,6 @@
./src/abg-internal.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./src/abg-ir-priv.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./src/abg-leaf-reporter.cc:1:// SPDX-License-Identifier: LGPL-3.0-or-later
-./src/abg-libzip-utils.cc:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./src/abg-reporter-priv.cc:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./src/abg-suppression-priv.h:1:// SPDX-License-Identifier: LGPL-3.0-or-later
./src/abg-viz-svg.cc:1:// SPDX-License-Identifier: LGPL-3.0-or-later
@@ -25,7 +25,6 @@
./include/abg-interned-str.h
./include/abg-ir.h
./include/abg-libxml-utils.h
-./include/abg-libzip-utils.h
./include/abg-regex.h
./include/abg-reporter.h
./include/abg-sptr-utils.h
@@ -56,7 +55,6 @@
./src/abg-internal.h
./src/abg-ir-priv.h
./src/abg-leaf-reporter.cc
-./src/abg-libzip-utils.cc
./src/abg-reporter-priv.cc
./src/abg-suppression-priv.h
./src/abg-viz-svg.cc
@@ -28,7 +28,6 @@ abg-comp-filter.cc \
abg-reader.cc \
abg-dwarf-reader.cc \
abg-libxml-utils.cc \
-abg-libzip-utils.cc \
abg-hash.cc \
abg-writer.cc \
abg-config.cc \
@@ -26,10 +26,6 @@ ABG_BEGIN_EXPORT_DECLARATIONS
#include "abg-tools-utils.h"
#include "abg-writer.h"
-#if WITH_ZIP_ARCHIVE
-#include "abg-libzip-utils.h"
-#endif
-
ABG_END_EXPORT_DECLARATIONS
// </headers defining libabigail's API>
@@ -47,13 +43,6 @@ using std::unordered_map;
using std::list;
using std::vector;
-#if WITH_ZIP_ARCHIVE
-using zip_utils::zip_sptr;
-using zip_utils::zip_file_sptr;
-using zip_utils::open_archive;
-using zip_utils::open_file_in_archive;
-#endif // WITH_ZIP_ARCHIVE
-
using regex::regex_t_sptr;
/// Constructor of @ref corpus::exported_decls_builder.
deleted file mode 100644
@@ -1,68 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// -*- mode: C++ -*-
-//
-// Copyright (C) 2013-2020 Red Hat, Inc.
-
-/// @file
-
-#include "abg-internal.h"
-#ifdef WITH_ZIP_ARCHIVE
-// <headers defining libabigail's API go under here>
-ABG_BEGIN_EXPORT_DECLARATIONS
-
-#include "abg-libzip-utils.h"
-
-ABG_END_EXPORT_DECLARATIONS
-// </headers defining libabigail's API>
-
-#include <string>
-namespace abigail
-{
-
-namespace zip_utils
-{
-
-/// This is a wrapper of the zip_open function, from libzip. Its
-/// purpose is to return a zip pointer wrapped in an appropriate
-/// shared_ptr and thus to free the caller from having to deal with
-/// calling zip_close on it.
-///
-/// The arguments this wrapper have the same meaning as in zip_open.
-///
-/// @param path the path to the zip archive to open.
-///
-/// @return a non-null zip pointer if the function succeeds.
-zip_sptr
-open_archive(const string& path, int flags, int *errorp)
-{
- zip* z = zip_open(path.c_str(), flags, errorp);
- if (!z)
- return zip_sptr();
- return zip_sptr(z, archive_deleter());
-}
-
-/// @brief Open a file from a zip archive.
-///
-/// Open the file that is at a given \a index in the \a archive.
-///
-/// @param archive the zip archive to consider
-///
-/// @param file_index the index of the file to open from the zip
-/// \a archive.
-///
-/// @return a non-null zip_file* upon successful completion, a null
-/// pointer otherwise.
-zip_file_sptr
-open_file_in_archive(zip_sptr archive,
- int file_index)
-{
- zip_file * f = zip_fopen_index(archive.get(), file_index, 0);
- if (!f)
- return zip_file_sptr();
- return zip_file_sptr(f, zip_file_deleter());
-}
-
-}// end namespace zip
-}// end namespace abigail
-
-#endif //WITH_ZIP_ARCHIVE
@@ -34,10 +34,6 @@ ABG_BEGIN_EXPORT_DECLARATIONS
#include "abg-reader.h"
#include "abg-corpus.h"
-#ifdef WITH_ZIP_ARCHIVE
-#include "abg-libzip-utils.h"
-#endif
-
ABG_END_EXPORT_DECLARATIONS
// </headers defining libabigail's API>
@@ -56,12 +52,6 @@ using std::unordered_map;
using std::dynamic_pointer_cast;
using std::vector;
using std::istream;
-#ifdef WITH_ZIP_ARCHIVE
-using zip_utils::zip_sptr;
-using zip_utils::zip_file_sptr;
-using zip_utils::open_archive;
-using zip_utils::open_file_in_archive;
-#endif //WITH_ZIP_ARCHIVE
static bool read_is_declaration_only(xmlNodePtr, bool&);
static bool read_is_artificial(xmlNodePtr, bool&);
@@ -5832,150 +5822,6 @@ struct array_deleter
}
};//end array_deleter
-#ifdef WITH_ZIP_ARCHIVE
-/// Deserialize an ABI Instrumentation XML file at a given index in a
-/// zip archive, and populate a given @ref translation_unit object
-/// with the result of that de-serialization.
-///
-/// @param the @ref translation_unit to populate with the result of
-/// the de-serialization.
-///
-/// @param ar the zip archive to read from.
-///
-/// @param file_index the index of the ABI Instrumentation XML file to
-/// read from the zip archive.
-///
-/// @return true upon successful completion, false otherwise.
-static translation_unit_sptr
-read_to_translation_unit(zip_sptr ar,
- int file_index)
-{
- translation_unit_sptr nil;
- if (!ar)
- return nil;
-
- zip_file_sptr f = open_file_in_archive(ar, file_index);
- if (!f)
- return nil;
-
- string input;
- {
- // Allocate a 64K byte buffer to read the archive.
- int buf_size = 64 * 1024;
- shared_ptr<char> buf(new char[buf_size + 1], array_deleter<char>());
- memset(buf.get(), 0, buf_size + 1);
- input.reserve(buf_size);
-
- while (zip_fread(f.get(), buf.get(), buf_size))
- {
- input.append(buf.get());
- memset(buf.get(), 0, buf_size + 1);
- }
- }
-
- return read_translation_unit_from_buffer(input);
-}
-
-/// Read an ABI corpus from an archive file which is a ZIP archive of
-/// several ABI Instrumentation XML files.
-///
-/// @param ar an object representing the archive file.
-///
-/// @param corp the ABI Corpus object to populate with the content of
-/// the archive @ref ar.
-///
-/// @return the number of ABI Instrumentation file read from the
-/// archive.
-static int
-read_corpus_from_archive(zip_sptr ar,
- corpus_sptr& corp)
-{
- if (!ar)
- return -1;
-
- int nb_of_tu_read = 0;
- int nb_entries = zip_get_num_entries(ar.get(), 0);
- if (nb_entries < 0)
- return -1;
-
- // TODO: ensure abi-info descriptor is present in the archive. Read
- // it and ensure that version numbers match.
- for (int i = 0; i < nb_entries; ++i)
- {
- shared_ptr<translation_unit>
- tu(new translation_unit(zip_get_name(ar.get(), i, 0)));
- if (read_to_translation_unit(*tu, ar, i))
- {
- if (!corp)
- corp.reset(new corpus(""));
- corp->add(tu);
- ++nb_of_tu_read;
- }
- }
- if (nb_of_tu_read)
- corp->set_origin(corpus::NATIVE_XML_ORIGIN);
- return nb_of_tu_read;
-}
-
-/// Read an ABI corpus from an archive file which is a ZIP archive of
-/// several ABI Instrumentation XML files.
-///
-/// @param corp the corpus to populate with the result of reading the
-/// archive.
-///
-/// @param path the path to the archive file.
-///
-/// @return the number of ABI Instrument XML file read from the
-/// archive, or -1 if the file could not read.
-int
-read_corpus_from_file(corpus_sptr& corp,
- const string& path)
-{
- if (path.empty())
- return -1;
-
- int error_code = 0;
- zip_sptr archive = open_archive(path, ZIP_CREATE|ZIP_CHECKCONS, &error_code);
- if (error_code)
- return -1;
-
- ABG_ASSERT(archive);
- return read_corpus_from_archive(archive, corp);
-}
-
-/// Read an ABI corpus from an archive file which is a ZIP archive of
-/// several ABI Instrumentation XML files.
-///
-/// @param corp the corpus to populate with the result of reading the
-/// archive. The archive file to consider is corp.get_path().
-///
-/// @return the number of ABI Instrument XML file read from the
-/// archive.
-int
-read_corpus_from_file(corpus_sptr& corp)
-{return read_corpus_from_file(corp, corp->get_path());}
-
-/// Read an ABI corpus from an archive file which is a ZIP archive of
-/// several ABI Instrumentation XML files.
-///
-/// @param path the path to the archive file.
-///
-/// @return the resulting corpus object, or NULL if the file could not
-/// be read.
-corpus_sptr
-read_corpus_from_file(const string& path)
-{
- if (path.empty())
- return corpus_sptr();
-
- corpus_sptr corp(new corpus(path));
- if (read_corpus_from_file(corp, path) < 0)
- return corpus_sptr();
-
- return corp;
-}
-
-#endif //WITH_ZIP_ARCHIVE
/// Create an xml_reader::read_context to read a native XML ABI file.
///
@@ -1333,9 +1333,6 @@ operator<<(ostream& output,
case FILE_TYPE_XML_CORPUS_GROUP:
repr = "native XML corpus group file type";
break;
- case FILE_TYPE_ZIP_CORPUS:
- repr = "native ZIP corpus file type";
- break;
case FILE_TYPE_RPM:
repr = "RPM file type";
break;
@@ -1445,12 +1442,6 @@ guess_file_type(istream& in)
&& buf[11] == ' ')
return FILE_TYPE_XML_CORPUS;
- if (buf[0] == 'P'
- && buf[1] == 'K'
- && buf[2] == 0x03
- && buf[3] == 0x04)
- return FILE_TYPE_ZIP_CORPUS;
-
if ((unsigned char) buf[0] == 0xed
&& (unsigned char) buf[1] == 0xab
&& (unsigned char) buf[2] == 0xee
@@ -34,10 +34,6 @@ ABG_BEGIN_EXPORT_DECLARATIONS
#include "abg-hash.h"
#include "abg-sptr-utils.h"
-#if WITH_ZIP_ARCHIVE
-#include "abg-libzip-utils.h"
-#endif
-
#include "abg-writer.h"
#include "abg-libxml-utils.h"
@@ -59,13 +55,6 @@ using std::stack;
using std::unordered_map;
using abigail::sptr_utils::noop_deleter;
-#if WITH_ZIP_ARCHIVE
-using zip_utils::zip_sptr;
-using zip_utils::zip_file_sptr;
-using zip_utils::open_archive;
-using zip_utils::open_file_in_archive;
-#endif // WITH_ZIP_ARCHIVE
-
/// The namespace for the native XML file format writer.
///
/// It contains utilities to serialize ABI artifacts from the @ref ir
@@ -4284,197 +4273,6 @@ write_class_tdecl(const shared_ptr<class_tdecl> decl,
return true;
}
-#ifdef WITH_ZIP_ARCHIVE
-
-/// A context used by functions that write a corpus out to disk in a
-/// ZIP archive of ABI Instrumentation XML files.
-///
-/// The aim of this context file is to hold the buffers of data that
-/// are to be written into a given zip object, until the zip object is
-/// closed. It's at that point that the buffers data is really
-/// flushed into the zip archive.
-///
-/// When an instance of this context type is created for a given zip
-/// object, is created, its life time should be longer than the @ref
-/// zip_sptr object it holds.
-///
-/// The definition of this type is private and should remain hidden
-/// from client code.
-struct archive_write_ctxt
-{
- list<string> serialized_tus;
- zip_sptr archive;
-
- archive_write_ctxt(zip_sptr ar)
- : archive(ar)
- {}
-};
-typedef shared_ptr<archive_write_ctxt> archive_write_ctxt_sptr;
-
-/// Create a write context to a given archive. The result of this
-/// function is to be passed to the functions that are to write a
-/// corpus to an archive, e.g, write_corpus_to_archive().
-///
-/// @param archive_path the path to the archive to create this write
-/// context for.
-///
-/// @return the resulting write context to pass to the functions that
-/// are to write a corpus to @ref archive_path.
-static archive_write_ctxt_sptr
-create_archive_write_context(const string& archive_path)
-{
- if (archive_path.empty())
- return archive_write_ctxt_sptr();
-
- int error_code = 0;
- zip_sptr archive = open_archive(archive_path,
- ZIP_CREATE|ZIP_TRUNCATE|ZIP_CHECKCONS,
- &error_code);
- if (error_code)
- return archive_write_ctxt_sptr();
-
- archive_write_ctxt_sptr r(new archive_write_ctxt(archive));
- return r;
-}
-
-/// Write a translation unit to an on-disk archive. The archive is a
-/// zip archive of ABI Instrumentation files in XML format.
-///
-/// @param tu the translation unit to serialize.
-///
-/// @param ctxt the context of the serialization. Contains
-/// information about where the archive is on disk, the zip archive,
-/// and the buffers holding the temporary data to be flushed into the archive.
-///
-/// @param annotate whether ABIXML output should be annotated.
-///
-/// @return true upon succesful serialization occured, false
-/// otherwise.
-static bool
-write_translation_unit_to_archive(const translation_unit& tu,
- archive_write_ctxt& ctxt,
- const bool annotate)
-{
- if (!ctxt.archive)
- return false;
-
- ostringstream os;
- if (!write_translation_unit(tu, /*indent=*/0, os, annotate))
- return false;
- ctxt.serialized_tus.push_back(os.str());
-
- zip_source *source;
- if ((source = zip_source_buffer(ctxt.archive.get(),
- ctxt.serialized_tus.back().c_str(),
- ctxt.serialized_tus.back().size(),
- false)) == 0)
- return false;
-
- if (zip_file_add(ctxt.archive.get(), tu.get_path().c_str(), source,
- ZIP_FL_OVERWRITE|ZIP_FL_ENC_GUESS) < 0)
- {
- zip_source_free(source);
- return false;
- }
-
- return true;
-}
-
- /// Serialize a given corpus to disk in a file at a given path.
- ///
- /// @param tu the translation unit to serialize.
- ///
- /// @param ctxt the context of the serialization. Contains
- /// information about where the archive is on disk, the zip archive
- /// object, and the buffers holding the temporary data to be flushed
- /// into the archive.
- ///
- /// @param annotate whether ABIXML output should be annotated.
- ///
- /// @return true upon successful completion, false otherwise.
-static bool
-write_corpus_to_archive(const corpus& corp,
- archive_write_ctxt& ctxt,
- const bool annotate)
-{
- for (translation_units::const_iterator i =
- corp.get_translation_units().begin();
- i != corp.get_translation_units().end();
- ++i)
- {
- if (! write_translation_unit_to_archive(**i, ctxt, annotate))
- return false;
- }
-
- // TODO: ensure abi-info descriptor is added to the archive.
- return true;
-}
-
-/// Serialize a given corpus to disk in an archive file at a given
-/// path.
-///
-/// @param corp the ABI corpus to serialize.
-///
- /// @param ctxt the context of the serialization. Contains
- /// information about where the archive is on disk, the zip archive
- /// object, and the buffers holding the temporary data to be flushed
- /// into the archive.
- ///
- /// @param annotate whether ABIXML output should be annotated.
- ///
- /// @return upon successful completion, false otherwise.
-static bool
-write_corpus_to_archive(const corpus& corp,
- archive_write_ctxt_sptr ctxt,
- const bool annotate)
-{return write_corpus_to_archive(corp, *ctxt, annotate);}
-
- /// Serialize the current corpus to disk in a file at a given path.
- ///
- /// @param tu the translation unit to serialize.
- ///
- /// @param path the path of the file to serialize the
- /// translation_unit to.
- ///
- /// @param annotate whether ABIXML output should be annotated.
- ///
- /// @return true upon successful completion, false otherwise.
-bool
-write_corpus_to_archive(const corpus& corp,
- const string& path,
- const bool annotate)
-{
- archive_write_ctxt_sptr ctxt = create_archive_write_context(path);
- ABG_ASSERT(ctxt);
- return write_corpus_to_archive(corp, ctxt, annotate);
-}
-
- /// Serialize the current corpus to disk in a file. The file path is
- /// given by translation_unit::get_path().
- ///
- /// @param tu the translation unit to serialize.
- ///
- /// @param annotate whether ABIXML output should be annotated.
- ///
- /// @return true upon successful completion, false otherwise.
-bool
-write_corpus_to_archive(const corpus& corp, const bool annotate)
-{return write_corpus_to_archive(corp, corp.get_path(), annotate);}
-
- /// Serialize the current corpus to disk in a file. The file path is
- /// given by translation_unit::get_path().
- ///
- /// @param tu the translation unit to serialize.
- ///
- /// @param annotate whether ABIXML output should be annotated.
- ///
- /// @return true upon successful completion, false otherwise.
-bool
-write_corpus_to_archive(const corpus_sptr corp, const bool annotate)
-{return write_corpus_to_archive(*corp, annotate);}
-
-#endif //WITH_ZIP_ARCHIVE
-
/// Serialize the current version number of the ABIXML format.
///
/// @param ctxt the writing context to use.
@@ -1,11 +1,6 @@
## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
SUBDIRS = data
-ZIP_ARCHIVE_TESTS =
-if ENABLE_ZIP_ARCHIVE
-ZIP_ARCHIVE_TESTS += runtestwritereadarchive runtestdot
-endif
-
AM_CXXFLAGS = $(VISIBILITY_FLAGS)
FEDABIPKGDIFF_TEST =
@@ -49,8 +44,7 @@ runtestsymtab \
runtestsymtabreader \
runtesttoolsutils \
runtestsvg \
-$(FEDABIPKGDIFF_TEST) \
-$(ZIP_ARCHIVE_TESTS)
+$(FEDABIPKGDIFF_TEST)
if ENABLE_RUNNING_TESTS_WITH_PY3
@@ -93,9 +87,6 @@ libcatch_la_SOURCES = lib/catch.cc lib/catch.hpp
runtestreadwrite_SOURCES=test-read-write.cc
runtestreadwrite_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
-runtestwritereadarchive_SOURCES=test-write-read-archive.cc
-runtestwritereadarchive_LDADD= libtestutils.la $(top_builddir)/src/libabigail.la
-
runtestreaddwarf_SOURCES=test-read-dwarf.cc
runtestreaddwarf_LDADD=libtestutils.la $(top_builddir)/src/libabigail.la
runtestreaddwarf_LDFLAGS=-pthread
@@ -163,9 +154,6 @@ runtestsymtabreader_LDADD = libcatch.la $(top_builddir)/src/libabigail.la
runtestsvg_SOURCES=test-svg.cc
runtestsvg_LDADD=$(top_builddir)/src/libabigail.la
-runtestdot_SOURCES = test-dot.cc
-runtestdot_LDADD = $(top_builddir)/src/libabigail.la
-
testirwalker_SOURCES=test-ir-walker.cc
testirwalker_LDADD=$(top_builddir)/src/libabigail.la
deleted file mode 100644
@@ -1,58 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// -*- mode: C++ -*-
-//
-// Copyright (C) 2013-2019 Red Hat, Inc.
-
-#include "abg-viz-dot.h"
-
-int main()
-{
- using namespace abigail;
-
- // sa-base
- {
- dot obj("sa-base");
- parent_node p("base");
- obj.start();
- obj.add_parent(p);
- obj.finish();
- }
-
-
- // sa-A
- {
- dot obj("sa-A");
- parent_node p("base");
- child_node c1("A");
- obj.start();
- obj.add_parent(p);
- obj.add_child_to_node(c1, p);
- obj.finish();
- }
-
- // sa-B
- {
- dot obj("sa-B");
- parent_node p("base");
- child_node c1("B");
- obj.start();
- obj.add_parent(p);
- obj.add_child_to_node(c1, p);
- obj.finish();
- }
-
- // sa-D1
- {
- dot obj("sa-D1");
- parent_node p("base");
- child_node c1("A");
- child_node c2("D1");
- obj.start();
- obj.add_parent(p);
- obj.add_child_to_node(c1, p);
- obj.add_child_to_node(c2, c1);
- obj.finish();
- }
-
- return 0;
-}
deleted file mode 100644
@@ -1,178 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// -*- Mode: C++ -*-
-//
-// Copyright (C) 2013-2020 Red Hat, Inc.
-
-#include <cstdlib>
-#include <fstream>
-#include <iostream>
-#include <memory>
-#include "test-utils.h"
-#include "abg-ir.h"
-#include "abg-corpus.h"
-#include "abg-tools-utils.h"
-#include "abg-reader.h"
-#include "abg-writer.h"
-
-struct InOutSpec
-{
- const char* in_path;
- const char* out_path;
-};// end struct InOutSpec
-
-/// This is an aggregate that specifies where the test gets the
-/// elements that it reads to build an archive. It also specifies
-/// where to write the output result of the element that is written
-/// back to disk, for diffing purposes.
-InOutSpec archive_elements[] =
-{
- {
- "data/test-write-read-archive/test0.xml",
- "output/test-write-read-archive/test0.xml",
- },
- {
- "data/test-write-read-archive/test1.xml",
- "output/test-write-read-archive/test2.xml",
- },
- {
- "data/test-write-read-archive/test2.xml",
- "output/test-write-read-archive/test2.xml",
- },
- {
- "data/test-write-read-archive/test3.xml",
- "output/test-write-read-archive/test3.xml",
- },
- {
- "data/test-write-read-archive/test4.xml",
- "output/test-write-read-archive/test4.xml",
- },
- // This should be the last entry.
- {NULL, NULL}
-};
-
-#define NUM_ARCHIVES_ELEMENTS \
- ((sizeof(archive_elements) / sizeof(InOutSpec)) -1)
-
-/// Where to write the archive, and where to read it from to get the
-/// base for the diffing.
-const InOutSpec archive_spec =
-{
- "data/test-write-read-archive/archive.abi",
- "output/test-write-read-archive/archive.abi"
-};
-
-using std::string;
-using std::cerr;
-using std::ofstream;
-using std::shared_ptr;
-using abigail::corpus;
-using abigail::corpus_sptr;
-using abigail::translation_unit;
-using abigail::xml_reader::read_corpus_from_file;
-using abigail::xml_writer::write_corpus_to_archive;
-
-int
-main()
-{
- // Read the elements into abigail::translation_unit and stick them
- // into an abigail::corpus.
- string in_path, out_path;
- bool is_ok = true;
-
- out_path =
- abigail::tests::get_build_dir() + "/tests/" + archive_spec.out_path;
-
- if (!abigail::tools_utils::ensure_parent_dir_created(out_path))
- {
- cerr << "Could not create parent director for " << out_path;
- return 1;
- }
-
- corpus_sptr abi_corpus(new corpus(out_path));
-
- for (InOutSpec *s = archive_elements; s->in_path; ++s)
- {
- in_path = abigail::tests::get_src_dir() + "/tests/" + s->in_path;
- abigail::translation_unit_sptr tu =
- abigail::xml_reader::read_translation_unit_from_file(in_path);
- if (!tu || tu->is_empty())
- {
- cerr << "failed to read " << in_path << "\n";
- is_ok = false;
- continue;
- }
-
- string file_name;
- abigail::tools_utils::base_name(tu->get_path(), file_name);
- tu->set_path(file_name);
- abi_corpus->add(tu);
- }
-
- if (!write_corpus_to_archive(abi_corpus))
- {
- cerr << "failed to write archive file: " << abi_corpus->get_path();
- return 1;
- }
-
- // Diff the archive members.
- //
- // Basically, re-read the corpus from disk, walk the loaded
- // translation units, write them back and diff them against their
- // reference.
-
- abi_corpus->drop_translation_units();
- if (abi_corpus->get_translation_units().size())
- {
- cerr << "In-memory object of abi corpus at '"
- << abi_corpus->get_path()
- << "' still has translation units after call to "
- "corpus::drop_translation_units!";
- return false;
- }
-
- if (read_corpus_from_file(abi_corpus) != NUM_ARCHIVES_ELEMENTS)
- {
- cerr << "Failed to load the abi corpus from path '"
- << abi_corpus->get_path()
- << "'";
- return 1;
- }
-
- if (abi_corpus->get_translation_units().size() != NUM_ARCHIVES_ELEMENTS)
- {
- cerr << "Read " << abi_corpus->get_translation_units().size()
- << " elements from the abi corpus at "
- << abi_corpus->get_path()
- << " instead of "
- << NUM_ARCHIVES_ELEMENTS
- << "\n";
- return 1;
- }
-
- for (unsigned i = 0; i < NUM_ARCHIVES_ELEMENTS; ++i)
- {
- InOutSpec& spec = archive_elements[i];
- out_path =
- abigail::tests::get_build_dir() + "/tests/" + spec.out_path;
- using abigail::xml_writer::write_translation_unit;
- bool wrote =
- write_translation_unit(*abi_corpus->get_translation_units()[i],
- /*indent=*/0, out_path);
- if (!wrote)
- {
- cerr << "Failed to serialize translation_unit to '"
- << out_path
- << "'\n";
- is_ok = false;
- }
-
- string ref =
- abigail::tests::get_src_dir() + "/tests/" + spec.in_path;
- string cmd = "diff -u " + ref + " " + out_path;
-
- if (system(cmd.c_str()))
- is_ok = false;
- }
-
- return !is_ok;
-}
@@ -1,11 +1,7 @@
## SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
h=$(abs_srcdir)
-if ENABLE_ZIP_ARCHIVE
- bin_PROGRAMS = abiar abidiff abilint abidw abicompat abipkgdiff kmidiff
-else
- bin_PROGRAMS = abidiff abilint abidw abicompat abipkgdiff kmidiff
-endif
+bin_PROGRAMS = abidiff abilint abidw abicompat abipkgdiff kmidiff
if ENABLE_FEDABIPKGDIFF
dist_bin_SCRIPTS = fedabipkgdiff
@@ -15,12 +11,6 @@ endif
noinst_PROGRAMS = abisym abinilint
-if ENABLE_ZIP_ARCHIVE
-abiar_SOURCES = abiar.cc
-abiardir = $(bindir)
-abiar_LDADD = ../src/libabigail.la
-endif
-
abidiff_SOURCES = abidiff.cc
abidiffdir = $(bindir)
abidiff_LDADD = ../src/libabigail.la
deleted file mode 100644
@@ -1,319 +0,0 @@
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-// -*- Mode: C++ -*-
-//
-// Copyright (C) 2013-2020 Red Hat, Inc.
-
-#include <sys/types.h>
-#include <sys/stat.h>// The two above is for 'stat'
-#include <cstring> // for 'strcmp'
-#include <cstdlib> // for 'system'
-#include <iostream>
-#include <fstream>
-#include <list>
-#include "abg-corpus.h"
-#include "abg-reader.h"
-#include "abg-writer.h"
-#include "abg-tools-utils.h"
-
-using std::cerr;
-using std::cout;
-using std::ostream;
-using std::string;
-using std::list;
-
-struct options
-{
- bool list_content;
- string extract_dest;
- string archive;
- list<string> in_files;
- string out_dir;
-
- options()
- : list_content(false)
- {
- }
-
-};//end options
-
-/// Display a message explaining the usage of the program on stdout.
-static void
-display_usage(const string &prog_name, ostream& out)
-{
- out << "usage: " << prog_name << " [options] [archive-file-path]\n"
- << " where options are: \n"
- << "--help|-h display this usage message\n"
- << "--list|l <archive> list the archive content\n"
- << "--add|-a <files-to-add> <archive> add files to an archive\n"
- << "--extract|x [dest-dir] <archive> extract archive content\n"
- ;
-}
-
-/// Parse the command line arguments and populate an instance of \a
-/// options as a result.
-///
-/// @param argc the number of words on the command line, including the
-/// program name.
-///
-/// @param argv an array of words representing the command line. This
-/// is the thing that is parsed.
-///
-/// @param opts the options that are set as a result of parsing the
-/// command line. This output parameter is set iff the function
-/// returs true.
-///
-/// @return true if the function could make sense of the command line
-/// and parsed it correctly. Otherwise, return false. If this
-/// function returns false, the caller would be well inspired to call
-/// display_usage() to remind the user how to properly invoke this
-/// program so that its command line makes sense.
-static bool
-parse_args(int argc, char* argv[], options& opts)
-{
- if (argc < 2)
- return false;
-
- for (int i = 1; i < argc; ++i)
- {
- char* arg = argv[i];
-
- if (! strcmp(arg, "--help")
- ||! strcmp(arg, "-h"))
- return false;
-
- if (arg[0] != '-')
- opts.archive = arg;
- else if (! strcmp(arg, "--list")
- ||! strcmp(arg, "-l"))
- opts.list_content = true;
- else if (! strcmp(arg, "--add")
- || ! strcmp(arg,"-a"))
- {
- int arg_index0, arg_index1;
- char *f = 0;
- for (arg_index0 = i + 1; arg_index0 < argc; ++arg_index0)
- {
- // --add must be followed by at N words that don't start
- // by '-' (N > 1). The first N-1 words are the
- // arguments of --add (the files to add to the archive)
- // and the last one is the name of the archive to add
- // the files to.
-
- f = argv[arg_index0];
- if (f[0] == '-')
- break;
-
- arg_index1 = arg_index0 + 1;
- if (arg_index1 >= argc
- || argv[arg_index1][0] == '-')
- break;
-
- opts.in_files.push_back(f);
- }
- if (opts.in_files.empty())
- return false;
- }
- else if (! strcmp(arg, "--extract")
- || ! strcmp(arg, "-x"))
- {
- int arg_index = i + 1, arch_index = arg_index + 1;
- if (arg_index < argc
- && argv[arg_index][0] != '-'
- && arch_index < argc
- && argv[arch_index][0] != '-')
- opts.extract_dest = argv[arg_index];
- else if (arg_index < argc
- && argv[arg_index][0] != '-')
- // No destination directory argument was given for the
- // --extract option, so consider it to be the current
- // directory
- opts.extract_dest = ".";
- else
- return false;
- }
- }
-
- return true;
-}
-
-using abigail::corpus;
-using abigail::corpus_sptr;
-using abigail::translation_unit;
-using abigail::translation_unit_sptr;
-using abigail::translation_units;
-using abigail::xml_reader::read_corpus_from_file;
-using abigail::xml_writer::write_corpus_to_archive;
-
-/// List the content of a given archive. The names of the files of
-/// the archive are then displayed on stdout.
-///
-/// @param archive_path a path to the file containing the archive file
-/// to list the content of.
-///
-/// @return true upon successful completion, false otherwise.
-static bool
-list_content(const string& archive_path)
-{
- if (archive_path.empty())
- {
- cerr << "Empty archive path\n";
- return false;
- }
-
- corpus_sptr archive = read_corpus_from_file(archive_path);
- if (!archive)
- {
- cerr << "Could not read archive at '" << archive_path << "'\n";
- return false;
- }
-
- for (translation_units::const_iterator i =
- archive->get_translation_units().begin();
- i != archive->get_translation_units().end();
- ++i)
- cout << (*i)->get_path() << "\n";
-
- return true;
-}
-
-/// Add a translation unit to an archive -- or create one for that
-/// matter.
-///
-/// @param tu_paths a list of paths to add to the archive.
-///
-/// @param archive_path the path of the archive to either open or
-/// create. The specified in \tu_paths are then added to this
-/// archive. Note that this function creates the entire directory
-/// tree needed up to \a archive_path, if needed.
-///
-/// @return true upon successful completion, false otherwise.
-static bool
-add_tus_to_archive(const list<string>& tu_paths,
- const string& archive_path)
-{
- translation_units tus;
- corpus corp(archive_path);
-
- bool added_some_tus = false;
- for (list<string>::const_iterator i = tu_paths.begin();
- i != tu_paths.end();
- ++i)
- {
- translation_unit_sptr tu =
- abigail::xml_reader::read_translation_unit_from_file(*i);
- if (!tu)
- {
- cerr << "could not read binary instrumentation file '"
- << *i
- << "'\n";
- continue;
- }
- corp.add(tu);
- added_some_tus = true;
- }
-
- if (added_some_tus)
- {
- if (!write_corpus_to_archive(corp))
- {
- cerr << "could not write archive file '"
- << corp.get_path()
- << "'\n";
- return false;
- }
- }
-
- return true;
-}
-
-/// Extract translation units from a given archive.
-///
-/// @param dest_path the path of the destination directory which the
-/// elements of the archive are to be extracted under.
-///
-/// @param archive_path the path to the archive to extract. The
-/// archive must exist and be accessible with read privileges.
-///
-/// @return true upon successful completion, false otherwise.
-static bool
-extract_tus_from_archive(const string& dest_path,
- const string& archive_path)
-{
- if (dest_path.empty())
- {
- cerr << "empty file directory\n";
- return false;
- }
-
- corpus_sptr archive(new corpus(archive_path));
-
- if (read_corpus_from_file(archive) < 1)
- {
- cerr << "could not read archive at '"
- << archive_path
- << "'\n;";
- return false;
- }
-
- string cmd = "mkdir -p " + dest_path;
- if (system(cmd.c_str()))
- {
- cerr << "could not create file directory '"
- << dest_path
- << "'\n";
- return false;
- }
-
- for (translation_units::const_iterator i =
- archive->get_translation_units().begin();
- i != archive->get_translation_units().end();
- ++i)
- {
- string dest = dest_path + "/" + (*i)->get_path();
- if (!abigail::tools_utils::ensure_parent_dir_created(dest))
- {
- cerr << "could not create parent director for '" << dest << "'\n";
- return false;
- }
-
- if (!abigail::xml_writer::write_translation_unit(**i, /*indent=*/0, dest))
- {
- cerr << "could not write binary instrumentation file to '"
- << dest
- << "'\n";
- return false;
- }
- }
-
- return true;
-}
-
-/// Parse the command line and perform the archive-related operations
-/// asked by the user, if the command line makes sense; otherwise,
-/// display a usage help message and bail out.
-int
-main(int argc, char* argv[])
-{
- options opts;
-
- if (!parse_args(argc, argv, opts)
- || opts.archive.empty())
- {
- display_usage(argv[0], cout);
- return -1;
- }
-
- if (opts.list_content)
- return !list_content(opts.archive);
- else if (!opts.in_files.empty())
- return !add_tus_to_archive(opts.in_files, opts.archive);
- else if (!opts.extract_dest.empty())
- return !extract_tus_from_archive(opts.extract_dest, opts.archive);
- else
- {
- display_usage(argv[0], cout);
- return -1;
- }
-
- return 0;
-}
@@ -1178,13 +1178,6 @@ main(int argc, char* argv[])
argv[0], opts);
}
break;
- case abigail::tools_utils::FILE_TYPE_ZIP_CORPUS:
-#ifdef WITH_ZIP_ARCHIVE
- c1 = abigail::xml_reader::read_corpus_from_file(opts.file1);
- if (!c1)
- return handle_error(c1_status, /*ctxt=*/0, argv[0], opts);
-#endif //WITH_ZIP_ARCHIVE
- break;
case abigail::tools_utils::FILE_TYPE_RPM:
case abigail::tools_utils::FILE_TYPE_SRPM:
case abigail::tools_utils::FILE_TYPE_DEB:
@@ -1253,13 +1246,6 @@ main(int argc, char* argv[])
return handle_error(c2_status, /*ctxt=*/0, argv[0], opts);
}
break;
- case abigail::tools_utils::FILE_TYPE_ZIP_CORPUS:
-#ifdef WITH_ZIP_ARCHIVE
- c2 = abigail::xml_reader::read_corpus_from_file(opts.file2);
- if (!c2)
- return handle_error(c2_status, /*ctxt=*/0, argv[0], opts);
-#endif //WITH_ZIP_ARCHIVE
- break;
case abigail::tools_utils::FILE_TYPE_RPM:
case abigail::tools_utils::FILE_TYPE_SRPM:
case abigail::tools_utils::FILE_TYPE_DEB:
@@ -57,9 +57,6 @@ using abigail::xml_writer::write_context_sptr;
using abigail::xml_writer::create_write_context;
using abigail::xml_writer::write_corpus;
using abigail::xml_writer::write_corpus_to_archive;
-#ifdef WITH_ZIP_ARCHIVE
-using abigail::xml_reader::read_corpus_from_file;
-#endif
struct options
{
@@ -370,11 +367,6 @@ main(int argc, char* argv[])
group = read_corpus_group_from_input(*ctxt);
}
break;
- case abigail::tools_utils::FILE_TYPE_ZIP_CORPUS:
-#if WITH_ZIP_ARCHIVE
- corp = read_corpus_from_file(opts.file_path);
-#endif
- break;
case abigail::tools_utils::FILE_TYPE_RPM:
break;
case abigail::tools_utils::FILE_TYPE_SRPM:
@@ -454,13 +446,6 @@ main(int argc, char* argv[])
if (!opts.noout)
is_ok = write_corpus(*ctxt, corp, 0);
}
- else if (type == abigail::tools_utils::FILE_TYPE_ZIP_CORPUS)
- {
-#ifdef WITH_ZIP_ARCHIVE
- if (!opts.noout)
- is_ok = write_corpus_to_archive(*corp, tmp_file->get_path());
-#endif //WITH_ZIP_ARCHIVE
- }
}
if (!is_ok)
@@ -478,8 +463,7 @@ main(int argc, char* argv[])
&& opts.diff
&& ((type == abigail::tools_utils::FILE_TYPE_XML_CORPUS)
||type == abigail::tools_utils::FILE_TYPE_XML_CORPUS_GROUP
- || type == abigail::tools_utils::FILE_TYPE_NATIVE_BI
- || type == abigail::tools_utils::FILE_TYPE_ZIP_CORPUS))
+ || type == abigail::tools_utils::FILE_TYPE_NATIVE_BI))
{
string cmd = "diff -u " + opts.file_path + " " + tmp_file->get_path();
if (system(cmd.c_str()))