diff options
author | 2010-11-07 16:53:04 +0000 | |
---|---|---|
committer | 2010-11-07 19:44:38 +0000 | |
commit | 4ac7b20c2006414b1ad708f61c2e31fc494bb4ee (patch) | |
tree | a8d70fc65651a4fdbf04a38c8705773cd28778d2 | |
parent | 78fae8c23f0aa4070ed495ced4c4f20434f91c62 (diff) | |
download | paludis-4ac7b20c2006414b1ad708f61c2e31fc494bb4ee.tar.gz paludis-4ac7b20c2006414b1ad708f61c2e31fc494bb4ee.tar.xz |
Write pax archives if gnutar isn't available
-rw-r--r-- | configure.ac | 12 | ||||
-rw-r--r-- | paludis/repositories/e/e_repository.cc | 11 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild.cc | 1 | ||||
-rw-r--r-- | paludis/repositories/e/ebuild.hh | 2 | ||||
-rwxr-xr-x | paludis/repositories/e/ebuild/write_binary_ebuild.bash | 2 | ||||
-rw-r--r-- | paludis/tar_extras.cc | 6 |
6 files changed, 28 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac index 698f4730d..08bd126f7 100644 --- a/configure.ac +++ b/configure.ac @@ -1564,6 +1564,7 @@ fi dnl }}} dnl {{{ libarchive +libarchive_does_gnutar=no if test "x$need_libarchive_check" = "xyes" ; then AC_MSG_CHECKING([for libarchive]) AC_PREPROC_IFELSE([AC_LANG_SOURCE([ @@ -1572,7 +1573,7 @@ if test "x$need_libarchive_check" = "xyes" ; then [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([libarchive is required for pbins])]) - AC_MSG_CHECKING([whether your libarchive is new enough]) + AC_MSG_CHECKING([whether your libarchive does gnutar]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ #include <archive.h> @@ -1582,9 +1583,14 @@ int main(int, char **) archive_write_set_format_gnutar(archive); } ])], - [AC_MSG_RESULT([yes])], - [AC_MSG_ERROR([a more recent libarchive than the one you have is required for pbins])]) + [ + AC_MSG_RESULT([yes]) + libarchive_does_gnutar=yes + AC_DEFINE([LIBARCHIVE_DOES_GNUTAR], [1], [libarchive does gnutar]) + ], + [AC_MSG_RESULT([no])]) fi +AM_CONDITIONAL([LIBARCHIVE_DOES_GNUTAR], test "x$libarchive_does_gnutar" = "xyes") dnl }}} dnl {{{ sqlite3 check diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc index bfea6ce1e..be5bd0eec 100644 --- a/paludis/repositories/e/e_repository.cc +++ b/paludis/repositories/e/e_repository.cc @@ -139,6 +139,12 @@ typedef std::map<FSPath, std::string, FSPathComparator> EAPIForFileMap; namespace { +#ifdef LIBARCHIVE_DOES_GNUTAR + const std::string pbin_tar_extension = ".tar"; +#else + const std::string pbin_tar_extension = ".pax"; +#endif + std::shared_ptr<FSPathSequence> get_master_locations( const std::shared_ptr<const ERepositorySequence> & r) { @@ -2783,7 +2789,7 @@ ERepository::merge(const MergeParams & m) n::output_manager() = m.output_manager(), n::package_id() = m.package_id(), n::root() = FSPath("/"), - n::tar_file() = _imp->params.binary_distdir() / (bin_dist_base + ".tar") + n::tar_file() = _imp->params.binary_distdir() / (bin_dist_base + pbin_tar_extension) )); if (! merger.check()) @@ -2791,7 +2797,7 @@ ERepository::merge(const MergeParams & m) merger.merge(); - Process compress_process(ProcessCommand({"bzip2", stringify(_imp->params.binary_distdir() / (bin_dist_base + ".tar")) })); + Process compress_process(ProcessCommand({"bzip2", stringify(_imp->params.binary_distdir() / (bin_dist_base + pbin_tar_extension)) })); if (0 != compress_process.run().wait()) throw ActionFailedError("Compressing tarball failed"); @@ -2821,6 +2827,7 @@ ERepository::merge(const MergeParams & m) n::binary_distdir() = _imp->params.binary_distdir(), n::binary_ebuild_location() = binary_ebuild_location, n::binary_keywords() = binary_keywords, + n::binary_uri_extension() = pbin_tar_extension + ".bz2", n::builddir() = _imp->params.builddir(), n::destination_repository() = this, n::environment() = _imp->params.environment(), diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc index 0611a558a..7b3f5255b 100644 --- a/paludis/repositories/e/ebuild.cc +++ b/paludis/repositories/e/ebuild.cc @@ -1232,6 +1232,7 @@ WriteBinaryEbuildCommand::operator() () + params.package_id()->eapi()->exported_name())->supported()->ebuild_metadata_variables()->keywords()->name()) .setenv("PALUDIS_BINARY_DISTDIR_VARIABLE", EAPIData::get_instance()->eapi_from_string("pbin-1+" + params.package_id()->eapi()->exported_name())->supported()->ebuild_environment_variables()->env_distdir()) + .setenv("PALUDIS_BINARY_URI_EXTENSION", params.binary_uri_extension()) .setenv("PALUDIS_EBUILD_MODULE_SUFFIXES", params.package_id()->eapi()->supported()->ebuild_options()->ebuild_module_suffixes()) .setenv("PALUDIS_EBUILD_PHASE_VAR", diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh index c3f713798..3a98f11e4 100644 --- a/paludis/repositories/e/ebuild.hh +++ b/paludis/repositories/e/ebuild.hh @@ -48,6 +48,7 @@ namespace paludis typedef Name<struct binary_distdir_name> binary_distdir; typedef Name<struct binary_ebuild_location_name> binary_ebuild_location; typedef Name<struct binary_keywords_name> binary_keywords; + typedef Name<struct binary_uri_extension_name> binary_uri_extension; typedef Name<struct builddir_name> builddir; typedef Name<struct clearenv_name> clearenv; typedef Name<struct commands_name> commands; @@ -300,6 +301,7 @@ namespace paludis NamedValue<n::binary_distdir, FSPath> binary_distdir; NamedValue<n::binary_ebuild_location, FSPath> binary_ebuild_location; NamedValue<n::binary_keywords, std::string> binary_keywords; + NamedValue<n::binary_uri_extension, std::string> binary_uri_extension; NamedValue<n::builddir, FSPath> builddir; NamedValue<n::destination_repository, const ERepository *> destination_repository; NamedValue<n::environment, const Environment *> environment; diff --git a/paludis/repositories/e/ebuild/write_binary_ebuild.bash b/paludis/repositories/e/ebuild/write_binary_ebuild.bash index 9cc91d496..3188ee759 100755 --- a/paludis/repositories/e/ebuild/write_binary_ebuild.bash +++ b/paludis/repositories/e/ebuild/write_binary_ebuild.bash @@ -124,7 +124,7 @@ main() make_binary_ebuild \ "${ebuildfile}" \ - "${PALUDIS_BINARY_URI_PREFIX}""$(basename ${bindistfile} ).tar.bz2" \ + "${PALUDIS_BINARY_URI_PREFIX}""$(basename ${bindistfile} )${PALUDIS_BINARY_URI_EXTENSION:-.tar.bz2}" \ "${PALUDIS_BINARY_KEYWORDS}" ebuild_section "Finished writing binary" diff --git a/paludis/tar_extras.cc b/paludis/tar_extras.cc index 82403cbd0..8ec734ff1 100644 --- a/paludis/tar_extras.cc +++ b/paludis/tar_extras.cc @@ -25,6 +25,8 @@ #include <archive.h> #include <archive_entry.h> +#include "config.h" + using namespace paludis; struct PaludisTarExtras @@ -47,7 +49,11 @@ paludis_tar_extras_init(const std::string & f, const std::string & compress) else archive_write_set_compression_none(extras->archive); +#ifdef LIBARCHIVE_DOES_GNUTAR archive_write_set_format_gnutar(extras->archive); +#else + archive_write_set_format_pax(extras->archive); +#endif if (ARCHIVE_OK != archive_write_open_filename(extras->archive, f.c_str())) throw MergerError("archive_write_open_filename failed"); |