aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-21 12:39:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-21 12:39:35 +0000
commitf5413106a3cad0840845cc3c7872d7ba94c89798 (patch)
treecdab4dad1d0d942e4e9fba4f7d497a3e9fe9e1c1 /src
parent1405839232f739083b5c84d6587730804d83a934 (diff)
downloadpaludis-f5413106a3cad0840845cc3c7872d7ba94c89798.tar.gz
paludis-f5413106a3cad0840845cc3c7872d7ba94c89798.tar.xz
New pluggable syncer code. Add a new darcs syncer. From David Leverton. Fixes: ticket:32
Diffstat (limited to 'src')
-rw-r--r--src/clients/paludis/Makefile.am2
-rw-r--r--src/clients/paludis/applets.cc31
-rwxr-xr-xsrc/clients/paludis/list_sync_formats_TEST3
-rw-r--r--src/clients/paludis/paludis.cc16
4 files changed, 37 insertions, 15 deletions
diff --git a/src/clients/paludis/Makefile.am b/src/clients/paludis/Makefile.am
index 37b84f3..7aa62da 100644
--- a/src/clients/paludis/Makefile.am
+++ b/src/clients/paludis/Makefile.am
@@ -81,7 +81,7 @@ TESTS_ENVIRONMENT = env \
SYSCONFDIR="$(sysconfdir)" \
bash $(top_srcdir)/test/run_test.sh bash
-TESTS = version_TEST help_TEST list_sync_formats_TEST \
+TESTS = version_TEST help_TEST \
list_repository_formats_TEST list_dep_tag_categories_TEST \
exception_TEST install_TEST upgrade_TEST args_from_environment_TEST
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 163c0e7..17b578b 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -25,6 +25,8 @@
#include <paludis/paludis.hh>
#include <paludis/util/log.hh>
#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/tokeniser.hh>
#include <paludis/environment/default/default_environment.hh>
#include <paludis/repositories/repository_maker.hh>
#include <string>
@@ -185,10 +187,33 @@ int do_list_repository_formats()
int do_list_sync_protocols()
{
- int return_code(1);
-
std::set<std::string> keys;
- SyncerMaker::get_instance()->copy_keys(std::inserter(keys, keys.begin()));
+
+ Environment * const env(DefaultEnvironment::get_instance());
+ std::list<std::string> syncers_dirs;
+ WhitespaceTokeniser::get_instance()->tokenise(env->syncers_dirs(),
+ std::back_inserter(syncers_dirs));
+
+ for (std::list<std::string>::const_iterator d(syncers_dirs.begin()),
+ d_end(syncers_dirs.end()) ; d != d_end ; ++d)
+ {
+ FSEntry dir(*d);
+ if (! dir.is_directory())
+ continue;
+
+ for (DirIterator f(dir), f_end; f != f_end; ++f)
+ {
+ std::string name(f->basename());
+ if (f->has_permission(fs_ug_owner, fs_perm_execute) &&
+ 0 == name.compare(0, 2, "do", 0, 2))
+ {
+ name.erase(0, 2);
+ keys.insert(name);
+ }
+ }
+ }
+
+ int return_code(1);
if (! keys.empty())
{
diff --git a/src/clients/paludis/list_sync_formats_TEST b/src/clients/paludis/list_sync_formats_TEST
deleted file mode 100755
index f638b22..0000000
--- a/src/clients/paludis/list_sync_formats_TEST
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-PALUDIS_SKIP_CONFIG=yes ./paludis --list-sync-protocols
diff --git a/src/clients/paludis/paludis.cc b/src/clients/paludis/paludis.cc
index ea96575..bf32fe2 100644
--- a/src/clients/paludis/paludis.cc
+++ b/src/clients/paludis/paludis.cc
@@ -253,14 +253,6 @@ main(int argc, char *argv[])
/* these actions don't need DefaultConfig or paludis_command. */
- if (CommandLine::get_instance()->a_list_sync_protocols.specified())
- {
- if (! CommandLine::get_instance()->empty())
- throw args::DoHelp("list-sync-protocols action takes no parameters");
-
- return do_list_sync_protocols();
- }
-
if (CommandLine::get_instance()->a_list_repository_formats.specified())
{
if (! CommandLine::get_instance()->empty())
@@ -331,6 +323,14 @@ main(int argc, char *argv[])
throw args::DoHelp("resume-command-template must contain at least XXXXXX");
}
+ if (CommandLine::get_instance()->a_list_sync_protocols.specified())
+ {
+ if (! CommandLine::get_instance()->empty())
+ throw args::DoHelp("list-sync-protocols action takes no parameters");
+
+ return do_list_sync_protocols();
+ }
+
if (CommandLine::get_instance()->a_info.specified())
{
display_version();