aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/e/vdb_merger.cc60
-rw-r--r--paludis/repositories/e/vdb_merger.hh9
-rw-r--r--paludis/repositories/unpackaged/ndbam_merger.cc61
-rw-r--r--paludis/repositories/unpackaged/ndbam_merger.hh9
4 files changed, 117 insertions, 22 deletions
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 796e9cf9e..b6882aeb3 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -27,6 +27,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/options.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/util/md5.hh>
@@ -112,7 +113,7 @@ VDBMerger::extend_hook(const Hook & h)
}
void
-VDBMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name)
+VDBMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / dst_name).strip_leading(_imp->realroot))),
tidy_real(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
@@ -124,7 +125,7 @@ VDBMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, con
MD5 md5(infile);
- std::string line(">>> [obj] " + tidy_real);
+ std::string line(make_arrows(flags) + " [obj] " + tidy_real);
if (tidy_real != tidy)
line.append(" (" + FSEntry(tidy).basename() + ")");
display_override(line);
@@ -133,22 +134,22 @@ VDBMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, con
}
void
-VDBMerger::record_install_dir(const FSEntry & src, const FSEntry & dst_dir)
+VDBMerger::record_install_dir(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
- display_override(">>> [dir] " + tidy);
+ display_override(make_arrows(flags) + " [dir] " + tidy);
*_imp->contents_file << "dir " << tidy << std::endl;
}
void
-VDBMerger::record_install_sym(const FSEntry & src, const FSEntry & dst_dir)
+VDBMerger::record_install_sym(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
std::string target((dst_dir / src.basename()).readlink());
time_t timestamp((dst_dir / src.basename()).mtime());
- display_override(">>> [sym] " + tidy);
+ display_override(make_arrows(flags) + " [sym] " + tidy);
*_imp->contents_file << "sym " << tidy << " -> " << target << " " << timestamp << std::endl;
}
@@ -295,3 +296,48 @@ VDBMerger::display_override(const std::string & message) const
std::cout << message << std::endl;
}
+std::string
+VDBMerger::make_arrows(const MergeStatusFlags & flags) const
+{
+ std::string result(">>>");
+ for (MergeStatusFlag m(static_cast<MergeStatusFlag>(0)), m_end(last_msi) ; m != m_end ;
+ m = static_cast<MergeStatusFlag>(static_cast<long>(m) + 1))
+ {
+ if (! flags[m])
+ continue;
+
+ switch (m)
+ {
+ case msi_unlinked_first:
+ result[0] = '<';
+ continue;
+
+ case msi_used_existing:
+ result[0] = '=';
+ continue;
+
+ case msi_parent_rename:
+ result[1] = '^';
+ continue;
+
+ case msi_rename:
+ result[1] = '-';
+ continue;
+
+ case msi_fixed_ownership:
+ result[2] = '~';
+ continue;
+
+ case msi_setid_bits:
+ result[2] = '*';
+ continue;
+
+ case last_msi:
+ break;
+ }
+ throw InternalError(PALUDIS_HERE, "Unhandled MergeStatusFlag '" + stringify(static_cast<long>(m)) + "'");
+ }
+
+ return result;
+}
+
diff --git a/paludis/repositories/e/vdb_merger.hh b/paludis/repositories/e/vdb_merger.hh
index b5a5896ee..e8bf53b54 100644
--- a/paludis/repositories/e/vdb_merger.hh
+++ b/paludis/repositories/e/vdb_merger.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -42,6 +42,7 @@ namespace paludis
{
private:
void display_override(const std::string &) const;
+ std::string make_arrows(const MergeStatusFlags &) const;
public:
///\name Basic operations
@@ -54,9 +55,9 @@ namespace paludis
virtual Hook extend_hook(const Hook &);
- virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &);
- virtual void record_install_dir(const FSEntry &, const FSEntry &);
- virtual void record_install_sym(const FSEntry &, const FSEntry &);
+ virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &, const MergeStatusFlags &);
+ virtual void record_install_dir(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
+ virtual void record_install_sym(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
virtual void on_error(bool is_check, const std::string &);
virtual void on_warn(bool is_check, const std::string &);
diff --git a/paludis/repositories/unpackaged/ndbam_merger.cc b/paludis/repositories/unpackaged/ndbam_merger.cc
index a72e96c45..e214847b2 100644
--- a/paludis/repositories/unpackaged/ndbam_merger.cc
+++ b/paludis/repositories/unpackaged/ndbam_merger.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -27,6 +27,7 @@
#include <paludis/util/fs_entry.hh>
#include <paludis/util/strip.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/options.hh>
#include <paludis/hook.hh>
#include <paludis/package_id.hh>
#include <paludis/util/md5.hh>
@@ -138,7 +139,7 @@ namespace
}
void
-NDBAMMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name)
+NDBAMMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / dst_name).strip_leading(_imp->realroot))),
tidy_real(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
@@ -150,7 +151,7 @@ NDBAMMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, c
MD5 md5(infile);
- std::string line(">>> [obj] " + tidy_real);
+ std::string line(make_arrows(flags) + " [obj] " + tidy_real);
if (tidy_real != tidy)
line.append(" (" + FSEntry(tidy).basename() + ")");
display_override(line);
@@ -163,22 +164,22 @@ NDBAMMerger::record_install_file(const FSEntry & src, const FSEntry & dst_dir, c
}
void
-NDBAMMerger::record_install_dir(const FSEntry & src, const FSEntry & dst_dir)
+NDBAMMerger::record_install_dir(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
- display_override(">>> [dir] " + tidy);
+ display_override(make_arrows(flags) + " [dir] " + tidy);
*_imp->contents_file << "type=dir path=" << escape(tidy) << std::endl;
}
void
-NDBAMMerger::record_install_sym(const FSEntry & src, const FSEntry & dst_dir)
+NDBAMMerger::record_install_sym(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
std::string tidy(stringify((dst_dir / src.basename()).strip_leading(_imp->realroot)));
std::string target((dst_dir / src.basename()).readlink());
time_t timestamp((dst_dir / src.basename()).mtime());
- display_override(">>> [sym] " + tidy);
+ display_override(make_arrows(flags) + " [sym] " + tidy);
*_imp->contents_file << "type=sym path=" << escape(tidy);
*_imp->contents_file << " target=" << escape(target);
@@ -263,6 +264,52 @@ NDBAMMerger::make_config_protect_name(const FSEntry & src, const FSEntry & dst)
return result_name;
}
+std::string
+NDBAMMerger::make_arrows(const MergeStatusFlags & flags) const
+{
+ std::string result(">>>");
+ for (MergeStatusFlag m(static_cast<MergeStatusFlag>(0)), m_end(last_msi) ; m != m_end ;
+ m = static_cast<MergeStatusFlag>(static_cast<long>(m) + 1))
+ {
+ if (! flags[m])
+ continue;
+
+ switch (m)
+ {
+ case msi_unlinked_first:
+ result[0] = '<';
+ continue;
+
+ case msi_used_existing:
+ result[0] = '=';
+ continue;
+
+ case msi_parent_rename:
+ result[1] = '^';
+ continue;
+
+ case msi_rename:
+ result[1] = '-';
+ continue;
+
+ case msi_fixed_ownership:
+ result[2] = '~';
+ continue;
+
+ case msi_setid_bits:
+ result[2] = '*';
+ continue;
+
+ case last_msi:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Unhandled MergeStatusFlag '" + stringify(static_cast<long>(m)) + "'");
+ }
+
+ return result;
+}
+
void
NDBAMMerger::merge()
{
diff --git a/paludis/repositories/unpackaged/ndbam_merger.hh b/paludis/repositories/unpackaged/ndbam_merger.hh
index 1c5e023d6..8ef055168 100644
--- a/paludis/repositories/unpackaged/ndbam_merger.hh
+++ b/paludis/repositories/unpackaged/ndbam_merger.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2007 Ciaran McCreesh
+ * Copyright (c) 2007, 2008 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis is free software;
* you can redistribute it and/or modify it under the terms of the GNU General
@@ -35,6 +35,7 @@ namespace paludis
{
private:
void display_override(const std::string &) const;
+ std::string make_arrows(const MergeStatusFlags &) const;
public:
NDBAMMerger(const NDBAMMergerOptions &);
@@ -42,9 +43,9 @@ namespace paludis
virtual Hook extend_hook(const Hook &);
- virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &);
- virtual void record_install_dir(const FSEntry &, const FSEntry &);
- virtual void record_install_sym(const FSEntry &, const FSEntry &);
+ virtual void record_install_file(const FSEntry &, const FSEntry &, const std::string &, const MergeStatusFlags &);
+ virtual void record_install_dir(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
+ virtual void record_install_sym(const FSEntry &, const FSEntry &, const MergeStatusFlags &);
virtual void on_error(bool is_check, const std::string &);
virtual void on_warn(bool is_check, const std::string &);