From 1496723307ed47b60d3116623ba383e85b50efef Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 24 May 2013 15:44:37 +0300 Subject: [PATCH] Remove deprecated features All of these have been deprecated for nearly a year, and I don't have any active projects using them. --- source/builder.cpp | 6 ---- source/builder.h | 1 - source/condition.cpp | 76 ---------------------------------------- source/condition.h | 39 --------------------- source/sourcepackage.cpp | 57 ++---------------------------- source/sourcepackage.h | 5 --- 6 files changed, 2 insertions(+), 182 deletions(-) delete mode 100644 source/condition.cpp delete mode 100644 source/condition.h diff --git a/source/builder.cpp b/source/builder.cpp index 81f4d8e..b73618f 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -300,7 +300,6 @@ Builder::Loader::Loader(Builder &b, const Config::InputOptions *o, bool a): add("architecture", &Loader::architecture); add("binary_package", &Loader::binpkg); add("build_type", &Loader::build_type); - add("profile", &Loader::profile); add("package", &Loader::package); if(!obj.top_loader) @@ -336,11 +335,6 @@ void Builder::Loader::build_type(const string &n) obj.build_type = &i->second; } -void Builder::Loader::profile(const string &) -{ - IO::print("Profiles are deprecated\n"); -} - void Builder::Loader::package(const string &n) { SourcePackage *pkg = new SourcePackage(obj, n, get_source()); diff --git a/source/builder.h b/source/builder.h index 3004ed2..7998a39 100644 --- a/source/builder.h +++ b/source/builder.h @@ -41,7 +41,6 @@ private: void architecture(const std::string &); void binpkg(const std::string &); void build_type(const std::string &); - void profile(const std::string &); void package(const std::string &); }; diff --git a/source/condition.cpp b/source/condition.cpp deleted file mode 100644 index 413870e..0000000 --- a/source/condition.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#include -#include "builder.h" -#include "condition.h" -#include "sourcepackage.h" - -using namespace std; -using namespace Msp; - -Condition::Condition(SourcePackage &p, const string &expr): - pkg(p) -{ - vector parts = split(expr); - - for(vector::iterator i=parts.begin(); i!=parts.end(); ++i) - { - if(*i=="and") - continue; - - string::size_type token = i->find_first_of("=!"); - if(token==string::npos) - expression.insert(Expression::value_type(*i, "=")); - else if(token==0 && (*i)[0]=='!') - expression.insert(Expression::value_type(i->substr(1), "!")); - else - expression.insert(Expression::value_type(i->substr(0, token), i->substr(token))); - } -} - -bool Condition::eval() -{ - const Config &conf = pkg.get_config(); - - bool result = true; - for(Expression::iterator i=expression.begin(); i!=expression.end(); ++i) - { - bool neg = (i->second[0]=='!'); - unsigned start = 1; - if(i->second[1]=='=') - ++start; - string value = i->second.substr(start); - - bool match = false; - if(conf.is_option(i->first)) - { - if(value.empty()) - match = lexical_cast(conf.get_option(i->first).value); - else - match = (conf.get_option(i->first).value==value); - } - else if(i->first=="arch") - match = pkg.get_builder().get_current_arch().match_name(value); - - if(match==neg) - result = false; - } - - return result; -} - - -Condition::Loader::Loader(Condition &c): - DataFile::ObjectLoader(c) -{ - add("require", &Loader::require); - add("build_info", &Loader::build_info); -} - -void Condition::Loader::require(const string &pkg) -{ - obj.requires.push_back(pkg); -} - -void Condition::Loader::build_info() -{ - load_sub(obj.build_info); -} diff --git a/source/condition.h b/source/condition.h deleted file mode 100644 index 0cdc2bb..0000000 --- a/source/condition.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CONDITION_H_ -#define CONDITION_H_ - -#include -#include "buildinfo.h" - -class Config; -class SourcePackage; - -class Condition -{ -public: - class Loader: public Msp::DataFile::ObjectLoader - { - public: - Loader(Condition &); - private: - void require(const std::string &); - void build_info(); - }; - - typedef std::list RequireList; - -private: - typedef std::map Expression; - - SourcePackage &pkg; - Expression expression; - RequireList requires; - BuildInfo build_info; - -public: - Condition(SourcePackage &, const std::string &); - const RequireList &get_requires() const { return requires; } - const BuildInfo &get_build_info() const { return build_info; } - bool eval(); -}; - -#endif diff --git a/source/sourcepackage.cpp b/source/sourcepackage.cpp index faf3bfe..e3f1109 100644 --- a/source/sourcepackage.cpp +++ b/source/sourcepackage.cpp @@ -166,40 +166,21 @@ void SourcePackage::Loader::init(const Config::InputOptions *o) add("description", &SourcePackage::description); add("build_info", &Loader::build_info); add("feature", &Loader::feature); - add("if", &Loader::condition); add("if_feature", &Loader::if_feature); add("program", &Loader::component); add("library", &Loader::component); add("module", &Loader::component); - add("headers", &Loader::headers); add("install", &Loader::component); add("interface_version", &Loader::interface_version); add("datapack", &Loader::component); add("source_tarball", &Loader::source_tarball); add("tarball", &Loader::tarball); - add("tar_file", &Loader::tar_file); add("version", &Loader::version); } void SourcePackage::Loader::finish() { obj.components.sort(component_sort); - - for(map::const_iterator i=install_map.begin(); i!=install_map.end(); ++i) - { - for(ComponentList::iterator j=obj.components.begin(); j!=obj.components.end(); ++j) - { - const Component::SourceList &sources = j->get_sources(); - for(Component::SourceList::const_iterator k=sources.begin(); k!=sources.end(); ++k) - { - string k_str = k->str(); - if(!i->first.compare(0, k_str.size(), k_str)) - { - const_cast(j->get_install_map()).add_mapping(obj.source_dir/i->first, i->second); - } - } - } - } } void SourcePackage::Loader::feature(const string &n, const string &d) @@ -219,14 +200,6 @@ void SourcePackage::Loader::feature(const string &n, const string &d) } } -void SourcePackage::Loader::condition(const string &c) -{ - IO::print("%s: Note: Old-style conditions are deprecated\n", get_source()); - Condition cond(obj, c); - if(cond.eval()) - load_sub_with(*this); -} - template void SourcePackage::Loader::component(const string &n) { @@ -240,16 +213,6 @@ void SourcePackage::Loader::build_info() load_sub(obj.build_info); } -void SourcePackage::Loader::headers(const string &n) -{ - IO::print("%s: Note: headers components are deprecated\n", get_source()); - Component comp(obj, Component::LIBRARY, n); - load_sub(comp); - const Component::SourceList &sources = comp.get_sources(); - for(Component::SourceList::const_iterator i=sources.begin(); i!=sources.end(); ++i) - install_map[i->str()] = "include/"+comp.get_name(); -} - void SourcePackage::Loader::if_feature(const string &cond) { bool match = obj.match_feature(cond); @@ -272,24 +235,8 @@ void SourcePackage::Loader::source_tarball() void SourcePackage::Loader::tarball(const string &n) { - if(n=="@src") - { - IO::print("%s: Note: Use source_tarball instead of tarball \"@src\"\n", get_source()); - load_sub(*obj.source_tarball); - } - else - { - Component trbl(obj, Component::TARBALL, n); - load_sub(trbl); - } -} - -void SourcePackage::Loader::tar_file(const string &f) -{ - IO::print("%s: Note: tar_file is deprecated\n", get_source()); - for(ComponentList::iterator i=obj.components.begin(); i!=obj.components.end(); ++i) - if(i->get_type()==Component::TARBALL && i->get_name()=="@src") - const_cast(i->get_sources()).push_back((obj.source_dir/f).str()); + Component trbl(obj, Component::TARBALL, n); + load_sub(trbl); } void SourcePackage::Loader::version(const string &v) diff --git a/source/sourcepackage.h b/source/sourcepackage.h index e5c3152..1e0e5f9 100644 --- a/source/sourcepackage.h +++ b/source/sourcepackage.h @@ -6,7 +6,6 @@ #include "buildinfo.h" #include "cache.h" #include "component.h" -#include "condition.h" #include "config.h" #include "feature.h" #include "package.h" @@ -32,7 +31,6 @@ public: { private: const Config::InputOptions *options; - std::map install_map; public: Loader(SourcePackage &); @@ -43,14 +41,11 @@ public: void feature(const std::string &, const std::string &); template void component(const std::string &); - void condition(const std::string &); void build_info(); - void headers(const std::string &); void if_feature(const std::string &); void interface_version(const std::string &); void source_tarball(); void tarball(const std::string &); - void tar_file(const std::string &); void version(const std::string &); }; -- 2.45.2