aboutsummaryrefslogtreecommitdiff
path: root/paludis/tar_merger.cc
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-29 18:34:10 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-31 11:36:05 +0100
commitf8058cf3d2faad1df09e1a0d1af51a99f3401004 (patch)
treecd7793dddb3b7bfe82a87717af8c0dc9c1847ef9 /paludis/tar_merger.cc
parent7c45cd17c44ad61b76b51c18144692ccca04390d (diff)
downloadpaludis-f8058cf3d2faad1df09e1a0d1af51a99f3401004.tar.gz
paludis-f8058cf3d2faad1df09e1a0d1af51a99f3401004.tar.xz
Use GNU tar format, and support compression
Diffstat (limited to 'paludis/tar_merger.cc')
-rw-r--r--paludis/tar_merger.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/paludis/tar_merger.cc b/paludis/tar_merger.cc
index cfa589836..9f73eb222 100644
--- a/paludis/tar_merger.cc
+++ b/paludis/tar_merger.cc
@@ -23,8 +23,12 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/singleton-impl.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/stringify.hh>
#include <paludis/about.hh>
+#include <ostream>
+
#include <dlfcn.h>
#include <stdint.h>
@@ -32,12 +36,14 @@
using namespace paludis;
+#include <paludis/tar_merger-se.cc>
+
namespace
{
struct TarMergerHandle :
Singleton<TarMergerHandle>
{
- typedef PaludisTarExtras * (* InitPtr) (const std::string &);
+ typedef PaludisTarExtras * (* InitPtr) (const std::string &, const std::string &);
typedef void (* AddFilePtr) (PaludisTarExtras * const, const std::string &, const std::string &);
typedef void (* AddSymPtr) (PaludisTarExtras * const, const std::string &, const std::string &, const std::string &);
typedef void (* CleanupPtr) (PaludisTarExtras * const);
@@ -141,7 +147,26 @@ TarMerger::prepare_install_under()
void
TarMerger::merge()
{
- _imp->tar = (*TarMergerHandle::get_instance()->init)(stringify(_imp->params.tar_file()));
+ std::string compress;
+
+ switch (_imp->params.compression())
+ {
+ case tmc_none:
+ compress = "none";
+ break;
+
+ case tmc_bz2:
+ compress = "bz2";
+ break;
+
+ case last_tmc:
+ break;
+ };
+
+ if (compress.empty())
+ throw InternalError(PALUDIS_HERE, "unknown compress");
+
+ _imp->tar = (*TarMergerHandle::get_instance()->init)(stringify(_imp->params.tar_file()), compress);
try
{