aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 19:14:38 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-05-01 19:14:38 +0000
commit48334501972cb8a1028a5e8bdb49657273587a89 (patch)
tree34409eee77ad879700f87b2107d34a9cca16540c
parent9fe4e7efb84521ce4e30a89f687379bd2c1ecceb (diff)
downloadpaludis-48334501972cb8a1028a5e8bdb49657273587a89.tar.gz
paludis-48334501972cb8a1028a5e8bdb49657273587a89.tar.xz
Add file package sets to Portage format repos. Fixes Paludis#FR2184.
-rw-r--r--paludis/portage_repository.cc56
-rw-r--r--paludis/portage_repository.hh2
-rw-r--r--paludis/util/smart_record.hh.m42
3 files changed, 59 insertions, 1 deletions
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 3caf77a..f66a91c 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -131,6 +131,9 @@ namespace paludis
/// Distfiles dir
FSEntry distdir;
+ /// Sets dir
+ FSEntry setsdir;
+
/// Sync URL
std::string sync;
@@ -230,6 +233,7 @@ Implementation<PortageRepository>::Implementation(const PortageRepositoryParams
cache(p.get<prpk_cache>()),
eclassdir(p.get<prpk_eclassdir>()),
distdir(p.get<prpk_distdir>()),
+ setsdir(p.get<prpk_setsdir>()),
sync(p.get<prpk_sync>()),
sync_exclude(p.get<prpk_sync_exclude>()),
root(p.get<prpk_root>()),
@@ -445,6 +449,7 @@ PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
_info.insert(std::make_pair(std::string("cache"), stringify(_imp->cache)));
_info.insert(std::make_pair(std::string("eclassdir"), stringify(_imp->eclassdir)));
_info.insert(std::make_pair(std::string("distdir"), stringify(_imp->distdir)));
+ _info.insert(std::make_pair(std::string("setsdir"), stringify(_imp->setsdir)));
_info.insert(std::make_pair(std::string("format"), std::string("portage")));
_info.insert(std::make_pair(std::string("root"), stringify(_imp->root)));
if (! _imp->sync.empty())
@@ -1046,6 +1051,10 @@ PortageRepository::make_portage_repository(
if (m.end() == m.find("distdir") || ((distdir = m.find("distdir")->second)).empty())
distdir = location + "/distfiles";
+ std::string setsdir;
+ if (m.end() == m.find("setsdir") || ((setsdir = m.find("setsdir")->second)).empty())
+ setsdir = location + "/sets";
+
std::string cache;
if (m.end() == m.find("cache") || ((cache = m.find("cache")->second)).empty())
cache = location + "/metadata/cache";
@@ -1070,6 +1079,7 @@ PortageRepository::make_portage_repository(
param<prpk_cache>(cache),
param<prpk_eclassdir>(eclassdir),
param<prpk_distdir>(distdir),
+ param<prpk_setsdir>(setsdir),
param<prpk_sync>(sync),
param<prpk_sync_exclude>(sync_exclude),
param<prpk_root>(root)))));
@@ -1548,6 +1558,52 @@ PortageRepository::do_package_set(const std::string & s) const
{
return do_security_set();
}
+ else if ((_imp->setsdir / (s + ".conf")).exists())
+ {
+ FSEntry ff(_imp->setsdir / (s + ".conf"));
+ Context context("When loading package set '" + s + "' from '" + stringify(ff) + "':");
+
+ AllDepAtom::Pointer result(new AllDepAtom);
+ LineConfigFile f(ff);
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+
+ for (LineConfigFile::Iterator line(f.begin()), line_end(f.end()) ;
+ line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ tokeniser.tokenise(*line, std::back_inserter(tokens));
+ if (tokens.empty())
+ continue;
+
+ if (1 == tokens.size())
+ {
+ Log::get_instance()->message(ll_warning, "Line '" + *line + "' in set file '"
+ + stringify(ff) + "' does not specify '*' or '?', assuming '*'");
+ result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(0))));
+ }
+ else if ("*" == tokens.at(0))
+ {
+ result->add_child(PackageDepAtom::Pointer(new PackageDepAtom(tokens.at(1))));
+ }
+ else if ("?" == tokens.at(0))
+ {
+ PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
+ if (! _imp->env->package_database()->query(
+ PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
+ is_installed_only)->empty())
+ result->add_child(p);
+ }
+ else
+ Log::get_instance()->message(ll_warning, "Line '" + *line + "' in set file '"
+ + stringify(ff) + "' does not start with '*' or '?' token, skipping");
+
+ if (tokens.size() > 2)
+ Log::get_instance()->message(ll_warning, "Line '" + *line + "' in set file '"
+ + stringify(ff) + "' has trailing garbage");
+ }
+
+ return result;
+ }
else
return DepAtom::Pointer(0);
}
diff --git a/paludis/portage_repository.hh b/paludis/portage_repository.hh
index 7600ad2..d73d078 100644
--- a/paludis/portage_repository.hh
+++ b/paludis/portage_repository.hh
@@ -52,6 +52,7 @@ namespace paludis
prpk_cache,
prpk_distdir,
prpk_eclassdir,
+ prpk_setsdir,
prpk_sync,
prpk_sync_exclude,
prpk_root,
@@ -74,6 +75,7 @@ namespace paludis
SmartRecordKey<prpk_cache, const FSEntry>,
SmartRecordKey<prpk_distdir, const FSEntry>,
SmartRecordKey<prpk_eclassdir, const FSEntry>,
+ SmartRecordKey<prpk_setsdir, const FSEntry>,
SmartRecordKey<prpk_sync, const std::string>,
SmartRecordKey<prpk_sync_exclude, const std::string>,
SmartRecordKey<prpk_root, const FSEntry>
diff --git a/paludis/util/smart_record.hh.m4 b/paludis/util/smart_record.hh.m4
index dd00309..6dcfbee 100644
--- a/paludis/util/smart_record.hh.m4
+++ b/paludis/util/smart_record.hh.m4
@@ -20,7 +20,7 @@ dnl vim: set ft=cpp et sw=4 sts=4 :
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-define(`max_record_size', `10')
+define(`max_record_size', `12')
define(`forloop', `pushdef(`$1', `$2')_forloop(`$1', `$2', `$3', `$4')popdef(`$1')')
define(`_forloop', `$4`'ifelse($1, `$3', , `define(`$1', incr($1))_forloop(`$1', `$2', `$3', `$4')')')
#endif