aboutsummaryrefslogtreecommitdiff
path: root/paludis
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-26 18:14:50 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-27 00:32:35 +0000
commit886656d70bf93fcf4c0246615ab94da42fb5cf3a (patch)
treed393f85fc1058790cb28e0a6e19b950ab870752a /paludis
parentbe1e9faa417d59f0948ef963fda48df3c24fcb65 (diff)
downloadpaludis-886656d70bf93fcf4c0246615ab94da42fb5cf3a.tar.gz
paludis-886656d70bf93fcf4c0246615ab94da42fb5cf3a.tar.xz
Repository::sync_host_key
Diffstat (limited to 'paludis')
-rw-r--r--paludis/repositories/accounts/accounts_repository.cc6
-rw-r--r--paludis/repositories/accounts/accounts_repository.hh1
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc6
-rw-r--r--paludis/repositories/cran/cran_installed_repository.hh1
-rw-r--r--paludis/repositories/cran/cran_repository.cc12
-rw-r--r--paludis/repositories/cran/cran_repository.hh1
-rw-r--r--paludis/repositories/e/e_repository.cc10
-rw-r--r--paludis/repositories/e/e_repository.hh1
-rw-r--r--paludis/repositories/e/exndbam_repository.cc6
-rw-r--r--paludis/repositories/e/exndbam_repository.hh1
-rw-r--r--paludis/repositories/e/vdb_repository.cc6
-rw-r--r--paludis/repositories/e/vdb_repository.hh1
-rw-r--r--paludis/repositories/fake/fake_installed_repository.cc6
-rw-r--r--paludis/repositories/fake/fake_installed_repository.hh1
-rw-r--r--paludis/repositories/fake/fake_repository.cc6
-rw-r--r--paludis/repositories/fake/fake_repository.hh1
-rw-r--r--paludis/repositories/gems/gems_repository.cc6
-rw-r--r--paludis/repositories/gems/gems_repository.hh1
-rw-r--r--paludis/repositories/gems/installed_gems_repository.cc6
-rw-r--r--paludis/repositories/gems/installed_gems_repository.hh1
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.cc10
-rw-r--r--paludis/repositories/unavailable/unavailable_repository.hh1
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc6
-rw-r--r--paludis/repositories/unpackaged/installed_repository.hh1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.cc6
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository.hh1
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.cc10
-rw-r--r--paludis/repositories/unwritten/unwritten_repository.hh1
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.cc6
-rw-r--r--paludis/repositories/virtuals/installed_virtuals_repository.hh1
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc6
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.hh1
-rw-r--r--paludis/repository.hh11
-rw-r--r--paludis/util/extract_host_from_url-fwd.hh38
-rw-r--r--paludis/util/extract_host_from_url.cc43
-rw-r--r--paludis/util/extract_host_from_url.hh30
-rw-r--r--paludis/util/extract_host_from_url_TEST.cc41
-rw-r--r--paludis/util/files.m41
38 files changed, 293 insertions, 1 deletions
diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc
index ec80a9ab8..af15ca74d 100644
--- a/paludis/repositories/accounts/accounts_repository.cc
+++ b/paludis/repositories/accounts/accounts_repository.cc
@@ -265,6 +265,12 @@ AccountsRepository::installed_root_key() const
return _imp->installed_root_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+AccountsRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
void
AccountsRepository::invalidate()
{
diff --git a/paludis/repositories/accounts/accounts_repository.hh b/paludis/repositories/accounts/accounts_repository.hh
index 60a9c5a20..c2eb767fd 100644
--- a/paludis/repositories/accounts/accounts_repository.hh
+++ b/paludis/repositories/accounts/accounts_repository.hh
@@ -113,6 +113,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\}
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 11edacdee..5dc56bf55 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -561,6 +561,12 @@ CRANInstalledRepository::installed_root_key() const
return _imp->installed_root_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+CRANInstalledRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
void
CRANInstalledRepository::populate_sets() const
{
diff --git a/paludis/repositories/cran/cran_installed_repository.hh b/paludis/repositories/cran/cran_installed_repository.hh
index d7e025d14..08d42e7ee 100644
--- a/paludis/repositories/cran/cran_installed_repository.hh
+++ b/paludis/repositories/cran/cran_installed_repository.hh
@@ -150,6 +150,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name Set methods
///\{
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index c83387aa2..f662393a2 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -46,6 +46,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
+#include <paludis/util/extract_host_from_url.hh>
#include <paludis/output_manager.hh>
#include <paludis/syncer.hh>
#include <paludis/hook.hh>
@@ -82,6 +83,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > builddir_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > library_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_key;
+ std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key;
};
}
@@ -94,7 +96,8 @@ Implementation<CRANRepository>::Implementation(const CRANRepositoryParams & p, c
format_key(new LiteralMetadataValueKey<std::string> ("format", "format", mkt_significant, "cran")),
builddir_key(new LiteralMetadataValueKey<FSEntry> ("builddir", "builddir", mkt_normal, params.builddir())),
library_key(new LiteralMetadataValueKey<FSEntry> ("library", "library", mkt_normal, params.library())),
- sync_key(new LiteralMetadataValueKey<std::string> ("sync", "sync", mkt_normal, params.sync()))
+ sync_key(new LiteralMetadataValueKey<std::string> ("sync", "sync", mkt_normal, params.sync())),
+ sync_host_key(new LiteralMetadataValueKey<std::string> ("sync_host", "sync_host", mkt_internal, extract_host_from_url(params.sync())))
{
}
@@ -135,6 +138,7 @@ CRANRepository::_add_metadata_keys() const
add_metadata_key(_imp->builddir_key);
add_metadata_key(_imp->library_key);
add_metadata_key(_imp->sync_key);
+ add_metadata_key(_imp->sync_host_key);
}
bool
@@ -536,6 +540,12 @@ CRANRepository::installed_root_key() const
return std::tr1::shared_ptr<const MetadataValueKey<FSEntry> >();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+CRANRepository::sync_host_key() const
+{
+ return _imp->sync_host_key;
+}
+
void
CRANRepository::populate_sets() const
{
diff --git a/paludis/repositories/cran/cran_repository.hh b/paludis/repositories/cran/cran_repository.hh
index 093a9b58a..158ee1078 100644
--- a/paludis/repositories/cran/cran_repository.hh
+++ b/paludis/repositories/cran/cran_repository.hh
@@ -155,6 +155,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name Set methods
///\{
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index c92bf03c1..1c66c1fd4 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -69,6 +69,7 @@
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/destringify.hh>
#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/extract_host_from_url.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -252,6 +253,7 @@ namespace paludis
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > accounts_repository_data_location_key;
std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > e_updates_location_key;
std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key;
+ std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key;
std::list<std::tr1::shared_ptr<const MetadataKey> > about_keys;
std::tr1::shared_ptr<EclassMtimes> eclass_mtimes;
@@ -339,6 +341,7 @@ namespace paludis
"binary_keywords", "binary_keywords", mkt_normal, params.binary_keywords())),
accounts_repository_data_location_key(layout->accounts_repository_data_location_key()),
e_updates_location_key(layout->e_updates_location_key()),
+ sync_host_key(new LiteralMetadataValueKey<std::string> ("sync_host", "sync_host", mkt_internal, extract_host_from_url(params.sync()))),
eclass_mtimes(new EclassMtimes(r, params.eclassdirs())),
master_mtime(0)
@@ -544,6 +547,7 @@ ERepository::_add_metadata_keys() const
add_metadata_key(_imp->e_updates_location_key);
if (_imp->accept_keywords_key)
add_metadata_key(_imp->accept_keywords_key);
+ add_metadata_key(_imp->sync_host_key);
std::for_each(_imp->about_keys.begin(), _imp->about_keys.end(), std::tr1::bind(
std::tr1::mem_fn(&ERepository::add_metadata_key), this, std::tr1::placeholders::_1));
@@ -1627,6 +1631,12 @@ ERepository::accept_keywords_key() const
return _imp->accept_keywords_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+ERepository::sync_host_key() const
+{
+ return _imp->sync_host_key;
+}
+
namespace
{
struct Suffixes :
diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh
index 28fd7289f..af0fddfc7 100644
--- a/paludis/repositories/e/e_repository.hh
+++ b/paludis/repositories/e/e_repository.hh
@@ -170,6 +170,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataCollectionKey<Set<std::string> > > info_vars_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index e484a302f..57109ba06 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -279,6 +279,12 @@ ExndbamRepository::installed_root_key() const
return _imp->root_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+ExndbamRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
void
ExndbamRepository::need_keys_added() const
{
diff --git a/paludis/repositories/e/exndbam_repository.hh b/paludis/repositories/e/exndbam_repository.hh
index 8ca9587b6..aa2f6b7e2 100644
--- a/paludis/repositories/e/exndbam_repository.hh
+++ b/paludis/repositories/e/exndbam_repository.hh
@@ -114,6 +114,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name For use by ExndbamID
///\{
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index ab949f8a0..777abe4aa 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -1156,6 +1156,12 @@ VDBRepository::installed_root_key() const
return _imp->root_key;
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+VDBRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
namespace
{
typedef std::map<QualifiedPackageName, QualifiedPackageName> DepRewrites;
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index 47f33266b..f1a682ac7 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -162,6 +162,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc
index 1d2a3a6be..a4b5ce241 100644
--- a/paludis/repositories/fake/fake_installed_repository.cc
+++ b/paludis/repositories/fake/fake_installed_repository.cc
@@ -247,3 +247,9 @@ FakeInstalledRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+FakeInstalledRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/fake/fake_installed_repository.hh b/paludis/repositories/fake/fake_installed_repository.hh
index fc36a3e58..adb76ffa5 100644
--- a/paludis/repositories/fake/fake_installed_repository.hh
+++ b/paludis/repositories/fake/fake_installed_repository.hh
@@ -93,6 +93,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index e2da44103..2572237d3 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -164,3 +164,9 @@ FakeRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+FakeRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index a768d305e..a1fb2f06b 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -87,6 +87,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
};
}
diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc
index fc9badc81..148acb741 100644
--- a/paludis/repositories/gems/gems_repository.cc
+++ b/paludis/repositories/gems/gems_repository.cc
@@ -419,3 +419,9 @@ GemsRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+GemsRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/gems/gems_repository.hh b/paludis/repositories/gems/gems_repository.hh
index e8e3f4f5a..657a46eac 100644
--- a/paludis/repositories/gems/gems_repository.hh
+++ b/paludis/repositories/gems/gems_repository.hh
@@ -92,6 +92,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc
index 26fcbc406..f65689aa5 100644
--- a/paludis/repositories/gems/installed_gems_repository.cc
+++ b/paludis/repositories/gems/installed_gems_repository.cc
@@ -437,3 +437,9 @@ InstalledGemsRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+InstalledGemsRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/gems/installed_gems_repository.hh b/paludis/repositories/gems/installed_gems_repository.hh
index a81a46860..9c80467b8 100644
--- a/paludis/repositories/gems/installed_gems_repository.hh
+++ b/paludis/repositories/gems/installed_gems_repository.hh
@@ -107,6 +107,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc
index c5ad42ada..a136a71a5 100644
--- a/paludis/repositories/unavailable/unavailable_repository.cc
+++ b/paludis/repositories/unavailable/unavailable_repository.cc
@@ -25,6 +25,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/extract_host_from_url.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/syncer.hh>
@@ -54,6 +55,7 @@ namespace paludis
const std::tr1::shared_ptr<LiteralMetadataValueKey<FSEntry> > location_key;
const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_key;
const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_options_key;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_host_key;
const ActiveObjectPtr<DeferredConstructionPtr<
std::tr1::shared_ptr<UnavailableRepositoryStore> > > store;
@@ -68,6 +70,7 @@ namespace paludis
"sync", "sync", mkt_normal, params.sync())),
sync_options_key(new LiteralMetadataValueKey<std::string> (
"sync_options", "sync_options", mkt_normal, params.sync_options())),
+ sync_host_key(new LiteralMetadataValueKey<std::string> ("sync_host", "sync_host", mkt_internal, extract_host_from_url(params.sync()))),
store(DeferredConstructionPtr<std::tr1::shared_ptr<UnavailableRepositoryStore> > (
std::tr1::bind(&make_store, repo, std::tr1::cref(params))))
{
@@ -116,6 +119,7 @@ UnavailableRepository::_add_metadata_keys()
add_metadata_key(_imp->location_key);
add_metadata_key(_imp->sync_key);
add_metadata_key(_imp->sync_options_key);
+ add_metadata_key(_imp->sync_host_key);
}
void
@@ -352,5 +356,11 @@ UnavailableRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+UnavailableRepository::sync_host_key() const
+{
+ return _imp->sync_host_key;
+}
+
template class PrivateImplementationPattern<unavailable_repository::UnavailableRepository>;
diff --git a/paludis/repositories/unavailable/unavailable_repository.hh b/paludis/repositories/unavailable/unavailable_repository.hh
index f4247f17d..99be86da5 100644
--- a/paludis/repositories/unavailable/unavailable_repository.hh
+++ b/paludis/repositories/unavailable/unavailable_repository.hh
@@ -77,6 +77,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
virtual bool has_category_named(const CategoryNamePart & c) const;
virtual bool has_package_named(const QualifiedPackageName & q) const;
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 9d3362841..aad70c44a 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -500,3 +500,9 @@ InstalledUnpackagedRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+InstalledUnpackagedRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/unpackaged/installed_repository.hh b/paludis/repositories/unpackaged/installed_repository.hh
index 1d98ad3de..a2397bd76 100644
--- a/paludis/repositories/unpackaged/installed_repository.hh
+++ b/paludis/repositories/unpackaged/installed_repository.hh
@@ -108,6 +108,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc
index 320128f2d..1c5e03c49 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository.cc
@@ -296,3 +296,9 @@ UnpackagedRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+UnpackagedRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/unpackaged/unpackaged_repository.hh b/paludis/repositories/unpackaged/unpackaged_repository.hh
index 0adfb8b24..43a0289a6 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository.hh
+++ b/paludis/repositories/unpackaged/unpackaged_repository.hh
@@ -109,6 +109,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name RepositoryFactory functions
///\{
diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc
index e30a3254e..0f950af6e 100644
--- a/paludis/repositories/unwritten/unwritten_repository.cc
+++ b/paludis/repositories/unwritten/unwritten_repository.cc
@@ -25,6 +25,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/make_named_values.hh>
+#include <paludis/util/extract_host_from_url.hh>
#include <paludis/literal_metadata_key.hh>
#include <paludis/action.hh>
#include <paludis/syncer.hh>
@@ -54,6 +55,7 @@ namespace paludis
const std::tr1::shared_ptr<LiteralMetadataValueKey<FSEntry> > location_key;
const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_key;
const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_options_key;
+ const std::tr1::shared_ptr<LiteralMetadataValueKey<std::string> > sync_host_key;
const ActiveObjectPtr<DeferredConstructionPtr<
std::tr1::shared_ptr<UnwrittenRepositoryStore> > > store;
@@ -68,6 +70,7 @@ namespace paludis
"sync", "sync", mkt_normal, params.sync())),
sync_options_key(new LiteralMetadataValueKey<std::string> (
"sync_options", "sync_options", mkt_normal, params.sync_options())),
+ sync_host_key(new LiteralMetadataValueKey<std::string> ("sync_host", "sync_host", mkt_internal, extract_host_from_url(params.sync()))),
store(DeferredConstructionPtr<std::tr1::shared_ptr<UnwrittenRepositoryStore> > (
std::tr1::bind(&make_store, repo, std::tr1::cref(params))))
{
@@ -116,6 +119,7 @@ UnwrittenRepository::_add_metadata_keys()
add_metadata_key(_imp->location_key);
add_metadata_key(_imp->sync_key);
add_metadata_key(_imp->sync_options_key);
+ add_metadata_key(_imp->sync_host_key);
}
void
@@ -352,5 +356,11 @@ UnwrittenRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+UnwrittenRepository::sync_host_key() const
+{
+ return _imp->sync_host_key;
+}
+
template class PrivateImplementationPattern<unwritten_repository::UnwrittenRepository>;
diff --git a/paludis/repositories/unwritten/unwritten_repository.hh b/paludis/repositories/unwritten/unwritten_repository.hh
index a152cd240..0e7946afc 100644
--- a/paludis/repositories/unwritten/unwritten_repository.hh
+++ b/paludis/repositories/unwritten/unwritten_repository.hh
@@ -76,6 +76,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
virtual bool has_category_named(const CategoryNamePart & c) const;
virtual bool has_package_named(const QualifiedPackageName & q) const;
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc
index 776cff431..8a2e21a0d 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.cc
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc
@@ -395,3 +395,9 @@ InstalledVirtualsRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+InstalledVirtualsRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.hh b/paludis/repositories/virtuals/installed_virtuals_repository.hh
index c4dd5613b..3c0ab9d39 100644
--- a/paludis/repositories/virtuals/installed_virtuals_repository.hh
+++ b/paludis/repositories/virtuals/installed_virtuals_repository.hh
@@ -114,6 +114,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
/* RepositoryDestinationInterface */
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index a4ef5a763..5970e35b4 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -472,3 +472,9 @@ VirtualsRepository::accept_keywords_key() const
return make_null_shared_ptr();
}
+const std::tr1::shared_ptr<const MetadataValueKey<std::string> >
+VirtualsRepository::sync_host_key() const
+{
+ return make_null_shared_ptr();
+}
+
diff --git a/paludis/repositories/virtuals/virtuals_repository.hh b/paludis/repositories/virtuals/virtuals_repository.hh
index 573dc9846..640cef934 100644
--- a/paludis/repositories/virtuals/virtuals_repository.hh
+++ b/paludis/repositories/virtuals/virtuals_repository.hh
@@ -117,6 +117,7 @@ namespace paludis
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > location_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<FSEntry> > installed_root_key() const;
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const;
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const;
///\name Set methods
///\{
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 4ad9ac136..2ebe999bc 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -303,6 +303,17 @@ namespace paludis
*/
virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > accept_keywords_key() const = 0;
+ /**
+ * The sync_host_key, if present, should have a value containing
+ * the host against which a sync will be performed.
+ *
+ * This is used to avoid starting multiple parallel syncs against
+ * the same host.
+ *
+ * \since 0.44
+ */
+ virtual const std::tr1::shared_ptr<const MetadataValueKey<std::string> > sync_host_key() const = 0;
+
///\}
///\name Repository content queries
diff --git a/paludis/util/extract_host_from_url-fwd.hh b/paludis/util/extract_host_from_url-fwd.hh
new file mode 100644
index 000000000..ae77bad4d
--- /dev/null
+++ b/paludis/util/extract_host_from_url-fwd.hh
@@ -0,0 +1,38 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_EXTRACT_HOST_FROM_URL_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_EXTRACT_HOST_FROM_URL_FWD_HH 1
+
+#include <paludis/util/attributes.hh>
+#include <string>
+
+namespace paludis
+{
+ /**
+ * Try to extract the hostname part of a URL.
+ *
+ * Returns an empty string if nothing convincing can be found.
+ *
+ * \since 0.44
+ */
+ std::string extract_host_from_url(const std::string &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
+}
+
+#endif
diff --git a/paludis/util/extract_host_from_url.cc b/paludis/util/extract_host_from_url.cc
new file mode 100644
index 000000000..4f82d520e
--- /dev/null
+++ b/paludis/util/extract_host_from_url.cc
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/extract_host_from_url.hh>
+#include <paludis/util/simple_parser.hh>
+
+using namespace paludis;
+
+std::string
+paludis::extract_host_from_url(const std::string & h)
+{
+ std::string result;
+ SimpleParser parser(h);
+
+ if (! parser.consume(+simple_parser::any_except(":")))
+ return "";
+ if (! parser.consume(+simple_parser::exact("://")))
+ return "";
+
+ if (parser.consume(+simple_parser::any_except("/") >> result))
+ return result;
+ else if (parser.consume(+simple_parser::any_except("") >> result))
+ return result;
+ else
+ return result;
+}
+
diff --git a/paludis/util/extract_host_from_url.hh b/paludis/util/extract_host_from_url.hh
new file mode 100644
index 000000000..a59e3c708
--- /dev/null
+++ b/paludis/util/extract_host_from_url.hh
@@ -0,0 +1,30 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_UTIL_EXTRACT_HOST_FROM_URL_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_EXTRACT_HOST_FROM_URL_HH 1
+
+#include <paludis/util/extract_host_from_url-fwd.hh>
+
+namespace paludis
+{
+
+}
+
+#endif
diff --git a/paludis/util/extract_host_from_url_TEST.cc b/paludis/util/extract_host_from_url_TEST.cc
new file mode 100644
index 000000000..ad3e90319
--- /dev/null
+++ b/paludis/util/extract_host_from_url_TEST.cc
@@ -0,0 +1,41 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2009 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
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/util/extract_host_from_url.hh>
+#include <test/test_runner.hh>
+#include <test/test_framework.hh>
+
+using namespace paludis;
+using namespace test;
+
+namespace test_cases
+{
+ struct TestExtractHostFromURL : TestCase
+ {
+ TestExtractHostFromURL() : TestCase("extract host from url") { }
+
+ void run()
+ {
+ TEST_CHECK_EQUAL(extract_host_from_url(""), "");
+ TEST_CHECK_EQUAL(extract_host_from_url("http://foo"), "foo");
+ TEST_CHECK_EQUAL(extract_host_from_url("http://foo/bar"), "foo");
+ TEST_CHECK_EQUAL(extract_host_from_url("http://foo/bar/baz"), "foo");
+ }
+ } test_extract_host_from_url;
+}
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 6a8404353..480941548 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -27,6 +27,7 @@ add(`dir_iterator', `hh', `cc', `fwd', `se', `test', `tests
add(`discard_output_stream', `hh', `cc')
add(`enum_iterator', `hh', `cc', `fwd', `test')
add(`exception', `hh', `cc')
+add(`extract_host_from_url', `hh', `cc', `fwd', `test')
add(`fast_unique_copy', `hh', `test')
add(`forward_parallel_for_each', `hh', `test')
add(`fs_entry', `hh', `cc', `fwd', `test', `testscript')