aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-03 12:33:23 +0000
committerAvatar Fernando J. Pereda <ferdy@ferdyx.org> 2008-06-03 12:33:23 +0000
commit668e1ee4f97e9a571db84a146a39928447462423 (patch)
tree3a62cdc9dceecb79efc5db137038c1ef92f69357
parent6eebef2db35080b511e21754c0e0f39740a1405a (diff)
downloadpaludis-668e1ee4f97e9a571db84a146a39928447462423.tar.gz
paludis-668e1ee4f97e9a571db84a146a39928447462423.tar.xz
Make Stripper aware of hardlinks. Fixes ticket:588
-rw-r--r--paludis/stripper.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/paludis/stripper.cc b/paludis/stripper.cc
index 791baf7..5333a5e 100644
--- a/paludis/stripper.cc
+++ b/paludis/stripper.cc
@@ -26,20 +26,25 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/system.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/hashes.hh>
#include <tr1/functional>
#include <sstream>
#include <list>
+#include <set>
#include <algorithm>
#include <sys/stat.h>
using namespace paludis;
+typedef std::set<std::pair<dev_t, ino_t> > StrippedSet;
+
namespace paludis
{
template <>
struct Implementation<Stripper>
{
StripperOptions options;
+ StrippedSet stripped_ids;
Implementation(const StripperOptions & o) :
options(o)
@@ -82,6 +87,8 @@ Stripper::do_dir_recursive(const FSEntry & f)
{
if (d->is_symbolic_link())
continue;
+ if (_imp->stripped_ids.end() != _imp->stripped_ids.find(d->lowlevel_id()))
+ continue;
if (d->is_directory())
do_dir_recursive(*d);
@@ -135,6 +142,7 @@ Stripper::do_strip(const FSEntry & f, const std::string & options)
on_strip(f);
if (0 != run_command(Command("strip " + options + " '" + stringify(f) + "'")))
Log::get_instance()->message("strip.failure", ll_warning, lc_context) << "Couldn't strip '" << f << "'";
+ _imp->stripped_ids.insert(f.lowlevel_id());
}
void