aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-07 23:59:21 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-12-07 23:59:21 +0000
commit25dad978006d69b4c42c7ae1188533438c28ce71 (patch)
tree8f62fbbb6d7e2b7836d7f3ee277a4c5c4f9a97a5
parentb3183c71e4bdd6a85978f4e887092090489dc009 (diff)
downloadpaludis-25dad978006d69b4c42c7ae1188533438c28ce71.tar.gz
paludis-25dad978006d69b4c42c7ae1188533438c28ce71.tar.xz
more dead sr
-rw-r--r--src/clients/adjutrix/Makefile.am28
-rw-r--r--src/clients/adjutrix/downgrade_check.cc38
-rw-r--r--src/clients/adjutrix/downgrade_check.sr11
-rw-r--r--src/clients/adjutrix/find_dropped_keywords.cc40
-rw-r--r--src/clients/adjutrix/find_dropped_keywords.sr13
-rw-r--r--src/clients/adjutrix/find_stable_candidates.cc41
-rw-r--r--src/clients/adjutrix/find_stable_candidates.sr12
7 files changed, 74 insertions, 109 deletions
diff --git a/src/clients/adjutrix/Makefile.am b/src/clients/adjutrix/Makefile.am
index 7e5d51d..7d93425 100644
--- a/src/clients/adjutrix/Makefile.am
+++ b/src/clients/adjutrix/Makefile.am
@@ -76,37 +76,11 @@ TESTS = version_TEST help_TEST find_stable_candidates_TEST args_from_environment
EXTRA_DIST = \
$(man_MANS) \
$(TESTS) \
- find_stable_candidates-sr.hh find_stable_candidates-sr.cc find_stable_candidates.sr \
- find_dropped_keywords-sr.hh find_dropped_keywords-sr.cc find_dropped_keywords.sr \
- downgrade_check-sr.hh downgrade_check-sr.cc downgrade_check.sr \
find_stable_candidates_TEST_setup.sh find_stable_candidates_TEST_cleanup.sh
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail
-DISTCLEANFILES = $(man_MANS) $(noinst_DATA) \
- find_stable_candidates-sr.hh find_stable_candidates-sr.cc
+DISTCLEANFILES = $(man_MANS) $(noinst_DATA)
MAINTAINERCLEANFILES = Makefile.in
-BUILT_SOURCES = \
- find_stable_candidates-sr.hh find_stable_candidates-sr.cc \
- find_dropped_keywords-sr.hh find_dropped_keywords-sr.cc \
- downgrade_check-sr.hh downgrade_check-sr.cc
-
-find_stable_candidates-sr.hh : find_stable_candidates.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/find_stable_candidates.sr > $@
-
-find_stable_candidates-sr.cc : find_stable_candidates.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/find_stable_candidates.sr > $@
-
-find_dropped_keywords-sr.hh : find_dropped_keywords.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/find_dropped_keywords.sr > $@
-
-find_dropped_keywords-sr.cc : find_dropped_keywords.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/find_dropped_keywords.sr > $@
-
-downgrade_check-sr.hh : downgrade_check.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --header $(srcdir)/downgrade_check.sr > $@
-
-downgrade_check-sr.cc : downgrade_check.sr $(top_srcdir)/misc/make_sr.bash
- $(top_srcdir)/misc/make_sr.bash --source $(srcdir)/downgrade_check.sr > $@
built-sources : $(BUILT_SOURCES)
for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc
index fcdaf9d..a8219e0 100644
--- a/src/clients/adjutrix/downgrade_check.cc
+++ b/src/clients/adjutrix/downgrade_check.cc
@@ -20,12 +20,13 @@
#include "downgrade_check.hh"
#include "command_line.hh"
#include <paludis/package_database.hh>
-#include <paludis/util/sr.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/make_shared_ptr.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/package_id.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/generator.hh>
@@ -39,13 +40,6 @@
using namespace paludis;
-namespace paludis
-{
-#include <src/clients/adjutrix/downgrade_check-sr.hh>
-}
-
-#include <src/clients/adjutrix/downgrade_check-sr.cc>
-
namespace
{
int
@@ -107,7 +101,7 @@ namespace
}
void
- load_list(std::map<QPNS, VersionSpec> & map, std::istream & f)
+ load_list(std::map<std::pair<QualifiedPackageName, SlotName>, VersionSpec> & map, std::istream & f)
{
std::string s;
while (std::getline(f, s))
@@ -117,32 +111,34 @@ namespace
if (tokens.size() != 3)
throw ConfigurationError("Bad line '" + s + "'");
- map.insert(std::make_pair(QPNS(QualifiedPackageName(tokens.at(0)),
+ map.insert(std::make_pair(make_pair(QualifiedPackageName(tokens.at(0)),
SlotName(tokens.at(1))), VersionSpec(tokens.at(2))));
}
}
int
check_one_list(NoConfigEnvironment & env, std::istream & f1,
- std::istream & f2, std::multimap<QPNS, std::string> & results,
+ std::istream & f2, std::multimap<std::pair<QualifiedPackageName, SlotName>, std::string> & results,
const std::string & desc)
{
int exit_status(0);
- std::map<QPNS, VersionSpec> before, after;
+ std::map<std::pair<QualifiedPackageName, SlotName>, VersionSpec> before, after;
load_list(before, f1);
load_list(after, f2);
- for (std::map<QPNS, VersionSpec>::const_iterator b(before.begin()), b_end(before.end()) ;
+ for (std::map<std::pair<QualifiedPackageName, SlotName>, VersionSpec>::const_iterator
+ b(before.begin()), b_end(before.end()) ;
b != b_end ; ++b)
{
- std::map<QPNS, VersionSpec>::const_iterator a(after.find(b->first));
+ std::map<std::pair<QualifiedPackageName, SlotName>, VersionSpec>::const_iterator
+ a(after.find(b->first));
if (after.end() == a)
{
if (! env[selection::SomeArbitraryVersion(generator::Matches(make_package_dep_spec()
- .package(b->first.name)
- .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(b->first.slot))),
+ .package(b->first.first)
+ .slot_requirement(make_shared_ptr(new UserSlotExactRequirement(b->first.second))),
MatchPackageOptions()))]->empty())
{
results.insert(std::make_pair(b->first, stringify(b->second) + " -> nothing on " + desc));
@@ -201,7 +197,7 @@ do_downgrade_check(NoConfigEnvironment & env)
if (! after_dir.is_directory())
throw ConfigurationError("Second input directory is not a directory");
- std::multimap<QPNS, std::string> results;
+ std::multimap<std::pair<QualifiedPackageName, SlotName>, std::string> results;
for (RepositoryEInterface::ProfilesConstIterator
p((*env.main_repository()).e_interface()->begin_profiles()),
@@ -227,13 +223,15 @@ do_downgrade_check(NoConfigEnvironment & env)
}
}
- QPNS old_qpns(QualifiedPackageName("dummy/dummmy"), SlotName("dummy"));
- for (std::multimap<QPNS, std::string>::const_iterator r(results.begin()), r_end(results.end()) ;
+ std::pair<QualifiedPackageName, SlotName> old_qpns(QualifiedPackageName("dummy/dummmy"),
+ SlotName("dummy"));
+ for (std::multimap<std::pair<QualifiedPackageName, SlotName>, std::string>::const_iterator
+ r(results.begin()), r_end(results.end()) ;
r != r_end ; ++r)
{
if (old_qpns != r->first)
{
- std::cout << r->first.name << " :" << r->first.slot << std::endl;
+ std::cout << r->first.first << " :" << r->first.second << std::endl;
old_qpns = r->first;
}
diff --git a/src/clients/adjutrix/downgrade_check.sr b/src/clients/adjutrix/downgrade_check.sr
deleted file mode 100644
index b50a029..0000000
--- a/src/clients/adjutrix/downgrade_check.sr
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_QPNS()
-{
- key name QualifiedPackageName;
- key slot SlotName;
-
- comparison_operators all all
-}
-
diff --git a/src/clients/adjutrix/find_dropped_keywords.cc b/src/clients/adjutrix/find_dropped_keywords.cc
index e8287ee..02414ed 100644
--- a/src/clients/adjutrix/find_dropped_keywords.cc
+++ b/src/clients/adjutrix/find_dropped_keywords.cc
@@ -25,6 +25,8 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
+#include <paludis/util/named_value.hh>
+#include <paludis/util/make_named_values.hh>
#include <paludis/version_spec.hh>
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
@@ -42,11 +44,22 @@ using std::cout;
using std::cerr;
using std::endl;
-namespace
+namespace paludis
{
+ namespace n
+ {
+ struct best_anywhere;
+ struct best_keyworded;
+ }
+}
-#include "find_dropped_keywords-sr.hh"
-#include "find_dropped_keywords-sr.cc"
+namespace
+{
+ struct VersionsEntry
+ {
+ NamedValue<n::best_anywhere, VersionSpec> best_anywhere;
+ NamedValue<n::best_keyworded, VersionSpec> best_keyworded;
+ };
static const int col_width_package = 30;
static const int col_width_best_keyworded = 20;
@@ -129,23 +142,24 @@ namespace
/* ensure that there's an entry for this SLOT */
versions_in_slots.insert(std::make_pair((*v)->slot(), VersionsEntry(
- VersionsEntry::create()
- .best_keyworded(VersionSpec("0"))
- .best_anywhere(VersionSpec("0")))));
+ make_named_values<VersionsEntry>(
+ value_for<n::best_anywhere>(VersionSpec("0")),
+ value_for<n::best_keyworded>(VersionSpec("0"))
+ ))));
if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword) ||
(*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(KeywordName("~" + stringify(keyword))))
{
is_interesting = true;
- versions_in_slots.find((*v)->slot())->second.best_keyworded =
- std::max(versions_in_slots.find((*v)->slot())->second.best_keyworded, (*v)->version());
+ versions_in_slots.find((*v)->slot())->second.best_keyworded() =
+ std::max(versions_in_slots.find((*v)->slot())->second.best_keyworded(), (*v)->version());
worst_keyworded = std::min(worst_keyworded, (*v)->version());
}
if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(),
(*v)->keywords_key()->value()->end(), IsStableOrUnstableKeyword()))
- versions_in_slots.find((*v)->slot())->second.best_anywhere =
- std::max(versions_in_slots.find((*v)->slot())->second.best_anywhere, (*v)->version());
+ versions_in_slots.find((*v)->slot())->second.best_anywhere() =
+ std::max(versions_in_slots.find((*v)->slot())->second.best_anywhere(), (*v)->version());
}
if (! is_interesting)
@@ -155,13 +169,13 @@ namespace
for (VersionsInSlots::const_iterator s(versions_in_slots.begin()),
s_end(versions_in_slots.end()) ; s != s_end ; ++s)
{
- if (s->second.best_keyworded >= s->second.best_anywhere)
+ if (s->second.best_keyworded() >= s->second.best_anywhere())
continue;
- if (s->second.best_anywhere < worst_keyworded)
+ if (s->second.best_anywhere() < worst_keyworded)
continue;
- write_package(package, s->first, s->second.best_keyworded, s->second.best_anywhere);
+ write_package(package, s->first, s->second.best_keyworded(), s->second.best_anywhere());
}
}
}
diff --git a/src/clients/adjutrix/find_dropped_keywords.sr b/src/clients/adjutrix/find_dropped_keywords.sr
deleted file mode 100644
index 4ad2707..0000000
--- a/src/clients/adjutrix/find_dropped_keywords.sr
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_VersionsEntry()
-{
- key best_keyworded VersionSpec
- key best_anywhere VersionSpec
-
- allow_named_args
-}
-
-
-
diff --git a/src/clients/adjutrix/find_stable_candidates.cc b/src/clients/adjutrix/find_stable_candidates.cc
index 06a9f68..f18d80e 100644
--- a/src/clients/adjutrix/find_stable_candidates.cc
+++ b/src/clients/adjutrix/find_stable_candidates.cc
@@ -25,6 +25,8 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/util/make_named_values.hh>
+#include <paludis/util/named_value.hh>
#include <paludis/version_spec.hh>
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
@@ -42,11 +44,22 @@ using std::cout;
using std::cerr;
using std::endl;
-namespace
+namespace paludis
{
+ namespace n
+ {
+ struct best_version;
+ struct our_version;
+ }
+}
-#include "find_stable_candidates-sr.hh"
-#include "find_stable_candidates-sr.cc"
+namespace
+{
+ struct SlotsEntry
+ {
+ NamedValue<n::best_version, VersionSpec> best_version;
+ NamedValue<n::our_version, VersionSpec> our_version;
+ };
static const int col_width_package = 30;
static const int col_width_our_version = 20;
@@ -133,9 +146,10 @@ namespace
/* replace the entry */
slots_to_versions.erase((*v)->slot());
slots_to_versions.insert(std::make_pair((*v)->slot(),
- SlotsEntry(SlotsEntry::create()
- .our_version((*v)->version())
- .best_version(VersionSpec("0")))));
+ make_named_values<SlotsEntry>(
+ value_for<n::best_version>(VersionSpec("0")),
+ value_for<n::our_version>((*v)->version())
+ )));
}
if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(),
@@ -143,14 +157,15 @@ namespace
{
/* ensure that an entry exists */
slots_to_versions.insert(std::make_pair((*v)->slot(),
- SlotsEntry(SlotsEntry::create()
- .our_version(VersionSpec("0"))
- .best_version((*v)->version()))));
+ make_named_values<SlotsEntry>(
+ value_for<n::best_version>((*v)->version()),
+ value_for<n::our_version>(VersionSpec("0"))
+ )));
/* update the entry to mark our current version as the best
* version */
- if (slots_to_versions.find((*v)->slot())->second.best_version <= (*v)->version())
- slots_to_versions.find((*v)->slot())->second.best_version = (*v)->version();
+ if (slots_to_versions.find((*v)->slot())->second.best_version() <= (*v)->version())
+ slots_to_versions.find((*v)->slot())->second.best_version() = (*v)->version();
}
}
@@ -161,10 +176,10 @@ namespace
for (SlotsToVersions::const_iterator s(slots_to_versions.begin()),
s_end(slots_to_versions.end()) ; s != s_end ; ++s)
{
- if (s->second.our_version >= s->second.best_version)
+ if (s->second.our_version() >= s->second.best_version())
continue;
- write_package(package, s->first, s->second.our_version, s->second.best_version);
+ write_package(package, s->first, s->second.our_version(), s->second.best_version());
}
}
}
diff --git a/src/clients/adjutrix/find_stable_candidates.sr b/src/clients/adjutrix/find_stable_candidates.sr
deleted file mode 100644
index c460b50..0000000
--- a/src/clients/adjutrix/find_stable_candidates.sr
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/usr/bin/env bash
-# vim: set sw=4 sts=4 et :
-
-make_class_SlotsEntry()
-{
- key our_version VersionSpec
- key best_version VersionSpec
-
- allow_named_args
-}
-
-