aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-11 16:35:12 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-11 16:35:12 +0000
commit7aa27f82fbef6c873b1a92012fd6f95610fc48bb (patch)
tree9775bc197a3f91f304208e7d26431fcd030c018a
parent19c30061351a6e2fbc07197a23483a873fceac2b (diff)
downloadpaludis-7aa27f82fbef6c873b1a92012fd6f95610fc48bb.tar.gz
paludis-7aa27f82fbef6c873b1a92012fd6f95610fc48bb.tar.xz
Stop using smart_record, start using sr
-rw-r--r--Makefile.am1
-rwxr-xr-xautogen.bash1
-rw-r--r--ebuild/utils/merge.cc38
-rw-r--r--misc/Makefile.am2
-rwxr-xr-xmisc/make_sr.bash500
-rw-r--r--paludis/Makefile.am.m420
-rw-r--r--paludis/default_config.cc3
-rw-r--r--paludis/default_config.hh79
-rw-r--r--paludis/default_environment.cc54
-rw-r--r--paludis/dep_list.cc124
-rw-r--r--paludis/dep_list.hh42
-rw-r--r--paludis/dep_list_TEST.cc187
-rw-r--r--paludis/dep_list_entry.sr16
-rw-r--r--paludis/ebin.cc92
-rw-r--r--paludis/ebin.hh136
-rw-r--r--paludis/ebin.sr40
-rw-r--r--paludis/ebuild.cc162
-rw-r--r--paludis/ebuild.hh171
-rw-r--r--paludis/ebuild.sr58
-rw-r--r--paludis/environment.cc60
-rw-r--r--paludis/files.m418
-rw-r--r--paludis/hashed_containers.cc6
-rw-r--r--paludis/match_package.cc24
-rw-r--r--paludis/name.cc62
-rw-r--r--paludis/name.hh71
-rw-r--r--paludis/package_database.cc10
-rw-r--r--paludis/package_database.hh1
-rw-r--r--paludis/package_database_entry.hh29
-rw-r--r--paludis/package_database_entry.sr12
-rw-r--r--paludis/qa/Makefile.am.m419
-rw-r--r--paludis/qa/check_result.cc2
-rw-r--r--paludis/qa/create_metadata_check.cc10
-rw-r--r--paludis/qa/dep_any_check.cc14
-rw-r--r--paludis/qa/dep_flags_check.cc40
-rw-r--r--paludis/qa/dep_packages_check.cc12
-rw-r--r--paludis/qa/deps_exist_check.cc20
-rw-r--r--paludis/qa/deps_visible_check.cc22
-rw-r--r--paludis/qa/description_check.cc18
-rw-r--r--paludis/qa/digest_collisions_check.cc27
-rw-r--r--paludis/qa/ebuild_check.cc2
-rw-r--r--paludis/qa/ebuild_check.hh19
-rw-r--r--paludis/qa/ebuild_check.sr10
-rw-r--r--paludis/qa/extract_check.cc12
-rw-r--r--paludis/qa/files.m48
-rw-r--r--paludis/qa/homepage_check.cc10
-rw-r--r--paludis/qa/inherits_check.cc10
-rw-r--r--paludis/qa/iuse_check.cc10
-rw-r--r--paludis/qa/keywords_check.cc12
-rw-r--r--paludis/qa/license_check.cc12
-rw-r--r--paludis/qa/message.cc2
-rw-r--r--paludis/qa/message.hh17
-rw-r--r--paludis/qa/message.sr9
-rw-r--r--paludis/qa/message_TEST.cc4
-rw-r--r--paludis/qa/parse_deps_check.cc14
-rw-r--r--paludis/qa/pdepend_overlap_check.cc14
-rw-r--r--paludis/qa/restrict_check.cc10
-rw-r--r--paludis/qa/slot_check.cc10
-rw-r--r--paludis/qa/src_uri_check.cc18
-rw-r--r--paludis/qualified_package_name.sr15
-rw-r--r--paludis/repositories/cran/Makefile.am33
-rw-r--r--paludis/repositories/cran/cran_description.cc22
-rw-r--r--paludis/repositories/cran/cran_installed_repository.cc62
-rw-r--r--paludis/repositories/cran/cran_installed_repository.hh49
-rw-r--r--paludis/repositories/cran/cran_installed_repository.sr13
-rw-r--r--paludis/repositories/cran/cran_repository.cc88
-rw-r--r--paludis/repositories/cran/cran_repository.hh56
-rw-r--r--paludis/repositories/cran/cran_repository.sr18
-rw-r--r--paludis/repositories/fake/fake_repository.cc50
-rw-r--r--paludis/repositories/fake/fake_repository.hh4
-rw-r--r--paludis/repositories/nothing/Makefile.am21
-rw-r--r--paludis/repositories/nothing/nothing_repository.cc49
-rw-r--r--paludis/repositories/nothing/nothing_repository.hh44
-rw-r--r--paludis/repositories/nothing/nothing_repository.sr14
-rw-r--r--paludis/repositories/portage/Makefile.am19
-rw-r--r--paludis/repositories/portage/make_ebin_repository.cc34
-rw-r--r--paludis/repositories/portage/make_ebuild_repository.cc34
-rw-r--r--paludis/repositories/portage/portage_repository.cc150
-rw-r--r--paludis/repositories/portage/portage_repository.hh17
-rw-r--r--paludis/repositories/portage/portage_repository_TEST.cc8
-rw-r--r--paludis/repositories/portage/portage_repository_ebin_entries.cc193
-rw-r--r--paludis/repositories/portage/portage_repository_ebuild_entries.cc251
-rw-r--r--paludis/repositories/portage/portage_repository_news.cc12
-rw-r--r--paludis/repositories/portage/portage_repository_params.cc8
-rw-r--r--paludis/repositories/portage/portage_repository_params.hh66
-rw-r--r--paludis/repositories/portage/portage_repository_params.sr25
-rw-r--r--paludis/repositories/portage/portage_repository_profile.cc2
-rw-r--r--paludis/repositories/portage/portage_repository_sets.cc28
-rw-r--r--paludis/repositories/vdb/Makefile.am22
-rw-r--r--paludis/repositories/vdb/vdb_repository.cc155
-rw-r--r--paludis/repositories/vdb/vdb_repository.hh55
-rw-r--r--paludis/repositories/vdb/vdb_repository.sr15
-rw-r--r--paludis/repository.cc6
-rw-r--r--paludis/repository.hh218
-rw-r--r--paludis/repository.sr32
-rw-r--r--paludis/repository_config_entry.sr11
-rw-r--r--paludis/syncer.cc6
-rw-r--r--paludis/syncer.hh31
-rw-r--r--paludis/syncer.sr8
-rw-r--r--paludis/tasks/install_task.cc46
-rw-r--r--paludis/tasks/sync_task.cc2
-rw-r--r--paludis/tasks/uninstall_task.cc16
-rw-r--r--paludis/use_config_entry.sr10
-rw-r--r--paludis/util/Makefile.am.m47
-rw-r--r--paludis/util/files.m42
-rw-r--r--paludis/util/smart_record.hh.m4944
-rw-r--r--paludis/util/smart_record_TEST.cc200
-rw-r--r--paludis/util/sr.hh45
-rw-r--r--paludis/version_metadata.cc87
-rw-r--r--paludis/version_metadata.hh240
-rw-r--r--paludis/version_metadata.sr88
-rw-r--r--paludis/version_spec.cc49
-rw-r--r--paludis/version_spec.sr12
-rw-r--r--src/gtkpaludis/browse_tree.cc2
-rw-r--r--src/gtkpaludis/information_tree.cc4
-rw-r--r--src/paludis/applets.cc10
-rw-r--r--src/paludis/contents.cc8
-rw-r--r--src/paludis/install.cc84
-rw-r--r--src/paludis/list.cc10
-rw-r--r--src/paludis/news.cc4
-rw-r--r--src/paludis/owner.cc4
-rw-r--r--src/paludis/query.cc86
-rw-r--r--src/paludis/uninstall.cc8
-rw-r--r--src/qualudis/qualudis.cc6
123 files changed, 2518 insertions, 3806 deletions
diff --git a/Makefile.am b/Makefile.am
index 9dc90c3..11ad007 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,6 +10,7 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-qa
automake-deps-hack.tmp :
make -C paludis/util
make -C paludis/args
+ make -C paludis/qa message-sr.hh
make -C src/paludis paludis.1
make -C src/qualudis qualudis.1
touch $@
diff --git a/autogen.bash b/autogen.bash
index 208093f..823fcad 100755
--- a/autogen.bash
+++ b/autogen.bash
@@ -36,7 +36,6 @@ misc/do_m4.bash paludis/qa/Makefile.am || exit $?
misc/do_m4.bash paludis/qa/qa.hh || exit $?
misc/do_m4.bash paludis/util/util.hh || exit $?
misc/do_m4.bash paludis/util/Makefile.am || exit $?
-misc/do_m4.bash paludis/util/smart_record.hh || exit $?
misc/do_m4.bash hooks/Makefile.am || exit $?
run mkdir -p config
run $(get libtoolize 1.5 ) --copy --force --automake
diff --git a/ebuild/utils/merge.cc b/ebuild/utils/merge.cc
index bc39b4d..3d09697 100644
--- a/ebuild/utils/merge.cc
+++ b/ebuild/utils/merge.cc
@@ -67,22 +67,24 @@ namespace
make_config_protect_name(const FSEntry & name, const FSEntry & file_to_install)
{
int n(0);
+ std::string file_to_install_name(stringify(file_to_install));
- ifstream our_md5_file(stringify(file_to_install).c_str());
+ ifstream our_md5_file(file_to_install_name.c_str());
if (! our_md5_file)
- throw Failure("Could not get md5 for '" + stringify(file_to_install) + "'");
+ throw Failure("Could not get md5 for '" + file_to_install_name + "'");
MD5 our_md5(our_md5_file);
FSEntry result(name);
+ std::string result_name(stringify(name));
while (true)
{
if (! result.exists())
return result;
else if (result.is_regular_file())
{
- ifstream other_md5_file(stringify(result).c_str());
+ ifstream other_md5_file(result_name.c_str());
if (! other_md5_file)
- throw Failure("Could not get md5 for '" + stringify(result) + "'");
+ throw Failure("Could not get md5 for '" + result_name + "'");
MD5 other_md5(other_md5_file);
if (our_md5.hexsum() == other_md5.hexsum())
@@ -93,6 +95,7 @@ namespace
s << std::setw(4) << std::setfill('0') << std::right << n++;
result = FSEntry(stringify(name.dirname() / ("._cfg" + s.str() + "_"
+ name.basename())));
+ result_name = stringify(result);
}
}
@@ -132,10 +135,11 @@ namespace
do_dir(const FSEntry & root, const FSEntry & src_dir,
const FSEntry & dst_dir, ofstream * const contents)
{
- Context context("Installing directory in root '" + stringify(root) + "' from '"
+ std::string root_str(stringify(root)), dst_dir_str(stringify(dst_dir.dirname()));
+
+ Context context("Installing directory in root '" + root_str + "' from '"
+ stringify(src_dir) + "' to '" + stringify(dst_dir) + "':");
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst_dir.dirname()));
if (root_str == "/")
root_str.clear();
if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
@@ -166,10 +170,11 @@ namespace
}
#endif
- FSEntry(dst_dir).mkdir(mode);
- FSEntry(stringify(dst_dir)).chown(src_dir.owner(), src_dir.group());
+ FSEntry dst_dir_copy(dst_dir);
+ dst_dir_copy.mkdir(mode);
+ dst_dir_copy.chown(src_dir.owner(), src_dir.group());
/* the chmod is needed to pick up fancy set*id bits */
- FSEntry(stringify(dst_dir)).chmod(src_dir.permissions());
+ dst_dir_copy.chmod(src_dir.permissions());
}
*contents << "dir " << dst_dir_str.substr(root_str.length()) << "/" <<
@@ -189,10 +194,12 @@ namespace
do_obj(const FSEntry & root, const FSEntry & src,
const FSEntry & dst, ofstream * const contents)
{
- Context context("Installing object in root '" + stringify(root) + "' from '"
+ std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname())),
+ src_str(stringify(src));
+
+ Context context("Installing object in root '" + root_str + "' from '"
+ stringify(src) + "' to '" + stringify(dst) + "':");
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname()));
if (root_str == "/")
root_str.clear();
if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
@@ -207,9 +214,9 @@ namespace
{
FSEntry real_dst(dst);
- FDHolder input_fd(::open(stringify(src).c_str(), O_RDONLY), false);
+ FDHolder input_fd(::open(src_str.c_str(), O_RDONLY), false);
if (-1 == input_fd)
- throw Failure("Cannot read '" + stringify(src) + "'");
+ throw Failure("Cannot read '" + src_str + "'");
if (dst.exists())
{
@@ -272,10 +279,11 @@ namespace
do_sym(const FSEntry & root, const FSEntry & src,
const FSEntry & dst, ofstream * const contents)
{
- Context context("Installing symlink in root '" + stringify(root) + "' from '"
+ std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname()));
+
+ Context context("Installing symlink in root '" + root_str + "' from '"
+ stringify(src) + "' to '" + stringify(dst) + "':");
- std::string root_str(stringify(root)), dst_dir_str(stringify(dst.dirname()));
if (root_str == "/")
root_str.clear();
if (0 != dst_dir_str.compare(0, root_str.length(), root_str))
diff --git a/misc/Makefile.am b/misc/Makefile.am
index ef81f09..27a0c77 100644
--- a/misc/Makefile.am
+++ b/misc/Makefile.am
@@ -1,4 +1,4 @@
CLEANFILES = *~
MAINTAINERCLEANFILES = Makefile.in svn-version-filter-data.bash
-EXTRA_DIST = generated-file.txt svn-version-filter-data.bash.in do_m4.bash
+EXTRA_DIST = generated-file.txt svn-version-filter-data.bash.in do_m4.bash make_sr.bash
diff --git a/misc/make_sr.bash b/misc/make_sr.bash
new file mode 100755
index 0000000..be10a4f
--- /dev/null
+++ b/misc/make_sr.bash
@@ -0,0 +1,500 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et tw=0 :
+
+echo -n "/* vim"
+echo ": set ro : */"
+echo
+echo "/* ******************************************************** */"
+echo "/* THIS IS A GENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY */"
+echo "/* ******************************************************** */"
+echo
+
+what_to_make=${1}
+shift
+
+for src in ${@} ; do
+ if ! source ${src} ; then
+ echo "source ${src} failed" 1>&2
+ exit 7
+ fi
+done
+
+make_const_ref()
+{
+ local x=${@}
+ if [[ "${x%\*}" != "${x}" ]] ; then
+ echo "${@}" const
+ elif [[ "${1#const}" != "${1}" ]] ; then
+ echo "${@}" const "&"
+ else
+ echo const "${@}" "&"
+ fi
+}
+
+set | grep '^make_class_.*() $' | sort -r | \
+while read a ; do
+ a=${a##make_class_}
+ a=${a%% *}
+
+ want_named_args=
+ want_keys=( )
+ want_key_types=( )
+ want_comparison_operators=
+ want_comparison_fields=( )
+
+ extra_constructors()
+ {
+ :
+ }
+
+ extra_methods()
+ {
+ :
+ }
+
+ allow_named_args()
+ {
+ want_named_args=yes
+ }
+
+ key()
+ {
+ want_keys=( "${want_keys[@]}" "$1" )
+ want_key_types=( "${want_key_types[@]}" "$2" )
+ }
+
+ comparison_operators()
+ {
+ want_comparison_operators=$1
+ shift
+ want_comparison_fields=( $@ )
+ }
+
+ make_class_${a}
+
+ if [[ "${want_comparison_fields[0]}" == "all" ]] ; then
+ want_comparison_fields=( ${want_keys[@]} )
+ fi
+
+ extra_constructors()
+ {
+ echo
+ cat
+ }
+
+ extra_methods()
+ {
+ echo
+ cat
+ }
+
+ allow_named_args()
+ {
+ :
+ }
+
+ key()
+ {
+ :
+ }
+
+ comparison_operators()
+ {
+ :
+ }
+
+ if [[ "${what_to_make}" == "--header" ]] ; then
+ echo "class ${a}"
+ echo "{"
+ echo " public:"
+ echo
+ echo " ///\\name Data members"
+ echo " ///\\{"
+ echo
+
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo " ${want_key_types[${k}]} ${want_keys[${k}]};"
+ done
+
+ echo
+ echo " ///\\}"
+ echo
+
+ if [[ -n "${want_comparison_operators}" ]] ; then
+
+ echo " ///\\name Comparison operators"
+ echo " ///\\{"
+ echo
+
+ if [[ "${want_comparison_operators}" == "all" ]] ; then
+ want_comparison_operators=( "==" "!=" "<" ">" "<=" ">=" )
+ echo " int compare (const ${a} & other) const;"
+ elif [[ "${want_comparison_operators}" == "equality" ]] ; then
+ want_comparison_operators=( "==" "!=" )
+ else
+ echo "bad first parameter for comparison_operators" 1>&2
+ exit 1
+ fi
+
+ for (( k = 0 ; k < ${#want_comparison_operators[@]} ; k++ )) ; do
+ echo " bool operator${want_comparison_operators[${k}]} (const ${a} & other) const;"
+ done
+
+ echo
+ echo " ///\\}"
+ echo
+ fi
+
+ echo " ///\\name Basic operations"
+ echo " ///\\{"
+ echo
+
+ echo " ${a}("
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " $(make_const_ref "${want_key_types[${k}]}") value_for_${want_keys[${k}]}"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo " );"
+ echo
+ echo " ${a}(const ${a} & other);"
+ echo
+ echo " const ${a} & operator= (const ${a} & other);"
+ echo
+ echo " ~${a}();"
+
+ make_class_${a}
+
+ echo
+ echo " ///\\}"
+ echo
+
+ if [[ -n "${want_named_args}" ]] ; then
+
+ echo " ///\\name Named argument constructor"
+ echo " ///\\{"
+ echo
+
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ n=${want_keys[${k}]}
+ t=${want_key_types[${k}]}
+ echo " class Param_${n}"
+ echo " {"
+ echo " private:"
+ echo " Param_${n}();"
+ echo
+ echo " public:"
+ echo " $(make_const_ref "${t}" ) ${n};"
+ echo
+ echo " Param_${n}(const Empty &, $(make_const_ref "${t}" ) value_for_${n}) :"
+ echo " ${n}(value_for_${n})"
+ echo " {"
+ echo " }"
+ echo
+ echo " Param_${n}(const Empty &, const Param_${n} & other) :"
+ echo " ${n}(other.${n})"
+ echo " {"
+ echo " }"
+ echo " };"
+ echo
+ echo " template <typename Before_, typename After_>"
+ echo " class ParamNeeded_${n}"
+ echo " {"
+ echo " private:"
+ echo " const Before_ & _before;"
+ echo
+ echo " public:"
+ echo " After_"
+ echo " ${n}($(make_const_ref "${t}" ) value_for_${n})"
+ echo " {"
+ echo " return After_("
+ for (( j = 0 ; j < ${#want_keys[@]} ; j++ )) ; do
+ if [[ ${j} == ${k} ]] ; then
+ echo -n " Param_${n}(_before, value_for_${n})"
+ else
+ echo -n " _before"
+ fi
+ if [[ $(( ${j} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo " );"
+ echo " }"
+ echo
+ echo " ParamNeeded_${n}(const Before_ & before, const Empty &) :"
+ echo " _before(before)"
+ echo " {"
+ echo " }"
+ echo " };"
+ echo
+ done
+
+ echo " template <"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " bool has_${want_keys[${k}]}_"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo " >"
+ echo " class Params :"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo " public Select<has_${want_keys[${k}]}_,"
+ echo " Param_${want_keys[${k}]},"
+ echo " ParamNeeded_${want_keys[${k}]}<"
+ echo -n " Params<"
+ for (( j = 0 ; j < ${#want_keys[@]} ; j++ )) ; do
+ if [[ ${j} == ${k} ]] ; then
+ echo -n "false"
+ else
+ echo -n "has_${want_keys[${j}]}_"
+ fi
+ if [[ $(( ${j} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ else
+ echo ">,"
+ fi
+ done
+ echo -n " Params<"
+ for (( j = 0 ; j < ${#want_keys[@]} ; j++ )) ; do
+ if [[ ${j} == ${k} ]] ; then
+ echo -n "true"
+ else
+ echo -n "has_${want_keys[${j}]}_"
+ fi
+ if [[ $(( ${j} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ else
+ echo "> >"
+ fi
+ done
+ echo " >::Type,"
+ done
+ echo " public Empty"
+ echo " {"
+ echo " private:"
+ echo " Params();"
+ echo
+ echo " public:"
+ echo " Params("
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ n=${want_keys[${k}]}
+ echo -n " "
+ echo -n "const typename Select<has_${n}_, Param_${n}, Empty>::Type & value_for_${n}"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo " ) :"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo " Select<has_${want_keys[${k}]}_,"
+ echo " Param_${want_keys[${k}]},"
+ echo " ParamNeeded_${want_keys[${k}]}<"
+ echo -n " Params<"
+ for (( j = 0 ; j < ${#want_keys[@]} ; j++ )) ; do
+ if [[ ${j} == ${k} ]] ; then
+ echo -n "false"
+ else
+ echo -n "has_${want_keys[${j}]}_"
+ fi
+ if [[ $(( ${j} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ else
+ echo ">,"
+ fi
+ done
+ echo -n " Params<"
+ for (( j = 0 ; j < ${#want_keys[@]} ; j++ )) ; do
+ if [[ ${j} == ${k} ]] ; then
+ echo -n "true"
+ else
+ echo -n "has_${want_keys[${j}]}_"
+ fi
+ if [[ $(( ${j} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ else
+ echo "> >"
+ fi
+ done
+ echo " >::Type(*this, value_for_${want_keys[${k}]}),"
+ done
+
+ echo " Empty()"
+ echo " {"
+ echo " }"
+ echo
+ echo " operator ${a} () const"
+ echo " {"
+ echo " return ${a}("
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " this->${want_keys[${k}]}"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ", "
+ else
+ echo
+ fi
+ done
+
+ echo " );"
+ echo " }"
+ echo
+ echo " };"
+ echo
+
+ echo -n " static Params<"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n "false"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ fi
+ done
+ echo "> create();"
+
+ echo " ///\\}"
+ echo
+ fi
+
+ echo "};"
+
+ elif [[ "${what_to_make}" == "--source" ]] ; then
+
+ echo "${a}::${a}("
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " $(make_const_ref "${want_key_types[${k}]}") value_for_${want_keys[${k}]}"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo ") :"
+ fi
+ done
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " ${want_keys[${k}]}(value_for_${want_keys[${k}]})"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo "{"
+ echo "}"
+ echo
+
+ echo "${a}::${a}(const ${a} & other) :"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n " ${want_keys[${k}]}(other.${want_keys[${k}]})"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo ","
+ else
+ echo
+ fi
+ done
+ echo "{"
+ echo "}"
+ echo
+
+ echo "const ${a} &"
+ echo "${a}::operator= (const ${a} & other)"
+ echo "{"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo " ${want_keys[${k}]} = other.${want_keys[${k}]};"
+ done
+ echo " return *this;"
+ echo "}"
+
+ echo "${a}::~${a}()"
+ echo "{"
+ echo "}"
+ echo
+
+ if [[ -n "${want_comparison_operators}" ]] ; then
+
+ if [[ "${want_comparison_operators}" == "all" ]] ; then
+ want_comparison_operators=( "==" "!=" "<" ">" "<=" ">=" )
+ echo "int"
+ echo "${a}::compare(const ${a} & other) const"
+ echo "{"
+ for (( k = 0 ; k < ${#want_comparison_fields[@]} ; k++ )) ; do
+ echo " if (${want_comparison_fields[${k}]} < other.${want_comparison_fields[${k}]})"
+ echo " return -1;"
+ echo " if (${want_comparison_fields[${k}]} > other.${want_comparison_fields[${k}]})"
+ echo " return 1;"
+ done
+ echo " return 0;"
+ echo "}"
+ echo
+ for (( k = 0 ; k < ${#want_comparison_operators[@]} ; k++ )) ; do
+ echo "bool"
+ echo "${a}::operator${want_comparison_operators[${k}]} (const ${a} & other) const"
+ echo "{"
+ echo " return compare(other) ${want_comparison_operators[${k}]} 0;"
+ echo "}"
+ echo
+ done
+ elif [[ "${want_comparison_operators}" == "equality" ]] ; then
+ echo "bool"
+ echo "${a}::operator== (const ${a} & other) const"
+ echo "{"
+ for (( k = 0 ; k < ${#want_comparison_fields[@]} ; k++ )) ; do
+ echo " if (${want_comparison_fields[${k}]} != other.${want_comparison_fields[${k}]})"
+ echo " return false;"
+ done
+ echo " return true;"
+ echo "}"
+ echo
+ echo "bool"
+ echo "${a}::operator!= (const ${a} & other) const"
+ echo "{"
+ echo " return ! operator== (other);"
+ echo "}"
+ echo
+ else
+ echo "bad first parameter for comparison_operators" 1>&2
+ exit 1
+ fi
+ fi
+
+ if [[ -n "${want_named_args}" ]] ; then
+
+ echo -n "${a}::Params<"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n "false"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ fi
+ done
+ echo ">"
+ echo "${a}::create()"
+ echo "{"
+ echo " return Params<"
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n "false"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ fi
+ done
+ echo -n ">("
+ for (( k = 0 ; k < ${#want_keys[@]} ; k++ )) ; do
+ echo -n "Empty()"
+ if [[ $(( ${k} + 1 )) -lt ${#want_keys[@]} ]] ; then
+ echo -n ", "
+ fi
+ done
+ echo ");"
+ echo "}"
+ fi
+
+ else
+ echo "bad argument (expected --header or --source)" 1>&2
+ exit 1
+ fi
+done
+
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 91ae584..6705d31 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -6,6 +6,9 @@ dnl vim: set ft=m4 noet :
define(`filelist', `')dnl
define(`testlist', `')dnl
define(`headerlist', `')dnl
+define(`srlist', `')dnl
+define(`srcleanlist', `')dnl
+define(`srheaderlist', `')dnl
define(`testscriptlist', `')dnl
define(`addtest', `define(`testlist', testlist `$1_TEST')dnl
$1_TEST_SOURCES = $1_TEST.cc
@@ -24,10 +27,21 @@ define(`addhh', `define(`filelist', filelist `$1.hh')define(`headerlist', header
define(`addhhx', `define(`filelist', filelist `$1.hh')')dnl
define(`addcc', `define(`filelist', filelist `$1.cc')')dnl
define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl
+define(`addsr', `define(`srlist', srlist `$1.sr')dnl
+define(`srcleanlist', srcleanlist `$1-sr.hh $1-sr.cc')dnl
+define(`srheaderlist', srheaderlist `$1-sr.hh')dnl
+$1-sr.hh : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $`'(srcdir)/$1.sr > $`'@
+
+$1-sr.cc : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $`'(srcdir)/$1.sr > $`'@
+
+')dnl
define(`addthis', `dnl
ifelse(`$2', `hh', `addhh(`$1')', `')dnl
ifelse(`$2', `hhx', `addhhx(`$1')', `')dnl
ifelse(`$2', `cc', `addcc(`$1')', `')dnl
+ifelse(`$2', `sr', `addsr(`$1')', `')dnl
ifelse(`$2', `impl', `addimpl(`$1')', `')dnl
ifelse(`$2', `test', `addtest(`$1')', `')dnl
ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
@@ -39,6 +53,7 @@ include(`paludis/files.m4')
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda ihateautomake.cc ihateautomake.o
MAINTAINERCLEANFILES = Makefile.in Makefile.am about.hh paludis.hh \
hashed_containers.hh
+DISTCLEANFILES = srcleanlist
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
@@ -46,8 +61,9 @@ DEFS= \
-DDATADIR=\"$(datadir)\" \
-DLIBDIR=\"$(libdir)\"
EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 \
- hashed_containers.hh.in testscriptlist
+ hashed_containers.hh.in testscriptlist srlist srcleanlist
SUBDIRS = digests util . repositories args qa selinux tasks
+BUILT_SOURCES = srcleanlist
libpaludis_la_SOURCES = filelist
libpaludis_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
@@ -65,7 +81,7 @@ check_PROGRAMS = $(TESTS)
check_SCRIPTS = testscriptlist
lib_LTLIBRARIES = libpaludis.la
paludis_includedir = $(includedir)/paludis/
-paludis_include_HEADERS = headerlist
+paludis_include_HEADERS = headerlist srheaderlist
Makefile.am : Makefile.am.m4 files.m4
$(top_srcdir)/misc/do_m4.bash Makefile.am
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index 1d16064..b33b6f2 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -46,6 +46,9 @@
using namespace paludis;
+#include <paludis/repository_config_entry-sr.cc>
+#include <paludis/use_config_entry-sr.cc>
+
namespace paludis
{
/**
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index cbb531e..188eb40 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -25,7 +25,7 @@
#include <paludis/util/collection.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/smart_record.hh>
+#include <paludis/util/sr.hh>
#include <string>
@@ -58,81 +58,8 @@ namespace paludis
DefaultConfigError(const std::string & msg) throw ();
};
- /**
- * Keys for RepositoryConfigEntry.
- *
- * \see RepositoryConfigEntry
- *
- * \ingroup grpdefaultconfig
- */
- enum RepositoryConfigEntryKeys
- {
- rce_format, ///< Our format
- rce_importance, ///< Our importance, higher being more important
- rce_keys, ///< Our key/value data
- last_rce ///< Number of entries
- };
-
- /**
- * Tag for RepositoryConfigEntry.
- *
- * \see RepositoryConfigEntry
- *
- * \ingroup grpdefaultconfig
- */
- struct RepositoryConfigEntryTag :
- SmartRecordTag<comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<rce_importance> >,
- SmartRecordKeys<RepositoryConfigEntryKeys, last_rce>,
- SmartRecordKey<rce_format, std::string>,
- SmartRecordKey<rce_importance, unsigned>,
- SmartRecordKey<rce_keys, AssociativeCollection<std::string, std::string>::Pointer >
- {
- };
-
- /**
- * Holds an entry in a DefaultConfig's repository configuration data.
- *
- * \ingroup grpdefaultconfig
- */
- typedef MakeSmartRecord<RepositoryConfigEntryTag>::Type RepositoryConfigEntry;
-
- /**
- * Keys for UseConfigEntry.
- *
- * \see UseConfigEntry
- *
- * \ingroup grpdefaultconfig
- */
- enum UseConfigEntryKeys
- {
- uce_dep_atom, ///< A dependency atom
- uce_flag_name, ///< The use flag name
- uce_flag_state ///< The use flag state
- };
-
- /**
- * Tag for UseConfigEntry.
- *
- * \see UseConfigEntry
- *
- * \ingroup grpdefaultconfig
- */
- struct UseConfigEntryTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<UseConfigEntryKeys, 3>,
- SmartRecordKey<uce_dep_atom, PackageDepAtom::ConstPointer>,
- SmartRecordKey<uce_flag_name, UseFlagName>,
- SmartRecordKey<uce_flag_state, UseFlagState>
- {
- };
-
- /**
- * An entry in a DefaultConfig's use configuration data.
- *
- * \ingroup grpdefaultconfig
- */
- typedef MakeSmartRecord<UseConfigEntryTag>::Type UseConfigEntry;
+#include <paludis/repository_config_entry-sr.hh>
+#include <paludis/use_config_entry-sr.hh>
/**
* DefaultConfig is used by DefaultEnvironment to access the user's
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index b3a5d33..726efdd 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -43,8 +43,8 @@ DefaultEnvironment::DefaultEnvironment() :
for (DefaultConfig::RepositoryIterator r(DefaultConfig::get_instance()->begin_repositories()),
r_end(DefaultConfig::get_instance()->end_repositories()) ; r != r_end ; ++r)
package_database()->add_repository(
- RepositoryMaker::get_instance()->find_maker(r->get<rce_format>())(
- this, package_database().raw_pointer(), r->get<rce_keys>()));
+ RepositoryMaker::get_instance()->find_maker(r->format)(
+ this, package_database().raw_pointer(), r->keys));
}
DefaultEnvironment::~DefaultEnvironment()
@@ -56,12 +56,12 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
{
/* first check package database use masks... */
const Repository * const repo((e ?
- package_database()->fetch_repository(e->get<pde_repository>()) :
+ package_database()->fetch_repository(e->repository) :
package_database()->fetch_repository(package_database()->favourite_repository())
).raw_pointer());
- if (repo->get_interface<repo_use>())
- if (repo->get_interface<repo_use>()->query_use_mask(f, e))
+ if (repo->use_interface)
+ if (repo->use_interface->query_use_mask(f, e))
return false;
/* check use: per package user config */
@@ -70,17 +70,17 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
UseFlagState s(use_unspecified);
for (DefaultConfig::UseConfigIterator
- u(DefaultConfig::get_instance()->begin_use_config(e->get<pde_name>())),
- u_end(DefaultConfig::get_instance()->end_use_config(e->get<pde_name>())) ;
+ u(DefaultConfig::get_instance()->begin_use_config(e->name)),
+ u_end(DefaultConfig::get_instance()->end_use_config(e->name)) ;
u != u_end ; ++u)
{
- if (f != u->get<uce_flag_name>())
+ if (f != u->flag_name)
continue;
- if (! match_package(this, *u->get<uce_dep_atom>(), *e))
+ if (! match_package(this, *u->dep_atom, *e))
continue;
- switch (u->get<uce_flag_state>())
+ switch (u->flag_state)
{
case use_enabled:
s = use_enabled;
@@ -142,9 +142,9 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
} while (false);
/* check use: package database config */
- if (repo->get_interface<repo_use>())
+ if (repo->use_interface)
{
- switch (repo->get_interface<repo_use>()->query_use(f, e))
+ switch (repo->use_interface->query_use(f, e))
{
case use_disabled:
case use_unspecified:
@@ -175,8 +175,8 @@ DefaultEnvironment::accept_keyword(const KeywordName & keyword, const PackageDat
if (d)
for (DefaultConfig::PackageKeywordsIterator
- k(DefaultConfig::get_instance()->begin_package_keywords(d->get<pde_name>())),
- k_end(DefaultConfig::get_instance()->end_package_keywords(d->get<pde_name>())) ;
+ k(DefaultConfig::get_instance()->begin_package_keywords(d->name)),
+ k_end(DefaultConfig::get_instance()->end_package_keywords(d->name)) ;
k != k_end ; ++k)
{
if (! match_package(this, k->first, d))
@@ -206,8 +206,8 @@ DefaultEnvironment::accept_license(const std::string & license, const PackageDat
if (d)
for (DefaultConfig::PackageLicensesIterator
- k(DefaultConfig::get_instance()->begin_package_licenses(d->get<pde_name>())),
- k_end(DefaultConfig::get_instance()->end_package_licenses(d->get<pde_name>())) ;
+ k(DefaultConfig::get_instance()->begin_package_licenses(d->name)),
+ k_end(DefaultConfig::get_instance()->end_package_licenses(d->name)) ;
k != k_end ; ++k)
{
if (! match_package(this, k->first, d))
@@ -234,8 +234,8 @@ bool
DefaultEnvironment::query_user_masks(const PackageDatabaseEntry & d) const
{
for (DefaultConfig::UserMasksIterator
- k(DefaultConfig::get_instance()->begin_user_masks(d.get<pde_name>())),
- k_end(DefaultConfig::get_instance()->end_user_masks(d.get<pde_name>())) ;
+ k(DefaultConfig::get_instance()->begin_user_masks(d.name)),
+ k_end(DefaultConfig::get_instance()->end_user_masks(d.name)) ;
k != k_end ; ++k)
{
if (! match_package(this, *k, d))
@@ -251,8 +251,8 @@ bool
DefaultEnvironment::query_user_unmasks(const PackageDatabaseEntry & d) const
{
for (DefaultConfig::UserMasksIterator
- k(DefaultConfig::get_instance()->begin_user_unmasks(d.get<pde_name>())),
- k_end(DefaultConfig::get_instance()->end_user_unmasks(d.get<pde_name>())) ;
+ k(DefaultConfig::get_instance()->begin_user_unmasks(d.name)),
+ k_end(DefaultConfig::get_instance()->end_user_unmasks(d.name)) ;
k != k_end ; ++k)
{
if (! match_package(this, *k, d))
@@ -308,24 +308,24 @@ DefaultEnvironment::query_enabled_use_matching(const std::string & prefix,
if (e)
{
for (DefaultConfig::UseConfigIterator
- u(DefaultConfig::get_instance()->begin_use_config(e->get<pde_name>())),
- u_end(DefaultConfig::get_instance()->end_use_config(e->get<pde_name>())) ;
+ u(DefaultConfig::get_instance()->begin_use_config(e->name)),
+ u_end(DefaultConfig::get_instance()->end_use_config(e->name)) ;
u != u_end ; ++u)
{
- if (0 != u->get<uce_flag_name>().data().compare(0, prefix.length(), prefix))
+ if (0 != u->flag_name.data().compare(0, prefix.length(), prefix))
continue;
- if (! match_package(this, *u->get<uce_dep_atom>(), *e))
+ if (! match_package(this, *u->dep_atom, *e))
continue;
- switch (u->get<uce_flag_state>())
+ switch (u->flag_state)
{
case use_enabled:
- result->insert(u->get<uce_flag_name>());
+ result->insert(u->flag_name);
break;
case use_disabled:
- result->erase(u->get<uce_flag_name>());
+ result->erase(u->flag_name);
break;
case use_unspecified:
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index e882616..5748e63 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -35,11 +35,13 @@
using namespace paludis;
+#include <paludis/dep_list_entry-sr.cc>
+
std::ostream &
paludis::operator<< (std::ostream & s, const DepListEntry & e)
{
- s << e.get<dle_name>() << "-" << e.get<dle_version>() << ":"
- << e.get<dle_metadata>()->get<vm_slot>() << "::" << e.get<dle_repository>();
+ s << e.name << "-" << e.version << ":"
+ << e.metadata->slot << "::" << e.repository;
return s;
}
@@ -166,7 +168,7 @@ namespace
{
bool operator() (const DepListEntry & e) const
{
- return e.get<dle_flags>()[dlef_skip];
+ return e.flags[dlef_skip];
}
};
}
@@ -188,29 +190,29 @@ DepList::add(DepAtom::ConstPointer atom)
_imp->merge_list_insert_pos = _imp->merge_list.end();
while (i != _imp->merge_list.end())
{
- if (! i->get<dle_flags>()[dlef_has_predeps] && ! _imp->drop_all)
+ if (! i->flags[dlef_has_predeps] && ! _imp->drop_all)
throw InternalError(PALUDIS_HERE, "dle_has_predeps not set for " + stringify(*i));
- else if (! i->get<dle_flags>()[dlef_has_trypredeps] && ! _imp->drop_all)
+ else if (! i->flags[dlef_has_trypredeps] && ! _imp->drop_all)
{
Save<const DepListEntry *> save_current_package(
&_imp->current_package, &*i);
_add_in_role(_imp->environment->package_database()->fetch_repository(
- i->get<dle_repository>())->version_metadata(
- i->get<dle_name>(), i->get<dle_version>())->get<vm_deps>().run_depend(),
+ i->repository)->version_metadata(
+ i->name, i->version)->deps.run_depend(),
"runtime dependencies");
- i->get<dle_flags>().set(dlef_has_trypredeps);
+ i->flags.set(dlef_has_trypredeps);
}
- else if (! i->get<dle_flags>()[dlef_has_postdeps] && ! _imp->drop_all)
+ else if (! i->flags[dlef_has_postdeps] && ! _imp->drop_all)
{
Save<const DepListEntry *> save_current_package(
&_imp->current_package, &*i);
_add_in_role(_imp->environment->package_database()->fetch_repository(
- i->get<dle_repository>())->version_metadata(
- i->get<dle_name>(), i->get<dle_version>())->get<vm_deps>().post_depend(),
+ i->repository)->version_metadata(
+ i->name, i->version)->deps.post_depend(),
"post dependencies");
- i->get<dle_flags>().set(dlef_has_postdeps);
+ i->flags.set(dlef_has_postdeps);
}
else
++i;
@@ -362,7 +364,7 @@ DepList::visit(const PackageDepAtom * const p)
DepListEntryMatcher(_imp->environment, *p)))))
{
/* what's our status? */
- if (! i->get<dle_flags>()[dlef_has_predeps])
+ if (! i->flags[dlef_has_predeps])
{
if (! installed->empty())
return;
@@ -371,8 +373,8 @@ DepList::visit(const PackageDepAtom * const p)
{
if (_imp->current_package)
Log::get_instance()->message(ll_warning, lc_context, "Dropping circular dependency on " +
- stringify(_imp->current_package->get<dle_name>()) + "-" +
- stringify(_imp->current_package->get<dle_version>()));
+ stringify(_imp->current_package->name) + "-" +
+ stringify(_imp->current_package->version));
return;
}
@@ -380,8 +382,8 @@ DepList::visit(const PackageDepAtom * const p)
match_package(_imp->environment, p, _imp->current_package))
{
Log::get_instance()->message(ll_warning, lc_context, "Dropping self-circular dependency on " +
- stringify(_imp->current_package->get<dle_name>()) + "-" +
- stringify(_imp->current_package->get<dle_version>()));
+ stringify(_imp->current_package->name) + "-" +
+ stringify(_imp->current_package->version));
return;
}
@@ -390,7 +392,7 @@ DepList::visit(const PackageDepAtom * const p)
}
if (p->tag())
- i->get<dle_tag>()->insert(p->tag());
+ i->tag->insert(p->tag());
return;
}
}
@@ -416,7 +418,7 @@ DepList::visit(const PackageDepAtom * const p)
/// \todo SLOTs?
if ((! _imp->ignore_installed) && ((0 != _imp->current_package) || (! _imp->reinstall)))
if (! installed->empty())
- if (e->get<pde_version>() <= installed->last()->get<pde_version>())
+ if (e->version <= installed->last()->version)
continue;
/* check masks */
@@ -424,7 +426,7 @@ DepList::visit(const PackageDepAtom * const p)
continue;
metadata = _imp->environment->package_database()->fetch_repository(
- e->get<pde_repository>())->version_metadata(e->get<pde_name>(), e->get<pde_version>());
+ e->repository)->version_metadata(e->name, e->version);
match = &*e;
break;
}
@@ -441,15 +443,15 @@ DepList::visit(const PackageDepAtom * const p)
if (_imp->recursive_deps)
{
metadata = _imp->environment->package_database()->fetch_repository(
- installed->last()->get<pde_repository>())->version_metadata(
- installed->last()->get<pde_name>(), installed->last()->get<pde_version>());
+ installed->last()->repository)->version_metadata(
+ installed->last()->name, installed->last()->version);
DepListEntryFlags flags;
flags.set(dlef_has_predeps);
flags.set(dlef_skip);
merge_entry = _imp->merge_list.insert(_imp->merge_list_insert_pos,
- DepListEntry(installed->last()->get<pde_name>(),
- installed->last()->get<pde_version>(), metadata,
- installed->last()->get<pde_repository>(), flags, tags));
+ DepListEntry(installed->last()->name,
+ installed->last()->version, metadata,
+ installed->last()->repository, flags, tags));
}
else
return;
@@ -471,12 +473,12 @@ DepList::visit(const PackageDepAtom * const p)
{
DepListEntryFlags flags;
merge_entry = _imp->merge_list.insert(_imp->merge_list_insert_pos,
- DepListEntry(match->get<pde_name>(), match->get<pde_version>(),
- metadata, match->get<pde_repository>(), flags, tags));
+ DepListEntry(match->name, match->version,
+ metadata, match->repository, flags, tags));
}
/* if we provide things, also insert them. */
- if ((metadata->get_ebuild_interface()) && ! merge_entry->get<dle_flags>()[dlef_skip])
+ if ((metadata->get_ebuild_interface()) && ! merge_entry->flags[dlef_skip])
{
DepAtom::ConstPointer provide(metadata->get_ebuild_interface()->provide());
@@ -485,9 +487,9 @@ DepList::visit(const PackageDepAtom * const p)
if (_imp->current_package)
e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
new PackageDatabaseEntry(
- _imp->current_package->get<dle_name>(),
- _imp->current_package->get<dle_version>(),
- _imp->current_package->get<dle_repository>()));
+ _imp->current_package->name,
+ _imp->current_package->version,
+ _imp->current_package->repository));
DepAtomFlattener f(_imp->environment, e.raw_pointer(), provide);
@@ -500,17 +502,17 @@ DepList::visit(const PackageDepAtom * const p)
continue;
VersionMetadata::Pointer p_metadata(new VersionMetadata::Ebuild(
- merge_entry->get<dle_metadata>()->get<vm_deps>().get<vmd_parser>()));
- p_metadata->set<vm_slot>(merge_entry->get<dle_metadata>()->get<vm_slot>());
- p_metadata->get_ebuild_interface()->set<evm_virtual>(stringify(merge_entry->get<dle_name>()));
+ merge_entry->metadata->deps.parser));
+ p_metadata->slot = merge_entry->metadata->slot;
+ p_metadata->get_ebuild_interface()->virtual_for = stringify(merge_entry->name);
DepListEntryFlags flags;
flags.set(dlef_has_predeps);
flags.set(dlef_has_trypredeps);
flags.set(dlef_has_postdeps);
_imp->merge_list.insert(next(merge_entry),
- DepListEntry(pp.package(), merge_entry->get<dle_version>(),
- p_metadata, merge_entry->get<dle_repository>(), flags,
+ DepListEntry(pp.package(), merge_entry->version,
+ p_metadata, merge_entry->repository, flags,
SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Pointer(
new SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Concrete)));
}
@@ -526,18 +528,18 @@ DepList::visit(const PackageDepAtom * const p)
&*merge_entry);
/* merge depends */
- if ((! merge_entry->get<dle_flags>()[dlef_has_predeps]) && ! (_imp->drop_all))
- _add_in_role(metadata->get<vm_deps>().build_depend(), "build dependencies");
- merge_entry->get<dle_flags>().set(dlef_has_predeps);
+ if ((! merge_entry->flags[dlef_has_predeps]) && ! (_imp->drop_all))
+ _add_in_role(metadata->deps.build_depend(), "build dependencies");
+ merge_entry->flags.set(dlef_has_predeps);
/* merge rdepends */
- if (! merge_entry->get<dle_flags>()[dlef_has_trypredeps] && dlro_always != _imp->rdepend_post
+ if (! merge_entry->flags[dlef_has_trypredeps] && dlro_always != _imp->rdepend_post
&& ! _imp->drop_all)
{
try
{
- _add_in_role(metadata->get<vm_deps>().run_depend(), "runtime dependencies");
- merge_entry->get<dle_flags>().set(dlef_has_trypredeps);
+ _add_in_role(metadata->deps.run_depend(), "runtime dependencies");
+ merge_entry->flags.set(dlef_has_trypredeps);
}
catch (const CircularDependencyError &)
{
@@ -545,8 +547,8 @@ DepList::visit(const PackageDepAtom * const p)
throw;
else if (_imp->current_package)
Log::get_instance()->message(ll_warning, lc_context, "Couldn't resolve runtime dependencies "
- "for " + stringify(_imp->current_package->get<dle_name>()) + "-" +
- stringify(_imp->current_package->get<dle_version>()) + " as build dependencies, "
+ "for " + stringify(_imp->current_package->name) + "-" +
+ stringify(_imp->current_package->version) + " as build dependencies, "
"trying them as post dependencies");
}
}
@@ -560,9 +562,9 @@ DepList::visit(const UseDepAtom * const u)
if (_imp->current_package)
e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
new PackageDatabaseEntry(
- _imp->current_package->get<dle_name>(),
- _imp->current_package->get<dle_version>(),
- _imp->current_package->get<dle_repository>()));
+ _imp->current_package->name,
+ _imp->current_package->version,
+ _imp->current_package->repository));
if (_imp->environment->query_use(u->flag(), e.raw_pointer()) ^ u->inverse())
std::for_each(u->begin(), u->end(), std::bind1st(std::mem_fun(&DepList::_add), this));
@@ -582,9 +584,9 @@ struct IsViable :
if (_impl.current_package)
e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
new PackageDatabaseEntry(
- _impl.current_package->get<dle_name>(),
- _impl.current_package->get<dle_version>(),
- _impl.current_package->get<dle_repository>()));
+ _impl.current_package->name,
+ _impl.current_package->version,
+ _impl.current_package->repository));
}
bool operator() (DepAtom::ConstPointer a)
@@ -697,7 +699,7 @@ DepList::visit(const BlockDepAtom * const d)
for (PackageDatabaseEntryCollection::Iterator ii(installed->begin()),
ii_end(installed->end()) ; ii != ii_end ; ++ii)
{
- if (_imp->current_package->get<dle_name>() == ii->get<pde_name>())
+ if (_imp->current_package->name == ii->name)
{
Log::get_instance()->message(ll_qa, lc_context, "Package '" + stringify(*_imp->current_package)
+ "' has suspicious block upon '!" + stringify(*d->blocked_atom()) + "'");
@@ -705,16 +707,16 @@ DepList::visit(const BlockDepAtom * const d)
}
DepAtom::ConstPointer provide(new AllDepAtom);
- if (_imp->current_package->get<dle_metadata>()->get_ebuild_interface())
- provide = _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->provide();
+ if (_imp->current_package->metadata->get_ebuild_interface())
+ provide = _imp->current_package->metadata->get_ebuild_interface()->provide();
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
new PackageDatabaseEntry(
- _imp->current_package->get<dle_name>(),
- _imp->current_package->get<dle_version>(),
- _imp->current_package->get<dle_repository>()));
+ _imp->current_package->name,
+ _imp->current_package->version,
+ _imp->current_package->repository));
DepAtomFlattener f(_imp->environment, e.raw_pointer(), provide);
@@ -760,16 +762,16 @@ DepList::visit(const BlockDepAtom * const d)
}
DepAtom::ConstPointer provide(new AllDepAtom);
- if (_imp->current_package->get<dle_metadata>()->get_ebuild_interface())
- provide = _imp->current_package->get<dle_metadata>()->get_ebuild_interface()->provide();
+ if (_imp->current_package->metadata->get_ebuild_interface())
+ provide = _imp->current_package->metadata->get_ebuild_interface()->provide();
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
e = CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag>(
new PackageDatabaseEntry(
- _imp->current_package->get<dle_name>(),
- _imp->current_package->get<dle_version>(),
- _imp->current_package->get<dle_repository>()));
+ _imp->current_package->name,
+ _imp->current_package->version,
+ _imp->current_package->repository));
DepAtomFlattener f(_imp->environment, e.raw_pointer(), provide);
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 8d526d5..a93ef11 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -26,7 +26,6 @@
#include <paludis/environment.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/version_spec.hh>
#include <iosfwd>
@@ -37,23 +36,6 @@
namespace paludis
{
/**
- * Keys for a DepListEntry.
- *
- * \see DepListEntry
- * \ingroup grpdepresolver
- */
- enum DepListEntryKeys
- {
- dle_name, ///< Package name
- dle_version, ///< Package version
- dle_metadata, ///< Package SLOT
- dle_repository, ///< Repository name
- dle_flags, ///< Flags
- dle_tag, ///< Our tag
- last_dle ///< Number of entries
- };
-
- /**
* Flags for a DepListEntry.
*
* \see DepListEntry
@@ -75,29 +57,7 @@ namespace paludis
*/
typedef std::bitset<last_dlef> DepListEntryFlags;
- /**
- * Tag for a DepListEntry.
- *
- * \ingroup grpdepresolver
- */
- struct DepListEntryTag :
- SmartRecordTag<comparison_mode::EqualityComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<DepListEntryKeys, last_dle>,
- SmartRecordKey<dle_name, QualifiedPackageName>,
- SmartRecordKey<dle_version, VersionSpec>,
- SmartRecordKey<dle_metadata, VersionMetadata::ConstPointer>,
- SmartRecordKey<dle_repository, RepositoryName>,
- SmartRecordKey<dle_flags, DepListEntryFlags>,
- SmartRecordKey<dle_tag, SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Pointer>
- {
- };
-
- /**
- * A DepListEntry represents an entry in a DepList.
- *
- * \ingroup grpdepresolver
- */
- typedef MakeSmartRecord<DepListEntryTag>::Type DepListEntry;
+#include <paludis/dep_list_entry-sr.hh>
/**
* A DepListEntry can be written to a stream.
diff --git a/paludis/dep_list_TEST.cc b/paludis/dep_list_TEST.cc
index cde1970..e9039a0 100644
--- a/paludis/dep_list_TEST.cc
+++ b/paludis/dep_list_TEST.cc
@@ -152,7 +152,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two";
repo->add_version("cat", "two", "1");
}
@@ -173,8 +173,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/three";
repo->add_version("cat", "three", "1");
}
@@ -196,7 +196,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -219,8 +219,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/three";
repo->add_version("cat", "three", "1");
}
@@ -242,9 +242,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two");
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/two";
}
void populate_expected()
@@ -265,9 +265,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four";
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/four";
repo->add_version("cat", "four", "1");
}
@@ -290,9 +290,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/three");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four cat/three";
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/four";
repo->add_version("cat", "four", "1");
}
@@ -315,9 +315,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four";
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/four cat/two";
repo->add_version("cat", "four", "1");
}
@@ -340,7 +340,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( cat/two cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -362,9 +362,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/four )");
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "|| ( cat/two cat/four )";
repo->add_version("cat", "four", "1");
}
@@ -386,7 +386,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( ( cat/two cat/three ) cat/four )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( ( cat/two cat/three ) cat/four )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
repo->add_version("cat", "four", "1");
@@ -410,10 +410,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three cat/four");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three cat/four";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
- repo->add_version("cat", "four", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( ( cat/two cat/three ) cat/five )");
+ repo->add_version("cat", "four", "1")->deps.build_depend_string = "|| ( ( cat/two cat/three ) cat/five )";
}
void populate_expected()
@@ -435,7 +435,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( cat/two cat/three )";
repo->add_version("cat", "three", "1");
}
@@ -456,8 +456,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( cat/two cat/three )";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four";
repo->add_version("cat", "three", "1");
}
@@ -478,10 +478,10 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two:slot2");
- repo->add_version("cat", "two", "1.1")->set<vm_slot>(SlotName("slot1"));
- repo->add_version("cat", "two", "1.2")->set<vm_slot>(SlotName("slot2"));
- repo->add_version("cat", "two", "1.3")->set<vm_slot>(SlotName("slot3"));
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two:slot2";
+ repo->add_version("cat", "two", "1.1")->slot = SlotName("slot1");
+ repo->add_version("cat", "two", "1.2")->slot = SlotName("slot2");
+ repo->add_version("cat", "two", "1.3")->slot = SlotName("slot3");
}
void populate_expected()
@@ -501,12 +501,12 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("<cat/two-1.2-r2:slot2");
- repo->add_version("cat", "two", "1.1")->set<vm_slot>(SlotName("slot1"));
- repo->add_version("cat", "two", "1.2")->set<vm_slot>(SlotName("slot2"));
- repo->add_version("cat", "two", "1.2-r1")->set<vm_slot>(SlotName("slot2"));
- repo->add_version("cat", "two", "1.2-r2")->set<vm_slot>(SlotName("slot2"));
- repo->add_version("cat", "two", "1.3")->set<vm_slot>(SlotName("slot3"));
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "<cat/two-1.2-r2:slot2";
+ repo->add_version("cat", "two", "1.1")->slot = SlotName("slot1");
+ repo->add_version("cat", "two", "1.2")->slot = SlotName("slot2");
+ repo->add_version("cat", "two", "1.2-r1")->slot = SlotName("slot2");
+ repo->add_version("cat", "two", "1.2-r2")->slot = SlotName("slot2");
+ repo->add_version("cat", "two", "1.3")->slot = SlotName("slot3");
}
void populate_expected()
@@ -526,7 +526,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( )";
}
void populate_expected()
@@ -545,7 +545,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("enabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "enabled? ( cat/two )";
repo->add_version("cat", "two", "1");
}
@@ -566,7 +566,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!enabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "!enabled? ( cat/two )";
repo->add_version("cat", "two", "1");
}
@@ -586,7 +586,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("disabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "disabled? ( cat/two )";
repo->add_version("cat", "two", "1");
}
@@ -606,7 +606,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!disabled? ( cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "!disabled? ( cat/two )";
repo->add_version("cat", "two", "1");
}
@@ -627,7 +627,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( enabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -649,7 +649,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( !enabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -671,7 +671,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( disabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -693,7 +693,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( !disabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -715,8 +715,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>(
- "cat/three || ( enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( enabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -738,7 +737,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !enabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( !enabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -760,7 +759,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( disabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -782,7 +781,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !disabled? ( cat/two ) cat/three )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( !disabled? ( cat/two ) cat/three )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -804,7 +803,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( enabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( enabled? ( cat/three ) cat/two )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -826,7 +825,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !enabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( !enabled? ( cat/three ) cat/two )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -849,7 +848,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( disabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( disabled? ( cat/three ) cat/two )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -872,7 +871,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three || ( !disabled? ( cat/three ) cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three || ( !disabled? ( cat/three ) cat/two )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -894,7 +893,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( enabled1? ( cat/two ) enabled2? ( cat/three ) )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -916,7 +915,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( !enabled1? ( cat/two ) enabled2? ( cat/three ) )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -938,7 +937,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( !enabled1? ( cat/two ) !enabled2? ( cat/three ) )";
repo->add_version("cat", "two", "1");
repo->add_version("cat", "three", "1");
}
@@ -959,7 +958,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "!cat/two";
repo->add_version("cat", "two", "1");
}
@@ -979,7 +978,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two !cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two !cat/two";
repo->add_version("cat", "two", "1");
}
@@ -1006,9 +1005,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "!cat/two";
}
void populate_expected()
@@ -1034,9 +1033,9 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/three cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/three cat/two";
repo->add_version("cat", "two", "1");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("!cat/two");
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "!cat/two";
}
void populate_expected()
@@ -1057,8 +1056,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/one");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( cat/two cat/three )";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/one";
repo->add_version("cat", "three", "1");
}
@@ -1079,8 +1078,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("|| ( cat/two cat/three )");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_run_depend_string>("cat/one");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "|| ( cat/two cat/three )";
+ repo->add_version("cat", "two", "1")->deps.run_depend_string = "cat/one";
repo->add_version("cat", "three", "1");
}
@@ -1101,7 +1100,7 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two )");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two cat/two )";
repo->add_version("cat", "two", "1");
}
@@ -1122,8 +1121,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two[enabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "enabled";
}
void populate_expected()
@@ -1143,8 +1142,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two[-disabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "disabled";
}
void populate_expected()
@@ -1164,8 +1163,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two[disabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "disabled";
}
void populate_expected()
@@ -1191,8 +1190,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two[-enabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "enabled";
}
void populate_expected()
@@ -1218,8 +1217,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[enabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two cat/two[enabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "enabled";
}
void populate_expected()
@@ -1239,8 +1238,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[-disabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two cat/two[-disabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "disabled";
}
void populate_expected()
@@ -1260,8 +1259,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[disabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("disabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two cat/two[disabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "disabled";
}
void populate_expected()
@@ -1287,8 +1286,8 @@ namespace test_cases
{
void populate_repo()
{
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("( cat/two cat/two[-enabled] )");
- repo->add_version("cat", "two", "1")->get_ebuild_interface()->set<evm_iuse>("enabled");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "( cat/two cat/two[-enabled] )";
+ repo->add_version("cat", "two", "1")->get_ebuild_interface()->iuse = "enabled";
}
void populate_expected()
@@ -1320,13 +1319,13 @@ namespace test_cases
FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
env.package_database()->add_repository(repo);
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four";
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/four cat/two";
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/six cat/seven");
+ repo->add_version("cat", "five", "1")->deps.build_depend_string = "cat/six cat/seven";
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/doesnotexist");
+ repo->add_version("cat", "seven", "1")->deps.build_depend_string = "cat/doesnotexist";
DepList d(&env);
d.add(PortageDepParser::parse("cat/one"));
@@ -1355,13 +1354,13 @@ namespace test_cases
FakeRepository::Pointer repo(new FakeRepository(RepositoryName("repo")));
env.package_database()->add_repository(repo);
- repo->add_version("cat", "one", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/two cat/three");
- repo->add_version("cat", "two", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four");
- repo->add_version("cat", "three", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/four cat/two");
+ repo->add_version("cat", "one", "1")->deps.build_depend_string = "cat/two cat/three";
+ repo->add_version("cat", "two", "1")->deps.build_depend_string = "cat/four";
+ repo->add_version("cat", "three", "1")->deps.build_depend_string = "cat/four cat/two";
repo->add_version("cat", "four", "1");
- repo->add_version("cat", "five", "1")->get<vm_deps>().set<vmd_build_depend_string>("cat/six cat/seven");
+ repo->add_version("cat", "five", "1")->deps.build_depend_string = "cat/six cat/seven";
repo->add_version("cat", "six", "1");
- repo->add_version("cat", "seven", "1")->get<vm_deps>().set<vmd_post_depend_string>("cat/doesnotexist");
+ repo->add_version("cat", "seven", "1")->deps.post_depend_string = "cat/doesnotexist";
DepList d(&env);
d.add(PortageDepParser::parse("cat/one"));
diff --git a/paludis/dep_list_entry.sr b/paludis/dep_list_entry.sr
new file mode 100644
index 0000000..9a58910
--- /dev/null
+++ b/paludis/dep_list_entry.sr
@@ -0,0 +1,16 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_DepListEntry()
+{
+ key name QualifiedPackageName
+ key version VersionSpec
+ key metadata VersionMetadata::ConstPointer
+ key repository RepositoryName
+ key flags DepListEntryFlags
+ key tag "SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Pointer"
+
+ comparison_operators equality all
+}
+
+
diff --git a/paludis/ebin.cc b/paludis/ebin.cc
index fe15798..48a4804 100644
--- a/paludis/ebin.cc
+++ b/paludis/ebin.cc
@@ -36,6 +36,8 @@
using namespace paludis;
+#include <paludis/ebin-sr.cc>
+
EbinCommand::EbinCommand(const EbinCommandParams & p) :
params(p)
{
@@ -68,32 +70,32 @@ EbinCommand::operator() ()
{
std::string ebin_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/ebuild.bash '" +
- stringify(params.get<ebcpk_ebin_dir>()) + "/" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_version>()) +
+ stringify(params.ebin_dir) + "/" +
+ stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version) +
".ebin' " + commands());
if (use_sandbox())
ebin_cmd = make_sandbox_command(ebin_cmd);
MakeEnvCommand cmd(extend_command(make_env_command(ebin_cmd)
- ("P", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_version>().remove_revision()))
- ("PV", stringify(params.get<ebcpk_db_entry>()->get<pde_version>().remove_revision()))
- ("PR", stringify(params.get<ebcpk_db_entry>()->get<pde_version>().revision_only()))
- ("PN", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()))
- ("PVR", stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
- ("PF", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
- ("CATEGORY", stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_category>()))
- ("REPOSITORY", stringify(params.get<ebcpk_db_entry>()->get<pde_repository>()))
- ("SRC_REPOSITORY", stringify(params.get<ebcpk_src_repository>()))
- ("PKGDIR", stringify(params.get<ebcpk_pkgdir>()))
- ("PALUDIS_TMPDIR", stringify(params.get<ebcpk_buildroot>()))
+ ("P", stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version.remove_revision()))
+ ("PV", stringify(params.db_entry->version.remove_revision()))
+ ("PR", stringify(params.db_entry->version.revision_only()))
+ ("PN", stringify(params.db_entry->name.package))
+ ("PVR", stringify(params.db_entry->version))
+ ("PF", stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version))
+ ("CATEGORY", stringify(params.db_entry->name.category))
+ ("REPOSITORY", stringify(params.db_entry->repository))
+ ("SRC_REPOSITORY", stringify(params.src_repository))
+ ("PKGDIR", stringify(params.pkgdir))
+ ("PALUDIS_TMPDIR", stringify(params.buildroot))
("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
- ("PALUDIS_BASHRC_FILES", params.get<ebcpk_environment>()->bashrc_files())
- ("PALUDIS_HOOK_DIRS", params.get<ebcpk_environment>()->hook_dirs())
- ("PALUDIS_COMMAND", params.get<ebcpk_environment>()->paludis_command())
+ ("PALUDIS_BASHRC_FILES", params.environment->bashrc_files())
+ ("PALUDIS_HOOK_DIRS", params.environment->hook_dirs())
+ ("PALUDIS_COMMAND", params.environment->paludis_command())
("KV", kernel_version())
("PALUDIS_EBUILD_LOG_LEVEL", Log::get_instance()->log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))));
@@ -109,17 +111,17 @@ EbinCommand::add_portage_vars(const MakeEnvCommand & cmd) const
{
return cmd
("PORTAGE_BASHRC", "/dev/null")
- ("PORTAGE_BUILDDIR", stringify(params.get<ebcpk_buildroot>()) + "/" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_category>()) + "/" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ebcpk_db_entry>()->get<pde_version>()))
- ("PORTAGE_CALLER", params.get<ebcpk_environment>()->paludis_command())
+ ("PORTAGE_BUILDDIR", stringify(params.buildroot) + "/" +
+ stringify(params.db_entry->name.category) + "/" +
+ stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version))
+ ("PORTAGE_CALLER", params.environment->paludis_command())
("PORTAGE_GID", "0")
("PORTAGE_INST_GID", "0")
("PORTAGE_INST_UID", "0")
("PORTAGE_MASTER_PID", stringify(::getpid()))
("PORTAGE_NICENCESS", stringify(::getpriority(PRIO_PROCESS, 0)))
- ("PORTAGE_TMPDIR", stringify(params.get<ebcpk_buildroot>()))
+ ("PORTAGE_TMPDIR", stringify(params.buildroot))
("PORTAGE_TMPFS", "/dev/shm")
("PORTAGE_WORKDIR_MODE", "0700");
}
@@ -140,19 +142,19 @@ bool
EbinFetchCommand::failure()
{
throw PackageFetchActionError("Fetch failed for '" + stringify(
- *params.get<ebcpk_db_entry>()) + "'");
+ *params.db_entry) + "'");
}
MakeEnvCommand
EbinFetchCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
- ("B", fetch_params.get<ebcfpk_b>())
- ("FLAT_BIN_URI", fetch_params.get<ebcfpk_flat_bin_uri>())
- ("ROOT", fetch_params.get<ebcfpk_root>())
- ("PALUDIS_PROFILE_DIR", stringify(*fetch_params.get<ebcfpk_profiles>()->begin()))
- ("PALUDIS_PROFILE_DIRS", join(fetch_params.get<ebcfpk_profiles>()->begin(),
- fetch_params.get<ebcfpk_profiles>()->end(), " ")));
+ ("B", fetch_params.b)
+ ("FLAT_BIN_URI", fetch_params.flat_bin_uri)
+ ("ROOT", fetch_params.root)
+ ("PALUDIS_PROFILE_DIR", stringify(*fetch_params.profiles->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(fetch_params.profiles->begin(),
+ fetch_params.profiles->end(), " ")));
return result;
}
@@ -167,7 +169,7 @@ EbinFetchCommand::EbinFetchCommand(const EbinCommandParams & p,
std::string
EbinInstallCommand::commands() const
{
- if (install_params.get<ebcipk_merge_only>())
+ if (install_params.merge_only)
return "merge";
else
return "init_bin unpack_bin setup strip preinst merge postinst tidyup";
@@ -177,27 +179,27 @@ bool
EbinInstallCommand::failure()
{
throw PackageInstallActionError("Install failed for '" + stringify(
- *params.get<ebcpk_db_entry>()) + "'");
+ *params.db_entry) + "'");
}
MakeEnvCommand
EbinInstallCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
- ("B", install_params.get<ebcipk_b>())
- ("USE", install_params.get<ebcipk_use>())
- ("USE_EXPAND", install_params.get<ebcipk_use_expand>())
- ("ROOT", install_params.get<ebcipk_root>())
+ ("B", install_params.b)
+ ("USE", install_params.use)
+ ("USE_EXPAND", install_params.use_expand)
+ ("ROOT", install_params.root)
("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
- install_params.get<ebcipk_disable_cfgpro>() ? "/" : "")
- ("PALUDIS_PROFILE_DIR", stringify(*install_params.get<ebcipk_profiles>()->begin()))
- ("PALUDIS_PROFILE_DIRS", join(install_params.get<ebcipk_profiles>()->begin(),
- install_params.get<ebcipk_profiles>()->end(), " "))
- ("SLOT", stringify(install_params.get<ebcipk_slot>())));
+ install_params.disable_cfgpro ? "/" : "")
+ ("PALUDIS_PROFILE_DIR", stringify(*install_params.profiles->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(install_params.profiles->begin(),
+ install_params.profiles->end(), " "))
+ ("SLOT", stringify(install_params.slot)));
for (AssociativeCollection<std::string, std::string>::Iterator
- i(install_params.get<ebcipk_expand_vars>()->begin()),
- j(install_params.get<ebcipk_expand_vars>()->end()) ; i != j ; ++i)
+ i(install_params.expand_vars->begin()),
+ j(install_params.expand_vars->end()) ; i != j ; ++i)
result = result(i->first, i->second);
return result;
diff --git a/paludis/ebin.hh b/paludis/ebin.hh
index c5051e2..9290b94 100644
--- a/paludis/ebin.hh
+++ b/paludis/ebin.hh
@@ -21,7 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_EBIN_HH 1
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/smart_record.hh>
+#include <paludis/util/sr.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/collection.hh>
@@ -36,52 +36,10 @@
namespace paludis
{
- /**
- * Keys for EbinCommandParams.
- *
- * \see EbinCommandParams
- *
- * \ingroup grpebininterface
- */
- enum EbinCommandParamsKeys
- {
- ebcpk_ebin_dir,
- ebcpk_environment,
- ebcpk_db_entry,
- ebcpk_src_repository,
- ebcpk_pkgdir,
- ebcpk_buildroot,
- last_ebcpk
- };
-
class Environment;
class MakeEnvCommand;
- /**
- * Tag for EbinCommandParams.
- *
- * \see EbinCommandParams.
- *
- * \ingroup grpebininterface
- */
- struct EbinCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbinCommandParamsKeys, last_ebcpk>,
- SmartRecordKey<ebcpk_ebin_dir, const FSEntry>,
- SmartRecordKey<ebcpk_environment, const Environment *>,
- SmartRecordKey<ebcpk_db_entry, const PackageDatabaseEntry *>,
- SmartRecordKey<ebcpk_src_repository, const RepositoryName>,
- SmartRecordKey<ebcpk_pkgdir, const FSEntry>,
- SmartRecordKey<ebcpk_buildroot, const FSEntry>
- {
- };
-
- /**
- * Parameters for EbinCommand's constructor.
- *
- * \ingroup grpebininterface
- */
- typedef MakeSmartRecord<EbinCommandParamsTag>::Type EbinCommandParams;
+#include <paludis/ebin-sr.hh>
/**
* An EbinCommand is the base class from which specific ebin
@@ -162,46 +120,6 @@ namespace paludis
};
/**
- * Keys for EbinFetchCommandParams.
- *
- * \see EbinFetchCommandParams
- *
- * \ingroup grpebininterface
- */
- enum EbinFetchCommandParamsKeys
- {
- ebcfpk_b,
- ebcfpk_flat_bin_uri,
- ebcfpk_root,
- ebcfpk_profiles,
- last_ebcfpk
- };
-
- /**
- * Tag for EbinFetchCommandParams.
- *
- * \see EbinFetchCommandParams
- *
- * \ingroup grpebininterface
- */
- struct EbinFetchCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbinFetchCommandParamsKeys, last_ebcfpk>,
- SmartRecordKey<ebcfpk_b, std::string>,
- SmartRecordKey<ebcfpk_flat_bin_uri, std::string>,
- SmartRecordKey<ebcfpk_root, std::string>,
- SmartRecordKey<ebcfpk_profiles, FSEntryCollection::ConstPointer>
- {
- };
-
- /**
- * Parameters for EbinFetchCommand's constructor.
- *
- * \ingroup grpebininterface
- */
- typedef MakeSmartRecord<EbinFetchCommandParamsTag>::Type EbinFetchCommandParams;
-
- /**
* An EbinFetchCommand is used to download and verify the digests for a
* particular ebin in a PortageRepository. On failure it throws.
*
@@ -228,56 +146,6 @@ namespace paludis
};
/**
- * Keys for EbinInstallCommandParams.
- *
- * \see EbinInstallCommandParams
- *
- * \ingroup grpebininterface
- */
- enum EbinInstallCommandParamsKeys
- {
- ebcipk_b,
- ebcipk_use,
- ebcipk_use_expand,
- ebcipk_root,
- ebcipk_profiles,
- ebcipk_expand_vars,
- ebcipk_disable_cfgpro,
- ebcipk_merge_only,
- ebcipk_slot,
- last_ebcipk
- };
-
- /**
- * Tag for EbinInstallCommandParams.
- *
- * \see EbinInstallCommandParams
- *
- * \ingroup grpebininterface
- */
- struct EbinInstallCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbinInstallCommandParamsKeys, last_ebcipk>,
- SmartRecordKey<ebcipk_b, std::string>,
- SmartRecordKey<ebcipk_use, std::string>,
- SmartRecordKey<ebcipk_use_expand, std::string>,
- SmartRecordKey<ebcipk_root, std::string>,
- SmartRecordKey<ebcipk_profiles, FSEntryCollection::ConstPointer>,
- SmartRecordKey<ebcipk_expand_vars, AssociativeCollection<std::string, std::string>::ConstPointer>,
- SmartRecordKey<ebcipk_disable_cfgpro, bool>,
- SmartRecordKey<ebcipk_merge_only, bool>,
- SmartRecordKey<ebcipk_slot, SlotName>
- {
- };
-
- /**
- * Parameters for EbinInstallCommand's constructor.
- *
- * \ingroup grpebininterface
- */
- typedef MakeSmartRecord<EbinInstallCommandParamsTag>::Type EbinInstallCommandParams;
-
- /**
* An EbinInstallCommand is used to install an ebin from a
* PortageRepository. On failure it throws.
*
diff --git a/paludis/ebin.sr b/paludis/ebin.sr
new file mode 100644
index 0000000..fd52440
--- /dev/null
+++ b/paludis/ebin.sr
@@ -0,0 +1,40 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_EbinCommandParams()
+{
+ key ebin_dir "FSEntry"
+ key environment "const Environment *"
+ key db_entry "const PackageDatabaseEntry *"
+ key src_repository "RepositoryName"
+ key pkgdir "FSEntry"
+ key buildroot "FSEntry"
+
+ allow_named_args
+}
+
+make_class_EbinFetchCommandParams()
+{
+ key b std::string
+ key flat_bin_uri std::string
+ key root std::string
+ key profiles FSEntryCollection::ConstPointer
+
+ allow_named_args
+}
+
+make_class_EbinInstallCommandParams()
+{
+ key b std::string
+ key use std::string
+ key use_expand std::string
+ key root std::string
+ key profiles FSEntryCollection::ConstPointer
+ key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
+ key disable_cfgpro bool
+ key merge_only bool
+ key slot SlotName
+
+ allow_named_args
+}
+
diff --git a/paludis/ebuild.cc b/paludis/ebuild.cc
index ab53d3a..cbd8f0a 100644
--- a/paludis/ebuild.cc
+++ b/paludis/ebuild.cc
@@ -36,6 +36,8 @@
using namespace paludis;
+#include <paludis/ebuild-sr.cc>
+
EbuildCommand::EbuildCommand(const EbuildCommandParams & p) :
params(p)
{
@@ -68,36 +70,36 @@ EbuildCommand::operator() ()
{
std::string ebuild_cmd(getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/ebuild.bash '" +
- stringify(params.get<ecpk_ebuild_dir>()) + "/" +
- stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ecpk_db_entry>()->get<pde_version>()) +
+ stringify(params.ebuild_dir) + "/" +
+ stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version) +
".ebuild' " + commands());
if (use_sandbox())
ebuild_cmd = make_sandbox_command(ebuild_cmd);
MakeEnvCommand cmd(extend_command(make_env_command(ebuild_cmd)
- ("P", stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ecpk_db_entry>()->get<pde_version>().remove_revision()))
- ("PV", stringify(params.get<ecpk_db_entry>()->get<pde_version>().remove_revision()))
- ("PR", stringify(params.get<ecpk_db_entry>()->get<pde_version>().revision_only()))
- ("PN", stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()))
- ("PVR", stringify(params.get<ecpk_db_entry>()->get<pde_version>()))
- ("PF", stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ecpk_db_entry>()->get<pde_version>()))
- ("CATEGORY", stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_category>()))
- ("REPOSITORY", stringify(params.get<ecpk_db_entry>()->get<pde_repository>()))
- ("FILESDIR", stringify(params.get<ecpk_files_dir>()))
- ("ECLASSDIR", stringify(*params.get<ecpk_eclassdirs>()->begin()))
- ("ECLASSDIRS", join(params.get<ecpk_eclassdirs>()->begin(),
- params.get<ecpk_eclassdirs>()->end(), " "))
- ("PORTDIR", stringify(params.get<ecpk_portdir>()))
- ("DISTDIR", stringify(params.get<ecpk_distdir>()))
- ("PALUDIS_TMPDIR", stringify(params.get<ecpk_buildroot>()))
+ ("P", stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version.remove_revision()))
+ ("PV", stringify(params.db_entry->version.remove_revision()))
+ ("PR", stringify(params.db_entry->version.revision_only()))
+ ("PN", stringify(params.db_entry->name.package))
+ ("PVR", stringify(params.db_entry->version))
+ ("PF", stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version))
+ ("CATEGORY", stringify(params.db_entry->name.category))
+ ("REPOSITORY", stringify(params.db_entry->repository))
+ ("FILESDIR", stringify(params.files_dir))
+ ("ECLASSDIR", stringify(*params.eclassdirs->begin()))
+ ("ECLASSDIRS", join(params.eclassdirs->begin(),
+ params.eclassdirs->end(), " "))
+ ("PORTDIR", stringify(params.portdir))
+ ("DISTDIR", stringify(params.distdir))
+ ("PALUDIS_TMPDIR", stringify(params.buildroot))
("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
- ("PALUDIS_BASHRC_FILES", params.get<ecpk_environment>()->bashrc_files())
- ("PALUDIS_HOOK_DIRS", params.get<ecpk_environment>()->hook_dirs())
- ("PALUDIS_COMMAND", params.get<ecpk_environment>()->paludis_command())
+ ("PALUDIS_BASHRC_FILES", params.environment->bashrc_files())
+ ("PALUDIS_HOOK_DIRS", params.environment->hook_dirs())
+ ("PALUDIS_COMMAND", params.environment->paludis_command())
("KV", kernel_version())
("PALUDIS_EBUILD_LOG_LEVEL", Log::get_instance()->log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis"))));
@@ -112,19 +114,19 @@ MakeEnvCommand
EbuildCommand::add_portage_vars(const MakeEnvCommand & cmd) const
{
return cmd
- ("PORTAGE_ACTUAL_DISTDIR", stringify(params.get<ecpk_distdir>()))
+ ("PORTAGE_ACTUAL_DISTDIR", stringify(params.distdir))
("PORTAGE_BASHRC", "/dev/null")
- ("PORTAGE_BUILDDIR", stringify(params.get<ecpk_buildroot>()) + "/" +
- stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_category>()) + "/" +
- stringify(params.get<ecpk_db_entry>()->get<pde_name>().get<qpn_package>()) + "-" +
- stringify(params.get<ecpk_db_entry>()->get<pde_version>()))
- ("PORTAGE_CALLER", params.get<ecpk_environment>()->paludis_command())
+ ("PORTAGE_BUILDDIR", stringify(params.buildroot) + "/" +
+ stringify(params.db_entry->name.category) + "/" +
+ stringify(params.db_entry->name.package) + "-" +
+ stringify(params.db_entry->version))
+ ("PORTAGE_CALLER", params.environment->paludis_command())
("PORTAGE_GID", "0")
("PORTAGE_INST_GID", "0")
("PORTAGE_INST_UID", "0")
("PORTAGE_MASTER_PID", stringify(::getpid()))
("PORTAGE_NICENCESS", stringify(::getpriority(PRIO_PROCESS, 0)))
- ("PORTAGE_TMPDIR", stringify(params.get<ecpk_buildroot>()))
+ ("PORTAGE_TMPDIR", stringify(params.buildroot))
("PORTAGE_TMPFS", "/dev/shm")
("PORTAGE_WORKDIR_MODE", "0700");
}
@@ -169,21 +171,21 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
bool ok(false);
try
{
- _metadata->get<vm_deps>().set<vmd_build_depend_string>(f.get("DEPEND"));
- _metadata->get<vm_deps>().set<vmd_run_depend_string>(f.get("RDEPEND"));
- _metadata->set<vm_slot>(SlotName(f.get("SLOT")));
- _metadata->get_ebuild_interface()->set<evm_src_uri>(f.get("SRC_URI"));
- _metadata->get_ebuild_interface()->set<evm_restrict>(f.get("RESTRICT"));
- _metadata->set<vm_homepage>(f.get("HOMEPAGE"));
- _metadata->set<vm_license>(f.get("LICENSE"));
- _metadata->set<vm_description>(f.get("DESCRIPTION"));
- _metadata->get_ebuild_interface()->set<evm_keywords>(f.get("KEYWORDS"));
- _metadata->get_ebuild_interface()->set<evm_inherited>(f.get("INHERITED"));
- _metadata->get_ebuild_interface()->set<evm_iuse>(f.get("IUSE"));
- _metadata->get<vm_deps>().set<vmd_post_depend_string>(f.get("PDEPEND"));
- _metadata->get_ebuild_interface()->set<evm_provide>(f.get("PROVIDE"));
- _metadata->set<vm_eapi>(f.get("EAPI"));
- _metadata->get_ebuild_interface()->set<evm_virtual>("");
+ _metadata->deps.build_depend_string = f.get("DEPEND");
+ _metadata->deps.run_depend_string = f.get("RDEPEND");
+ _metadata->slot = SlotName(f.get("SLOT"));
+ _metadata->get_ebuild_interface()->src_uri = f.get("SRC_URI");
+ _metadata->get_ebuild_interface()->restrict_string = f.get("RESTRICT");
+ _metadata->homepage = f.get("HOMEPAGE");
+ _metadata->license_string = f.get("LICENSE");
+ _metadata->description = f.get("DESCRIPTION");
+ _metadata->get_ebuild_interface()->keywords = f.get("KEYWORDS");
+ _metadata->get_ebuild_interface()->inherited = f.get("INHERITED");
+ _metadata->get_ebuild_interface()->iuse = f.get("IUSE");
+ _metadata->deps.post_depend_string = f.get("PDEPEND");
+ _metadata->get_ebuild_interface()->provide_string = f.get("PROVIDE");
+ _metadata->eapi = f.get("EAPI");
+ _metadata->get_ebuild_interface()->virtual_for = "";
if (0 == prog.exit_status())
ok = true;
@@ -197,8 +199,8 @@ EbuildMetadataCommand::do_run_command(const std::string & cmd)
else
{
Log::get_instance()->message(ll_warning, lc_context, "Could not generate cache for '"
- + stringify(*params.get<ecpk_db_entry>()) + "'");
- _metadata->set<vm_eapi>("UNKNOWN");
+ + stringify(*params.db_entry) + "'");
+ _metadata->eapi = "UNKNOWN";
return false;
}
@@ -243,7 +245,7 @@ EbuildVariableCommand::do_run_command(const std::string & cmd)
std::string
EbuildFetchCommand::commands() const
{
- if (fetch_params.get<ecfpk_no_fetch>())
+ if (fetch_params.no_fetch)
return "nofetch";
else
return "fetch";
@@ -253,26 +255,26 @@ bool
EbuildFetchCommand::failure()
{
throw PackageFetchActionError("Fetch failed for '" + stringify(
- *params.get<ecpk_db_entry>()) + "'");
+ *params.db_entry) + "'");
}
MakeEnvCommand
EbuildFetchCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
- ("A", fetch_params.get<ecfpk_a>())
- ("AA", fetch_params.get<ecfpk_aa>())
- ("USE", fetch_params.get<ecfpk_use>())
- ("USE_EXPAND", fetch_params.get<ecfpk_use_expand>())
- ("FLAT_SRC_URI", fetch_params.get<ecfpk_flat_src_uri>())
- ("ROOT", fetch_params.get<ecfpk_root>())
- ("PALUDIS_PROFILE_DIR", stringify(*fetch_params.get<ecfpk_profiles>()->begin()))
- ("PALUDIS_PROFILE_DIRS", join(fetch_params.get<ecfpk_profiles>()->begin(),
- fetch_params.get<ecfpk_profiles>()->end(), " ")));
+ ("A", fetch_params.a)
+ ("AA", fetch_params.aa)
+ ("USE", fetch_params.use)
+ ("USE_EXPAND", fetch_params.use_expand)
+ ("FLAT_SRC_URI", fetch_params.flat_src_uri)
+ ("ROOT", fetch_params.root)
+ ("PALUDIS_PROFILE_DIR", stringify(*fetch_params.profiles->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(fetch_params.profiles->begin(),
+ fetch_params.profiles->end(), " ")));
for (AssociativeCollection<std::string, std::string>::Iterator
- i(fetch_params.get<ecfpk_expand_vars>()->begin()),
- j(fetch_params.get<ecfpk_expand_vars>()->end()) ; i != j ; ++i)
+ i(fetch_params.expand_vars->begin()),
+ j(fetch_params.expand_vars->end()) ; i != j ; ++i)
result = result(i->first, i->second);
return result;
@@ -288,7 +290,7 @@ EbuildFetchCommand::EbuildFetchCommand(const EbuildCommandParams & p,
std::string
EbuildInstallCommand::commands() const
{
- if (install_params.get<ecipk_merge_only>())
+ if (install_params.merge_only)
return "merge";
else
return "init setup unpack compile test install strip preinst "
@@ -299,28 +301,28 @@ bool
EbuildInstallCommand::failure()
{
throw PackageInstallActionError("Install failed for '" + stringify(
- *params.get<ecpk_db_entry>()) + "'");
+ *params.db_entry) + "'");
}
MakeEnvCommand
EbuildInstallCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
- ("A", install_params.get<ecipk_a>())
- ("AA", install_params.get<ecipk_aa>())
- ("USE", install_params.get<ecipk_use>())
- ("USE_EXPAND", install_params.get<ecipk_use_expand>())
- ("ROOT", install_params.get<ecipk_root>())
+ ("A", install_params.a)
+ ("AA", install_params.aa)
+ ("USE", install_params.use)
+ ("USE_EXPAND", install_params.use_expand)
+ ("ROOT", install_params.root)
("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
- install_params.get<ecipk_disable_cfgpro>() ? "/" : "")
- ("PALUDIS_PROFILE_DIR", stringify(*install_params.get<ecipk_profiles>()->begin()))
- ("PALUDIS_PROFILE_DIRS", join(install_params.get<ecipk_profiles>()->begin(),
- install_params.get<ecipk_profiles>()->end(), " "))
- ("SLOT", stringify(install_params.get<ecipk_slot>())));
+ install_params.disable_cfgpro ? "/" : "")
+ ("PALUDIS_PROFILE_DIR", stringify(*install_params.profiles->begin()))
+ ("PALUDIS_PROFILE_DIRS", join(install_params.profiles->begin(),
+ install_params.profiles->end(), " "))
+ ("SLOT", stringify(install_params.slot)));
for (AssociativeCollection<std::string, std::string>::Iterator
- i(install_params.get<ecipk_expand_vars>()->begin()),
- j(install_params.get<ecipk_expand_vars>()->end()) ; i != j ; ++i)
+ i(install_params.expand_vars->begin()),
+ j(install_params.expand_vars->end()) ; i != j ; ++i)
result = result(i->first, i->second);
return result;
@@ -336,7 +338,7 @@ EbuildInstallCommand::EbuildInstallCommand(const EbuildCommandParams & p,
std::string
EbuildUninstallCommand::commands() const
{
- if (uninstall_params.get<ecupk_unmerge_only>())
+ if (uninstall_params.unmerge_only)
return "unmerge";
else
return "prerm unmerge postrm";
@@ -346,20 +348,20 @@ bool
EbuildUninstallCommand::failure()
{
throw PackageUninstallActionError("Uninstall failed for '" + stringify(
- *params.get<ecpk_db_entry>()) + "'");
+ *params.db_entry) + "'");
}
MakeEnvCommand
EbuildUninstallCommand::extend_command(const MakeEnvCommand & cmd)
{
MakeEnvCommand result(cmd
- ("ROOT", uninstall_params.get<ecupk_root>())
+ ("ROOT", uninstall_params.root)
("PALUDIS_EBUILD_OVERRIDE_CONFIG_PROTECT_MASK",
- uninstall_params.get<ecupk_disable_cfgpro>() ? "/" : ""));
+ uninstall_params.disable_cfgpro ? "/" : ""));
- if (uninstall_params.get<ecupk_load_environment>())
+ if (uninstall_params.load_environment)
result = result
- ("PALUDIS_LOAD_ENVIRONMENT", stringify(*uninstall_params.get<ecupk_load_environment>()))
+ ("PALUDIS_LOAD_ENVIRONMENT", stringify(*uninstall_params.load_environment))
("PALUDIS_SKIP_INHERIT", "yes");
return result;
diff --git a/paludis/ebuild.hh b/paludis/ebuild.hh
index a9db44f..0f00329 100644
--- a/paludis/ebuild.hh
+++ b/paludis/ebuild.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_PALUDIS_EBUILD_HH 1
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/collection.hh>
@@ -59,33 +58,7 @@ namespace paludis
class Environment;
class MakeEnvCommand;
- /**
- * Tag for EbuildCommandParams.
- *
- * \see EbuildCommandParams.
- *
- * \ingroup grpebuildinterface
- */
- struct EbuildCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildCommandParamsKeys, last_ecpk>,
- SmartRecordKey<ecpk_environment, const Environment *>,
- SmartRecordKey<ecpk_db_entry, const PackageDatabaseEntry *>,
- SmartRecordKey<ecpk_ebuild_dir, const FSEntry>,
- SmartRecordKey<ecpk_files_dir, const FSEntry>,
- SmartRecordKey<ecpk_eclassdirs, FSEntryCollection::ConstPointer>,
- SmartRecordKey<ecpk_portdir, const FSEntry>,
- SmartRecordKey<ecpk_distdir, const FSEntry>,
- SmartRecordKey<ecpk_buildroot, const FSEntry>
- {
- };
-
- /**
- * Parameters for EbuildCommand's constructor.
- *
- * \ingroup grpebuildinterface
- */
- typedef MakeSmartRecord<EbuildCommandParamsTag>::Type EbuildCommandParams;
+#include <paludis/ebuild-sr.hh>
/**
* An EbuildCommand is the base class from which specific ebuild
@@ -240,56 +213,6 @@ namespace paludis
};
/**
- * Keys for EbuildFetchCommandParams.
- *
- * \see EbuildFetchCommandParams
- *
- * \ingroup grpebuildinterface
- */
- enum EbuildFetchCommandParamsKeys
- {
- ecfpk_a,
- ecfpk_aa,
- ecfpk_use,
- ecfpk_use_expand,
- ecfpk_flat_src_uri,
- ecfpk_root,
- ecfpk_profiles,
- ecfpk_expand_vars,
- ecfpk_no_fetch,
- last_ecfpk
- };
-
- /**
- * Tag for EbuildFetchCommandParams.
- *
- * \see EbuildFetchCommandParams
- *
- * \ingroup grpebuildinterface
- */
- struct EbuildFetchCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildFetchCommandParamsKeys, last_ecfpk>,
- SmartRecordKey<ecfpk_a, std::string>,
- SmartRecordKey<ecfpk_aa, std::string>,
- SmartRecordKey<ecfpk_use, std::string>,
- SmartRecordKey<ecfpk_use_expand, std::string>,
- SmartRecordKey<ecfpk_flat_src_uri, std::string>,
- SmartRecordKey<ecfpk_root, std::string>,
- SmartRecordKey<ecfpk_profiles, FSEntryCollection::ConstPointer>,
- SmartRecordKey<ecfpk_expand_vars, AssociativeCollection<std::string, std::string>::ConstPointer>,
- SmartRecordKey<ecfpk_no_fetch, bool>
- {
- };
-
- /**
- * Parameters for EbuildFetchCommand's constructor.
- *
- * \ingroup grpebuildinterface
- */
- typedef MakeSmartRecord<EbuildFetchCommandParamsTag>::Type EbuildFetchCommandParams;
-
- /**
* An EbuildFetchCommand is used to download and verify the digests for a
* particular ebuild in a PortageRepository. On failure it throws.
*
@@ -316,58 +239,6 @@ namespace paludis
};
/**
- * Keys for EbuildInstallCommandParams.
- *
- * \see EbuildInstallCommandParams
- *
- * \ingroup grpebuildinterface
- */
- enum EbuildInstallCommandParamsKeys
- {
- ecipk_a,
- ecipk_aa,
- ecipk_use,
- ecipk_use_expand,
- ecipk_root,
- ecipk_profiles,
- ecipk_expand_vars,
- ecipk_disable_cfgpro,
- ecipk_merge_only,
- ecipk_slot,
- last_ecipk
- };
-
- /**
- * Tag for EbuildInstallCommandParams.
- *
- * \see EbuildInstallCommandParams
- *
- * \ingroup grpebuildinterface
- */
- struct EbuildInstallCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildInstallCommandParamsKeys, last_ecipk>,
- SmartRecordKey<ecipk_a, std::string>,
- SmartRecordKey<ecipk_aa, std::string>,
- SmartRecordKey<ecipk_use, std::string>,
- SmartRecordKey<ecipk_use_expand, std::string>,
- SmartRecordKey<ecipk_root, std::string>,
- SmartRecordKey<ecipk_profiles, FSEntryCollection::ConstPointer>,
- SmartRecordKey<ecipk_expand_vars, AssociativeCollection<std::string, std::string>::ConstPointer>,
- SmartRecordKey<ecipk_disable_cfgpro, bool>,
- SmartRecordKey<ecipk_merge_only, bool>,
- SmartRecordKey<ecipk_slot, SlotName>
- {
- };
-
- /**
- * Parameters for EbuildInstallCommand's constructor.
- *
- * \ingroup grpebuildinterface
- */
- typedef MakeSmartRecord<EbuildInstallCommandParamsTag>::Type EbuildInstallCommandParams;
-
- /**
* An EbuildInstallCommand is used to install an ebuild from a
* PortageRepository. On failure it throws.
*
@@ -394,46 +265,6 @@ namespace paludis
};
/**
- * Keys for EbuildUninstallCommandParams.
- *
- * \see EbuildUninstallCommandParams
- *
- * \ingroup grpebuildinterface
- */
- enum EbuildUninstallCommandParamsKeys
- {
- ecupk_root,
- ecupk_disable_cfgpro,
- ecupk_unmerge_only,
- ecupk_load_environment,
- last_ecupk
- };
-
- /**
- * Tags for EbuildUninstallCommandParams.
- *
- * \see EbuildUninstallCommandParams
- *
- * \ingroup grpebuildinterface
- */
- struct EbuildUninstallCommandParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildUninstallCommandParamsKeys, last_ecupk>,
- SmartRecordKey<ecupk_root, std::string>,
- SmartRecordKey<ecupk_disable_cfgpro, bool>,
- SmartRecordKey<ecupk_unmerge_only, bool>,
- SmartRecordKey<ecupk_load_environment, const FSEntry * const>
- {
- };
-
- /**
- * Parameters for EbuildUninstallCommand's constructor.
- *
- * \ingroup grpebuildinterface
- */
- typedef MakeSmartRecord<EbuildUninstallCommandParamsTag>::Type EbuildUninstallCommandParams;
-
- /**
* An EbuildUninstallCommand is used to uninstall a package in a VDBRepository.
*
* \ingroup grpebuildinterface
diff --git a/paludis/ebuild.sr b/paludis/ebuild.sr
new file mode 100644
index 0000000..8fd67da
--- /dev/null
+++ b/paludis/ebuild.sr
@@ -0,0 +1,58 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_EbuildCommandParams()
+{
+ key environment "const Environment *"
+ key db_entry "const PackageDatabaseEntry *"
+ key ebuild_dir FSEntry
+ key files_dir FSEntry
+ key eclassdirs FSEntryCollection::ConstPointer
+ key portdir FSEntry
+ key distdir FSEntry
+ key buildroot FSEntry
+
+ allow_named_args
+}
+
+make_class_EbuildFetchCommandParams()
+{
+ key a std::string
+ key aa std::string
+ key use std::string
+ key use_expand std::string
+ key flat_src_uri std::string
+ key root std::string
+ key profiles FSEntryCollection::ConstPointer
+ key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
+ key no_fetch bool
+
+ allow_named_args
+}
+
+make_class_EbuildInstallCommandParams()
+{
+ key a std::string
+ key aa std::string
+ key use std::string
+ key use_expand std::string
+ key root std::string
+ key profiles FSEntryCollection::ConstPointer
+ key expand_vars "AssociativeCollection<std::string, std::string>::ConstPointer"
+ key disable_cfgpro bool
+ key merge_only bool
+ key slot SlotName
+
+ allow_named_args
+}
+
+make_class_EbuildUninstallCommandParams()
+{
+ key root std::string
+ key disable_cfgpro bool
+ key unmerge_only bool
+ key load_environment "const FSEntry *"
+
+ allow_named_args
+}
+
diff --git a/paludis/environment.cc b/paludis/environment.cc
index 0923e9c..13b46d1 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -129,10 +129,10 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
MaskReasons result;
VersionMetadata::ConstPointer metadata(package_database()->fetch_repository(
- e.get<pde_repository>())->version_metadata(e.get<pde_name>(), e.get<pde_version>()));
+ e.repository)->version_metadata(e.name, e.version));
- if (metadata->get<vm_eapi>() != "0" && metadata->get<vm_eapi>() != ""
- && metadata->get<vm_eapi>() != "paludis-1" && metadata->get<vm_eapi>() != "CRAN-0")
+ if (metadata->eapi != "0" && metadata->eapi != ""
+ && metadata->eapi != "paludis-1" && metadata->eapi != "CRAN-0")
result.set(mr_eapi);
else
{
@@ -140,7 +140,7 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
{
std::set<KeywordName> keywords;
WhitespaceTokeniser::get_instance()->tokenise(
- metadata->get_ebuild_interface()->get<evm_keywords>(),
+ metadata->get_ebuild_interface()->keywords,
create_inserter<KeywordName>(std::inserter(keywords, keywords.end())));
result.set(mr_keyword);
@@ -152,14 +152,14 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
break;
}
- if (! metadata->get_ebuild_interface()->get<evm_virtual>().empty())
+ if (! metadata->get_ebuild_interface()->virtual_for.empty())
{
- QualifiedPackageName n(metadata->get_ebuild_interface()->get<evm_virtual>());
+ QualifiedPackageName n(metadata->get_ebuild_interface()->virtual_for);
- PackageDatabaseEntry ee(n, e.get<pde_version>(), e.get<pde_repository>());
+ PackageDatabaseEntry ee(n, e.version, e.repository);
std::set<KeywordName> keywords;
WhitespaceTokeniser::get_instance()->tokenise(
- metadata->get_ebuild_interface()->get<evm_keywords>(),
+ metadata->get_ebuild_interface()->keywords,
create_inserter<KeywordName>(std::inserter(keywords, keywords.end())));
for (std::set<KeywordName>::const_iterator i(keywords.begin()),
@@ -183,29 +183,29 @@ Environment::mask_reasons(const PackageDatabaseEntry & e) const
result.set(mr_user_mask);
const Repository * const repo(package_database()->fetch_repository(
- e.get<pde_repository>()).raw_pointer());
+ e.repository).raw_pointer());
- if (repo->get_interface<repo_mask>())
+ if (repo->mask_interface)
{
- if (repo->get_interface<repo_mask>()->query_profile_masks(e.get<pde_name>(),
- e.get<pde_version>()))
+ if (repo->mask_interface->query_profile_masks(e.name,
+ e.version))
result.set(mr_profile_mask);
- if (repo->get_interface<repo_mask>()->query_repository_masks(e.get<pde_name>(),
- e.get<pde_version>()))
+ if (repo->mask_interface->query_repository_masks(e.name,
+ e.version))
result.set(mr_repository_mask);
if (metadata->get_ebuild_interface())
- if (! metadata->get_ebuild_interface()->get<evm_virtual>().empty())
+ if (! metadata->get_ebuild_interface()->virtual_for.empty())
{
- QualifiedPackageName n(metadata->get_ebuild_interface()->get<evm_virtual>());
+ QualifiedPackageName n(metadata->get_ebuild_interface()->virtual_for);
- if (repo->get_interface<repo_mask>()->query_profile_masks(n,
- e.get<pde_version>()))
+ if (repo->mask_interface->query_profile_masks(n,
+ e.version))
result.set(mr_profile_mask);
- if (repo->get_interface<repo_mask>()->query_repository_masks(n,
- e.get<pde_version>()))
+ if (repo->mask_interface->query_repository_masks(n,
+ e.version))
result.set(mr_repository_mask);
}
}
@@ -225,7 +225,7 @@ Environment::begin_provide_map() const
for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
r_end(package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (*r)->get_interface<repo_installed>())
+ if (! (*r)->installed_interface)
continue;
std::copy((*r)->begin_provide_map(), (*r)->end_provide_map(),
@@ -255,16 +255,16 @@ Environment::package_set(const std::string & s, const PackageSetOptions & o) con
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
{
- if (! (*r)->get_interface<repo_sets>())
+ if (! (*r)->sets_interface)
continue;
- DepAtom::Pointer add((*r)->get_interface<repo_sets>()->package_set(s, o));
+ DepAtom::Pointer add((*r)->sets_interface->package_set(s, o));
if (0 != add)
result->add_child(add);
if ("system" != s)
{
- add = (*r)->get_interface<repo_sets>()->package_set("system");
+ add = (*r)->sets_interface->package_set("system");
if (0 != add)
result->add_child(add);
}
@@ -282,10 +282,10 @@ Environment::package_set(const std::string & s, const PackageSetOptions & o) con
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
{
- if (! (*r)->get_interface<repo_sets>())
+ if (! (*r)->sets_interface)
continue;
- DepAtom::Pointer result((*r)->get_interface<repo_sets>()->package_set(s));
+ DepAtom::Pointer result((*r)->sets_interface->package_set(s));
if (0 != result)
return result;
}
@@ -396,8 +396,8 @@ Environment::add_appropriate_to_world(DepAtom::ConstPointer a,
for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
- if ((*r)->get_interface<repo_world>())
- (*r)->get_interface<repo_world>()->add_to_world((*i)->package());
+ if ((*r)->world_interface)
+ (*r)->world_interface->add_to_world((*i)->package());
}
}
@@ -413,8 +413,8 @@ Environment::remove_appropriate_from_world(DepAtom::ConstPointer a,
for (PackageDatabase::RepositoryIterator r(package_database()->begin_repositories()),
r_end(package_database()->end_repositories()) ;
r != r_end ; ++r)
- if ((*r)->get_interface<repo_world>())
- (*r)->get_interface<repo_world>()->remove_from_world((*i)->package());
+ if ((*r)->world_interface)
+ (*r)->world_interface->remove_from_world((*i)->package());
ww->remove_callback(*i);
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index 21ac375..4bb507e 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -17,24 +17,28 @@ add(`dep_atom', `hh', `cc', `test')
add(`dep_atom_flattener', `hh', `cc')
add(`dep_atom_pretty_printer', `hh', `cc')
add(`dep_list', `hh', `cc', `test')
+add(`dep_list_entry', `sr')
add(`dep_tag', `hh', `cc')
-add(`ebin', `hh', `cc')
-add(`ebuild', `hh', `cc')
+add(`ebin', `hh', `cc', `sr')
+add(`ebuild', `hh', `cc', `sr')
add(`environment', `hh', `cc')
add(`hashed_containers', `hhx', `cc', `test')
add(`mask_reasons', `hh', `cc')
add(`match_package', `hh', `cc')
add(`name', `hh', `cc', `test')
add(`package_database', `hh', `cc', `test')
-add(`package_database_entry', `hh')
+add(`package_database_entry', `hh', `sr')
add(`paludis', `hh')
add(`portage_dep_lexer', `hh', `cc', `test')
add(`portage_dep_parser', `hh', `cc', `test')
-add(`repository', `hh', `cc')
+add(`qualified_package_name', `sr')
+add(`repository', `hh', `cc', `sr')
+add(`repository_config_entry', `sr')
add(`repository_so_loader', `cc')
-add(`syncer', `hh', `cc')
+add(`syncer', `hh', `cc', `sr')
add(`test_environment', `hh', `cc')
-add(`version_metadata', `hh', `cc')
+add(`use_config_entry', `sr')
+add(`version_metadata', `hh', `cc', `sr')
add(`version_operator', `hh', `cc', `test')
-add(`version_spec', `hh', `cc', `test')
+add(`version_spec', `hh', `cc', `sr', `test')
diff --git a/paludis/hashed_containers.cc b/paludis/hashed_containers.cc
index ddee118..a5c60b6 100644
--- a/paludis/hashed_containers.cc
+++ b/paludis/hashed_containers.cc
@@ -34,7 +34,7 @@ using namespace paludis;
std::size_t
CRCHash<QualifiedPackageName>::operator() (const QualifiedPackageName & val) const
{
- const std::string & s1(val.get<qpn_category>().data()), s2(val.get<qpn_package>().data());
+ const std::string & s1(val.category.data()), s2(val.package.data());
std::size_t h(0);
for (std::string::size_type t(0) ; t < s1.length() ; ++t)
@@ -76,8 +76,8 @@ std::size_t
CRCHash<std::pair<QualifiedPackageName, VersionSpec> >::operator() (
const std::pair<QualifiedPackageName, VersionSpec> & val) const
{
- const std::string & s1(val.first.get<qpn_category>().data()),
- s2(val.first.get<qpn_package>().data());
+ const std::string & s1(val.first.category.data()),
+ s2(val.first.package.data());
std::size_t h(0);
diff --git a/paludis/match_package.cc b/paludis/match_package.cc
index 60e5280..ed0bb26 100644
--- a/paludis/match_package.cc
+++ b/paludis/match_package.cc
@@ -33,26 +33,26 @@ match_package_internals::do_match(
const PackageDepAtom * const atom,
const PackageDatabaseEntry * const entry)
{
- if (atom->package() != entry->get<pde_name>())
+ if (atom->package() != entry->name)
return false;
- if (atom->version_spec_ptr() && ! (((entry->get<pde_version>()).*
+ if (atom->version_spec_ptr() && ! (((entry->version).*
(atom->version_operator().as_version_spec_operator()))
(*atom->version_spec_ptr())))
return false;
if (atom->repository_ptr())
- if (*atom->repository_ptr() != entry->get<pde_repository>())
+ if (*atom->repository_ptr() != entry->repository)
return false;
if (atom->slot_ptr() || atom->use_requirements_ptr())
{
VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
- entry->get<pde_repository>())->version_metadata(
- entry->get<pde_name>(), entry->get<pde_version>()));
+ entry->repository)->version_metadata(
+ entry->name, entry->version));
if (atom->slot_ptr())
- if (*atom->slot_ptr() != SlotName(metadata->get<vm_slot>()))
+ if (*atom->slot_ptr() != SlotName(metadata->slot))
return false;
if (atom->use_requirements_ptr())
@@ -89,24 +89,24 @@ match_package_internals::do_match(
const PackageDepAtom * const atom,
const DepListEntry * const entry)
{
- if (atom->package() != entry->get<dle_name>())
+ if (atom->package() != entry->name)
return false;
- if (atom->version_spec_ptr() && ! (((entry->get<dle_version>()).*
+ if (atom->version_spec_ptr() && ! (((entry->version).*
(atom->version_operator().as_version_spec_operator()))
(*atom->version_spec_ptr())))
return false;
- if (atom->repository_ptr() && (*atom->repository_ptr() != entry->get<dle_repository>()))
+ if (atom->repository_ptr() && (*atom->repository_ptr() != entry->repository))
return false;
- if (atom->slot_ptr() && (*atom->slot_ptr() != entry->get<dle_metadata>()->get<vm_slot>()))
+ if (atom->slot_ptr() && (*atom->slot_ptr() != entry->metadata->slot))
return false;
if (atom->use_requirements_ptr())
{
- PackageDatabaseEntry e(entry->get<dle_name>(), entry->get<dle_version>(),
- entry->get<dle_repository>());
+ PackageDatabaseEntry e(entry->name, entry->version,
+ entry->repository);
for (UseRequirements::Iterator u(atom->use_requirements_ptr()->begin()),
u_end(atom->use_requirements_ptr()->end()) ; u != u_end ; ++u)
diff --git a/paludis/name.cc b/paludis/name.cc
index 80e4a77..c42cdeb 100644
--- a/paludis/name.cc
+++ b/paludis/name.cc
@@ -29,6 +29,8 @@
using namespace paludis;
+#include <paludis/qualified_package_name-sr.cc>
+
QualifiedPackageNameError::QualifiedPackageNameError(const std::string & s) throw () :
NameError(s, "qualified package name")
{
@@ -37,25 +39,10 @@ QualifiedPackageNameError::QualifiedPackageNameError(const std::string & s) thro
std::ostream &
paludis::operator<< (std::ostream & s, const QualifiedPackageName & q)
{
- s << q.get<qpn_category>() << "/" << q.get<qpn_package>();
+ s << q.category << "/" << q.package;
return s;
}
-MakeSmartRecord<QualifiedPackageNameTag>::Type
-QualifiedPackageName::_make_parent(
- const std::string & s)
-{
- Context c("When splitting out category and package names from '" + s + "':");
-
- std::string::size_type p(s.find('/'));
- if (std::string::npos == p)
- throw QualifiedPackageNameError(s);
-
- return MakeSmartRecord<QualifiedPackageNameTag>::Type(
- CategoryNamePart(s.substr(0, p)),
- PackageNamePart(s.substr(p + 1)));
-}
-
void
UseFlagNameValidator::validate(const std::string & s)
{
@@ -273,29 +260,38 @@ KeywordNameValidator::validate(const std::string & s)
throw KeywordNameError(s);
}
-QualifiedPackageName::QualifiedPackageName(const CategoryNamePart & c, const PackageNamePart & p) :
- MakeSmartRecord<QualifiedPackageNameTag>::Type(c, p)
+namespace
{
-}
+ CategoryNamePart
+ get_category_name_part(const std::string & s)
+ {
+ Context c("When splitting out category and package names from '" + s + "':");
-QualifiedPackageName::QualifiedPackageName(const QualifiedPackageName & other) :
- MakeSmartRecord<QualifiedPackageNameTag>::Type(other)
-{
-}
+ std::string::size_type p(s.find('/'));
+ if (std::string::npos == p)
+ throw QualifiedPackageNameError(s);
-QualifiedPackageName::QualifiedPackageName(const std::string & s) :
- MakeSmartRecord<QualifiedPackageNameTag>::Type(_make_parent(s))
-{
-}
+ return CategoryNamePart(s.substr(0, p));
-QualifiedPackageName::~QualifiedPackageName()
-{
+ }
+
+ PackageNamePart
+ get_package_name_part(const std::string & s)
+ {
+ Context c("When splitting out category and package names from '" + s + "':");
+
+ std::string::size_type p(s.find('/'));
+ if (std::string::npos == p)
+ throw QualifiedPackageNameError(s);
+
+ return PackageNamePart(s.substr(p + 1));
+
+ }
}
-const QualifiedPackageName &
-QualifiedPackageName::operator= (const QualifiedPackageName & other)
+QualifiedPackageName::QualifiedPackageName(const std::string & s) :
+ category(get_category_name_part(s)),
+ package(get_package_name_part(s))
{
- MakeSmartRecord<QualifiedPackageNameTag>::Type::operator= (other);
- return *this;
}
diff --git a/paludis/name.hh b/paludis/name.hh
index 838cf62..d8311ea 100644
--- a/paludis/name.hh
+++ b/paludis/name.hh
@@ -23,7 +23,7 @@
#include <paludis/util/collection.hh>
#include <paludis/util/exception.hh>
#include <paludis/util/instantiation_policy.hh>
-#include <paludis/util/smart_record.hh>
+#include <paludis/util/sr.hh>
#include <paludis/util/validated.hh>
#include <string>
@@ -131,74 +131,7 @@ namespace paludis
*/
typedef SortedCollection<CategoryNamePart> CategoryNamePartCollection;
- /**
- * Keys for a QualifiedPackageName.
- *
- * \ingroup grpnames
- *
- * \see QualifiedPackageName
- */
- enum QualifiedPackageNameKeys
- {
- qpn_category, ///< The CategoryNamePart part
- qpn_package, ///< The PackageNamePart part
- last_qpn ///< Number of values
- };
-
- /**
- * Tags for a QualifiedPackageName.
- *
- * \ingroup grpnames
- *
- * \see QualifiedPackageName
- */
- struct QualifiedPackageNameTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<QualifiedPackageNameKeys, last_qpn>,
- SmartRecordKey<qpn_category, CategoryNamePart>,
- SmartRecordKey<qpn_package, PackageNamePart>
- {
- };
-
- /**
- * A QualifiedPackageName instance holds a CategoryNamePart and
- * a PackageNamePart.
- *
- * \ingroup grpnames
- */
- class QualifiedPackageName :
- public MakeSmartRecord<QualifiedPackageNameTag>::Type
- {
- private:
- static MakeSmartRecord<QualifiedPackageNameTag>::Type _make_parent(
- const std::string & s);
-
- public:
- /**
- * Constructor.
- */
- QualifiedPackageName(const CategoryNamePart & c, const PackageNamePart & p);
-
- /**
- * Copy constructor.
- */
- QualifiedPackageName(const QualifiedPackageName & other);
-
- /**
- * Constructor, from a raw string.
- */
- explicit QualifiedPackageName(const std::string & s);
-
- /**
- * Assignment.
- */
- const QualifiedPackageName & operator= (const QualifiedPackageName & other);
-
- /**
- * Destructor.
- */
- ~QualifiedPackageName();
- };
+#include <paludis/qualified_package_name-sr.hh>
/**
* Output a QualifiedPackageName to a stream.
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 57e3579..43a16d7 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -34,10 +34,12 @@
using namespace paludis;
+#include "package_database_entry-sr.cc"
+
std::ostream &
paludis::operator<< (std::ostream & s, const PackageDatabaseEntry & v)
{
- s << v.get<pde_name>() << "-" << v.get<pde_version>() << "::" << v.get<pde_repository>();
+ s << v.name << "-" << v.version << "::" << v.repository;
return s;
}
@@ -212,13 +214,13 @@ PackageDatabase::_do_query(const PackageDepAtom & a, const InstallState installe
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
{
- if ((installed_state == is_installed_only) && ! r->get_interface<repo_installed>())
+ if ((installed_state == is_installed_only) && ! r->installed_interface)
continue;
- if ((installed_state == is_uninstalled_only) && r->get_interface<repo_installed>())
+ if ((installed_state == is_uninstalled_only) && r->installed_interface)
continue;
- if (! r->has_category_named(a.package().get<qpn_category>()))
+ if (! r->has_category_named(a.package().category))
continue;
if (! r->has_package_named(a.package()))
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index dbac74b..9d81b90 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -30,7 +30,6 @@
#include <paludis/util/join.hh>
#include <paludis/util/private_implementation_pattern.hh>
#include <paludis/util/stringify.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/collection.hh>
#include <paludis/version_metadata.hh>
#include <paludis/version_spec.hh>
diff --git a/paludis/package_database_entry.hh b/paludis/package_database_entry.hh
index 22ffd5e..1985c06 100644
--- a/paludis/package_database_entry.hh
+++ b/paludis/package_database_entry.hh
@@ -20,40 +20,13 @@
#ifndef PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_HH
#define PALUDIS_GUARD_PALUDIS_PACKAGE_DATABASE_ENTRY_HH 1
-#include <paludis/util/smart_record.hh>
#include <paludis/name.hh>
#include <paludis/version_spec.hh>
namespace paludis
{
- /**
- * Keys in a PackageDatabaseEntry.
- */
- enum PackageDatabaseEntryKeys
- {
- pde_name, ///< Our package
- pde_version, ///< Our version
- pde_repository, ///< Our repository
- last_pde ///< Number of items
- };
- /**
- * Tag for a PackageDatabaseEntry.
- */
- struct PackageDatabaseEntryTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<PackageDatabaseEntryKeys, last_pde>,
- SmartRecordKey<pde_name, QualifiedPackageName>,
- SmartRecordKey<pde_version, VersionSpec>,
- SmartRecordKey<pde_repository, RepositoryName>
- {
- };
-
- /**
- * A PackageDatabaseEntry holds a QualifiedPackageName, a VersionSpec and a
- * RepositoryName, and is fully comparable.
- */
- typedef MakeSmartRecord<PackageDatabaseEntryTag>::Type PackageDatabaseEntry;
+#include <paludis/package_database_entry-sr.hh>
/**
* A collection of PackageDatabaseEntry instances.
diff --git a/paludis/package_database_entry.sr b/paludis/package_database_entry.sr
new file mode 100644
index 0000000..3057e8f
--- /dev/null
+++ b/paludis/package_database_entry.sr
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_PackageDatabaseEntry()
+{
+ key name QualifiedPackageName
+ key version VersionSpec
+ key repository RepositoryName
+
+ comparison_operators all all
+}
+
diff --git a/paludis/qa/Makefile.am.m4 b/paludis/qa/Makefile.am.m4
index fce09dc..b35ffd9 100644
--- a/paludis/qa/Makefile.am.m4
+++ b/paludis/qa/Makefile.am.m4
@@ -7,6 +7,9 @@ if ENABLE_QA
define(`filelist', `')dnl
define(`testlist', `')dnl
+define(`srlist', `')dnl
+define(`srcleanlist', `')dnl
+define(`srheaderlist', `')dnl
define(`testscriptlist', `')dnl
define(`addtest', `define(`testlist', testlist `$1_TEST')dnl
$1_TEST_SOURCES = $1_TEST.cc
@@ -23,9 +26,20 @@ define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.
define(`addhh', `define(`filelist', filelist `$1.hh')')dnl
define(`addcc', `define(`filelist', filelist `$1.cc')')dnl
define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl
+define(`addsr', `define(`srlist', srlist `$1.sr')dnl
+define(`srcleanlist', srcleanlist `$1-sr.hh $1-sr.cc')dnl
+define(`srheaderlist', srheaderlist `$1-sr.hh')dnl
+$1-sr.hh : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $`'(srcdir)/$1.sr > $`'@
+
+$1-sr.cc : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $`'(srcdir)/$1.sr > $`'@
+
+')dnl
define(`addthis', `dnl
ifelse(`$2', `hh', `addhh(`$1')', `')dnl
ifelse(`$2', `cc', `addcc(`$1')', `')dnl
+ifelse(`$2', `sr', `addsr(`$1')', `')dnl
ifelse(`$2', `impl', `addimpl(`$1')', `')dnl
ifelse(`$2', `test', `addtest(`$1')', `')dnl
ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
@@ -59,9 +73,12 @@ qa.hh : qa.hh.m4 files.m4
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in Makefile.am qa.hh
+DISTCLEANFILES = srcleanlist
+BUILT_SOURCES = srcleanlist
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
DEFS= \
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DBIGTEMPDIR=\"/var/tmp\"
-EXTRA_DIST = Makefile.am.m4 files.m4 qa.hh.m4 testscriptlist
+EXTRA_DIST = Makefile.am.m4 files.m4 qa.hh.m4 testscriptlist srlist srcleanlist
+
diff --git a/paludis/qa/check_result.cc b/paludis/qa/check_result.cc
index 29b137b..50ef8f5 100644
--- a/paludis/qa/check_result.cc
+++ b/paludis/qa/check_result.cc
@@ -39,6 +39,6 @@ CheckResult::most_severe_level() const
{
QALevel result(static_cast<QALevel>(0));
for (Iterator i(begin()), i_end(end()) ; i != i_end ; ++i)
- result = std::max(result, i->get<mk_level>());
+ result = std::max(result, i->level);
return result;
}
diff --git a/paludis/qa/create_metadata_check.cc b/paludis/qa/create_metadata_check.cc
index 55c50be..6d5a6c1 100644
--- a/paludis/qa/create_metadata_check.cc
+++ b/paludis/qa/create_metadata_check.cc
@@ -30,17 +30,17 @@ CreateMetadataCheck::CreateMetadataCheck()
CheckResult
CreateMetadataCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- if ("UNKNOWN" == metadata->get<vm_eapi>())
+ if ("UNKNOWN" == metadata->eapi)
result << Message(qal_fatal, "Couldn't generate metadata");
}
catch (const InternalError &)
diff --git a/paludis/qa/dep_any_check.cc b/paludis/qa/dep_any_check.cc
index 7a02091..4cf8a61 100644
--- a/paludis/qa/dep_any_check.cc
+++ b/paludis/qa/dep_any_check.cc
@@ -97,26 +97,26 @@ DepAnyCheck::DepAnyCheck()
CheckResult
DepAnyCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Checker depend_checker(result, "DEPEND");
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_checker);
Checker rdepend_checker(result, "RDEPEND");
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
Checker pdepend_checker(result, "PDEPEND");
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
}
catch (const InternalError &)
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 78721be..3fd89c0 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -64,10 +64,10 @@ namespace
Repository::ConstPointer r(env->package_database()->fetch_repository(env->package_database()->
favourite_repository()));
- if (! r->get_interface<repo_use>())
+ if (! r->use_interface)
throw InternalError(PALUDIS_HERE, "Confused: Repository does not have a UseInterface.");
- if (r->get_interface<repo_use>()->is_arch_flag(u->flag()))
+ if (r->use_interface->is_arch_flag(u->flag()))
{
if (role == "DEPEND" || role == "RDEPEND" || role == "PDEPEND")
{
@@ -79,7 +79,7 @@ namespace
result << Message(qal_major, "Arch flag '" + stringify(u->flag()) +
"' in " + role);
}
- else if (r->get_interface<repo_use>()->is_expand_flag(u->flag()))
+ else if (r->use_interface->is_expand_flag(u->flag()))
{
}
else if (iuse.end() == iuse.find(u->flag()))
@@ -106,47 +106,47 @@ DepFlagsCheck::DepFlagsCheck()
CheckResult
DepFlagsCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::set<UseFlagName> iuse;
WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
- get<evm_iuse>(), create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
iuse.insert(UseFlagName("bootstrap"));
iuse.insert(UseFlagName("build"));
- Checker depend_checker(result, "DEPEND", e.get<ecd_environment>(), iuse);
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ Checker depend_checker(result, "DEPEND", e.environment, iuse);
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_checker);
- Checker rdepend_checker(result, "RDEPEND", e.get<ecd_environment>(), iuse);
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ Checker rdepend_checker(result, "RDEPEND", e.environment, iuse);
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
- Checker pdepend_checker(result, "PDEPEND", e.get<ecd_environment>(), iuse);
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ Checker pdepend_checker(result, "PDEPEND", e.environment, iuse);
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
- Checker provide_checker(result, "PROVIDE", e.get<ecd_environment>(), iuse);
- std::string provide(metadata->get_ebuild_interface()->get<evm_provide>());
+ Checker provide_checker(result, "PROVIDE", e.environment, iuse);
+ std::string provide(metadata->get_ebuild_interface()->provide_string);
PortageDepParser::parse(provide, PortageDepParserPolicy<PackageDepAtom, false>::get_instance())->accept(&provide_checker);
- Checker license_checker(result, "LICENSE", e.get<ecd_environment>(), iuse);
- std::string license(metadata->get<vm_license>());
+ Checker license_checker(result, "LICENSE", e.environment, iuse);
+ std::string license(metadata->license_string);
PortageDepParser::parse(license, PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&license_checker);
- Checker src_uri_checker(result, "SRC_URI", e.get<ecd_environment>(), iuse);
+ Checker src_uri_checker(result, "SRC_URI", e.environment, iuse);
if (metadata->get_ebuild_interface() == 0)
result << Message(qal_fatal, "Not an ebuild");
- std::string src_uri(metadata->get_ebuild_interface()->get<evm_src_uri>());
+ std::string src_uri(metadata->get_ebuild_interface()->src_uri);
PortageDepParser::parse(src_uri, PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&src_uri_checker);
}
diff --git a/paludis/qa/dep_packages_check.cc b/paludis/qa/dep_packages_check.cc
index 7fab3de..b2aadc7 100644
--- a/paludis/qa/dep_packages_check.cc
+++ b/paludis/qa/dep_packages_check.cc
@@ -80,15 +80,15 @@ DepPackagesCheck::DepPackagesCheck()
CheckResult
DepPackagesCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
static std::set<QualifiedPackageName> suspicious_depend;
if (suspicious_depend.empty())
@@ -97,7 +97,7 @@ DepPackagesCheck::operator() (const EbuildCheckData & e) const
}
Checker depend_checker(result, "DEPEND", suspicious_depend);
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_checker);
static std::set<QualifiedPackageName> suspicious_rdepend;
@@ -122,7 +122,7 @@ DepPackagesCheck::operator() (const EbuildCheckData & e) const
}
Checker rdepend_checker(result, "RDEPEND", suspicious_rdepend);
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
}
catch (const InternalError &)
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index bfd24f2..f0c7472 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -93,26 +93,26 @@ DepsExistCheck::DepsExistCheck()
CheckResult
DepsExistCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- Checker depend_checker(result, "DEPEND", e.get<ecd_environment>());
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ Checker depend_checker(result, "DEPEND", e.environment);
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_checker);
- Checker rdepend_checker(result, "RDEPEND", e.get<ecd_environment>());
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ Checker rdepend_checker(result, "RDEPEND", e.environment);
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
- Checker pdepend_checker(result, "PDEPEND", e.get<ecd_environment>());
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ Checker pdepend_checker(result, "PDEPEND", e.environment);
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
}
catch (const InternalError &)
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index 7781bb6..ac92262 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -91,30 +91,30 @@ DepsVisibleCheck::DepsVisibleCheck()
CheckResult
DepsVisibleCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- if (e.get<ecd_environment>()->mask_reasons(ee).any())
+ if (e.environment->mask_reasons(ee).any())
result << Message(qal_skip, "Masked, so skipping checks");
else
{
- Checker depend_checker(result, "DEPEND", e.get<ecd_environment>());
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ Checker depend_checker(result, "DEPEND", e.environment);
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_checker);
- Checker rdepend_checker(result, "RDEPEND", e.get<ecd_environment>());
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ Checker rdepend_checker(result, "RDEPEND", e.environment);
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
- Checker pdepend_checker(result, "PDEPEND", e.get<ecd_environment>());
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ Checker pdepend_checker(result, "PDEPEND", e.environment);
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
}
}
diff --git a/paludis/qa/description_check.cc b/paludis/qa/description_check.cc
index dbebad4..8121c03 100644
--- a/paludis/qa/description_check.cc
+++ b/paludis/qa/description_check.cc
@@ -30,24 +30,24 @@ DescriptionCheck::DescriptionCheck()
CheckResult
DescriptionCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- const std::string::size_type length(metadata->get<vm_description>().length());
+ const std::string::size_type length(metadata->description.length());
if (0 == length)
result << Message(qal_major, "DESCRIPTION unset or empty");
- else if (0 == strcasecmp(e.get<ecd_name>().get<qpn_package>().data().c_str(),
- metadata->get<vm_description>().c_str()))
+ else if (0 == strcasecmp(e.name.package.data().c_str(),
+ metadata->description.c_str()))
result << Message(qal_major, "DESCRIPTION equal to $PN? You can do better than that.");
- else if (std::string::npos != metadata->get<vm_description>().find("Based on the") &&
- std::string::npos != metadata->get<vm_description>().find("eclass"))
+ else if (std::string::npos != metadata->description.find("Based on the") &&
+ std::string::npos != metadata->description.find("eclass"))
result << Message(qal_major, "DESCRIPTION is about as useful as a chocolate teapot");
else if (length < 10)
result << Message(qal_minor, "DESCRIPTION suspiciously short (" + stringify(length) + ")");
diff --git a/paludis/qa/digest_collisions_check.cc b/paludis/qa/digest_collisions_check.cc
index 3ad27fc..6dde528 100644
--- a/paludis/qa/digest_collisions_check.cc
+++ b/paludis/qa/digest_collisions_check.cc
@@ -23,7 +23,6 @@
#include <paludis/qa/digest_collisions_check.hh>
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/tokeniser.hh>
using namespace paludis;
@@ -31,23 +30,7 @@ using namespace paludis::qa;
namespace
{
- enum DigestDataKeys
- {
- de_md5,
- de_owner
- };
-
- struct DigestDataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<DigestDataKeys, 2>,
- SmartRecordKey<de_md5, std::string>,
- SmartRecordKey<de_owner, FSEntry>
- {
- };
-
- typedef MakeSmartRecord<DigestDataTag>::Type DigestData;
-
- static MakeHashedMap<std::string, DigestData>::Type digests;
+ static MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type digests;
}
DigestCollisionsCheck::DigestCollisionsCheck()
@@ -78,17 +61,17 @@ DigestCollisionsCheck::operator() (const FSEntry & d) const
if ("MD5" != entries.at(0))
continue;
- MakeHashedMap<std::string, DigestData>::Type::iterator existing(
+ MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type::iterator existing(
digests.find(entries.at(2)));
if (digests.end() != existing)
{
- if (entries.at(1) != existing->second.get<de_md5>())
+ if (entries.at(1) != existing->second.first)
result << Message(qal_major, "Digest conflict on '" + entries.at(2) +
"' in '" + stringify(*i) +
- "' (original was '" + stringify(existing->second.get<de_owner>()) + "')");
+ "' (original was '" + stringify(existing->second.second) + "')");
}
else
- digests.insert(std::make_pair(entries.at(2), DigestData(entries.at(1), *i)));
+ digests.insert(std::make_pair(entries.at(2), std::make_pair(entries.at(1), *i)));
}
}
diff --git a/paludis/qa/ebuild_check.cc b/paludis/qa/ebuild_check.cc
index 57fe262..639298e 100644
--- a/paludis/qa/ebuild_check.cc
+++ b/paludis/qa/ebuild_check.cc
@@ -22,6 +22,8 @@
using namespace paludis;
using namespace paludis::qa;
+#include <paludis/qa/ebuild_check-sr.cc>
+
EbuildCheck::EbuildCheck()
{
}
diff --git a/paludis/qa/ebuild_check.hh b/paludis/qa/ebuild_check.hh
index b02020f..5190760 100644
--- a/paludis/qa/ebuild_check.hh
+++ b/paludis/qa/ebuild_check.hh
@@ -25,7 +25,6 @@
#include <paludis/qa/check_result.hh>
#include <paludis/qa/environment.hh>
#include <paludis/util/counted_ptr.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/version_spec.hh>
@@ -33,24 +32,8 @@ namespace paludis
{
namespace qa
{
- enum EbuildCheckDataKeys
- {
- ecd_name,
- ecd_version,
- ecd_environment,
- last_ecd
- };
-
- struct EbuildCheckDataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildCheckDataKeys, last_ecd>,
- SmartRecordKey<ecd_name, QualifiedPackageName>,
- SmartRecordKey<ecd_version, VersionSpec>,
- SmartRecordKey<ecd_environment, const Environment *>
- {
- };
- typedef MakeSmartRecord<EbuildCheckDataTag>::Type EbuildCheckData;
+#include <paludis/qa/ebuild_check-sr.hh>
class EbuildCheck :
public Check,
diff --git a/paludis/qa/ebuild_check.sr b/paludis/qa/ebuild_check.sr
new file mode 100644
index 0000000..c5248dd
--- /dev/null
+++ b/paludis/qa/ebuild_check.sr
@@ -0,0 +1,10 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_EbuildCheckData()
+{
+ key name QualifiedPackageName
+ key version VersionSpec
+ key environment "const Environment *"
+}
+
diff --git a/paludis/qa/extract_check.cc b/paludis/qa/extract_check.cc
index 707be13..eba9029 100644
--- a/paludis/qa/extract_check.cc
+++ b/paludis/qa/extract_check.cc
@@ -80,22 +80,22 @@ ExtractCheck::ExtractCheck()
CheckResult
ExtractCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
do
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Checker checker;
- PortageDepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ PortageDepParser::parse(metadata->get_ebuild_interface()->src_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance())->accept(&checker);
- PortageDepParser::parse(metadata->get<vm_deps>().get<vmd_build_depend_string>())->accept(&checker);
+ PortageDepParser::parse(metadata->deps.build_depend_string)->accept(&checker);
if (checker.need_zip && ! checker.have_zip)
result << Message(qal_major, "Found .zip in SRC_URI but app-arch/unzip is not in DEPEND");
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
index 3a4614a..cfc0bf4 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -20,12 +20,12 @@ add(`deps_exist_check', `hh', `cc')
add(`deps_visible_check', `hh', `cc')
add(`description_check', `hh', `cc')
add(`digest_collisions_check', `hh', `cc')
-add(`ebuild_check', `hh', `cc')
-add(`ebuild_count_check', `hh', `cc')
+add(`ebuild_check', `hh', `cc', `sr')
+add(`ebuild_count_check', `hh', `cc')
add(`environment', `hh', `cc')
add(`extract_check', `hh', `cc')
add(`file_check', `hh', `cc')
-add(`filename_check', `hh', `cc')
+add(`filename_check', `hh', `cc')
add(`file_permissions_check', `hh', `cc', `test', `testscript')
add(`files_dir_size_check', `hh', `cc')
add(`glep_31_check', `hh', `cc', `test')
@@ -36,7 +36,7 @@ add(`inherits_check', `hh', `cc')
add(`iuse_check', `hh', `cc')
add(`keywords_check', `hh', `cc')
add(`license_check', `hh', `cc')
-add(`message', `hh', `cc', `test')
+add(`message', `hh', `cc', `sr', `test')
add(`metadata_check', `hh', `cc')
add(`package_dir_check', `hh', `cc')
add(`package_name_check', `hh', `cc', `test', `testscript')
diff --git a/paludis/qa/homepage_check.cc b/paludis/qa/homepage_check.cc
index 46f556f..342f794 100644
--- a/paludis/qa/homepage_check.cc
+++ b/paludis/qa/homepage_check.cc
@@ -29,17 +29,17 @@ HomepageCheck::HomepageCheck()
CheckResult
HomepageCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string homepage(metadata->get<vm_homepage>());
+ std::string homepage(metadata->homepage);
if (homepage.empty())
result << Message(qal_major, "HOMEPAGE empty or unset");
diff --git a/paludis/qa/inherits_check.cc b/paludis/qa/inherits_check.cc
index 709bc7b..72521ac 100644
--- a/paludis/qa/inherits_check.cc
+++ b/paludis/qa/inherits_check.cc
@@ -34,19 +34,19 @@ InheritsCheck::InheritsCheck()
CheckResult
InheritsCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::set<std::string> inherits;
Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->get_ebuild_interface()->get<evm_inherited>(), std::inserter(inherits, inherits.begin()));
+ tokeniser.tokenise(metadata->get_ebuild_interface()->inherited, std::inserter(inherits, inherits.begin()));
static std::set<std::string> inherits_blacklist;
if (inherits_blacklist.empty())
diff --git a/paludis/qa/iuse_check.cc b/paludis/qa/iuse_check.cc
index 7589eca..de59c4d 100644
--- a/paludis/qa/iuse_check.cc
+++ b/paludis/qa/iuse_check.cc
@@ -33,21 +33,21 @@ IuseCheck::IuseCheck()
CheckResult
IuseCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
{
std::set<UseFlagName> iuse;
WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
- get<evm_iuse>(), create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
static std::set<UseFlagName> iuse_blacklist;
diff --git a/paludis/qa/keywords_check.cc b/paludis/qa/keywords_check.cc
index b089d18..94c0d3d 100644
--- a/paludis/qa/keywords_check.cc
+++ b/paludis/qa/keywords_check.cc
@@ -31,22 +31,22 @@ KeywordsCheck::KeywordsCheck()
CheckResult
KeywordsCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
{
//std::set<KeywordName> keywords(metadata->begin_keywords(), metadata->end_keywords());
std::set<KeywordName> keywords;
WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
- get<evm_keywords>(), create_inserter<KeywordName>(std::inserter(keywords, keywords.begin())));
+ keywords, create_inserter<KeywordName>(std::inserter(keywords, keywords.begin())));
if (keywords.end() != keywords.find(KeywordName("-*")) &&
keywords.size() == 1)
@@ -61,7 +61,7 @@ KeywordsCheck::operator() (const EbuildCheckData & e) const
result << Message(qal_major, "Bad entries in KEYWORDS");
}
- if (! metadata->get_ebuild_interface()->get<evm_keywords>().empty())
+ if (! metadata->get_ebuild_interface()->keywords.empty())
result << Message(qal_major, "KEYWORDS was altered by an eclass");
}
catch (const InternalError &)
diff --git a/paludis/qa/license_check.cc b/paludis/qa/license_check.cc
index 22c329d..1ed53bf 100644
--- a/paludis/qa/license_check.cc
+++ b/paludis/qa/license_check.cc
@@ -85,20 +85,20 @@ LicenseCheck::LicenseCheck()
CheckResult
LicenseCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
do
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string license(metadata->get<vm_license>());
+ std::string license(metadata->license_string);
DepAtom::ConstPointer license_parts(0);
try
@@ -106,7 +106,7 @@ LicenseCheck::operator() (const EbuildCheckData & e) const
license_parts = PortageDepParser::parse(license,
PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance());
- Checker checker(result, e.get<ecd_environment>());
+ Checker checker(result, e.environment);
license_parts->accept(&checker);
}
catch (const DepStringError & e)
diff --git a/paludis/qa/message.cc b/paludis/qa/message.cc
index e7bdbcf..06c66ea 100644
--- a/paludis/qa/message.cc
+++ b/paludis/qa/message.cc
@@ -22,3 +22,5 @@
using namespace paludis;
using namespace paludis::qa;
+#include <paludis/qa/message-sr.cc>
+
diff --git a/paludis/qa/message.hh b/paludis/qa/message.hh
index a6ea95d..5611295 100644
--- a/paludis/qa/message.hh
+++ b/paludis/qa/message.hh
@@ -20,7 +20,6 @@
#ifndef PALUDIS_GUARD_PALUDIS_QA_MESSAGE_HH
#define PALUDIS_GUARD_PALUDIS_QA_MESSAGE_HH 1
-#include <paludis/util/smart_record.hh>
#include <string>
/** \file
@@ -43,22 +42,8 @@ namespace paludis
qal_fatal
};
- enum MessageKeys
- {
- mk_level,
- mk_msg,
- last_mk
- };
-
- struct MessageTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<MessageKeys, last_mk>,
- SmartRecordKey<mk_level, QALevel>,
- SmartRecordKey<mk_msg, std::string>
- {
- };
+#include <paludis/qa/message-sr.hh>
- typedef MakeSmartRecord<MessageTag>::Type Message;
}
}
diff --git a/paludis/qa/message.sr b/paludis/qa/message.sr
new file mode 100644
index 0000000..e4f559e
--- /dev/null
+++ b/paludis/qa/message.sr
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_Message()
+{
+ key level QALevel
+ key msg std::string
+}
+
diff --git a/paludis/qa/message_TEST.cc b/paludis/qa/message_TEST.cc
index cc43072..d80b58e 100644
--- a/paludis/qa/message_TEST.cc
+++ b/paludis/qa/message_TEST.cc
@@ -34,8 +34,8 @@ namespace test_cases
void run()
{
Message m(qal_minor, "Test");
- TEST_CHECK_EQUAL(m.get<mk_level>(), qal_minor);
- TEST_CHECK_EQUAL(m.get<mk_msg>(), "Test");
+ TEST_CHECK_EQUAL(m.level, qal_minor);
+ TEST_CHECK_EQUAL(m.msg, "Test");
}
} test_message;
}
diff --git a/paludis/qa/parse_deps_check.cc b/paludis/qa/parse_deps_check.cc
index 5b85a25..df34ac6 100644
--- a/paludis/qa/parse_deps_check.cc
+++ b/paludis/qa/parse_deps_check.cc
@@ -30,19 +30,19 @@ ParseDepsCheck::ParseDepsCheck()
CheckResult
ParseDepsCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
{
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend);
}
catch (const Exception & e)
@@ -53,7 +53,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
try
{
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend);
}
catch (const Exception & e)
@@ -64,7 +64,7 @@ ParseDepsCheck::operator() (const EbuildCheckData & e) const
try
{
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend);
}
catch (const Exception & e)
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index efc0446..8c1d2db 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -74,23 +74,23 @@ PdependOverlapCheck::PdependOverlapCheck()
CheckResult
PdependOverlapCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
Collector pdepend_collector;
- std::string pdepend(metadata->get<vm_deps>().get<vmd_post_depend_string>());
+ std::string pdepend(metadata->deps.post_depend_string);
PortageDepParser::parse(pdepend)->accept(&pdepend_collector);
{
Collector depend_collector;
- std::string depend(metadata->get<vm_deps>().get<vmd_build_depend_string>());
+ std::string depend(metadata->deps.build_depend_string);
PortageDepParser::parse(depend)->accept(&depend_collector);
std::set<QualifiedPackageName> overlap;
@@ -105,7 +105,7 @@ PdependOverlapCheck::operator() (const EbuildCheckData & e) const
{
Collector rdepend_collector;
- std::string rdepend(metadata->get<vm_deps>().get<vmd_run_depend_string>());
+ std::string rdepend(metadata->deps.run_depend_string);
PortageDepParser::parse(rdepend)->accept(&rdepend_collector);
std::set<QualifiedPackageName> overlap;
diff --git a/paludis/qa/restrict_check.cc b/paludis/qa/restrict_check.cc
index ea367e2..16afdd1 100644
--- a/paludis/qa/restrict_check.cc
+++ b/paludis/qa/restrict_check.cc
@@ -33,19 +33,19 @@ RestrictCheck::RestrictCheck()
CheckResult
RestrictCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
std::set<std::string> restricts;
Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->get_ebuild_interface()->get<evm_restrict>(),
+ tokeniser.tokenise(metadata->get_ebuild_interface()->restrict_string,
std::inserter(restricts, restricts.begin()));
static std::set<std::string> allowed_restricts;
diff --git a/paludis/qa/slot_check.cc b/paludis/qa/slot_check.cc
index e27685a..f117279 100644
--- a/paludis/qa/slot_check.cc
+++ b/paludis/qa/slot_check.cc
@@ -29,19 +29,19 @@ SlotCheck::SlotCheck()
CheckResult
SlotCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
try
{
- SlotName slot(metadata->get<vm_slot>());
+ SlotName slot(metadata->slot);
}
catch (const NameError &)
{
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index 1ef96fc..61dcbe7 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -78,8 +78,8 @@ namespace
else
{
mirror_host.erase(p);
- Repository::MirrorInterface * m(env->package_database()->fetch_repository(
- env->package_database()->favourite_repository())->get_interface<repo_mirrors>());
+ RepositoryMirrorsInterface * m(env->package_database()->fetch_repository(
+ env->package_database()->favourite_repository())->mirrors_interface);
if ((! m) || (! m->is_mirror(mirror_host)))
result << Message(qal_major, "Unknown mirror for '" + a->text() + "'");
}
@@ -127,19 +127,19 @@ SrcUriCheck::SrcUriCheck()
CheckResult
SrcUriCheck::operator() (const EbuildCheckData & e) const
{
- CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
identifier());
try
{
do
{
- PackageDatabaseEntry ee(e.get<ecd_name>(), e.get<ecd_version>(),
- e.get<ecd_environment>()->package_database()->favourite_repository());
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
VersionMetadata::ConstPointer metadata(
- e.get<ecd_environment>()->package_database()->fetch_repository(ee.get<pde_repository>())->version_metadata(ee.get<pde_name>(), ee.get<pde_version>()));
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
- std::string src_uri(metadata->get_ebuild_interface()->get<evm_src_uri>());
+ std::string src_uri(metadata->get_ebuild_interface()->src_uri);
DepAtom::ConstPointer src_uri_parts(0);
try
@@ -149,11 +149,11 @@ SrcUriCheck::operator() (const EbuildCheckData & e) const
std::set<std::string> restricts;
Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
- tokeniser.tokenise(metadata->get_ebuild_interface()->get<evm_restrict>(),
+ tokeniser.tokenise(metadata->get_ebuild_interface()->restrict_string,
std::inserter(restricts, restricts.begin()));
bool fetch_restrict(restricts.end() != restricts.find("fetch"));
- Checker checker(result, fetch_restrict, e.get<ecd_environment>());
+ Checker checker(result, fetch_restrict, e.environment);
src_uri_parts->accept(&checker);
}
catch (const DepStringError & e)
diff --git a/paludis/qualified_package_name.sr b/paludis/qualified_package_name.sr
new file mode 100644
index 0000000..13f0b8e
--- /dev/null
+++ b/paludis/qualified_package_name.sr
@@ -0,0 +1,15 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_QualifiedPackageName()
+{
+ key category CategoryNamePart
+ key package PackageNamePart
+
+ comparison_operators all all
+
+ extra_constructors <<END
+ QualifiedPackageName(const std::string &);
+END
+}
+
diff --git a/paludis/repositories/cran/Makefile.am b/paludis/repositories/cran/Makefile.am
index 9e6f884..6257684 100644
--- a/paludis/repositories/cran/Makefile.am
+++ b/paludis/repositories/cran/Makefile.am
@@ -1,4 +1,5 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = cran_repository-sr.hh cran_repository-sr.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -17,13 +18,15 @@ paludis_repositories_cran_include_HEADERS = \
cran_description.hh \
cran_dep_parser.hh \
cran_repository.hh \
- cran_installed_repository.hh
+ cran_repository-sr.hh \
+ cran_installed_repository.hh \
+ cran_installed_repository-sr.hh
libpaludiscranrepository_la_SOURCES = \
cran_description.cc \
cran_dep_parser.cc \
cran_repository.cc \
- cran_installed_repository.cc
+ cran_installed_repository.cc \
$(paludis_repositories_cran_include_HEADERS)
TESTS = cran_dep_parser_TEST cran_repository_TEST
@@ -53,7 +56,19 @@ cran_repository_TEST_CXXFLAGS = -I$(top_srcdir)
EXTRA_DIST = \
cran_repository_TEST.cc \
cran_repository_TEST_setup.sh \
- cran_repository_TEST_cleanup.sh
+ cran_repository_TEST_cleanup.sh \
+ cran_repository.sr \
+ cran_repository-sr.hh \
+ cran_repository-sr.cc \
+ cran_installed_repository.sr \
+ cran_installed_repository-sr.hh \
+ cran_installed_repository-sr.cc
+
+BUILT_SOURCES = \
+ cran_repository-sr.hh \
+ cran_repository-sr.cc \
+ cran_installed_repository-sr.hh \
+ cran_installed_repository-sr.cc
check_PROGRAMS = $(TESTS)
check_SCRIPTS = cran_repository_TEST_setup.sh cran_repository_TEST_cleanup.sh
@@ -65,3 +80,15 @@ TESTS_ENVIRONMENT = env \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
bash $(top_srcdir)/test/run_test.sh
+cran_repository-sr.hh : cran_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/cran_repository.sr > $@
+
+cran_repository-sr.cc : cran_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/cran_repository.sr > $@
+
+cran_installed_repository-sr.hh : cran_installed_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/cran_installed_repository.sr > $@
+
+cran_installed_repository-sr.cc : cran_installed_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/cran_installed_repository.sr > $@
+
diff --git a/paludis/repositories/cran/cran_description.cc b/paludis/repositories/cran/cran_description.cc
index 57c006b..29d88da 100644
--- a/paludis/repositories/cran/cran_description.cc
+++ b/paludis/repositories/cran/cran_description.cc
@@ -36,7 +36,7 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f) :
if (! f.is_regular_file())
{
Log::get_instance()->message(ll_warning, lc_context, "Unexpected irregular file: '" + stringify(f) + "'.");
- metadata->set<vm_eapi>("INVALID");
+ metadata->eapi = "INVALID";
return;
}
@@ -45,9 +45,9 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f) :
LineConfigFile::Iterator l(file.begin()), l_end(file.end());
// Fill in default values
- metadata->set<vm_slot>(SlotName("0"));
- metadata->set<vm_eapi>("CRAN-0");
- metadata->get_cran_interface()->set<cranvm_keywords>(std::string("*"));
+ metadata->slot = SlotName("0");
+ metadata->eapi = "CRAN-0";
+ metadata->get_cran_interface()->keywords = std::string("*");
std::string key;
for ( ; l != l_end ; ++l)
@@ -68,8 +68,8 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f) :
if ("Package" == key)
{
- metadata->get_cran_interface()->set<cranvm_package>(value);
- metadata->set<vm_homepage>("http://cran.r-project.org/src/contrib/Descriptions/" + value + ".html");
+ metadata->get_cran_interface()->package = value;
+ metadata->homepage = "http://cran.r-project.org/src/contrib/Descriptions/" + value + ".html";
CRANDescription::normalise_name(value);
if (n != value)
Log::get_instance()->message(ll_warning, lc_context, "Inconsistent package name in file '" +
@@ -77,17 +77,17 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f) :
}
else if ("Bundle" == key)
{
- metadata->get_cran_interface()->set<cranvm_is_bundle>(true);
+ metadata->get_cran_interface()->is_bundle = true;
}
else if ("Version" == key)
{
- metadata->get_cran_interface()->set<cranvm_version>(value);
+ metadata->get_cran_interface()->version = value;
normalise_version(value);
version = VersionSpec(value);
}
else if ("Title" == key)
{
- metadata->set<vm_description>(value);
+ metadata->description = value;
}
else if ("Depends" == key)
{
@@ -95,8 +95,8 @@ CRANDescription::CRANDescription(const std::string & n, const FSEntry & f) :
value = "R";
else
value.append(", R");
- metadata->get<vm_deps>().set<vmd_build_depend_string>(value);
- metadata->get<vm_deps>().set<vmd_run_depend_string>(value);
+ metadata->deps.build_depend_string = value;
+ metadata->deps.run_depend_string = value;
}
}
}
diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc
index 4d45d3c..53d8a65 100644
--- a/paludis/repositories/cran/cran_installed_repository.cc
+++ b/paludis/repositories/cran/cran_installed_repository.cc
@@ -42,6 +42,7 @@
using namespace paludis;
+#include <paludis/repositories/cran/cran_installed_repository-sr.cc>
namespace paludis
{
@@ -96,11 +97,11 @@ namespace paludis
}
Implementation<CRANInstalledRepository>::Implementation(const CRANInstalledRepositoryParams & p) :
- db(p.get<craninstrpk_package_database>()),
- env(p.get<craninstrpk_environment>()),
- location(p.get<craninstrpk_location>()),
- root(p.get<craninstrpk_root>()),
- world_file(p.get<craninstrpk_world>()),
+ db(p.package_database),
+ env(p.environment),
+ location(p.location),
+ root(p.root),
+ world_file(p.world),
entries_valid(false)
{
}
@@ -155,19 +156,18 @@ Implementation<CRANInstalledRepository>::invalidate() const
CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryParams & p) :
Repository(RepositoryName("cran_installed"),
- RepositoryCapabilities::create((
- param<repo_mask>(static_cast<MaskInterface *>(0)),
- param<repo_installable>(static_cast<InstallableInterface *>(0)),
- param<repo_installed>(this),
- param<repo_news>(static_cast<NewsInterface *>(0)),
- param<repo_sets>(this),
- param<repo_syncable>(static_cast<SyncableInterface *>(0)),
- param<repo_uninstallable>(this),
- param<repo_use>(static_cast<UseInterface *>(0)),
- param<repo_world>(this),
- param<repo_environment_variable>(static_cast<EnvironmentVariableInterface *>(0)),
- param<repo_mirrors>(static_cast<MirrorInterface *>(0))
- ))),
+ RepositoryCapabilities::create()
+ .mask_interface(0)
+ .installable_interface(0)
+ .installed_interface(this)
+ .news_interface(0)
+ .sets_interface(this)
+ .syncable_interface(0)
+ .uninstallable_interface(this)
+ .use_interface(0)
+ .world_interface(this)
+ .environment_variable_interface(0)
+ .mirrors_interface(0)),
PrivateImplementationPattern<CRANInstalledRepository>(new Implementation<CRANInstalledRepository>(p))
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
@@ -195,7 +195,7 @@ CRANInstalledRepository::do_has_package_named(const QualifiedPackageName & q) co
Context context("When checking for package '" + stringify(q) +
"' in " + stringify(name()) + ":");
- if (! do_has_category_named(q.get<qpn_category>()))
+ if (! do_has_category_named(q.category))
return false;
if (! _imp->entries_valid)
@@ -282,12 +282,12 @@ CRANInstalledRepository::do_version_metadata(
VersionMetadata::Pointer result(0);
FSEntry d(_imp->location);
- d /= stringify(q.get<qpn_package>());
+ d /= stringify(q.package);
d /= "DESCRIPTION";
if (d.is_regular_file())
{
- CRANDescription description(stringify(q.get<qpn_package>()), d);
+ CRANDescription description(stringify(q.package), d);
result = description.metadata;
}
else
@@ -296,7 +296,7 @@ CRANInstalledRepository::do_version_metadata(
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': No DESCRIPTION file present.");
result.assign(new VersionMetadata(CRANDepParser::parse));
- result->set<vm_eapi>("UNKNOWN");
+ result->eapi = "UNKNOWN";
return result;
}
@@ -319,7 +319,7 @@ CRANInstalledRepository::do_contents(
if (! has_version(q, v))
return result;
- std::string pn = stringify(q.get<qpn_package>());
+ std::string pn = stringify(q.package);
CRANDescription::normalise_name(pn);
FSEntry f(_imp->location / "paludis" / pn / "CONTENTS");
if (! f.is_regular_file())
@@ -401,12 +401,12 @@ CRANInstalledRepository::make_cran_installed_repository(
if (m->end() == m->find("world") || ((world = m->find("world")->second)).empty())
world = location + "/world";
- return CountedPtr<Repository>(new CRANInstalledRepository(CRANInstalledRepositoryParams::create((
- param<craninstrpk_environment>(env),
- param<craninstrpk_package_database>(db),
- param<craninstrpk_location>(location),
- param<craninstrpk_root>(root),
- param<craninstrpk_world>(world)))));
+ return CountedPtr<Repository>(new CRANInstalledRepository(CRANInstalledRepositoryParams::create()
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .root(root)
+ .world(world)));
}
CRANInstalledRepositoryConfigurationError::CRANInstalledRepositoryConfigurationError(
@@ -435,14 +435,12 @@ CRANInstalledRepository::do_uninstall(const QualifiedPackageName & q, const Vers
VersionMetadata::ConstPointer vm(do_version_metadata(q, v));
MakeEnvCommand cmd(LIBEXECDIR "/paludis/cran.bash unmerge", "");
- cmd = cmd("PN", vm->get_cran_interface()->get<cranvm_package>());
+ cmd = cmd("PN", vm->get_cran_interface()->package);
cmd = cmd("PV", stringify(v));
cmd = cmd("PALUDIS_CRAN_LIBRARY", stringify(_imp->location));
cmd = cmd("PALUDIS_EBUILD_DIR", std::string(LIBEXECDIR "/paludis/"));
cmd = cmd("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files());
-
-
if (0 != run_command(cmd))
throw PackageUninstallActionError("Couldn't unmerge '" + stringify(q) + "-" + stringify(v) + "'");
}
diff --git a/paludis/repositories/cran/cran_installed_repository.hh b/paludis/repositories/cran/cran_installed_repository.hh
index 3b8cd6c..d9309b6 100644
--- a/paludis/repositories/cran/cran_installed_repository.hh
+++ b/paludis/repositories/cran/cran_installed_repository.hh
@@ -23,7 +23,6 @@
#include <paludis/repository.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/fs_entry.hh>
/** \file
@@ -35,46 +34,8 @@
namespace paludis
{
- /**
- * Keys for CRANInstalledRepositoryParams
- *
- * \see CRANInstalledRepositoryParams
- * \ingroup grpcraninstrepository
- */
- enum CRANInstalledRepositoryParamsKeys
- {
- craninstrpk_environment,
- craninstrpk_package_database,
- craninstrpk_location,
- craninstrpk_root,
- craninstrpk_world,
- last_craninstrpk
- };
- /**
- * Tag for CRANInstalledRepositoryParams.
- *
- * \see CRANInstalledRepositoryParams
- * \ingroup grpcraninstrepository
- */
- struct CRANInstalledRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<CRANInstalledRepositoryParamsKeys, last_craninstrpk>,
- SmartRecordKey<craninstrpk_environment, const Environment *>,
- SmartRecordKey<craninstrpk_package_database, const PackageDatabase *>,
- SmartRecordKey<craninstrpk_location, const FSEntry>,
- SmartRecordKey<craninstrpk_root, const FSEntry>,
- SmartRecordKey<craninstrpk_world, const FSEntry>
- {
- };
-
- /**
- * Constructor parameters for CRANInstalledRepository.
- *
- * \see CRANInstalledRepository
- * \ingroup grpcraninstrepository
- */
- typedef MakeSmartRecord<CRANInstalledRepositoryParamsTag>::Type CRANInstalledRepositoryParams;
+#include <paludis/repositories/cran/cran_installed_repository-sr.hh>
/**
* A CRANInstalledRepository represents the database used for
@@ -84,10 +45,10 @@ namespace paludis
*/
class CRANInstalledRepository :
public Repository,
- public Repository::InstalledInterface,
- public Repository::UninstallableInterface,
- public Repository::SetsInterface,
- public Repository::WorldInterface,
+ public RepositoryInstalledInterface,
+ public RepositoryUninstallableInterface,
+ public RepositorySetsInterface,
+ public RepositoryWorldInterface,
public PrivateImplementationPattern<CRANInstalledRepository>
{
protected:
diff --git a/paludis/repositories/cran/cran_installed_repository.sr b/paludis/repositories/cran/cran_installed_repository.sr
new file mode 100644
index 0000000..e972866
--- /dev/null
+++ b/paludis/repositories/cran/cran_installed_repository.sr
@@ -0,0 +1,13 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_CRANInstalledRepositoryParams()
+{
+ key environment "const Environment *"
+ key package_database "const PackageDatabase *"
+ key location FSEntry
+ key root FSEntry
+ key world FSEntry
+ allow_named_args
+}
+
diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc
index 3750496..7cf809a 100644
--- a/paludis/repositories/cran/cran_repository.cc
+++ b/paludis/repositories/cran/cran_repository.cc
@@ -63,6 +63,8 @@
using namespace paludis;
+#include <paludis/repositories/cran/cran_repository-sr.cc>
+
namespace paludis
{
/// Map for versions.
@@ -147,15 +149,15 @@ namespace paludis
}
Implementation<CRANRepository>::Implementation(const CRANRepositoryParams & p) :
- db(p.get<cranrpk_package_database>()),
- env(p.get<cranrpk_environment>()),
- location(p.get<cranrpk_location>()),
- distdir(p.get<cranrpk_distdir>()),
- mirror(p.get<cranrpk_mirror>()),
- sync(p.get<cranrpk_sync>()),
- buildroot(p.get<cranrpk_buildroot>()),
- root(p.get<cranrpk_root>()),
- library(p.get<cranrpk_library>()),
+ db(p.package_database),
+ env(p.environment),
+ location(p.location),
+ distdir(p.distdir),
+ mirror(p.mirror),
+ sync(p.sync),
+ buildroot(p.buildroot),
+ root(p.root),
+ library(p.library),
has_packages(false),
has_mirrors(false)
{
@@ -178,20 +180,19 @@ Implementation<CRANRepository>::invalidate() const
CRANRepository::CRANRepository(const CRANRepositoryParams & p) :
- Repository(CRANRepository::fetch_repo_name(stringify(p.get<cranrpk_location>())),
- RepositoryCapabilities::create((
- param<repo_mask>(static_cast<MaskInterface *>(0)),
- param<repo_installable>(this),
- param<repo_installed>(static_cast<InstalledInterface *>(0)),
- param<repo_news>(static_cast<NewsInterface *>(0)),
- param<repo_sets>(this),
- param<repo_syncable>(this),
- param<repo_uninstallable>(static_cast<UninstallableInterface *>(0)),
- param<repo_use>(static_cast<UseInterface *>(0)),
- param<repo_world>(static_cast<WorldInterface *>(0)),
- param<repo_environment_variable>(static_cast<EnvironmentVariableInterface *>(0)),
- param<repo_mirrors>(static_cast<MirrorInterface *>(0))
- ))),
+ Repository(CRANRepository::fetch_repo_name(stringify(p.location)),
+ RepositoryCapabilities::create()
+ .mask_interface(0)
+ .installable_interface(this)
+ .installed_interface(0)
+ .news_interface(0)
+ .sets_interface(this)
+ .syncable_interface(this)
+ .uninstallable_interface(0)
+ .use_interface(0)
+ .world_interface(0)
+ .environment_variable_interface(0)
+ .mirrors_interface(0)),
PrivateImplementationPattern<CRANRepository>(new Implementation<CRANRepository>(p))
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
@@ -228,7 +229,7 @@ CRANRepository::do_has_package_named(const QualifiedPackageName & q) const
need_packages();
- if (! do_has_category_named(q.get<qpn_category>()))
+ if (! do_has_category_named(q.category))
return false;
return _imp->package_names.end() != _imp->package_names.find(q);
@@ -365,13 +366,13 @@ CRANRepository::need_packages() const
CRANDescription d(*i, FSEntry(_imp->location / std::string(last_package_name + ".DESCRIPTION")));
- std::string dep(d.metadata->get<vm_deps>().get<vmd_build_depend_string>());
- std::string pkg(d.metadata->get_cran_interface()->get<cranvm_package>());
+ std::string dep(d.metadata->deps.build_depend_string);
+ std::string pkg(d.metadata->get_cran_interface()->package);
if ("" == dep)
dep = pkg;
else
dep += "," + pkg;
- d.metadata->get<vm_deps>().set<vmd_build_depend_string>(dep);
+ d.metadata->deps.build_depend_string = dep;
_imp->package_names[d.name] = true;
_imp->metadata.insert(std::make_pair(std::make_pair(d.name, d.version), d.metadata));
@@ -408,7 +409,7 @@ CRANRepository::do_version_metadata(
VersionMetadata::Pointer result(new VersionMetadata(CRANDepParser::parse));
FSEntry d(_imp->location);
- PackageNamePart p(q.get<qpn_package>());
+ PackageNamePart p(q.package);
std::string n(stringify(p));
CRANDescription::denormalise_name(n);
d /= n + ".DESCRIPTION";
@@ -424,7 +425,7 @@ CRANRepository::do_version_metadata(
stringify(q) + "-" + stringify(v) + "' in repository '" +
stringify(name()) + "': File '" + n + ".DESCRIPTION' not present.");
VersionMetadata::Pointer result(new VersionMetadata(CRANDepParser::parse));
- result->set<vm_eapi>("UNKNOWN");
+ result->eapi = "UNKNOWN";
}
_imp->metadata.insert(std::make_pair(std::make_pair(q, v), result));
@@ -475,16 +476,16 @@ CRANRepository::make_cran_repository(
if (m->end() == m->find("root") || ((root = m->find("root")->second)).empty())
root = "/";
- return CountedPtr<Repository>(new CRANRepository(CRANRepositoryParams::create((
- param<cranrpk_environment>(env),
- param<cranrpk_package_database>(db),
- param<cranrpk_location>(location),
- param<cranrpk_distdir>(distdir),
- param<cranrpk_sync>(sync),
- param<cranrpk_buildroot>(buildroot),
- param<cranrpk_root>(root),
- param<cranrpk_library>(library),
- param<cranrpk_mirror>(mirror)))));
+ return CountedPtr<Repository>(new CRANRepository(CRANRepositoryParams::create()
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .distdir(distdir)
+ .sync(sync)
+ .buildroot(buildroot)
+ .root(root)
+ .library(library)
+ .mirror(mirror)));
}
CRANRepositoryConfigurationError::CRANRepositoryConfigurationError(
@@ -503,12 +504,11 @@ void
CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
const InstallOptions &o) const
{
- PackageNamePart pn(q.get<qpn_package>());
+ PackageNamePart pn(q.package);
CategoryNamePart c("cran");
VersionMetadata::ConstPointer vm(do_version_metadata(q, vn));
- std::string p(vm->get_cran_interface()->get<cranvm_package>());
- std::string v(vm->get_cran_interface()->get<cranvm_version>());
-
+ std::string p(vm->get_cran_interface()->package);
+ std::string v(vm->get_cran_interface()->version);
MakeEnvCommand cmd(LIBEXECDIR "/paludis/cran.bash fetch", "");
cmd = cmd("CATEGORY", "cran");
@@ -525,7 +525,7 @@ CRANRepository::do_install(const QualifiedPackageName &q, const VersionSpec &vn,
if (0 != run_command(cmd))
throw PackageInstallActionError("Couldn't fetch sources for '" + stringify(q) + "-" + stringify(vn) + "'");
- if (o.get<io_fetchonly>())
+ if (o.fetch_only)
return;
std::string image(stringify(_imp->buildroot / stringify(q) / "image"));
diff --git a/paludis/repositories/cran/cran_repository.hh b/paludis/repositories/cran/cran_repository.hh
index a15793c..6e209c5 100644
--- a/paludis/repositories/cran/cran_repository.hh
+++ b/paludis/repositories/cran/cran_repository.hh
@@ -23,7 +23,6 @@
#include <paludis/repository.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
#include <string>
/** \file
@@ -36,54 +35,7 @@ namespace paludis
{
class PackageDatabase;
- /**
- * Keys for PortageRepositoryParams.
- *
- * \see PortageRepositoryParams
- * \ingroup grpportagerepository
- */
- enum CRANRepositoryParamsKeys
- {
- cranrpk_environment,
- cranrpk_package_database,
- cranrpk_location,
- cranrpk_distdir,
- cranrpk_mirror,
- cranrpk_sync,
- cranrpk_buildroot,
- cranrpk_root,
- cranrpk_library,
- last_cranrpk
- };
-
- /**
- * Tag for CRANRepositoryParams.
- *
- * \see CRANRepositoryParams
- * \ingroup grpcranrepository
- */
- struct CRANRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<CRANRepositoryParamsKeys, last_cranrpk>,
- SmartRecordKey<cranrpk_environment, const Environment *>,
- SmartRecordKey<cranrpk_package_database, const PackageDatabase *>,
- SmartRecordKey<cranrpk_location, const FSEntry>,
- SmartRecordKey<cranrpk_distdir, const FSEntry>,
- SmartRecordKey<cranrpk_mirror, const std::string>,
- SmartRecordKey<cranrpk_sync, const std::string>,
- SmartRecordKey<cranrpk_buildroot, const FSEntry>,
- SmartRecordKey<cranrpk_root, const FSEntry>,
- SmartRecordKey<cranrpk_library, const FSEntry>
- {
- };
-
- /**
- * Constructor parameters for CRANRepository.
- *
- * \see CRANRepository
- * \ingroup grpcranrepository
- */
- typedef MakeSmartRecord<CRANRepositoryParamsTag>::Type CRANRepositoryParams;
+#include <paludis/repositories/cran/cran_repository-sr.hh>
/**
* A CRANRepository is a Repository that handles the layout used by
@@ -93,9 +45,9 @@ namespace paludis
*/
class CRANRepository :
public Repository,
- public Repository::InstallableInterface,
- public Repository::SyncableInterface,
- public Repository::SetsInterface,
+ public RepositoryInstallableInterface,
+ public RepositorySyncableInterface,
+ public RepositorySetsInterface,
private PrivateImplementationPattern<CRANRepository>
{
private:
diff --git a/paludis/repositories/cran/cran_repository.sr b/paludis/repositories/cran/cran_repository.sr
new file mode 100644
index 0000000..c7b9615
--- /dev/null
+++ b/paludis/repositories/cran/cran_repository.sr
@@ -0,0 +1,18 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_CRANRepositoryParams()
+{
+ key environment "const Environment *"
+ key package_database "const PackageDatabase *"
+ key location FSEntry
+ key distdir FSEntry
+ key mirror std::string
+ key sync std::string
+ key buildroot FSEntry
+ key root FSEntry
+ key library FSEntry
+
+ allow_named_args
+}
+
diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc
index 10ead5c..ec052af 100644
--- a/paludis/repositories/fake/fake_repository.cc
+++ b/paludis/repositories/fake/fake_repository.cc
@@ -70,21 +70,21 @@ namespace paludis
}
FakeRepository::FakeRepository(const RepositoryName & name) :
- Repository(name, RepositoryCapabilities::create((
- param<repo_installable>(static_cast<InstallableInterface *>(0)),
- param<repo_installed>(static_cast<InstalledInterface *>(0)),
- param<repo_mask>(this),
- param<repo_news>(static_cast<NewsInterface *>(0)),
- param<repo_sets>(static_cast<SetsInterface *>(0)),
- param<repo_syncable>(static_cast<SyncableInterface *>(0)),
- param<repo_uninstallable>(static_cast<UninstallableInterface *>(0)),
- param<repo_use>(this),
- param<repo_world>(static_cast<WorldInterface *>(0)),
- param<repo_environment_variable>(static_cast<EnvironmentVariableInterface *>(0)),
- param<repo_mirrors>(static_cast<MirrorInterface *>(0))
- ))),
- Repository::MaskInterface(),
- Repository::UseInterface(),
+ Repository(name, RepositoryCapabilities::create()
+ .installable_interface(0)
+ .installed_interface(0)
+ .mask_interface(this)
+ .news_interface(0)
+ .sets_interface(0)
+ .syncable_interface(0)
+ .uninstallable_interface(0)
+ .use_interface(this)
+ .world_interface(0)
+ .environment_variable_interface(0)
+ .mirrors_interface(0)
+ ),
+ RepositoryMaskInterface(),
+ RepositoryUseInterface(),
PrivateImplementationPattern<FakeRepository>(new Implementation<FakeRepository>)
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
@@ -106,9 +106,9 @@ FakeRepository::do_has_category_named(const CategoryNamePart & c) const
bool
FakeRepository::do_has_package_named(const QualifiedPackageName & q) const
{
- return has_category_named(q.get<qpn_category>()) &&
- (_imp->package_names.find(q.get<qpn_category>())->second->end() !=
- _imp->package_names.find(q.get<qpn_category>())->second->find(q.get<qpn_package>()));
+ return has_category_named(q.category) &&
+ (_imp->package_names.find(q.category)->second->end() !=
+ _imp->package_names.find(q.category)->second->find(q.package));
}
CategoryNamePartCollection::ConstPointer
@@ -133,7 +133,7 @@ FakeRepository::do_package_names(const CategoryNamePart & c) const
VersionSpecCollection::ConstPointer
FakeRepository::do_version_specs(const QualifiedPackageName & n) const
{
- if (! has_category_named(n.get<qpn_category>()))
+ if (! has_category_named(n.category))
throw InternalError(PALUDIS_HERE, "no category");
if (! has_package_named(n))
throw InternalError(PALUDIS_HERE, "no package");
@@ -143,7 +143,7 @@ FakeRepository::do_version_specs(const QualifiedPackageName & n) const
bool
FakeRepository::do_has_version(const QualifiedPackageName & q, const VersionSpec & v) const
{
- if (! has_category_named(q.get<qpn_category>()))
+ if (! has_category_named(q.category))
throw InternalError(PALUDIS_HERE, "no category");
if (! has_package_named(q))
throw InternalError(PALUDIS_HERE, "no package");
@@ -161,8 +161,8 @@ FakeRepository::add_category(const CategoryNamePart & c)
void
FakeRepository::add_package(const QualifiedPackageName & q)
{
- add_category(q.get<qpn_category>());
- _imp->package_names.find(q.get<qpn_category>())->second->insert(q.get<qpn_package>());
+ add_category(q.category);
+ _imp->package_names.find(q.category)->second->insert(q.package);
_imp->versions.insert(std::make_pair(q, new VersionSpecCollection::Concrete));
}
@@ -175,9 +175,9 @@ FakeRepository::add_version(const QualifiedPackageName & q, const VersionSpec &
std::make_pair(stringify(q) + "-" + stringify(v),
VersionMetadata::Pointer(new VersionMetadata::Ebuild(PortageDepParser::parse_depend))));
VersionMetadata::Pointer r(_imp->metadata.find(stringify(q) + "-" + stringify(v))->second);
- r->set<vm_slot>(SlotName("0"));
- r->set<vm_eapi>("0");
- r->get_ebuild_interface()->set<evm_keywords>("test");
+ r->slot = SlotName("0");
+ r->eapi = "0";
+ r->get_ebuild_interface()->keywords = "test";
return r;
}
diff --git a/paludis/repositories/fake/fake_repository.hh b/paludis/repositories/fake/fake_repository.hh
index 04f8d05..776ff36 100644
--- a/paludis/repositories/fake/fake_repository.hh
+++ b/paludis/repositories/fake/fake_repository.hh
@@ -39,8 +39,8 @@ namespace paludis
*/
class FakeRepository :
public Repository,
- public Repository::MaskInterface,
- public Repository::UseInterface,
+ public RepositoryMaskInterface,
+ public RepositoryUseInterface,
private PrivateImplementationPattern<FakeRepository>
{
protected:
diff --git a/paludis/repositories/nothing/Makefile.am b/paludis/repositories/nothing/Makefile.am
index cbe30d8..4035957 100644
--- a/paludis/repositories/nothing/Makefile.am
+++ b/paludis/repositories/nothing/Makefile.am
@@ -1,4 +1,5 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = nothing_repository-sr.hh nothing_repository-sr.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -12,5 +13,23 @@ paludis_repositories_lib_LTLIBRARIES = libpaludisnothingrepository.la
libpaludisnothingrepository_la_SOURCES = nothing_repository.cc nothing_repository.hh
libpaludisnothingrepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
paludis_repositories_nothing_includedir = $(includedir)/paludis/repositories/nothing/
-paludis_repositories_nothing_include_HEADERS = nothing_repository.hh
+
+paludis_repositories_nothing_include_HEADERS = \
+ nothing_repository.hh \
+ nothing_repository-sr.hh
+
+EXTRA_DIST = \
+ nothing_repository-sr.hh \
+ nothing_repository-sr.cc \
+ nothing_repository.sr
+
+BUILT_SOURCES = \
+ nothing_repository-sr.hh \
+ nothing_repository-sr.cc
+
+nothing_repository-sr.hh : nothing_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/nothing_repository.sr > $@
+
+nothing_repository-sr.cc : nothing_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/nothing_repository.sr > $@
diff --git a/paludis/repositories/nothing/nothing_repository.cc b/paludis/repositories/nothing/nothing_repository.cc
index e1a18a1..4132269 100644
--- a/paludis/repositories/nothing/nothing_repository.cc
+++ b/paludis/repositories/nothing/nothing_repository.cc
@@ -37,6 +37,8 @@
using namespace paludis;
+#include <paludis/repositories/nothing/nothing_repository-sr.cc>
+
namespace paludis
{
/**
@@ -71,10 +73,10 @@ namespace paludis
};
Implementation<NothingRepository>::Implementation(const NothingRepositoryParams & p) :
- name(p.get<nrpk_name>()),
- location(p.get<nrpk_location>()),
- sync(p.get<nrpk_sync>()),
- sync_exclude(p.get<nrpk_sync_exclude>())
+ name(p.name),
+ location(p.location),
+ sync(p.sync),
+ sync_exclude(p.sync_exclude)
{
}
@@ -84,20 +86,19 @@ namespace paludis
}
NothingRepository::NothingRepository(const NothingRepositoryParams & p) try :
- Repository(RepositoryName(p.get<nrpk_name>()),
- RepositoryCapabilities::create((
- param<repo_mask>(static_cast<MaskInterface *>(0)),
- param<repo_installable>(static_cast<InstallableInterface *>(0)),
- param<repo_installed>(static_cast<InstalledInterface *>(0)),
- param<repo_news>(static_cast<NewsInterface *>(0)),
- param<repo_sets>(static_cast<SetsInterface *>(0)),
- param<repo_syncable>(this),
- param<repo_uninstallable>(static_cast<UninstallableInterface *>(0)),
- param<repo_use>(static_cast<UseInterface *>(0)),
- param<repo_world>(static_cast<WorldInterface *>(0)),
- param<repo_environment_variable>(static_cast<EnvironmentVariableInterface *>(0)),
- param<repo_mirrors>(static_cast<MirrorInterface *>(0))
- ))),
+ Repository(RepositoryName(p.name),
+ RepositoryCapabilities::create()
+ .mask_interface(0)
+ .installable_interface(0)
+ .installed_interface(0)
+ .news_interface(0)
+ .sets_interface(0)
+ .syncable_interface(this)
+ .uninstallable_interface(0)
+ .use_interface(0)
+ .world_interface(0)
+ .environment_variable_interface(0)
+ .mirrors_interface(0)),
PrivateImplementationPattern<NothingRepository>(new Implementation<NothingRepository>(p))
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
@@ -109,7 +110,7 @@ NothingRepository::NothingRepository(const NothingRepositoryParams & p) try :
}
catch (const NameError & e)
{
- Context context("When making Nothing repository '" + p.get<nrpk_name>() + "':");
+ Context context("When making Nothing repository '" + p.name + "':");
throw NothingRepositoryConfigurationError("Caught NameError: " + e.message());
}
@@ -195,11 +196,11 @@ NothingRepository::make_nothing_repository(
if (m->end() == m->find("sync_exclude") || ((sync_exclude = m->find("sync_exclude")->second)).empty())
; // nothing
- return CountedPtr<Repository>(new NothingRepository(NothingRepositoryParams::create((
- param<nrpk_name>(name),
- param<nrpk_location>(location),
- param<nrpk_sync>(sync),
- param<nrpk_sync_exclude>(sync_exclude)))));
+ return CountedPtr<Repository>(new NothingRepository(NothingRepositoryParams::create()
+ .name(name)
+ .location(location)
+ .sync(sync)
+ .sync_exclude(sync_exclude)));
}
NothingRepositoryConfigurationError::NothingRepositoryConfigurationError(
diff --git a/paludis/repositories/nothing/nothing_repository.hh b/paludis/repositories/nothing/nothing_repository.hh
index a47d60e..f5728c5 100644
--- a/paludis/repositories/nothing/nothing_repository.hh
+++ b/paludis/repositories/nothing/nothing_repository.hh
@@ -22,7 +22,7 @@
#include <paludis/repository.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
+#include <paludis/util/fs_entry.hh>
/** \file
* Declarations for the NothingRepository class.
@@ -33,46 +33,8 @@
namespace paludis
{
class PackageDatabase;
- class FSEntry;
- /**
- * Keys for NothingRepositoryParams.
- *
- * \see NothingRepositoryParams
- * \ingroup grpnothingrepository
- */
- enum NothingRepositoryParamsKeys
- {
- nrpk_name,
- nrpk_location,
- nrpk_sync,
- nrpk_sync_exclude,
- last_nrpk
- };
-
- /**
- * Tag for NothingRepositoryParams.
- *
- * \see NothingRepositoryParams
- * \ingroup grpnothingrepository
- */
- struct NothingRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<NothingRepositoryParamsKeys, last_nrpk>,
- SmartRecordKey<nrpk_location, const FSEntry>,
- SmartRecordKey<nrpk_name, const std::string>,
- SmartRecordKey<nrpk_sync, const std::string>,
- SmartRecordKey<nrpk_sync_exclude, const std::string>
- {
- };
-
- /**
- * Constructor parameters for NothingRepository.
- *
- * \see NothingRepository
- * \ingroup grpnothingrepository
- */
- typedef MakeSmartRecord<NothingRepositoryParamsTag>::Type NothingRepositoryParams;
+#include <paludis/repositories/nothing/nothing_repository-sr.hh>
/**
* A NothingRepository is a Repository that has no content, but can be
@@ -82,7 +44,7 @@ namespace paludis
*/
class NothingRepository :
public Repository,
- public Repository::SyncableInterface,
+ public RepositorySyncableInterface,
private PrivateImplementationPattern<NothingRepository>
{
protected:
diff --git a/paludis/repositories/nothing/nothing_repository.sr b/paludis/repositories/nothing/nothing_repository.sr
new file mode 100644
index 0000000..71bf2d1
--- /dev/null
+++ b/paludis/repositories/nothing/nothing_repository.sr
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_NothingRepositoryParams()
+{
+ key location FSEntry
+ key name std::string
+ key sync std::string
+ key sync_exclude std::string
+
+ allow_named_args
+}
+
+
diff --git a/paludis/repositories/portage/Makefile.am b/paludis/repositories/portage/Makefile.am
index abed3cc..c8932bf 100644
--- a/paludis/repositories/portage/Makefile.am
+++ b/paludis/repositories/portage/Makefile.am
@@ -1,4 +1,5 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = portage_repository-sr.hh portage_repository-sr.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -19,6 +20,7 @@ paludis_repositories_portage_include_HEADERS = \
portage_repository_exceptions.hh \
portage_repository_news.hh \
portage_repository_params.hh \
+ portage_repository_params-sr.hh \
portage_repository_sets.hh \
portage_repository_entries.hh \
portage_repository_ebuild_entries.hh \
@@ -35,6 +37,7 @@ libpaludisportagerepository_la_SOURCES = \
portage_repository_entries.cc \
portage_repository_ebuild_entries.cc \
portage_repository_ebin_entries.cc \
+ portage_repository_params.cc \
make_ebuild_repository.cc \
make_ebin_repository.cc \
$(paludis_repositories_portage_include_HEADERS)
@@ -56,7 +59,14 @@ portage_repository_TEST_CXXFLAGS = -I$(top_srcdir)
EXTRA_DIST = \
portage_repository_TEST.cc \
portage_repository_TEST_setup.sh \
- portage_repository_TEST_cleanup.sh
+ portage_repository_TEST_cleanup.sh \
+ portage_repository_params-sr.hh \
+ portage_repository_params-sr.cc \
+ portage_repository_params.sr
+
+BUILT_SOURCES = \
+ portage_repository_params-sr.hh \
+ portage_repository_params-sr.cc
check_PROGRAMS = $(TESTS)
check_SCRIPTS = portage_repository_TEST_setup.sh portage_repository_TEST_cleanup.sh
@@ -68,3 +78,10 @@ TESTS_ENVIRONMENT = env \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
bash $(top_srcdir)/test/run_test.sh
+portage_repository_params-sr.hh : portage_repository_params.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/portage_repository_params.sr > $@
+
+portage_repository_params-sr.cc : portage_repository_params.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/portage_repository_params.sr > $@
+
+
diff --git a/paludis/repositories/portage/make_ebin_repository.cc b/paludis/repositories/portage/make_ebin_repository.cc
index 880aaeb..d53d6eb 100644
--- a/paludis/repositories/portage/make_ebin_repository.cc
+++ b/paludis/repositories/portage/make_ebin_repository.cc
@@ -81,22 +81,22 @@ paludis::make_ebin_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
- param<prpk_entry_format>("ebin"),
- param<prpk_environment>(env),
- param<prpk_package_database>(db),
- param<prpk_location>(location),
- param<prpk_profiles>(profiles),
- param<prpk_cache>(FSEntry("/var/empty")),
- param<prpk_eclassdirs>(eclassdirs),
- param<prpk_distdir>(FSEntry("/var/empty")),
- param<prpk_pkgdir>(pkgdir),
- param<prpk_securitydir>(securitydir),
- param<prpk_setsdir>(setsdir),
- param<prpk_newsdir>(newsdir),
- param<prpk_sync>(sync),
- param<prpk_sync_exclude>(sync_exclude),
- param<prpk_root>(root),
- param<prpk_buildroot>(buildroot)))));
+ return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create()
+ .entry_format("ebin")
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .profiles(profiles)
+ .cache(FSEntry("/var/empty"))
+ .eclassdirs(eclassdirs)
+ .distdir(FSEntry("/var/empty"))
+ .pkgdir(pkgdir)
+ .securitydir(securitydir)
+ .setsdir(setsdir)
+ .newsdir(newsdir)
+ .sync(sync)
+ .sync_exclude(sync_exclude)
+ .root(root)
+ .buildroot(buildroot)));
}
diff --git a/paludis/repositories/portage/make_ebuild_repository.cc b/paludis/repositories/portage/make_ebuild_repository.cc
index 1916572..bc0add4 100644
--- a/paludis/repositories/portage/make_ebuild_repository.cc
+++ b/paludis/repositories/portage/make_ebuild_repository.cc
@@ -110,23 +110,23 @@ paludis::make_ebuild_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create((
- param<prpk_entry_format>("ebuild"),
- param<prpk_environment>(env),
- param<prpk_package_database>(db),
- param<prpk_location>(location),
- param<prpk_profiles>(profiles),
- param<prpk_cache>(cache),
- param<prpk_eclassdirs>(eclassdirs),
- param<prpk_distdir>(distdir),
- param<prpk_pkgdir>(FSEntry("/var/empty")),
- param<prpk_securitydir>(securitydir),
- param<prpk_setsdir>(setsdir),
- param<prpk_newsdir>(newsdir),
- param<prpk_sync>(sync),
- param<prpk_sync_exclude>(sync_exclude),
- param<prpk_root>(root),
- param<prpk_buildroot>(buildroot)))));
+ return CountedPtr<Repository>(new PortageRepository(PortageRepositoryParams::create()
+ .entry_format("ebuild")
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .profiles(profiles)
+ .cache(cache)
+ .eclassdirs(eclassdirs)
+ .distdir(distdir)
+ .pkgdir(FSEntry("/var/empty"))
+ .securitydir(securitydir)
+ .setsdir(setsdir)
+ .newsdir(newsdir)
+ .sync(sync)
+ .sync_exclude(sync_exclude)
+ .root(root)
+ .buildroot(buildroot)));
}
CountedPtr<Repository>
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 6a4fa15..97312ae 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -189,10 +189,10 @@ namespace paludis
has_arch_list(false),
has_mirrors(false),
profile_ptr(0),
- news_ptr(new PortageRepositoryNews(params.get<prpk_environment>(), repo, p)),
- sets_ptr(new PortageRepositorySets(params.get<prpk_environment>(), repo, p)),
+ news_ptr(new PortageRepositoryNews(params.environment, repo, p)),
+ sets_ptr(new PortageRepositorySets(params.environment, repo, p)),
entries_ptr(PortageRepositoryEntriesMaker::get_instance()->find_maker(
- params.get<prpk_entry_format>())(params.get<prpk_environment>(), repo, p)),
+ params.entry_format)(params.environment, repo, p)),
has_our_virtuals(false)
{
}
@@ -208,7 +208,7 @@ namespace paludis
return;
profile_ptr.assign(new PortageRepositoryProfile(
- params.get<prpk_environment>(), *params.get<prpk_profiles>()));
+ params.environment, *params.profiles));
}
void
@@ -231,42 +231,42 @@ namespace paludis
}
PortageRepository::PortageRepository(const PortageRepositoryParams & p) :
- Repository(PortageRepository::fetch_repo_name(stringify(p.get<prpk_location>())),
- RepositoryCapabilities::create((
- param<repo_mask>(this),
- param<repo_installable>(this),
- param<repo_installed>(static_cast<InstalledInterface *>(0)),
- param<repo_news>(this),
- param<repo_sets>(this),
- param<repo_syncable>(this),
- param<repo_uninstallable>(static_cast<UninstallableInterface *>(0)),
- param<repo_use>(this),
- param<repo_world>(static_cast<WorldInterface *>(0)),
- param<repo_environment_variable>(this),
- param<repo_mirrors>(this)
- ))),
+ Repository(PortageRepository::fetch_repo_name(stringify(p.location)),
+ RepositoryCapabilities::create()
+ .mask_interface(this)
+ .installable_interface(this)
+ .installed_interface(0)
+ .news_interface(this)
+ .sets_interface(this)
+ .syncable_interface(this)
+ .uninstallable_interface(0)
+ .use_interface(this)
+ .world_interface(0)
+ .environment_variable_interface(this)
+ .mirrors_interface(this)
+ ),
PrivateImplementationPattern<PortageRepository>(new Implementation<PortageRepository>(this, p))
{
// the info_vars and info_pkgs info is only added on demand, since it's
// fairly slow to calculate.
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
- config_info->add_kv("location", stringify(_imp->params.get<prpk_location>()));
- config_info->add_kv("profiles", join(_imp->params.get<prpk_profiles>()->begin(),
- _imp->params.get<prpk_profiles>()->end(), " "));
- config_info->add_kv("eclassdirs", join(_imp->params.get<prpk_eclassdirs>()->begin(),
- _imp->params.get<prpk_eclassdirs>()->end(), " "));
- config_info->add_kv("cache", stringify(_imp->params.get<prpk_cache>()));
- config_info->add_kv("distdir", stringify(_imp->params.get<prpk_distdir>()));
- config_info->add_kv("pkgdir", stringify(_imp->params.get<prpk_pkgdir>()));
- config_info->add_kv("securitydir", stringify(_imp->params.get<prpk_securitydir>()));
- config_info->add_kv("setsdir", stringify(_imp->params.get<prpk_setsdir>()));
- config_info->add_kv("newsdir", stringify(_imp->params.get<prpk_newsdir>()));
+ config_info->add_kv("location", stringify(_imp->params.location));
+ config_info->add_kv("profiles", join(_imp->params.profiles->begin(),
+ _imp->params.profiles->end(), " "));
+ config_info->add_kv("eclassdirs", join(_imp->params.eclassdirs->begin(),
+ _imp->params.eclassdirs->end(), " "));
+ config_info->add_kv("cache", stringify(_imp->params.cache));
+ config_info->add_kv("distdir", stringify(_imp->params.distdir));
+ config_info->add_kv("pkgdir", stringify(_imp->params.pkgdir));
+ config_info->add_kv("securitydir", stringify(_imp->params.securitydir));
+ config_info->add_kv("setsdir", stringify(_imp->params.setsdir));
+ config_info->add_kv("newsdir", stringify(_imp->params.newsdir));
config_info->add_kv("format", "portage");
- config_info->add_kv("root", stringify(_imp->params.get<prpk_root>()));
- config_info->add_kv("buildroot", stringify(_imp->params.get<prpk_buildroot>()));
- config_info->add_kv("sync", _imp->params.get<prpk_sync>());
- config_info->add_kv("sync_exclude", _imp->params.get<prpk_sync_exclude>());
+ config_info->add_kv("root", stringify(_imp->params.root));
+ config_info->add_kv("buildroot", stringify(_imp->params.buildroot));
+ config_info->add_kv("sync", _imp->params.sync);
+ config_info->add_kv("sync_exclude", _imp->params.sync_exclude);
_info->add_section(config_info);
}
@@ -294,10 +294,10 @@ PortageRepository::do_has_package_named(const QualifiedPackageName & q) const
need_category_names();
- if (q.get<qpn_category>() == CategoryNamePart("virtual"))
+ if (q.category == CategoryNamePart("virtual"))
need_virtual_names();
- CategoryMap::iterator cat_iter(_imp->category_names.find(q.get<qpn_category>()));
+ CategoryMap::iterator cat_iter(_imp->category_names.find(q.category));
if (_imp->category_names.end() == cat_iter)
return false;
@@ -311,9 +311,9 @@ PortageRepository::do_has_package_named(const QualifiedPackageName & q) const
_imp->package_names.end())
return true;
- FSEntry fs(_imp->params.get<prpk_location>());
- fs /= stringify(q.get<qpn_category>());
- fs /= stringify(q.get<qpn_package>());
+ FSEntry fs(_imp->params.location);
+ fs /= stringify(q.category);
+ fs /= stringify(q.package);
if (! fs.is_directory())
return false;
_imp->package_names.insert(std::make_pair(q, false));
@@ -343,7 +343,7 @@ namespace
/// Predicate.
bool operator() (const QualifiedPackageName & a) const
{
- return a.get<qpn_category>() == category;
+ return a.category == category;
}
};
}
@@ -380,8 +380,8 @@ PortageRepository::do_package_names(const CategoryNamePart & c) const
if (_imp->category_names.end() == _imp->category_names.find(c))
return QualifiedPackageNameCollection::Pointer(new QualifiedPackageNameCollection::Concrete);
- if ((_imp->params.get<prpk_location>() / stringify(c)).is_directory())
- for (DirIterator d(_imp->params.get<prpk_location>() / stringify(c)), d_end ; d != d_end ; ++d)
+ if ((_imp->params.location / stringify(c)).is_directory())
+ for (DirIterator d(_imp->params.location / stringify(c)), d_end ; d != d_end ; ++d)
{
if (! d->is_directory())
continue;
@@ -452,7 +452,7 @@ PortageRepository::need_category_names() const
Context context("When loading category names for " + stringify(name()) + ":");
- LineConfigFile cats(_imp->params.get<prpk_location>() / "profiles" / "categories");
+ LineConfigFile cats(_imp->params.location / "profiles" / "categories");
for (LineConfigFile::Iterator line(cats.begin()), line_end(cats.end()) ;
line != line_end ; ++line)
@@ -464,7 +464,7 @@ PortageRepository::need_category_names() const
void
PortageRepository::need_version_names(const QualifiedPackageName & n) const
{
- if (n.get<qpn_category>() == CategoryNamePart("virtual"))
+ if (n.category == CategoryNamePart("virtual"))
need_virtual_names();
if (_imp->package_names[n])
@@ -475,9 +475,9 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
VersionSpecCollection::Pointer v(new VersionSpecCollection::Concrete);
- FSEntry path(_imp->params.get<prpk_location>() / stringify(n.get<qpn_category>()) /
- stringify(n.get<qpn_package>()));
- if (CategoryNamePart("virtual") == n.get<qpn_category>() && ! path.exists())
+ FSEntry path(_imp->params.location / stringify(n.category) /
+ stringify(n.package));
+ if (CategoryNamePart("virtual") == n.category && ! path.exists())
{
VirtualsMap::iterator i(_imp->our_virtuals.find(n));
need_version_names(i->second->package());
@@ -487,7 +487,7 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
vv != vv_end ; ++vv)
{
PackageDatabaseEntry e(i->second->package(), *vv, name());
- if (! match_package(_imp->params.get<prpk_environment>(), i->second, e))
+ if (! match_package(_imp->params.environment, i->second, e))
continue;
v->insert(*vv);
@@ -497,7 +497,7 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
{
for (DirIterator e(path), e_end ; e != e_end ; ++e)
{
- if (! IsFileWithExtension(stringify(n.get<qpn_package>()) + "-",
+ if (! IsFileWithExtension(stringify(n.package) + "-",
_imp->entries_ptr->file_extension())(*e))
continue;
@@ -505,7 +505,7 @@ PortageRepository::need_version_names(const QualifiedPackageName & n) const
{
v->insert(strip_leading_string(
strip_trailing_string(e->basename(), _imp->entries_ptr->file_extension()),
- stringify(n.get<qpn_package>()) + "-"));
+ stringify(n.package) + "-"));
}
catch (const NameError &)
{
@@ -579,7 +579,7 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
Context context("When querying repository mask for '" + stringify(q) + "-"
+ stringify(v) + "':");
- FSEntry fff(_imp->params.get<prpk_location>() / "profiles" / "package.mask");
+ FSEntry fff(_imp->params.location / "profiles" / "package.mask");
if (fff.exists())
{
LineConfigFile ff(fff);
@@ -600,7 +600,7 @@ PortageRepository::do_query_repository_masks(const QualifiedPackageName & q, con
else
for (IndirectIterator<std::list<PackageDepAtom::ConstPointer>::const_iterator, const PackageDepAtom>
k(r->second.begin()), k_end(r->second.end()) ; k != k_end ; ++k)
- if (match_package(_imp->params.get<prpk_environment>(), *k, PackageDatabaseEntry(q, v, name())))
+ if (match_package(_imp->params.environment, *k, PackageDatabaseEntry(q, v, name())))
return true;
return false;
@@ -653,8 +653,8 @@ PortageRepository::need_virtual_names() const
i_end(_imp->profile_ptr->end_virtuals()) ; i != i_end ; ++i)
_imp->our_virtuals.insert(*i);
- for (Environment::ProvideMapIterator p(_imp->params.get<prpk_environment>()->begin_provide_map()),
- p_end(_imp->params.get<prpk_environment>()->end_provide_map()) ; p != p_end ; ++p)
+ for (Environment::ProvideMapIterator p(_imp->params.environment->begin_provide_map()),
+ p_end(_imp->params.environment->end_provide_map()) ; p != p_end ; ++p)
{
if (! has_package_named(p->second))
continue;
@@ -683,7 +683,7 @@ PortageRepository::do_is_arch_flag(const UseFlagName & u) const
{
Context context("When checking arch list for '" + stringify(u) + "':");
- LineConfigFile archs(_imp->params.get<prpk_location>() / "profiles" / "arch.list");
+ LineConfigFile archs(_imp->params.location / "profiles" / "arch.list");
std::copy(archs.begin(), archs.end(), create_inserter<UseFlagName>(
std::inserter(_imp->arch_list, _imp->arch_list.begin())));
@@ -745,7 +745,7 @@ PortageRepository::do_expand_flag_delim_pos(const UseFlagName & u) const
bool
PortageRepository::do_is_licence(const std::string & s) const
{
- FSEntry l(_imp->params.get<prpk_location>());
+ FSEntry l(_imp->params.location);
l /= "licenses";
if (! l.is_directory())
@@ -760,9 +760,9 @@ PortageRepository::need_mirrors() const
{
if (! _imp->has_mirrors)
{
- if ((_imp->params.get<prpk_location>() / "profiles" / "thirdpartymirrors").exists())
+ if ((_imp->params.location / "profiles" / "thirdpartymirrors").exists())
{
- LineConfigFile mirrors(_imp->params.get<prpk_location>() / "profiles" / "thirdpartymirrors");
+ LineConfigFile mirrors(_imp->params.location / "profiles" / "thirdpartymirrors");
for (LineConfigFile::Iterator line(mirrors.begin()) ; line != mirrors.end() ; ++line)
{
std::vector<std::string> entries;
@@ -783,7 +783,7 @@ PortageRepository::need_mirrors() const
else
Log::get_instance()->message(ll_warning, lc_no_context,
"No thirdpartymirrors file found in '"
- + stringify(_imp->params.get<prpk_location>() / "profiles") + "', so mirror:// SRC_URI "
+ + stringify(_imp->params.location / "profiles") + "', so mirror:// SRC_URI "
"components cannot be fetched");
_imp->has_mirrors = true;
@@ -796,9 +796,9 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
{
_imp->need_profiles();
- if (! _imp->params.get<prpk_root>().is_directory())
+ if (! _imp->params.root.is_directory())
throw PackageInstallActionError("Can't install '" + stringify(q) + "-"
- + stringify(v) + "' since root ('" + stringify(_imp->params.get<prpk_root>()) + "') isn't a directory");
+ + stringify(v) + "' since root ('" + stringify(_imp->params.root) + "') isn't a directory");
_imp->entries_ptr->install(q, v, o, _imp->profile_ptr);
}
@@ -820,18 +820,18 @@ PortageRepository::do_sync() const
{
Context context("When syncing repository '" + stringify(name()) + "':");
- if (_imp->params.get<prpk_sync>().empty())
+ if (_imp->params.sync.empty())
return false;
- std::string::size_type p(_imp->params.get<prpk_sync>().find("://")), q(_imp->params.get<prpk_sync>().find(":"));
+ std::string::size_type p(_imp->params.sync.find("://")), q(_imp->params.sync.find(":"));
if (std::string::npos == p)
- throw NoSuchSyncerError(_imp->params.get<prpk_sync>());
+ throw NoSuchSyncerError(_imp->params.sync);
- SyncOptions opts(_imp->params.get<prpk_sync_exclude>());
+ SyncOptions opts(_imp->params.sync_exclude);
- SyncerMaker::get_instance()->find_maker(_imp->params.get<prpk_sync>().substr(0, std::min(p, q)))(
- stringify(_imp->params.get<prpk_location>()),
- _imp->params.get<prpk_sync>().substr(q < p ? q + 1 : 0))->sync(opts);
+ SyncerMaker::get_instance()->find_maker(_imp->params.sync.substr(0, std::min(p, q)))(
+ stringify(_imp->params.location),
+ _imp->params.sync.substr(q < p ? q + 1 : 0))->sync(opts);
return true;
}
@@ -870,8 +870,8 @@ PortageRepository::get_environment_variable(
_imp->need_profiles();
- return _imp->entries_ptr->get_environment_variable(for_package.get<pde_name>(),
- for_package.get<pde_version>(), var, _imp->profile_ptr);
+ return _imp->entries_ptr->get_environment_variable(for_package.name,
+ for_package.version, var, _imp->profile_ptr);
}
RepositoryInfo::ConstPointer
@@ -888,9 +888,9 @@ PortageRepository::info(bool verbose) const
result->add_section(*s);
std::set<std::string> info_pkgs;
- if ((_imp->params.get<prpk_location>() / "profiles" / "info_pkgs").exists())
+ if ((_imp->params.location / "profiles" / "info_pkgs").exists())
{
- LineConfigFile vars(_imp->params.get<prpk_location>() / "profiles" / "info_pkgs");
+ LineConfigFile vars(_imp->params.location / "profiles" / "info_pkgs");
info_pkgs.insert(vars.begin(), vars.end());
}
@@ -901,7 +901,7 @@ PortageRepository::info(bool verbose) const
i_end(info_pkgs.end()) ; i != i_end ; ++i)
{
PackageDatabaseEntryCollection::ConstPointer q(
- _imp->params.get<prpk_environment>()->package_database()->query(
+ _imp->params.environment->package_database()->query(
PackageDepAtom::ConstPointer(new PackageDepAtom(*i)), is_installed_only));
if (q->empty())
package_info->add_kv(*i, "(none)");
@@ -914,7 +914,7 @@ PortageRepository::info(bool verbose) const
// std::mem_fun_ref(&PackageDatabaseEntry::get<pde_version>));
for (PackageDatabaseEntryCollection::Iterator qq(q->begin()), qq_end(q->end()) ;
qq != qq_end ; ++qq)
- versions.insert(qq->get<pde_version>());
+ versions.insert(qq->version);
package_info->add_kv(*i, join(versions.begin(), versions.end(), ", "));
}
}
@@ -923,9 +923,9 @@ PortageRepository::info(bool verbose) const
}
std::set<std::string> info_vars;
- if ((_imp->params.get<prpk_location>() / "profiles" / "info_vars").exists())
+ if ((_imp->params.location / "profiles" / "info_vars").exists())
{
- LineConfigFile vars(_imp->params.get<prpk_location>() / "profiles" / "info_vars");
+ LineConfigFile vars(_imp->params.location / "profiles" / "info_vars");
info_vars.insert(vars.begin(), vars.end());
}
diff --git a/paludis/repositories/portage/portage_repository.hh b/paludis/repositories/portage/portage_repository.hh
index 2f1a201..ea22658 100644
--- a/paludis/repositories/portage/portage_repository.hh
+++ b/paludis/repositories/portage/portage_repository.hh
@@ -23,7 +23,6 @@
#include <paludis/repository.hh>
#include <paludis/util/fs_entry.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/repositories/portage/portage_repository_params.hh>
#include <string>
@@ -47,14 +46,14 @@ namespace paludis
*/
class PortageRepository :
public Repository,
- public Repository::MaskInterface,
- public Repository::UseInterface,
- public Repository::InstallableInterface,
- public Repository::SyncableInterface,
- public Repository::NewsInterface,
- public Repository::SetsInterface,
- public Repository::EnvironmentVariableInterface,
- public Repository::MirrorInterface,
+ public RepositoryMaskInterface,
+ public RepositoryUseInterface,
+ public RepositoryInstallableInterface,
+ public RepositorySyncableInterface,
+ public RepositoryNewsInterface,
+ public RepositorySetsInterface,
+ public RepositoryEnvironmentVariableInterface,
+ public RepositoryMirrorsInterface,
private PrivateImplementationPattern<PortageRepository>
{
private:
diff --git a/paludis/repositories/portage/portage_repository_TEST.cc b/paludis/repositories/portage/portage_repository_TEST.cc
index 285cf82..6216229 100644
--- a/paludis/repositories/portage/portage_repository_TEST.cc
+++ b/paludis/repositories/portage/portage_repository_TEST.cc
@@ -498,7 +498,7 @@ namespace test_cases
VersionMetadata::ConstPointer m(0);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get<vm_description>(), "the-description");
+ TEST_CHECK_EQUAL(m->description, "the-description");
TEST_CHECK_THROWS(repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2")),
NoSuchPackageError);
@@ -539,8 +539,8 @@ namespace test_cases
VersionMetadata::ConstPointer m(0);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get<vm_description>(), "The Description");
- TEST_CHECK_EQUAL(m->get<vm_eapi>(), "0");
+ TEST_CHECK_EQUAL(m->description, "The Description");
+ TEST_CHECK_EQUAL(m->eapi, "0");
}
}
} test_portage_repository_metadata_uncached;
@@ -576,7 +576,7 @@ namespace test_cases
VersionMetadata::ConstPointer m(0);
m = repo->version_metadata(QualifiedPackageName("cat-one/pkg-two"), VersionSpec("1"));
- TEST_CHECK_EQUAL(m->get<vm_eapi>(), "UNKNOWN");
+ TEST_CHECK_EQUAL(m->eapi, "UNKNOWN");
}
}
} test_portage_repository_metadata_unparsable;
diff --git a/paludis/repositories/portage/portage_repository_ebin_entries.cc b/paludis/repositories/portage/portage_repository_ebin_entries.cc
index ff394e0..7eb8e6e 100644
--- a/paludis/repositories/portage/portage_repository_ebin_entries.cc
+++ b/paludis/repositories/portage/portage_repository_ebin_entries.cc
@@ -81,43 +81,42 @@ PortageRepositoryEbinEntries::generate_version_metadata(const QualifiedPackageNa
{
VersionMetadata::Pointer result(new VersionMetadata::Ebin(PortageDepParser::parse_depend));
- FSEntry ebin_file(_imp->params.get<prpk_location>());
- ebin_file /= stringify(q.get<qpn_category>());
- ebin_file /= stringify(q.get<qpn_package>());
- ebin_file /= (stringify(q.get<qpn_package>()) + "-" + stringify(v) + ".ebin");
+ FSEntry ebin_file(_imp->params.location);
+ ebin_file /= stringify(q.category);
+ ebin_file /= stringify(q.package);
+ ebin_file /= (stringify(q.package) + "-" + stringify(v) + ".ebin");
PortageRepository::OurVirtualsIterator vi(_imp->portage_repository->end_our_virtuals());
if (ebin_file.is_regular_file())
{
KeyValueConfigFile f(ebin_file);
- result->get<vm_deps>().set<vmd_build_depend_string>(f.get("depend"));
- result->get<vm_deps>().set<vmd_run_depend_string>(f.get("rdepend"));
- result->get<vm_deps>().set<vmd_post_depend_string>(f.get("pdepend"));
- result->set<vm_slot>(SlotName(f.get("slot")));
- result->set<vm_license>(f.get("license"));
- result->set<vm_eapi>(f.get("eapi"));
- result->set<vm_homepage>(f.get("homepage"));
- result->set<vm_description>(f.get("description"));
- result->get_ebuild_interface()->set<evm_provide>(f.get("provide"));
- result->get_ebuild_interface()->set<evm_restrict>(f.get("restrict"));
- result->get_ebuild_interface()->set<evm_keywords>(f.get("keywords"));
- result->get_ebuild_interface()->set<evm_iuse>(f.get("iuse"));
- result->get_ebuild_interface()->set<evm_virtual>(f.get("virtual"));
- result->get_ebuild_interface()->set<evm_inherited>(f.get("inherited"));
- result->get_ebin_interface()->set<ebvm_bin_uri>(f.get("bin_uri"));
- result->get_ebin_interface()->set<ebvm_src_repository>(RepositoryName(f.get("src_repository")));
+ result->deps.build_depend_string = f.get("depend");
+ result->deps.run_depend_string = f.get("rdepend");
+ result->deps.post_depend_string = f.get("pdepend");
+ result->slot = SlotName(f.get("slot"));
+ result->license_string = f.get("license");
+ result->eapi = f.get("eapi");
+ result->homepage = f.get("homepage");
+ result->description = f.get("description");
+ result->get_ebuild_interface()->provide_string = f.get("provide");
+ result->get_ebuild_interface()->restrict_string = f.get("restrict");
+ result->get_ebuild_interface()->keywords = f.get("keywords");
+ result->get_ebuild_interface()->iuse = f.get("iuse");
+ result->get_ebuild_interface()->virtual_for = f.get("virtual");
+ result->get_ebuild_interface()->inherited = f.get("inherited");
+ result->get_ebin_interface()->bin_uri = f.get("bin_uri");
+ result->get_ebin_interface()->src_repository = RepositoryName(f.get("src_repository"));
}
else if (_imp->portage_repository->end_our_virtuals() !=
((vi = _imp->portage_repository->find_our_virtuals(q))))
{
VersionMetadata::ConstPointer m(_imp->portage_repository->version_metadata(
vi->second->package(), v));
- result->set<vm_slot>(m->get<vm_slot>());
- result->get_ebuild_interface()->set<evm_keywords>(m->get_ebuild_interface()->get<evm_keywords>());
- result->set<vm_eapi>(m->get<vm_eapi>());
- result->get_ebuild_interface()->set<evm_virtual>(stringify(vi->second->package()));
- result->get<vm_deps>().set<vmd_build_depend_string>(
- "=" + stringify(vi->second->package()) + "-" + stringify(v));
+ result->slot = m->slot;
+ result->get_ebuild_interface()->keywords = m->get_ebuild_interface()->keywords;
+ result->eapi = m->eapi;
+ result->get_ebuild_interface()->virtual_for = (stringify(vi->second->package()));
+ result->deps.build_depend_string = "=" + stringify(vi->second->package()) + "-" + stringify(v);
}
else
throw NoSuchPackageError(stringify(PackageDatabaseEntry(q, v, _imp->portage_repository->name())));
@@ -133,11 +132,11 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
VersionMetadata::ConstPointer metadata(0);
if (! _imp->portage_repository->has_version(q, v))
{
- if (q.get<qpn_category>() == CategoryNamePart("virtual"))
+ if (q.category == CategoryNamePart("virtual"))
{
VersionMetadata::Ebin::Pointer m(new VersionMetadata::Ebin(PortageDepParser::parse_depend));
- m->set<vm_slot>(SlotName("0"));
- m->get_ebuild_interface()->set<evm_virtual>(" ");
+ m->slot = SlotName("0");
+ m->get_ebuild_interface()->virtual_for = " ";
metadata = m;
}
else
@@ -154,9 +153,9 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
std::set<std::string> already_in_binaries;
/* make B */
- DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->get_ebin_interface()->get<ebvm_bin_uri>(),
+ DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->get_ebin_interface()->bin_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
- DepAtomFlattener f(_imp->params.get<prpk_environment>(), &e, f_atom);
+ DepAtomFlattener f(_imp->params.environment, &e, f_atom);
for (DepAtomFlattener::Iterator ff(f.begin()), ff_end(f.end()) ; ff != ff_end ; ++ff)
{
@@ -181,8 +180,8 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
/* add * mirror entries */
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors("*")),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors("*")) ;
+ m(_imp->params.environment->begin_mirrors("*")),
+ m_end(_imp->params.environment->end_mirrors("*")) ;
m != m_end ; ++m)
flat_bin_uri.append(m->second + "/" + (*ff)->text().substr(p + 1) + " ");
@@ -201,12 +200,12 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
mirror.substr(0, q) + "'");
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors(mirror.substr(0, q))),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors(mirror.substr(0, q))) ;
+ m(_imp->params.environment->begin_mirrors(mirror.substr(0, q))),
+ m_end(_imp->params.environment->end_mirrors(mirror.substr(0, q))) ;
m != m_end ; ++m)
flat_bin_uri.append(m->second + "/" + mirror.substr(q + 1) + " ");
- for (Repository::MirrorInterface::MirrorsIterator
+ for (RepositoryMirrorsInterface::MirrorsIterator
m(_imp->portage_repository->begin_mirrors(mirror.substr(0, q))),
m_end(_imp->portage_repository->end_mirrors(mirror.substr(0, q))) ;
m != m_end ; ++m)
@@ -221,12 +220,12 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
if (_imp->portage_repository->is_mirror(master_mirror))
{
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors(master_mirror)),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors(master_mirror)) ;
+ m(_imp->params.environment->begin_mirrors(master_mirror)),
+ m_end(_imp->params.environment->end_mirrors(master_mirror)) ;
m != m_end ; ++m)
flat_bin_uri.append(m->second + "/" + (*ff)->text().substr(p + 1) + " ");
- for (Repository::MirrorInterface::MirrorsIterator
+ for (RepositoryMirrorsInterface::MirrorsIterator
m(_imp->portage_repository->begin_mirrors(master_mirror)),
m_end(_imp->portage_repository->end_mirrors(master_mirror)) ;
m != m_end ; ++m)
@@ -239,10 +238,10 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
{
std::set<UseFlagName> iuse;
WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
- get<evm_iuse>(), create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
for (std::set<UseFlagName>::const_iterator iuse_it(iuse.begin()), iuse_end(iuse.end()) ;
iuse_it != iuse_end; ++iuse_it)
- if (_imp->params.get<prpk_environment>()->query_use(*iuse_it, &e))
+ if (_imp->params.environment->query_use(*iuse_it, &e))
use += (*iuse_it).data() + " ";
}
@@ -263,7 +262,7 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
u != u_end ; ++u)
use += lower_x + "_" + *u + " ";
- UseFlagNameCollection::Pointer u(_imp->params.get<prpk_environment>()->query_enabled_use_matching(
+ UseFlagNameCollection::Pointer u(_imp->params.environment->query_enabled_use_matching(
lower_x + "_", &e));
for (UseFlagNameCollection::Iterator uu(u->begin()), uu_end(u->end()) ;
uu != uu_end ; ++uu)
@@ -280,7 +279,7 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
&::tolower);
prefix.append("_");
- UseFlagNameCollection::Pointer x(_imp->params.get<prpk_environment>()->query_enabled_use_matching(prefix, &e));
+ UseFlagNameCollection::Pointer x(_imp->params.environment->query_enabled_use_matching(prefix, &e));
std::string value;
for (UseFlagNameCollection::Iterator xx(x->begin()), xx_end(x->end()) ;
xx != xx_end ; ++xx)
@@ -291,50 +290,48 @@ PortageRepositoryEbinEntries::install(const QualifiedPackageName & q, const Vers
binaries = strip_trailing(binaries, " ");
- EbinFetchCommand fetch_cmd(EbinCommandParams::create((
- param<ebcpk_environment>(_imp->params.get<prpk_environment>()),
- param<ebcpk_db_entry>(&e),
- param<ebcpk_src_repository>(metadata->get_ebin_interface()->get<ebvm_src_repository>()),
- param<ebcpk_ebin_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ebcpk_pkgdir>(_imp->params.get<prpk_pkgdir>()),
- param<ebcpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )),
- EbinFetchCommandParams::create((
- param<ebcfpk_b>(binaries),
- param<ebcfpk_flat_bin_uri>(flat_bin_uri),
- param<ebcfpk_root>(stringify(_imp->params.get<prpk_root>()) + "/"),
- param<ebcfpk_profiles>(_imp->params.get<prpk_profiles>())
- )));
-
- if (metadata->get_ebuild_interface()->get<evm_virtual>().empty())
+ EbinFetchCommand fetch_cmd(EbinCommandParams::create()
+ .environment(_imp->params.environment)
+ .db_entry(&e)
+ .src_repository(metadata->get_ebin_interface()->src_repository)
+ .ebin_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .pkgdir(_imp->params.pkgdir)
+ .buildroot(_imp->params.buildroot),
+
+ EbinFetchCommandParams::create()
+ .b(binaries)
+ .flat_bin_uri(flat_bin_uri)
+ .root(stringify(_imp->params.root) + "/")
+ .profiles(_imp->params.profiles));
+
+ if (metadata->get_ebuild_interface()->virtual_for.empty())
fetch_cmd();
- if (o.get<io_fetchonly>())
+ if (o.fetch_only)
return;
- EbinInstallCommand install_cmd(EbinCommandParams::create((
- param<ebcpk_environment>(_imp->params.get<prpk_environment>()),
- param<ebcpk_db_entry>(&e),
- param<ebcpk_src_repository>(metadata->get_ebin_interface()->get<ebvm_src_repository>()),
- param<ebcpk_ebin_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ebcpk_pkgdir>(_imp->params.get<prpk_pkgdir>()),
- param<ebcpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )),
- EbinInstallCommandParams::create((
- param<ebcipk_b>(binaries),
- param<ebcipk_use>(use),
- param<ebcipk_use_expand>(join(
+ EbinInstallCommand install_cmd(EbinCommandParams::create()
+ .environment(_imp->params.environment)
+ .db_entry(&e)
+ .src_repository(metadata->get_ebin_interface()->src_repository)
+ .ebin_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .pkgdir(_imp->params.pkgdir)
+ .buildroot(_imp->params.buildroot),
+
+ EbinInstallCommandParams::create()
+ .b(binaries)
+ .use(use)
+ .use_expand(join(
p->begin_use_expand(),
- p->end_use_expand(), " ")),
- param<ebcipk_expand_vars>(expand_vars),
- param<ebcipk_root>(stringify(_imp->params.get<prpk_root>()) + "/"),
- param<ebcipk_profiles>(_imp->params.get<prpk_profiles>()),
- param<ebcipk_disable_cfgpro>(o.get<io_noconfigprotect>()),
- param<ebcipk_merge_only>(! metadata->get_ebuild_interface()->get<evm_virtual>().empty()),
- param<ebcipk_slot>(SlotName(metadata->get<vm_slot>()))
- )));
+ p->end_use_expand(), " "))
+ .expand_vars(expand_vars)
+ .root(stringify(_imp->params.root) + "/")
+ .profiles(_imp->params.profiles)
+ .disable_cfgpro(o.no_config_protect)
+ .merge_only(! metadata->get_ebuild_interface()->virtual_for.empty())
+ .slot(SlotName(metadata->slot)));
install_cmd();
}
@@ -347,40 +344,40 @@ PortageRepositoryEbinEntries::get_environment_variable(const QualifiedPackageNam
VersionMetadata::ConstPointer metadata(_imp->portage_repository->version_metadata(q, v));
if (s == "DEPEND")
- return metadata->get<vm_deps>().get<vmd_build_depend_string>();
+ return metadata->deps.build_depend_string;
if (s == "RDEPEND")
- return metadata->get<vm_deps>().get<vmd_run_depend_string>();
+ return metadata->deps.run_depend_string;
if (s == "PDEPEND")
- return metadata->get<vm_deps>().get<vmd_post_depend_string>();
+ return metadata->deps.post_depend_string;
if (s == "SLOT")
- return stringify(metadata->get<vm_slot>());
+ return stringify(metadata->slot);
if (s == "LICENSE")
- return metadata->get<vm_license>();
+ return metadata->license_string;
if (s == "EAPI")
- return metadata->get<vm_eapi>();
+ return metadata->eapi;
if (s == "HOMEPAGE")
- return metadata->get<vm_homepage>();
+ return metadata->homepage;
if (s == "DESCRIPTION")
- return metadata->get<vm_description>();
+ return metadata->description;
if (s == "PROVIDE")
- return metadata->get_ebuild_interface()->get<evm_provide>();
+ return metadata->get_ebuild_interface()->provide_string;
if (s == "SRC_URI")
- return metadata->get_ebuild_interface()->get<evm_src_uri>();
+ return metadata->get_ebuild_interface()->src_uri;
if (s == "RESTRICT")
- return metadata->get_ebuild_interface()->get<evm_restrict>();
+ return metadata->get_ebuild_interface()->restrict_string;
if (s == "KEYWORDS")
- return metadata->get_ebuild_interface()->get<evm_keywords>();
+ return metadata->get_ebuild_interface()->keywords;
if (s == "IUSE")
- return metadata->get_ebuild_interface()->get<evm_iuse>();
+ return metadata->get_ebuild_interface()->iuse;
if (s == "VIRTUAL")
- return metadata->get_ebuild_interface()->get<evm_inherited>();
+ return metadata->get_ebuild_interface()->inherited;
if (s == "BIN_URI")
- return metadata->get_ebin_interface()->get<ebvm_bin_uri>();
+ return metadata->get_ebin_interface()->bin_uri;
if (s == "SRC_REPOSITORY")
- return stringify(metadata->get_ebin_interface()->get<ebvm_src_repository>());
+ return stringify(metadata->get_ebin_interface()->src_repository);
PackageDatabaseEntry for_package(q, v, _imp->portage_repository->name());
throw EnvironmentVariableActionError("Couldn't get environment variable '" +
diff --git a/paludis/repositories/portage/portage_repository_ebuild_entries.cc b/paludis/repositories/portage/portage_repository_ebuild_entries.cc
index 5a0c75c..4a255d3 100644
--- a/paludis/repositories/portage/portage_repository_ebuild_entries.cc
+++ b/paludis/repositories/portage/portage_repository_ebuild_entries.cc
@@ -80,9 +80,9 @@ PortageRepositoryEbuildEntries::generate_version_metadata(const QualifiedPackage
{
VersionMetadata::Pointer result(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
- FSEntry cache_file(_imp->params.get<prpk_cache>());
- cache_file /= stringify(q.get<qpn_category>());
- cache_file /= stringify(q.get<qpn_package>()) + "-" + stringify(v);
+ FSEntry cache_file(_imp->params.cache);
+ cache_file /= stringify(q.category);
+ cache_file /= stringify(q.package) + "-" + stringify(v);
bool ok(false);
PortageRepository::OurVirtualsIterator vi(_imp->portage_repository->end_our_virtuals());
@@ -93,44 +93,44 @@ PortageRepositoryEbuildEntries::generate_version_metadata(const QualifiedPackage
if (cache)
{
- std::getline(cache, line); result->get<vm_deps>().set<vmd_build_depend_string>(line);
- std::getline(cache, line); result->get<vm_deps>().set<vmd_run_depend_string>(line);
- std::getline(cache, line); result->set<vm_slot>(SlotName(line));
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_src_uri>(line);
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_restrict>(line);
- std::getline(cache, line); result->set<vm_homepage>(line);
- std::getline(cache, line); result->set<vm_license>(line);
- std::getline(cache, line); result->set<vm_description>(line);
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_keywords>(line);
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_inherited>(line);
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_iuse>(line);
+ std::getline(cache, line); result->deps.build_depend_string = line;
+ std::getline(cache, line); result->deps.run_depend_string = line;
+ std::getline(cache, line); result->slot = SlotName(line);
+ std::getline(cache, line); result->get_ebuild_interface()->src_uri = line;
+ std::getline(cache, line); result->get_ebuild_interface()->restrict_string = line;
+ std::getline(cache, line); result->homepage = line;
+ std::getline(cache, line); result->license_string = line;
+ std::getline(cache, line); result->description = line;
+ std::getline(cache, line); result->get_ebuild_interface()->keywords = line;
+ std::getline(cache, line); result->get_ebuild_interface()->inherited = line;
+ std::getline(cache, line); result->get_ebuild_interface()->iuse = line;
std::getline(cache, line);
- std::getline(cache, line); result->get<vm_deps>().set<vmd_post_depend_string>(line);
- std::getline(cache, line); result->get_ebuild_interface()->set<evm_provide>(line);
- std::getline(cache, line); result->set<vm_eapi>(line);
- result->get_ebuild_interface()->set<evm_virtual>("");
+ std::getline(cache, line); result->deps.post_depend_string = line;
+ std::getline(cache, line); result->get_ebuild_interface()->provide_string = line;
+ std::getline(cache, line); result->eapi = line;
+ result->get_ebuild_interface()->virtual_for = "";
// check mtimes
time_t cache_time(cache_file.mtime());
ok = true;
- if ((_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>()) /
- (stringify(q.get<qpn_package>()) + "-" + stringify(v)
+ if ((_imp->params.location / stringify(q.category) /
+ stringify(q.package) /
+ (stringify(q.package) + "-" + stringify(v)
+ ".ebuild")).mtime() > cache_time)
ok = false;
else
{
- FSEntry timestamp(_imp->params.get<prpk_location>() / "metadata" / "timestamp");
+ FSEntry timestamp(_imp->params.location / "metadata" / "timestamp");
if (timestamp.exists())
cache_time = timestamp.mtime();
std::list<std::string> inherits;
WhitespaceTokeniser::get_instance()->tokenise(
- stringify(result->get_ebuild_interface()->get<evm_inherited>()),
+ stringify(result->get_ebuild_interface()->inherited),
std::back_inserter(inherits));
- for (FSEntryCollection::Iterator e(_imp->params.get<prpk_eclassdirs>()->begin()),
- e_end(_imp->params.get<prpk_eclassdirs>()->end()) ; e != e_end ; ++e)
+ for (FSEntryCollection::Iterator e(_imp->params.eclassdirs->begin()),
+ e_end(_imp->params.eclassdirs->end()) ; e != e_end ; ++e)
for (std::list<std::string>::const_iterator i(inherits.begin()),
i_end(inherits.end()) ; i != i_end ; ++i)
{
@@ -154,35 +154,34 @@ PortageRepositoryEbuildEntries::generate_version_metadata(const QualifiedPackage
{
VersionMetadata::ConstPointer m(_imp->portage_repository->version_metadata(
vi->second->package(), v));
- result->set<vm_slot>(m->get<vm_slot>());
- result->get_ebuild_interface()->set<evm_keywords>(m->get_ebuild_interface()->get<evm_keywords>());
- result->set<vm_eapi>(m->get<vm_eapi>());
- result->get_ebuild_interface()->set<evm_virtual>(stringify(vi->second->package()));
- result->get<vm_deps>().set<vmd_build_depend_string>(
- "=" + stringify(vi->second->package()) + "-" + stringify(v));
+ result->slot = m->slot;
+ result->get_ebuild_interface()->keywords = m->get_ebuild_interface()->keywords;
+ result->eapi = m->eapi;
+ result->get_ebuild_interface()->virtual_for = stringify(vi->second->package());
+ result->deps.build_depend_string = "=" + stringify(vi->second->package()) + "-" + stringify(v);
ok = true;
}
if (! ok)
{
- if (_imp->params.get<prpk_cache>().basename() != "empty")
+ if (_imp->params.cache.basename() != "empty")
Log::get_instance()->message(ll_warning, lc_no_context,
"No usable cache entry for '" + stringify(q) +
"-" + stringify(v) + "' in '" + stringify(_imp->portage_repository->name()) + "'");
PackageDatabaseEntry e(q, v, _imp->portage_repository->name());
- EbuildMetadataCommand cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->environment),
- param<ecpk_db_entry>(&e),
- param<ecpk_ebuild_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ecpk_files_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>()) / "files"),
- param<ecpk_eclassdirs>(_imp->params.get<prpk_eclassdirs>()),
- param<ecpk_portdir>(_imp->params.get<prpk_location>()),
- param<ecpk_distdir>(_imp->params.get<prpk_distdir>()),
- param<ecpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )));
+ EbuildMetadataCommand cmd(EbuildCommandParams::create()
+ .environment(_imp->environment)
+ .db_entry(&e)
+ .ebuild_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .files_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .portdir(_imp->params.location)
+ .distdir(_imp->params.distdir)
+ .buildroot(_imp->params.buildroot));
+
if (! cmd())
Log::get_instance()->message(ll_warning, lc_no_context,
"No usable metadata for '" + stringify(q)
@@ -266,11 +265,11 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
VersionMetadata::ConstPointer metadata(0);
if (! _imp->portage_repository->has_version(q, v))
{
- if (q.get<qpn_category>() == CategoryNamePart("virtual"))
+ if (q.category == CategoryNamePart("virtual"))
{
VersionMetadata::Ebuild::Pointer m(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
- m->set<vm_slot>(SlotName("0"));
- m->get_ebuild_interface()->set<evm_virtual>(" ");
+ m->slot = SlotName("0");
+ m->get_ebuild_interface()->virtual_for = " ";
metadata = m;
}
else
@@ -286,7 +285,7 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
{
std::list<std::string> restricts;
WhitespaceTokeniser::get_instance()->tokenise(
- metadata->get_ebuild_interface()->get<evm_restrict>(), std::back_inserter(restricts));
+ metadata->get_ebuild_interface()->restrict_string, std::back_inserter(restricts));
fetch_restrict = (restricts.end() != std::find(restricts.begin(), restricts.end(), "fetch")) ||
(restricts.end() != std::find(restricts.begin(), restricts.end(), "nofetch"));
no_mirror = (restricts.end() != std::find(restricts.begin(), restricts.end(), "mirror")) ||
@@ -298,9 +297,9 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
std::set<std::string> already_in_archives;
/* make A and FLAT_SRC_URI */
- DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ DepAtom::ConstPointer f_atom(PortageDepParser::parse(metadata->get_ebuild_interface()->src_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
- DepAtomFlattener f(_imp->params.get<prpk_environment>(), &e, f_atom);
+ DepAtomFlattener f(_imp->params.environment, &e, f_atom);
for (DepAtomFlattener::Iterator ff(f.begin()), ff_end(f.end()) ; ff != ff_end ; ++ff)
{
@@ -325,8 +324,8 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
/* add * mirror entries */
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors("*")),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors("*")) ;
+ m(_imp->params.environment->begin_mirrors("*")),
+ m_end(_imp->params.environment->end_mirrors("*")) ;
m != m_end ; ++m)
flat_src_uri.append(m->second + "/" + (*ff)->text().substr(p + 1) + " ");
@@ -345,12 +344,12 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
mirror.substr(0, q) + "'");
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors(mirror.substr(0, q))),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors(mirror.substr(0, q))) ;
+ m(_imp->params.environment->begin_mirrors(mirror.substr(0, q))),
+ m_end(_imp->params.environment->end_mirrors(mirror.substr(0, q))) ;
m != m_end ; ++m)
flat_src_uri.append(m->second + "/" + mirror.substr(q + 1) + " ");
- for (Repository::MirrorInterface::MirrorsIterator
+ for (RepositoryMirrorsInterface::MirrorsIterator
m(_imp->portage_repository->begin_mirrors(mirror.substr(0, q))),
m_end(_imp->portage_repository->end_mirrors(mirror.substr(0, q))) ;
m != m_end ; ++m)
@@ -365,12 +364,12 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
if (! no_mirror && _imp->portage_repository->is_mirror(master_mirror))
{
for (Environment::MirrorIterator
- m(_imp->params.get<prpk_environment>()->begin_mirrors(master_mirror)),
- m_end(_imp->params.get<prpk_environment>()->end_mirrors(master_mirror)) ;
+ m(_imp->params.environment->begin_mirrors(master_mirror)),
+ m_end(_imp->params.environment->end_mirrors(master_mirror)) ;
m != m_end ; ++m)
flat_src_uri.append(m->second + "/" + (*ff)->text().substr(p + 1) + " ");
- for (Repository::MirrorInterface::MirrorsIterator
+ for (RepositoryMirrorsInterface::MirrorsIterator
m(_imp->portage_repository->begin_mirrors(master_mirror)),
m_end(_imp->portage_repository->end_mirrors(master_mirror)) ;
m != m_end ; ++m)
@@ -380,7 +379,7 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
/* make AA */
DepAtom::ConstPointer g_atom(PortageDepParser::parse(
- metadata->get_ebuild_interface()->get<evm_src_uri>(),
+ metadata->get_ebuild_interface()->src_uri,
PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance()));
AAFinder g(g_atom);
std::set<std::string> already_in_all_archives;
@@ -412,10 +411,10 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
{
std::set<UseFlagName> iuse;
WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
- get<evm_iuse>(), create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
for (std::set<UseFlagName>::const_iterator iuse_it(iuse.begin()), iuse_end(iuse.end()) ;
iuse_it != iuse_end; ++iuse_it)
- if (_imp->params.get<prpk_environment>()->query_use(*iuse_it, &e))
+ if (_imp->params.environment->query_use(*iuse_it, &e))
use += (*iuse_it).data() + " ";
}
@@ -436,7 +435,7 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
u != u_end ; ++u)
use += lower_x + "_" + *u + " ";
- UseFlagNameCollection::Pointer u(_imp->params.get<prpk_environment>()->query_enabled_use_matching(
+ UseFlagNameCollection::Pointer u(_imp->params.environment->query_enabled_use_matching(
lower_x + "_", &e));
for (UseFlagNameCollection::Iterator uu(u->begin()), uu_end(u->end()) ;
uu != uu_end ; ++uu)
@@ -453,7 +452,7 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
&::tolower);
prefix.append("_");
- UseFlagNameCollection::Pointer x(_imp->params.get<prpk_environment>()->query_enabled_use_matching(prefix, &e));
+ UseFlagNameCollection::Pointer x(_imp->params.environment->query_enabled_use_matching(prefix, &e));
std::string value;
for (UseFlagNameCollection::Iterator xx(x->begin()), xx_end(x->end()) ;
xx != xx_end ; ++xx)
@@ -469,64 +468,58 @@ PortageRepositoryEbuildEntries::install(const QualifiedPackageName & q, const Ve
archives = strip_trailing(archives, " ");
all_archives = strip_trailing(all_archives, " ");
- EbuildFetchCommand fetch_cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->params.get<prpk_environment>()),
- param<ecpk_db_entry>(&e),
- param<ecpk_ebuild_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ecpk_files_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>()) / "files"),
- param<ecpk_eclassdirs>(_imp->params.get<prpk_eclassdirs>()),
- param<ecpk_portdir>(_imp->params.get<prpk_location>()),
- param<ecpk_distdir>(_imp->params.get<prpk_distdir>()),
- param<ecpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )),
- EbuildFetchCommandParams::create((
- param<ecfpk_a>(archives),
- param<ecfpk_aa>(all_archives),
- param<ecfpk_use>(use),
- param<ecfpk_use_expand>(join(
- p->begin_use_expand(),
- p->end_use_expand(), " ")),
- param<ecfpk_expand_vars>(expand_vars),
- param<ecfpk_flat_src_uri>(flat_src_uri),
- param<ecfpk_root>(stringify(_imp->params.get<prpk_root>()) + "/"),
- param<ecfpk_profiles>(_imp->params.get<prpk_profiles>()),
- param<ecfpk_no_fetch>(fetch_restrict)
- )));
-
- if (metadata->get_ebuild_interface()->get<evm_virtual>().empty())
+ EbuildFetchCommand fetch_cmd(EbuildCommandParams::create()
+ .environment(_imp->params.environment)
+ .db_entry(&e)
+ .ebuild_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .files_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .portdir(_imp->params.location)
+ .distdir(_imp->params.distdir)
+ .buildroot(_imp->params.buildroot),
+
+ EbuildFetchCommandParams::create()
+ .a(archives)
+ .aa(all_archives)
+ .use(use)
+ .use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ .expand_vars(expand_vars)
+ .flat_src_uri(flat_src_uri)
+ .root(stringify(_imp->params.root) + "/")
+ .profiles(_imp->params.profiles)
+ .no_fetch(fetch_restrict));
+
+ if (metadata->get_ebuild_interface()->virtual_for.empty())
fetch_cmd();
- if (o.get<io_fetchonly>())
+ if (o.fetch_only)
return;
- EbuildInstallCommand install_cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->params.get<prpk_environment>()),
- param<ecpk_db_entry>(&e),
- param<ecpk_ebuild_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ecpk_files_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>()) / "files"),
- param<ecpk_eclassdirs>(_imp->params.get<prpk_eclassdirs>()),
- param<ecpk_portdir>(_imp->params.get<prpk_location>()),
- param<ecpk_distdir>(_imp->params.get<prpk_distdir>()),
- param<ecpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )),
- EbuildInstallCommandParams::create((
- param<ecipk_use>(use),
- param<ecipk_a>(archives),
- param<ecipk_aa>(all_archives),
- param<ecipk_use_expand>(join(
- p->begin_use_expand(),
- p->end_use_expand(), " ")),
- param<ecipk_expand_vars>(expand_vars),
- param<ecipk_root>(stringify(_imp->params.get<prpk_root>()) + "/"),
- param<ecipk_profiles>(_imp->params.get<prpk_profiles>()),
- param<ecipk_disable_cfgpro>(o.get<io_noconfigprotect>()),
- param<ecipk_merge_only>(! metadata->get_ebuild_interface()->get<evm_virtual>().empty()),
- param<ecipk_slot>(SlotName(metadata->get<vm_slot>()))
- )));
+ EbuildInstallCommand install_cmd(EbuildCommandParams::create()
+ .environment(_imp->params.environment)
+ .db_entry(&e)
+ .ebuild_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .files_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .portdir(_imp->params.location)
+ .distdir(_imp->params.distdir)
+ .buildroot(_imp->params.buildroot),
+
+ EbuildInstallCommandParams::create()
+ .use(use)
+ .a(archives)
+ .aa(all_archives)
+ .use_expand(join(p->begin_use_expand(), p->end_use_expand(), " "))
+ .expand_vars(expand_vars)
+ .root(stringify(_imp->params.root) + "/")
+ .profiles(_imp->params.profiles)
+ .disable_cfgpro(o.no_config_protect)
+ .merge_only(! metadata->get_ebuild_interface()->virtual_for.empty())
+ .slot(SlotName(metadata->slot)));
install_cmd();
}
@@ -538,18 +531,18 @@ PortageRepositoryEbuildEntries::get_environment_variable(const QualifiedPackageN
{
PackageDatabaseEntry for_package(q, v, _imp->portage_repository->name());
- EbuildVariableCommand cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->params.get<prpk_environment>()),
- param<ecpk_db_entry>(&for_package),
- param<ecpk_ebuild_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>())),
- param<ecpk_files_dir>(_imp->params.get<prpk_location>() / stringify(q.get<qpn_category>()) /
- stringify(q.get<qpn_package>()) / "files"),
- param<ecpk_eclassdirs>(_imp->params.get<prpk_eclassdirs>()),
- param<ecpk_portdir>(_imp->params.get<prpk_location>()),
- param<ecpk_distdir>(_imp->params.get<prpk_distdir>()),
- param<ecpk_buildroot>(_imp->params.get<prpk_buildroot>())
- )),
+ EbuildVariableCommand cmd(EbuildCommandParams::create()
+ .environment(_imp->params.environment)
+ .db_entry(&for_package)
+ .ebuild_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package))
+ .files_dir(_imp->params.location / stringify(q.category) /
+ stringify(q.package) / "files")
+ .eclassdirs(_imp->params.eclassdirs)
+ .portdir(_imp->params.location)
+ .distdir(_imp->params.distdir)
+ .buildroot(_imp->params.buildroot),
+
var);
if (! cmd())
diff --git a/paludis/repositories/portage/portage_repository_news.cc b/paludis/repositories/portage/portage_repository_news.cc
index a05fece..913a2ac 100644
--- a/paludis/repositories/portage/portage_repository_news.cc
+++ b/paludis/repositories/portage/portage_repository_news.cc
@@ -57,9 +57,9 @@ namespace paludis
environment(e),
portage_repository(p),
params(k),
- skip_file(params.get<prpk_root>() / "var" / "lib" / "paludis" / "news" /
+ skip_file(params.root / "var" / "lib" / "paludis" / "news" /
("news-" + stringify(portage_repository->name()) + ".skip")),
- unread_file(params.get<prpk_root>() / "var" / "lib" / "paludis" / "news" /
+ unread_file(params.root / "var" / "lib" / "paludis" / "news" /
("news-" + stringify(portage_repository->name()) + ".unread"))
{
}
@@ -80,10 +80,10 @@ void
PortageRepositoryNews::update_news() const
{
Context context("When updating news at location '" +
- stringify(_imp->params.get<prpk_newsdir>()) + "' for repository '" +
+ stringify(_imp->params.newsdir) + "' for repository '" +
stringify(_imp->portage_repository->name()) + "':");
- if (! _imp->params.get<prpk_newsdir>().is_directory())
+ if (! _imp->params.newsdir.is_directory())
return;
std::set<std::string> skip;
@@ -96,7 +96,7 @@ PortageRepositoryNews::update_news() const
std::copy(s.begin(), s.end(), std::inserter(skip, skip.end()));
}
- for (DirIterator d(_imp->params.get<prpk_newsdir>()), d_end ; d != d_end ; ++d)
+ for (DirIterator d(_imp->params.newsdir), d_end ; d != d_end ; ++d)
{
Context local_context("When handling news entry '" + stringify(*d) + "':");
@@ -137,7 +137,7 @@ PortageRepositoryNews::update_news() const
if (news.begin_display_if_profile() != news.end_display_if_profile())
{
bool local_show(false);
- FSEntryCollection::ConstPointer c(_imp->params.get<prpk_profiles>());
+ FSEntryCollection::ConstPointer c(_imp->params.profiles);
for (FSEntryCollection::Iterator p(c->begin()), p_end(c->end()) ; p != p_end ; ++p)
{
std::string profile(strip_leading_string(strip_trailing_string(
diff --git a/paludis/repositories/portage/portage_repository_params.cc b/paludis/repositories/portage/portage_repository_params.cc
new file mode 100644
index 0000000..d520725
--- /dev/null
+++ b/paludis/repositories/portage/portage_repository_params.cc
@@ -0,0 +1,8 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+#include "portage_repository_params.hh"
+
+using namespace paludis;
+
+#include <paludis/repositories/portage/portage_repository_params-sr.cc>
+
diff --git a/paludis/repositories/portage/portage_repository_params.hh b/paludis/repositories/portage/portage_repository_params.hh
index fe3bdf6..a71ed8b 100644
--- a/paludis/repositories/portage/portage_repository_params.hh
+++ b/paludis/repositories/portage/portage_repository_params.hh
@@ -20,8 +20,9 @@
#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_PARAMS_HH
#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_PORTAGE_PORTAGE_REPOSITORY_PARAMS_HH 1
-#include <paludis/util/smart_record.hh>
#include <paludis/util/fs_entry.hh>
+#include <paludis/util/collection.hh>
+#include <paludis/util/sr.hh>
/** \file
* Declaration for the PortageRepositoryParams class.
@@ -34,68 +35,7 @@ namespace paludis
class Environment;
class PackageDatabase;
- /**
- * Keys for PortageRepositoryParams.
- *
- * \see PortageRepositoryParams
- * \ingroup grpportagerepository
- */
- enum PortageRepositoryParamsKeys
- {
- prpk_entry_format,
- prpk_environment,
- prpk_package_database,
- prpk_location,
- prpk_profiles,
- prpk_cache,
- prpk_distdir,
- prpk_pkgdir,
- prpk_eclassdirs,
- prpk_setsdir,
- prpk_securitydir,
- prpk_newsdir,
- prpk_sync,
- prpk_sync_exclude,
- prpk_root,
- prpk_buildroot,
- last_prpk
- };
-
- /**
- * Tag for PortageRepositoryParams.
- *
- * \see PortageRepositoryParams
- * \ingroup grpportagerepository
- */
- struct PortageRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<PortageRepositoryParamsKeys, last_prpk>,
- SmartRecordKey<prpk_entry_format, const std::string>,
- SmartRecordKey<prpk_environment, const Environment *>,
- SmartRecordKey<prpk_package_database, const PackageDatabase *>,
- SmartRecordKey<prpk_location, const FSEntry>,
- SmartRecordKey<prpk_profiles, FSEntryCollection::Pointer>,
- SmartRecordKey<prpk_cache, const FSEntry>,
- SmartRecordKey<prpk_distdir, const FSEntry>,
- SmartRecordKey<prpk_pkgdir, const FSEntry>,
- SmartRecordKey<prpk_eclassdirs, FSEntryCollection::Pointer>,
- SmartRecordKey<prpk_setsdir, const FSEntry>,
- SmartRecordKey<prpk_securitydir, const FSEntry>,
- SmartRecordKey<prpk_newsdir, const FSEntry>,
- SmartRecordKey<prpk_sync, const std::string>,
- SmartRecordKey<prpk_sync_exclude, const std::string>,
- SmartRecordKey<prpk_root, const FSEntry>,
- SmartRecordKey<prpk_buildroot, const FSEntry>
- {
- };
-
- /**
- * Constructor parameters for PortageRepository.
- *
- * \see PortageRepository
- * \ingroup grpportagerepository
- */
- typedef MakeSmartRecord<PortageRepositoryParamsTag>::Type PortageRepositoryParams;
+#include <paludis/repositories/portage/portage_repository_params-sr.hh>
}
diff --git a/paludis/repositories/portage/portage_repository_params.sr b/paludis/repositories/portage/portage_repository_params.sr
new file mode 100644
index 0000000..54ece53
--- /dev/null
+++ b/paludis/repositories/portage/portage_repository_params.sr
@@ -0,0 +1,25 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_PortageRepositoryParams()
+{
+ key entry_format std::string
+ key environment "const Environment *"
+ key package_database "const PackageDatabase *"
+ key location FSEntry
+ key profiles FSEntryCollection::ConstPointer
+ key cache FSEntry
+ key distdir FSEntry
+ key pkgdir FSEntry
+ key eclassdirs FSEntryCollection::ConstPointer
+ key setsdir FSEntry
+ key securitydir FSEntry
+ key newsdir FSEntry
+ key sync std::string
+ key sync_exclude std::string
+ key root FSEntry
+ key buildroot FSEntry
+
+ allow_named_args
+}
+
diff --git a/paludis/repositories/portage/portage_repository_profile.cc b/paludis/repositories/portage/portage_repository_profile.cc
index 746549f..d457517 100644
--- a/paludis/repositories/portage/portage_repository_profile.cc
+++ b/paludis/repositories/portage/portage_repository_profile.cc
@@ -434,7 +434,7 @@ Implementation<PortageRepositoryProfile>::use_mask_or_force(
if (0 == e)
return false;
- PackageUseMaskMap::const_iterator i(package.find(e->get<pde_name>()));
+ PackageUseMaskMap::const_iterator i(package.find(e->name));
if (package.end() == i)
return false;
diff --git a/paludis/repositories/portage/portage_repository_sets.cc b/paludis/repositories/portage/portage_repository_sets.cc
index d8884b1..1b9b767 100644
--- a/paludis/repositories/portage/portage_repository_sets.cc
+++ b/paludis/repositories/portage/portage_repository_sets.cc
@@ -192,11 +192,11 @@ PortageRepositorySets::package_set(const std::string & s, const PackageSetOption
throw InternalError(PALUDIS_HERE, "system set should've been handled by PortageRepository");
else if ("security" == s)
return security_set(o);
- else if ((_imp->params.get<prpk_setsdir>() / (s + ".conf")).exists())
+ else if ((_imp->params.setsdir / (s + ".conf")).exists())
{
GeneralSetDepTag::Pointer tag(new GeneralSetDepTag(s));
- FSEntry ff(_imp->params.get<prpk_setsdir>() / (s + ".conf"));
+ FSEntry ff(_imp->params.setsdir / (s + ".conf"));
Context context("When loading package set '" + s + "' from '" + stringify(ff) + "':");
AllDepAtom::Pointer result(new AllDepAtom);
@@ -255,8 +255,8 @@ namespace
inline
PackageDepAtom::Pointer make_atom(const PackageDatabaseEntry & e)
{
- QualifiedPackageName n(e.get<pde_name>());
- VersionSpec v(e.get<pde_version>());
+ QualifiedPackageName n(e.name);
+ VersionSpec v(e.version);
std::string s("=" + stringify(n) + "-" + stringify(v));
return PackageDepAtom::Pointer(new PackageDepAtom(s));
@@ -266,20 +266,20 @@ namespace
PackageDatabaseEntryCollection::Iterator
PortageRepositorySets::find_best(PackageDatabaseEntryCollection & c, const PackageDatabaseEntry & e) const
{
- Context local("When finding best update for '" + stringify(e.get<pde_name>()) + "-" +
- stringify(e.get<pde_version>()) + "':");
+ Context local("When finding best update for '" + stringify(e.name) + "-" +
+ stringify(e.version) + "':");
// Find an entry in c that matches e best. e is not in c.
- QualifiedPackageName n(e.get<pde_name>());
+ QualifiedPackageName n(e.name);
SlotName s(_imp->environment->package_database()->fetch_repository(
- e.get<pde_repository>())->version_metadata(e.get<pde_name>(), e.get<pde_version>())->get<vm_slot>());
+ e.repository)->version_metadata(e.name, e.version)->slot);
PackageDatabaseEntryCollection::Iterator i(c.begin()), i_end(c.end()), i_best(c.end());
for ( ; i != i_end; ++i)
{
- if (n != i->get<pde_name>())
+ if (n != i->name)
continue;
if (s != _imp->environment->package_database()->fetch_repository(
- i->get<pde_repository>())->version_metadata(
- i->get<pde_name>(), i->get<pde_version>())->get<vm_slot>())
+ i->repository)->version_metadata(
+ i->name, i->version)->slot)
continue;
i_best = i;
@@ -295,14 +295,14 @@ PortageRepositorySets::security_set(const PackageSetOptions & o) const
Context c("When building security package set:");
AllDepAtom::Pointer security_packages(new AllDepAtom);
- bool list_affected_only(o.get<pso_list_affected_only>());
+ bool list_affected_only(o.list_affected_only);
InstallState affected_state(list_affected_only ? is_either : is_installed_only);
- if (!_imp->params.get<prpk_securitydir>().is_directory())
+ if (!_imp->params.securitydir.is_directory())
return DepAtom::Pointer(new AllDepAtom);
std::list<FSEntry> advisories;
- std::copy(DirIterator(_imp->params.get<prpk_securitydir>()), DirIterator(),
+ std::copy(DirIterator(_imp->params.securitydir), DirIterator(),
filter_inserter(std::back_inserter(advisories),
IsFileWithExtension("advisory-", ".conf")));
diff --git a/paludis/repositories/vdb/Makefile.am b/paludis/repositories/vdb/Makefile.am
index 5d2863d..835d204 100644
--- a/paludis/repositories/vdb/Makefile.am
+++ b/paludis/repositories/vdb/Makefile.am
@@ -1,4 +1,5 @@
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+DISTCLEANFILES = vdb_repository-sr.hh vdb_repository-sr.cc
MAINTAINERCLEANFILES = Makefile.in
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
@@ -12,7 +13,10 @@ paludis_repositories_lib_LTLIBRARIES = libpaludisvdbrepository.la
libpaludisvdbrepository_la_SOURCES = vdb_repository.cc vdb_repository.hh
libpaludisvdbrepository_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
paludis_repositories_vdb_includedir = $(includedir)/paludis/repositories/vdb/
-paludis_repositories_vdb_include_HEADERS = vdb_repository.hh
+paludis_repositories_vdb_include_HEADERS = \
+ vdb_repository.hh \
+ vdb_repository-sr.hh \
+ vdb_repository-sr.cc
TESTS = vdb_repository_TEST
@@ -31,7 +35,14 @@ vdb_repository_TEST_CXXFLAGS = -I$(top_srcdir)
EXTRA_DIST = \
vdb_repository_TEST.cc \
vdb_repository_TEST_setup.sh \
- vdb_repository_TEST_cleanup.sh
+ vdb_repository_TEST_cleanup.sh \
+ vdb_repository-sr.hh \
+ vdb_repository-sr.cc \
+ vdb_repository.sr
+
+BUILT_SOURCES = \
+ vdb_repository-sr.hh \
+ vdb_repository-sr.cc
check_PROGRAMS = $(TESTS)
check_SCRIPTS = vdb_repository_TEST_setup.sh vdb_repository_TEST_cleanup.sh
@@ -43,3 +54,10 @@ TESTS_ENVIRONMENT = env \
TEST_SCRIPT_DIR="$(srcdir)/" \
bash $(top_srcdir)/test/run_test.sh
+vdb_repository-sr.hh : vdb_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/vdb_repository.sr > $@
+
+vdb_repository-sr.cc : vdb_repository.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/vdb_repository.sr > $@
+
+
diff --git a/paludis/repositories/vdb/vdb_repository.cc b/paludis/repositories/vdb/vdb_repository.cc
index 7c30a93..07abc76 100644
--- a/paludis/repositories/vdb/vdb_repository.cc
+++ b/paludis/repositories/vdb/vdb_repository.cc
@@ -52,6 +52,8 @@
using namespace paludis;
+#include <paludis/repositories/vdb/vdb_repository-sr.cc>
+
namespace
{
/**
@@ -100,12 +102,12 @@ namespace
{
bool operator() (const CategoryNamePart & c, const VDBEntry & e) const
{
- return c < e.name.get<qpn_category>();
+ return c < e.name.category;
}
bool operator() (const VDBEntry & e, const CategoryNamePart & c) const
{
- return e.name.get<qpn_category>() < c;
+ return e.name.category < c;
}
};
@@ -205,8 +207,8 @@ namespace
Context context("When loading VDBRepository entry for '" + stringify(name)
+ "-" + stringify(v) + "' key '" + key + "' from '" + stringify(location) + "':");
- FSEntry f(location / stringify(name.get<qpn_category>()) /
- (stringify(name.get<qpn_package>()) + "-" + stringify(v)));
+ FSEntry f(location / stringify(name.category) /
+ (stringify(name.package) + "-" + stringify(v)));
if (! (f / key).is_regular_file())
return "";
@@ -290,12 +292,12 @@ namespace paludis
};
Implementation<VDBRepository>::Implementation(const VDBRepositoryParams & p) :
- db(p.get<vdbrpk_package_database>()),
- env(p.get<vdbrpk_environment>()),
- location(p.get<vdbrpk_location>()),
- root(p.get<vdbrpk_root>()),
- buildroot(p.get<vdbrpk_buildroot>()),
- world_file(p.get<vdbrpk_world>()),
+ db(p.package_database),
+ env(p.environment),
+ location(p.location),
+ root(p.root),
+ buildroot(p.buildroot),
+ world_file(p.world),
entries_valid(false),
has_provide_map(false)
{
@@ -353,23 +355,21 @@ namespace paludis
+ "-" + stringify(p->version) + "' from '" + stringify(location) + "':");
p->metadata = VersionMetadata::Pointer(new VersionMetadata::Ebuild(PortageDepParser::parse_depend));
- p->metadata->get<vm_deps>().set<vmd_build_depend_string>(
- file_contents(location, p->name, p->version, "DEPEND"));
- p->metadata->get<vm_deps>().set<vmd_run_depend_string>(
- file_contents(location, p->name, p->version, "RDEPEND"));
- p->metadata->set<vm_license>(file_contents(location, p->name, p->version, "LICENSE"));
- p->metadata->get_ebuild_interface()->set<evm_keywords>("*");
- p->metadata->get_ebuild_interface()->set<evm_inherited>(
- file_contents(location, p->name, p->version, "INHERITED"));
- p->metadata->get_ebuild_interface()->set<evm_iuse>(
- file_contents(location, p->name, p->version, "IUSE"));
- p->metadata->get<vm_deps>().set<vmd_post_depend_string>(
- file_contents(location, p->name, p->version, "PDEPEND"));
- p->metadata->get_ebuild_interface()->set<evm_provide>(
- file_contents(location, p->name, p->version, "PROVIDE"));
- p->metadata->set<vm_eapi>(file_contents(location, p->name, p->version, "EAPI"));
- p->metadata->set<vm_homepage>(file_contents(location, p->name, p->version, "HOMEPAGE"));
- p->metadata->set<vm_description>(file_contents(location, p->name, p->version, "DESCRIPTION"));
+ p->metadata->deps.build_depend_string = file_contents(location, p->name, p->version, "DEPEND");
+ p->metadata->deps.run_depend_string = file_contents(location, p->name, p->version, "RDEPEND");
+ p->metadata->license_string = file_contents(location, p->name, p->version, "LICENSE");
+ p->metadata->get_ebuild_interface()->keywords = "*";
+ p->metadata->get_ebuild_interface()->inherited =
+ file_contents(location, p->name, p->version, "INHERITED");
+ p->metadata->get_ebuild_interface()->iuse =
+ file_contents(location, p->name, p->version, "IUSE");
+ p->metadata->deps.post_depend_string =
+ file_contents(location, p->name, p->version, "PDEPEND");
+ p->metadata->get_ebuild_interface()->provide_string =
+ file_contents(location, p->name, p->version, "PROVIDE");
+ p->metadata->eapi = file_contents(location, p->name, p->version, "EAPI");
+ p->metadata->homepage = file_contents(location, p->name, p->version, "HOMEPAGE");
+ p->metadata->description = file_contents(location, p->name, p->version, "DESCRIPTION");
std::string slot(file_contents(location, p->name, p->version, "SLOT"));
if (slot.empty())
@@ -379,7 +379,7 @@ namespace paludis
stringify(location) + "' has empty SLOT, setting to \"0\"");
slot = "0";
}
- p->metadata->set<vm_slot>(SlotName(slot));
+ p->metadata->slot = SlotName(slot);
std::string raw_use(file_contents(location, p->name, p->version, "USE"));
p->use.clear();
@@ -391,19 +391,19 @@ namespace paludis
VDBRepository::VDBRepository(const VDBRepositoryParams & p) :
Repository(RepositoryName("installed"),
- RepositoryCapabilities::create((
- param<repo_installable>(static_cast<InstallableInterface *>(0)),
- param<repo_installed>(this),
- param<repo_mask>(static_cast<MaskInterface *>(0)),
- param<repo_news>(static_cast<NewsInterface *>(0)),
- param<repo_sets>(this),
- param<repo_syncable>(static_cast<SyncableInterface *>(0)),
- param<repo_uninstallable>(this),
- param<repo_use>(this),
- param<repo_world>(this),
- param<repo_environment_variable>(this),
- param<repo_mirrors>(static_cast<MirrorInterface *>(0))
- ))),
+ RepositoryCapabilities::create()
+ .installable_interface(0)
+ .installed_interface(this)
+ .mask_interface(0)
+ .news_interface(0)
+ .sets_interface(this)
+ .syncable_interface(0)
+ .uninstallable_interface(this)
+ .use_interface(this)
+ .world_interface(this)
+ .environment_variable_interface(this)
+ .mirrors_interface(0)
+ ),
PrivateImplementationPattern<VDBRepository>(new Implementation<VDBRepository>(p))
{
RepositoryInfoSection::Pointer config_info(new RepositoryInfoSection("Configuration information"));
@@ -463,7 +463,7 @@ VDBRepository::do_category_names() const
for (std::vector<VDBEntry>::const_iterator c(_imp->entries.begin()), c_end(_imp->entries.end()) ;
c != c_end ; ++c)
- result->insert(c->name.get<qpn_category>());
+ result->insert(c->name.category);
return result;
}
@@ -568,8 +568,8 @@ VDBRepository::do_contents(
Contents::Pointer result(new Contents);
- FSEntry f(_imp->location / stringify(q.get<qpn_category>()) /
- (stringify(q.get<qpn_package>()) + "-" + stringify(v)));
+ FSEntry f(_imp->location / stringify(q.category) /
+ (stringify(q.package) + "-" + stringify(v)));
if (! (f / "CONTENTS").is_regular_file())
{
Log::get_instance()->message(ll_warning, lc_context,
@@ -635,12 +635,12 @@ VDBRepository::do_query_use(const UseFlagName & f,
if (! _imp->entries_valid)
_imp->load_entries();
- if (e->get<pde_repository>() == name())
+ if (e->repository == name())
{
std::pair<std::vector<VDBEntry>::iterator, std::vector<VDBEntry>::iterator>
r(std::equal_range(_imp->entries.begin(), _imp->entries.end(), std::make_pair(
- e->get<pde_name>(), e->get<pde_version>()), VDBEntry::CompareVersion()));
+ e->name, e->version), VDBEntry::CompareVersion()));
if (r.first == r.second)
return use_unspecified;
@@ -694,13 +694,13 @@ VDBRepository::make_vdb_repository(
if (m->end() == m->find("buildroot") || ((buildroot = m->find("buildroot")->second)).empty())
buildroot = "/var/tmp/paludis";
- return CountedPtr<Repository>(new VDBRepository(VDBRepositoryParams::create((
- param<vdbrpk_environment>(env),
- param<vdbrpk_package_database>(db),
- param<vdbrpk_location>(location),
- param<vdbrpk_root>(root),
- param<vdbrpk_world>(world),
- param<vdbrpk_buildroot>(buildroot)))));
+ return CountedPtr<Repository>(new VDBRepository(VDBRepositoryParams::create()
+ .environment(env)
+ .package_database(db)
+ .location(location)
+ .root(root)
+ .world(world)
+ .buildroot(buildroot)));
}
VDBRepositoryConfigurationError::VDBRepositoryConfigurationError(
@@ -765,32 +765,31 @@ VDBRepository::do_uninstall(const QualifiedPackageName & q, const VersionSpec &
PackageDatabaseEntry e(q, v, name());
FSEntryCollection::Pointer eclassdirs(new FSEntryCollection::Concrete);
- eclassdirs->append(FSEntry(_imp->location / stringify(q.get<qpn_category>()) /
- (stringify(q.get<qpn_package>()) + "-" + stringify(v))));
+ eclassdirs->append(FSEntry(_imp->location / stringify(q.category) /
+ (stringify(q.package) + "-" + stringify(v))));
- FSEntry pkg_dir(_imp->location / stringify(q.get<qpn_category>()) /
- (stringify(q.get<qpn_package>()) + "-" + stringify(v)));
+ FSEntry pkg_dir(_imp->location / stringify(q.category) /
+ (stringify(q.package) + "-" + stringify(v)));
CountedPtr<FSEntry, count_policy::ExternalCountTag> load_env(0);
if (is_full_env(pkg_dir))
load_env.assign(new FSEntry(pkg_dir / "environment.bz2"));
- EbuildUninstallCommand uninstall_cmd(EbuildCommandParams::create((
- param<ecpk_environment>(_imp->env),
- param<ecpk_db_entry>(&e),
- param<ecpk_ebuild_dir>(pkg_dir),
- param<ecpk_files_dir>(pkg_dir),
- param<ecpk_eclassdirs>(eclassdirs),
- param<ecpk_portdir>(_imp->location),
- param<ecpk_distdir>(pkg_dir),
- param<ecpk_buildroot>(_imp->buildroot)
- )),
- EbuildUninstallCommandParams::create((
- param<ecupk_root>(stringify(_imp->root) + "/"),
- param<ecupk_disable_cfgpro>(o.get<io_noconfigprotect>()),
- param<ecupk_unmerge_only>(! metadata->get_ebuild_interface()->get<evm_virtual>().empty()),
- param<ecupk_load_environment>(load_env.raw_pointer())
- )));
+ EbuildUninstallCommand uninstall_cmd(EbuildCommandParams::create()
+ .environment(_imp->env)
+ .db_entry(&e)
+ .ebuild_dir(pkg_dir)
+ .files_dir(pkg_dir)
+ .eclassdirs(eclassdirs)
+ .portdir(_imp->location)
+ .distdir(pkg_dir)
+ .buildroot(_imp->buildroot),
+
+ EbuildUninstallCommandParams::create()
+ .root(stringify(_imp->root) + "/")
+ .disable_cfgpro(o.no_config_protect)
+ .unmerge_only(! metadata->get_ebuild_interface()->virtual_for.empty())
+ .load_environment(load_env.raw_pointer()));
uninstall_cmd();
}
@@ -875,7 +874,7 @@ VDBRepository::begin_provide_map() const
{
if (! e->metadata)
_imp->load_entry(e);
- const std::string provide_str(e->metadata->get_ebuild_interface()->get<evm_provide>());
+ const std::string provide_str(e->metadata->get_ebuild_interface()->provide_string);
if (provide_str.empty())
continue;
@@ -888,7 +887,7 @@ VDBRepository::begin_provide_map() const
{
QualifiedPackageName pp((*p)->text());
- if (pp.get<qpn_category>() != CategoryNamePart("virtual"))
+ if (pp.category != CategoryNamePart("virtual"))
Log::get_instance()->message(ll_warning, lc_no_context, "PROVIDE of non-virtual '"
+ stringify(pp) + "' from '" + stringify(e->name) + "-"
+ stringify(e->version) + "' in '" + stringify(name())
@@ -1000,9 +999,9 @@ VDBRepository::get_environment_variable(
Context context("When fetching environment variable '" + var + "' for '" +
stringify(for_package) + "':");
- FSEntry vdb_dir(_imp->location / stringify(for_package.get<pde_name>().get<qpn_category>())
- / (stringify(for_package.get<pde_name>().get<qpn_package>()) + "-" +
- stringify(for_package.get<pde_version>())));
+ FSEntry vdb_dir(_imp->location / stringify(for_package.name.category)
+ / (stringify(for_package.name.package) + "-" +
+ stringify(for_package.version)));
if (! vdb_dir.is_directory())
throw EnvironmentVariableActionError("Could not find VDB entry for '"
diff --git a/paludis/repositories/vdb/vdb_repository.hh b/paludis/repositories/vdb/vdb_repository.hh
index c9d1573..5c0793b 100644
--- a/paludis/repositories/vdb/vdb_repository.hh
+++ b/paludis/repositories/vdb/vdb_repository.hh
@@ -23,7 +23,6 @@
#include <paludis/repository.hh>
#include <paludis/util/attributes.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/fs_entry.hh>
/** \file
@@ -34,48 +33,8 @@
namespace paludis
{
- /**
- * Keys for VDBRepositoryParams
- *
- * \see VDBRepositoryParams
- * \ingroup grpvdbrepository
- */
- enum VDBRepositoryParamsKeys
- {
- vdbrpk_environment,
- vdbrpk_package_database,
- vdbrpk_location,
- vdbrpk_root,
- vdbrpk_world,
- vdbrpk_buildroot,
- last_vdbrpk
- };
- /**
- * Tag for VDBRepositoryParams.
- *
- * \see VDBRepositoryParams
- * \ingroup grpvdbrepository
- */
- struct VDBRepositoryParamsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<VDBRepositoryParamsKeys, last_vdbrpk>,
- SmartRecordKey<vdbrpk_environment, const Environment *>,
- SmartRecordKey<vdbrpk_package_database, const PackageDatabase *>,
- SmartRecordKey<vdbrpk_location, const FSEntry>,
- SmartRecordKey<vdbrpk_root, const FSEntry>,
- SmartRecordKey<vdbrpk_world, const FSEntry>,
- SmartRecordKey<vdbrpk_buildroot, const FSEntry>
- {
- };
-
- /**
- * Constructor parameters for VDBRepository.
- *
- * \see VDBRepository
- * \ingroup grpvdbrepository
- */
- typedef MakeSmartRecord<VDBRepositoryParamsTag>::Type VDBRepositoryParams;
+#include <paludis/repositories/vdb/vdb_repository-sr.hh>
/**
* A VDBRepository represents the /var/db/pkg database used for
@@ -87,12 +46,12 @@ namespace paludis
*/
class VDBRepository :
public Repository,
- public Repository::InstalledInterface,
- public Repository::UseInterface,
- public Repository::UninstallableInterface,
- public Repository::SetsInterface,
- public Repository::WorldInterface,
- public Repository::EnvironmentVariableInterface,
+ public RepositoryInstalledInterface,
+ public RepositoryUseInterface,
+ public RepositoryUninstallableInterface,
+ public RepositorySetsInterface,
+ public RepositoryWorldInterface,
+ public RepositoryEnvironmentVariableInterface,
public PrivateImplementationPattern<VDBRepository>
{
protected:
diff --git a/paludis/repositories/vdb/vdb_repository.sr b/paludis/repositories/vdb/vdb_repository.sr
new file mode 100644
index 0000000..1441408
--- /dev/null
+++ b/paludis/repositories/vdb/vdb_repository.sr
@@ -0,0 +1,15 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_VDBRepositoryParams()
+{
+ key environment "const Environment *"
+ key package_database "const PackageDatabase *"
+ key location FSEntry
+ key root FSEntry
+ key world FSEntry
+ key buildroot FSEntry
+
+ allow_named_args
+}
+
diff --git a/paludis/repository.cc b/paludis/repository.cc
index 7a951e6..4b63370 100644
--- a/paludis/repository.cc
+++ b/paludis/repository.cc
@@ -30,11 +30,13 @@
using namespace paludis;
+#include <paludis/repository-sr.cc>
+
Repository::Repository(
const RepositoryName & name,
const RepositoryCapabilities & caps) :
+ RepositoryCapabilities(caps),
_name(name),
- _caps(caps),
_info(new RepositoryInfo)
{
}
@@ -177,7 +179,7 @@ RepositoryInfo::end_sections() const
}
UseFlagName
-Repository::UseInterface::expand_flag_name(const UseFlagName & u) const
+RepositoryUseInterface::expand_flag_name(const UseFlagName & u) const
{
std::string upper_u;
std::transform(u.data().begin(), u.data().end(), std::back_inserter(upper_u),
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 4ce3e9f..48b8823 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -25,6 +25,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/counted_ptr.hh>
#include <paludis/util/exception.hh>
+#include <paludis/util/sr.hh>
#include <paludis/util/virtual_constructor.hh>
#include <paludis/version_metadata.hh>
#include <paludis/version_spec.hh>
@@ -46,90 +47,19 @@ namespace paludis
{
class Environment;
- /**
- * Keys for InstallOptions.
- *
- * \see InstallOptions
- * \ingroup grprepository
- */
- enum InstallOptionsKeys
- {
- io_noconfigprotect, ///< Disable config protection
- io_fetchonly, ///< Fetch only
- last_io ///< Number of entries
- };
-
- /**
- * Tag for InstallOptions.
- *
- * \see InstallOptions
- * \ingroup grprepository
- */
- struct InstallOptionsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<InstallOptionsKeys, last_io>,
- SmartRecordKey<io_noconfigprotect, bool>,
- SmartRecordKey<io_fetchonly, bool>
- {
- };
-
- /**
- * Defines various options for package installation.
- *
- * \ingroup grprepository
- */
- typedef MakeSmartRecord<InstallOptionsTag>::Type InstallOptions;
+ class RepositoryInstallableInterface;
+ class RepositoryInstalledInterface;
+ class RepositoryMaskInterface;
+ class RepositoryNewsInterface;
+ class RepositorySetsInterface;
+ class RepositorySyncableInterface;
+ class RepositoryUninstallableInterface;
+ class RepositoryUseInterface;
+ class RepositoryWorldInterface;
+ class RepositoryEnvironmentVariableInterface;
+ class RepositoryMirrorsInterface;
- /**
- * Keys for PackageSetOptions.
- *
- * \see PackageSetOptions
- * \ingroup grprepository
- */
- enum PackageSetOptionsKeys
- {
- pso_list_affected_only, ///< Only list affected packages in the set
- last_pso
- };
-
- /**
- * Tag for PackageSetOptions.
- *
- * \see PackageSetOptions
- * \ingroup grprepository
- */
- struct PackageSetOptionsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<PackageSetOptionsKeys, last_pso>,
- SmartRecordKey<pso_list_affected_only, bool>
- {
- };
-
- /**
- * Defines various options for package installation.
- *
- * \ingroup grprepository
- */
- typedef MakeSmartRecord<PackageSetOptionsTag>::Type PackageSetOptions;
-
- /**
- * Capability keys for a repository.
- */
- enum RepositoryCapabilitiesKeys
- {
- repo_installable,
- repo_installed,
- repo_mask,
- repo_news,
- repo_sets,
- repo_syncable,
- repo_uninstallable,
- repo_use,
- repo_world,
- repo_environment_variable,
- repo_mirrors,
- last_repo
- };
+#include <paludis/repository-sr.hh>
/**
* A section of information about a Repository.
@@ -217,59 +147,12 @@ namespace paludis
*/
class Repository :
private InstantiationPolicy<Repository, instantiation_method::NonCopyableTag>,
- public InternalCounted<Repository>
+ public InternalCounted<Repository>,
+ public RepositoryCapabilities
{
- public:
- class InstallableInterface;
- class InstalledInterface;
- class MaskInterface;
- class NewsInterface;
- class SetsInterface;
- class SyncableInterface;
- class UninstallableInterface;
- class UseInterface;
- class WorldInterface;
- class EnvironmentVariableInterface;
- class MirrorInterface;
-
- protected:
- /**
- * Tag for RepositoryCapabilities.
- *
- * \see RepositoryCapabilities
- * \ingroup grprepository
- */
- struct RepositoryCapabilitiesTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<RepositoryCapabilitiesKeys, last_repo>,
- SmartRecordKey<repo_installable, InstallableInterface *>,
- SmartRecordKey<repo_installed, InstalledInterface *>,
- SmartRecordKey<repo_mask, MaskInterface *>,
- SmartRecordKey<repo_news, NewsInterface *>,
- SmartRecordKey<repo_sets, SetsInterface *>,
- SmartRecordKey<repo_syncable, SyncableInterface *>,
- SmartRecordKey<repo_uninstallable, UninstallableInterface *>,
- SmartRecordKey<repo_use, UseInterface *>,
- SmartRecordKey<repo_world, WorldInterface *>,
- SmartRecordKey<repo_mirrors, MirrorInterface *>,
- SmartRecordKey<repo_environment_variable, EnvironmentVariableInterface *>
- {
- };
-
- /**
- * Holds pointers to upcast ourself to different capability interfaces. Each entry
- * is either a this pointer or a zero pointer.
- *
- * \see Repository
- * \ingroup grprepository
- */
- typedef MakeSmartRecord<RepositoryCapabilitiesTag>::Type RepositoryCapabilities;
-
private:
const RepositoryName _name;
- RepositoryCapabilities _caps;
-
protected:
/**
* Our information.
@@ -339,31 +222,6 @@ namespace paludis
public:
virtual RepositoryInfo::ConstPointer info(bool verbose) const;
- ///\name Interface queries
- ///{
-
- /**
- * Fetch an interface.
- */
- template <RepositoryCapabilitiesKeys k_>
- typename RepositoryCapabilities::GetKeyType<k_>::Type
- get_interface()
- {
- return _caps.get<k_>();
- }
-
- /**
- * Fetch an interface, const.
- */
- template <RepositoryCapabilitiesKeys k_>
- const typename RepositoryCapabilities::GetKeyType<k_>::Type
- get_interface() const
- {
- return _caps.get<k_>();
- }
-
- ///}
-
/**
* Destructor.
*/
@@ -469,7 +327,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::MaskInterface
+ class RepositoryMaskInterface
{
protected:
/**
@@ -501,7 +359,7 @@ namespace paludis
return do_query_profile_masks(q, v);
}
- virtual ~MaskInterface() { }
+ virtual ~RepositoryMaskInterface() { }
};
/**
@@ -510,7 +368,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::UseInterface
+ class RepositoryUseInterface
{
protected:
/**
@@ -621,7 +479,7 @@ namespace paludis
return UseFlagName(stringify(u).substr(do_expand_flag_delim_pos(u) + 1));
}
- virtual ~UseInterface() { }
+ virtual ~RepositoryUseInterface() { }
};
/**
@@ -630,7 +488,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::InstalledInterface
+ class RepositoryInstalledInterface
{
protected:
/**
@@ -651,7 +509,7 @@ namespace paludis
return do_contents(q, v);
}
- virtual ~InstalledInterface() { }
+ virtual ~RepositoryInstalledInterface() { }
};
/**
@@ -660,7 +518,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::InstallableInterface
+ class RepositoryInstallableInterface
{
protected:
/**
@@ -678,7 +536,7 @@ namespace paludis
do_install(q, v, i);
}
- virtual ~InstallableInterface() { }
+ virtual ~RepositoryInstallableInterface() { }
};
/**
@@ -687,7 +545,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::UninstallableInterface
+ class RepositoryUninstallableInterface
{
protected:
/**
@@ -705,7 +563,7 @@ namespace paludis
do_uninstall(q, v, i);
}
- virtual ~UninstallableInterface() { }
+ virtual ~RepositoryUninstallableInterface() { }
};
/**
@@ -714,7 +572,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::SetsInterface
+ class RepositorySetsInterface
{
protected:
/**
@@ -732,7 +590,7 @@ namespace paludis
return do_package_set(s, o);
}
- virtual ~SetsInterface() { }
+ virtual ~RepositorySetsInterface() { }
};
/**
@@ -741,7 +599,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::SyncableInterface
+ class RepositorySyncableInterface
{
protected:
/**
@@ -760,7 +618,7 @@ namespace paludis
return do_sync();
}
- virtual ~SyncableInterface() { }
+ virtual ~RepositorySyncableInterface() { }
};
/**
@@ -769,7 +627,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::WorldInterface
+ class RepositoryWorldInterface
{
public:
/**
@@ -782,7 +640,7 @@ namespace paludis
*/
virtual void remove_from_world(const QualifiedPackageName &) const = 0;
- virtual ~WorldInterface() { }
+ virtual ~RepositoryWorldInterface() { }
};
/**
@@ -791,7 +649,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::NewsInterface
+ class RepositoryNewsInterface
{
public:
/**
@@ -801,7 +659,7 @@ namespace paludis
{
}
- virtual ~NewsInterface() { }
+ virtual ~RepositoryNewsInterface() { }
};
/**
@@ -810,7 +668,7 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::EnvironmentVariableInterface
+ class RepositoryEnvironmentVariableInterface
{
public:
/**
@@ -820,7 +678,7 @@ namespace paludis
const PackageDatabaseEntry & for_package,
const std::string & var) const = 0;
- virtual ~EnvironmentVariableInterface() { }
+ virtual ~RepositoryEnvironmentVariableInterface() { }
};
/**
@@ -829,13 +687,13 @@ namespace paludis
* \see Repository
* \ingroup grprepository
*/
- class Repository::MirrorInterface
+ class RepositoryMirrorsInterface
{
public:
///\name Iterate over our mirrors
///\{
- typedef libwrapiter::ForwardIterator<MirrorInterface,
+ typedef libwrapiter::ForwardIterator<RepositoryMirrorsInterface,
const std::pair<const std::string, std::string> > MirrorsIterator;
virtual MirrorsIterator begin_mirrors(const std::string & s) const = 0;
@@ -849,7 +707,7 @@ namespace paludis
return begin_mirrors(s) != end_mirrors(s);
}
- virtual ~MirrorInterface() { }
+ virtual ~RepositoryMirrorsInterface() { }
};
/**
diff --git a/paludis/repository.sr b/paludis/repository.sr
new file mode 100644
index 0000000..1a22e69
--- /dev/null
+++ b/paludis/repository.sr
@@ -0,0 +1,32 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_InstallOptions()
+{
+ key no_config_protect bool
+ key fetch_only bool
+}
+
+make_class_PackageSetOptions()
+{
+ key list_affected_only bool
+}
+
+make_class_RepositoryCapabilities()
+{
+ key installable_interface "RepositoryInstallableInterface *"
+ key installed_interface "RepositoryInstalledInterface *"
+ key mask_interface "RepositoryMaskInterface *"
+ key news_interface "RepositoryNewsInterface *"
+ key sets_interface "RepositorySetsInterface *"
+ key syncable_interface "RepositorySyncableInterface *"
+ key uninstallable_interface "RepositoryUninstallableInterface *"
+ key use_interface "RepositoryUseInterface *"
+ key world_interface "RepositoryWorldInterface *"
+ key mirrors_interface "RepositoryMirrorsInterface *"
+ key environment_variable_interface "RepositoryEnvironmentVariableInterface *"
+
+ allow_named_args
+}
+
+
diff --git a/paludis/repository_config_entry.sr b/paludis/repository_config_entry.sr
new file mode 100644
index 0000000..648071b
--- /dev/null
+++ b/paludis/repository_config_entry.sr
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_RepositoryConfigEntry()
+{
+ key format std::string
+ key importance unsigned
+ key keys "AssociativeCollection<std::string, std::string>::Pointer"
+ comparison_operators all importance
+}
+
diff --git a/paludis/syncer.cc b/paludis/syncer.cc
index 11e91e7..054661f 100644
--- a/paludis/syncer.cc
+++ b/paludis/syncer.cc
@@ -30,6 +30,8 @@
using namespace paludis;
+#include <paludis/syncer-sr.cc>
+
NoSuchSyncerError::NoSuchSyncerError(const std::string & format) throw () :
SyncFailedError("No such syncer for format '" + format + "'")
{
@@ -182,8 +184,8 @@ RsyncSyncer::sync(const SyncOptions & opts) const
FSEntry(_local).mkdir();
std::string exclude;
- if (! opts.get<so_excludefrom>().empty())
- exclude = "--exclude-from " + std::string(opts.get<so_excludefrom>()) + " ";
+ if (! opts.exclude_from.empty())
+ exclude = "--exclude-from " + opts.exclude_from + " ";
std::string cmd("rsync --recursive --links --safe-links --perms --times "
"--compress --force --whole-file --delete --delete-after --stats "
diff --git a/paludis/syncer.hh b/paludis/syncer.hh
index dff8c86..a87d54b 100644
--- a/paludis/syncer.hh
+++ b/paludis/syncer.hh
@@ -33,37 +33,8 @@
namespace paludis
{
- /**
- * Keys for SyncOptions.
- *
- * \see SyncOptions
- * \ingroup grpsyncer
- */
- enum SyncOptionsKeys
- {
- so_excludefrom, ///< Filename from which to take a list of excluded files
- so_last ///< Number of keys.
- };
- /**
- * Tag for SyncOptions.
- *
- * \see SyncOptions
- * \ingroup grpsyncer
- */
- struct SyncOptionsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<SyncOptionsKeys, so_last>,
- SmartRecordKey<so_excludefrom, std::string>
- {
- };
-
- /**
- * Defines options to be passed to the syncer.
- *
- * \ingroup grpsyncer
- */
- typedef MakeSmartRecord<SyncOptionsTag>::Type SyncOptions;
+#include <paludis/syncer-sr.hh>
/**
* A Syncer subclass handles syncing Repository instances.
diff --git a/paludis/syncer.sr b/paludis/syncer.sr
new file mode 100644
index 0000000..2d49fca
--- /dev/null
+++ b/paludis/syncer.sr
@@ -0,0 +1,8 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_SyncOptions()
+{
+ key exclude_from std::string
+}
+
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 7f87f7b..803228f 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -128,13 +128,13 @@ InstallTask::set_no_unnecessary_upgrades(const bool value)
void
InstallTask::set_no_config_protect(const bool value)
{
- _imp->install_options.set<io_noconfigprotect>(value);
+ _imp->install_options.no_config_protect = value;
}
void
InstallTask::set_fetch_only(const bool value)
{
- _imp->install_options.set<io_fetchonly>(value);
+ _imp->install_options.fetch_only = value;
}
void
@@ -244,7 +244,7 @@ InstallTask::execute()
}
/* we're about to fetch / install the entire list */
- if (_imp->install_options.get<io_fetchonly>())
+ if (_imp->install_options.fetch_only)
{
_imp->env->perform_hook(Hook("fetch_all_pre")("TARGETS", join(
_imp->raw_targets.begin(), _imp->raw_targets.end(), " ")));
@@ -261,12 +261,12 @@ InstallTask::execute()
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
{
- std::string cpvr(stringify(dep->get<dle_name>()) + "-" +
- stringify(dep->get<dle_version>()) + "::" +
- stringify(dep->get<dle_repository>()));
+ std::string cpvr(stringify(dep->name) + "-" +
+ stringify(dep->version) + "::" +
+ stringify(dep->repository));
/* we're about to fetch / install one item */
- if (_imp->install_options.get<io_fetchonly>())
+ if (_imp->install_options.fetch_only)
{
_imp->env->perform_hook(Hook("fetch_pre")("TARGET", cpvr));
on_fetch_pre(*dep);
@@ -278,15 +278,15 @@ InstallTask::execute()
}
/* fetch / install one item */
- const Repository::InstallableInterface * const installable_interface(
- _imp->env->package_database()->fetch_repository(dep->get<dle_repository>())->
- get_interface<repo_installable>());
+ const RepositoryInstallableInterface * const installable_interface(
+ _imp->env->package_database()->fetch_repository(dep->repository)->
+ installable_interface);
if (! installable_interface)
throw InternalError(PALUDIS_HERE, "Trying to install from a non-installable repository");
try
{
- installable_interface->install(dep->get<dle_name>(), dep->get<dle_version>(), _imp->install_options);
+ installable_interface->install(dep->name, dep->version, _imp->install_options);
}
catch (const PackageInstallActionError & e)
{
@@ -295,7 +295,7 @@ InstallTask::execute()
}
/* we've fetched / installed one item */
- if (_imp->install_options.get<io_fetchonly>())
+ if (_imp->install_options.fetch_only)
{
on_fetch_post(*dep);
_imp->env->perform_hook(Hook("fetch_post")("TARGET", cpvr));
@@ -306,7 +306,7 @@ InstallTask::execute()
_imp->env->perform_hook(Hook("install_post")("TARGET", cpvr));
}
- if (_imp->install_options.get<io_fetchonly>())
+ if (_imp->install_options.fetch_only)
continue;
/* figure out whether we need to unmerge (clean) anything */
@@ -316,21 +316,21 @@ InstallTask::execute()
// wrong now
for (PackageDatabase::RepositoryIterator r(_imp->env->package_database()->begin_repositories()),
r_end(_imp->env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((*r)->get_interface<repo_installed>())
+ if ((*r)->installed_interface)
(*r)->invalidate();
// look for packages with the same name in the same slot
PackageDatabaseEntryCollection::Pointer collision_list(_imp->env->package_database()->query(
PackageDepAtom::Pointer(new PackageDepAtom(
- stringify(dep->get<dle_name>()) + ":" +
- stringify(dep->get<dle_metadata>()->get<vm_slot>()))),
+ stringify(dep->name) + ":" +
+ stringify(dep->metadata->slot))),
is_installed_only));
// don't clean the thing we just installed
PackageDatabaseEntryCollection::Concrete clean_list;
for (PackageDatabaseEntryCollection::Iterator c(collision_list->begin()),
c_end(collision_list->end()) ; c != c_end ; ++c)
- if (dep->get<dle_version>() != c->get<pde_version>())
+ if (dep->version != c->version)
clean_list.insert(*c);
on_build_cleanlist_post(*dep);
@@ -347,15 +347,15 @@ InstallTask::execute()
_imp->env->perform_hook(Hook("uninstall_pre")("TARGET", stringify(*c)));
on_clean_pre(*dep, *c);
- const Repository::UninstallableInterface * const uninstall_interface(
- _imp->env->package_database()->fetch_repository(c->get<pde_repository>())->
- get_interface<repo_uninstallable>());
+ const RepositoryUninstallableInterface * const uninstall_interface(
+ _imp->env->package_database()->fetch_repository(c->repository)->
+ uninstallable_interface);
if (! uninstall_interface)
throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
try
{
- uninstall_interface->uninstall(c->get<pde_name>(), c->get<pde_version>(), _imp->install_options);
+ uninstall_interface->uninstall(c->name, c->version, _imp->install_options);
}
catch (const PackageUninstallActionError & e)
{
@@ -374,7 +374,7 @@ InstallTask::execute()
}
/* update world */
- if ((! _imp->had_set_targets) && (! _imp->install_options.get<io_fetchonly>()))
+ if ((! _imp->had_set_targets) && (! _imp->install_options.fetch_only))
{
if (! _imp->preserve_world)
{
@@ -388,7 +388,7 @@ InstallTask::execute()
}
/* we've fetched / installed the entire list */
- if (_imp->install_options.get<io_fetchonly>())
+ if (_imp->install_options.fetch_only)
{
on_fetch_all_post();
_imp->env->perform_hook(Hook("fetch_all_post")("TARGETS", join(
diff --git a/paludis/tasks/sync_task.cc b/paludis/tasks/sync_task.cc
index 80e34ee..fbd4d6e 100644
--- a/paludis/tasks/sync_task.cc
+++ b/paludis/tasks/sync_task.cc
@@ -82,7 +82,7 @@ SyncTask::execute()
{
Repository::ConstPointer rr(_imp->env->package_database()->fetch_repository(*r));
- if (rr->get_interface<repo_syncable>() && rr->get_interface<repo_syncable>()->sync())
+ if (rr->syncable_interface && rr->syncable_interface->sync())
on_sync_succeed(*r);
else
on_sync_skip(*r);
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index dc3b113..31f5108 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -67,7 +67,7 @@ UninstallTask::set_pretend(const bool v)
void
UninstallTask::set_no_config_protect(const bool v)
{
- _imp->install_options.set<io_noconfigprotect>(v);
+ _imp->install_options.no_config_protect = v;
}
void
@@ -169,22 +169,22 @@ UninstallTask::execute()
for (PackageDatabaseEntryCollection::Iterator i(unmerge->begin()),
i_end(unmerge->end()) ; i != i_end ; ++i)
{
- std::string cpvr(stringify(i->get<pde_name>()) + "-" +
- stringify(i->get<pde_version>()) + "::" +
- stringify(i->get<pde_repository>()));
+ std::string cpvr(stringify(i->name) + "-" +
+ stringify(i->version) + "::" +
+ stringify(i->repository));
_imp->env->perform_hook(Hook("uninstall_pre")("TARGET", cpvr));
on_uninstall_pre(*i);
- const Repository::UninstallableInterface * const uninstall_interface(
- _imp->env->package_database()->fetch_repository(i->get<pde_repository>())->
- get_interface<repo_uninstallable>());
+ const RepositoryUninstallableInterface * const uninstall_interface(
+ _imp->env->package_database()->fetch_repository(i->repository)->
+ uninstallable_interface);
if (! uninstall_interface)
throw InternalError(PALUDIS_HERE, "Trying to uninstall from a non-uninstallable repo");
try
{
- uninstall_interface->uninstall(i->get<pde_name>(), i->get<pde_version>(), _imp->install_options);
+ uninstall_interface->uninstall(i->name, i->version, _imp->install_options);
}
catch (const PackageUninstallActionError & e)
{
diff --git a/paludis/use_config_entry.sr b/paludis/use_config_entry.sr
new file mode 100644
index 0000000..44dae8c
--- /dev/null
+++ b/paludis/use_config_entry.sr
@@ -0,0 +1,10 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_UseConfigEntry()
+{
+ key dep_atom PackageDepAtom::ConstPointer
+ key flag_name UseFlagName
+ key flag_state UseFlagState
+}
+
diff --git a/paludis/util/Makefile.am.m4 b/paludis/util/Makefile.am.m4
index dd98391..cc98d7d 100644
--- a/paludis/util/Makefile.am.m4
+++ b/paludis/util/Makefile.am.m4
@@ -30,13 +30,13 @@ addthis(`$1',`$5')addthis(`$1',`$6')')dnl
include(`paludis/util/files.m4')
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
-MAINTAINERCLEANFILES = Makefile.in Makefile.am paludis.hh smart_record.hh \
+MAINTAINERCLEANFILES = Makefile.in Makefile.am paludis.hh \
hashed_containers.hh util.hh
AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@
DEFS=\
-DSYSCONFDIR=\"$(sysconfdir)\" \
-DLIBEXECDIR=\"$(libexecdir)\"
-EXTRA_DIST = util.hh.m4 Makefile.am.m4 files.m4 smart_record.hh.m4 \
+EXTRA_DIST = util.hh.m4 Makefile.am.m4 files.m4 \
testscriptlist test_extras.cc
SUBDIRS = .
@@ -59,9 +59,6 @@ paludis_util_include_HEADERS = headerlist
Makefile.am : Makefile.am.m4 files.m4
$(top_srcdir)/misc/do_m4.bash Makefile.am
-smart_record.hh : smart_record.hh.m4
- $(top_srcdir)/misc/do_m4.bash smart_record.hh
-
util.hh : util.hh.m4 files.m4
$(top_srcdir)/misc/do_m4.bash util.hh
diff --git a/paludis/util/files.m4 b/paludis/util/files.m4
index 4c4b0ad..dea1b6f 100644
--- a/paludis/util/files.m4
+++ b/paludis/util/files.m4
@@ -29,7 +29,7 @@ add(`private_implementation_pattern', `hh')
add(`pstream', `hh', `cc', `test')
add(`random', `hh', `cc', `test')
add(`save', `hh', `test')
-add(`smart_record', `hh', `test')
+add(`sr', `hh')
add(`stringify', `hh', `test')
add(`strip', `hh', `cc', `test')
add(`system', `hh', `cc', `test', `testscript')
diff --git a/paludis/util/smart_record.hh.m4 b/paludis/util/smart_record.hh.m4
deleted file mode 100644
index 64fee3f..0000000
--- a/paludis/util/smart_record.hh.m4
+++ /dev/null
@@ -1,944 +0,0 @@
-#if 0
-ifdef(`__gnu__',`',`errprint(`This is not GNU m4...
-')m4exit(1)') include(`misc/generated-file.txt')
-dnl vim: set ft=cpp et sw=4 sts=4 :
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
- *
- * 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
- */
-
-define(`max_record_size', `18')
-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
-
-#ifndef PALUDIS_GUARD_PALUDIS_SMART_RECORD_HH
-#define PALUDIS_GUARD_PALUDIS_SMART_RECORD_HH 1
-
-#include <paludis/util/comparison_policy.hh>
-#include <paludis/util/compare.hh>
-#include <paludis/util/exception.hh>
-#include <string>
-
-/** \file
- * SmartRecord declarations.
- *
- * \ingroup grprecords
- */
-
-namespace paludis
-{
- namespace comparison_method
- {
- /**
- * Comparisons are done by considering each member in order.
- *
- * \ingroup grprecords
- */
- struct SmartRecordCompareByAllTag
- {
- };
-
- /**
- * Comparisons are done by considering a specific key.
- *
- * \ingroup grprecords
- */
- template <unsigned key_>
- struct SmartRecordCompareByKeyTag
- {
- };
-
- /**
- * Comparisons are done by considering a range of keys.
- *
- * \ingroup grprecords
- */
- template <unsigned first_key_, unsigned last_key_>
- struct SmartRecordCompareByKeyRangeTag
- {
- };
- }
-
- /**
- * Provides the basic typedefs required for a MakeSmartRecord instantiation.
- *
- * \ingroup grprecords
- */
- template <
- typename ComparisonModeTag_ = comparison_mode::NoComparisonTag,
- typename ComparisonMethod_ = comparison_method::SmartRecordCompareByAllTag>
- struct SmartRecordTag
- {
- /**
- * Mode used for ComparisonPolicy.
- *
- * \ingroup grprecords
- */
- typedef ComparisonModeTag_ ComparisonModeTag;
-
- /**
- * Method used for ComparisonPolicy, should be either
- * comparison_method::SmartRecordCompareByAllTag or
- * comparison_method::SmartRecordCompareByKeyTag .
- *
- * \ingroup grprecords
- */
- typedef ComparisonMethod_ ComparisonMethodTag;
- };
-
- /**
- * Provides the key information typedefs for a MakeSmartRecord
- * instantiation.
- *
- * \ingroup grprecords
- */
- template <typename E_, unsigned Count_>
- struct SmartRecordKeys
- {
- /**
- * The type of our keys.
- */
- typedef E_ Keys;
-
- /**
- * The number of keys.
- */
- static const unsigned key_count = Count_;
- };
-
- template <unsigned Idx_, typename T_>
- struct SmartRecordKey;
-
-forloop(`idx', `0', max_record_size, `
- /**
- * Provides the key information typedefs for a MakeSmartRecord
- * instantiation.
- *
- * \ingroup grprecords
- */
- template <typename T_>
- struct SmartRecordKey<`'idx`', T_>
- {
- typedef T_ KeyType`'idx`';
- };
-')
-
- /**
- * Internal use by SmartRecord.
- *
- * \ingroup grprecords
- */
- namespace smart_record_internals
- {
- /**
- * Internal use by SmartRecord: turn a string literal into a string.
- *
- * \ingroup grprecords
- */
- template <typename T_>
- struct CharStarToString
- {
- /// Our type, unconverted.
- typedef T_ Type;
- };
-
- /**
- * Internal use by SmartRecord: turn a string literal into a string.
- *
- * \ingroup grprecords
- */
- template <unsigned i_>
- struct CharStarToString<char [i_]>
- {
- /// We are a string.
- typedef std::string Type;
- };
-
- /**
- * Internal use by SmartRecord: turn a string literal into a string.
- *
- * \ingroup grprecords
- */
- template <unsigned i_>
- struct CharStarToString<const char [i_]>
- {
- /// We are a string.
- typedef std::string Type;
- };
-
- /**
- * Internal use by SmartRecord: turn a string literal into a string.
- *
- * \ingroup grprecords
- */
- template <>
- struct CharStarToString<char *>
- {
- /// We are a string.
- typedef std::string Type;
- };
-
- /**
- * Internal use by SmartRecord: tail of a list.
- *
- * \ingroup grprecords
- */
- struct ParamListTail
- {
- /// We have no children.
- static const unsigned list_length = 0;
- };
-
- /**
- * Internal use by SmartRecord: a list of parameters.
- *
- * \ingroup grprecords
- */
- template <unsigned left_idx_, typename L_, typename R_>
- struct ParamList
- {
- /// Our left index.
- static const unsigned left_idx = left_idx_;
-
- /// Our left item.
- L_ left;
-
- /// Type of our left item.
- typedef L_ LeftType;
-
- /// Our right item.
- R_ right;
-
- /// Type of our right item.
- typedef R_ RightType;
-
- /// How long are we?
- static const unsigned list_length = 1 + RightType::list_length;
-
- /// Constructor.
- ParamList(const L_ & l, const R_ & r) :
- left(l),
- right(r)
- {
- }
- };
-
- template <unsigned idx_, typename Result_, unsigned left_idx_, typename L_, typename R_>
- Result_
- find_list_entry(const ParamList<left_idx_, L_, R_> & list);
-
- /**
- * Find a list entry.
- *
- * \ingroup grprecords
- */
- template <bool is_left, unsigned idx_, typename Result_, unsigned left_idx_, typename L_, typename R_>
- struct FindListEntry;
-
- /**
- * Find a list entry.
- *
- * \ingroup grprecords
- */
- template <unsigned idx_, typename Result_, unsigned left_idx_, typename L_, typename R_>
- struct FindListEntry<true, idx_, Result_, left_idx_, L_, R_>
- {
- Result_ operator() (const ParamList<left_idx_, L_, R_> & list) const
- {
- return list.left;
- }
- };
-
- /**
- * Find a list entry.
- *
- * \ingroup grprecords
- */
- template <unsigned idx_, typename Result_, unsigned left_idx_, typename L_, typename R_>
- struct FindListEntry<false, idx_, Result_, left_idx_, L_, R_>
- {
- Result_ operator() (const ParamList<left_idx_, L_, R_> & list) const
- {
- return find_list_entry<idx_, Result_>(list.right);
- }
- };
-
- /**
- * Find a list entry.
- *
- * \ingroup grprecords
- */
- template <unsigned idx_, typename Result_, unsigned left_idx_, typename L_, typename R_>
- Result_
- find_list_entry(const ParamList<left_idx_, L_, R_> & list)
- {
- return FindListEntry<left_idx_ == idx_, idx_, Result_, left_idx_, L_, R_>()(list);
- }
-
- /**
- * A node in a param list.
- *
- * \ingroup grprecords
- */
- template <unsigned idx_, typename T_>
- struct ParamListNode
- {
- /// Our item.
- T_ value;
-
- /// Our index.
- static const unsigned idx = idx_;
-
- /// Constructor.
- ParamListNode(const T_ & t) :
- value(t)
- {
- }
- };
-
- /**
- * Join param nodes.
- *
- * \ingroup grprecords
- */
- template <unsigned left_idx_, typename T_, unsigned right_idx_, typename U_>
- ParamList<left_idx_, T_, ParamList<right_idx_, U_, ParamListTail> >
- operator, (const ParamListNode<left_idx_, T_> & t, const ParamListNode<right_idx_, U_> & u)
- {
- return ParamList<left_idx_, T_, ParamList<right_idx_, U_, ParamListTail> >(t.value,
- ParamList<right_idx_, U_, ParamListTail>(u.value, ParamListTail()));
- }
-
- /**
- * Join param nodes.
- *
- * \ingroup grprecords
- */
- template <unsigned left_idx_, typename T_, typename U_, unsigned right_idx_, typename V_>
- ParamList<left_idx_, V_, ParamList<right_idx_, T_, U_> >
- operator, (const ParamList<right_idx_, T_, U_> & t, const ParamListNode<left_idx_, V_> & u)
- {
- return ParamList<left_idx_, V_, ParamList<right_idx_, T_, U_> >(u.value, t);
- }
-
- template <typename Tag_, unsigned Key_>
- struct GetRecordKeyType;
-
-forloop(`idx', `0', max_record_size, `
- /**
- * Get the type of a particular key in a record.
- *
- * \ingroup grprecords
- */
- template <typename Tag_>
- struct GetRecordKeyType<Tag_, `'idx`'>
- {
- typedef typename Tag_::KeyType`'idx`' Type;
- };
-')
-
- template <typename Tag_, unsigned key_count_>
- struct RecordBase;
-
- template <typename Tag_, unsigned key_count_, unsigned Key_>
- struct RecordKeyGetter;
-
- template <typename Tag_, unsigned key_count_, unsigned Key_>
- struct RecordKeyPointerGetter;
-
-forloop(`idx', `0', max_record_size, `
- /**
- * Handle fetching a record key.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_>
- struct RecordKeyGetter<Tag_, key_count_, `'idx`'>
- {
- /**
- * Fetch, const.
- */
- static const typename GetRecordKeyType<Tag_, `'idx`'>::Type &
- do_get(const RecordBase<Tag_, key_count_> & r)
- {
- return r._v`'idx`';
- }
-
- /**
- * Fetch, non const.
- */
- static typename GetRecordKeyType<Tag_, `'idx`'>::Type &
- do_get(RecordBase<Tag_, key_count_> & r)
- {
- return r._v`'idx`';
- }
-
- /**
- * Set.
- */
- static void
- do_set(RecordBase<Tag_, key_count_> & r,
- const typename GetRecordKeyType<Tag_, `'idx`'>::Type & v)
- {
- r._v`'idx`' = v;
- }
- };
-')
-
- template <typename Tag_, unsigned key_count_, typename ComparisonModeTag_, typename ComparisonMethodTag_>
- struct RecordComparisonBase;
-
- /**
- * RecordComparisonBase: specialisation for comparison_mode::NoComparisonTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, typename ComparisonMethodTag_>
- struct RecordComparisonBase<Tag_, key_count_, comparison_mode::NoComparisonTag, ComparisonMethodTag_> :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::NoComparisonTag, ComparisonMethodTag_>
- {
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::EqualityComparisonTag and
- * comparison_method::SmartRecordCompareByKeyTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned key_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> > : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >
- {
- public:
- /// Constructor.
- RecordComparisonBase();
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other);
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::FullComparisonTag and
- * comparison_method::SmartRecordCompareByKeyTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned key_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> > : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >
- {
- public:
- /// Constructor.
- RecordComparisonBase();
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other);
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::EqualityComparisonTag and
- * comparison_method::SmartRecordCompareByAllTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByAllTag> : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>
- {
- protected:
- /// Do the comparison.
- bool compare(const RecordBase<Tag_, key_count_> & other) const;
-
- public:
- /// Constructor.
- RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(&RecordComparisonBase::compare)
- {
- }
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(other)
- {
- }
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::FullComparisonTag and
- * comparison_method::SmartRecordCompareByAllTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByAllTag> : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>
- {
- protected:
- /// Do the comparison.
- int compare(const RecordBase<Tag_, key_count_> & other) const;
-
- public:
- /// Constructor.
- RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(&RecordComparisonBase::compare)
- {
- }
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(other)
- {
- }
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::EqualityComparisonTag and
- * comparison_method::SmartRecordCompareByKeyRangeTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned first_key_, unsigned last_key_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByKeyRangeTag<first_key_, last_key_> > : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>
- {
- protected:
- /// Do the comparison.
- bool compare(const RecordBase<Tag_, key_count_> & other) const;
-
- public:
- /// Constructor.
- RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(&RecordComparisonBase::compare)
- {
- }
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(other)
- {
- }
- };
-
- /**
- * RecordComparisonBase: specialisation for
- * comparison_mode::FullComparisonTag and
- * comparison_method::SmartRecordCompareByKeyRangeTag.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned first_key_, unsigned last_key_>
- class RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyRangeTag<first_key_, last_key_> > : public
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>
- {
- protected:
- /// Do the comparison.
- int compare(const RecordBase<Tag_, key_count_> & other) const;
-
- public:
- /// Constructor.
- RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(&RecordComparisonBase::compare)
- {
- }
-
- /// Copy constructor.
- RecordComparisonBase(const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberComparisonFunctionTag>(other)
- {
- }
- };
-
-forloop(`idx', `1', max_record_size, `
- /**
- * Base class for a SmartRecord.
- *
- * \ingroup grprecords
- */
- template<typename Tag_>
- class RecordBase<Tag_, `'idx`'> : public RecordComparisonBase<Tag_, `'idx`',
- typename Tag_::ComparisonModeTag,
- typename Tag_::ComparisonMethodTag>
- {
-forloop(`idy', `0', decr(`'idx`'), `
- friend class RecordKeyGetter<Tag_, `'idx`', `'idy`'>;
- friend class RecordKeyPointerGetter<Tag_, `'idx`', `'idy`'>;
-')
-
- private:
-forloop(`idy', `0', decr(`'idx`'), `
- typename Tag_::KeyType`'idy`' _v`'idy`';
-')
-
- public:
- /// Destructor.
- ~RecordBase();
-
- /// Constructor, from raw parameters.
- RecordBase(
-ifelse(idx, `1', `', `forloop(`idy', `0', decr(decr(idx)), `
- const typename Tag_::KeyType`'idy`' & p`'idy`',
-') ')
- const typename Tag_::KeyType`'decr(idx)`' & p`'decr(idx)`'
- ) :
-ifelse(idx, `1', `', `forloop(`idy', `0', decr(decr(idx)), `
- _v`'idy`'(p`'idy`'),
-') ')
- _v`'decr(idx)`'(p`'decr(idx)`')
- {
- }
-
- /// Copy constructor.
- RecordBase(const RecordBase<Tag_, `'idx`'> & other);
-
- /// Assignment.
- const RecordBase & operator= (const RecordBase<Tag_, `'idx`'> & other)
- {
-forloop(`idy', `0', decr(idx), `
- _v`'idy`' = other._v`'idy`';
-')
- return *this;
- }
-
- /// Fetch a key type.
- template <typename Tag_::Keys k_>
- struct GetKeyType
- {
- /// The key type.
- typedef typename GetRecordKeyType<Tag_, k_>::Type Type;
- };
-
- /// Fetch an item.
- template <typename Tag_::Keys k_>
- const typename GetRecordKeyType<Tag_, k_>::Type & get() const
- {
- return RecordKeyGetter<Tag_, `'idx`', k_>::do_get(*this);
- }
-
- /// Fetch an item.
- template <typename Tag_::Keys k_>
- typename GetRecordKeyType<Tag_, k_>::Type & get()
- {
- return RecordKeyGetter<Tag_, `'idx`', k_>::do_get(*this);
- }
-
- /// Set an item.
- template <typename Tag_::Keys k_>
- void set(const typename GetRecordKeyType<Tag_, k_>::Type & v)
- {
- return RecordKeyGetter<Tag_, `'idx`', k_>::do_set(*this, v);
- }
-
- /// Named parameters constructor.
- template <typename List_>
- static RecordBase
- create(const List_ & list);
- };
-
- template<typename Tag_>
- RecordBase<Tag_, `'idx`'>::RecordBase(const RecordBase<Tag_, `'idx`'> & other) :
- RecordComparisonBase<Tag_, `'idx`', typename Tag_::ComparisonModeTag,
- typename Tag_::ComparisonMethodTag>(other),
-ifelse(idx, `1', `', `forloop(`idy', `0', decr(decr(idx)), `
- _v`'idy`'(other._v`'idy`'),
-') ')
- _v`'decr(idx)`'(other._v`'decr(idx)`')
- {
- }
-
- template<typename Tag_>
- template<typename List_>
- RecordBase<Tag_, `'idx`'>
- RecordBase<Tag_, `'idx`'>::create(const List_ & list)
- {
- return RecordBase(
-ifelse(idx, `1', `', `forloop(`idy', `0', decr(decr(idx)), `
- find_list_entry<`'idy`', typename Tag_::KeyType`'idy`'>(list),
-') ')
- find_list_entry<`'decr(idx)`', typename Tag_::KeyType`'decr(idx)`'>(list)
- );
- }
-
- template<typename Tag_>
- RecordBase<Tag_, `'idx`'>::~RecordBase()
- {
- }
-')
-
-forloop(`idx', `0', max_record_size, `
- /**
- * Fetch a pointer to a record key.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_>
- struct RecordKeyPointerGetter<Tag_, key_count_, `'idx`'>
- {
- /**
- * Fetch the pointer.
- */
- static typename GetRecordKeyType<Tag_, `'idx>::Type
- RecordBase<Tag_, key_count_>::* do_get_pointer()
- {
- return &RecordBase<Tag_, key_count_>::_v`'idx`';
- }
- };
-')
-
- template <typename Tag_, unsigned key_count_, unsigned key_>
- RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> >::RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >(
- RecordKeyPointerGetter<Tag_, key_count_, key_>::do_get_pointer())
- {
- }
-
- template <typename Tag_, unsigned key_count_, unsigned key_>
- RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> >::RecordComparisonBase(
- const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::FullComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >(other)
- {
- }
-
- template <typename Tag_, unsigned key_count_, unsigned key_>
- RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> >::RecordComparisonBase() :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >(
- RecordKeyPointerGetter<Tag_, key_count_, key_>::do_get_pointer())
- {
- }
-
- template <typename Tag_, unsigned key_count_, unsigned key_>
- RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByKeyTag<key_> >::RecordComparisonBase(
- const RecordComparisonBase & other) :
- ComparisonPolicy<RecordBase<Tag_, key_count_>, comparison_mode::EqualityComparisonTag,
- comparison_method::CompareByMemberTag<typename GetRecordKeyType<Tag_, key_>::Type> >(other)
- {
- }
-
- template <typename Tag_, unsigned key_count_>
- struct DoFullCompareByAll;
-
-forloop(`idx', `1', max_record_size, `
- /**
- * Mixin class for SmartRecord instances that are compared by all
- * keys in order.
- *
- * \ingroup grprecords
- */
- template <typename Tag_>
- struct DoFullCompareByAll<Tag_, `'idx`'>
- {
- /// Do the comparison.
- static int do_compare(const RecordBase<Tag_, `'idx`'> * const a,
- const RecordBase<Tag_, `'idx`'> * const b);
- };
-
- template <typename Tag_>
- int
- DoFullCompareByAll<Tag_, `'idx`'>::do_compare(
- const RecordBase<Tag_, `'idx`'> * const a,
- const RecordBase<Tag_, `'idx`'> * const b)
- {
-forloop(`idy', `0', decr(`'idx`'), `
- switch (compare(
- RecordKeyGetter<Tag_, `'idx`', `'idy`'>::do_get(*a),
- RecordKeyGetter<Tag_, `'idx`', `'idy`'>::do_get(*b)))
- {
- case -1:
- return -1;
- case 1:
- return 1;
- case 0:
- break;
- default:
- throw InternalError(PALUDIS_HERE, "Bad value from compare");
- }
-')
- return 0;
- }
-')
-
- template <typename Tag_, unsigned key_count_>
- struct DoEqualCompareByAll;
-
-forloop(`idx', `1', max_record_size, `
- /**
- * Mixin class for SmartRecord instances that are equal-compared by all
- * keys in order.
- *
- * \ingroup grprecords
- */
- template <typename Tag_>
- struct DoEqualCompareByAll<Tag_, `'idx`'>
- {
- static bool do_compare(const RecordBase<Tag_, `'idx`'> * const a,
- const RecordBase<Tag_, `'idx`'> * const b);
- };
-
- template <typename Tag_>
- bool
- DoEqualCompareByAll<Tag_, `'idx`'>::do_compare(
- const RecordBase<Tag_, `'idx`'> * const a,
- const RecordBase<Tag_, `'idx`'> * const b)
- {
-forloop(`idy', `0', decr(`'idx`'), `
- if (RecordKeyGetter<Tag_, `'idx`', `'idy`'>::do_get(*a) !=
- RecordKeyGetter<Tag_, `'idx`', `'idy`'>::do_get(*b))
- return false;
-')
- return true;
- }
-')
-
- template <typename Tag_, unsigned key_count_>
- int RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByAllTag>::compare(
- const RecordBase<Tag_, key_count_> & other) const
- {
- return DoFullCompareByAll<Tag_, key_count_>::do_compare(
- static_cast<const RecordBase<Tag_, key_count_> *>(this), &other);
- }
-
- template <typename Tag_, unsigned key_count_>
- bool RecordComparisonBase<Tag_, key_count_, comparison_mode::EqualityComparisonTag,
- comparison_method::SmartRecordCompareByAllTag>::compare(
- const RecordBase<Tag_, key_count_> & other) const
- {
- return DoEqualCompareByAll<Tag_, key_count_>::do_compare(
- static_cast<const RecordBase<Tag_, key_count_> *>(this), &other);
- }
-
- /**
- * Do the comparison for a range of keys.
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned from_key_, unsigned count_>
- struct DoFullCompareByKeyRange
- {
- /**
- * Do the comparison.
- *
- * \ingroup grprecords
- */
- static int do_compare(const RecordBase<Tag_, key_count_> * const a,
- const RecordBase<Tag_, key_count_> * const b)
- {
- if (RecordKeyGetter<Tag_, key_count_, from_key_>::do_get(*a) <
- RecordKeyGetter<Tag_, key_count_, from_key_>::do_get(*b))
- return -1;
- if (RecordKeyGetter<Tag_, key_count_, from_key_>::do_get(*a) >
- RecordKeyGetter<Tag_, key_count_, from_key_>::do_get(*b))
- return 1;
-
- return DoFullCompareByKeyRange<Tag_, key_count_, from_key_ + 1, count_ - 1>::do_compare(a, b);
- }
- };
-
- /**
- * Do the comparison for a range of keys (specialisation for zero sized
- * ranges).
- *
- * \ingroup grprecords
- */
- template <typename Tag_, unsigned key_count_, unsigned from_key_>
- struct DoFullCompareByKeyRange<Tag_, key_count_, from_key_, 0>
- {
- /**
- * Do the comparison.
- */
- static int do_compare(const RecordBase<Tag_, key_count_> * const,
- const RecordBase<Tag_, key_count_> * const)
- {
- return 0;
- }
- };
-
-#ifndef DOXYGEN
- template <typename Tag_, unsigned key_count_, unsigned from_key_, unsigned to_key_>
- int RecordComparisonBase<Tag_, key_count_, comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByKeyRangeTag<from_key_, to_key_> >::compare(
- const RecordBase<Tag_, key_count_> & other) const
- {
- return DoFullCompareByKeyRange<Tag_, key_count_, from_key_, to_key_ - from_key_>::do_compare(
- static_cast<const RecordBase<Tag_, key_count_> *>(this), &other);
- }
-#endif
-
- }
-
- /**
- * Create a SmartRecord with the attributes described by Tag_.
- *
- * \ingroup grprecords
- */
- template <typename Tag_>
- struct MakeSmartRecord
- {
- /**
- * The type of our SmartRecord.
- *
- * \ingroup grprecords
- */
- typedef smart_record_internals::RecordBase<Tag_, Tag_::key_count> Type;
- };
-
- /**
- * Create a named parameter for creating a SmartRecord instance.
- *
- * \ingroup grprecords
- */
- template <unsigned idx_, typename T_>
- smart_record_internals::ParamListNode<idx_, typename smart_record_internals::CharStarToString<T_>::Type>
- param(const T_ & t)
- {
- return smart_record_internals::ParamListNode<idx_,
- typename smart_record_internals::CharStarToString<T_>::Type>(t);
- }
-}
-
-#endif
diff --git a/paludis/util/smart_record_TEST.cc b/paludis/util/smart_record_TEST.cc
deleted file mode 100644
index e24e342..0000000
--- a/paludis/util/smart_record_TEST.cc
+++ /dev/null
@@ -1,200 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
- *
- * 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/smart_record.hh>
-#include <test/test_framework.hh>
-#include <test/test_runner.hh>
-#include <vector>
-#include <iterator>
-
-using namespace paludis;
-using namespace test;
-
-/** \file
- * Test cases for smart_record.hh .
- *
- * \ingroup grptestcases
- */
-
-namespace
-{
- enum PersonKeys
- {
- firstname,
- surname,
- age
- };
-
- struct PersonRecordTag :
- SmartRecordTag<
- comparison_mode::FullComparisonTag,
- comparison_method::SmartRecordCompareByAllTag
- >,
- SmartRecordKeys<PersonKeys, 3>,
- SmartRecordKey<firstname, std::string>,
- SmartRecordKey<surname, std::string>,
- SmartRecordKey<age, unsigned>
- {
- };
-
- typedef MakeSmartRecord<PersonRecordTag>::Type Person;
-
- enum PairKeys
- {
- first,
- second
- };
-
- struct PairTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<PairKeys, 2>,
- SmartRecordKey<first, int>,
- SmartRecordKey<second, int>
- {
- };
-
- typedef MakeSmartRecord<PairTag>::Type Pair;
-}
-
-namespace test_cases
-{
- /**
- * \test Test a simple SmartRecord.
- *
- * \ingroup grptestcases
- */
- struct SimpleRecordTest : TestCase
- {
- SimpleRecordTest() : TestCase("simple") { }
-
- void run()
- {
- const Person p1("blah", "first", 10);
- TEST_CHECK_EQUAL(p1.get<firstname>(), "blah");
- TEST_CHECK_EQUAL(p1.get<surname>(), "first");
- TEST_CHECK_EQUAL(p1.get<age>(), 10);
-
- const Person p2("blah", "second", 6);
- TEST_CHECK_EQUAL(p2.get<firstname>(), "blah");
- TEST_CHECK_EQUAL(p2.get<surname>(), "second");
- TEST_CHECK_EQUAL(p2.get<age>(), 6);
-
- TEST_CHECK( (p1 < p2));
- TEST_CHECK( (p1 <= p2));
- TEST_CHECK(!(p1 == p2));
- TEST_CHECK( (p1 != p2));
- TEST_CHECK(!(p1 >= p2));
- TEST_CHECK(!(p1 > p2));
-
- Person p3("foo", "bar", 1);
- TEST_CHECK_EQUAL(p3.get<age>(), 1);
- p3.set<age>(2);
- TEST_CHECK_EQUAL(p3.get<age>(), 2);
- p3.get<age>() = 4;
- TEST_CHECK_EQUAL(p3.get<age>(), 4);
- }
- } test_simple_record;
-
- /**
- * \test Test a list constructed SmartRecord.
- *
- * \ingroup grptestcases
- */
- struct ListConstructedRecordTest : TestCase
- {
- ListConstructedRecordTest() : TestCase("list constructed") { }
-
- void run()
- {
- const Person p1(Person::create((
- param<firstname>("first"),
- param<surname>("sur"),
- param<age>(10))));
-
- TEST_CHECK_EQUAL(p1.get<firstname>(), "first");
- TEST_CHECK_EQUAL(p1.get<surname>(), "sur");
- TEST_CHECK_EQUAL(p1.get<age>(), 10);
-
- const Person p2(Person::create((
- param<surname>("bar"),
- param<firstname>("foo"),
- param<age>(42))));
-
- TEST_CHECK_EQUAL(p2.get<firstname>(), "foo");
- TEST_CHECK_EQUAL(p2.get<surname>(), "bar");
- TEST_CHECK_EQUAL(p2.get<age>(), 42);
- }
- } test_list_constructed_record;
-
- /**
- * \test Test a SmartRecord of pairs of items.
- *
- * \ingroup grptestcases
- */
- struct PairTest : TestCase
- {
- PairTest() : TestCase("pair") { }
-
- void run()
- {
- std::vector<Pair> v;
- v.push_back(Pair(0, 0));
- v.push_back(Pair(0, 1));
- v.push_back(Pair(0, 2));
- v.push_back(Pair(1, 0));
- v.push_back(Pair(1, 1));
- v.push_back(Pair(1, 2));
- v.push_back(Pair(2, 0));
-
- std::vector<Pair>::iterator v1(v.begin()), v_end(v.end());
- for ( ; v1 != v_end ; ++v1)
- {
- TestMessageSuffix s1("v1:" + stringify(v1->get<first>()) + "/"
- + stringify(v1->get<second>()), true);
- std::vector<Pair>::iterator v2(v.begin());
- for ( ; v2 != v_end ; ++v2)
- {
- TestMessageSuffix s2("v2:" + stringify(v2->get<first>()) + "/"
- + stringify(v2->get<second>()), true);
-
- if (std::distance(v.begin(), v1) < std::distance(v.begin(), v2))
- {
- TEST_CHECK(*v1 < *v2);
- TEST_CHECK(*v2 > *v1);
- TEST_CHECK(*v1 != *v2);
- TEST_CHECK(*v2 != *v1);
- }
- else if (std::distance(v.begin(), v1) > std::distance(v.begin(), v2))
- {
- TEST_CHECK(*v2 < *v1);
- TEST_CHECK(*v1 > *v2);
- TEST_CHECK(*v2 != *v1);
- TEST_CHECK(*v1 != *v2);
- }
- else
- {
- TEST_CHECK(*v2 == *v1);
- TEST_CHECK(*v1 == *v2);
- }
- }
- }
- }
- } test_pair;
-}
-
diff --git a/paludis/util/sr.hh b/paludis/util/sr.hh
new file mode 100644
index 0000000..8197ad3
--- /dev/null
+++ b/paludis/util/sr.hh
@@ -0,0 +1,45 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.uk>
+ *
+ * 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_SR_HH
+#define PALUDIS_GUARD_PALUDIS_UTIL_SR_HH 1
+
+namespace paludis
+{
+ struct Empty
+ {
+ };
+
+ template <bool value_, typename IfTrue_, typename IfFalse_>
+ struct Select;
+
+ template <typename IfTrue_, typename IfFalse_>
+ struct Select<true, IfTrue_, IfFalse_>
+ {
+ typedef IfTrue_ Type;
+ };
+
+ template <typename IfTrue_, typename IfFalse_>
+ struct Select<false, IfTrue_, IfFalse_>
+ {
+ typedef IfFalse_ Type;
+ };
+}
+
+#endif
diff --git a/paludis/version_metadata.cc b/paludis/version_metadata.cc
index bee0a7a..5764d6e 100644
--- a/paludis/version_metadata.cc
+++ b/paludis/version_metadata.cc
@@ -31,40 +31,38 @@
using namespace paludis;
-VersionMetadataDeps::VersionMetadataDeps(ParserFunction p) :
- MakeSmartRecord<VersionMetadataDepsTag>::Type(MakeSmartRecord<VersionMetadataDepsTag>::Type::create((
- param<vmd_build_depend_string>(""),
- param<vmd_run_depend_string>(""),
- param<vmd_post_depend_string>(""),
- param<vmd_parser>(p))))
-{
-}
+#include <paludis/version_metadata-sr.cc>
DepAtom::ConstPointer
VersionMetadataDeps::build_depend() const
{
- return get<vmd_parser>()(get<vmd_build_depend_string>());
+ return parser(build_depend_string);
}
DepAtom::ConstPointer
VersionMetadataDeps::run_depend() const
{
- return get<vmd_parser>()(get<vmd_run_depend_string>());
+ return parser(run_depend_string);
}
DepAtom::ConstPointer
VersionMetadataDeps::post_depend() const
{
- return get<vmd_parser>()(get<vmd_post_depend_string>());
+ return parser(post_depend_string);
+}
+
+VersionMetadataDeps::VersionMetadataDeps(const ParserFunction & p) :
+ parser(p)
+{
}
VersionMetadata::CRAN::CRAN(ParserFunction f) :
VersionMetadata(f, &_c, 0, 0),
- _c(CRANVersionMetadata::create((
- param<cranvm_keywords>(""),
- param<cranvm_package>(""),
- param<cranvm_version>(""),
- param<cranvm_is_bundle>(false))))
+ _c(CRANVersionMetadata::create()
+ .keywords("")
+ .package("")
+ .version("")
+ .is_bundle(false))
{
}
@@ -86,15 +84,13 @@ VersionMetadata::~VersionMetadata()
}
VersionMetadata::VersionMetadata(ParserFunction p) :
- MakeSmartRecord<VersionMetadataTag>::Type(MakeSmartRecord<VersionMetadataTag>::Type::create((
- param<vm_slot>(SlotName("unset")),
- param<vm_deps>(VersionMetadataDeps(p)),
- param<vm_homepage>(""),
- param<vm_license>(""),
- param<vm_description>(""),
- param<vm_eapi>("UNSET"),
- param<vm_license>("")
- ))),
+ VersionMetadataBase(VersionMetadataBase::create()
+ .slot(SlotName("unset"))
+ .deps(VersionMetadataDeps(p))
+ .homepage("")
+ .license_string("")
+ .description("")
+ .eapi("")),
_cran_if(0),
_ebuild_if(0),
_ebin_if(0)
@@ -105,15 +101,13 @@ VersionMetadata::VersionMetadata(ParserFunction p,
CRANVersionMetadata * cran_if,
EbuildVersionMetadata * ebuild_if,
EbinVersionMetadata * ebin_if) :
- MakeSmartRecord<VersionMetadataTag>::Type(MakeSmartRecord<VersionMetadataTag>::Type::create((
- param<vm_slot>(SlotName("unset")),
- param<vm_deps>(VersionMetadataDeps(p)),
- param<vm_homepage>(""),
- param<vm_license>(""),
- param<vm_description>(""),
- param<vm_eapi>("UNSET"),
- param<vm_license>("")
- ))),
+ VersionMetadataBase(VersionMetadataBase::create()
+ .slot(SlotName("unset"))
+ .deps(VersionMetadataDeps(p))
+ .homepage("")
+ .license_string("")
+ .description("")
+ .eapi("")),
_cran_if(cran_if),
_ebuild_if(ebuild_if),
_ebin_if(ebin_if)
@@ -121,35 +115,32 @@ VersionMetadata::VersionMetadata(ParserFunction p,
}
EbuildVersionMetadata::EbuildVersionMetadata() :
- MakeSmartRecord<EbuildVersionMetadataTag>::Type((EbuildVersionMetadata::create((
- param<evm_src_uri>(""),
- param<evm_restrict>(""),
- param<evm_keywords>(""),
- param<evm_inherited>(""),
- param<evm_iuse>(""),
- param<evm_inherited>(""),
- param<evm_provide>(""),
- param<evm_virtual>("")))))
+ provide_string(""),
+ src_uri(""),
+ restrict_string(""),
+ keywords(""),
+ iuse(""),
+ virtual_for(""),
+ inherited("")
{
}
EbinVersionMetadata::EbinVersionMetadata() :
- MakeSmartRecord<EbinVersionMetadataTag>::Type((EbinVersionMetadata::create((
- param<ebvm_bin_uri>(""),
- param<ebvm_src_repository>(RepositoryName("unset"))))))
+ bin_uri(""),
+ src_repository(RepositoryName("unset"))
{
}
DepAtom::ConstPointer
EbuildVersionMetadata::provide() const
{
- return PortageDepParser::parse(get<evm_provide>(), PortageDepParserPolicy<PackageDepAtom,
+ return PortageDepParser::parse(provide_string, PortageDepParserPolicy<PackageDepAtom,
false>::get_instance());
}
DepAtom::ConstPointer
VersionMetadata::license() const
{
- return PortageDepParser::parse(get<vm_license>(), PortageDepParserPolicy<PlainTextDepAtom,
+ return PortageDepParser::parse(license_string, PortageDepParserPolicy<PlainTextDepAtom,
true>::get_instance());
}
diff --git a/paludis/version_metadata.hh b/paludis/version_metadata.hh
index c93120a..b5ab0bc 100644
--- a/paludis/version_metadata.hh
+++ b/paludis/version_metadata.hh
@@ -23,7 +23,7 @@
#include <paludis/name.hh>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/private_implementation_pattern.hh>
-#include <paludis/util/smart_record.hh>
+#include <paludis/util/sr.hh>
#include <paludis/dep_atom.hh>
#include <string>
@@ -42,241 +42,7 @@ namespace paludis
*/
typedef DepAtom::ConstPointer (* ParserFunction) (const std::string &);
- /**
- * Keys for VersionMetadataDeps.
- *
- * \see VersionMetadataDeps
- * \ingroup grpversions
- */
- enum VersionMetadataDepsKey
- {
- vmd_parser, ///< Our parser
- vmd_build_depend_string, ///< Our build deps
- vmd_run_depend_string, ///< Our runtime deps
- vmd_post_depend_string, ///< Our post deps
- last_vmd ///< Number of items
- };
-
- /**
- * Tag for VersionMetadataDeps.
- *
- * \see VersionMetadataDeps
- * \ingroup grpversions
- */
- struct VersionMetadataDepsTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<VersionMetadataDepsKey, last_vmd>,
- SmartRecordKey<vmd_parser, ParserFunction>,
- SmartRecordKey<vmd_build_depend_string, std::string>,
- SmartRecordKey<vmd_run_depend_string, std::string>,
- SmartRecordKey<vmd_post_depend_string, std::string>
- {
- };
-
- /**
- * Version metadata dependency information.
- *
- * \see VersionMetadata
- * \ingroup grpversions
- */
- class VersionMetadataDeps :
- public MakeSmartRecord<VersionMetadataDepsTag>::Type
- {
- public:
- /**
- * Constructor.
- */
- VersionMetadataDeps(ParserFunction);
-
- /**
- * Our build depends.
- */
- DepAtom::ConstPointer build_depend() const;
-
- /**
- * Our runtime depends.
- */
- DepAtom::ConstPointer run_depend() const;
-
- /**
- * Our post depends.
- */
- DepAtom::ConstPointer post_depend() const;
- };
-
- /**
- * Key for VersionMetadata.
- *
- * \see VersionMetadata
- * \ingroup grpversions
- */
- enum VersionMetadataKey
- {
- vm_deps, ///< Dependencies
- vm_slot, ///< Slot
- vm_license, ///< Licence
- vm_eapi, ///< EAPI
- vm_homepage, ///< Homepage
- vm_description, ///< Description
- last_vm ///< Number of items
- };
-
- /**
- * Tag for VersionMetadata.
- *
- * \see VersionMetadata
- * \ingroup grpversions
- */
- struct VersionMetadataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<VersionMetadataKey, last_vm>,
- SmartRecordKey<vm_deps, VersionMetadataDeps>,
- SmartRecordKey<vm_slot, SlotName>,
- SmartRecordKey<vm_license, std::string>,
- SmartRecordKey<vm_eapi, std::string>,
- SmartRecordKey<vm_homepage, std::string>,
- SmartRecordKey<vm_description, std::string>
- {
- };
-
- /**
- * Key for EbuildVersionMetadata.
- *
- * \see EbuildVersionMetadata
- * \ingroup grpversions
- */
- enum EbuildVersionMetadataKey
- {
- evm_provide, ///< PROVIDE
- evm_src_uri, ///< SRC_URI
- evm_restrict, ///< RESTRICT
- evm_keywords, ///< KEYWORDS
- evm_iuse, ///< IUSE
- evm_virtual, ///< virtual for what?
- evm_inherited, ///< INHERITED
- last_evm ///< number of items
- };
-
- /**
- * Tag for EbuildVersionMetadata.
- *
- * \see EbuildVersionMetadata
- * \ingroup grpversions
- */
- struct EbuildVersionMetadataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbuildVersionMetadataKey, last_evm>,
- SmartRecordKey<evm_provide, std::string>,
- SmartRecordKey<evm_src_uri, std::string>,
- SmartRecordKey<evm_restrict, std::string>,
- SmartRecordKey<evm_keywords, std::string>,
- SmartRecordKey<evm_iuse, std::string>,
- SmartRecordKey<evm_virtual, std::string>,
- SmartRecordKey<evm_inherited, std::string>
- {
- };
-
- /**
- * Version metadata for an ebuild.
- *
- * \ingroup grpversions
- * \see VersionMetadata
- */
- class EbuildVersionMetadata :
- public MakeSmartRecord<EbuildVersionMetadataTag>::Type
- {
- public:
- /**
- * Constructor.
- */
- EbuildVersionMetadata();
- /**
- * PROVIDE, as a dep atom.
- */
- DepAtom::ConstPointer provide() const;
- };
-
- /**
- * Key for CRANVersionMetadata.
- *
- * \see CRANVersionMetadata
- * \ingroup grpversions
- */
- enum CRANVersionMetadataKey
- {
- cranvm_keywords,
- cranvm_package,
- cranvm_version,
- cranvm_is_bundle,
- last_cranvm
- };
-
- /**
- * Tag for CRANVersionMetadata.
- *
- * \see CRANVersionMetadata
- * \ingroup grpversions
- */
- struct CRANVersionMetadataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<CRANVersionMetadataKey, last_cranvm>,
- SmartRecordKey<cranvm_keywords, std::string>,
- SmartRecordKey<cranvm_package, std::string>,
- SmartRecordKey<cranvm_version, std::string>,
- SmartRecordKey<cranvm_is_bundle, bool>
- {
- };
-
- /**
- * Version metadata for a CRAN package.
- *
- * \ingroup grpversions
- * \see VersionMetadata
- */
- typedef MakeSmartRecord<CRANVersionMetadataTag>::Type CRANVersionMetadata;
-
- /**
- * Key for EbinVersionMetadata.
- *
- * \see EbinVersionMetadata
- * \ingroup grpversions
- */
- enum EbinVersionMetadataKey
- {
- ebvm_bin_uri, ///< BIN_URI
- ebvm_src_repository, ///< SRC_REPOSITORY
- last_ebvm ///< number of items
- };
-
- /**
- * Tag for EbinVersionMetadata.
- *
- * \see EbinVersionMetadata
- * \ingroup grpversions
- */
- struct EbinVersionMetadataTag :
- SmartRecordTag<comparison_mode::NoComparisonTag, void>,
- SmartRecordKeys<EbinVersionMetadataKey, last_ebvm>,
- SmartRecordKey<ebvm_bin_uri, std::string>,
- SmartRecordKey<ebvm_src_repository, RepositoryName>
- {
- };
-
- /**
- * Version metadata for an ebin.
- *
- * \ingroup grpversions
- * \see VersionMetadata
- */
- class EbinVersionMetadata :
- public MakeSmartRecord<EbinVersionMetadataTag>::Type
- {
- public:
- /**
- * Constructor.
- */
- EbinVersionMetadata();
- };
+#include <paludis/version_metadata-sr.hh>
/**
* Version metadata.
@@ -285,7 +51,7 @@ namespace paludis
*/
class VersionMetadata :
private InstantiationPolicy<VersionMetadata, instantiation_method::NonCopyableTag>,
- public MakeSmartRecord<VersionMetadataTag>::Type,
+ public VersionMetadataBase,
public InternalCounted<VersionMetadata>
{
private:
diff --git a/paludis/version_metadata.sr b/paludis/version_metadata.sr
new file mode 100644
index 0000000..7f6f25a
--- /dev/null
+++ b/paludis/version_metadata.sr
@@ -0,0 +1,88 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_VersionMetadataDeps()
+{
+ key parser ParserFunction
+ key build_depend_string std::string
+ key run_depend_string std::string
+ key post_depend_string std::string
+
+ extra_constructors <<END
+ VersionMetadataDeps(const ParserFunction &);
+END
+
+ extra_methods <<END
+ /**
+ * Our build depends.
+ */
+ DepAtom::ConstPointer build_depend() const;
+
+ /**
+ * Our runtime depends.
+ */
+ DepAtom::ConstPointer run_depend() const;
+
+ /**
+ * Our post depends.
+ */
+ DepAtom::ConstPointer post_depend() const;
+END
+}
+
+make_class_VersionMetadataBase()
+{
+ key deps VersionMetadataDeps
+ key slot SlotName
+ key license_string std::string
+ key eapi std::string
+ key homepage std::string
+ key description std::string
+
+ allow_named_args
+}
+
+make_class_EbuildVersionMetadata()
+{
+ key provide_string std::string
+ key src_uri std::string
+ key restrict_string std::string
+ key keywords std::string
+ key iuse std::string
+ key virtual_for std::string
+ key inherited std::string
+
+ extra_constructors <<END
+ EbuildVersionMetadata();
+END
+
+ extra_methods <<END
+ /**
+ * PROVIDE, as a dep atom.
+ */
+ DepAtom::ConstPointer provide() const;
+END
+
+ allow_named_args
+}
+
+make_class_CRANVersionMetadata()
+{
+ key keywords std::string
+ key package std::string
+ key version std::string
+ key is_bundle bool
+
+ allow_named_args
+}
+
+make_class_EbinVersionMetadata()
+{
+ key bin_uri std::string
+ key src_repository RepositoryName
+
+ extra_constructors <<END
+ EbinVersionMetadata();
+END
+}
+
diff --git a/paludis/version_spec.cc b/paludis/version_spec.cc
index d446e41..326e216 100644
--- a/paludis/version_spec.cc
+++ b/paludis/version_spec.cc
@@ -19,7 +19,6 @@
#include <algorithm>
#include <paludis/util/exception.hh>
-#include <paludis/util/smart_record.hh>
#include <paludis/util/stringify.hh>
#include <paludis/version_spec.hh>
#include <vector>
@@ -60,37 +59,9 @@ namespace
scm
};
- /**
- * Keys for a Part.
- *
- * \see Part
- * \ingroup grpversions
- */
- enum PartKeys
- {
- part_kind,
- part_value,
- last_part
- };
+#include <paludis/version_spec-sr.hh>
+#include <paludis/version_spec-sr.cc>
- /**
- * Tag for a Part.
- *
- * \see Part
- * \ingroup grpversions
- */
- struct PartTag :
- SmartRecordTag<comparison_mode::FullComparisonTag, comparison_method::SmartRecordCompareByAllTag>,
- SmartRecordKeys<PartKeys, last_part>,
- SmartRecordKey<part_kind, PartKind>,
- SmartRecordKey<part_value, unsigned long>
- {
- };
-
- /**
- * An entry in a VersionSpec data vector.
- */
- typedef MakeSmartRecord<PartTag>::Type Part;
}
namespace paludis
@@ -156,7 +127,7 @@ VersionSpec::VersionSpec(const std::string & text) :
while (_imp->parts.size() > 1)
{
- if (0 == _imp->parts[_imp->parts.size() - 1].get<part_value>())
+ if (0 == _imp->parts[_imp->parts.size() - 1].value)
_imp->parts.pop_back();
else
break;
@@ -251,8 +222,8 @@ VersionSpec::VersionSpec(const std::string & text) :
{
for (std::vector<Part>::iterator i(_imp->parts.begin()),
i_end(_imp->parts.end()) ; i != i_end ; ++i)
- if (std::numeric_limits<unsigned long>::max() == i->get<part_value>())
- i->set<part_value>(0);
+ if (std::numeric_limits<unsigned long>::max() == i->value)
+ i->value = 0;
}
}
@@ -336,11 +307,11 @@ VersionSpec::tilde_compare(const VersionSpec & other) const
while (true)
{
const Part * p1(v1 == v1_end ? &end_part : &*v1++);
- while (p1 != &end_part && p1->get<part_kind>() == revision)
+ while (p1 != &end_part && p1->kind == revision)
p1 = (v1 == v1_end ? &end_part : &*v1++);
const Part * p2(v2 == v2_end ? &end_part : &*v2++);
- while (p2 != &end_part && p2->get<part_kind>() == revision)
+ while (p2 != &end_part && p2->kind == revision)
p2 = (v2 == v2_end ? &end_part : &*v2++);
if (&end_part == p1 && &end_part == p2)
@@ -365,7 +336,7 @@ VersionSpec::hash_value() const
/// \todo Improve this;
if (_imp->parts.empty())
return 0;
- return _imp->parts[0].get<part_value>();
+ return _imp->parts[0].value;
}
namespace
@@ -379,7 +350,7 @@ namespace
{
bool operator() (const Part & p) const
{
- return p.get<part_kind>() == revision;
+ return p.kind == revision;
}
};
}
@@ -409,7 +380,7 @@ VersionSpec::revision_only() const
std::vector<Part>::const_iterator r(std::find_if(_imp->parts.begin(),
_imp->parts.end(), IsRevisionPart()));
if (r != _imp->parts.end())
- return "r" + stringify(r->get<part_value>());
+ return "r" + stringify(r->value);
else
return "r0";
}
diff --git a/paludis/version_spec.sr b/paludis/version_spec.sr
new file mode 100644
index 0000000..48ccc80
--- /dev/null
+++ b/paludis/version_spec.sr
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_Part()
+{
+ key kind PartKind
+ key value "unsigned long"
+
+ comparison_operators all all
+}
+
+
diff --git a/src/gtkpaludis/browse_tree.cc b/src/gtkpaludis/browse_tree.cc
index b7888e2..29b5603 100644
--- a/src/gtkpaludis/browse_tree.cc
+++ b/src/gtkpaludis/browse_tree.cc
@@ -215,7 +215,7 @@ namespace
pkg != pkg_end ; ++pkg)
{
Gtk::TreeModel::Row pkg_row = *(model->append(us->children()));
- pkg_row[columns.col_item] = stringify(pkg->get<qpn_package>());
+ pkg_row[columns.col_item] = stringify(pkg->package);
pkg_row[columns.col_data] = BrowseTreeDisplayData::Pointer(
new BrowseTreeDisplayPackageData(_r, *pkg));
}
diff --git a/src/gtkpaludis/information_tree.cc b/src/gtkpaludis/information_tree.cc
index c3bade3..5b09636 100644
--- a/src/gtkpaludis/information_tree.cc
+++ b/src/gtkpaludis/information_tree.cc
@@ -150,11 +150,11 @@ InformationTree::show_version(const RepositoryName & r, const QualifiedPackageNa
Gtk::TreeModel::Row description_row(*(_imp->model->append()));
description_row[_imp->columns.col_key] = "description";
- description_row[_imp->columns.col_value] = metadata->get<vm_description>();
+ description_row[_imp->columns.col_value] = metadata->description;
Gtk::TreeModel::Row homepage_row(*(_imp->model->append()));
description_row[_imp->columns.col_key] = "homepage";
- description_row[_imp->columns.col_value] = metadata->get<vm_homepage>();
+ description_row[_imp->columns.col_value] = metadata->homepage;
set_model(_imp->model);
}
diff --git a/src/paludis/applets.cc b/src/paludis/applets.cc
index 4837f44..4b49270 100644
--- a/src/paludis/applets.cc
+++ b/src/paludis/applets.cc
@@ -67,8 +67,8 @@ int do_best_version()
{
// don't include repo, it breaks built_with_use and the like.
std::string entry(
- stringify(entries->last()->get<p::pde_name>()) + "-" +
- stringify(entries->last()->get<p::pde_version>()));
+ stringify(entries->last()->name) + "-" +
+ stringify(entries->last()->version));
std::cout << entry << std::endl;
}
@@ -96,9 +96,9 @@ int do_environment_variable()
throw p::NoSuchPackageError(atom_str);
p::Repository::ConstPointer repo(env->package_database()->fetch_repository(
- entries->begin()->get<p::pde_repository>()));
- p::Repository::EnvironmentVariableInterface * env_if(
- repo->get_interface<p::repo_environment_variable>());
+ entries->begin()->repository));
+ p::RepositoryEnvironmentVariableInterface * env_if(
+ repo->environment_variable_interface);
if (! env_if)
{
diff --git a/src/paludis/contents.cc b/src/paludis/contents.cc
index f2d59f4..4aa9414 100644
--- a/src/paludis/contents.cc
+++ b/src/paludis/contents.cc
@@ -62,13 +62,13 @@ do_one_contents_entry(
{
cout << "* " << colour(cl_package_name, e) << endl;
- const p::Repository::InstalledInterface * const installed_interface(
- env->package_database()->fetch_repository(e.get<p::pde_repository>())->
- get_interface<p::repo_installed>());
+ const p::RepositoryInstalledInterface * const installed_interface(
+ env->package_database()->fetch_repository(e.repository)->
+ installed_interface);
if (installed_interface)
{
p::Contents::ConstPointer contents(installed_interface->contents(
- e.get<p::pde_name>(), e.get<p::pde_version>()));
+ e.name, e.version));
ContentsDisplayer d;
std::for_each(contents->begin(), contents->end(), accept_visitor(&d));
}
diff --git a/src/paludis/install.cc b/src/paludis/install.cc
index 6c19b37..d4632de 100644
--- a/src/paludis/install.cc
+++ b/src/paludis/install.cc
@@ -97,8 +97,8 @@ namespace
virtual void on_build_cleanlist_pre(const DepListEntry & d)
{
cout << endl << colour(cl_heading, "Cleaning stale versions after installing " +
- stringify(d.get<dle_name>()) + "-" + stringify(d.get<dle_version>()) +
- "::" + stringify(d.get<dle_repository>())) << endl << endl;
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
}
virtual void on_build_cleanlist_post(const DepListEntry &)
@@ -154,13 +154,13 @@ namespace
virtual void on_fetch_pre(const DepListEntry & d)
{
cout << colour(cl_heading, "Fetching " +
- stringify(d.get<dle_name>()) + "-" + stringify(d.get<dle_version>()) +
- "::" + stringify(d.get<dle_repository>())) << endl << endl;
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
cerr << xterm_title("(" + stringify(++_current_count) + " of " +
stringify(_max_count) + ") Fetching " +
- stringify(d.get<dle_name>()) + "-" + stringify(d.get<dle_version>()) +
- "::" + stringify(d.get<dle_repository>()));
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
}
virtual void on_fetch_post(const DepListEntry &)
@@ -178,13 +178,13 @@ namespace
virtual void on_install_pre(const DepListEntry & d)
{
cout << endl << colour(cl_heading, "Installing " +
- stringify(d.get<dle_name>()) + "-" + stringify(d.get<dle_version>()) +
- "::" + stringify(d.get<dle_repository>())) << endl << endl;
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
cerr << xterm_title("(" + stringify(++_current_count) + " of " +
stringify(_max_count) + ") Installing " +
- stringify(d.get<dle_name>()) + "-" + stringify(d.get<dle_version>()) +
- "::" + stringify(d.get<dle_repository>()));
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
}
virtual void on_install_post(const DepListEntry &)
@@ -317,27 +317,27 @@ namespace
{
Context context("When displaying entry '" + stringify(d) + "':");
- cout << "* " << colour(cl_package_name, d.get<dle_name>());
+ cout << "* " << colour(cl_package_name, d.name);
/* display version, unless it's 0 and our category is "virtual" */
- if ((VersionSpec("0") != d.get<dle_version>()) ||
- CategoryNamePart("virtual") != d.get<dle_name>().get<qpn_category>())
- cout << "-" << d.get<dle_version>();
+ if ((VersionSpec("0") != d.version) ||
+ CategoryNamePart("virtual") != d.name.category)
+ cout << "-" << d.version;
/* display repository, unless it's our main repository */
- if (DefaultEnvironment::get_instance()->package_database()->favourite_repository() != d.get<dle_repository>())
- cout << "::" << d.get<dle_repository>();
+ if (DefaultEnvironment::get_instance()->package_database()->favourite_repository() != d.repository)
+ cout << "::" << d.repository;
/* display slot name, unless it's 0 */
- if (SlotName("0") != d.get<dle_metadata>()->get<vm_slot>())
+ if (SlotName("0") != d.metadata->slot)
cout << colour(cl_slot, " {:" + stringify(
- d.get<dle_metadata>()->get<vm_slot>()) + "}");
+ d.metadata->slot) + "}");
/* indicate [U], [S] or [N]. display existing version, if we're
* already installed */
PackageDatabaseEntryCollection::Pointer existing(DefaultEnvironment::get_instance()->package_database()->
query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
- d.get<dle_name>()))), is_installed_only));
+ d.name))), is_installed_only));
if (existing->empty())
{
@@ -348,8 +348,8 @@ namespace
else
{
existing = DefaultEnvironment::get_instance()->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(stringify(d.get<dle_name>()) + ":" +
- stringify(d.get<dle_metadata>()->get<vm_slot>()))),
+ new PackageDepAtom(stringify(d.name) + ":" +
+ stringify(d.metadata->slot))),
is_installed_only);
if (existing->empty())
{
@@ -357,17 +357,17 @@ namespace
++_new_slot_count;
++_max_count;
}
- else if (existing->last()->get<pde_version>() < d.get<dle_version>())
+ else if (existing->last()->version < d.version)
{
cout << colour(cl_updatemode, " [U " + stringify(
- existing->last()->get<pde_version>()) + "]");
+ existing->last()->version) + "]");
++_upgrade_count;
++_max_count;
}
- else if (existing->last()->get<pde_version>() > d.get<dle_version>())
+ else if (existing->last()->version > d.version)
{
cout << colour(cl_updatemode, " [D " + stringify(
- existing->last()->get<pde_version>()) + "]");
+ existing->last()->version) + "]");
++_downgrade_count;
++_max_count;
}
@@ -380,18 +380,18 @@ namespace
}
/* fetch db entry */
- PackageDatabaseEntry p(PackageDatabaseEntry(d.get<dle_name>(),
- d.get<dle_version>(), d.get<dle_repository>()));
+ PackageDatabaseEntry p(PackageDatabaseEntry(d.name,
+ d.version, d.repository));
/* display USE flags */
- if (d.get<dle_metadata>()->get_ebuild_interface())
+ if (d.metadata->get_ebuild_interface())
{
- const Repository::UseInterface * const use_interface(
- DefaultEnvironment::get_instance()->package_database()->fetch_repository(d.get<dle_repository>())->
- get_interface<repo_use>());
+ const RepositoryUseInterface * const use_interface(
+ DefaultEnvironment::get_instance()->package_database()->
+ fetch_repository(d.repository)->use_interface);
std::set<UseFlagName> iuse;
WhitespaceTokeniser::get_instance()->tokenise(
- d.get<dle_metadata>()->get_ebuild_interface()->get<evm_iuse>(),
+ d.metadata->get_ebuild_interface()->iuse,
create_inserter<UseFlagName>(std::inserter(iuse, iuse.end())));
@@ -454,12 +454,12 @@ namespace
}
/* display tag, add tag to our post display list */
- if (! d.get<dle_tag>()->empty())
+ if (! d.tag->empty())
{
std::string tag_titles;
for (SortedCollection<DepTag::ConstPointer, DepTag::Comparator>::Iterator
- tag(d.get<dle_tag>()->begin()),
- tag_end(d.get<dle_tag>()->end()) ;
+ tag(d.tag->begin()),
+ tag_end(d.tag->end()) ;
tag != tag_end ; ++tag)
{
_all_tags.insert(*tag);
@@ -581,8 +581,8 @@ do_install()
{
std::string eapi_str(DefaultEnvironment::get_instance()->
package_database()->fetch_repository(
- pp->get<pde_repository>())->version_metadata(
- pp->get<pde_name>(), pp->get<pde_version>())->get<vm_eapi>());
+ pp->repository)->version_metadata(
+ pp->name, pp->version)->eapi);
cerr << " ( " << colour(cl_masked, eapi_str) << " )";
}
@@ -592,21 +592,21 @@ do_install()
LicenceDisplayer ld(cerr, DefaultEnvironment::get_instance(), &*pp);
DefaultEnvironment::get_instance()->package_database()->fetch_repository(
- pp->get<pde_repository>())->version_metadata(
- pp->get<pde_name>(), pp->get<pde_version>())->license()->
+ pp->repository)->version_metadata(
+ pp->name, pp->version)->license()->
accept(&ld);
}
else if (mr_keyword == mm)
{
VersionMetadata::ConstPointer m(DefaultEnvironment::get_instance()->
package_database()->fetch_repository(
- pp->get<pde_repository>())->version_metadata(
- pp->get<pde_name>(), pp->get<pde_version>()));
+ pp->repository)->version_metadata(
+ pp->name, pp->version));
if (m->get_ebuild_interface())
{
std::set<KeywordName> keywords;
WhitespaceTokeniser::get_instance()->tokenise(
- m->get_ebuild_interface()->get<evm_keywords>(),
+ m->get_ebuild_interface()->keywords,
create_inserter<KeywordName>(
std::inserter(keywords, keywords.end())));
diff --git a/src/paludis/list.cc b/src/paludis/list.cc
index 9ddee7f..183b2a4 100644
--- a/src/paludis/list.cc
+++ b/src/paludis/list.cc
@@ -162,7 +162,7 @@ do_list_packages()
if (CommandLine::get_instance()->a_package.args_end() == std::find(
CommandLine::get_instance()->a_package.args_begin(),
CommandLine::get_instance()->a_package.args_end(),
- stringify(p->first.get<p::qpn_package>())))
+ stringify(p->first.package)))
continue;
ret_code = 0;
@@ -247,7 +247,7 @@ namespace
{
p::QualifiedPackageName q(a->package());
- std::string c(p::stringify(q.get<p::qpn_category>()));
+ std::string c(p::stringify(q.category));
if (CommandLine::get_instance()->a_category.specified())
if (CommandLine::get_instance()->a_category.args_end() == std::find(
CommandLine::get_instance()->a_category.args_begin(),
@@ -255,7 +255,7 @@ namespace
c))
return;
- std::string p(p::stringify(q.get<p::qpn_package>()));
+ std::string p(p::stringify(q.package));
if (CommandLine::get_instance()->a_package.specified())
if (CommandLine::get_instance()->a_package.args_end() == std::find(
CommandLine::get_instance()->a_package.args_begin(),
@@ -305,10 +305,10 @@ do_list_vulnerabilities()
stringify(r->name())))
continue;
- if (! r->get_interface<p::repo_sets>())
+ if (! r->sets_interface)
continue;
- p::DepAtom::Pointer dep = r->get_interface<p::repo_sets>()->package_set("security", opts);
+ p::DepAtom::Pointer dep = r->sets_interface->package_set("security", opts);
if (0 != dep)
vulnerabilities->add_child(dep);
}
diff --git a/src/paludis/news.cc b/src/paludis/news.cc
index c377803..eb51fe6 100644
--- a/src/paludis/news.cc
+++ b/src/paludis/news.cc
@@ -41,8 +41,8 @@ do_update_news()
for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
- if ((*r)->get_interface<p::repo_news>())
- (*r)->get_interface<p::repo_news>()->update_news();
+ if ((*r)->news_interface)
+ (*r)->news_interface->update_news();
return return_code;
}
diff --git a/src/paludis/owner.cc b/src/paludis/owner.cc
index b83393b..581c8f6 100644
--- a/src/paludis/owner.cc
+++ b/src/paludis/owner.cc
@@ -83,7 +83,7 @@ do_one_owner(
for (p::PackageDatabase::RepositoryIterator r(env->package_database()->begin_repositories()),
r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (*r)->get_interface<p::repo_installed>())
+ if (! (*r)->installed_interface)
continue;
p::CategoryNamePartCollection::ConstPointer cats((*r)->category_names());
@@ -99,7 +99,7 @@ do_one_owner(
v_end(vers->end()) ; v != v_end ; ++v)
{
p::PackageDatabaseEntry e(*p, *v, (*r)->name());
- p::Contents::ConstPointer contents((*r)->get_interface<p::repo_installed>()->
+ p::Contents::ConstPointer contents((*r)->installed_interface->
contents(*p, *v));
ContentsFinder d(query, CommandLine::get_instance()->a_full_match.specified());
std::for_each(contents->begin(), contents->end(), accept_visitor(&d));
diff --git a/src/paludis/query.cc b/src/paludis/query.cc
index b6a4a4d..1c38eae 100644
--- a/src/paludis/query.cc
+++ b/src/paludis/query.cc
@@ -81,7 +81,7 @@ void do_one_query(
const p::PackageDatabaseEntry display_entry(*preferred_entries->last());
/* match! display it. */
- cout << "* " << colour(cl_package_name, entries->begin()->get<p::pde_name>());
+ cout << "* " << colour(cl_package_name, entries->begin()->name);
if (atom->version_spec_ptr())
cout << " (" << atom->version_operator() << *atom->version_spec_ptr() << ")";
if (atom->slot_ptr())
@@ -94,7 +94,7 @@ void do_one_query(
p::RepositoryNameCollection::Concrete repo_names;
p::PackageDatabaseEntryCollection::Iterator e(entries->begin()), e_end(entries->end());
for ( ; e != e_end ; ++e)
- repo_names.append(e->get<p::pde_repository>());
+ repo_names.append(e->repository);
/* display versions, by repository. */
p::RepositoryNameCollection::Iterator r(repo_names.begin()), r_end(repo_names.end());
@@ -105,15 +105,15 @@ void do_one_query(
std::string old_slot;
for (e = entries->begin() ; e != e_end ; ++e)
- if (e->get<p::pde_repository>() == *r)
+ if (e->repository == *r)
{
p::VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
- e->get<p::pde_repository>())->version_metadata(e->get<p::pde_name>(),
- e->get<p::pde_version>()));
+ e->repository)->version_metadata(e->name,
+ e->version));
if (CommandLine::get_instance()->a_show_slot.specified())
{
/* show the slot, if we're about to move onto a new slot */
- std::string slot_name(stringify(metadata->get<p::vm_slot>()));
+ std::string slot_name(stringify(metadata->slot));
if (old_slot.empty())
old_slot = slot_name;
else if (old_slot != slot_name)
@@ -124,7 +124,7 @@ void do_one_query(
const p::MaskReasons masks(env->mask_reasons(*e));
if (masks.none())
- cout << colour(cl_visible, e->get<p::pde_version>());
+ cout << colour(cl_visible, e->version);
else
{
std::string reasons;
@@ -159,7 +159,7 @@ void do_one_query(
}
}
mask_reasons_to_explain |= masks;
- cout << colour(cl_masked, "(" + stringify(e->get<p::pde_version>()) + ")" + reasons);
+ cout << colour(cl_masked, "(" + stringify(e->version) + ")" + reasons);
}
if (*e == display_entry)
@@ -176,72 +176,72 @@ void do_one_query(
/* display metadata */
p::VersionMetadata::ConstPointer metadata(env->package_database()->fetch_repository(
- display_entry.get<p::pde_repository>())->version_metadata(
- display_entry.get<p::pde_name>(), display_entry.get<p::pde_version>()));
+ display_entry.repository)->version_metadata(
+ display_entry.name, display_entry.version));
if (CommandLine::get_instance()->a_show_metadata.specified())
{
cout << " " << std::setw(22) << std::left << "DESCRIPTION:" << std::setw(0) <<
- " " << metadata->get<p::vm_description>() << endl;
+ " " << metadata->description << endl;
cout << " " << std::setw(22) << std::left << "HOMEPAGE:" << std::setw(0) <<
- " " << metadata->get<p::vm_homepage>() << endl;
+ " " << metadata->homepage << endl;
cout << " " << std::setw(22) << std::left << "LICENSE:" << std::setw(0) <<
- " " << metadata->get<p::vm_license>() << endl;
+ " " << metadata->license_string << endl;
cout << " " << std::setw(22) << std::left << "DEPEND:" << std::setw(0) <<
- " " << metadata->get<p::vm_deps>().get<p::vmd_build_depend_string>() << endl;
+ " " << metadata->deps.build_depend_string << endl;
cout << " " << std::setw(22) << std::left << "RDEPEND:" << std::setw(0) <<
- " " << metadata->get<p::vm_deps>().get<p::vmd_run_depend_string>() << endl;
+ " " << metadata->deps.run_depend_string << endl;
cout << " " << std::setw(22) << std::left << "PDEPEND:" << std::setw(0) <<
- " " << metadata->get<p::vm_deps>().get<p::vmd_post_depend_string>() << endl;
+ " " << metadata->deps.post_depend_string << endl;
if (metadata->get_cran_interface())
{
cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
- " " << metadata->get_cran_interface()->get<p::cranvm_keywords>() << endl;
+ " " << metadata->get_cran_interface()->keywords << endl;
cout << " " << std::setw(22) << std::left << "PACKAGE:" << std::setw(0) <<
- " " << metadata->get_cran_interface()->get<p::cranvm_package>() << endl;
+ " " << metadata->get_cran_interface()->package << endl;
cout << " " << std::setw(22) << std::left << "VERSION:" << std::setw(0) <<
- " " << metadata->get_cran_interface()->get<p::cranvm_version>() << endl;
+ " " << metadata->get_cran_interface()->version << endl;
cout << " " << std::setw(22) << std::left << "IS_BUNDLE:" << std::setw(0) <<
- " " << std::boolalpha << metadata->get_cran_interface()->get<p::cranvm_is_bundle>() << endl;
+ " " << std::boolalpha << metadata->get_cran_interface()->is_bundle << endl;
}
if (metadata->get_ebuild_interface())
{
cout << " " << std::setw(22) << std::left << "IUSE:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_iuse>() << endl;
+ " " << metadata->get_ebuild_interface()->iuse << endl;
cout << " " << std::setw(22) << std::left << "KEYWORDS:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_keywords>() << endl;
+ " " << metadata->get_ebuild_interface()->keywords << endl;
cout << " " << std::setw(22) << std::left << "PROVIDE:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_provide>() << endl;
+ " " << metadata->get_ebuild_interface()->provide_string << endl;
cout << " " << std::setw(22) << std::left << "RESTRICT:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_restrict>() << endl;
+ " " << metadata->get_ebuild_interface()->restrict_string << endl;
cout << " " << std::setw(22) << std::left << "SRC_URI:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_src_uri>() << endl;
+ " " << metadata->get_ebuild_interface()->src_uri << endl;
cout << " " << std::setw(22) << std::left << "VIRTUAL:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_virtual>() << endl;
+ " " << metadata->get_ebuild_interface()->virtual_for << endl;
}
if (metadata->get_ebin_interface())
{
cout << " " << std::setw(22) << std::left << "BIN_URI:" << std::setw(0) <<
- " " << metadata->get_ebin_interface()->get<p::ebvm_bin_uri>() << endl;
+ " " << metadata->get_ebin_interface()->bin_uri << endl;
cout << " " << std::setw(22) << std::left << "SRC_REPOSITORY:" << std::setw(0) <<
- " " << metadata->get_ebin_interface()->get<p::ebvm_src_repository>() << endl;
+ " " << metadata->get_ebin_interface()->src_repository << endl;
}
}
else
{
- if (! metadata->get<p::vm_homepage>().empty())
+ if (! metadata->homepage.empty())
cout << " " << std::setw(22) << std::left << "Homepage:" << std::setw(0) <<
- " " << metadata->get<p::vm_homepage>() << endl;
+ " " << metadata->homepage << endl;
- if (! metadata->get<p::vm_description>().empty())
+ if (! metadata->description.empty())
cout << " " << std::setw(22) << std::left << "Description:" << std::setw(0) <<
- " " << metadata->get<p::vm_description>() << endl;
+ " " << metadata->description << endl;
- if (! metadata->get<p::vm_license>().empty())
+ if (! metadata->license_string.empty())
{
cout << " " << std::setw(22) << std::left << "License:" << std::setw(0) << " ";
LicenceDisplayer d(cout, env, &display_entry);
@@ -251,40 +251,40 @@ void do_one_query(
if (CommandLine::get_instance()->a_show_deps.specified())
{
- if (! metadata->get<p::vm_deps>().get<p::vmd_build_depend_string>().empty())
+ if (! metadata->deps.build_depend_string.empty())
{
p::DepAtomPrettyPrinter p_depend(12);
- metadata->get<p::vm_deps>().build_depend()->accept(&p_depend);
+ metadata->deps.build_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Build dependencies:" << std::setw(0)
<< endl << p_depend;
}
- if (! metadata->get<p::vm_deps>().get<p::vmd_run_depend_string>().empty())
+ if (! metadata->deps.run_depend_string.empty())
{
p::DepAtomPrettyPrinter p_depend(12);
- metadata->get<p::vm_deps>().run_depend()->accept(&p_depend);
+ metadata->deps.run_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Runtime dependencies:" << std::setw(0)
<< endl << p_depend;
}
- if (! metadata->get<p::vm_deps>().get<p::vmd_post_depend_string>().empty())
+ if (! metadata->deps.post_depend_string.empty())
{
p::DepAtomPrettyPrinter p_depend(12);
- metadata->get<p::vm_deps>().post_depend()->accept(&p_depend);
+ metadata->deps.post_depend()->accept(&p_depend);
cout << " " << std::setw(22) << std::left << "Post dependencies:" << std::setw(0)
<< endl << p_depend;
}
}
if (metadata->get_ebuild_interface() && ! metadata->get_ebuild_interface()->
- get<p::evm_virtual>().empty())
+ virtual_for.empty())
cout << " " << std::setw(22) << std::left << "Virtual for:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_virtual>() << endl;
+ " " << metadata->get_ebuild_interface()->virtual_for << endl;
if (metadata->get_ebuild_interface() && ! metadata->get_ebuild_interface()->
- get<p::evm_provide>().empty())
+ provide_string.empty())
cout << " " << std::setw(22) << std::left << "Provides:" << std::setw(0) <<
- " " << metadata->get_ebuild_interface()->get<p::evm_provide>() << endl;
+ " " << metadata->get_ebuild_interface()->provide_string << endl;
}
diff --git a/src/paludis/uninstall.cc b/src/paludis/uninstall.cc
index e90af2e..a7ba5b5 100644
--- a/src/paludis/uninstall.cc
+++ b/src/paludis/uninstall.cc
@@ -86,13 +86,13 @@ namespace
virtual void on_uninstall_pre(const PackageDatabaseEntry & d)
{
cout << endl << colour(cl_heading, "Uninstalling " +
- stringify(d.get<pde_name>()) + "-" + stringify(d.get<pde_version>()) +
- "::" + stringify(d.get<pde_repository>())) << endl << endl;
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository)) << endl << endl;
cerr << xterm_title("(" + stringify(++_current_count) + " of " +
stringify(_count) + ") Uninstalling " +
- stringify(d.get<pde_name>()) + "-" + stringify(d.get<pde_version>()) +
- "::" + stringify(d.get<pde_repository>()));
+ stringify(d.name) + "-" + stringify(d.version) +
+ "::" + stringify(d.repository));
}
virtual void on_uninstall_post(const PackageDatabaseEntry &)
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 756da49..a5c5efb 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -83,13 +83,13 @@ namespace
for (qa::CheckResult::Iterator i(r.begin()), i_end(r.end()) ; i != i_end ; ++i)
{
- if (i->get<qa::mk_level>() < QualudisCommandLine::get_instance()->message_level)
+ if (i->level < QualudisCommandLine::get_instance()->message_level)
continue;
bool show(true);
do
{
- switch (i->get<qa::mk_level>())
+ switch (i->level)
{
case qa::qal_info:
display_header_once(&done_out, r);
@@ -132,7 +132,7 @@ namespace
while (false);
if (show)
- cout << i->get<qa::mk_msg>() << endl;
+ cout << i->msg << endl;
}
}