X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdependencycache.cpp;h=ffc6fd63fbc7291c289395f9230abc78a83378ca;hb=699493ee7346c578537f4e310702c57012686c22;hp=b2ba4e8ce953e9b92bd41d4c66443bf24c749237;hpb=7edb751727a176f58da886c2424d4840a0a910fd;p=builder.git diff --git a/source/dependencycache.cpp b/source/dependencycache.cpp index b2ba4e8..ffc6fd6 100644 --- a/source/dependencycache.cpp +++ b/source/dependencycache.cpp @@ -1,7 +1,7 @@ /* $Id$ This file is part of builder -Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions +Copyright © 2007-2009 Mikko Rasa, Mikkosoft Productions Distributed under the LGPL */ @@ -22,25 +22,21 @@ DependencyCache::DependencyCache(SourcePackage &p): changed(false) { } +void DependencyCache::set_deps(const string &tgt, const StringList &d) +{ + deps[tgt] = d; + changed = true; +} + const StringList &DependencyCache::get_deps(const string &tgt) const { - DepsMap::const_iterator i=deps.find(tgt); + DepsMap::const_iterator i = deps.find(tgt); if(i==deps.end()) throw KeyError("Unknown dependencies", tgt); return i->second; } -void DependencyCache::set_deps(const string &tgt, const StringList &d) -{ - deps[tgt]=d; - changed=true; -} - -/** -Saves the depencency cache. If there are no cached dependencies or they -haven't been changed, does nothing. -*/ void DependencyCache::save() const { if(deps.empty() || !changed || package.get_builder().get_dry_run()) @@ -59,7 +55,7 @@ void DependencyCache::save() const void DependencyCache::load() { - string fn=(package.get_source()/".deps").str(); + string fn = (package.get_source()/".deps").str(); try { @@ -68,11 +64,11 @@ void DependencyCache::load() string line; while(in.getline(line)) { - vector parts=split(line, '|'); - deps[parts[0]]=StringList(parts.begin()+1, parts.end()); + vector parts = split(line, '|'); + deps[parts[0]] = StringList(parts.begin()+1, parts.end()); } - mtime=Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime); + mtime = Time::TimeStamp::from_unixtime(FS::stat(fn).st_mtime); } catch(const IO::FileNotFound &) { }